Repository navigation
fix(#257): defer FindModuleRoot in runReport after --analyzer check - #258
Conversation
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts |
|
🤖 Finished Review · ✅ Success · Started 12:53 PM UTC · Completed 1:08 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.57 |
|
Risk Assessment: moderate (2/5) DetailsSmall, well-scoped bug fix (2 files, 77 lines, 50% test ratio) deferring FindModuleRoot after the --analyzer early-return path. Tier 1 signals are minimal across all 8 dimensions. Tier 2 is elevated due to cmd/gaze/main.go being a high-churn hub with fix-related commits in 90d. Tier 3 is low: all 4 acceptance criteria met, trivially reversible. Composite 1.55 rounds to 2 (moderate), consistent with prior assessment. Previous runRisk Assessment: moderate (2/5) DetailsSmall, well-scoped bug fix (2 files, 77 lines, 50% test ratio) deferring FindModuleRoot after the --analyzer early-return path — known pattern duplicate of #250. Tier 1 is minimal across all 8 dimensions. Tier 2 is elevated due to cmd/gaze/main.go being a high-churn hub with 20 fix-related commits in 90 days. Tier 3 is low: all acceptance criteria met, trivially reversible. Composite 1.55 rounds to 2 (moderate), consistent with prior assessment. Previous run (2)Risk Assessment: moderate (2/5) DetailsSmall, well-scoped bug fix (2 files, 93 lines, 78 are new tests) deferring FindModuleRoot after the --analyzer early-return path. Tier 1 is minimal risk across all signals. Tier 2 is elevated because cmd/gaze/main.go is a high-churn hub with 27 commits and 20 fix-related commits in 90 days. Tier 3 is low: known pattern (duplicate of #250), all acceptance criteria addressed, trivially reversible. Composite 1.67 rounds to 2 (moderate). |
|
Looks good to me Previous runLooks good to me Previous run (2)ReviewFindingsLow
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 1:09 PM UTC · Completed 1:22 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $2.34 |
🔧 Fix agent — iteration 1 (bot-triggered)Replaced manual os.Chdir + t.Cleanup pattern with t.Chdir(t.TempDir()) in both report regression tests, as recommended by the reviewer. The project requires Go 1.25+, so t.Chdir (added in Go 1.24) is available and preferable. Fixed (1):
Tests: passedNext steps:
|
Replace manual os.Chdir + t.Cleanup boilerplate with t.Chdir(t.TempDir()) in both TestReportWithExternalAnalyzer_BypassesFindModuleRoot and TestRunReport_GoNativePath_FindModuleRootFailure. Go 1.24+ t.Chdir is available (module requires 1.25) and makes the test-isolation contract explicit by auto-restoring the directory and forbidding t.Parallel. Addresses #258
|
🤖 Finished Review · ✅ Success · Started 1:23 PM UTC · Completed 1:37 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.34 |
em-redhat
left a comment
There was a problem hiding this comment.
APPROVE — Clean, minimal bug fix. All 4 acceptance criteria from #257 satisfied. CI passes across all matrix entries (Go 1.24 + 1.25, unit/integration + E2E + MegaLinter). No security, alignment, or constitution concerns.
This review was generated by /uf.review-pr (AI-assisted).
runReport called loader.FindModuleRoot unconditionally at the top of the function, causing gaze report --analyzer to fail with "no go.mod found" on non-Go projects. This is the same bug pattern fixed in runCrap by PR #254 (issue #250). The fix makes FindModuleRoot conditional on p.analyzerFlag == "": when --analyzer is set, the project may not be a Go module, so cwd is used directly as moduleDir. When --analyzer is not set (Go-native path), FindModuleRoot resolves the module root as before. Added two regression tests: - TestReportWithExternalAnalyzer_BypassesFindModuleRoot: verifies that runReport with --analyzer from a non-Go directory produces an analyzer discovery error, not "no go.mod found" - TestRunReport_GoNativePath_FindModuleRootFailure: verifies that runReport without --analyzer still calls FindModuleRoot and produces the expected error format All three commands (crap, quality, report) now follow the same pattern: check --analyzer before calling FindModuleRoot. Closes #257
Replace manual os.Chdir + t.Cleanup boilerplate with t.Chdir(t.TempDir()) in both TestReportWithExternalAnalyzer_BypassesFindModuleRoot and TestRunReport_GoNativePath_FindModuleRootFailure. Go 1.24+ t.Chdir is available (module requires 1.25) and makes the test-isolation contract explicit by auto-restoring the directory and forbidding t.Parallel. Addresses #258
aaf5407 to
db3d665
Compare
|
🤖 Finished Review · ✅ Success · Started 12:02 PM UTC · Completed 12:13 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.03 |
|
🤖 Finished Retro · ✅ Success · Started 12:21 PM UTC · Completed 12:34 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.87 |
Retro: PR #258 —
|
| Time (UTC) | Event |
|---|---|
| Sep 14, 12:29 | Retro agent files issue #257 from PR #254 review findings |
| Sep 14, 12:30–12:34 | Triage agent verifies bug by reading source ($0.86) |
| Sep 14, 12:36–12:51 | Code agent creates PR #258 with fix + 2 regression tests ($3.60) |
| Sep 14, 12:52–13:08 | Review agent: CHANGES_REQUESTED — low: use t.Chdir instead of os.Chdir + t.Cleanup ($5.57) |
| Sep 14, 13:08–13:22 | Fix agent replaces os.Chdir with t.Chdir(t.TempDir()) ($2.34) |
| Sep 14, 13:22–13:37 | Review agent: APPROVED ($4.34) |
| Sep 17, 11:58 | Human (em-redhat): APPROVED via /uf.review-pr |
| Sep 17, 12:01–12:13 | Review agent re-run on push: APPROVED ($4.03) |
| Sep 17, 12:20 | Merged by em-redhat |
Total agent cost: ~$20.74 (triage + code + 3 reviews + 1 fix). Rework iterations: 1 (t.Chdir style fix).
What went well
- Retro-to-code pipeline created real value. The retro agent identified the sibling
FindModuleRootbug inrunReportduring PR #254's review, filed issue #257 with precise reproduction steps and validation criteria, and the full pipeline (triage → code → review → fix → merge) executed cleanly. - Code agent produced a minimal, correct fix. 2 files changed, +74/-3 lines. The fix mirrors the pattern from PR fix: allow gaze crap --analyzer on non-Go projects #254 exactly, with two regression tests covering both the external-analyzer and Go-native paths.
- Review agent caught a real issue. The
os.Chdir+t.Cleanup→t.Chdir(t.TempDir())finding was legitimate — the codebase already usest.Chdirincmd/gaze/main_test.goand the project requires Go 1.25+. - Duplicate dispatch handled correctly. Two fullsend runs fired within 2 seconds (PR
opened+labeledevents). The per-role concurrency group cancelled the second run before any agent work started — no wasted compute.
Existing issue evidence
- Review agent's disabled follow-up-issue-creation code comment points to a stale, repurposed issue number fullsend-ai/agents#1229 (follow-up issue creation disabled): This PR's existence is direct evidence for that issue. The review agent for PR fix: allow gaze crap --analyzer on non-Go projects #254 found the
runReportsibling bug but couldn't auto-file a tracking issue. The retro agent filled that gap, but enabling review-agent follow-up issue creation would have shortened the feedback loop from days to minutes.
Proposals filed
- Code agent: sibling pattern audit for bug-fix PRs (target:
fullsend-ai/agents) — When fixing a bug pattern, grep for the same pattern in sibling functions before submitting. - Go convention pack: add
t.Chdirpreference (target:unbound-force/gaze) — Documentt.Chdiras the preferred pattern for directory-changing tests to prevent the rework that occurred here.
Proposals filed
- Go convention pack: add t.Chdir preference for directory-changing tests (in
unbound-force/gaze)
Proposals skipped (target repo not allowed)
File manually or update create_issues.allow_targets in config.yaml:
- Code agent: add sibling pattern audit step for bug-fix PRs (
fullsend-ai/agents)

Summary
loader.FindModuleRootinrunReport(cmd/gaze/main.go) to after the--analyzerflag check, sogaze report --analyzerno longer fails with "no go.mod found" on non-Go projectsrunCrapin PR fix: allow gaze crap --analyzer on non-Go projects #254 (issue bug: gaze crap --analyzer fails with 'no go.mod found' for non-Go projects #250) — all three commands (crap,quality,report) now follow the same pattern: check--analyzerbefore callingFindModuleRootTestReportWithExternalAnalyzer_BypassesFindModuleRoot(external path bypasses FindModuleRoot) andTestRunReport_GoNativePath_FindModuleRootFailure(Go-native path still calls FindModuleRoot)Test plan
TestReportWithExternalAnalyzer_BypassesFindModuleRoot— verifies the bug is fixedTestRunReport_GoNativePath_FindModuleRootFailure— verifies the Go-native path still calls FindModuleRootcmd/gazetests pass (go test -race -count=1 -short ./cmd/gaze/...)go vet ./cmd/gaze/...passesCloses #257
Post-script verification
agent/257-report-defer-findmoduleroot)ec204ea5db81ed2ba2741a3f9e08e73929a2edbc..HEAD)