Repository navigation
Description
- Severity: Critical
- Status: Confirmed — reproduced first-hand on 2026-06-08
- Component:
internal/crap/analyze.go→generateCoverProfile(lines 158–188) - Affected commands:
gaze crap,gaze report,gaze self-check - 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
gaze crap ./... computes coverage by shelling out to go test -coverprofile.
If that single invocation exits non-zero — because one package fails to
build, or one test fails — gaze deletes the coverage profile and returns an
error, producing zero output for the entire run. go test writes a
complete, usable coverprofile for every package that did pass; gaze throws it
away. A test-quality tool therefore refuses to analyze any repository in the
extremely common state of "one failing test" or "one non-building package."
Reproduction
Real-world target: github.com/complytime-labs/crosscodex (one package,
internal/testgrpc, imports an uncommitted generated package, so
go test ./... fails to build it).
$ cd /tmp/crosscodex && GOTOOLCHAIN=auto gaze crap ./... >out.txt 2>err.txt
$ echo "exit=$? stdout_bytes=$(wc -c <out.txt)"
exit=1 stdout_bytes=0
$ tail -3 err.txt
ok github.com/complytime-labs/crosscodex/pkg/tlsconfig/pki coverage: 82.0% of statements
ok github.com/complytime-labs/crosscodex/pkg/vectordb coverage: 37.8% of statements
FAIL
The same tool on any single clean package works perfectly:
$ gaze crap ./pkg/tlsconfig
# → full 34-function CRAP table, exit 0
So ~30 packages that tested fine produced no report solely because one
unrelated package would not build.
Expected vs Actual
- Expected: Use the coverprofile that
go testwrote, report scores for the
packages that were measured, and warn that some packages could not be tested. - Actual: Empty stdout, exit 1, and the
go testfailure text dumped to
stderr.
Root cause
internal/crap/analyze.go:179-185:
cmd := exec.Command("go", args...)
cmd.Dir = moduleDir
output, err := cmd.CombinedOutput()
if err != nil {
_ = os.Remove(profilePath) // <-- deletes the usable partial profile
return "", fmt.Errorf("go test failed: %s\n%s", err, string(output))
}go test's exit code conflates "the test binary reported a failure" with "no
data is available." The coverprofile at profilePath is fully written before
go test returns non-zero.
Impact
This is the single largest usability defect in the tool and the most likely
reason a first-time user pointed at a real repo "gets nothing." Running with
./... — the form the README and CI guide recommend — fails closed on any repo
that is not 100% green and 100% building.
Suggested fix
After cmd.Run(), check whether profilePath is non-empty and parseable. If
so, proceed with the partial data and emit a warning listing what failed,
instead of aborting. Only return a hard error when no profile was produced at
all. Consider separating "build failure" (fatal) from "test failure" (warn and
continue) by inspecting the output.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✔️
Activity
jflowers commentedon Jun 16, 2026
Triage Summary
Verdict: Valid bug — unanimous across all 5 review agents.
Category: Bug (error handling defect)
Objectivity: Objective — root cause verified at
internal/crap/analyze.go:179-185Analysis
The panel confirms this is a genuine error handling gap in
generateCoverProfile. The function unconditionally deletes the coverage profile and returns an error whengo testexits non-zero, discarding valid partial coverage data thatgo test -coverprofilewrites for all successfully-tested packages.Key findings:
SSADegraded,SSADegradedPackages) that returns partial results instead of aborting. The coverage profile handling should follow the same pattern.gaze crap,gaze report(when no--coverprofileis supplied), andgaze self-check(which has no workaround).ParseCoverProfileandcomputeScoresalready handle partial coverage data gracefully — onlygenerateCoverProfileneeds to change.generateCoverProfileis currently untested; all existingAnalyzetests bypass it via pre-supplied profiles.Recommended fix approach (following the SSA degradation pattern):
cmd.CombinedOutput()returns non-zero, check ifprofilePathexists and has non-zero sizecover.ParseProfiles(profilePath)— if valid, proceed with partial datago testoutput)CoverageDegradedPackages []stringtocrap.Summary(mirroringSSADegradedPackages)This triage was performed by the Divisor review panel.
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
fix(unbound-force#375): complete review-advisory sweep — quote versio…
fix(#375): complete review-advisory sweep — quote version inputs, pin…