[PR #5035] [MERGED] fix(browser): ignore scenario storage enumeration order #6748

Closed
opened 2026-11-01 21:42:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5035
Author: @Vaishnavi220506
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @morluto

Base: main ← Head: fix/scenario-storage-order


📝 Commits (3)

  • e0d993e fix(browser): ignore scenario storage enumeration order
  • 98d4617 perf(browser): sort storage entries without serialized copies
  • 9af5848 style(browser): format storage normalization comparator

📊 Changes

6 files changed (+230 additions, -3 deletions)

View changed files

📝 docs/browser-scenario-contract.md (+9 -0)
📝 src/domain/browserScenarioDiff.test.ts (+118 -0)
📝 src/domain/browserScenarioDiff.ts (+1 -1)
📝 src/domain/browserScenarioDiffValues.ts (+1 -0)
📝 src/domain/browserScenarioNormalization.ts (+53 -2)
📝 tests/boundary/cli/browserCli.test.ts (+48 -0)

📄 Description

Summary

Browser scenario comparison treated storage enumeration order as a change. The same cookies and storage records could therefore produce changed when returned in a different order. Storage inventories now compare deterministically while retaining meaningful record differences.

Change and evidence

Normalization sorts parsed storage fields directly instead of retaining a full canonical JSON string for every record. It preserves duplicate entries, normalized values, cookie attributes, and permutation-invariant order; the normalization commitment records this behavior. No arbitrary cardinality cap was added because the contract has no existing bound and a new cap would make evidence incomplete.

  • The domain regression passes for cookies, local storage, and session storage, including duplicates and changed attributes (21 tests).
  • On Node 24.18.0/npm 11.16.0, this pass executed npm run test:local -- src/domain/browserScenarioDiff.test.ts (21 passed), typecheck, lint and cached npm run check:fast on the semantic fix. The final commit changes formatting only; its formatting check and check:fast passed.
  • Exact-head hosted Source tests, Static checks and Docs Generation passed at the latest query. Earlier body claims about a 12-case CLI comparison, compilation and local docs checks were not independently repeated or pinned to this head, so they are not used as current validation evidence.

A representative completed domain comparison used 20,000 local-storage records on each side, mirrored across two scenario steps, and ran three comparisons per process. All results were unchanged. Baseline: 706 ms elapsed, 690 ms CPU, 300,960 KB peak RSS (one run). Direct-field sort: 194–648 ms elapsed, 233–382 ms CPU, 183,552–198,896 KB peak RSS (four runs). The sample is small and wall time varies; it suggests lower CPU and peak RSS but does not establish a precise speedup. Whole CLI/MCP/provider latency and model or agent token cost were not measured; fixture construction and validation were outside the timed interval.

Scope and limitations

This changes only normalization immediately before browser scenario comparison. Capture, Evidence provenance, schemas, providers, and target behavior are unchanged. No provider or CLI process was executed for the cost comparison. Hosted checks still pending at the recorded query are not treated as passed.

Author readiness

Human owner: @Vaishnavi220506

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5035 **Author:** [@Vaishnavi220506](https://github.com/Vaishnavi220506) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/scenario-storage-order` --- ### 📝 Commits (3) - [`e0d993e`](https://github.com/morluto/rea/commit/e0d993ea92c27ebdf57a62ed106639b09c047194) fix(browser): ignore scenario storage enumeration order - [`98d4617`](https://github.com/morluto/rea/commit/98d461751944ba16a67f178df17fd7afe73679e0) perf(browser): sort storage entries without serialized copies - [`9af5848`](https://github.com/morluto/rea/commit/9af5848de8b36fbc0c0b5f06ebb3a5f59f80a50e) style(browser): format storage normalization comparator ### 📊 Changes **6 files changed** (+230 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/browser-scenario-contract.md` (+9 -0) 📝 `src/domain/browserScenarioDiff.test.ts` (+118 -0) 📝 `src/domain/browserScenarioDiff.ts` (+1 -1) 📝 `src/domain/browserScenarioDiffValues.ts` (+1 -0) 📝 `src/domain/browserScenarioNormalization.ts` (+53 -2) 📝 `tests/boundary/cli/browserCli.test.ts` (+48 -0) </details> ### 📄 Description ## Summary Browser scenario comparison treated storage enumeration order as a change. The same cookies and storage records could therefore produce `changed` when returned in a different order. Storage inventories now compare deterministically while retaining meaningful record differences. ## Change and evidence Normalization sorts parsed storage fields directly instead of retaining a full canonical JSON string for every record. It preserves duplicate entries, normalized values, cookie attributes, and permutation-invariant order; the normalization commitment records this behavior. No arbitrary cardinality cap was added because the contract has no existing bound and a new cap would make evidence incomplete. - The domain regression passes for cookies, local storage, and session storage, including duplicates and changed attributes (21 tests). - On Node 24.18.0/npm 11.16.0, this pass executed `npm run test:local -- src/domain/browserScenarioDiff.test.ts` (21 passed), typecheck, lint and cached `npm run check:fast` on the semantic fix. The final commit changes formatting only; its formatting check and `check:fast` passed. - Exact-head hosted Source tests, Static checks and Docs Generation passed at the latest query. Earlier body claims about a 12-case CLI comparison, compilation and local docs checks were not independently repeated or pinned to this head, so they are not used as current validation evidence. A representative completed domain comparison used 20,000 local-storage records on each side, mirrored across two scenario steps, and ran three comparisons per process. All results were `unchanged`. Baseline: 706 ms elapsed, 690 ms CPU, 300,960 KB peak RSS (one run). Direct-field sort: 194–648 ms elapsed, 233–382 ms CPU, 183,552–198,896 KB peak RSS (four runs). The sample is small and wall time varies; it suggests lower CPU and peak RSS but does not establish a precise speedup. Whole CLI/MCP/provider latency and model or agent token cost were not measured; fixture construction and validation were outside the timed interval. ## Scope and limitations This changes only normalization immediately before browser scenario comparison. Capture, Evidence provenance, schemas, providers, and target behavior are unchanged. No provider or CLI process was executed for the cost comparison. Hosted checks still pending at the recorded query are not treated as passed. ## Author readiness Human owner: @Vaishnavi220506 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:42:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6748
No description provided.