feat(#512): restore dirty documents after OAuth reauthentication (phase 3) - #527
Merged
Merged
Conversation
Co-Authored-By: OpenAI Codex <noreply@openai.com> Claude-Session: unavailable (OpenAI Codex)
31 tasks
Addresses independent review of #527. Co-Authored-By: OpenAI Codex <noreply@openai.com> Claude-Session: unavailable (OpenAI Codex)
This was referenced Jul 28, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes #512
This final Phase 3 PR completes the architecture adopted across #512:
sessionStoragerecovery checkpoint. It restores authored dirty tabs only after the successful callback has loaded the committed workspace, reconciled linked query tabs, and revalidated raw Specs before the first signed-in render.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_sharedseeding 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 linesnpm run types: passednpm run check:arch: 96/8 passednpm run build: passed;dist/sql.html2,073,371 bytesChecklist
npm testpasses (the per-file coverage gate is non-negotiable)npm run buildsucceeds (single-filedist/sql.html)src/core/, network insrc/net/(injected fetch), DOM insrc/ui/CHANGELOG.md([Unreleased]) updated for the changed authentication/session surface