Skip to content

Name the Prose Gate's Own Copy on Every Verdict - #1417

Merged
ptr727 merged 7 commits into
developfrom
feature/prose-gate-provenance
Sep 7, 2026
Merged

ptr727 merged 7 commits into
developfrom
feature/prose-gate-provenance

Conversation

@ptr727

@ptr727 ptr727 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Settles #1412, and the diagnosis is not either of the two candidates that issue proposed.

What was actually wrong

ptr727/HomeAutomation-Config pins the hub reusable workflow at 389f5b9 (2.0.392, 2026-08-19). The HUB_HOSTED exemption that silences repo-config/README.md and repo-config/settings.json landed in e31d3fc, the very next commit. So its CI ran a prose gate one commit behind the rule, and no local run of a current copy could reproduce it.

Reproduced by extracting the pinned copy and running it against the same worktree and diff base:

Copy Result
389f5b9, what CI ran 3 violations, lines 17/26/110, byte-identical to the CI output in the issue
hub develop today 0 violations

The local invocation in the issue was correct and the composite action is not defective. The three findings were stale-pin false positives. That pin was frozen because Dependabot version updates had never run on that repository, which the maintainer has since fixed at the account level.

What this changes

Every prose-gate verdict now names the copy that produced it, on the scope line beside the scope it already reports:

  • gate <owner>/<repo>@<ref> from a pinned remote action
  • gate local <sha> from a checkout that tracks the script at that commit
  • gate local <sha>-dirty from the same with the file edited
  • gate unknown where no commit describes the copy

Three sources answer in order of what can be trusted: the action's own pin, which is the only source that knows it since a checked-out action carries no history; PROSE_GATE_PROVENANCE for a caller invoking the script directly; then the script's own checkout. None resolving reports unknown rather than a plausible value, because a wrong attribution sends the next investigation at a copy nobody ran.

GOVERNANCE.md gains the reproduction recipe #1412 found missing, verified verbatim against the case that prompted the issue. scripts/README.md documents the flag and the variable.

A separate defect found while writing the runbook: an exclusion is a substring test, so --exclude "" matched every path and reported the empty scan as clean while exiting 0. Reachable from a blank line in an exclusions file read by a hand-run loop. Now refused.

Verification

Four adversarial review passes on the strongest tier, raising 9, 5, 3, and 4 findings; the first three sets are answered in the commits above. Mutation-tested: moving --provenance past the -- separator, dropping the tracked-file check, dropping the dirty marker, dropping the status pathspec, restoring the inherited git environment, and removing the empty-exclude guard each fail at least one case. 1109 tests, ruff, format, prose gate, spec/validate.py, build_dist --check and canonical_review check all green.

Open findings from the last pass, for reviewers

  1. The empty-exclude guard closes the empty value only. Any over-broad non-empty exclusion still narrows the scan silently: --exclude .md takes the discovered set from 328 files to 160 and exits 0, and the scope line never reports that an exclusion removed anything. The root-cause guard would be scope-level rather than value-level. Pre-existing, and the one I would want answered before merge.
  2. catalog/snippets/hub-fetch-run.py writes the fetched script to a temporary file, so the fleet's own documented downstream local route reports gate unknown on every run. It is the one caller that could set PROSE_GATE_PROVENANCE from what it fetched.
  3. The action trims blank exclusion lines with ASCII whitespace while the new guard uses Python str.strip(), so a line of only U+00A0 survives one and is refused by the other.
  4. The guard sits between scan_paths and the unusable check, which separates the invariant comment above from the code it introduces. Directly after parse_args would keep both blocks intact.

Closes #1412

🤖 Generated with Claude Code

ptr727 and others added 5 commits September 7, 2026 09:05
A repository runs this gate at whatever hub commit its own workflow pins, so CI
and a hub checkout run different copies from the moment a rule changes until that
pin moves. Nothing in a verdict said which copy produced it, so a finding raised
by a stale pin reproduced against no local run and read as a defect in the gate.

On #1412 that cost a full investigation. Three dead-path findings on a downstream
pull request reproduced nowhere, and the issue proposed the only two readings the
output allowed: a wrong local invocation, or a genuine action-versus-local defect.
Both were wrong. The consuming repository pinned the hub at 389f5b9 and the
HUB_HOSTED exemption that silences those three paths landed in e31d3fc, the very
next commit, so CI ran a gate one commit behind the rule.

Every verdict now names its copy on the scope line, as `gate <owner>/<repo>@<ref>`
under the composite action and as `gate local <sha>` from a checkout. Three sources
answer in order of what can be trusted: the action's own pin, which is the only
source that knows it, since a checked-out action carries no history to read; the
environment, for a caller invoking the script directly; then the script's own
checkout. None of the three resolving reports `unknown` rather than a plausible
value, because a wrong attribution sends the next investigation somewhere worse
than an absent one does.

GOVERNANCE.md gains the reproduction recipe the issue found missing, extracting
the pinned copy and running it against the same worktree and diff base, verified
to reproduce all three findings the downstream CI reported.

Closes #1412

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…unnable

The local review pass raised nine findings against the first commit, all of them
against text it wrote. The root one: reading HEAD to name the copy conflates a
checkout containing the script with a commit describing it, and the two come
apart in both directions. A copy dropped into an unrelated repository resolved
that repository's HEAD, naming content it never held and reading exactly like a
genuine hub checkout. A file edited in place resolved the commit before the edit,
so the run that most needs an accurate attribution, the one made while changing a
rule, got a stale one. Both now ask what HEAD says about the path rather than
about the repository, so an untracked copy is attributed to nothing and a moved
working copy is named as moved.

The action reads the default environment variables as well as the contexts, since
the context value for a repository-relative reference is undocumented and an empty
one would have left every downstream verdict silently unattributed.

The runbook recipe did not run as written. It used an undefined variable, so the
redirection resolved to the filesystem root, and the copy it extracted reported
`unknown` rather than the pinned value the paragraph told the reader to compare
against, because an extracted copy sits under no checkout. It now sets
`PROSE_GATE_PROVENANCE` and is verified verbatim against the case that prompted
the issue. Two claims beside it were wrong: dead-path does fire on the hub, which
deletes paths of its own, and what cannot arise there is a finding about a
hub-hosted path the hub still holds. The excluded-path contract the action honors
was missing, so a documented run would have read files CI never read.

The two tests gating this were substring greps over the action text and a shape
match on the local value, and neither could fail on the regressions its own
docstring named. The action's shell block now executes against a stub that reports
its argument vector, and the local cases assert against a real repository's HEAD.
Verified by mutation: moving the argument past the `--` separator, dropping the
tracked-file check, and dropping the dirty marker each fail two cases.

scripts/README.md documents the flag and the variable, which is where a caller
looks for the gate's inputs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t Environment

The previous commit's own pre-commit run printed `gate unknown` where the same
command had printed the commit a moment earlier, which is the third way a
checkout containing the script comes apart from a commit describing it.

Git's location variables outrank `-C`, and a git hook exports them, so a run made
from inside one resolves against whichever repository invoked the hook. Here that
degraded to `unknown`, which is safe. It is not safe in general: a hook in one
repository running a script from another names a real commit in the wrong one,
which is the well-formed wrong attribution the previous commit was written to
refuse, arriving by an environment rather than by the filesystem.

The location variables are dropped for the resolution, so the answer keys on the
script's own path alone. Gated by a case that sets GIT_DIR at an unrelated
repository and asserts the script's own HEAD still answers, and confirmed by
mutation that restoring the inherited environment fails it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ipe's Placeholder

Five findings from the second review pass, all against text the first two rounds
wrote.

