fix(engine): preserve an explicit all-zero phase7 composite weighting - #8680
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
normalizeCompositeWeights silently reverted a config with both composite
weights explicitly set to 0 back to the 50/50 default. That branch is
reachable only when both weights were deliberately 0 (invalid inputs floor to
a positive default), so it's an explicit "disable composite weighting" signal,
not degraded input. Preserve {0,0} — matching the sibling composers'
preserve-explicit-zero principle — which yields a null composite downstream
rather than overriding the operator's intent.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8680 +/- ##
==========================================
+ Coverage 93.76% 93.78% +0.01%
==========================================
Files 797 797
Lines 79454 79454
Branches 24070 24070
==========================================
+ Hits 74504 74515 +11
+ Misses 3565 3563 -2
+ Partials 1385 1376 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-25 23:55:36 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
Fixes #8644
Root cause
normalizeCompositeWeights(packages/loopover-engine/src/phase7-calibration-loop.ts) reverted a config with both composite weights explicitly0back to the 50/50 default, silently. Thattotal <= 0branch is reachable only when both weights were deliberately set to0:finiteNonNegativefloors any invalid/negative input to a positive default, which can't sum to 0. So a 0 total is an operator's explicit "disable composite weighting" signal, not a degraded input — and overriding it back to 50/50 loses that intent with no trace.Fix (chose Requirements option 1 — preserve the explicit zero)
Return
{ historicalReplay: 0, prOutcome: 0 }at the branch, with a comment documenting the decision and why. This matches the "preserve explicit zero" principle the sibling calibration composers already follow.Downstream this is safe and already-handled:
{0,0}leavesweightTotalat 0, which the existingcombinedAccuracyguard renders asnull— the same state reached today when no source contributes, not a new untested path. I chose this over option 2 (warn but keep defaulting) because the result'sweightsfield makes the preserved zeros directly observable/testable, whereasconfig.warningsisn't surfaced on the loop result — and preserving the operator's intent is the stronger fix.Tests
packages/loopover-engine/test/phase7-calibration-loop.test.ts, the deliverable's named file): resolves an explicit all-zero config, asserts the weights are preserved as{0,0}and the composite isnull. Full engine suite: 713 pass / 0 fail.test/unit/phase7-calibration-loop-weights.test.ts): the package-nativenode:testsuite runs under the engine workspace, not the root run Codecov grades, so — per the test(calibration): make signal-tracking's real coverage visible to Codecov #8438 precedent — this imports frompackages/loopover-engine/src/index(source, not dist) and exercises both arms of thetotal <= 0branch. This is what givescodecov/patchcoverage of the changed line.Validation
phase7-calibration-loop.ts: every changed line and both branches covered via the root mirrornpm run typecheckclean;oxlintclean on the changed lines (the one warning is a pre-existing control-char regex at line 169, outside this diff)srctwin of this file exists (no parity mirror needed); branch cut from currentmain(c5cc6c4c);git diff --checkclean