Repository navigation
fix(id/web): cancel() disposes AutoSaveManager — no saves after editor close (#2437) - #5042
Conversation
… or indicator writes after close (#2437)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex disposition (task 7942, lane code-o): the Codex code review on |
|
Salvage note (protocol §8) — duplicate PR #3434 diffed against this merged PR: PR #3434 ( |
Fixes #2437.
AutoSaveManager.cancel()cleared timers but did nothing about a save already in flight: its completion could schedule a rate-limit retry, run the coalesced follow-up save, and write the shared#save-btnindicator — all after the editor closed and the manager was dropped. BecausesaveFile()resolves its target from live app state, that post-cancel save acts on the newly opened document and breaks the #1440 one-save-in-flight serialization.Change (manager lifecycle only — no
main.tschange needed)disposedflag, set at the top ofcancel().onSaveResult()returns immediately when disposed: a completing in-flight save schedules nothing, flips no state, and writes no indicator.triggerSave()returns immediately when disposed, so any timer callback or completion path still queued at cancel time can never start a save.Tests (
pkgs/id/web/src/auto-save.test.ts, fake timers + deferred saveFn, mirroring the issue's probe)idle, zero indicator writes after cancel.Verification
bunx vitest run src/auto-save.test.ts— 10/10 pass (7 pre-existing id(web): AutoSaveManager runs concurrent saves and a stale completion marks newer edits saved #1440/id(web): AutoSaveManager's generic-error path drops a coalesced follow-up — an edit made during a failed save is never autosaved #1616/id(web): SaveRateLimiter check/record race — overlapping saves of one file both pass the cooldown, and the slower save wins the filename tag #2466 tests unchanged and green).Queue: task 7942 (repo-health-code-pilot), lane code-o.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.