Skip to content

feat(calibration): pure per-repo corpus slicing + density stats - #8233

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
michiot05:feat/repo-corpus-slice
Jul 23, 2026
Merged

feat(calibration): pure per-repo corpus slicing + density stats#8233
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
michiot05:feat/repo-corpus-slice

Conversation

@michiot05

Copy link
Copy Markdown
Contributor

Summary

Tests

Two suites, per the epic's "engine blind-spot rule":

  • packages/loopover-engine/test/repo-corpus-slice.test.ts — the node:test suite gating the engine workspace's own npm run test (all 671 engine tests pass). It runs against dist and is invisible to Codecov.
  • test/unit/repo-corpus-slice-engine.test.ts — the root vitest mirror importing the engine src path directly, which provides codecov/patch coverage (the engine's node:test output isn't harvested to Codecov). Covers multi-repo slicing, unparseable-key drops, last-# parsing, the confirmed/reversed split, both && branches of the eligibility floors (visible-floor fail, held-out-floor fail, both-pass), the own-slice-floors invariant, split determinism, and the empty corpus — 100% of the diff's lines and branches, verified locally (21/21 lines, 0 missed branches).

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (Closes #8215).

Validation

  • git diff --check
  • npm run typecheck
  • npm run test:coverage locally (100% patch coverage on the new file, verified via lcov)
  • @loopover/engine build + its 671-test node:test suite
  • npm run test:engine-parity, npm run engine-parity:drift-check, npm run docs:drift-check

If any required check was skipped, explain why:

  • This is a single pure, self-contained new engine file plus one additive barrel-export line and two test files — it touches no API/OpenAPI, migration, generated artifact, command, setting, or dependency, so the remaining test:ci steps (workers, mcp/miner packs, ui:build, db/drift checks) cannot be affected by it. Engine build + node:test, whole-repo typecheck, engine-parity, drift checks, and the unsharded coverage run were all executed and pass.

Safety

  • No secrets, wallets, hotkeys, trust scores, or reward values anywhere.
  • Aggregate-only output — no targetKey or metadata leaves the functions (invariant covered by tests).
  • API/OpenAPI/MCP behavior unchanged.

UI Evidence

Not applicable — a pure calibration-engine function with no visible UI, frontend, docs, or extension change.

Notes

  • Engine-pure only, per the issue boundary: no store reads, no registry changes (those are the maintainer follow-ons). Foundation for track B's per-repo evaluation; no consumer yet.

Closes JSONbored#8215. Adds packages/loopover-engine/src/calibration/repo-corpus-slice.ts
with sliceCorpusByRepo (group a BacktestCase[] by owner/repo parsed from
targetKey's last '#', dropping unparseable keys, order-preserving) and
computeRepoCorpusDensity (per-repo cases/confirmed/reversed plus an eligible
flag that applies the same splitBacktestCorpus split + sample-minimum floors
on each repo's own slice). Pure, aggregate-only. Barrel export + node:test
(engine gate) + root vitest mirror (codecov coverage).
@michiot05
michiot05 requested a review from JSONbored as a code owner July 23, 2026 13:26
@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 (3dd08e5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8233      +/-   ##
==========================================
- Coverage   92.10%   92.10%   -0.01%     
==========================================
  Files         776      777       +1     
  Lines       78328    78350      +22     
  Branches    23668    23673       +5     
==========================================
+ Hits        72147    72165      +18     
  Misses       5062     5062              
- Partials     1119     1123       +4     
Flag Coverage Δ
shard-1 57.48% <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 Δ
...opover-engine/src/calibration/repo-corpus-slice.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 23, 2026
@loopover-orb

loopover-orb Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-23 13:43:23 UTC

4 files · 1 AI reviewer · no blockers · readiness 86/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds a pure, storage-agnostic per-repo corpus slicing and density-eligibility module (`sliceCorpusByRepo` + `computeRepoCorpusDensity`) to the engine, wired through the barrel and covered by both the engine's node:test suite and the root vitest mirror for Codecov. The parsing logic (last-`#`, empty-prefix drop) and the per-repo split/floor eligibility check both trace correctly to their described behavior and are exercised for both `&&` branches. It's additive with no existing consumer changed, closes the linked issue #8215/epic #8211 track B, and follows the established aggregate-only, pure-function discipline of the surrounding calibration module (#8083-#8087).

Nits — 3 non-blocking
  • `computeRepoCorpusDensity` has no wired caller yet in this diff (per-repo evaluation itself is presumably a follow-up issue) — worth a one-line note in the PR description confirming that's intentional scope for this issue.
  • `repoFromTargetKey` (repo-corpus-slice.ts:26) silently drops any targetKey missing a valid repo prefix; consider a debug-level count/log hook if this ever needs operational visibility into how many cases get dropped in production corpora.
  • If a follow-up PR wires `computeRepoCorpusDensity` into an evaluator, reuse the exact `minVisible`/`minHeldOut`/`heldOutFraction`/`splitSeed` values the global evaluator already reads from config, per the stated 'same floors' invariant, rather than re-deriving them.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8215
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 30 registered-repo PR(s), 13 merged, 6 issue(s).
Contributor context ✅ Confirmed Gittensor contributor michiot05; Gittensor profile; 30 PR(s), 6 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds the two required pure functions (sliceCorpusByRepo and computeRepoCorpusDensity) in a new file beside backtest-corpus.ts, both exported from the engine barrel, with own-slice split/floor logic reusing splitBacktestCorpus and aggregate-only output shapes as specified.

Review context
  • Author: michiot05
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Rust
  • Official Gittensor activity: 30 PR(s), 6 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit c1e2ab2 into JSONbored:main Jul 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calibration: pure per-repo corpus slicing + density stats

1 participant