Skip to content

feat: Studio sessions — autosave, resume and session list (Phase 2, sessions PR 2/2) - #12

Merged
andrecoliveira merged 7 commits into
mainfrom
feat/studio-sessions
Nov 16, 2026
Merged

andrecoliveira merged 7 commits into
mainfrom
feat/studio-sessions

Conversation

@andrecoliveira

Copy link
Copy Markdown
Owner

Outcome

PR 2 of 2 for the Phase 2 sessions slice (spec; plan). The Studio now uses the local session store from #11.

  • Autosave: the Sandbox saves 750 ms after you stop editing.
    • A header indicator shows All changes saved, Saving… or Not saved (with a Retry button).
    • On page hide or exit, pending edits are flushed with keepalive, for bodies up to 60 KB.
    • The initial render is never saved, so an unedited launch leaves no session.
  • Sessions panel: a keyboard-accessible dialog that lists sessions newest first, with A/B and Architecture changed badges. From it you can Resume (in place), Rename, Delete (with in-panel confirmation) or start a New session.
  • Changed architecture: a resumed session renders its stored base view with a notice, and a button starts a new session on the current graph.
  • Safety:
    • Refresh, resume and new-session flush pending edits first, and cancel the switch if that save fails.
    • A session deleted elsewhere stops autosave with a reload prompt.
    • An unrestorable stored Sandbox halts autosave instead of being overwritten.
  • CLI: archwise --serve --resume latest|SESSION_ID. A miss exits 2 with "Run --sessions" and starts no server. SessionService.startNew and POST /api/v1/sessions/new back the New session action.
  • Browser storage: localStorage is retired for Sandbox state, and the unused key helper is removed.
  • Docs: sessions guide, Sandbox persistence, scenario comparison, Alpha guide, Browser QA, roadmap (Phase 2 status), README, the web and CLI READMEs, and a changeset.

Verification

  • pnpm check: 364 Vitest + 17 Node integration tests pass, and svelte-check reports 0 errors and 0 warnings.
  • Real Chrome smoke (scripts/browser-smoke.mjs, run locally):
    • autosave, and reload restoring from the store;
    • cross-launch resume after the project changed, restoring the byte-identical document, with the notice shown;
    • a hostile HTML label rendered as text;
    • deleting the open session;
    • no catalog replay on New session;
    • an edit just before Refresh being saved;
    • keyboard open, Escape and focus return on the panel;
    • an unrestorable session not being overwritten.
  • Independent whole-branch review: 1 Critical, 3 Important and 5 Minor, all fixed. Each fix has a test, and two were upgraded to Important by effect.
    • Critical: a remount replayed the last catalog addition into resumed or new sessions.
    • Important: an edit lost on Refresh; a queued edit lost on switch; a switch proceeding after a failed save.

Review notes

  • Security/privacy impact and offline behavior:
    • No new server surface beyond POST /api/v1/sessions/new, which requires the capability and the same origin.
    • Labels render as text.
    • Everything stays local.
  • Public contracts, migrations, and compatibility impact:
    • The archwise-sandbox v1 format is unchanged.
    • Sandboxes stored only in the browser by older builds are no longer read; the documented migration path is JSON export and import.
  • Documentation or ADR updates: included in this PR. They describe the real multi-tab behavior (last write wins; only deletion is detected) and the 60 KB keepalive limit.
  • Screenshots or accessibility evidence for UI changes: the panel is keyboard-operable and focus management is asserted in the browser smoke. A visual design review is still manual.
  • Parent PR, if this change is stacked: none.

Checklist

  • The change has one coherent scope.
  • New contribution commits include my DCO Signed-off-by trailer.
  • Relevant tests or documentation checks were run.
  • No secrets, private fixtures, or machine-specific paths are included.
  • Implemented behavior is distinguished from future proposals.

🤖 Generated with Claude Code

andrecoliveira and others added 7 commits November 15, 2026 21:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
Document autosave, the Sessions panel, resume, the changed-architecture
notice, --resume, the single-tab rule and the retirement of browser
localStorage. Update the roadmap, README, Alpha guide, Browser QA,
Sandbox persistence and scenario comparison. Remove the unused
localStorage key helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
- A remounted canvas no longer replays the last catalog addition into the
  next session (it was saved into resumed or new sessions).
- Refresh, resume and new-session flush pending edits first and cancel the
  switch if saving fails. Flush now waits for an in-flight save and then
  saves queued changes.
- An unrestorable stored Sandbox halts autosave instead of being overwritten.
- Keepalive is used only for bodies under 60 KB, which browsers accept on
  page exit.
- The Sessions panel moves focus in on open and returns it on close.
  Escape in the rename field cancels only the rename, and Delete focuses
  its confirmation.
- Accurate rename errors and conflict text. Docs state the real multi-tab
  behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: André Oliveira <coliveira.andre@gmail.com>
@andrecoliveira
andrecoliveira merged commit 7155316 into main Nov 16, 2026
12 checks passed
@andrecoliveira
andrecoliveira deleted the feat/studio-sessions branch November 16, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant