fix: recover valid Today edits from corrupt queue
CI / lint (pull_request) Successful in 2m43s
CI / build-release (pull_request) Successful in 8s
CI / browser-journey (pull_request) Failing after 2m21s
CI / release-candidate (pull_request) Has been skipped

Closes #1042
This commit is contained in:
timmy committed 2026-08-17 21:26:40 +00:00
1 parent 66968d90c0
commit a6550f8b1f
4 files changed
+94 -11

No files matched your search

@@ -159,6 +159,26 @@ def test_release_artifact_plans_hands_off_and_opens_next_mobile_issue(tmp_path:
today = page.evaluate("JSON.parse(localStorage.getItem('stackchain.today-work.v1.timmy') || '[]')")
assert today == ["issue:acme/mobile:41:", "issue:acme/mobile:42:"]
page.evaluate("""() => {
const prefix = 'stackchain.today-sync.v1.timmy.operation.';
const snapshot = JSON.parse(localStorage.getItem('stackchain.today-sync-snapshot.v1.timmy') || '{}');
localStorage.setItem(prefix + 'broken', '{not-json');
localStorage.setItem(prefix + 'recover-remove', JSON.stringify({
queued_at: Date.now(),
operation: {
operation_id: 'recover-remove', action: 'remove',
item_id: 'issue:acme/mobile:42:', direction: null, base_revision: snapshot.revision,
},
}));
}""")
page.reload(wait_until="networkidle")
expect(page.locator("#today-sync-status")).to_have_text(
"Recovered 1 Today edit · discarded 1 unreadable device record."
)
assert page.evaluate("""() => !Object.keys(localStorage).some(
key => key.startsWith('stackchain.today-sync.v1.timmy.operation.')
)""")
assert page.evaluate("document.documentElement.scrollWidth <= window.innerWidth")
assert browser_errors == []
assert failed_responses == []