Context Boundary
- Repo/module:
talkincode/GameKit, IndexedDB autosave in src/studio/store.tsx and src/lib/storage.ts
- Version/commit:
main, 9eb811e7bc3db3193b57609425723c478e438d32
- Runtime: browser UI with a 350 ms debounced write
- OS/browser: not recorded; source-level path
- Dependencies/config: IndexedDB; no feature flag involved
Expectation vs. Reality
Expected: Switching projects does not discard dirty edits, and the UI reports Saved only after the IndexedDB transaction has committed.
Actual: The autosave effect schedules saveProject after 350 ms and clears that timer in its cleanup. Switching projects changes the project dependency, so the previous project's pending timer is cancelled without flushing the edit. In addition, saveProject resolves on the individual put request's success rather than waiting for the transaction's complete event, so the save indicator does not explicitly represent transaction commit.
Reproduction Path
- Open a project and change a file.
- Before the 350 ms debounce finishes (while the UI says Saving), immediately open another project.
- Reopen the original project or reload GameKit and inspect the file.
- To verify commit semantics, exercise a test IndexedDB transaction that succeeds at request level but aborts before commit; ensure the UI never reports Saved for it.
Minimal reproduction: edit A, start the autosave timer, switch to B before it fires, then reload A from IndexedDB.
Blast Radius
- Affected users/paths: recent edits made immediately before switching projects or leaving the page; failed/aborted IndexedDB writes.
- Frequency: navigation inside the debounce window, or a transaction that aborts after its request callback.
- Severity rationale: silent loss of the most recent edit and a potentially premature Saved state; recommend P1 for project data durability.
- Workaround: wait until the save indicator shows Saved before switching projects.
Evidence
Context Boundary
talkincode/GameKit, IndexedDB autosave insrc/studio/store.tsxandsrc/lib/storage.tsmain,9eb811e7bc3db3193b57609425723c478e438d32Expectation vs. Reality
Expected: Switching projects does not discard dirty edits, and the UI reports Saved only after the IndexedDB transaction has committed.
Actual: The autosave effect schedules
saveProjectafter 350 ms and clears that timer in its cleanup. Switching projects changes theprojectdependency, so the previous project's pending timer is cancelled without flushing the edit. In addition,saveProjectresolves on the individualputrequest's success rather than waiting for the transaction'scompleteevent, so the save indicator does not explicitly represent transaction commit.Reproduction Path
Minimal reproduction: edit A, start the autosave timer, switch to B before it fires, then reload A from IndexedDB.
Blast Radius
Evidence