fix(engine): report below-baseline calibration delta as a signed negative - #3890
fix(engine): report below-baseline calibration delta as a signed negative#3890glorydavid03023 wants to merge 1 commit into
Conversation
…tive computePhase7CalibrationLoop rounded deltaFromBaseline through roundScore, which clamps to [0,1]. Since combinedAccuracy is in [0,1] and the documented baseline is 0.62, the true delta ranges over [-0.62, 0.38], so every below-baseline calibration run (a regression) was flattened to 0 and reported as on-baseline. deltaFromBaseline is a signed field surfaced as signed percentage points in the audit, so it must round the difference without the score clamp; add a roundDelta helper and use it. Regression tests cover below/at/above baseline in both the engine node:test and a root vitest suite.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-07 05:47:46 UTC
🛑 Suggested Action - Reject/Close
Review summary Nits — 4 non-blocking
Why this is blocked
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Gittensory is closing this pull request on the maintainer's behalf (No linked issue detected; Maintainer requires a linked issue). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (50.00%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #3890 +/- ##
==========================================
+ Coverage 93.57% 93.77% +0.19%
==========================================
Files 340 340
Lines 33516 33517 +1
Branches 12262 12262
==========================================
+ Hits 31364 31431 +67
+ Misses 1528 1389 -139
- Partials 624 697 +73
🚀 New features to boost your workflow:
|
Summary
computePhase7CalibrationLoop(packages/gittensory-engine/src/phase7-calibration-loop.ts) computeddeltaFromBaseline— the signed deviation of the combined calibration accuracy from the documented 62% baseline — by rounding throughroundScore, which clamps its input to[0, 1]:combinedAccuracyis in[0, 1]and the baseline is0.62, so the true delta ranges over[-0.62, +0.38]. Every below-baseline run (a calibration regression) produced a negative delta thatroundScoreflattened to0, so a regression was reported as "on baseline / no deviation."deltaFromBaselineis a signed field (number | null), the module tracks accuracy "against the documented 62% baseline," and the audit renderer prints it as a signed magnitude (${(deltaFromBaseline * 100).toFixed(2)} percentage points) — so surfacing below-baseline regressions is exactly its purpose. The siblingcombinedAccuracyis a genuine[0, 1]score and correctly usesroundScore; only the signed delta was mis-clamped.The fix rounds the signed difference without the
[0, 1]clamp via a dedicatedroundDeltahelper.Example: two sources at 0.5 accuracy → combined
0.5(0.12 below baseline) now yieldsdeltaFromBaseline === -0.12(rendered-12.00 percentage points) instead of0.No linked issue: a small, self-contained correctness fix in pure engine logic; per this repo's
linkedIssuePolicy: preferred, the defect is described in full above.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typecheck(green)npm run build:minerbuilds + typechecks the engine package with the change (green)test/unit/phase7-calibration-delta.test.ts(vitest, run bytest:coverage) and the enginepackages/gittensory-engine/test/phase7-calibration-loop.test.ts(node:test).0.5now reportsdeltaFromBaseline === -0.12(was0).If any required check was skipped, explain why:
npm run test:ciwas not run in my local dev environment (several self-host suites require Linux/bash/Docker/Postgres and fail only on Windows). This change is confined topackages/gittensory-engine(a pure function, nosrc/app, API/OpenAPI, MCP, binding, DB, or migration surface), so no generated artifacts change; typecheck, the engine build, and the new regression tests are green, and the remaining CI runs on this PR.Safety
UI Evidence
N/A - pure backend engine logic; no UI, frontend, docs, or extension change.