Skip to content

Fix --include-unexported doc-code mismatch when used with --analyzer #273

Closed

Description

@fullsend-ai-retro

What happened

The review agent on PR #242 identified a doc-code mismatch on 2026-09-21 (inline comment on cmd/gaze/main.go:1188): the README and docs/reference/cli/quality.md document that --include-unexported is rejected when --analyzer is set, but the code in runQualityWithExternalAnalyzer only validates --target and --ai-mapper. The --include-unexported flag is silently accepted and ignored. The PR was merged without addressing this finding — the author had already resolved 7+ findings across 3 review rounds over 21 days, and the agent's final review posted the same day as the merge.

What could go better

This is a genuine documentation accuracy bug that the review agent correctly identified and both human reviewers missed. The agent's strongest value-add on this PR was systematic doc-code consistency checking — this is exactly the class of issue where automated review outperforms human review.

However, the finding was not actioned before merge, likely due to a combination of: (a) the agent's accumulated noise from repeated findings (6 duplicate filings across 3 runs) reducing trust in its output, and (b) review fatigue after 21 days and 3 rounds. The finding was valid but lost in the noise.

Confidence: HIGH — the mismatch is verifiable by comparing docs/reference/cli/quality.md (says --include-unexported is rejected) with cmd/gaze/main.go runQualityWithExternalAnalyzer (no check for includeUnexported).

Proposed change

Either add the missing validation in cmd/gaze/main.go runQualityWithExternalAnalyzer to reject --include-unexported with --analyzer (matching the documented behavior):

if p.includeUnexported {
    return fmt.Errorf("--include-unexported is not supported with --analyzer")
}

Or, if the intention is to silently ignore the flag (since external analyzers handle their own function visibility), update README.md and docs/reference/cli/quality.md to only list --target and --ai-mapper as rejected flags, removing --include-unexported from the incompatibility list.

The choice depends on the intended UX: rejecting loudly follows the existing pattern for --target/--ai-mapper and aligns with Constitution Principle II (Minimal Assumptions — make assumptions explicit). Silently ignoring requires less code but violates the principle of least surprise.

Validation criteria

  1. gaze quality --analyzer /path/to/analyzer --language python --include-unexported ./... either (a) exits with a clear error message if the flag is rejected, or (b) proceeds without error if the docs are updated to allow it.
  2. The behavior of --include-unexported with --analyzer matches what all documentation files (README.md, docs/reference/cli/quality.md) describe.
  3. A test case in cmd/gaze/external_analyzer_test.go covers the --include-unexported + --analyzer combination.

Generated by retro agent from #242

Activity

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

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 5:55 PM UTC · Completed 5:59 PM UTC

    Commit: 76f8ca9 · View workflow run →

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

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

    @fullsend-ai-triage

    Verified the mismatch: runQualityWithExternalAnalyzer validates --target and --ai-mapper but not --include-unexported, while both README.md (line 199) and docs/reference/cli/quality.md (line 41) document all three as rejected.

    The fix should add a validation check following the existing pattern at lines 1190–1201 of cmd/gaze/main.go, plus a test mirroring the existing TestRunQuality_ExternalAnalyzer_RejectsTarget pattern:

    func TestRunQuality_ExternalAnalyzer_RejectsIncludeUnexported(t *testing.T) {
        p := qualityParams{
            analyzerFlag:      "/path/to/analyzer",
            languageFlag:      "python",
            includeUnexported: true,
            stdout:            io.Discard,
            stderr:            &bytes.Buffer{},
        }
        err := runQualityWithExternalAnalyzer(p)
        if err == nil {
            t.Fatal("expected error for --include-unexported with --analyzer")
        }
        if !strings.Contains(err.Error(), "--include-unexported is not supported with --analyzer") {
            t.Errorf("unexpected error: %v", err)
        }
    }

    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 21, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 6:00 PM UTC · Completed 6:14 PM UTC

    Commit: 76f8ca9 · View workflow run →

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

  6. added 2 commits that reference this issue on Sep 22, 2026
  7. added a commit that references this issue on Sep 25, 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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions