fix(merger-ai): gate the no-commits dep-sync skip on the branch diff — the P1 #2501 shipped without - #2958
Conversation
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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 |
|
Merge-blocking correction before anyone lands this by hand: this PR and #2501 point at the same commit ( So the rationale in the description above no longer holds. It says #2501 "cannot be pushed to" and "the fixes those threads asked for are not in it — merging #2501 as it stands ships the P1 unfixed." Neither is true of the current head: the fix is present (the Consequence: these are duplicates, not a fixed-vs-unfixed pair. Merge one, close the other — there is no version-selection decision to make, and merging both would be a no-op second merge of the same tree. I checked because the description asserted a difference and a hand-merge was about to be made on that basis. Verified by SHA and diff, not by reading either body. #2501's last open thread asked for exactly this env-restore fix; I have replied there pointing at the code, so both PRs are now thread-clear. |
…(PR #2501 review) greptile P1: the skip trusted ctx.noCommitsExpected alone. Control only reaches that line when the branch is AHEAD — the rev-list short-circuit returns early at zero — and both downstream empty-lane guards explicitly carve out noCommitsExpected tasks, so nothing revalidates the expectation against what actually landed. A no-commits task whose executor committed a lockfile change had its install and its frozen-lockfile validation skipped. The flag now says look; the diff decides. A branch touching package.json or any LOCKFILE_CANDIDATES entry falls through to the normal sync and is audited. An unreadable diff also syncs, matching the hard-fail contract above it. LOCKFILE_CANDIDATES is exported rather than duplicated so the skip and the installer cannot drift on what counts as a dependency change. Also fixes the coderabbit env nit: restoring an absent var by assignment stores the string "undefined" and leaks into later tests; delete it instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2972472 to
5323671
Compare
#2501 merged without its P1 fix; this is that fix, alone
#2501 has landed. Its review threads were resolved — I judged and fixed them — but its head was a fork branch I could not push to, so the fixes were never in it. Confirmed on
mainatc1c1b964af:Rebasing dropped this PR's five duplicated base commits, so it is now one commit: the review fix and its regression.
The defect on main
The dep-sync skip trusts
ctx.noCommitsExpectedalone, and only ever runs on a branch that has commits — therev-list --countshort-circuit ~50 lines above returnsoutcome: "empty"at zero ahead, so control reaches it only when the branch is AHEAD.Nothing revalidates the flag. Both downstream empty-lane guards carve no-commits tasks out explicitly —
merger-ai.ts:1372(#2259 already-landed proof) and:1994(FN-8141 executor veto) — and both guard the opposite direction: commit-expected task, empty branch. The inverse has no check.So a task marked no-commits whose executor committed a manifest or lockfile change gets its dependency install and its frozen-lockfile validation skipped, and the change lands unvalidated.
The fix
The flag says look; the branch diff decides. A
main...branchdiff touchingpackage.jsonor anyLOCKFILE_CANDIDATESentry falls through to the normal sync and emits an audit row withskipOverridden: true. An unreadable diff also syncs — matching the hard-fail contract documented directly above that block, rather than treating absence of evidence as evidence of safety.LOCKFILE_CANDIDATESis exported instead of duplicated, so the skip and the installer cannot drift on what counts as a dependency change.Mutation-verified: reverting to trust-the-flag fails exactly the new case and nothing else. The existing "lands successfully with noCommitsExpected: true and actual changes" case is untouched and still passes —
feature.txtis not a dependency file, so an ordinary source change on a no-commits task still skips. The new case differs only in which file the branch touches.Also carried over from the #2501 review
coderabbit's env nit —
process.env.X = undefinedstores the string"undefined", leaving a previously-absent var truthy and leaking into later tests.restoreEnvapplied at both sites.Both entry paths — deferred with reasons:
runAiMerge/landWorkspaceTasksit behind real worktrees, sessions and a merge agent, and the cheap version is a mirrored-implementation test that cannot fail on a revert (this repo has deleted two of those). The fix above also means propagation is no longer the only thing between a stale flag and an unvalidated lockfile.A correction to my own work
My first version of the regression committed the lockfile while the fixture had left the tree on
main, so themain...branchdiff could not see it and the case passed for the wrong reason. Corrected, with the reason recorded in the test.Verification
merger-ai-no-commits-deps-skip— 5/5, mutation-verifiedmerge-dependency-sync-lockfile-heal— 10/10pnpm lint— clean🤖 Generated with Claude Code