Repository navigation
Store large values in parts that AdGuard keeps (6.13.1) - #25
Conversation
AdGuard sends each GM_setValue to its app as one request with the value URL-encoded in it, and drops a value too large for that request without telling the script, while the writing page still reads it back. Past a few hundred visits the history survived no page load at all, so every page downloaded it again with "Restored N visited URLs". Values larger than the device keeps are stored as parts under that size, plus a pointer written last; a value with a missing part reads as missing. Each tab trims the part sets it replaced (keeping two), and parts nothing refers to are removed 30 minutes after they were written. The device's limit is measured with probe values (2/8/32/128 KB) judged on the next page load, and shown in the panel; until known, parts are about 6 KB. The harness gains maxEncodedValue (JVS_VALUE_LIMIT) to model this; under an 8 KB limit 6.13.0 fails 12 tests and this passes all 144. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCuhK4TQqcEbLXdmxLjggy
P1 orphaned history copies per page load, P2 leaked probe values, P3 missing part wipes history despite kept previous set, P4 click-navigate lands pointer before parts, P5 JSON-encoded size exceeds measured limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCuhK4TQqcEbLXdmxLjggy
Review found that a page usually saved the history once, so replaced part sets lingered 30 minutes (a full copy per page load); that one missing part made the next save write a near-empty history over a complete previous set; that an unordered or interrupted upload could land the pointer without its parts; that encoded size was measured more loosely than AdGuard may count it; and that tabs probing together leaked probe values. - Pointers name the previous complete set; readers fall back to it, and a history found incomplete but recent is not written over. - Parts are cut at 80% of the measured limit, counted JSON-then-URL encoded; the pointer waits for parts to arrive; saves not made by a sync pause before writing parts, so a page being left writes none. - Tabs trim the set before the one they replaced; unreferenced parts go after two minutes; retirement also runs after main saves. - Queued saves coalesce, so a burst of clicks costs one or two saves. - Fixed probe keys, cleared by the judging page; last limit kept while re-measuring; a floor when nothing was kept. - A save stopped by leaving the page is not reported as a failure. Adds the review's tests (review-parts.test.mjs) and a test for leaving mid-save; 150/150 pass with and without an 8 KB value limit and with the dotted GM API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCuhK4TQqcEbLXdmxLjggy
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Workers Builds: javstore-sync fails on this PR, but not because of this change.
Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce896bd5e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
A page that read the previous part set because the newest one was missing a part did not count the value as incomplete, so its next save could replace the pointer before the late part landed and drop the visits only the newest set held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCuhK4TQqcEbLXdmxLjggy
Why
On AdGuard for Mac, "Restored N visited URLs from the worker" still appeared on every page load with 6.13.0, and each page downloaded the whole history again.
AdGuard sends each
GM_setValueto its app as one request, with the value URL-encoded in it. A value too large for that request is not kept, and the script is not told: the writing page still reads it back from its own copy. Once the history passed a few hundred visits it survived no page load at all. Small values, such as the sync settings and session record, were kept, which is why the failure looked like something else.What changes
Testing
maxEncodedValue(JVS_VALUE_LIMIT), modelling a manager that drops oversized values while the writing tab still reads them back.npm test,JVS_DOTTED=1,JVS_VALUE_LIMIT=8000, and both together.tests/storage-size.test.mjsand the review'stests/review-parts.test.mjs(P1–P5: storage bloat, probe leaks, missing-part fallback, interrupted upload, JSON-encoded size).Generated by Claude Code