Repository navigation
Description
- Severity: Critical
- Status: Confirmed — reproduced first-hand on 2026-06-08
- Component:
internal/quality/pairing.go(InferTargets,resolveCallee),internal/quality/quality.go - Affected command:
gaze quality(and the GazeCRAP path ofgaze crap/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
gaze quality — the tool's headline feature (contract coverage / assertion
mapping) — silently produces no output and exits 0 when it cannot infer the
function a test targets. Target inference is a static SSA call-graph walk that
matches a test to the functions it calls directly. Ginkgo/BDD suites register
spec closures into a global registry at init and run them via dynamic
dispatch, which SSA cannot resolve, so gaze maps nothing. The user gets an empty
result with a success exit code — in CI this reads as a pass.
Reproduction
Real-world target: crosscodex/pkg/tlsconfig, whose tests are a single Ginkgo
entrypoint TestTLSConfigBDD:
$ cd /tmp/crosscodex && GOTOOLCHAIN=auto gaze quality ./pkg/tlsconfig
warning: TestTLSConfigBDD: no target function identified, skipping
$ echo $?
0
# stdout: (empty)
crosscodex uses Ginkgo in 23 files; 15 packages have only a TestXxxBDD
entrypoint, so gaze quality is inert across all of them.
Expected vs Actual
- Expected: Either map the BDD specs to their targets, or — when targets
cannot be inferred — emit a clear diagnostic to stdout and exit non-zero
(or a dedicated "no data" code), so the absence of analysis is visible. - Actual: A single
warning:line on stderr, empty stdout, exit 0.
Root cause
internal/quality/pairing.go:153 InferTargets walks the test's SSA call graph
(walkCalls, line 208) and resolves callees with resolveCallee (line 265),
which returns nil for calls it cannot statically resolve (dynamic
dispatch / interface invoke). When nothing resolves it returns:
return nil, []string{"no target function identified"} // pairing.go:175internal/quality/quality.go:193 turns that into a skip and moves on:
fmt.Fprintf(stderr, "warning: %s: no target function identified, skipping\n", tf.Name)There is no aggregate "0 of N tests could be analyzed" result on stdout and no
non-zero exit when the entire package yields nothing.
Impact
The entire value proposition of gaze (verifying that tests assert on contractual
side effects) is unavailable for a whole class of idiomatic Go test suites
(Ginkgo/Gomega and any test using dynamic dispatch), and the tool gives no
honest signal that it produced nothing. This is the second major reason a
real-world run "returns nothing useful."
Suggested fix
- When a package's analyzed-test count is zero, print an explicit summary to
stdout (e.g. "0/15 tests mapped to a target") and exit non-zero (or a
documented "no-data" code) so CI and humans can tell analysis did not run. - Optionally add a BDD-aware target heuristic (e.g. associate specs with the
package's exported API, or honor an explicit--target).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✔️
Activity
jflowers commentedon Jun 16, 2026
This issue is valid — the diagnosis is accurate. Here's what I found after tracing the full code path:
Confirmed behavior:
InferTargets(internal/quality/pairing.go:174) returnsnilwhenwalkCallsfinds zero candidates viaresolveCallee, which returnsnilfor interface dispatch (call.Call.IsInvoke()). Ginkgo's dynamic dispatch is invisible to SSA.Assess(internal/quality/quality.go:190-195) silently skips test functions with no targets — warning to stderr only.runQuality(cmd/gaze/main.go) returnsnil(exit 0) when the reports slice is empty. No stdout output is produced.Recommended approach (disagrees with suggested fix #2):
Print a summary to stdout when reports are empty. Something like:
"0 of 15 test functions mapped to a target; quality assessment skipped."This is the highest-value, lowest-risk change — makes the absence of analysis visible to both humans and CI log scrapers.Add a
--fail-on-emptyflag for CI opt-in non-zero exit. A blanket non-zero exit on empty results would be too aggressive — packages with only benchmarks/examples, or exploratorygaze qualityruns on unfamiliar code, would break. An opt-in flag (or leveraging the existing--min-contract-coveragethreshold — if you set a minimum and nothing was analyzed, that should fail) keeps the default safe while giving CI users the gate they need.List skipped test names in stdout output, not just stderr warnings. CI logs often truncate stderr or interleave it unpredictably. The skipped tests should appear in the report itself.
Do NOT implement a BDD-aware target heuristic as part of this fix. The suggestion to "associate specs with the package's exported API" would create false contract coverage claims — worse than no data, because it would be wrong data. This directly violates Principle I (Accuracy): "False positives erode trust and MUST be treated as bugs." A proper BDD heuristic would require parsing Ginkgo's DSL and reverse-engineering which function each
Itblock exercises — that's a feature requiring its own spec, accuracy analysis, and ratchet testing. Worth filing separately, but not bundling here.Note: the
--targetflag already exists (qualityParams.targetFunc) for manual target specification, which partially addresses Ginkgo suites where the user knows the target function. The issue doesn't mention this — might be worth documenting more prominently.fix: gaze quality produces output and gates on empty results (unbound…
docs: add OpenSpec artifacts for quality-empty-results-gate (unbound-…
fix: gaze quality produces output and gates on empty results (unbound…
docs: add OpenSpec artifacts for quality-empty-results-gate (#103)
fix: gaze quality produces output and gates on empty results (#103)
docs: add OpenSpec artifacts for quality-empty-results-gate (unbound-…
fix: gaze quality produces output and gates on empty results (unbound…