Repository navigation
fix: migrate all 10 filepath.Walk err-shadow sites (ADR-49633) and enforce in CI - #49907
Conversation
… (ADR-49633 migration) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Triage ResultCategory: refactor | Risk: medium | Score: 52/100 (impact 25, urgency 12, quality 15) Recommended action: defer Draft PR, CI pending, moderate-size refactor across 8 files (filepath.Walk err-shadow migration). No reviews yet. Revisit once CI completes and draft is marked ready.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
❌ Test Quality Sentinel failed during test quality analysis. |
There was a problem hiding this comment.
Pull request overview
Migrates all ten filepath.Walk shadowing sites and enables ongoing CI enforcement.
Changes:
- Renames outer walk errors to
walkErracross six Go files. - Enables
walkfuncerrshadowfor native and WASM lint jobs. - Marks ADR-49633 as accepted.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/trial_support.go |
Renames artifact walk error. |
pkg/cli/remove_command.go |
Renames three include-walk errors. |
pkg/cli/logs_metrics.go |
Renames two log-walk errors. |
pkg/cli/logs_download.go |
Renames two artifact-walk errors. |
pkg/cli/dependency_graph.go |
Renames workflow scan error. |
pkg/cli/compile_watch.go |
Renames watcher setup walk error. |
.github/workflows/cgo.yml |
Enforces the linter in CI. |
docs/adr/49633-add-walkfuncerrshadow-linter-for-filepath-walk-err-shadow.md |
Accepts the ADR. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 0
- Review effort level: Balanced
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #49907 does not have the implementation label and has only 28 new lines in business logic directories (threshold: 100). |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs — clean, mechanical migration with no logic changes.
📋 Review Summary
What was done
- All 10
filepath.Walkerr-shadow sites renamederr→walkErrconsistently - Linter flag
-walkfuncerrshadowadded to both native and wasm CI invocations - ADR-49633 status updated to Accepted
Positive Highlights
- ✅ Every renamed site uses
walkErr— matches existing convention - ✅ CI enforcement added in the same PR, preventing regression
- ✅ Wasm linter invocation also picks up the flag (no coverage gap)
- ✅ Pure rename — no behaviour changes, low risk
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 17.1 AIC · ⌖ 8.08 AIC · ⊞ 7.1K
Comment /matt to run again
There was a problem hiding this comment.
The changes are a clean, mechanical rename of err → walkErr at all 10 filepath.Walk call sites across 6 files. The fix is correct, consistent, and complete.
One minor observation: -walkfuncerrshadow is also added to the wasm linter step, but that step's LINTER_PACKAGES only covers ./pkg/console ./pkg/parser ./pkg/styles ./pkg/tty ./pkg/workflow — none of the changed packages — so the flag is effectively a no-op there. Harmless; the native linter step is the one that actually enforces this across ./pkg/cli.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 16.7 AIC · ⌖ 7.58 AIC · ⊞ 5.4K
There was a problem hiding this comment.
Verdict: Approve — clean, mechanical fix
All 10 filepath.Walk sites correctly rename the outer err to walkErr, eliminating the shadow bug. Verified each site: no leftover references to the old err name, no scoping conflicts (e.g. remove_command.go inner err := in the loop is unaffected since it's a different, inner scope). CI linter flag and ADR status update are consistent with the stated migration. Build succeeds.
Notes
No blocking issues found. Confirmed via go build ./pkg/cli/... that the package compiles cleanly after the renames.
🔎 Code quality review by PR Code Quality Reviewer · auto · 13.3 AIC · ⌖ 3.77 AIC · ⊞ 7.9K
Comment /review to run again
|
@copilot merge main and recompile |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…rate-walkfuncerrshadow Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done — merged main and recompiled all 269 workflows (all in sync, zero errors). |
|
@copilot Please take the next maintainer-ready step on this PR. Refresh the branch if GitHub allows it, verify checks, and run the Run: https://github.com/github/gh-aw/actions/runs/30811225763
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Done. Here's the PR finisher summary:
Actions taken: Fixed Hand-off: CI must be re-triggered by a maintainer (close/reopen PR, workflow_dispatch, or push) before merge. |
|
🎉 This pull request is included in a new release. Release: |
Ten
filepath.Walkcall sites usederrfor both the outer walk result and the callback's third parameter, silently shadowing the outer variable. This is the one-time migration cost called out in ADR-49633; the linter existed but was never enforced and the migration was never done.Changes
err→walkErrat all 10 flagged sites across 6 files, matching the convention already used at other Walk call sites in the codebase (logs_utils.go,copilot_agent.go,logs_metrics.go:985):pkg/cli/logs_download.go— 2 sites (flattenArtifactTree,listArtifacts)pkg/cli/compile_watch.go— 1 site (subdirectory watcher setup)pkg/cli/trial_support.go— 1 site (artifact directory walk)pkg/cli/remove_command.go— 3 sites (cleanupOrphanedIncludes,getAllIncludeFiles,cleanupAllIncludes)pkg/cli/logs_metrics.go— 2 sites (log file walk, MCP failure extraction)pkg/cli/dependency_graph.go— 1 site (BuildGraph).github/workflows/cgo.yml— adds-walkfuncerrshadowto bothLINTER_FLAGSinvocations (native and wasm) so the pattern is caught in CI going forward.ADR-49633 — status flipped from
Draft→Accepted.run: https://github.com/github/gh-aw/actions/runs/30811225763