Skip to content

feat: inject sorted git diff into broad review rule prompts - #325

Closed
nhorton wants to merge 4 commits into
mainfrom
feat/inject-diff-into-broad-reviews
Closed

feat: inject sorted git diff into broad review rule prompts#325
nhorton wants to merge 4 commits into
mainfrom
feat/inject-diff-into-broad-reviews

Conversation

@nhorton

@nhorton nhorton commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Rules with all_changed_files or matches_together strategy and a **/* matcher now get git diff main..HEAD pre-fetched and injected into the review instruction file, reducing reviewer turn count
  • Diff is sorted by filepath to naturally group files by directory
  • Diff is scoped to the rule's source_dir so subdirectory .deepreview files get narrower diffs
  • Streamlines /review skill to skip get_configured_reviews and go straight to get_review_instructions

Test plan

  • 235 unit tests pass (5 new test classes, 16 new tests)
  • Tests cover: _should_inject_diff, _get_git_diff with scoping, _sort_diff_by_path, diff injection in match_files_to_rules, diff rendering in build_instruction_file
  • Ruff + mypy clean
  • Full /review run passed with no findings

🤖 Generated with Claude Code

nhorton and others added 4 commits March 31, 2026 18:46
Rules with strategy all_changed_files or matches_together and a **/*
matcher now get git diff main..HEAD pre-fetched and injected into the
review instruction file. The diff is sorted by filepath to group files
by directory, reducing reviewer turn count. Diff is scoped to the
rule's source_dir so subdirectory .deepreview files get narrower diffs.

Also streamlines the /review skill to skip the get_configured_reviews
call and go straight to get_review_instructions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The git diff injected into broad review prompts now includes:
- A `git diff --stat` summary at the top for quick change overview
- 8 lines of context (-U8) instead of the default 3, so reviewers
  can understand hunk placement without reading full files

Also adds tagged test for REVIEW-REQ-004.11.5 (field default) and
moves REVIEW-REQ-005.7 to end of file for sequential section order.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tructure

Moves the REVIEW-REQ-004.11.6 traceability comments from before the
test function to before the requirement-specific assertions. This way
the mock setup (which changes when implementation details like number
of git calls change) is not guarded, while the actual pathspec
assertions remain protected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Traceability comments for REVIEW-REQ-004.11.6 were inside the method
body; the project convention requires them immediately before the def
line. Also includes lint auto-formatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nhorton

nhorton commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

This did not seem to really help

@nhorton nhorton closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant