Skip to content

audit follow-up PR-B: cousin-shape symmetry (F-5, F-14)#17

Merged
oubiwann merged 1 commit into
audit/0014-go-quality-auditfrom
audit/follow-up-pr-b-cousin-shape
May 8, 2026
Merged

audit follow-up PR-B: cousin-shape symmetry (F-5, F-14)#17
oubiwann merged 1 commit into
audit/0014-go-quality-auditfrom
audit/follow-up-pr-b-cousin-shape

Conversation

@oubiwann

@oubiwann oubiwann commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the two CONSIDER findings the 0015 plan grouped as PR-B — both about the diagnostic chain matching the actual git diff exec invocation. Single commit per the plan's PR-B scope.

Findings closed

F-5 — *GitDiffError cousin-shape parity

*GitDiffError (internal/cli/errors.go) now carries a Dir string field next to Cmd []string, mirroring *golist.ExitError's shape exactly. classifyGitDiffError's third parameter is dir string (was _); the caller at internal/cli/cli.go passes cfg.root which is now stored on *GitDiffError.Dir instead of being discarded.

Test addition: TestClassifyGitDiffError/exec_exit_error in internal/cli/seam_test.go now asserts ge.Dir == "/m".

F-14 — return argv from the git-diff seam

gitDiffResult (internal/cli/seam.go) grew an argv []string field. defaultRunGitDiff constructs argv once and uses it both for the actual exec.CommandContext invocation and as the returned diagnostic argv — the two paths can no longer drift. The synthetic argv reconstruction at internal/cli/cli.go's loadChangeSet is removed; the call site now reads classifyGitDiffError(res.err, res.argv, cfg.root, res.stderr, ctx).

Tests that synthesize gitDiffResult without setting argv produce nil Cmd in the diagnostic — acceptable for the existing tests (none assert on Cmd); a future test that needs argv just sets it on the synthetic result.

Diff scope

5 files modified, 47 insertions / 9 deletions. Plan estimated ~30 lines.

File Change
internal/cli/errors.go + Dir string field on *GitDiffError + doc
internal/cli/seam.go + argv []string on gitDiffResult; defaultRunGitDiff returns argv; classifyGitDiffError takes dir string and stores it
internal/cli/cli.go drop synthetic argv reconstruction; pass res.argv
internal/cli/seam_test.go new ge.Dir == "/m" assertion
docs/dev/0014-go-quality-audit.md PR-B closure walk appended at the bottom

Test plan

  • make check (build + lint via golangci-lint + go test -race -count=1 ./...)
  • Confirm *GitDiffError shape matches *golist.ExitError (grep -n 'Dir ' internal/cli/errors.go pkg/golist/errors.go)
  • Confirm the synthetic argv reconstruction at the old cli.go:269 is gone (grep -n 'git diff --name-only' internal/cli/cli.go — should only show the doc / help text, not a constructed argv)
  • Read the F-14 closure paragraph in docs/dev/0014-go-quality-audit.md

Stacking

Base: audit/0014-go-quality-audit (PR #15). After PR #15 merges, this PR's base can be retargeted to main.

Parallel to PR-A (PR #16, doc pass closing 14 findings + PROMPT-1). PR-A and PR-B do not conflict in code (different files / different lines); each updates docs/dev/0014-go-quality-audit.md at a different anchor (PR-A above the existing ## Closure heading; PR-B at the file end) so the doc edits don't conflict either.

🤖 Generated with Claude Code

Per docs/dev/0015-audit-follow-up-plan-address-all-16-findings.md.

F-5: *GitDiffError grows a Dir field, mirroring *golist.ExitError's
shape. classifyGitDiffError's third parameter changes from `_` to
`dir string`; the caller at internal/cli/cli.go passes cfg.root which
is now stored on the diagnostic instead of discarded. Assertion added
in TestClassifyGitDiffError/exec_exit_error verifies ge.Dir == "/m".

F-14: gitDiffResult gains argv []string. defaultRunGitDiff constructs
argv once and uses it both for exec.CommandContext and as the returned
diagnostic argv — the two paths can no longer drift. The synthetic
argv reconstruction at cli.go's loadChangeSet (the dead-letter that
the audit flagged) is removed; the call site now reads res.argv.

Tests that synthesize gitDiffResult without setting argv produce nil
Cmd in the diagnostic; acceptable for the existing tests (none assert
on Cmd) and a future test that needs argv sets it on the synthetic.

Audit doc 0014 grows a "Post-audit closure — PR-B" section at the
bottom (separate from PR-A's closure walk to avoid merge conflict).

make check passes: build + lint (golangci-lint clean) + test
(go test -race -count=1 ./...) all green.

Closes the last 2 of 16 audit findings + 1 meta-finding (PROMPT-1)
when both PR-A and PR-B land on main.
@oubiwann oubiwann force-pushed the audit/follow-up-pr-b-cousin-shape branch from 6a2ef77 to 5e2d07c Compare May 8, 2026 08:11
@oubiwann oubiwann merged commit ea583d1 into audit/0014-go-quality-audit May 8, 2026
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.

1 participant