Repository navigation
Make the worker's visited history append-only (6.10.0) - #19
Conversation
The worker applied every removal a device sent and deleted the rows: one clear, retention cutoff, unmark or backup import on any device wiped those visits from the worker and every other device. It now ignores visit tombstones and the resetAt/prunedBefore horizons, reports both horizons as 0, and lets a visit outrank a visit tombstone an older worker stored. Those actions now apply only to the device they happen on. The 50,000-visit archive cap and override removals are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BGAYvSDCqQt1R7AerUwSeT
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 466ae84ac6
ℹ️ 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".
| const kept = syncConfigured() | ||
| ? 'Only this device is cleared: your sync worker and other devices keep their copies.' | ||
| : 'This cannot be undone unless you exported a backup.'; |
There was a problem hiding this comment.
Warn before clearing through an older worker
When sync is configured but the worker has not yet been redeployed to 6.10.0, this confirmation falsely promises that the worker and other devices will keep their copies. The clear still sends the new resetAt through persistState(), and a pre-6.10 worker applies that horizon by deleting its visits and propagating the clear globally. Only show this reassurance after confirming a worker version with append-only behavior; otherwise warn that clearing may affect every device or require redeployment first.
Useful? React with 👍 / 👎.
| // A visit tombstone a worker from before 6.10.0 stored never outranks a visit. | ||
| const buried = kind === 'v' && existing.deleted; | ||
| const wins = buried || at > existing.at || (at === existing.at && deleted && !existing.deleted); |
There was a problem hiding this comment.
Do not return pre-upgrade visit tombstones
When an upgraded Durable Object contains a visit tombstone from the old worker, sync() captures that tombstone in ahead before this branch replaces it with an incoming visit. A recovering device with an earlier cursor can therefore upload its retained visit, receive the obsolete tombstone in the same response, delete its local copy, and then record the cursor for the replacement sequence, so the worker's restored visit is never downloaded. Suppress legacy visit tombstones from responses or replace the captured row with the newly stored visit.
Useful? React with 👍 / 👎.
Problem
The worker applied every removal a device sent and hard-deleted the rows. One Clear visited history, one retention setting above 0, one unmarked card or one import of an older backup, on any device, wiped those visits from the worker and from every other device. The only way back was an exported backup.
Change
resetAt/prunedBeforehorizons from devices, and reports both horizons as 0.Tests
Six tests rewritten or added for the new behaviour: unmark, clear (including a full re-download afterwards), import, the worker ignoring deletions and horizons (delta and 6.2.0 whole-document paths), and data left by an older worker. All six fail against the old worker. Full suite: 77/77 passing.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BGAYvSDCqQt1R7AerUwSeT
Generated by Claude Code