Repository navigation
#80 — git-rename detection on PR-diff scope - #184
Conversation
A pure rename (100% similarity) in a git diff carries only the 'rename from'/'rename to' extended headers — no '+++ b/' header, no hunks — so the renamed model scoped nothing. The parser now collects the rename pairs into PrDiff.renames (serde(default) + skip_serializing_if keeps rename-free payloads byte-identical), and NormalizedDiffIndex puts BOTH sides of every pair into the changed-file keyset. Scope selection is untouched: the current manifest (compiled at the PR head) resolves the new path to the renamed node, so the model scopes under its new name; the old path matches no current node and is inert. A rename-with-edit already carried its hunks on the new path's file entry — the index merge keeps them, so the model scopes once, not twice. Verified against real 'git diff --unified=0' output (git 2.51): pure rename, rename+edit, spaced paths (rename headers are unquoted and un-prefixed), and the --no-renames delete+add fallback (which already worked via the new-file entry). Rename paths are taken verbatim; C-quoted non-ASCII paths are not dequoted — parity with the '+++ b/<path>' parser. Docs: the CI recipe's producer command gains --find-renames (explicit + config-proof; both forms keep working), and the renamed-model fidelity-limit bullets in how-it-works and the recipe are replaced with the supported behavior. The .feature fidelity comment becomes two executable scenarios (pure rename / rename+edit) on the existing synthesizer, extended to emit real rename header blocks. The Windows-path deferral that piggybacked on cute-dbt#80's tracking comments is re-pointed at its own issue (tracked: cute-dbt#183). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 42 minutes and 21 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughThis PR implements deferred feature ChangesGit rename detection for PR-diff scoping
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
…e-dbt#80) Add --find-renames to the two workflow git-diff producer invocations (report-preview.yml prdiff-preview job — the live dogfood — and the committed example workflow), matching the recipe's documented producer command. Dogfood-alongside: without this the rename-detection feature would be invisible in the repo's own live PR preview. The flag only makes git's default rename detection explicit (config-proof against a runner setting diff.renames=false); patch shape is otherwise identical. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 39cf5cf on Jun 10, 2026 3:32pm UTC. |
📄 Rendered report previewAll golden examples regenerated cleanly. 🟡 Golden examplesCommitted to
🐶 Live dogfood previewThis PR doesn't touch ▶ Open ↗ opens the report in your browser in one click — The Pages preview may take ~1 min to update after this comment Alternative: GitHub CLI# gh CLI >= 2.63 extracts into ./report-preview-playground/.
gh run download 27287294599 -R breezy-bays-labs/cute-dbt -n report-preview-playground
open report-preview-playground/playground-report.htmlPosted by |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
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 `@book/src/how-it-works.md`:
- Around line 149-154: Update the paragraph that currently says "since git 2.9"
to state the correct timeline/wording (e.g., "since April 2016 (commit
5d2a30d7d8777319c745804f040fa405d02169ce)") and clarify that this default
applies to porcelain commands like `git diff`/`git log`; note that adding
`--find-renames` to `git diff` is therefore redundant in modern versions (only
needed for older git or other commands). Also replace the jargon "maps both
paths onto the scope match" with clearer wording such as "maps both paths to the
model under the renamed path" while keeping the rest of the "rename
from`/`rename to`" and "pure rename (100% similarity, no hunks at all)" wording
intact.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: ae5aada0-ba28-44c1-9dd3-8f09e272d55e
📒 Files selected for processing (16)
.github/workflows/examples/cute-dbt-pr-review.yml.github/workflows/report-preview.ymlbook/src/how-it-works.mdbook/src/recipes/github-actions-pr-review.mdfeatures/pr_diff_scoping.featuresrc/cli/mod.rssrc/cli/pr_diff.rssrc/domain/cell_diff.rssrc/domain/path.rssrc/domain/pr_diff.rssrc/domain/scope.rstests/cell_table_diff.rstests/headless_toggle.rstests/path_matching.rstests/steps/pr_diff_scoping.rstests/steps/world.rs
… -> 22)
The rename-header branches (cute-dbt#80) pushed parse_unified_diff to
complexity 31 against the crap4rs threshold of 25 (coverage is 100%,
so CRAP == CC). Extract the header-territory classification into two
helpers, mirroring the existing consume_body_line seam:
- consume_path_header — the '--- '/'+++ ' path headers (CC 3)
- consume_rename_header — the 'rename from'/'rename to' pair, incl.
the stray-'rename to' lenience (CC 5)
parse_unified_diff keeps the state machine's spine (file boundaries,
hunk open/close, saw_structure) and lands at CC 22. Behavior is
byte-identical: zero test changes; 803 nextest + 88 BDD scenarios
green. Scorecard verified with BOTH the local crap4rs v0.6.0 and the
CI-pinned v0.4.0 ('crap4rs --config crap4rs.toml --coverage
lcov.info'): 0 functions above threshold, repo worst is the
pre-existing normalize_path at 23, exit 0.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Closes #80
A renamed model in a
--pr-diffpatch was a documented v0.1 fidelity limit: git's default rename detection (on since git 2.9) emits a pure rename (100% similarity) as only therename from/rename toextended headers — no+++ b/header, no hunks — so the renamed model scoped nothing. This PR layers rename detection onto the existing parse → index → scope pipeline, additively.Input forms supported (verified against real git 2.51 output)
git diff --unified=0(default rename detection), pure renamerename from/rename to, no hunks---/++++ hunksgit diff --no-renamesPrDiffserializes without the new field)--name-status(R<score>\told\tnew) was not added as an input form: since #96 the flag takes a raw unified diff (the hunks drive block precision and the inline diffs), the recipe's actual producer already emits rename headers in that patch, and a second input grammar would carry none of the hunk information the rest of the feature set needs.Design
cli::pr_diff— the line-oriented state machine recognizesrename from/rename toin header territory only (thein_hunkdisambiguation keeps a+rename from …added body line from forging a pair). Paths taken verbatim — git emits them un-prefixed and unquoted-for-spaces; C-quoted non-ASCII paths are not dequoted (parity with the+++ b/<path>parser).domain::pr_diff— newRenamePairPOD;PrDiff.renameswith#[serde(default, skip_serializing_if)](pre-Deferred (v0.2+): git-rename detection layer on PR-diff scope #80 payloads deserialize; rename-free payloads stay byte-identical).NormalizedDiffIndex::newputs both normalized sides of every pair into the changed-file keyset (strip-applied), never attaching hunks via the rename.domain::scope— zero code change: scope selection consults the keyset; the rename mapping lives entirely in the index.Semantics decisions
changedat scope level; the existing feature: block-precise PrDiff updated-test detection + inline YAML diff #96 block-precise refinement then narrows them to context (zero hunks touch no block) — mechanical consequence of existing machinery, pinned by a unit test.Tests
.featurefidelity-limit comment is replaced by two executable scenarios; the harness synthesizer emits real git rename header blocks (shape verified against git 2.51).Docs
--find-renames(explicit/config-proof; both forms keep working — a--no-renamespatch still scopes via delete+add); §10 fidelity-limit bullet replaced with the supported behavior. Same inhow-it-works.md.Gates (run directly — lefthook skips in fresh worktrees)
fmt ✓ · clippy
--all-targets --locked -D warningsexit 0 ✓ · nextest 803/803 ✓ · bdd 88/88 ✓ · headless_zero_egress ✓ · headless_toggle 29/29 ✓ · rustdoc-D warnings --document-private-items --lockedexit 0 ✓ · deny ✓ · baseline-required-grep + feature-count (12) mirrors ✓ · mdbook build ✓🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation