Skip to content

feat(#512): restore dirty documents after OAuth reauthentication (phase 3) - #527

Merged
BorisTyshkevich merged 2 commits into
mainfrom
feat/oauth-document-recovery-512p3
Jul 28, 2026
Merged

feat(#512): restore dirty documents after OAuth reauthentication (phase 3)#527
BorisTyshkevich merged 2 commits into
mainfrom
feat/oauth-document-recovery-512p3

Conversation

@BorisTyshkevich

@BorisTyshkevich BorisTyshkevich commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

What & why

Closes #512

This final Phase 3 PR completes the architecture adopted across #512:

The checkpoint intentionally contains authored document state only: tab order/identity and bindings, SQL and raw Spec drafts, editor mode, dirty flags, and reconciliation metadata. It never stores passwords, OAuth tokens, results, ClickHouse sessions, result metadata, or running/export state. Its 15-minute TTL is an eligibility bound; malformed, unsupported, expired, workspace-mismatched, and callback-mismatched data fails closed into normal bootstrap.

Basic recovery remains entirely in-shell: it resumes the same RAM document session and resets/clears the reusable password form after success. OAuth re-enables the same in-shell action once the durable pre-redirect transaction is available. Snapshot failure prevents navigation and retains the ordinary dirty-page guard. After a durable write, only the exact intentional redirect consumes the one-shot unload bypass; reloads, closes, unrelated navigation, and failed writes still warn.

Failed OAuth callbacks retain the authored checkpoint and retry only rebinds its OAuth attempt state. A separate tab-scoped validated-callback marker carries only state plus validation time: a checkpoint is never retry authority. Pending valid recovery suppresses legacy oauth_shared seeding rather than merging the two. It restores only after authoritative workspace load, never overwrites newer save-relevant dirty RAM, and retires the marker before publication. Explicit Log out clears both checkpoint and marker.

Evidence

  • npm test: 193 files, 6,425 tests; 100% statements and lines
  • npm run types: passed
  • npm run check:arch: 96/8 passed
  • npm run build: passed; dist/sql.html 2,073,371 bytes
  • Hardened Chromium recovery flow: 3/3 passed
  • Independent lifecycle/auth/security and integration reviews: clear

Checklist

Co-Authored-By: OpenAI Codex <noreply@openai.com>

Claude-Session: unavailable (OpenAI Codex)
Addresses independent review of #527.

Co-Authored-By: OpenAI Codex <noreply@openai.com>

Claude-Session: unavailable (OpenAI Codex)
@BorisTyshkevich
BorisTyshkevich merged commit 1003ee9 into main Jul 28, 2026
7 checks passed
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.

Preserve the document session across ClickHouse auth loss and reauthentication

1 participant