Summary
confidenceRange in internal/adapter/contract.go (lines 194-203) initializes sentinels as minConf = 100, maxConf = 0 and skips effects with nil Classification. When all effects have nil Classification (e.g., an external analyzer that doesn't support classify_signals), the sentinels are returned unchanged, producing an inverted range where min (100) > max (0).
This value flows through deriveCoverageReason (line 186-187) into ContractCoverageInfo.MinConfidence and MaxConfidence, potentially surfacing in output as "confidence 100-0".
Impact
Low. Only triggers when an external analyzer returns side effects without classification data. The output is confusing but does not affect CRAP score computation or cause a crash.
Reproduction
Use an external analyzer whose initialize response sets capabilities.classify_signals: false. Run gaze crap --analyzer <binary> against a package where all detected effects lack classification. The confidence range in the output will show 100-0.
Suggested Fix
Return (0, 0) when no effects have classifications:
func confidenceRange(effects []taxonomy.SideEffect) (minConf, maxConf int) {
minConf, maxConf = 100, 0
found := false
for _, e := range effects {
if e.Classification == nil {
continue
}
found = true
minConf = min(minConf, e.Classification.Confidence)
maxConf = max(maxConf, e.Classification.Confidence)
}
if !found {
return 0, 0
}
return minConf, maxConf
}
## References
- Introduced in PR #178 (commit 131cd1f, refined in 711bbb0)
- File: internal/adapter/contract.go:194-203
- Caller: deriveCoverageReason at contract.go:186
Found-by: OpenCode (claude-opus-4-6)
Summary
confidenceRangeininternal/adapter/contract.go(lines 194-203) initializes sentinels asminConf = 100, maxConf = 0and skips effects withnilClassification. When all effects havenilClassification (e.g., an external analyzer that doesn't supportclassify_signals), the sentinels are returned unchanged, producing an inverted range where min (100) > max (0).This value flows through
deriveCoverageReason(line 186-187) intoContractCoverageInfo.MinConfidenceandMaxConfidence, potentially surfacing in output as "confidence 100-0".Impact
Low. Only triggers when an external analyzer returns side effects without classification data. The output is confusing but does not affect CRAP score computation or cause a crash.
Reproduction
Use an external analyzer whose
initializeresponse setscapabilities.classify_signals: false. Rungaze crap --analyzer <binary>against a package where all detected effects lack classification. The confidence range in the output will show100-0.Suggested Fix
Return
(0, 0)when no effects have classifications: