Skip to content

feat(calibration): claimed-confidence reliability curves with derived threshold suggestion - #8252

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
oktofeesh1:feat/reliability-curve-8226
Jul 23, 2026
Merged

feat(calibration): claimed-confidence reliability curves with derived threshold suggestion#8252
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
oktofeesh1:feat/reliability-curve-8226

Conversation

@oktofeesh1

Copy link
Copy Markdown
Contributor

Summary

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 #8226).

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally (unsharded) — 100% of the diff's lines AND branches (reliability-curve.ts: 46/46 lines, 42/42 branches, 5/5 functions, verified via lcov)
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • None skipped — the full npm run test:ci chain was run end-to-end (includes all of the above plus the engine workspace's own node --test suite, worker-pool tests, parity/drift checks, and the UI chain).

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests — no such surface is touched (pure engine math; the functions' own invalid-input paths are negative-tested: malformed edges, out-of-range targets, NaN fails closed into throws).
  • API/OpenAPI/MCP behavior is updated and tested where needed — unchanged (additive engine exports only).
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks — no UI change.
  • Visible UI changes include a UI Evidence section — not applicable, no visible UI/frontend/docs change.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs — no changelog edit.

UI Evidence

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

Notes

  • Two mirror suites, per the epic's engine blind-spot rule: packages/loopover-engine/test/reliability-curve.test.ts (node:test against dist, gates the engine workspace's own npm run test) and test/unit/reliability-curve-engine.test.ts (the root vitest mirror importing the engine src path directly — the suite that provides codecov/patch coverage). Coverage includes bucket boundaries (floor-inclusive interior edges, ceiling-inclusive top), every drop path (no/non-numeric/out-of-range/NaN claims), both sides of the sample floor, pooled-density and hard-minimum arms of the suggestion, all throw guards, and a monotonicity invariant (a rising target never loosens the suggestion; a suggestion is never below the hard minimum and is always a real bucket floor).
  • Pure math only, per the issue boundary: no advisor/registry integration (maintainer follow-on, calibration: surface reliability curves in the advisor + trend, and evaluate ladder replacement #8227).

… threshold suggestion

Bucket a rule's decided BacktestCases by claimed confidence
(metadata.confidence) into fixed 0.05-step edges and report per-bucket
empirical precision (null below the sample floor, never 0), then derive
the loosest floor whose at-or-above pooled precision meets a target --
never below the hard minimum, null on insufficient pooled density.
Engine-exported; no consumer changes (JSONbored#8226, epic JSONbored#8211 track E).
@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner July 23, 2026 14:50
@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.12%. Comparing base (a0e791d) to head (fb8d235).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8252      +/-   ##
==========================================
- Coverage   92.12%   92.12%   -0.01%     
==========================================
  Files         782      783       +1     
  Lines       78531    78580      +49     
  Branches    23720    23738      +18     
==========================================
+ Hits        72347    72392      +45     
  Misses       5062     5062              
- Partials     1122     1126       +4     
Flag Coverage Δ
shard-1 59.01% <4.08%> (-0.94%) ⬇️
shard-2 44.89% <4.08%> (-2.32%) ⬇️
shard-3 55.63% <100.00%> (+2.11%) ⬆️

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

Files with missing lines Coverage Δ
...opover-engine/src/calibration/reliability-curve.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 15:13:23 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds pure, well-tested reliability-curve math (bucketing by claimed confidence + a conservative pooled-precision threshold derivation) with no wiring into the advisor/registry yet, per the PR's own stated scope. The N/A-over-zero discipline, ceiling-inclusive top bucket, and never-clamp-up suggestion logic are all correctly implemented and exercised by both the node:test and vitest mirrors, including edge cases (NaN, out-of-range, sample-floor boundaries, empty corpus). The PR closes #8226 and is narrowly scoped pure-math work consistent with the epic's stated 'let the floor fall out of the corpus' goal.

Nits — 5 non-blocking
  • The magic-number literals for DEFAULT_RELIABILITY_BUCKET_EDGES (reliability-curve.ts:41) and RELIABILITY_BUCKET_SAMPLE_FLOOR are already named exported constants with explanatory doc comments, so the external magic-number flags are largely noise here — not worth further extraction.
  • bucketIndexFor (reliability-curve.ts:55-61) is a tight, well-commented function; the flagged 'depth 5' nesting is really just a for-loop with an if inside a function, not a real complexity concern.
  • No advisor/registry integration test exists yet, but the PR explicitly defers that to a maintainer follow-on, so this is expected rather than a gap.
  • Since this is explicitly the 'math only' half of the epic, it would help future reviewers if the PR description linked the follow-on issue/PR number for the advisor/registry wiring once filed.
  • Consider a brief JSDoc example (input cases -> curve -> suggestion) at the top of reliability-curve.ts to make the module's intent scannable without reading both 100+ line functions.

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 #8226
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 64 registered-repo PR(s), 49 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor oktofeesh1; Gittensor profile; 64 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds computeReliabilityCurve and deriveThresholdSuggestion in a new engine-pure calibration module with documented bucket edges, N/A-over-zero null-precision discipline, conservative loosest-floor derivation respecting a hard minimum, barrel export with no consumer changes, and both a root mirror test suite and the engine's own test covering boundaries, null-density arms, and a monotonicity

Review context
  • Author: oktofeesh1
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, MDX, Python, TypeScript
  • Official Gittensor activity: 64 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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 2defb4a 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: reliability curves — empirical precision by claimed-confidence bucket, with derived threshold suggestion

2 participants