Skip to content

Report What a Move or a Shebang Edit Adds in the Prose Gate's Diff Mode - #3765

Merged
ptr727 merged 2 commits into
developfrom
feature/burn-3711
Nov 1, 2026
Merged

ptr727 merged 2 commits into
developfrom
feature/burn-3711

Conversation

@ptr727

@ptr727 ptr727 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

The prose gate's diff mode could report clean on findings a change introduced without editing the lines they sit on. This happened in two cases.

  • A move that changes a path-dependent rule (Report Only What a Move Adds When a Compose Name or a Directory Changes in the Prose Gate #3711). A moved file whose lexer is unchanged is now checked twice: once as if it still sat at its old path, and once at its new path. Outside the lines the change edits, a run reports only the findings the new path adds. That covers a move off a Compose name, which exposes container-side home paths. It also covers a move into another directory, which can turn a relative mention dead. An older finding that both paths report stays unreported. This replaces the hand-kept path_readings table, so the file_exemption and issue-ref cases it held now go through the same comparison. A rule that later gains a path dependency needs no new table entry.
  • An edited shebang that changes the lexer (Read an Extensionless Script Whole When Its Edited Shebang Changes Its Lexer in the Prose Gate #3714). changed_lines now rebuilds the file's old first line from the diff's hunks. It reads the file whole when the lexer at its old path and old first line differs from the lexer at its new path and new first line. A move whose lexer changes is read whole too, as before. The check now also catches a move that edits the shebang along the way.

Tests

The new cases fail on develop and pass here, all in TestChangedLines:

  • test_a_move_off_a_compose_name_reports_the_container_paths_it_exposes
  • test_a_move_to_another_directory_reports_the_mentions_it_turns_dead
  • test_an_edited_shebang_changing_the_lexer_reads_the_script_whole covers a changed, inserted, or deleted shebang, a shebang edit that keeps the lexer, a body edit, and a move with a shebang edit run end to end.
  • test_a_moved_file_is_judged_where_it_sat_by_the_first_line_it_had_there covers a move onto a suffix that keeps the lexer while the shebang changes. The run at the old path reads the old first line, so no older finding comes back. A BOM subtest in the shebang case checks that a byte order mark is dropped before the lexer comparison, as check_file already does. The local strict-review pass raised both of these, and both are fixed in the second commit.
  • test_a_move_into_instruction_text_reports_its_issue_references checks that the comparison still covers the case path_readings used to.

The existing move cases now expect a pure move's destination in scope with no lines and its source recorded in moves.

tests/test_prose_lint.py, test_repo_gate.py, test_cli_usage.py, test_pre_commit_hook.py, and test_tooling_encoding.py all pass locally. So do the hook's ruff format and check, mypy, and the prose gate.

Closes on promotion: #3711, #3714

🤖 Generated with Claude Code

ptr727 and others added 2 commits November 1, 2026 10:53
A moved file is now checked twice, at its old path and its new one, and
reports only the findings the new path adds. That covers a move off a
Compose name and a move into another directory, which the hand-kept
path_readings table missed, and replaces that table.

An edit that changes a file's lexer through its first line now reads the
file whole, as a move changing its lexer already did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The run at the old path read the new first line, so a move onto a
suffix that keeps the lexer, together with a shebang edit, judged the
old path through the wrong lexer and could resurface an older finding.
The first line the diff recorded is now passed along with the source.

A byte order mark opening the first line is also dropped before the
lexer comparison, as check_file already drops it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 1, 2026 19:05
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 1, 2026
@ptr727

ptr727 commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head d88320cfa45b6bae4342095c1d7a79108d105238, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.31%. Comparing base (71194c9) to head (d88320c).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3765   +/-   ##
========================================
  Coverage    82.31%   82.31%           
========================================
  Files           28       28           
  Lines         9438     9438           
========================================
  Hits          7769     7769           
  Misses        1669     1669           
Flag Coverage Δ
python-3.13 82.31% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The change affects core CI gate behavior across Git rename parsing, path-dependent rules, and shebang-derived lexers, so the full Git/version matrix requires human validation beyond the reviewed cases.

No open issues 🎉

What changed in this PR

This pull request improves prose-gate diff-mode reporting for moved files and shebang changes, ensuring newly introduced path-dependent findings and lexer changes are correctly detected without resurfacing existing issues.

Changes:

  • Compares findings at both source and destination paths for moved files.
  • Reconstructs prior first lines to detect lexer changes from shebang edits, including BOM handling.
  • Adds regression coverage for path-dependent moves, instruction references, relative paths, and shebang changes.
File Description
tests/​test_prose_lint.py Adds and updates tests covering moved files, path-dependent findings, lexer changes, shebang edits, and BOM handling.
.github/​actions/​prose-gate/​prose_lint.py Implements move-aware finding comparison and old/new lexer detection based on paths and first lines.

Review effort: Lite

@ptr727

ptr727 commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Answering the Copilot round on d88320c. Its headline reads needs a closer look and counts no finding: "the full Git/version matrix requires human validation beyond the reviewed cases." It names no failing input, so there is no defect here to fix. The diff shape this change parses does not vary with host configuration, because DIFF_ARGS pins it: --unified=0, --inter-hunk-context=0, --find-renames, -c core.quotePath=true, fixed prefixes, and --no-ext-diff --no-textconv. The tests run real git in every case. They cover diff.renames set to true, false, and copies. They cover an insertion above line 1, a deletion of line 1, a rename with edits, and a byte order mark. Linux and Windows unit jobs both run them. Whether to add a human validation pass on top of that is a merge decision for the maintainer, so this verdict goes to the maintainer under Merge Gate item 2.

@ptr727
ptr727 merged commit 2126004 into develop Nov 1, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/burn-3711 branch November 1, 2026 19:54
ptr727 added a commit that referenced this pull request Nov 1, 2026
…xcluded-Files Refusal, and Fix backlog-burndown and Prose Gate Gaps (#3778)

Promotes the changes merged into `develop` since promotion #3762 to
`main`, the first round of a backlog burndown.

- [#3764](#3764) reads a
bare push whose branch the write guard cannot read as writing every
protected default (`main`, `master`, `develop`), as `--all` is. That
covers a run-time `cd`, `git -C` or `env -C`, an exported `GIT_DIR`, and
a command that can switch the branch before the push. It also drops the
unused `_bare_push_branch` parameters. Naming the branch in the refspec
is the remedy, per the maintainer's decisions on #3729 and #3730.
- [#3765](#3765) has the
prose gate's diff mode report what a move adds by checking a moved file
at its old path and its new path, replacing the hand-kept
`path_readings` table. It also reads a script whole when an edited
shebang changes its lexer.
- [#3776](#3776) fixes
`backlog-burndown`'s ranking, claim, liveness and cleanup gaps:
  - An attended run holds an unapproved agent-safety issue.
- Claim comments name their branch in backticks and are released by an
edit.
  - A silent worker counts as finished only with a merged pull request.
  - The orchestrator removes a standalone clone after its merge.
  - An abandoned worker discards its own uncommitted edits.
- [#3775](#3775) reads
Copilot's excluded-files refusal as its own `excluded` kind, which an
attested local pass covers on a pull request into a non-default branch.
It aligns Merge Gate item 2 with the code on an earlier-head refusal,
adds two Copilot label spellings, and states the lineless-file allowance
where the prose describes table coverage.
- [#3779](#3779) deletes
an abandoned group's pushed branch with a checked remote delete before
its claim is released, and says the claim lookup's `<branch>` is
replaced before it runs. It answers this promotion's first review round.
- [#3781](#3781) has a
release open the claim comment with `**Released (<date>):**`, and has
the claim lookup skip a comment that opens with it. It answers this
promotion's second review round.
- [#3782](#3782) has
`pr_review.py wait` poll a pending review request past an excluded-files
refusal under `--request` as well. It answers this promotion's second
review round.

Fixes #3729
Fixes #3730
Fixes #3723
Fixes #3711
Fixes #3714
Fixes #3761
Fixes #1275
Fixes #1274
Fixes #1306
Fixes #1301
Fixes #3733
Fixes #3571
Fixes #2180
Fixes #3732
Fixes #3713
Fixes #3726

🤖 Generated with [Claude Code](https://claude.com/claude-code)
ptr727 added a commit that referenced this pull request Nov 2, 2026
… merge Reads (#3793)

## Summary

`pr_review.py merge` now reads an acknowledgment record for findings no
thread carries. It also ends every run on one `next=` line, and the
skills follow that field instead of listing every status line. The
digest gives the excluded-files refusal its own `refusal=EXCLUDED`
value.

### Acknowledgment record (#3718, and the verdict case from #3724)

- New library module `scripts/pr_review_answers.py`. It makes no call
and imports neither the gate nor a transport. It gives each answerable
item a key. That is a SHA-256 prefix over the item's kind, the round or
comment raising it, and the item's text. The items are:
- each `suppressed`, `previously_missed`, and `cr_outside_diff` section
on every round
  - each open Qodo entry
  - the head round's `FINDINGS WITH NO THREAD` block
  - each `REVIEWER OUTPUT NOTED` part
  - a verdict naming no counted finding

One key covers every finding a collapsed section or block holds. A key
holding a finding still awaiting the maintainer takes no `--ack`. A Qodo
entry's key covers its title and text, since Qodo edits one comment in
place. A reviewer login drift gets no key and takes no answer. `merge`
refuses it as `REVIEWER_LOGIN_DRIFT` for the maintainer, since that
login's rounds stay unread while the drift stands.
- `pr_review.py comment --ack KEY=OUTCOME`, repeatable, posts the
written outcomes with one `<!-- fleet-finding-ack: key=<key>
outcome=<outcome> -->` line per item. Some bodies post nothing and exit
`69`: one with no prose outside code (for `--fingerprint` too), one
naming a key no item carries, and one with an outcome the item does not
take. Both acknowledgment kinds count only where markdown-it finds prose
outside code.
- The outcomes are `fixed`, `declined`, `filed`, `listed`, and
`dropped`, after `pr-review-conduct`'s verdicts. `Awaiting maintainer`
has no outcome, so a value call stays the maintainer's.
- A record counts only when it is all of these:
  - from an owner, member, or collaborator
  - in a comment that is not hidden
  - written beside outcomes in prose, not just the marker
  - outside code
- `merge` clears a count only once every item under it carries an
outcome. A partial answer, a new round raising the same text (new key),
a `?` count, or a cut window still refuses.
- A verdict naming no counted finding
(`VERDICT_NAMES_UNCOUNTED_FINDINGS`, exit `50`) clears once its key is
acknowledged. That is the case that blocked #3764 and #3765. It stays
fail-closed:
  - An unanswered verdict still exits `50`.
  - `--ack` refuses `fixed` for a verdict, since a fix moves the head.
- A headline naming a concrete failing input is a real finding under
outcome 1, so the driver fixes it and pushes.
- After a fix push, a head hold that was acknowledged turns into noted
output. That output now reads as answered by its own round's shape
acknowledgment. `shape_hold` takes the commit to read for this. A
refusal's parts never read as answered this way. The shape
acknowledgment and the finding acknowledgment now read a written outcome
the same way, through `answering_comments`.
- `report_verdict` moved from `pr_review.py` into the new module. That
keeps `pr_review.py` under its ceiling (2196 lines before, 2166 now).
The gate-item reading moved out of `pr_merge.py` as well (227 lines
now). No ceiling was raised. The new module has its own ceiling, 450,
and sits in the readers' import contract test (384 lines).

### `next=` route (#3724)

- `merge` passes its output through and ends on
`next=done|cleanup|readback|redrive|retry|maintainer`. One table in
`pr_review_answers.py` decides it from each `status=` line, `wait`'s
gate lines included. A line the table does not name goes to the
maintainer.
- A run naming several routes takes the first of `readback`, `cleanup`,
`redrive`, `retry`, and `maintainer`, so what the seat can clear goes
first. The skill keeps the one-rerun bound.
- A generic `REVIEW_IS_A_REFUSAL` routes to the maintainer, since only a
file-count refusal has a remedy this seat can apply, and the line does
not say which kind it is.
- A test pins every status line `pr_merge.py`, `pr_review.py`, and
`pr_review_answers.py` print to its route.
- `drive-pr` step 4 now follows `next=` and drops its per-status list.
`scripts/README.md` "`pr_merge.py`" carries the route table.
- The Qodo open item: an open Qodo entry is now answered by `--ack` and
needs no `/review` re-review for `merge` to read. The untracked
re-review wait therefore no longer gates a merge.

### Excluded-files refusal kind (#3777)

- The digest prints `refusal=EXCLUDED` for the excluded-files refusal,
apart from `refusal=YES`.
- `scripts/README.md` now lists `excluded` among the adapter's refusal
kinds. The `wait` exit-`41` paragraph now covers the `49`/`0`/`41` split
for that kind and the earlier-head quota or error refusal under an
attested later head. The `coverage=` paragraph already described the
lineless-file allowance (from #3702), so it is unchanged.

### Skills

- `pr-review-conduct` Merge Gate item 3 (verdict) and item 4 (noted
parts), and "Answering a suppressed finding" (the `--ack` outcome
mapping), agree with the code. The generated trees are regenerated.

## Verification

- `tests/test_pr_review.py`, `tests/test_pr_merge.py`,
`tests/test_pr_review_copilot.py`, and `tests/test_pr_review_size.py`
pass, as do ruff, mypy, the prose gate (with the `comments` label), and
`build_dist.py --check`.
- New cases cover:
  - the clearing of each count
- an untrusted, hidden, marker-only, unknown-outcome, or code-quoted
record not clearing
  - a partial answer still refusing
  - per-round keys
  - shape-acknowledged noted parts
- a verdict clearing as `declined` but not as `fixed` or from an
outsider
  - `comment --ack` posting the marker, and refusing with `69`
  - `refusal=EXCLUDED`
- each route, through `merge` and as a table pinned to the status lines
in the sources

Closes on promotion: #3718, #3724, #3777

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants