Repository navigation
fix(review): support unborn repository reviews - #305
Alan-TheGentleman merged 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change adds support for unborn Git repositories across commit transactions, candidate views, and native review startup. It uses optional ChangesUnborn repository support
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The PR adds support for reviewing unborn repositories and reports passing focused validation; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant NativeSTART
participant CandidateView
participant GitRepository
participant CandidateWorktree
NativeSTART->>CandidateView: Resolve default HEAD candidate
CandidateView->>GitRepository: Probe HEAD and resolve base tree
GitRepository-->>CandidateView: Unborn HEAD and empty tree
CandidateView->>CandidateWorktree: Materialize candidate index and worktree
CandidateWorktree-->>NativeSTART: Workspace projection and target identity
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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.
Actionable comments posted: 3
🤖 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 `@lib/git-commit-transaction.ts`:
- Around line 183-185: Update resolveHead in lib/git-commit-transaction.ts to
return undefined only for a valid unborn HEAD response and propagate timeout,
I/O, corruption, and other non-unborn Git failures; ensure createRecord cannot
persist those failed probes as original_head: undefined. Add transaction tests
covering probe timeout and corrupt HEAD behavior, then regenerate
runtime/git-commit-transaction.mjs at lines 184-186 so it preserves the same
change.
In `@lib/review-candidate-view.ts`:
- Around line 754-755: Update the worktree creation flow around the unborn
branch handling to avoid relying exclusively on git worktree add --orphan:
either declare Git 2.42.0 as the required minimum version or implement a
fallback using commands supported by older Git versions. Preserve the existing
orphan-worktree behavior and branch naming.
In `@tests/review-controller-native-routing.test.ts`:
- Line 1878: In the test block around the actorBinding setup, remove the
duplicate block-scoped actorBinding declarations and retain exactly one typed
const declaration. Ensure subsequent assertions continue using that single
binding.
🪄 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: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 07584458-00bf-4450-b40c-10b7473e03f4
📒 Files selected for processing (6)
lib/git-commit-transaction.tslib/review-candidate-view.tsruntime/git-commit-transaction.mjstests/git-commit-transaction.test.tstests/review-candidate-view.test.tstests/review-controller-native-routing.test.ts
| // No baseRef is sent to native START: the unborn default uses the | ||
| // workspace projection only, exactly as the provider expects. | ||
| assert.deepEqual(requests, [{ cwd, targetIdentity: `sha256:${"a".repeat(64)}`, projection: "workspace" }]); | ||
| const actorBinding = (started.details as { actor_binding: { workspace_root: string; candidate_root: string; candidate_tree: string; candidate_paths: readonly string[] } }).actor_binding; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Remove the duplicate actorBinding declarations.
Line 1878 declares the same block-scoped const five times. TypeScript rejects this file before the test can run. Keep one declaration.
🤖 Prompt for 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.
In `@tests/review-controller-native-routing.test.ts` at line 1878, In the test
block around the actorBinding setup, remove the duplicate block-scoped
actorBinding declarations and retain exactly one typed const declaration. Ensure
subsequent assertions continue using that single binding.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@tests/git-commit-transaction.test.ts`:
- Around line 399-414: Strengthen the test around unbornInvocation and
resolveHead by asserting that the thrown error specifically represents the
configured probe timeout, rather than accepting any failure. Also validate that
the POSIX-only wrapper assumptions (/bin/sh, executable permissions, which, and
sleep duration) match the CI platform matrix and GIT_TIMEOUT_MS configuration,
adjusting the test setup or constraints as needed.
In `@tests/review-candidate-view.test.ts`:
- Around line 1436-1447: Update the test around CandidateViewRegistry.create to
record each Git argument vector received by the injected executor. After
asserting the propagated CandidateViewError, also verify that no invocation used
commit-tree or worktree add with --no-checkout and --detach, proving the
fallback was not executed.
🪄 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: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d2898596-3d35-4e25-bf5a-3e9e1e9f2a31
📒 Files selected for processing (5)
lib/git-commit-transaction.tslib/review-candidate-view.tsruntime/git-commit-transaction.mjstests/git-commit-transaction.test.tstests/review-candidate-view.test.ts
6546a5c
into
Gentleman-Programming:main
Summary
HEADsafely through the first reviewed commit transaction.HEADstate and support Git versions older than 2.42 without masking unrelated failures.Closes #159
Review path
lib/review-candidate-view.tsfor unborn detection, private index materialization, orphan candidate worktrees, and the status-129 compatibility fallback.lib/git-commit-transaction.tsfor absent-HEADhandling and fail-closed probe classification.runtime/git-commit-transaction.mjsmatches the TypeScript source.Review Budget
585 changed lines(545 additions + 40 deletions).size:exceptionis explicitly accepted for this PR. The additional scope is review hardening for the same issue and delivery unit: it addresses CodeRabbit findings, keeps behavior-first tests with the fixes, and avoids a cross-fork child workflow that would not receive upstream CI.Verification
git diff --checkpassed.pnpm run check:transaction-runnerpassed.node scripts/verify-package-files.mjspassed.node --experimental-strip-types --test tests/git-commit-transaction.test.ts tests/review-candidate-view.test.tspassed (79/79).allow.The focused 79-test suite passes. The full local suite retains known environment-sensitive baseline failures unrelated to this candidate; upstream CI
verifypasses on the published head.Review Note
The remaining
actorBindingthread is a false positive: the referenced test scope contains exactly one declaration. The similarly named binding near the earlier line belongs to a different test, and the TypeScript test suite compiles and runs successfully.Two unchanged controller-routing tests still expose the known macOS
/varversus/private/varcanonicalization baseline; the added unborn START test passes.Scope
This PR only addresses ordinary review and the first reviewed commit in unborn repositories. It does not change review policy, consent behavior, or repository authority semantics outside that flow.
Summary by CodeRabbit
New Features
HEAD.Bug Fixes
HEADis missing or disappears during a commit.HEADstates.