REL-NB-004 — Scope autosave state to each notebook
| Field | Value |
|---|---|
| Status | Open; source-verified and output autosave happy path tested |
| Architecture state | Source-backed current behavior |
| Severity | Critical |
| Affected surface | Multiple tabs, background execution output, autosave, and refresh |
| Components | sparqd/oqullus |
| Associated issue | oqullus #518 |
Where the problem appears
Edit or execute notebook A, switch to notebook B before autosave runs, and then inspect which notebook was written and which dirty state was cleared.
Concrete observed case
Workspace holds one provider-level dirty flag and revision counter. The later save serializes the current active tab rather than the tab that became dirty. Background execution output follows the same shared path.
Expected condition
Each canonical notebook has independent dirty, saved, saving, and failed revisions. A queued save remains bound to that document and snapshot regardless of active-tab changes.
Cause and evidence
Dirty state is global, while save target resolution happens later from the current active tab. Execution output does not consistently set the affected tab's visible dirty indicator.
Why it matters
One notebook can remain unsaved while another is overwritten and the shared guard is cleared. Refresh can then discard the intended edit or output.
Existing controls and workarounds
Remain on one notebook until save completes and manually verify the saved indicator before switching. This does not protect background completion.
Alternatives considered
- Recommended: per-notebook revisions and
saveTaboperations bound to ID, snapshot, and expected server version. - Lock tab switching during save — rejected because it harms normal notebook use and does not solve background changes.
- Keep one global dirty flag — rejected because it cannot represent multiple documents.
Component involvement
sparqd/oqullusowns per-notebook dirty/save state, snapshot binding, background-output targeting, and navigation guards.
Reproduction and verification
Resolution conditions
Close when edits and output in multiple tabs save only their originating notebook, independent statuses remain correct, and refresh restores both.
Validation and blockers
The shared-state source path is confirmed. Deployed two-tab request evidence is pending.