fix(components): make archive cascade hydration- and failure-safe - #658
Draft
wibus-wee wants to merge 4 commits into
Draft
fix(components): make archive cascade hydration- and failure-safe#658wibus-wee wants to merge 4 commits into
wibus-wee wants to merge 4 commits into
Conversation
Discover archive targets from the repository metadata index before any state writes, while preserving rendered-root fallback and direct-child-only lifecycle ownership. Closes #574 Model: gpt-5
Model: gpt-5
Propose immutable lifecycle operations, durable recovery, and atomic metadata projection to replace archive snapshot compensation. Add the bilingual contract and decision note, implementation gates, and a reproducible dependency probe. Validation: dependency probe, targeted Prettier, and diff checks pass. Full pnpm check and format cannot start because corepack is unavailable. Docs check retains 20 pre-existing links into missing submodules. Model: gpt-5
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.
Related issue
Closes #574
Problem / pressure
Session Detail can expose Archive while the UI metadata projection contains only the root Session. Selecting lifecycle targets from that partial cache can archive the root while leaving a direct child Tab active.
Even after target discovery is corrected, a root-first sequence of independent metadata writes can recreate the same final state when a later child write rejects. LoroRepo has no cross-document rollback transaction, and terminal IPC previously ran before each metadata write.
Summary
parentSessionIdchildren.openedBy*Sessions remain independent.isArchivedandstatus; compensate the root before children so rollback failure still preserves root-archived implies children-archived.Visual explanation
flowchart TD A[Archive requested] --> B[Query repository metadata] B -->|query fails| X[Reject: zero writes and zero terminal closes] B --> C[Select root and direct child Tabs] C --> D{Workspace unchanged?} D -->|no| X D -->|yes| E[Write children first] E -->|failure| R[Compensate attempted targets] E --> F[Write root last] F -->|failure| R F --> G[Close selected terminals best effort]Failure contract
Test plan
vitest run tests/use-session-actions.test.ts— 39 tests passed, including realLoroRepo.getMeta().scan()archive integration and all failure/commit-point cases above.vitest run tests/doc-meta-batch.test.ts tests/doc-meta-subscription.test.ts— 10 tests passed.oxlint --quiet src/hooks/use-session-actions.ts tests/use-session-actions.test.ts— zero findings.git diff --checkpassed for all changed files.pnpm run docs checkreaches the checker but reports only pre-existing broken links into unavailable local submodules; this change adds no documentation error.Context handoff
Instructions for reviewing agents
Authoring context
openedBySessionId.