(restore): retry the cold-cache restore until indexing is done, not once - #263
Merged
Conversation
createRestorePlanner replaces the one-shot defer/retry flags: it ticks on every projects-changed/indexing-progress event, restoring sessions incrementally as they get indexed (auto mode) or asking once the full picture is known (ask mode), instead of consuming its only retry on the first partially-populated sessionMap.
Merged
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.
Audit 2026-09-11, finding 5 (
.work-files/switchboard/audit-fable-2026-09-11.md, local note); follows #239.Why
On a cold start
populateCacheViaWorkerfillssessionMapone folder at a time. The single retry introduced by #239 fired on the first partialprojects-changed: it restored whatever was indexed by then and never came back for the rest, or gave up when nothing was indexed yet. Its test was a replica of the app.js orchestration and never modelled a partial map.What
public/restore-plan.js:createRestorePlanner({ savedSet, maxTicks, askOnce })— a pure planner that tracks the saved ids still missing across ticks.autorestores incrementally as sessions get indexed and keeps waiting until every id is indexed or indexing reports done (then the rest is treated as deleted);askasks once, with the final picture. Dismiss, a tick cap and a session opened outside the restore all settle it.public/app.js: one planner per startup, ticked from the existingloadProjects()call sites and fromupdateIndexingBanneronpayload.done; the two retry flags are gone.test/session-restore-cold-cache.test.jsrewritten against the real module: partial map, none indexed, done-with-missing, cap, dismiss, outside open, already open, askOnce variants, plus one wiring check.Proof
Mutations: mark everything restored on the first restore → partial-map test red; make
waitignoreindexingDone→ deleted-sessions test red.task check: 1141 + 119 pass, 0 fail, 8 pre-existing skips.