Repository navigation
Description
- Severity: High
- Status: Confirmed — reproduced first-hand on 2026-06-08
- Component:
internal/aireport/payload.go(line 21),internal/aireport/runner_steps.go(line 68),internal/aireport/threshold.go(line 41) - Affected command:
gaze report - Audited commit:
1a06131(main) - Target codebase: complytime-labs/crosscodex @
dae5cc4 - Evaluation model: Claude Opus 4.6 (1M context) —
claude-opus-4-6(analysis and parallel audit subagents)
Summary
ReportPayload.Summary.GazeCRAPload is a plain int. GazeCRAP is only computed
when contract-coverage data is available — the common case is that it is not
available. When unavailable, GazeCRAPload keeps its zero value, and the
threshold check GazeCRAPload <= limit evaluates to PASS. A
--max-gaze-crapload gate therefore always passes when there is no GazeCRAP
data, with no warning. The gaze crap command, which models the same value as
*int, correctly prints a "GazeCRAP unavailable" note for the same input — so
the two commands disagree.
Reproduction
A package whose GazeCRAP is genuinely unavailable (no contract coverage):
$ gaze crap --format=json . | jq '.summary.gaze_crapload'
null
$ gaze crap . 2>&1 | grep -i note
note: GazeCRAP unavailable — run 'gaze quality' to compute contract coverage
$ gaze report --format=json --max-gaze-crapload=0 . 2>&1 >/dev/null | grep -i gazecrapload
GazeCRAPload: 0/0 (PASS)
$ gaze report --format=json --max-gaze-crapload=0 . >/dev/null 2>&1; echo $?
0
$ gaze report --format=json --max-gaze-crapload=0 . 2>/dev/null | jq '.crap.summary.gaze_crapload'
null
report reports 0/0 (PASS) (and exits 0) while the underlying value is
null — "not computed" is indistinguishable from "zero functions over
threshold."
Root cause
internal/aireport/payload.go:19-21:
// GazeCRAPload is the number of Q4 functions ...
GazeCRAPload int // <-- plain int: cannot represent "unavailable"internal/aireport/runner_steps.go:68 only assigns it when present:
if rpt.Summary.GazeCRAPload != nil {
res.GazeCRAPload = *rpt.Summary.GazeCRAPload
}
// else: stays 0internal/aireport/threshold.go:41:
passed := summary.GazeCRAPload <= limit // 0 <= limit → PASSImpact
A CI gate built on --max-gaze-crapload provides false assurance: it passes
unconditionally whenever GazeCRAP data is missing, which is precisely when the
user most needs to be told the metric was not computed. Closely related to
BUG_002 (same zero-value-means-pass pattern).
Suggested fix
Model ReportSummary.GazeCRAPload as *int (mirroring crap.Summary). When a
--max-gaze-crapload gate is set but GazeCRAP is unavailable, fail the gate or
emit the same "GazeCRAP unavailable" note the crap command prints — never
silently PASS.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✔️
Activity
jflowers commentedon Jun 16, 2026
Review Council Analysis
Five review council agents (Adversary, Architect, Guard, SRE, Testing) independently analyzed this issue against the codebase at
main.Verdict: VALID — Bug Confirmed
The core claim is correct. The data flow chain is:
crap.Summary.GazeCRAPload*intnilcrapStepResult.GazeCRAPloadint0ReportSummary.GazeCRAPloadint0EvaluateThresholdscomparison0 <= limitThe
*int→intnarrowing atrunner_steps.go:68-70is the root cause. The code knows about the nil case (it checks for it) but has nowhere to store the distinction becausecrapStepResult.GazeCRAPloadisint.One Factual Inaccuracy in the Report
The reproduction snippet claims
gaze crap . 2>&1 | grep -i noteproduces"note: GazeCRAP unavailable — run 'gaze quality' to compute contract coverage". This message does not exist in the codebase. Thegaze craptext report silently omits the GazeCRAP section whenGazeCRAPload == nil(internal/crap/report.go:82). This does not diminish the bug — it actually makes the problem slightly worse than described, since neither command warns the user.Critical Assessment of the Suggested Fix
The suggested fix ("model as
*int, fail or warn") is directionally correct but underspecified.1. FAIL, not WARN. All five reviewers agree unanimously: when
--max-gaze-craploadis set but GazeCRAP data is unavailable, the gate must FAIL. A CI gate that warns but passes is not a gate. Users who don't want the gate should not pass the flag —ThresholdConfig.MaxGazeCraploadalready supportsnil(disabled). Constitution Principle III (Actionable Output) requires metrics to be comparable across runs; a metric that silently becomes 0 when unavailable violates this.2. Blast radius is larger than described. The
*intchange must propagate through three intermediate structs, not justReportSummary:crapStepResult.GazeCRAPload(runner_steps.go:28)ReportSummary.GazeCRAPload(payload.go:21)compactSummary.GazeCRAPload(compact.go:28— currentlyintwithoutomitempty, so the AI adapter always sees"gaze_crapload": 0when unavailable)3.
ThresholdResultneeds anUnavailable boolfield, not a*intforActual.ThresholdResultis a presentation type — it represents an evaluation outcome. Stderr output should renderGazeCRAPload: unavailable/5 (FAIL)instead ofGazeCRAPload: 0/5 (PASS).4.
AvgContractCoveragehas the same pattern (*float64upstream →intinReportSummary). While less dangerous (0 >= limit fails for limit > 0), it's semantically wrong. Should be fixed in the same change.5. Breaking change risk. This will fail previously-green CI pipelines that pass
--max-gaze-craploadwithout contract coverage data. The council considers this the correct breaking behavior — a gate that can't evaluate should fail, not silently pass. The fix is trivial for affected users (remove the flag).Test Coverage Gaps
The testing reviewer identified critical gaps:
TestEvaluateThresholds_NilPayloadatthreshold_test.go:235validates the buggy behavior (nil payload → 0/5 → PASS)runCRAPStep→runProductionPipeline→EvaluateThresholdsfor the unavailable case*intmigration when the fix landsRecommended Implementation Scope
runner_steps.go:28crapStepResult.GazeCRAPload→*intpayload.go:21ReportSummary.GazeCRAPload→*intcompact.go:28compactSummary.GazeCRAPload→*intwithomitemptyrunner_steps.go:64-71rpt.Summary.GazeCRAPloadthrough directlyrunner.go:258*intassignmentthreshold.go:39-51Unavailable = true,Passed = falsepayload.goUnavailable bool+Reason stringtoThresholdResultrunner.go:176-181unavailable/N (FAIL)whenUnavailableis trueAvgContractCoverageExit code: 1 (same as threshold failure — no new exit codes).
Severity
All reviewers agree High is appropriate. It's a CI governance bypass that provides false assurance when GazeCRAP data is missing. Not CRITICAL because there's no data corruption or security impact.
fix: prevent silent CI passes on missing/partial data (unbound-force#101
fix: prevent silent CI passes on missing/partial data (unbound-force#101
fix: prevent silent CI passes on missing/partial data (unbound-force#101
fix: prevent silent CI passes on missing/partial data (#101, #108, #116)
fix: prevent silent CI passes on missing/partial data (unbound-force#101
docs: add OpenSpec artifacts for report-step-failure-gate
fix: fail CI gate when analysis step errors and threshold is set
docs: add OpenSpec artifacts for report-step-failure-gate
fix: fail CI gate when analysis step errors and threshold is set
docs: add OpenSpec artifacts for report-step-failure-gate
fix: fail CI gate when analysis step errors and threshold is set
fix(unbound-force#375): complete review-advisory sweep — quote versio…
fix(#375): complete review-advisory sweep — quote version inputs, pin…