fix(worktrees): recover downgraded V2 registry wrappers - #53
Conversation
Recognize the exact completed-upgrade shape emitted by older writers while preserving fail-closed evidence and crash recovery semantics. Refs #40
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe worktree registry now handles V1-wrapped V2 records during recovery. It validates record schemas, checks source and backup hashes, preserves migration evidence and completion timestamps, and rejects ambiguous or malformed states without modifying invalid source data. ChangesWorktree registry recovery
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bc5a718d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/server-core/src/git/worktree-registry.ts`:
- Around line 847-853: Update the generic RPC error handler at the registry
boundary to detect WorktreeRegistryError and translate each registry error code
through its corresponding i18n.t() key before sending the response. Cover
REGISTRY_CONFLICT, including both referenced conflict paths, and every other
registry error code without exposing WorktreeRegistryError.message directly. Add
all required translation keys to each of the seven locale files in alphabetical
order.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 88cb77f8-7699-4972-82d0-0f8d3f56761a
⛔ Files ignored due to path filters (4)
apps/electron/resources/release-notes/next.mdis excluded by!**/*.mddocs/adrs/2026-07-29-server-owned-managed-worktrees.mdis excluded by!**/*.mddocs/adrs/log.mdis excluded by!**/*.mddocs/log.mdis excluded by!**/*.md
📒 Files selected for processing (2)
packages/server-core/src/git/__tests__/worktree-registry.test.tspackages/server-core/src/git/worktree-registry.ts
Summary
Related to #40. The pre-existing nonparticipating-writer replacement race is tracked separately in #52.
Test Plan
cd packages/server-core && bun test src/git/__tests__/worktree-registry.test.ts src/git/__tests__/managed-worktree-service.test.ts src/git/__tests__/reconcile.test.tscd packages/server-core && bun run typecheckgit diff --check origin/mainAll 54 targeted tests pass.
Summary by CodeRabbit
Greptile Summary
This change restores the V2 registry wrapper when an older Kata process retains valid V2 records but writes a V1 wrapper. It preserves lifecycle state, the original V1 backup, and upgrade completion time while rejecting mixed, malformed, missing-evidence, and mismatched-evidence states without rewriting the source registry.
Merge safety: safe to merge.
Confidence Score: 5/5
No blocking failure remains; the registry recovery and fail-closed paths behave as intended.
No accepted blocking findings remain.
What T-Rex did
Reviews (2): Last reviewed commit: "docs(release): link registry recovery pr..." | Re-trigger Greptile