Skip to content

feat(calibration): pure per-repo corpus slicing and labeled-density stats - #8234

Closed
kai392 wants to merge 1 commit into
JSONbored:mainfrom
kai392:feat/critical-issue-repo-corpus-slicing
Closed

feat(calibration): pure per-repo corpus slicing and labeled-density stats#8234
kai392 wants to merge 1 commit into
JSONbored:mainfrom
kai392:feat/critical-issue-repo-corpus-slicing

Conversation

@kai392

@kai392 kai392 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add packages/loopover-engine/src/calibration/repo-corpus.ts (Epic: calibration expansion — self-correcting configuration and measured judgment #8211 track B's first building block) with two pure functions beside buildBacktestCorpus, per the epic's file-per-concern discipline:
    • sliceCorpusByRepo(cases) — deterministic Map<repoFullName, BacktestCase[]> keyed by everything before targetKey's last # (so an embedded # in a repo name never truncates it); unparseable keys (no #, or nothing before it) are dropped, never guessed; per-slice case order and first-appearance repo order preserved.
    • computeRepoCorpusDensity(cases, minVisible, minHeldOut, heldOutFraction, splitSeed) — per-repo {cases, confirmed, reversed, eligible} where eligible re-runs the deterministic seeded split on that repo's OWN slice and requires both sides to clear the floors — the exact never-on-noise bar evaluateKnobLoosening/evaluateKnobDrift apply globally.
  • Aggregate-only shapes throughout (repo names + numbers — no target keys, no metadata), pinned by an invariant test.
  • Both functions exported from the engine barrel, per the deliverable.

Closes #8215

Test plan

  • test/unit/repo-corpus-engine.test.ts (vitest, importing the engine source — the root mirror suite per the engine blind-spot rule): multi-repo slicing with order preservation; embedded-# repo keying; unparseable-key drops; empty corpus; density floors above/below (including a held-out-side-only miss); split determinism per slice; the no-corpus-content invariant
  • packages/loopover-engine/test/repo-corpus.test.ts (node:test vs dist): barrel re-export + slicing/density round-trip
  • Local coverage on the new file: 19/19 lines, 8/8 branches; engine workspace suite 663 green; npm run typecheck green
  • CI validate

@kai392
kai392 requested a review from JSONbored as a code owner July 23, 2026 13:32
@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 92.10%. Comparing base (0c8d3d6) to head (b3cfabf).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8234      +/-   ##
==========================================
- Coverage   92.10%   92.10%   -0.01%     
==========================================
  Files         776      777       +1     
  Lines       78328    78348      +20     
  Branches    23668    23672       +4     
==========================================
+ Hits        72147    72163      +16     
  Misses       5062     5062              
- Partials     1119     1123       +4     
Flag Coverage Δ
shard-1 57.49% <0.00%> (+2.56%) ⬆️
shard-2 51.82% <0.00%> (-0.78%) ⬇️
shard-3 53.17% <100.00%> (-1.59%) ⬇️

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

Files with missing lines Coverage Δ
...ges/loopover-engine/src/calibration/repo-corpus.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@kai392

kai392 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Withdrawing: #8233 (filed earlier) merged and closed #8215 — this duplicate is superseded.

@kai392 kai392 closed this Jul 23, 2026
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: pure per-repo corpus slicing + density stats

2 participants