Skip to content

feat(review): detect successor-superseded reversals for the one-shot close culture - #8188

Merged
JSONbored merged 1 commit into
mainfrom
feat/reversal-superseded
Jul 23, 2026
Merged

feat(review): detect successor-superseded reversals for the one-shot close culture#8188
JSONbored merged 1 commit into
mainfrom
feat/reversal-superseded

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

Adds the successor-based reversal detector (#8166): when a PR merges, scan the last 30 days of real (non-dry-run) bot closes in the same repo and record a reversal_superseded event — plus the per-rule reversed human-override events the calibration corpus consumes — for any bot-closed PR the merge supersedes.

Why

The gate's own one-shot design tells a wronged contributor "recovery = open a fresh PR", so the reopen-shaped reversal signal is structurally near-impossible here — verified against the full production ledger: zero reversal events ever recorded. This is the culture's actual "the bot was wrong" shape, and it is what finally feeds the corpus's positive class organically.

How

Validation

  • Full npm run test:ci green locally (1118 test files).
  • 100% line+branch coverage on both touched src ranges, including the fail-safe arms (forced write rejections, undefined D1 result set, garbage target keys, self-close skip).

Closes #8166

…close culture

The reopen-shaped reversal signal is structurally near-impossible under this
gate's one-shot design (verified: zero reversal events in the full production
ledger), so bot-was-wrong evidence never reaches the calibration corpus's
positive class. Detect the culture's actual reversal shape instead: a merged
PR that shares a linked issue with a recently bot-closed PR, or the same
author reworking a majority of its files, records reversal_superseded plus
the per-rule reversed overrides the corpus consumes. Conservative matcher
(borderline records nothing), idempotent per closed target, fail-safe on
every write, and counted in the public reversal stats.

Closes #8166
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.63%. Comparing base (d89698d) to head (67ac8dc).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8188      +/-   ##
==========================================
- Coverage   92.07%   89.63%   -2.44%     
==========================================
  Files         769      101     -668     
  Lines       77882    23021   -54861     
  Branches    23529     3965   -19564     
==========================================
- Hits        71707    20635   -51072     
+ Misses       5062     2199    -2863     
+ Partials     1113      187     -926     
Flag Coverage Δ
shard-1 42.85% <97.67%> (-9.53%) ⬇️
shard-2 81.70% <23.25%> (+24.59%) ⬆️
shard-3 48.62% <18.60%> (-4.69%) ⬇️

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

Files with missing lines Coverage Δ
src/review/outcomes-wire.ts 92.51% <100.00%> (+0.92%) ⬆️
src/review/public-stats.ts 97.56% <ø> (ø)
src/review/reversal-superseded.ts 100.00% <100.00%> (ø)
src/services/public-accuracy-trend.ts 100.00% <ø> (ø)

... and 669 files with indirect coverage changes

@JSONbored JSONbored self-assigned this Jul 23, 2026
@JSONbored
JSONbored merged commit 06ebd53 into main Jul 23, 2026
14 checks passed
@JSONbored
JSONbored deleted the feat/reversal-superseded branch July 23, 2026 09:31
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.

calibration: detect one-shot-culture reversals — bot-closed PR superseded by a merged successor (reversal_superseded)

1 participant