The resolution's docstring claimed to close a case it narrows. Requiring the
script to be tracked closes an untracked copy dropped into an unrelated
repository, and it does not close a copy committed into one, which is tracked and
clean there and is named by that repository's HEAD with nothing in the value to
tell it apart. A `local` value is a commit read inside the repository that
produced it and nowhere else, which is now what the docstring says, and naming
the repository alongside the commit is a change to the value's shape rather than
to this resolution.

The runbook recipe overloaded one placeholder across a reference and a commit, so
pasting the workflow's whole `uses:` value into `git show` failed, and the value
it exported produced a shape the paragraph's own enumeration did not list. The
placeholders are now distinct and the exported value matches the enumerated
remote form.

Two claims beside them were wrong. The hub-hosted exemption is a standing list
rather than a consequence of what the hub currently holds, which one entry with
history and no tree file already disproves. And this repository's own run is not
the workspace-relative case the action's comment named, since it reaches the gate
through the reusable workflow's repository-qualified self-reference, so what the
contexts carry there is read off the first run rather than asserted here.

The clean-copy case asserted a prefix of the moved one, so dropping the pathspec
from the status query passed while naming every clean copy moved. Verified by
mutation that it now fails three cases. The unrelated-checkout case is renamed
for the trackedness it actually gates.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…mpty Scan as Clean

An exclusion is a substring test, so the empty one is a substring of every key.
It empties the scan and the run still exits 0, printing a scope of zero beside an
exit of zero exactly as a clean tree does. That is the false clean this gate is
built to refuse, reaching it through an argument rather than through any of the
resolutions the scope line already guards.

It is reachable rather than theoretical, and this branch made it more so. The
composite action skips a blank line when it builds arguments from a repository's
exclusions file, and the runbook paragraph added here asks a reader to reproduce
those arguments by hand, where no such step exists unless it is stated. The
paragraph said "non-comment lines", which admits a blank one. It now says
non-empty as well, and the gate refuses the value rather than trusting every
caller to have read that sentence.

Two claims the third pass found wrong are corrected with it. The reproduction
recipe exported a provenance value identical in shape to a genuine pinned CI
verdict, so the two runs it exists to tell apart printed the same clause; it now
says it is reproducing one. And a test docstring asserted what this repository's
own CI run resolves to, which the action beside it deliberately declines to state
until a real run measures it, so it no longer predicts an answer nothing has yet
observed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings September 7, 2026 17:45
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: b4b9792d-26e0-44ff-b3ab-58c570a09db3


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

Comment @coderabbitai help to get the list of available commands.

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.

🟡 Changes recommended

The new provenance and exclude-blank guards have edge cases that can yield empty gate output or inconsistent CI behavior and should be fixed before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves the prose gate’s diagnosability across pinned workflow versions by ensuring every verdict reports which copy of the gate produced it, and by tightening handling around exclusions that can otherwise yield false-clean results.

Changes:

  • Add provenance resolution and scope-line reporting (gate <provenance>) to the prose gate output.
  • Refuse empty/blank --exclude values (with tests) to prevent “scan nothing, exit 0” false-cleans.
  • Document the reproduction workflow and new provenance mechanism in GOVERNANCE.md and scripts/README.md.
File summaries
File Description
scripts/tests/test_prose_lint.py Adds tests for empty-exclude refusal and for provenance attribution behavior across invocation modes.
scripts/README.md Documents that the scope line now includes the gate provenance and how it is resolved/passed.
GOVERNANCE.md Adds a runbook for reproducing downstream prose-gate findings using the pinned copy and matching excludes.
.github/actions/prose-gate/prose_lint.py Implements provenance resolution, prints it on the scope line, and refuses empty exclusions.
.github/actions/prose-gate/action.yml Passes the action’s own owner/repo@ref pin to the script via --provenance and continues to build exclusions.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

ptr727 and others added 2 commits September 7, 2026 10:54
…e Way the Action Does

Two findings from the first review round, both against text this branch wrote.

