Repository navigation
Description
Context & Rationale
Part 1 of this issue shipped in v0.2.23 (CHANGELOG.md:98). compute_symbol_delta (ai/analyze/symbols.py:32-42) records the symbols each file added, removed and kept on FileAnalysisMeta (models/ai.py:43-45). When the construct validator gets that removed set, a finding that cites a removed symbol is labelled "cites removed symbol" and moved to the nearest diff hunk instead of being invalidated (ai/review/construct_validator.py:396-414, :466-467). A symbol missing from both base and head is still invalidated (:469).
The exemption works when it gets the removed set. A scratch repo at ef21785 had a branch that deletes legacy_helper from mod.py. Against that branch, the finding "removal of legacy_helper breaks callers" came back INVALIDATED without the set. With the set it came back UNVERIFIED, noted "cites removed symbol".
Real reviews never get the set:
- Only
devops ai analyze branchcomputes a delta (commands/analyze.py:179-205, called at:214,:251and:303). Nothing runs it before a review. The review's own pre-analysis callsanalyze_single_filewith no base (ai/review/pipeline.py:892-903). On the scratch repo, the branch review's pre-analysis recorded([], [], [])formod.py. - The base read is broken.
git --no-pager show -- <rev>:<path>(commands/analyze.py:150-152) treats the argument as a pathspec. It prints the HEAD commit header, which never parses, so every head symbol counts as added. This is fix(review): the symbol delta is always empty becausegit showreads the base revision as a path #787, introduced by f93231b. - Branch reviews do not know each file's status. The review diff is
git diff base...target(ai/review/runner.py:1822), and nothing records which files were added or renamed.devops ai analyze branchparsesgit diff --name-status(commands/analyze.py:504-516), but git prints a rename asR088<TAB>old.py<TAB>new.py. The parser keepsold.py<TAB>new.pyas one path, which does not exist, so the renamed file is handled as deleted. - PR reviews have no base.
_materialize_pr_head(ai/review/runner.py:1897-1944) writes the head version of each changed file. It reads the base only for convention files (:1917-1929). - Pre-analysis reuses cached deltas.
_collect_paths_to_analyze(pipeline.py:953-981) reuses a cachedFileAnalysisMetawhose file is unchanged, symbol lists included. A delta thatdevops ai analyze branchcomputed against another base therefore rides into the review. - Verification reads the wrong metadata and the wrong text. The orchestrated path calls
_validate_segment_findingswithout metadata (ai/review/pipeline.py:2589-2595). That function then loads the newest*-metadata.jsonunder the target, whichever review or branch wrote it (ai/review/verification.py:2029-2032,ai/analyze/cache.py:164-180). Its segments are the file's numbered source (pipeline.py:2585), which has no@@headers. So no hunk is ever found to move the finding to. - The summary can show another branch's numbers. When the reviewed files have no delta, the summary adds up every file in the newest cached analysis (
pipeline.py:3542-3546).
Nobody has measured how often reviews raise findings about removed symbols. This item makes removed_symbol_findings_count (ai/review_schema.py:1133) a real number, which #607's run history can then track.
Two parts of the earlier plan are no longer in this item:
- Per-function complexity before and after is now its own backlog item (split off).
- A scalar drift score stays out. vibes'
EmbeddingDriftAuditor(examples/valkey-l2-repomap-cache/repomap_cache.py:326-400, bands atREADME.md:42-44) was re-run at ef21785 on two unrelated modules,commands/devcontainer.pyandai/gateway.py. It gaveD_C = 0.0048, which it labels PRESERVED. The line-count dimensions make up 0.81 and 0.86 of the two unit vectors.
Scope & Deliverables
- Deliverable: branch and PR reviews compute the delta for the files they review. They use it in verification and in the summary.
- Move the base-read and merge-base helpers (
commands/analyze.py:138-176, after fix(review): the symbol delta is always empty becausegit showreads the base revision as a path #787's fix) togit/operations.pyas public functions. Add one more there: a changed-file lister that runsgit diff --name-status -zover a range and returns each file's status, head path and, for a rename, its old path.devops ai analyze branchand the review both call these three, so the rename bug atcommands/analyze.py:509-512goes away. - Branch reviews:
_prepare_branch_content(runner.py:1785-1856) also returns the base revision. For a branch, that is the merge base ofeffective_baseand the target, the same basegit diff base...targetuses (:1822). If there is no merge base, the review already falls back to a two-dot diff (:1827-1833), and the base revision iseffective_base. For a working-tree review it isHEAD(:1777,:1815). The file statuses come from the changed-file lister over the same range. - PR reviews: add one
GitHubClientmethod that gets the merge base ofpull.base.shaandpull.head.shafrom the compare endpoint, next toget_file_at(github/client.py:140-149). For each modified or renamed.py/.pyifile, read the base text from the base repo at that commit. A renamed file is read at itsprevious_filename. - Pre-analysis records the delta on each changed Python file before it saves the session metadata. Every other file in the session metadata carries empty symbol lists, including files reused from the cache.
execute_finding_verificationpasses verification the session's metadata and each file's diff text. That diff text is thediff_mapthat persona review already gets (runner.py:2066-2071). Hunks come from the diff text, and the numbered source stays the verification context.- The summary counts only the reviewed files. Delete the fallback at
pipeline.py:3542-3546. - Docs:
- The task file drops its
**Milestone**line, which says v0.2.24, and its three-PR plan. ADR 0001 says task files carry no milestone, andtests/test_agent_task_files.pydoes not require one. - If
docs/ROADMAP.mdis still hand-edited when this PR merges, correct the entry (:494-499) and its matrix row (:1350, which still names lizard and v0.2.23). If feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate,render) #739'srenderalready owns the file, leave it alone. - Add a CHANGELOG entry.
- The task file drops its
- Move the base-read and merge-base helpers (
- Acceptance criteria:
-
A branch review's pre-analysis gets the delta with no earlier
devops ai analyze branchrun, and reads the right revision. Verified by a unit test with a fake base reader that logs each(revision, path)it is asked for and a fake merge-base resolver that returns a sentinel SHA:- The base
mod.pydefineslegacy_helperandkeep, and the head defines onlykeep. The session metadata formod.pyhas added[], removed["legacy_helper"]and retained["keep"]. mod.pyis read at the sentinel SHA, not at the base branch name.- A renamed file is read at its old path.
- An added file is never read, and every one of its symbols is listed as added.
- A working-tree review reads
HEAD. - fix(review): the symbol delta is always empty because
git showreads the base revision as a path #787's real-repo test covers the moved base-read helper. A second real-repo test covers the changed-file lister: a rename comes back as one entry with its old and new paths.
- The base
-
A PR review reads the base at the merge base and uses it. Verified by a unit test whose
_FakeGitHub(tests/test_review_scope.py:15-22) is keyed by(path, ref)and also answers the merge-base call. The test checks the fetch log:- the modified file is read from the base repo at the merge-base SHA;
- the renamed file is read at its old path;
- added and removed files get no base read;
- no source file is read at
pull.base.sha.
It also checks that the PR session metadata for the modified file has removed
["legacy_helper"], and that the renamed file has the delta between its old and new text. -
Orchestrated verification exempts only real removals, with no model call. Verified by a unit test with a verification client fake that fails if it is called:
- a finding that cites
legacy_helperatmod.py:1ends UNVERIFIED, noted "cites removed symbol", and its location is the file's diff hunk; - a finding that cites
ghost_fnends INVALIDATED.
Neither fixture text contains an absence marker (
config/constants.py:949-959), because those are checked before removed symbols (construct_validator.py:463-467). - a finding that cites
-
Only the session's own delta counts. Verified by a unit test that runs pre-analysis and then verification:
- A newer cached analysis file that lists
ghost_fnas removed frommod.pydoes not change criterion 3's results. - The cache on disk lists
fooas removed fromother.py, which is unchanged and outside the diff. The session metadata forother.pyhas empty symbol lists, and a finding onother.pythat citesfooends INVALIDATED.
- A newer cached analysis file that lists
-
A failed base read leaves the delta empty. When the reader returns
Nonefor a modified file, that file's added, removed and retained lists are all empty. Verified by a unit test. -
The summary uses only the reviewed files. Verified by a unit test:
- for criterion 3's fixture,
findings.jsonhassymbol_delta_summary == {"added": 0, "removed": 1, "retained": 1}andremoved_symbol_findings_count == 1; - a review whose files have no delta shows no Symbol Delta row, even when a cached analysis on disk has one.
- for criterion 3's fixture,
-
The new tests make no network call (fix(test): the test network guard refuses loopback connects to services the test did not start #837's guard enforces this) and add under 1 s in total. The task file records the
--durationsfigures.uv run devops cipasses. -
The docs are current. Verified in review of the diff:
grep -n Milestone docs/agent/tasks/task-593-*.mdfinds nothing;- the task file describes one PR;
- if the PR edits
docs/ROADMAP.md,grep -n lizard docs/ROADMAP.mdfinds no line for this item.
-
A person runs this check with a live model. Worktrees share the main checkout's analysis cache (
ai/analyze/cache.py:48-54,core/repo.py:194-200), so the check points the cache at an empty directory. It deletes a test helper, which the CLI never imports, so the code under test stays whole:git worktree add /tmp/probe-593 -b probe/593 main cd /tmp/probe-593 # delete the _pull helper from tests/test_review_scope.py git commit -am "probe: remove a test helper" DEVOPS_CLI_DATA_ANALYSIS_DIR=$(mktemp -d) uv run devops review branch probe/593 --base mainThe summary table shows a Symbol Delta row with
-1or more. Then runuv run devops review pr <number>, without--postand with the same variable set, on an open PR that deletes a function. It shows the same row. Clean up withgit worktree remove --force /tmp/probe-593 && git branch -D probe/593.
-
- Key questions:
- Which base does a branch review read? (proposed) The merge base of the effective base and the target, so the delta matches the reviewed diff. With no merge base,
effective_base, matching the two-dot fallback diff. A working-tree review readsHEAD. - How does a branch review know which files were added or renamed? (proposed) From
git diff --name-status -zover the same range as the reviewed diff, through the shared changed-file lister. Parsing thediff --githeaders of the redacted, paged diff would be more fragile. - Which base does a PR review read? (proposed) The merge base from the compare endpoint, not
pull.base.sha.base.shais the base branch tip, which can be ahead of the merge base. A PR branched earlier would then list symbols added on main since as removed, which widens the exemption. The cost is one extra API call per review. - Which files get a delta? (proposed) Modified and renamed
.py/.pyifiles that exist at head:- Added files list every symbol as added and need no base read.
- Deleted files get none. The validator returns a finding on a missing file unchanged (
construct_validator.py:348-350,:479-480), and PR reviews do not write removed files (runner.py:1908-1912). So the review summary does not count a deleted file's symbols, unlikedevops ai analyze branch. - Files outside the diff get none.
- What does a failed base read mean? (proposed) The delta is unknown: it stays empty and a debug line is logged.
compute_symbol_delta(None, head)would count every head symbol as added, which is the wrong number fix(review): the symbol delta is always empty becausegit showreads the base revision as a path #787 produces today.devops ai analyze branchfollows the same rule, since it calls the same helper. - Where does verification get the delta? (proposed) From the session's own metadata in memory. The newest cache file can belong to another branch or to a review running at the same time.
- Where do the git helpers live? (proposed) In
git/operations.py. Theailayer imports fromcommandsin only one place (ai/mcp/server.py:2844), and this item should not add a second. - Do path reviews change? (proposed) No. A path review has no base.
- Does the fallback persona loop change (
runner.py:1043)? (proposed) No._make_review_clientsalways buildsLLMClient(runner.py:1527-1561), so reviews take the orchestrated path. - What happens to the new
GitHubClientmethod when refactor(github): one github session per identity owning token, quota and transport #767 removes PyGithub? (proposed) refactor(github): one github session per identity owning token, quota and transport #767 ports it with the other methods, with no shim. - Where does per-function complexity before and after go? It is now a separate backlog item. It uses refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner #773's mccabe entry, per owner decision D1 on feat(cli): enforce the complexity cap with ruff C901 and an inline baseline that only shrinks #586: ruff C901 is the definition, with no lizard, no radon and no new dependency.
- Which base does a branch review read? (proposed) The merge base of the effective base and the target, so the delta matches the reviewed diff. With no merge base,
- Constraint:
- The exemption stays narrow. A symbol missing from both base and head is invalidated.
- This item ships no scalar score, threshold, persona routing or auto-apply verdict. Any score needs its own item and a labelled corpus.
- No new dependency.
- Tests use fakes for git and GitHub, apart from the two real-repo tests named in criterion 1. They make no network calls and use structural tuple asserts until test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851 settles that.
- The
uv run devops cigate stays within its 5-minute budget.
Strategic Alignment
- Milestone: v0.2.25
- Depends on: fix(review): the symbol delta is always empty because
git showreads the base revision as a path #787. It sits in the backlog, which is later than this item, so it needs a place in v0.2.25 ahead of feat(review): branch and pr reviews compute their own base-vs-head symbol delta #593. - Related:
- fix(review): verdicts bind across conflicting titles and absence wording shields nonexistent constructs #790: the absence exemption in the same validator; independent work.
- feat(review): subject-keyed review history with a leave-one-out baseline #607: the run history that can measure how often the exemption fires.
- feat(review): per-model review quality baseline for the devops-review pool #475: the per-backend review quality baseline.
- refactor(github): one github session per identity owning token, quota and transport #767: ports the new
GitHubClientmethod. - feat(github): github-sourced roadmap, migration and generated roadmap view (
devops roadmap migrate,render) #739: rendersdocs/ROADMAP.mdfrom GitHub. Its task-file split-off (backlog) drops milestone lines from task files. - fix(test): the test network guard refuses loopback connects to services the test did not start #837: the no-network test guard.
- refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner #773 and feat(cli): enforce the complexity cap with ruff C901 and an inline baseline that only shrinks #586: the complexity split-off.
- Split off (backlog): feat(review): ruff and mypy run as review evidence with the project's settings, advisory rules report only on changed lines, and changed functions show complexity before and after #873 (per-function complexity before and after for changed python functions in reviews).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(ai): base-vs-head symbol delta and removed-symbol finding exempt…
dan-petty commentedon Oct 1, 2026
Retargeted from the shipped v0.2.23 to v0.2.25. It is still valid (checked 2026-10-01), and a P1 left open in a shipped release keeps precedence over P1 work committed later.
[-]feat(review): base-vs-head symbol delta and removed-symbol finding exemption in reviews[/-][+]feat(review): branch and pr reviews compute their own base-vs-head symbol delta[/+]fix(review): branch and pr reviews compute their own symbol delta (#593)
fix(review): branch and pr reviews compute their own symbol delta (#593)
fix(review): branch and pr reviews compute their own symbol delta (#593…
dan-petty commentedon Oct 2, 2026
Closed by #932, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)