Skip to content

bug: gaze report --analyzer fails with 'no go.mod found' on non-Go projects (same as #250) #257

Closed

Description

@fullsend-ai-retro

What happened

PR #254 fixed issue #250 where gaze crap --analyzer failed immediately with no go.mod found on non-Go projects because FindModuleRoot ran unconditionally before the --analyzer flag was checked. The fix deferred FindModuleRoot in runCrap to after the --analyzer dispatch, matching the pattern already used by runQuality.

During review of PR #254 (workflow run 34275311403), the fullsend review agent's correctness sub-agent searched for the same pattern in adjacent commands and found that runReport (line 1944 of cmd/gaze/main.go) has the identical bug: it calls loader.FindModuleRoot(cwd) unconditionally at the top of the function, ~65 lines before checking p.analyzerFlag at line 2009.

Because follow-up issue creation is currently disabled in the review agent post-script, the finding was noted in the PR review comment but no tracking issue was filed.

What could go better

The same bug pattern survived in runReport because the fix in PR #254 was scoped to runCrap only. The original issue #250 was filed specifically about gaze crap, so the PR's scope was reasonable — but neither the human reviewer nor the PR author checked the sibling commands for the same pattern.

The review agent correctly identified this gap, but the finding was buried in a low-severity PR comment with no follow-up mechanism. The disabled follow-up issue creation (tracked in fullsend-ai/agents#1229) means actionable findings from reviews risk being lost.

Confidence: High. The bug has been verified by reading the current source code — runReport calls FindModuleRoot at line 1944 before checking analyzerFlag at line 2009, exactly mirroring the pre-fix runCrap pattern.

Proposed change

File a bug in unbound-force/gaze to defer FindModuleRoot in runReport after the --analyzer dispatch, matching the pattern now used by both runCrap (post-PR #254) and runQuality.

The fix in cmd/gaze/main.go would move the FindModuleRoot call (currently at line 1944) to after the if p.analyzerFlag != "" check (line 2009), following the same structure as the runCrap fix:

  1. Remove the unconditional FindModuleRoot call near the top of runReport
  2. Add a conditional FindModuleRoot call in the Go-native path after the --analyzer early-return
  3. Add regression tests mirroring TestCrapWithExternalAnalyzer_BypassesFindModuleRoot

Validation criteria

  1. gaze report --analyzer nonexistent --language python . from a non-Go project directory produces an analyzer-discovery error, not no go.mod found
  2. gaze report ./... from a Go module continues to work correctly
  3. A regression test analogous to TestCrapWithExternalAnalyzer_BypassesFindModuleRoot exists for the report command
  4. All three commands (crap, quality, report) follow the same pattern: check --analyzer before calling FindModuleRoot

Generated by retro agent from #254

Activity

  1. added
    ready-for-triage
    on Sep 14, 2026
  2. fullsend-ai-triage commented on Sep 14, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 12:30 PM UTC · Completed 12:34 PM UTC

    Commit: ec204ea · View workflow run →

    Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $0.86

  3. added
    bug
    ready-to-code
    on Sep 14, 2026
  4. fullsend-ai-triage commented on Sep 14, 2026

    @fullsend-ai-triage

    Verified by reading the current runReport source — loader.FindModuleRoot(cwd) is called unconditionally at line 1944, with p.analyzerFlag not checked until line 2009. This is the same pattern fixed in runCrap by PR #254.

    The fix follows the established pattern: move FindModuleRoot into the Go-native code path, after the --analyzer early-return.

    Proposed test case:

    func TestReportWithExternalAnalyzer_BypassesFindModuleRoot(t *testing.T) {
        // Run from a directory with no go.mod
        dir := t.TempDir()
        // Set analyzerFlag to a non-existent binary
        p := reportParams{
            analyzerFlag: "nonexistent-analyzer",
            languageFlag: "python",
            patterns:     []string{"."},
            // ... other required fields
        }
        err := runReport(p)
        // Should fail with analyzer discovery error, NOT "no go.mod found"
        if err == nil {
            t.Fatal("expected error for missing analyzer")
        }
        if strings.Contains(err.Error(), "go.mod") {
            t.Errorf("got go.mod error on external analyzer path: %v", err)
        }
    }

    Related: #250 (same bug in gaze crap, now fixed), PR #254 (the fix for runCrap — reference for the pattern).


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  5. fullsend-ai-coder commented on Sep 14, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 12:36 PM UTC · Completed 12:51 PM UTC

    Commit: ec204ea · View workflow run →

    Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $3.60

  6. moved this to In Review 🏁 in Unbound Force Planningon Sep 17, 2026
  7. added a commit that references this issue on Sep 17, 2026
  8. added a commit that references this issue on Sep 17, 2026
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

    bugready-for-triageready-to-code

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions