Repository navigation
fix(browser): report complete storage key inventory changes - #2861
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
fe2cc0d to
d360e47
Compare
Reuse the key-coverage propagation and independent fingerprint mapping proposed by chAng-L19 in morluto#2491. Propagate failed or malformed inventories into the canonical completeness ledger before comparing membership; preserve independently proven value changes. Add producer-to-comparison regressions and document recapture requirements.
d360e47 to
e84f52f
Compare
|
Thanks for #2861, @zhangguiping-xydt. Separating complete storage-key inventory changes from the stronger evidence needed to compare values lets keys-only captures report additions and removals without implying equal contents. Preserving partial observations and marking failed inventories unknown is a strong improvement. |
Summary
Fixes #2608. Report proven storage-key additions/removals without requiring content fingerprints, and preserve unknown inventory coverage when a storage read fails or is malformed.
Problem and expected behavior
What Problem This Solves
Capturing complete local/session-storage key inventories before and after adding a key, without opting into content fingerprints, produces
unknownwith zero storage changes. Missing content evidence suppresses an independently established inventory difference.User Impact
compare-web-capturesandcompare_web_capturesretain key additions/removals in keys-only workflows. Comparing identical keys-only captures remainsunknown: this does not establish equal values.Change and scope
Why This Change Was Made
Separate the proof required for inventory membership changes from the stronger proof required for dimension-wide equivalence. Storage supplies its key-inventory completeness to the existing comparator. Content identities are already restricted to mutually comparable fingerprints, so unobserved value changes are not invented. Other dimensions retain the existing default gate.
Storage capture now records unavailable or malformed local/session/IndexedDB/cache inventories in the existing
storage_keyscompleteness ledger. Membership changes require complete inventories on both sides; independently confirmed content modifications remain comparable when an inventory is incomplete. Successful partial observations are retained.This reuses the necessary key-coverage propagation and independent fingerprint mapping proposed by chAng-L19 in #2491, with producer-to-comparison regressions. #2491 alone does not fix the original complete-inventory, unselected-fingerprint case. The browser observation documentation now explains recapturing older exports whose unavailable inventories were recorded as complete.
Contract and boundary impact
webCaptureDiff.ts.Evidence and regression coverage
Evidence
Executed on Linux x64, Node 24.18.0 / npm 11.16.0, Chrome 138.0.7204.157, using the compiled CLI and an actual stdio MCP client.
localStorage.alpha = '1'with empty session storage.node scripts/rea.mjs inspect-web-page <loopback-cdp-endpoint> <target-id> --observation-ms 0 --include-storage-keys --format json. Do not enable fingerprints. Save{ "inspection": <normalized_result> }asbefore.json.localStorage.beta = '2'andsessionStorage.draft = 'saved'. Capture again asafter.json; an independent browser read confirms the exact keys.node scripts/rea.mjs compare-web-captures before.json after.json --format json, then reverse the inputs and compareafter.jsonwith itself.inspect_web_pageover stdio MCP (include_storage_keys: true) and comparison withcompare_web_captures. The comparison consumes the actual normalized captures; no coverage flags, usage/quota values, or inventories are rewritten.cbe769bbetaand sessiondraftaddedThe comparator is unchanged between live-before
cbe769band branch base6e25cc3. The new boundary regression fails on the unmodified comparator (1 failed / 14 passed). It additionally covers IndexedDB/cache name inventories, missing quota, and incomplete-inventory negative controls in both directions. Existing fingerprint/value/unknown controls remain covered.Review regression: unread keys must not appear deleted
Addresses the P1 review. On real isolated Chrome, a local WebSocket forwarding proxy injects CDP
-32601only forDOMStorage.getDOMStorageItems; all other requests reach the browser normally. This is controlled protocol failure injection, not a claim that unmodified Chrome naturally emits this error.stable-localand sessionstable-session; capture the successful inventories through the compiled CLI and stdio MCP.dd0ac6ce10c8a610storage_keys/provider_unavailableThe producer-to-comparison regressions first failed 4 tests before coverage propagation. A separate regression failed when incomplete inventories suppressed proven fingerprint modifications. The final suite covers unavailable and malformed reads for all four inventory sources, both comparison directions, retained partial keys, complete fingerprints, and incomplete-fingerprint negative controls.
Validation performed
Current revision
e10c8a610a15bae2ae424873532aa43ed50cf159(Linux, pinned Node.js 24.18.0/npm 11.16.0):npm run check— passed, including repository-wide formatting, typecheck, lint/module boundaries, knip, metadata and architecture guards.npm run docs:check— passed, including 5 documentation consistency tests.The earlier shared CI failures were repaired by integrating main through
f1045001f, including #2895 (static checks) and #2910 (portable DEX regex and isolated Linux process inventory). The remaining complete-facet reconstruction fixture correction is reused from #2853; the pinned formatter was applied to the process inventory code introduced by #2910. No assertions or CI gates were removed, and process-observation permission behavior remains unchanged.Before these repairs, the three affected suites failed 7 tests on unmodified main
1b6c899b0. The shared repairs passed 120 tests across reconstruction, function comparison, advertised schema patterns and the live Linux process fixture. Each PR's own workflow was then checked separately on its final revision above. The locked duplicate scanner was also run directly using its same-versionjscpd-linux-x64-musl5.0.12 binary because the GNU binary requires newer glibc: all five revisions are below 2.94% duplicated lines, within the unchanged 3.5% threshold.npm run scan:todosalso passed. Remote CI continues to use its normal GNU binary.Remote CI for this revision is being checked separately; passing local verification is not a claim that queued GitHub checks have passed.
Compatibility, safety, and release
No schema, dependency, capture-authority, or release changes. What was not tested: other OS/browser versions, the published package, and the full browser verifier. Real-browser changes cover local/session storage; IndexedDB/cache inventory changes are boundary fixtures. No private application data or credentials are used.
Before merge