Skip to content

Classification breakdown needs 'why' guidance, not just raw data (follow-up to #42) #60

Closed

Description

@jflowers

Context

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.

What the report shows

{
  "function": "LoadConversations",
  "contract_coverage": 0,
  "gaze_crap": 30,
  "quadrant": "Q3_SimpleButUnderspecified"
}

What the report should also show

Something like:

{
  "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.

Activity

  1. added
    enhancement
    on Mar 16, 2026
  2. added this to the v1.5.0 milestone on Mar 16, 2026
  3. jflowers commented on Mar 16, 2026

    @jflowers
    CollaboratorAuthor

    Triage

    Priority: High
    Milestone: v1.5.0
    Effort: Medium

    What already exists (v1.4.2):

    What's missing (this issue):
    The raw counts don't diagnose why contract coverage is 0%. The specific gap is:

    1. No per-function contract_coverage_reason field explaining the root cause
    2. No confidence range visibility ("all effects at 78-79, threshold 80")
    3. 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.

    Related: #42 (classification breakdown — closed), #48 (agent tooling — open)

  4. added a commit that references this issue on Mar 16, 2026
    66e1db9
  5. moved this from Todo to In Progress in Gaze Roadmapon Mar 16, 2026
  6. moved this from In Progress to Done in Gaze Roadmapon Mar 16, 2026
  7. added a commit that references this issue on Mar 16, 2026
    8cf478d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions