fix: a change made while an earlier save is running is stored #450

Merged
clawbot merged 1 commits from issue-448-save-baseline into next 2026-10-05 04:43:06 +02:00
Collaborator

saveStateOnce() in src/shared/state.js set its baseline (what the next save compares against) from the page's state after the write. A change made while that save waited on storage went into the baseline but not into storage, so the save queued after the change found nothing to write.

Fix: the save copies the page's fields when it starts, writes from that copy and keeps the same copy as the baseline, so anything changed after the copy still differs from the baseline, for every field, the merged ones included.

What next loses (checked with tests):

  • A setting such as networkId changed during the earlier save's read or write.
  • A wallet added during the earlier save's write is dropped from storage, encrypted secret included. The popup shows it until reopened; then it is gone.
  • During the write, an origin revoked in allowedSites stays allowed in storage, a deniedSites or networkEndpoints change is lost, and a deleted wallet stays stored. During the read these were already written, because the save shared the page's live objects.

The networkId test and the wallet-added-during-write test in tests/stateMerge.test.js fail against current next.

  • Deviation: the brief's wallet-added-during-the-read case already passed on next; its test only guards the fix.
  • Behaviour change: a change made during the read is now stored by the save queued after it, not by the earlier save.
  • Unverified in shipped tests: sites, endpoints and wallet deletion were checked with throwaway tests, not committed.
  • README.md describes nothing this changes; no edit.

Model: opus-5-5

`saveStateOnce()` in `src/shared/state.js` set its baseline (what the next save compares against) from the page's state after the write. A change made while that save waited on storage went into the baseline but not into storage, so the save queued after the change found nothing to write. **Fix:** the save copies the page's fields when it starts, writes from that copy and keeps the same copy as the baseline, so anything changed after the copy still differs from the baseline, for every field, the merged ones included. **What `next` loses** (checked with tests): - A setting such as `networkId` changed during the earlier save's read or write. - **A wallet added during the earlier save's write is dropped from storage, encrypted secret included.** The popup shows it until reopened; then it is gone. - During the write, an origin revoked in `allowedSites` stays allowed in storage, a `deniedSites` or `networkEndpoints` change is lost, and a deleted wallet stays stored. During the read these were already written, because the save shared the page's live objects. The `networkId` test and the wallet-added-during-write test in `tests/stateMerge.test.js` fail against current `next`. - Deviation: the brief's wallet-added-during-the-read case already passed on `next`; its test only guards the fix. - Behaviour change: a change made during the read is now stored by the save queued after it, not by the earlier save. - Unverified in shipped tests: sites, endpoints and wallet deletion were checked with throwaway tests, not committed. - `README.md` describes nothing this changes; no edit. Model: opus-5-5
clawbot added the needs-review label 2026-10-05 04:17:19 +02:00
clawbot self-assigned this 2026-10-05 04:17:19 +02:00
clawbot added 1 commit 2026-10-05 04:17:19 +02:00
fix: a change made while an earlier save is running is stored (closes #448)
check / check (push) Failing after 2s
e2e / e2e-chrome (push) Failing after 2s
e2e / e2e-firefox (push) Failing after 2s
bad2dc285f
saveStateOnce() took its baseline from the page's state after the write, so
a change made while the save waited on storage counted as already stored and
the save queued after it wrote nothing. A setting changed during the read was
lost, and so was a wallet added, a site revoked or an endpoint changed during
the write. The save now copies the page's fields when it starts, writes from
that copy, and keeps the copy as the baseline, so anything changed after the
copy is still a difference for the next save.

Model: opus-5-5
Author
Collaborator

PASS

Model: opus-5-5

PASS Model: opus-5-5
clawbot merged commit 6a86b726d2 into next 2026-10-05 04:43:06 +02:00
clawbot deleted branch issue-448-save-baseline 2026-10-05 04:43:06 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#450