Skip to content

feat(audit): a pull-request preset for chant audit and chant lint, held to a precision bar on a replay (#5118) - #5127

Merged
lex00 merged 1 commit into
mainfrom
estate/int-chant-6
Nov 15, 2026
Merged

lex00 merged 1 commit into
mainfrom
estate/int-chant-6

Conversation

@lex00

@lex00 lex00 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Closes #5118

The last open item of the estate-read work in chant (#5105). It adds a pull-request preset for chant audit and chant lint, held to a precision bar on a replay of real history.

What it adds

  • --preset pull-request and --baseline <file> on chant audit and chant lint. The baseline is the same command's JSON or SARIF report on the base, and only findings whose identity (audit findings carry no stable identity, so a rename reports every old finding as new #5106) is not in it are reported. A merge-blocking finding fails the run. The floor is warning. A rule in no set is off, and the source gives each off rule's measured reason (packages/core/src/audit/pull-request-preset.ts).
  • The replay harness, test/pr-preset-replay/replay.ts (just replay-pr-preset <corpus> [work]). On both sides of every change it reruns audit, per-file import with lint, and helm localize, then compares by identity and scores the labelled findings. It exits 1 below the bar, on a lost true finding, when more than 10 changes are blocked, or when a merge-blocking finding has no label.
  • bar.test.ts scores the labelled corpus.json in the unit suite. The corpus holds commit SHAs, paths, rule ids and labels, with no people. replay.e2e.test.ts reruns the whole replay when CHANT_REPLAY_CORPUS is set.
  • A guide page, guide/pull-request-check.mdx, with flag rows in cli/audit.mdx and cli/lint.mdx, a CHANGELOG entry, and a level-0 exception row. chant lint --format json gains locator, and the getting-started golden also picks up the entity field it was missing.

Rule lists, changed from the issue

Six rules the issue lists as merge-blocking (GRAF104, GRAF105, WK8203, WK8204, WK8205, TF002) had no true finding in either window, so they are report-only. The numbers are on #5118.

Done when

  • On the saved corpus, merge-blocking precision is 17 of 17 with all 17 true findings kept. The issue's own lists give 17 of 46 (37.0%).
  • 3 of the 159 changes get a merge-blocking finding.
  • The harness exits non-zero below the bar (score.ts barFailures; it exited 1 before labelling).
  • The second window, 2025-11 to 2026-05, is documented in the guide, and its numbers are on A pull request preset for chant audit and lint, held to a precision bar on a replay #5118: 0 true findings of 1020, nothing blocked under the preset.

Gates on this branch

  • The commit is cherry-picked onto main.
  • just build and core tsc are clean.
  • The preset, CLI and bar tests pass: 24 tests in 4 files.
  • scripts/release-floors.ts --npm agrees.

…ld to a precision bar on a replay (#5118)

chant audit and chant lint take --preset pull-request and --baseline <file>.
The preset places each rule as merge-blocking, report-only or a tool notice,
drops findings below warning, and fails the run on a merge-blocking finding.
With --baseline, the same command's JSON or SARIF report on the base, only
findings whose identity is not in it are reported. Identities are computed
over the whole run before anything is left out, and lint findings carry
their identity, gate and the post-synth locator.

test/pr-preset-replay holds the replay harness, the labelled corpus of the
findings it found on 159 merged changes of a public Kubernetes infrastructure
repository, and a unit test that scores the preset against it. On that
window the preset keeps all 17 true findings, 17 of 17 merge-blocking, on 3
changes, against 17 of 721 with every rule on. On the six months before it
the preset blocks nothing; the merge-blocking list first proposed blocked 8
changes there with no true finding, so GRAF104, GRAF105, WK8203, WK8204,
WK8205 and TF002 report and do not block.
@lex00
lex00 merged commit 479f6ff into main Nov 15, 2026
9 checks passed
@lex00
lex00 deleted the estate/int-chant-6 branch November 15, 2026 22:52
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.

A pull request preset for chant audit and lint, held to a precision bar on a replay

1 participant