Repository navigation
Download history again when a device loses it but keeps its cursor (6.9.1) - #18
Merged
Merged
Conversation
….9.1) The sync cursor and the visited history live under separate storage keys. When a userscript manager lost only the history, the device kept asking the worker for rows after its cursor and never got the lost ones back. The history now carries an id that the sync config records alongside the cursor; a history without the matching id pulls from cursor 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BGAYvSDCqQt1R7AerUwSeT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The visited history and the sync bookmark (
cursor, injavstore_sync_config_v1) are stored under separate keys. When a userscript manager lost only the history, the device kept asking the worker for rows after its cursor, so the history it lost was never sent back. Seen in practice: 5 visits on the device and 435 on the worker, with the panel showing "synced just now".Fix
historyId. The sync config records the ID its cursor belongs to.The worker code is unchanged;
WORKER_VERSIONmoves with the script because a test requires them to match.Tests
Three new sync tests, all failing on the old script and passing now: a lost history with its cursor kept, a visit recorded after the loss, and a device synced by an older version (full download once, then deltas). Full suite: 75/75 passing.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BGAYvSDCqQt1R7AerUwSeT
Generated by Claude Code