A whitespace-only `--provenance` was truthy, so it passed the test and then
stripped itself to nothing, printing the label with an empty value after it. It
is now stripped before it is tested, so a source carrying no value falls through
to the next one, which is what carrying none means.

The empty-exclusion guard judged blank with Python's `str.strip`, whose set is
wider than the ASCII whitespace class the composite action trims an exclusions
line with. A line holding only a non-breaking space therefore survives the
action's trim, arrives here as a non-empty argument, and would have been refused,
failing that repository's gate on every run over an exclusion that is merely
inert. The guard now names the same set the action uses, so it cannot refuse a
value the action itself builds.

Verified by mutation that reverting either change fails two cases each. The empty
exclusion is still refused with exit 2.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…clusions Too

Three claims the local pass found wrong, each about the blank-line handling the
previous commit reasoned from.

The action trims every exclusions line before passing it, and the recipe said to
pass each non-empty, non-comment line without saying so. The repository's own
fixture writes padded CRLF lines, which is the shape such a file actually holds,
so a reader following the sentence literally passes a value that is a substring
matching no key. It excludes nothing and says nothing about having failed, which
is the same silent divergence from CI the paragraph exists to prevent, in the one
direction it did not warn about.

`ASCII_BLANK` was described as what bash's `[[:space:]]` holds in the C locale,
and the action does not run in the C locale. Under a UTF-8 locale that class also
covers several Unicode spaces, so the sets are not equal in either direction
claimed. What matters is the ordering rather than an equality: the action's trim
always removes at least this set, `[[:space:]]` and `str.strip` are each supersets
of it, and naming the smallest keeps the divergence one way, which is the
direction where the guard cannot fail a repository over an inert exclusion.

The action's comment said no caller in this tree names it by a workspace-relative
path. Both `test-pull-request.yml` and `publish-release.yml` call the reusable
workflow that way, so this repository's own runs may take the checkout fallback,
and it is a downstream repository calling at a pin that the two variables exist
for. The comment no longer predicts which, since not having to predict it is the
point of a verdict that names its own copy.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings September 7, 2026 18:06

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.

🟢 Approval recommended

The changes are coherent, well-tested, and consistently wired through the action, script, and documentation without introducing behavioral regressions.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@ptr727

ptr727 commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

ptr727 added a commit that referenced this pull request Sep 7, 2026
…carried path fix (#1422)

Promote `develop` to `main`. Four commits, no code behavior change
outside the prose gate's own
reporting and its tests.

- **#1417** Name the Prose Gate's Own Copy on Every Verdict. A
`dead-path` violation CI reported
could not be reproduced locally, because the gate read a different copy
of the file than the one
the operator had in hand and never said which. Every verdict now names
the copy it read.
- **#1409** Say Which Reviewers a Repository Has, and Split the Reviewer
Doc in Two. Reviewer
availability turns on repository visibility and star count, and the one
doc that stated it mixed
the evaluation with the operating reference. Split, with the
availability rule stated where a
  driver reads it.
- **#1414** Replace Three Hub-Only Pointers in a Carried Skill Reference
With the Behavior. The
carried reference named `repo-config` paths that exist only in the hub,
so a downstream prose gate
  failed the moment the file landed in a diff there.
- **#1410** Bump `streetsidesoftware/cspell-action` from 9.0.1 to 9.1.0.

Closes #1412
Closes #1403

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Prose-check findings now identify the specific gate version that
produced them, improving traceability across repositories and revisions.
- Invalid empty exclusion values are rejected instead of being treated
as a full-tree scan.

- **Documentation**
- Added guidance for reproducing prose-check findings and diagnosing
outdated pinned versions.
- Expanded reviewer documentation covering availability, skip behavior,
limits, and repository scope.
  - Updated review-loop references and release workflow guidance.

- **Maintenance**
  - Updated the spell-checking tool version used in validation.


<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants