Skip to content

feat(calibration): counterfactual replay contract — fixtures, spend, and scoring decided - #8242

Merged
JSONbored merged 1 commit into
mainfrom
feat/counterfactual-contract
Jul 23, 2026
Merged

feat(calibration): counterfactual replay contract — fixtures, spend, and scoring decided#8242
JSONbored merged 1 commit into
mainfrom
feat/counterfactual-contract

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

The #8219 design deliverable for the counterfactual sub-epic (#8218): the three contracts the assembler (#8220) and harness (#8221) implement against, shipped as typed interfaces + constants in the engine plus the docs design section — decisions in code, not prose.

  • Fixtures: replayable = bounded diff + human label; capture-era provenance carried (live vs backfilled) so era-skewed 'improvements' are visible; over-budget selection is a seeded deterministic sample recorded per run — never 'the first N'.
  • Spend: neuron-estimate units matching live AI budgeting; hard per-run cap defaulting well under one day's review spend; partial-run persist + resume cursor; local-model smoke path, BYOK behind explicit flags; offline-only (never posts, never touches live reviews).
  • Scoring: a variant is just another classifier — scoreBacktest/compareBacktestScores apply unchanged; unparseable output is an ABSTENTION, counted and excluded, never coerced (coercion would let a degenerate prompt farm precision by failing on hard cases).

Validation

Full npm run test:ci green (TEST_CI_EXIT=0); the contract module is 100% covered by its root mirror suite (every arm of the shared replayability rule + pinned constants).

Closes #8219

…and scoring decided (#8219)

The design deliverable the counterfactual sub-epic (#8218) implements
against, as typed constants/interfaces the assembler (#8220) and harness
(#8221) must cite rather than reinvent:

- Fixtures: replayable = bounded diff + human label; capture-era
  provenance carried so era-skewed improvements are visible; over-budget
  selection is a SEEDED deterministic sample recorded per run — never
  'the first N'.
- Spend: neuron-estimate units matching live AI budgeting, hard per-run
  cap defaulting well under one day's review spend, partial-run persist +
  resume cursor (the #8170 discipline), local-model smoke path, BYOK
  behind explicit flags, offline-only.
- Scoring: a variant is just another classifier — scoreBacktest and the
  Pareto comparator apply unchanged; unparseable output is an ABSTENTION,
  counted and excluded, never coerced (coercion would let a degenerate
  prompt farm precision by failing on hard cases).

Docs page gains the design section; contract module 100% covered by its
mirror suite.

Closes #8219
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 23, 2026

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 7e3a074 Commit Preview URL

Branch Preview URL
Jul 23 2026, 02:09 PM

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 3.97kB (0.05%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
loopover-ui 7.41MB 3.97kB (0.05%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: loopover-ui

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/add-scalar-classes-D3rq9xtW.js (New) 2.17MB 2.17MB 100.0% 🚀
assets/tanstack-vendor-C9I3f1Mu.js (New) 739.41kB 739.41kB 100.0% 🚀
assets/docs.fumadocs-spike-api-reference-WgBctSW4.js (New) 442.92kB 442.92kB 100.0% 🚀
assets/AgentScalarChatInterface.vue-DcT-pZ4R.js (New) 201.71kB 201.71kB 100.0% 🚀
assets/modal-Cr5d5oey.js (New) 184.38kB 184.38kB 100.0% 🚀
assets/client-B60zdVpt.js (New) 146.06kB 146.06kB 100.0% 🚀
assets/maintainer-panel-BercFcx_.js (New) 78.99kB 78.99kB 100.0% 🚀
assets/ui-vendor-nkHtj3HX.js (New) 57.04kB 57.04kB 100.0% 🚀
assets/routes-DdWjWq2C.js (New) 34.98kB 34.98kB 100.0% 🚀
assets/owner-panel-DqMNt4RP.js (New) 27.36kB 27.36kB 100.0% 🚀
assets/app-Cf8Utycq.js (New) 25.7kB 25.7kB 100.0% 🚀
assets/backtest-calibration-DiK-ileJ.js (New) 24.2kB 24.2kB 100.0% 🚀
assets/app.runs-Dr4KpOcz.js (New) 23.56kB 23.56kB 100.0% 🚀
assets/miner-panel-Dz4c8Rc1.js (New) 20.28kB 20.28kB 100.0% 🚀
assets/api._op-BWBM5VYq.js (New) 17.57kB 17.57kB 100.0% 🚀
assets/self-hosting-docs-audit-DmgIlagQ.js (New) 16.61kB 16.61kB 100.0% 🚀
assets/app.index-YIcwF9Pk.js (New) 15.62kB 15.62kB 100.0% 🚀
assets/docs._slug-D9XRJVH1.js (New) 15.22kB 15.22kB 100.0% 🚀
assets/playground-panel-BWVQZXjk.js (New) 14.49kB 14.49kB 100.0% 🚀
assets/app.audit-IzFtF1ac.js (New) 10.11kB 10.11kB 100.0% 🚀
assets/app.config-generator-CJA-i21w.js (New) 10.09kB 10.09kB 100.0% 🚀
assets/extension-Csh8DsRX.js (New) 10.04kB 10.04kB 100.0% 🚀
assets/fairness-CoGB97MH.js (New) 8.34kB 8.34kB 100.0% 🚀
assets/maintainers-CP2hTmzK.js (New) 8.09kB 8.09kB 100.0% 🚀
assets/miners-5tvrZJTL.js (New) 7.91kB 7.91kB 100.0% 🚀
assets/agents-CE0KnMP1.js (New) 7.8kB 7.8kB 100.0% 🚀
assets/commands-panel-CrRhwKxP.js (New) 6.65kB 6.65kB 100.0% 🚀
assets/maintainer-workflow-7x8YLaXy.js (New) 6.52kB 6.52kB 100.0% 🚀
assets/roadmap-Cu1eOL7h.js (New) 6.33kB 6.33kB 100.0% 🚀
assets/digest-panel-DUnGrVZ2.js (New) 6.18kB 6.18kB 100.0% 🚀
assets/repos._owner._repo.quality-wbCy0EHe.js (New) 6.14kB 6.14kB 100.0% 🚀
assets/docs.index-ZOUQhyzZ.js (New) 5.73kB 5.73kB 100.0% 🚀
assets/docs-nav-MSMyWxY2.js (New) 5.53kB 5.53kB 100.0% 🚀
assets/api.index-BLB5us1k.js (New) 4.7kB 4.7kB 100.0% 🚀
assets/docs-CTsjHc15.js (New) 2.7kB 2.7kB 100.0% 🚀
assets/api-Hny21q6v.js (New) 2.69kB 2.69kB 100.0% 🚀
assets/docs-page-CN3bWIyo.js (New) 2.1kB 2.1kB 100.0% 🚀
assets/table-bOgZuwpj.js (New) 1.75kB 1.75kB 100.0% 🚀
assets/app.workbench-gYyWsto7.js (New) 1.58kB 1.58kB 100.0% 🚀
assets/session-CLa6UUE5.js (New) 1.45kB 1.45kB 100.0% 🚀
assets/tooltip-QUXIINQh.js (New) 1.45kB 1.45kB 100.0% 🚀
assets/tabs-DNjBiXep.js (New) 1.39kB 1.39kB 100.0% 🚀
assets/app.repos-DFtbCG15.js (New) 1.07kB 1.07kB 100.0% 🚀
assets/input-S5poX0rM.js (New) 796 bytes 796 bytes 100.0% 🚀
assets/file-cog-IwoCUr2g.js (New) 758 bytes 758 bytes 100.0% 🚀
assets/app.maintainer-Bpu-pnlV.js (New) 502 bytes 502 bytes 100.0% 🚀
assets/sparkles-C1qAE6TA.js (New) 494 bytes 494 bytes 100.0% 🚀
assets/app.owner-xVqmP_En.js (New) 474 bytes 474 bytes 100.0% 🚀
assets/app.commands-CwZGK8cW.js (New) 455 bytes 455 bytes 100.0% 🚀
assets/app.playground-Coh7u8om.js (New) 442 bytes 442 bytes 100.0% 🚀
assets/reveal-D2Lv3-53.js (New) 442 bytes 442 bytes 100.0% 🚀
assets/index-BgRHUET5.js (New) 438 bytes 438 bytes 100.0% 🚀
assets/app.digest-N9aktV0p.js (New) 430 bytes 430 bytes 100.0% 🚀
assets/eye-off-u4mEMwlR.js (New) 430 bytes 430 bytes 100.0% 🚀
assets/app.miner-CdVIoH0R.js (New) 422 bytes 422 bytes 100.0% 🚀
assets/key-round-BjgFKgrj.js (New) 355 bytes 355 bytes 100.0% 🚀
assets/bot-B-mjzlOP.js (New) 328 bytes 328 bytes 100.0% 🚀
assets/trash-2-C5WZtdZ-.js (New) 328 bytes 328 bytes 100.0% 🚀
assets/save-DDO8KbVD.js (New) 327 bytes 327 bytes 100.0% 🚀
assets/git-pull-request-arrow-D4Evj_CG.js (New) 321 bytes 321 bytes 100.0% 🚀
assets/wrench-3nzK6TrR.js (New) 303 bytes 303 bytes 100.0% 🚀
assets/list-checks-CF2JFWab.js (New) 279 bytes 279 bytes 100.0% 🚀
assets/shield-B_GyRMcf.js (New) 272 bytes 272 bytes 100.0% 🚀
assets/workflow-D2JKOVW7.js (New) 265 bytes 265 bytes 100.0% 🚀
assets/compass-DqLG7TVg.js (New) 251 bytes 251 bytes 100.0% 🚀
assets/history-B_Ka9JZ1.js (New) 237 bytes 237 bytes 100.0% 🚀
assets/activity-Bemcl8qp.js (New) 234 bytes 234 bytes 100.0% 🚀
assets/message-square-DKIBQJF0.js (New) 233 bytes 233 bytes 100.0% 🚀
assets/lock-0AjoYcqc.js (New) 206 bytes 206 bytes 100.0% 🚀
assets/rotate-cw-DpNJd5VJ.js (New) 201 bytes 201 bytes 100.0% 🚀
assets/play-QWOuWz8u.js (New) 190 bytes 190 bytes 100.0% 🚀
assets/circle-check-RR5Up6xM.js (New) 178 bytes 178 bytes 100.0% 🚀
assets/search-B5sERELP.js (New) 174 bytes 174 bytes 100.0% 🚀
assets/circle-BeZFsMBI.js (New) 130 bytes 130 bytes 100.0% 🚀
assets/add-scalar-classes-Vo6khwrj.js (Deleted) -2.17MB 0 bytes -100.0% 🗑️
assets/tanstack-vendor-DwRrbLVG.js (Deleted) -739.41kB 0 bytes -100.0% 🗑️
assets/docs.fumadocs-spike-api-reference-CeIfx7Ms.js (Deleted) -442.92kB 0 bytes -100.0% 🗑️
assets/AgentScalarChatInterface.vue-CLVJPor-.js (Deleted) -201.71kB 0 bytes -100.0% 🗑️
assets/modal-DsAHlH2e.js (Deleted) -184.38kB 0 bytes -100.0% 🗑️
assets/client-DeZupq4J.js (Deleted) -146.06kB 0 bytes -100.0% 🗑️
assets/maintainer-panel-Da1hS6--.js (Deleted) -78.99kB 0 bytes -100.0% 🗑️
assets/ui-vendor-CFGUHXJi.js (Deleted) -57.04kB 0 bytes -100.0% 🗑️
assets/routes-DWP0271E.js (Deleted) -34.98kB 0 bytes -100.0% 🗑️
assets/owner-panel-BjaJBR6l.js (Deleted) -27.36kB 0 bytes -100.0% 🗑️
assets/app-p3CcOTh2.js (Deleted) -25.7kB 0 bytes -100.0% 🗑️
assets/app.runs-DJfFC5Xm.js (Deleted) -23.56kB 0 bytes -100.0% 🗑️
assets/miner-panel-ChnLB8W6.js (Deleted) -20.28kB 0 bytes -100.0% 🗑️
assets/backtest-calibration-TKigdVya.js (Deleted) -20.23kB 0 bytes -100.0% 🗑️
assets/api._op-2Xbkr33X.js (Deleted) -17.57kB 0 bytes -100.0% 🗑️
assets/self-hosting-docs-audit-BjHcBMqx.js (Deleted) -16.61kB 0 bytes -100.0% 🗑️
assets/app.index-0L0WC_Ul.js (Deleted) -15.62kB 0 bytes -100.0% 🗑️
assets/docs._slug-B0jxlHRk.js (Deleted) -15.22kB 0 bytes -100.0% 🗑️
assets/playground-panel-BcFJdQ4M.js (Deleted) -14.49kB 0 bytes -100.0% 🗑️
assets/app.audit-BxC95U1i.js (Deleted) -10.11kB 0 bytes -100.0% 🗑️
assets/app.config-generator-0M_ShS5R.js (Deleted) -10.09kB 0 bytes -100.0% 🗑️
assets/extension-CG646fcg.js (Deleted) -10.04kB 0 bytes -100.0% 🗑️
assets/fairness-CgvurdWc.js (Deleted) -8.34kB 0 bytes -100.0% 🗑️
assets/maintainers-DlkK2BDr.js (Deleted) -8.09kB 0 bytes -100.0% 🗑️
assets/miners-PyAvgGtx.js (Deleted) -7.91kB 0 bytes -100.0% 🗑️
assets/agents-CRqWjdm7.js (Deleted) -7.8kB 0 bytes -100.0% 🗑️
assets/commands-panel-B2-ettNh.js (Deleted) -6.65kB 0 bytes -100.0% 🗑️
assets/maintainer-workflow-DSZqia8n.js (Deleted) -6.52kB 0 bytes -100.0% 🗑️
assets/roadmap-BULjprxu.js (Deleted) -6.33kB 0 bytes -100.0% 🗑️
assets/digest-panel-DfO3NOkX.js (Deleted) -6.18kB 0 bytes -100.0% 🗑️
assets/repos._owner._repo.quality-Cn1jT-wl.js (Deleted) -6.14kB 0 bytes -100.0% 🗑️
assets/docs.index-bOpitwAm.js (Deleted) -5.73kB 0 bytes -100.0% 🗑️
assets/docs-nav-BCkQfk2d.js (Deleted) -5.53kB 0 bytes -100.0% 🗑️
assets/api.index-BzVGLWsS.js (Deleted) -4.7kB 0 bytes -100.0% 🗑️
assets/docs-CxMPttKv.js (Deleted) -2.7kB 0 bytes -100.0% 🗑️
assets/api-Y7ZzDdvm.js (Deleted) -2.69kB 0 bytes -100.0% 🗑️
assets/docs-page-BLbF6c_t.js (Deleted) -2.1kB 0 bytes -100.0% 🗑️
assets/table-Bmoxombt.js (Deleted) -1.75kB 0 bytes -100.0% 🗑️
assets/app.workbench-CXo5OKwC.js (Deleted) -1.58kB 0 bytes -100.0% 🗑️
assets/session-C5vhxb3H.js (Deleted) -1.45kB 0 bytes -100.0% 🗑️
assets/tooltip-CKUC5NX0.js (Deleted) -1.45kB 0 bytes -100.0% 🗑️
assets/tabs-CHAA9MEu.js (Deleted) -1.39kB 0 bytes -100.0% 🗑️
assets/app.repos-R9xwbWC5.js (Deleted) -1.07kB 0 bytes -100.0% 🗑️
assets/input-B_hLTRC5.js (Deleted) -796 bytes 0 bytes -100.0% 🗑️
assets/file-cog-ejP82umm.js (Deleted) -758 bytes 0 bytes -100.0% 🗑️
assets/app.maintainer-Dup3PtkC.js (Deleted) -502 bytes 0 bytes -100.0% 🗑️
assets/sparkles-DrR0NRmB.js (Deleted) -494 bytes 0 bytes -100.0% 🗑️
assets/app.owner-Dn1TWmsp.js (Deleted) -474 bytes 0 bytes -100.0% 🗑️
assets/app.commands-CN-i7MKt.js (Deleted) -455 bytes 0 bytes -100.0% 🗑️
assets/app.playground-B_mTl7Gl.js (Deleted) -442 bytes 0 bytes -100.0% 🗑️
assets/reveal-DMe2hWBH.js (Deleted) -442 bytes 0 bytes -100.0% 🗑️
assets/index-RR9w12a0.js (Deleted) -438 bytes 0 bytes -100.0% 🗑️
assets/app.digest-CgZQZW5I.js (Deleted) -430 bytes 0 bytes -100.0% 🗑️
assets/eye-off-g0V65IOR.js (Deleted) -430 bytes 0 bytes -100.0% 🗑️
assets/app.miner-DPi3oPrK.js (Deleted) -422 bytes 0 bytes -100.0% 🗑️
assets/key-round-C4hjTnLs.js (Deleted) -355 bytes 0 bytes -100.0% 🗑️
assets/bot-BlQAovdP.js (Deleted) -328 bytes 0 bytes -100.0% 🗑️
assets/trash-2-BDrM3E6W.js (Deleted) -328 bytes 0 bytes -100.0% 🗑️
assets/save-D5sPicBi.js (Deleted) -327 bytes 0 bytes -100.0% 🗑️
assets/git-pull-request-arrow-CkB5BX9T.js (Deleted) -321 bytes 0 bytes -100.0% 🗑️
assets/wrench-BjfUBzUs.js (Deleted) -303 bytes 0 bytes -100.0% 🗑️
assets/list-checks-BGNNxImZ.js (Deleted) -279 bytes 0 bytes -100.0% 🗑️
assets/shield-CogAXx8V.js (Deleted) -272 bytes 0 bytes -100.0% 🗑️
assets/workflow-276JoZZ-.js (Deleted) -265 bytes 0 bytes -100.0% 🗑️
assets/compass-DXK91S_w.js (Deleted) -251 bytes 0 bytes -100.0% 🗑️
assets/history-C6FHXefi.js (Deleted) -237 bytes 0 bytes -100.0% 🗑️
assets/activity-B8vKFA17.js (Deleted) -234 bytes 0 bytes -100.0% 🗑️
assets/message-square-DWo1NJ_y.js (Deleted) -233 bytes 0 bytes -100.0% 🗑️
assets/lock-C9G7tJEz.js (Deleted) -206 bytes 0 bytes -100.0% 🗑️
assets/rotate-cw-DvDhAUJ1.js (Deleted) -201 bytes 0 bytes -100.0% 🗑️
assets/play-CI8-G74c.js (Deleted) -190 bytes 0 bytes -100.0% 🗑️
assets/circle-check-DJcjPIH_.js (Deleted) -178 bytes 0 bytes -100.0% 🗑️
assets/search-BHrhkAzI.js (Deleted) -174 bytes 0 bytes -100.0% 🗑️
assets/circle-DbHh_38M.js (Deleted) -130 bytes 0 bytes -100.0% 🗑️

@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.11%. Comparing base (f20cdf1) to head (7e3a074).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8242      +/-   ##
==========================================
- Coverage   92.11%   92.11%   -0.01%     
==========================================
  Files         780      781       +1     
  Lines       78489    78492       +3     
  Branches    23712    23713       +1     
==========================================
- Hits        72304    72303       -1     
  Misses       5062     5062              
- Partials     1123     1127       +4     
Flag Coverage Δ
shard-1 58.96% <66.66%> (+4.48%) ⬆️
shard-2 48.80% <100.00%> (-1.88%) ⬇️
shard-3 53.64% <66.66%> (-1.78%) ⬇️

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

Files with missing lines Coverage Δ
...-engine/src/calibration/counterfactual-contract.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@JSONbored
JSONbored merged commit d8f706c into main Jul 23, 2026
16 checks passed
@JSONbored
JSONbored deleted the feat/counterfactual-contract branch July 23, 2026 14:23
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

counterfactual: design the offline judge-replay contract — sampling, spend budget, scoring mapping

1 participant