Skip to content

fix(#282): honor --language alone for gaze report external analyzer dispatch - #379

Merged
jflowers merged 7 commits into
unbound-force:mainfrom
jflowers:opsx/report-language-dispatch
Nov 25, 2026
Merged

jflowers merged 7 commits into
unbound-force:mainfrom
jflowers:opsx/report-language-dispatch

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

gaze report now dispatches to the external analyzer pipeline when --language is set without --analyzer, matching gaze crap, gaze quality, and gaze docscan. The change widens the two external-analyzer gates in runReport's extracted helpers (cmd/gaze/main.go) from --analyzer-only to --analyzer || --language — the identical condition the sibling commands already use: resolveReportModuleDir (language-only runs use the working directory instead of requiring a Go module root) and applyReportAnalyzeFunc (language-only runs build the external-analyzer AnalyzeFunc), with updated GoDoc. A hermetic regression test (TestReportWithLanguageOnly_TriggersExternalPath) pins the dispatch: outside a Go module with the undiscoverable sentinel language, the error must contain no analyzer found for language and must not contain finding module root. Behavior changes: --language-only outside a Go module previously failed with a module-root error — now dispatches externally, or fails with the actionable no analyzer found for language "<lang>"; inside a Go module the flag was silently inert — now dispatches externally; the no-flag Go-native path is byte-identical. No protocol, schema, flag-surface, or internal/aireport changes.

Closes #282

How to Test

  1. Run the regression test: go test -race -count=1 -run TestReportWithLanguageOnly_TriggersExternalPath -v ./cmd/gaze/
  2. From a directory that is not a Go module, run gaze report --language python . — it must dispatch externally; with no analyzer installed it fails with no analyzer found for language "python", never a module-root error.
  3. Inside a Go module, run gaze report --language python ./... — it must take the external-analyzer dispatch path, never silently fall through to Go-native analysis.
  4. Run gaze report --analyzer snake-eyes . — --analyzer-only behavior is unchanged.
  5. Run gaze report with no flags — outside a module it still fails with the module-root error; inside a module it still runs Go-native analysis (byte-identical path).
  6. Run the full suite: go test -race -count=1 -short ./...

How to Demo

Run gaze report --language python . from a directory that is not a Go module — observe external-analyzer dispatch (no analyzer found for language "python") instead of the previous module-root error.

Key Files Changed

  • cmd/gaze/main.go — widened dispatch gates in resolveReportModuleDir and applyReportAnalyzeFunc (+ GoDoc)
  • cmd/gaze/external_analyzer_test.go — hermetic regression test TestReportWithLanguageOnly_TriggersExternalPath
  • README.md — Go-analysis fallback condition corrected
  • openspec/changes/report-language-dispatch/ — proposal, design, specs, tasks

8 files changed, 439 insertions(+), 6 deletions(-)

Known Issues

  • LOW (test-coverage): The spec scenario "Language-only inside a Go module" (Requirement 1, Scenario 2) has no test executing its WHEN clause — no automated test proves that a --language-only gaze report inside a Go module dispatches externally instead of silently running Go-native analysis.
  • LOW (assertion-depth): The regression test asserts the error contains no analyzer found for language but not that it names the requested language; a regression that made the diagnostic generic would still pass the test.

All CI-parity checks green locally: go build clean; go test -race -count=1 -short ./... — 22 packages ok; golangci-lint run — 0 issues; markdownlint/yamllint clean; gaze dogfood gates PASS (CRAPload 23/38, GazeCRAPload 6/6, avg contract coverage 39.8 ≥ 8); e2e self-check pass.

This PR was generated by /uf.finale (AI-assisted).

The 1.1 delegation's commit flipped the Phase-3 task 3.4 checkbox
alongside 1.1 before Phases 1-2 executed. Reverting per supervisor
audit; 3.4 is re-marked when Phase 3 runs it.
The Multi-Language Support section claimed Gaze falls back to built-in
Go analysis "when no --analyzer flag is set and no analyzer is
configured". Since gaze report now dispatches to external analyzer
discovery on --language alone (matching crap/quality/docscan), a
--language run with nothing configured fails with "no analyzer found
for language" instead of using Go analysis. Require both --analyzer
and --language to be unset for the Go-native fallback.
- tasks.md checkbox edit marking verification tasks done

Assisted-by: Muse-Spark-Open-816B-A42B-NVFP4
Generated with AI assistance (Muse-Spark-Open-816B-A42B-NVFP4)
@jflowers
jflowers enabled auto-merge (rebase) November 25, 2026 04:43

@uf-divisor uf-divisor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Council Review: fix(#282) — honor --language alone for gaze report external analyzer dispatch

Council verdict: APPROVE WITH ADVISORIES — 7 of 7 reviewers completed; 6 returned APPROVE and 1 returned APPROVE WITH ADVISORIES (divisor-testing). One LOW advisory finding; no CRITICAL or HIGH findings.

Summary

Widens the two external-analyzer gates in runReport's extracted helpers (resolveReportModuleDir, applyReportAnalyzeFunc) from --analyzer-only to --analyzer || --language, matching runCrap/runQuality/runDocscan and resolving issue #282. A hermetic regression test (TestReportWithLanguageOnly_TriggersExternalPath) pins the dispatch, the README fallback wording is corrected, and the OpenSpec change report-language-dispatch ships complete with all tasks marked done.

Reviewers

Reviewer Verdict
divisor-adversary APPROVE
divisor-architect APPROVE
divisor-curator APPROVE
divisor-entropy APPROVE
divisor-gaze-testing APPROVE
divisor-guard APPROVE
divisor-testing APPROVE WITH ADVISORIES

Findings

LOW — test-coverage (cmd/gaze/external_analyzer_test.go:814, divisor-testing): the regression test pins language-only dispatch through its failure leg only — see the inline comment. The delta spec's "Language-only inside a Go module" scenario is covered transitively, and the language-only → PATH-discovery → external-report success composition lacks an end-to-end test. The dispatch contract itself is protected (reverting either widened gate fails the paired assertions); the gap is inherited shape, not a regression. Optional strengtheners are listed inline.

All 6 CI checks pass. No CRITICAL or HIGH findings.

This review was generated by /uf.review-pr (AI-assisted).

Comment thread cmd/gaze/external_analyzer_test.go Resolved
@jflowers
jflowers merged commit 2d80f2e into unbound-force:main Nov 25, 2026
7 of 12 checks passed
@jflowers
jflowers deleted the opsx/report-language-dispatch branch November 25, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gaze report: honor --language alone for external analyzer dispatch

2 participants