Repository navigation
feat: add contract coverage reason and confidence range to CRAP scores - #63
Merged
Merged
Conversation
When contract coverage is 0% because all effects are classified 'ambiguous', the CRAP score now explains why via ContractCoverageReason and shows how close effects are to the threshold via EffectConfidenceRange. - Add ContractCoverageInfo struct replacing bare float64 in ContractCoverageFunc callback - Add ContractCoverageReason and EffectConfidenceRange to Score - Update buildContractCoverageFunc to compute reason from quality classification data - Display reason in text report worst-offenders section - 2 new tests for reason computation Closes unbound-force#60
jflowers
added a commit
to jflowers/gaze
that referenced
this pull request
Mar 19, 2026
ci-gaze-report: superseded by ci-gaze-report-v2 ci-gaze-report-v2: merged as PR unbound-force#69 (v1.4.5) target-warning-guidance: merged as PR unbound-force#65 coverage-reason-guidance: merged as PR unbound-force#63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ContractCoverageReasonandEffectConfidenceRangeto CRAP scoresContractCoverageFuncfrom barefloat64toContractCoverageInfostructProblem (Issue #60)
A developer spent a full iteration adding 55 assertion fixes across 9 test files with zero improvement to contract coverage. The reason: all 24 Q3 functions had effects at confidence 78-79 (threshold 80). With
total_contractual=0, adding assertions can't improve the metric. The report didn't explain this.Solution
Before:
{"function": "LoadConversations", "contract_coverage": 0, "gaze_crap": 30}After:
{ "function": "LoadConversations", "contract_coverage": 0, "gaze_crap": 30, "contract_coverage_reason": "all_effects_ambiguous", "effect_confidence_range": [78, 79] }Text report worst-offenders now show:
Changes
internal/crap/crap.goContractCoverageReason,EffectConfidenceRangetoScore; addedContractCoverageInfostructinternal/crap/analyze.goContractCoverageFunctype, updatedcomputeScoresinternal/crap/report.gocmd/gaze/main.gobuildContractCoverageFuncto compute reason from classification dataCloses #60