Skip to content

feat(metrics): widen the revert rule and add the escaped-defect count (T879a) - #199

Merged
bketelsen merged 5 commits into
mainfrom
lucilla/pr-outcomes
Nov 5, 2026
Merged

bketelsen merged 5 commits into
mainfrom
lucilla/pr-outcomes

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

ACMM scorecard (T879a, 2026-11-04), missing instruments 3 and 5 (G1 and G7): the spec's revert rule missed bketelsen/fleet#99 (Revert #94: …, no Reverts line), and no rule or tool counted escaped defects.

  • docs/specs/pr-acceptance-metric.md: new ### Revert rule. A change (merged PR, or a default-branch commit that is no PR's own commit) reverts merged PR P by 1 of 3 rules: the quoted title Revert "T" (T = P's title, or its squash subject T (#P)); a revert word and a reference to P in the title, any order; a body line with a revert word and, after it, a reference to P. References: #N, owner/name#N, PR URL; they resolve only to merged PRs in the input. fleet#99 is the named vector. New ### Escaped defects: cohort = PRs by the given authors (default frostyard-machines) merged in [from, to); complete only when as_of ≥ to + 7 days (no rate before); P escaped when a change merged in (P, P + 7 days] reverts P or names P as fixed: a fix word (closed list) and a reference to P with at most 3 words between, either order, no sentence end between, in the title or 1 body line. The ## Definition and ## Rules headings stay (docs gate pin).
  • scripts/lib/pr-outcomes.mjs: pure functions an audit can import: parseReferences, prCommitNumber, normalizeChanges, findReverts, namesAsFixed, escapedDefects. Each match carries its rule and the line that matched.
  • scripts/pr-outcomes.mjs: read-only CLI, reverts and escaped, from gh (gh pr list --search merged:…, gh api --paginate --slurp repos/R/commits) or from --input FILE (no network). 1000 PRs from 1 search is an error, never a silent partial count.
  • Review fixes (spec and code): rule 1 with identical titles names the PR merged last before C (tie: the larger number); a commit whose SHA is any PR's merge commit is no change; 1 PR is 1 change, and 2 records of 1 PR that differ in any field are an error; letters and digits are Unicode (\p{L}, \p{N}); changes and the cohort are PRs merged into the default branch (the CLI reads it with gh api repos/R, keeps off-branch PRs only for their merge SHAs); both CLI modes apply the same --repo and window selection; fix-name matching is linear (4 tokens each way).
  • .memory/corrections.jsonl: 3 lines (blocker to guard).
  • test/pr-outcomes.test.mjs: 37 tests. docs/design/quality-loop.md: 1 line in Observe.

For the audit (bketelsen/pi-pocket-team Q1, not changed here): call findReverts (or run reverts --input) instead of the title-only rule; then Q1's "reverts its rule misses" note in the spec is no longer needed, so the spec now says Q1 reports the changes it matched.

Risk tier

Risk tier: 1 — a metric spec, a read-only report and its tests. No workflow, authority, policy, or risk path; the report is not in verify/check.

Verification

  • node --test test/pr-outcomes.test.mjs: 37/37 pass. make ci: 313 tests pass, docs gate green (head 95634fb).

  • Vectors: fleet#99 → fleet#94 by rule "title"; the GitHub button form (rules 1 and 3, each alone); Revert "X (#94)"; revert: undo frostyard/updex#12 across repositories; negatives (no reference, a number that is no merged PR, a revert before P, a self-reference, #94 after a letter or &, a reference before the revert word in the body, a cross-repository #N); the spec's fix-name vectors (4 positive, 2 negative, exactly 3 and 4 words between); window bounds (P + 7 days counts, + 1 ms does not); cohort bounds and the author filter; incomplete cohort (to + 7 days − 1 ms); 2 fixing changes count once; a squash commit is no change, a direct revert commit is; the CLI with --input, text and JSON, and exit 2 on a usage error.

  • Revert test (scratch worktree from the PR head, removed after): rule 2 (title) switched off, tests kept: 9 of 26 fail on assertions (at bf7013b; 10 of 34 at the fix round), among them fleet#99 reverts fleet#94 by the title rule, fleet#94 is 1 escape over a complete cohort, …, rule 2 across repositories: revert: undo frostyard/updex#12.

  • Real run, read-only: node scripts/pr-outcomes.mjs reverts --repo bketelsen/fleet --repo frostyard/frostnotes --since 2026-10-04T00:00:00Z --until 2026-11-05T00:00:00Z finds fleet#99 → fleet#94 (rule title). escaped --repo bketelsen/fleet --from 2026-10-28T00:00:00Z --to 2026-10-29T00:00:00Z: complete, merged 8, escaped 1 (fleet#94, by revert and by the fix line PR #94 broke the regexes). The baseline's other revert, frostnotes 0ddd26e (10-19), is a direct commit that reverts a direct commit (docs: keep plan 0007 …, no PR with that title): no PR was reverted, so it is outside a PR metric, and the tool rightly reports none.

  • Revert tests for the review fixes: each new test fails with its fix off (coder's check at be391ed); in a scratch worktree with the code of be391ed and the tests of ce5b261, the off-branch merge-commit and 2-page fetch tests fail, and with the tie-break clause removed the same-instant test fails too; with the 95634fb lib change stashed, the branch-duplicate test fails.

  • Cross-review (reviewer openai/gpt-6.1-sol; coders deepseek/deepseek-flash for code and tests, github-copilot/claude-opus-5.5 for the spec and small fixes; base 408ec56): initial review at bf7013b: Not ready, 6 blocking (identical titles in rule 1; squash commits by subject only; duplicate PRs inflate the denominator; ASCII boundaries vs "letters"; --input ignored the selection; branch scope unstated) and 1 low (cubic matching), all accepted, fixed in be391ed. Re-review 1 at be391ed: Not ready, 2 blocking (an off-branch PR dropped before its merge SHA was read; tie-break not in the spec) and 1 low (fetch test lost its 2nd page), fixed in ce5b261. Re-review 2 at ce5b261: Not ready, 1 blocking (duplicate check ignored the branch fields), fixed in 95634fb. Re-review 3 at 95634fb: Ready, Blocking: none. Budget used: 1 review + 3 re-reviews.

  • Base moved after the final review: core#198 merged into main (99d37ee) while this PR was in review, and both PRs append to .memory/corrections.jsonl. Merge commit 98c9374 (no force-push) merges origin/main and keeps feat(corrections-report): --ref reads each file at a ref, once per clone (T879a) #198's 2 lines before this PR's 3 (append-only check passes). The PR's changed lines against its new base are byte-for-byte the changed lines of the reviewed range 408ec56..95634fb (checked with git diff … | grep '^[+-]' on both ranges, the corrections file compared by added lines). make ci at 98c9374: 321 tests pass; CI green. By the cross-review policy, a new base invalidates the final review and the budget was used; Brian authorized 1 more re-review (T881a). Re-review 4 (openai/gpt-6.1-sol) of the merge 95634fb..98c9374, base and merge-base 99d37ee: the metric files are byte-for-byte those of the Ready head, the corrections order is append-only with no line lost or duplicated, no adverse interaction with feat(corrections-report): --ref reads each file at a ref, once per clone (T879a) #198: Ready, Blocking: none.

Docs housekeeping

  • Spec changed alongside its code; design doc back-link in Observe; no new doc.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 5, 2026
@bketelsen
bketelsen merged commit 0d28f5b into main Nov 5, 2026
6 checks passed
@bketelsen
bketelsen deleted the lucilla/pr-outcomes branch November 5, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants