You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Classification breakdown needs 'why' guidance, not just raw data (follow-up to #42) #60
Follow-up to #42. Gaze v1.4.2 now includes quadrant distribution, per-function contract_coverage, gaze_crap, and quadrant fields in the CRAP JSON output. This is a significant improvement over v1.2.12 which had none of this data. However, the report still doesn't explain why contract coverage is low, which leads developers to waste effort on the wrong fix.
Problem
In a real project (get-out), the CRAP output shows:
Q1=58 Q2=0 Q3=24 Q4=0
GazeCRAPload: 24
All 24 Q3 functions have contract_coverage: 0 and gaze_crap values of 12-182. The developer's natural reaction is "I need to add contract assertions to my tests." I did exactly that — spent a full iteration adding 55 assertion fixes across 9 test files. The result: contract coverage didn't change at all.
The reason: all 24 functions have their side effects classified as "ambiguous" at confidence 78-79 (just below the default threshold of 80). With total_contractual=0, no amount of assertion work can improve the percentage. The fix was either lowering --contractual-threshold or relying on AI reclassification — neither of which the report suggests.
{
"function": "LoadConversations",
"contract_coverage": 0,
"gaze_crap": 30,
"quadrant": "Q3_SimpleButUnderspecified",
"contract_coverage_reason": "all_effects_ambiguous",
"effect_confidence_range": [78, 79],
"recommendation": "Effects are borderline ambiguous (confidence 78-79). Use --ai for reclassification or lower --contractual-threshold to 75."
}
Or in the text report summary:
GazeCRAPload: 24 functions above threshold
Note: All 24 have 0% contract coverage because their side effects are
classified as "ambiguous" (confidence 78-79, threshold 80). Adding
assertions alone will not improve this — use --ai for reclassification
or --contractual-threshold=75.
Impact
Without this guidance, developers spend significant effort adding assertions that have zero effect on the metric. The data is present in v1.4.2 but the diagnosis and recommended action are missing.
What's missing (this issue):
The raw counts don't diagnose why contract coverage is 0%. The specific gap is:
No per-function contract_coverage_reason field explaining the root cause
No confidence range visibility ("all effects at 78-79, threshold 80")
No actionable recommendation ("use --ai or lower --contractual-threshold")
Proposed fix:
Add contract_coverage_reason computed field to crap.Score — one of:
all_effects_ambiguous: all effects classified ambiguous, no contractual effects to assert against
no_effects_detected: no side effects found for this function
no_assertions_mapped: assertions exist but couldn't be mapped to effects
partial_coverage: some effects covered, some not (the normal case)
Include effect_confidence_range (min/max confidence across effects) when reason is all_effects_ambiguous so users can see how close they are to the threshold.
Activity
jflowers commentedon Mar 16, 2026
Triage
Priority: High
Milestone: v1.5.0
Effort: Medium
What already exists (v1.4.2):
Contractual,Ambiguous,Incidentalcounts toReportSummaryfix_strategyfield to CRAP scores (decompose,add_tests,add_assertions,decompose_and_test)What's missing (this issue):
The raw counts don't diagnose why contract coverage is 0%. The specific gap is:
contract_coverage_reasonfield explaining the root causeProposed fix:
Add
contract_coverage_reasoncomputed field tocrap.Score— one of:all_effects_ambiguous: all effects classified ambiguous, no contractual effects to assert againstno_effects_detected: no side effects found for this functionno_assertions_mapped: assertions exist but couldn't be mapped to effectspartial_coverage: some effects covered, some not (the normal case)Include
effect_confidence_range(min/max confidence across effects) when reason isall_effects_ambiguousso users can see how close they are to the threshold.Related: #42 (classification breakdown — closed), #48 (agent tooling — open)
feat: add contract coverage reason and confidence range to CRAP scores
feat: add contract coverage reason and confidence range to CRAP scores