Skip to content

fix(review): reviews read the code under review - #526

Merged
dan-petty merged 1 commit into
release/v0.2.23from
fix/515-review-scope
Sep 24, 2026
Merged

dan-petty merged 1 commit into
release/v0.2.23from
fix/515-review-scope

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

Closes #515 (part 3 of 3). Part of the #509 audit.

Reviews were reading code other than the code under review.

Problem Fix
A PR review took its pages from the PR diff, but verified findings, ran scanners and extracted dependencies against the local checkout: a different version of the files, none, or another repository's under --repo The changed files and the conventions files are fetched at the PR's head commit (from the head repo for forks) into a temp directory the review reads. Escaping filenames are refused.
Persona review gave each file every page whose text contained its name, so a.py got data.py's pages Pages map to the files their headers name
Content sniffing classified a Python file opening with # Copyright, or YAML opening with ---, as documentation, whose prompt excuses described vulnerabilities; requirements.txt, CMakeLists.txt and HTML went the same way A known name or extension decides first. Build files are configuration; templates and HTML are code.
Lockfiles, excluded from persona review for size, never reached Trivy Lockfiles beside the reviewed files are scanned, and a finding in one attaches to the manifest beside it

Page splits without overlap move to #499, alongside line numbers.

Live check

_prepare_pr_content for PR #525 wrote its 21 changed files at head 836a5814, including AGENTS.md, CLAUDE.md and .devops/review.md at that commit, and loaded conventions from them. Trivy isn't installed in this devcontainer (#516), so the lockfile path is covered by tests.

Test plan

  • tests/test_review_scope.py:
    • PR head materialization;
    • the pr command reviews against the head directory;
    • each file gets its own pages;
    • lockfiles are scanned and attached to the manifest.
  • tests/test_review_classification.py: known names decide before content, across ten file kinds; HTML is now code.
  • uv run devops ci --force: all gates pass.

A PR review took its pages from the PR's diff but verified findings, ran the
scanners and extracted dependencies against the local checkout. It now fetches
the changed files and the conventions files at the PR head into a temporary
directory and reviews against that.

Persona review gave each file every page containing its name as a substring;
pages now map to the files their headers name. Content sniffing classified
Python files opening with a comment and YAML opening with --- as documentation;
known names and extensions decide first, build files are configuration, and
templates are code. Lockfiles, left out of the persona review for their size,
now reach Trivy, and findings in them attach to the manifest beside them.

Closes #515
@dan-petty dan-petty added this to the v0.2.23 milestone Sep 24, 2026
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/review Multi-persona code review engine, verification, and findings priority/p1-high Priority P1: high-impact work for the next planned milestone labels Sep 24, 2026
@dan-petty
dan-petty merged commit 83c1a89 into release/v0.2.23 Sep 24, 2026
7 checks passed
@dan-petty
dan-petty deleted the fix/515-review-scope branch September 24, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1-high Priority P1: high-impact work for the next planned milestone scope/review Multi-persona code review engine, verification, and findings type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant