fix: prevent stale header rules with versioned storage meta#88
Open
fix: prevent stale header rules with versioned storage meta#88
Conversation
🤖 Pull request artifacts
|
13f91af to
1585555
Compare
1585555 to
c7d6752
Compare
c7d6752 to
92e9ea1
Compare
92e9ea1 to
386a76a
Compare
- Add retry logic (3 attempts with exponential backoff) for transient
DNR updateDynamicRules errors ("Internal error while updating dynamic rules")
- Re-throw errors from setBrowserHeaders to prevent queue state from updating
when rules fail to apply
- Add detailed diagnostic logging for debugging header toggle issues
Co-authored-by: Cursor <cursoragent@cursor.com>
386a76a to
3c192ee
Compare
…ggle Route all startup/install applies through the queue fallback path and serialize diagnostic payloads as stable JSON strings to simplify production incident analysis Add an opt-in UI toggle that mirrors extension logs into the active page console for faster user-side debugging
…sed self-healing for long-running apply drift and expose a user-triggered debug log export so support can collect worker health storage state DNR snapshots and recent logs in a single file Also temporarily comment out CI e2e container commands while race diagnostics are in progress
4b9e608 to
f564bb9
Compare
…y on every background worker boot so DNR rules are immediately synced with storage after sleep/unlock style restarts Add an e2e regression that injects a stale rule reloads the extension and verifies stale rules are cleared when headers are disabled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Исправляет Windows-специфичную гонку, когда при переключении вкладок и редактировании заголовков могли применяться устаревшие значения (старый снапшот из storage), перезаписывая актуальную конфигурацию.
Changes
declarativeNetRequest.updateDynamicRules({ removeRuleIds, addRules })одним вызовом, чтобы избежать гонки remove→add.headersConfigMetaV1(seq, монотонныйupdatedAt) и в background пропускаем устаревшие снапшоты, даже если события приходят не по порядку.tabs.onActivatedтолько увеличивала вероятность гонок.updateOverrideHeaders/runtime reload message; обновления теперь идут черезstorage.onChanged.Why this works
На Windows из-за другой латентности и планирования событий чаще происходили перекрывающиеся триггеры применения правил. Версионирование + очередь не позволяют применить старую конфигурацию “после” новой.
Test plan
pnpm test:unitApply skipped (stale meta)), а применения идут последовательно.Notes
seq— best-effort при конкурентных записях;updatedAtпринудительно монотонный и используется как tie-breaker.