Repository navigation
Description
Problem or Motivation
Part 1 of #883 (owner decision 2026-10-28 on #883). A review session records no head commit and no clean-tree flag, so no code can tell a session "on merged code" from a session on a topic branch or a dirty tree.
review_subject(src/devops_cli/ai/review/history.py) holds the target type, the ref and a digest of the pages.ReviewProfile(src/devops_cli/ai/review/profile.py) holdstarget, and the tree commit only inside each tool run record.
Proposed Solution & Architectural Design
- The session record (
findings.json) records the head commit and whether the working tree was clean when the review started. - One function decides whether a session is on merged code: its target type is
path, its tree was clean, andgit merge-base --is-ancestor <head> origin/mainpasses. It sends no GitHub request. review prandreview branchsessions are never on merged code.
Target Subsystem
Review sessions: src/devops_cli/ai/review/history.py, the session writer, and src/devops_cli/review/.
Existing Tool Considered
git (rev-parse HEAD, status --porcelain, merge-base --is-ancestor) gives every fact. Nothing new is built beyond two recorded fields and one predicate.
Acceptance criteria
- A
review pathsession on a clean tree records its head commit andclean: true. A dirty tree recordsclean: false. - The merged-code predicate is true only for a
pathsession on a clean tree whose head is an ancestor oforigin/main. A parametrized test coverspr,branch, a dirty tree and a head that is not onorigin/main, with git faked at the process edge. - The tests run offline.
Related
Parent: #883. Sibling items: the fingerprint marker, and the devops review intake command.
Source: #883
Proposed design
Problem statement
A review session does not record its head commit or whether the working tree was clean at review start. No code can tell a session on merged code apart from one on a topic branch or a dirty tree. This issue adds two fields to the session record and one predicate that decides whether a session is on merged code, using only local git commands.
Acceptance criteria
- Criterion 1: A
review pathsession on a clean tree records its head commit andclean: truein findings.json. A dirty tree recordsclean: false.
Verification: Rundevops review pathon a clean tree and confirm findings.json contains the head commit andclean: true. Run it on a dirty tree and confirmclean: false. - Criterion 2: The merged-code predicate returns true only when the target type is
path, the tree was clean, andgit merge-base --is-ancestor origin/mainexits 0.
Verification: A parametrized test coverspr,branch, a dirty tree, and a head not onorigin/main. Git is faked at the process edge. Each case asserts the expected boolean. - Criterion 3: The tests run offline with no network access.
Verification: Run the test suite with network disabled. All tests pass.
Key questions
- Where are the head commit and clean-tree flag recorded?: In the session record (findings.json), as new fields written by the session writer in the runner. (proposed) [sources: src/devops_cli/ai/review/runner.py:1583, src/devops_cli/ai/review/history.py]
- What conditions make a session on merged code?: Three conditions must all hold: the target type is
path, the tree was clean, andgit merge-base --is-ancestor origin/mainexits 0. (proposed) [sources: src/devops_cli/ai/review/history.py] - Does the merged-code predicate send a GitHub request?: No. It uses only local git commands:
rev-parse HEAD,status --porcelain, andmerge-base --is-ancestor. (proposed) [sources: src/devops_cli/ai/review/history.py] - Are
review prandreview branchsessions ever on merged code?: No. They are never on merged code because their target type is notpath. (proposed) [sources: src/devops_cli/ai/review/history.py] - Which git commands provide the facts the predicate needs?:
rev-parse HEADfor the head commit,status --porcelainfor the clean-tree flag, andmerge-base --is-ancestorfor the ancestry check. [sources: src/devops_cli/ai/review/history.py, src/devops_cli/ai/review/runner.py:1583]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
It adds new fields to the session record and a new predicate function.It is Part 1 of a planned feature set and is a building block, not an urgent fix.It enables routing and reporting decisions about whether a review ran on merged code.It adds two recorded fields and one predicate using existing git commands, with a clear acceptance criteria.Both record git state in a review record, but the candidate adds head commit and clean flag to findings.json while #2101 adds repository URI and revision to the ToolRun and SARIF export.dan-petty commentedon Oct 28, 2026
Status set to Ready at 73d1807 (see proposed design in issue body).
feat(review): devops review intake hands the findings of a session on…