Context
packages/loopover-engine/src has three sibling calibration modules (gate-verdict-calibration.ts, finding-severity-calibration.ts, reviewer-consensus-calibration.ts) that share a composite-scorer weight-resolution pattern. The newest, reviewer-consensus-calibration.ts, has two behaviors its two older siblings never got backported:
-
Zero-weight handling (reviewer-consensus-calibration.ts:402-405 vs gate-verdict-calibration.ts:317-318 and finding-severity-calibration.ts:365-366): both older files do if (total <= 0) return DEFAULT_COMPOSITE_WEIGHTS;, silently restoring the 45/35/20 blend when a caller explicitly passes all-zero weights. reviewer-consensus-calibration.ts instead returns the explicit zeroed weights, with a comment: "a caller that zeroes every component must reach the objective-only fallback ... not silently get the default 45/35/20 blend." test/reviewer-consensus-calibration.test.ts:291 has a dedicated test for this; the other two have no equivalent test.
-
Malformed-repo preservation (gate-verdict-calibration.ts:286 vs finding-severity-calibration.ts:331-334 and reviewer-consensus-calibration.ts:368-371): gate-verdict-calibration.ts's sanitizer uses normalizeRepoFullName(row.repoFullName) alone (returns null, dropping the row) for already-rejected audit rows; both siblings use normalizeRepoFullName(...) ?? normalizeId(...) to preserve the raw string instead. test/reviewer-consensus-calibration.test.ts:353,385 tests an invalid_repo rejected row surviving sanitization; test/gate-verdict-calibration.test.ts:478 only exercises a valid repo.
Requirements
- In
gate-verdict-calibration.ts and finding-severity-calibration.ts, change the zero-weight branch to return the explicit zeroed weights (matching reviewer-consensus-calibration.ts:402-405's behavior), not the silent DEFAULT_COMPOSITE_WEIGHTS fallback.
- In
gate-verdict-calibration.ts, change the sanitizer to use normalizeRepoFullName(...) ?? normalizeId(...) (matching the other two files), so a malformed-repo rejected row is preserved instead of dropped.
- Do not change
reviewer-consensus-calibration.ts — it's already correct and is the reference implementation for both fixes.
Test Coverage Requirements
99%+ Codecov patch coverage on both changed branches in both files; add the equivalent tests reviewer-consensus-calibration.test.ts already has (zero-weight explicit-fallback test, and an invalid_repo rejected-row-survives-sanitization test) to test/gate-verdict-calibration.test.ts and test/finding-severity-calibration.test.ts.
Deliverables
Expected Outcome
All three sibling calibration modules handle all-zero weights and malformed-repo rejected rows identically, instead of two of them silently diverging from the newest/correct one.
Links & Resources
packages/loopover-engine/src/gate-verdict-calibration.ts:286,317-318
packages/loopover-engine/src/finding-severity-calibration.ts:331-334,365-366
packages/loopover-engine/src/reviewer-consensus-calibration.ts:368-371,402-405 (reference implementation)
test/reviewer-consensus-calibration.test.ts:291,353,385 (reference tests)
Context
packages/loopover-engine/srchas three sibling calibration modules (gate-verdict-calibration.ts,finding-severity-calibration.ts,reviewer-consensus-calibration.ts) that share a composite-scorer weight-resolution pattern. The newest,reviewer-consensus-calibration.ts, has two behaviors its two older siblings never got backported:Zero-weight handling (
reviewer-consensus-calibration.ts:402-405vsgate-verdict-calibration.ts:317-318andfinding-severity-calibration.ts:365-366): both older files doif (total <= 0) return DEFAULT_COMPOSITE_WEIGHTS;, silently restoring the 45/35/20 blend when a caller explicitly passes all-zero weights.reviewer-consensus-calibration.tsinstead returns the explicit zeroed weights, with a comment: "a caller that zeroes every component must reach the objective-only fallback ... not silently get the default 45/35/20 blend."test/reviewer-consensus-calibration.test.ts:291has a dedicated test for this; the other two have no equivalent test.Malformed-repo preservation (
gate-verdict-calibration.ts:286vsfinding-severity-calibration.ts:331-334andreviewer-consensus-calibration.ts:368-371):gate-verdict-calibration.ts's sanitizer usesnormalizeRepoFullName(row.repoFullName)alone (returnsnull, dropping the row) for already-rejected audit rows; both siblings usenormalizeRepoFullName(...) ?? normalizeId(...)to preserve the raw string instead.test/reviewer-consensus-calibration.test.ts:353,385tests aninvalid_reporejected row surviving sanitization;test/gate-verdict-calibration.test.ts:478only exercises a valid repo.Requirements
gate-verdict-calibration.tsandfinding-severity-calibration.ts, change the zero-weight branch to return the explicit zeroed weights (matchingreviewer-consensus-calibration.ts:402-405's behavior), not the silentDEFAULT_COMPOSITE_WEIGHTSfallback.gate-verdict-calibration.ts, change the sanitizer to usenormalizeRepoFullName(...) ?? normalizeId(...)(matching the other two files), so a malformed-repo rejected row is preserved instead of dropped.reviewer-consensus-calibration.ts— it's already correct and is the reference implementation for both fixes.Test Coverage Requirements
99%+ Codecov patch coverage on both changed branches in both files; add the equivalent tests
reviewer-consensus-calibration.test.tsalready has (zero-weight explicit-fallback test, and aninvalid_reporejected-row-survives-sanitization test) totest/gate-verdict-calibration.test.tsandtest/finding-severity-calibration.test.ts.Deliverables
gate-verdict-calibration.ts: zero-weight fix + malformed-repo fix, both with regression tests.finding-severity-calibration.ts: zero-weight fix, with regression test.Expected Outcome
All three sibling calibration modules handle all-zero weights and malformed-repo rejected rows identically, instead of two of them silently diverging from the newest/correct one.
Links & Resources
packages/loopover-engine/src/gate-verdict-calibration.ts:286,317-318packages/loopover-engine/src/finding-severity-calibration.ts:331-334,365-366packages/loopover-engine/src/reviewer-consensus-calibration.ts:368-371,402-405(reference implementation)test/reviewer-consensus-calibration.test.ts:291,353,385(reference tests)