Skip to content

feat(engine): AMS calibration corpus — pair predicted gate verdicts with realized PR outcomes#8200

Merged
JSONbored merged 1 commit into
mainfrom
feat/ams-calibration-corpus
Jul 23, 2026
Merged

feat(engine): AMS calibration corpus — pair predicted gate verdicts with realized PR outcomes#8200
JSONbored merged 1 commit into
mainfrom
feat/ams-calibration-corpus

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

The #8172 epic's foundation (#8183): buildAmsPredictionCorpus turns the miner's own prediction-ledger rows + pr_outcome events into the exact labeled BacktestCase shape the shared calibration primitives consume — adapters over the miner ledger, not new math.

How

  • Class mapping (the miner's reversal analog): a directional prediction (merge/close) whose realized outcome agrees labels confirmed; contradiction labels reversed. Hold-shaped/unrecognized predictions, pending PRs, non-terminal outcomes, and malformed rows all skip conservatively.
  • Join semantics: repo + PR number; re-predictions of one head collapse to the latest, distinct heads each stand as their own correctly-labeled case. Deterministic output order via a composite sort key.
  • Replay-ready: the 0-100 readiness score normalizes into the [0,1] confidence field the threshold classifier replays against; engineVersion rides case metadata with filterCasesByEngineVersion for comparable-build slicing.
  • Miner surface: two thin projections in calibration-cli.ts and a corpus-stats line (aggregates only — corpus content never prints) in both text and --json output.
  • Fully local: a node's corpus never leaves the node.

Validation

Full npm run test:ci ran with zero test failures (1119 files); the run's only red was a since-fixed local-artifact prettier gap (#8199coverage/ reports in a reused worktree; CI checkouts are clean). 100% line+branch on the engine module and the touched CLI ranges via the root mirror suite (engine blind-spot rule) + pack tests.

Closes #8183

…ith realized PR outcomes

The #8172 epic's foundation (#8183): buildAmsPredictionCorpus turns the
miner's own prediction-ledger rows + pr_outcome events into the exact
labeled BacktestCase shape the shared calibration primitives consume.
Class mapping: agreement between a directional prediction (merge/close)
and the realized outcome labels confirmed; contradiction labels reversed —
the miner's reversal analog. Hold-shaped/unrecognized predictions,
pending PRs, non-terminal outcomes, and malformed rows all skip
conservatively. Re-predictions of one head collapse to the latest;
distinct heads each stand as their own correctly-labeled case. The
readiness score (0-100) normalizes into the [0,1] confidence field the
threshold classifier replays against, and engineVersion rides case
metadata with a filterCasesByEngineVersion helper for comparable-build
slicing. Everything downstream (score/compare/split/render) is reused
untouched — adapters over the miner ledger, not new math.

Miner side: two thin projections in calibration-cli.ts and a corpus
stats line (aggregates only, corpus content never prints) in both text
and --json output — the local evidence base #8184's backtest will replay
against. Fully local: a node's corpus never leaves the node.

Closes #8183
@superagent-security

Copy link
Copy Markdown
Contributor

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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui 23766f0 Commit Preview URL

Branch Preview URL
Jul 23 2026, 11:19 AM

@JSONbored JSONbored self-assigned this Jul 23, 2026
@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 92.08%. Comparing base (9d021ad) to head (23766f0).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8200   +/-   ##
=======================================
  Coverage   92.07%   92.08%           
=======================================
  Files         771      772    +1     
  Lines       77942    78002   +60     
  Branches    23545    23564   +19     
=======================================
+ Hits        71767    71827   +60     
  Misses       5062     5062           
  Partials     1113     1113           
Flag Coverage Δ
shard-1 58.13% <34.92%> (-0.36%) ⬇️
shard-2 54.05% <1.58%> (+4.29%) ⬆️
shard-3 50.03% <66.66%> (-4.81%) ⬇️

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

Files with missing lines Coverage Δ
...er-engine/src/calibration/ams-prediction-corpus.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/calibration-cli.ts 100.00% <100.00%> (ø)

@JSONbored
JSONbored merged commit d40421e into main Jul 23, 2026
15 checks passed
@JSONbored
JSONbored deleted the feat/ams-calibration-corpus branch July 23, 2026 11:30
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.

ams-calibration: pure corpus adapter pairing prediction-ledger predictions with realized pr_outcome events

1 participant