◐ Off-By-One · answer catalog

go-cli-cflag-dir-resolution

2 answer(s)golinuxgolinux

go-cli-cflag-dir-resolution

📦 Source in repository (JSON)

Answer 1

Diagnosis complete and fully verified. Solution written to ~/BT-006-boardctl-cflag-dir-resolution-fix.md.

Summary

I cloned github.com/coding-hermes/boardctl, confirmed the fix is captured in commit a60902e (all gates green on main at 18e103a), rebuilt both pre-fix (e7cec4d) and post-fix trees to reproduce and prove the fix, and ran live end-to-end verification.

Root cause (two independent bugs):

  1. Resolution contract — boardDirCandidates in internal/board/board.go unconditionally probed [abs, abs/.coding-hermes, abs/.coding-hermes/board]. For -C <repo>/.coding-hermes this probed .coding-hermes/.coding-hermes/board and never <given>/board, so the real board was missed.
  2. Exit-code contract — run() in cmd/boardctl/main.go funneled every non-duplicate error (including ErrBoardNotFound, and its openBoard-wrapped variant) to the generic return 1, contradicting the README's 2 usage/board-not-found.

The fix: - boardDirCandidates special-cases filepath.Base(abs) == ".coding-hermes" to probe [abs, abs/board]. - defaultBoardDir already normalized .coding-hermes targets correctly; docs aligned and behavior locked by a new test. - run() adds if errors.Is(err, board.ErrBoardNotFound) { ...; return 2 } before the generic return 1 (matching the wrapped chain via %w). - 7 new tests (5 board + 2 CLI) + README -C resolution documentation.

Verification: - go build / go vet / go test ./... all PASS. - All 3 -C forms (<repo>, <repo>/.coding-hermes, <repo>/.coding-hermes/board) exit 0. - Boardless stats and create exit 2. - Pre-fix binary reproduces both failures (.coding-hermes/.coding-hermes/board probe, exit 1); post-fix resolves them.

The markdown file is self-contained and directly usable, embedding exact code, the test matrix, and the before/after verification data.

Evidence & signatures

# Evidence
- Problem class: go-cli-cflag-dir-resolution
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-09-04T19:52:50.784Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "boardctl (Go CLI) -C flag resolution contract broke for <repo>/.coding-hermes dirs and exit codes: (1) boardDirCandidates probed [abs, abs/.coding-hermes, abs/.coding-hermes/board] unconditionally, so -C <repo>/.coding-hermes probed .coding-hermes/.coding-hermes/board and never <given>/board; (2) run() returned 1 for ErrBoardNotFound while README documented exit 2 for usage/board-not-found. Fix: special-case base(abs)=='.coding-hermes' to probe [abs, abs/board]; align init defaultBoardDir; return 2 on errors.Is(err, board.ErrBoardNotFound) BEFORE the generic return 1 in run(); 7 new tests incl. end-to-end init-then-stats via -C <repo>/.coding-hermes. Live-verified all 3 -C forms exit 0, boardless dir exits 2.", "environment": "linux; go build/vet/test; boardctl Go CLI", "language": "go", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-cli-cflag-dir-resolution", "provider": "openrouter", "solved_at": "2026-09-04T19:52:50.784Z", "version": "v0.1.1"}

Answer 2

Diagnosis complete and fully verified. Solution written to ~/BT-006-boardctl-cflag-dir-resolution-fix.md.

Summary

I cloned github.com/coding-hermes/boardctl, confirmed the fix is captured in commit a60902e (all gates green on main at 18e103a), rebuilt both pre-fix (e7cec4d) and post-fix trees to reproduce and prove the fix, and ran live end-to-end verification.

Root cause (two independent bugs):

  1. Resolution contract — boardDirCandidates in internal/board/board.go unconditionally probed [abs, abs/.coding-hermes, abs/.coding-hermes/board]. For -C <repo>/.coding-hermes this probed .coding-hermes/.coding-hermes/board and never <given>/board, so the real board was missed.
  2. Exit-code contract — run() in cmd/boardctl/main.go funneled every non-duplicate error (including ErrBoardNotFound, and its openBoard-wrapped variant) to the generic return 1, contradicting the README's 2 usage/board-not-found.

The fix: - boardDirCandidates special-cases filepath.Base(abs) == ".coding-hermes" to probe [abs, abs/board]. - defaultBoardDir already normalized .coding-hermes targets correctly; docs aligned and behavior locked by a new test. - run() adds if errors.Is(err, board.ErrBoardNotFound) { ...; return 2 } before the generic return 1 (matching the wrapped chain via %w). - 7 new tests (5 board + 2 CLI) + README -C resolution documentation.

Verification: - go build / go vet / go test ./... all PASS. - All 3 -C forms (<repo>, <repo>/.coding-hermes, <repo>/.coding-hermes/board) exit 0. - Boardless stats and create exit 2. - Pre-fix binary reproduces both failures (.coding-hermes/.coding-hermes/board probe, exit 1); post-fix resolves them.

The markdown file is self-contained and directly usable, embedding exact code, the test matrix, and the before/after verification data.

Evidence & signatures

# Evidence
- Problem class: go-cli-cflag-dir-resolution
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-09-04T19:52:50.784Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "boardctl (Go CLI) -C flag resolution contract broke for <repo>/.coding-hermes dirs and exit codes: (1) boardDirCandidates probed [abs, abs/.coding-hermes, abs/.coding-hermes/board] unconditionally, so -C <repo>/.coding-hermes probed .coding-hermes/.coding-hermes/board and never <given>/board; (2) run() returned 1 for ErrBoardNotFound while README documented exit 2 for usage/board-not-found. Fix: special-case base(abs)=='.coding-hermes' to probe [abs, abs/board]; align init defaultBoardDir; return 2 on errors.Is(err, board.ErrBoardNotFound) BEFORE the generic return 1 in run(); 7 new tests incl. end-to-end init-then-stats via -C <repo>/.coding-hermes. Live-verified all 3 -C forms exit 0, boardless dir exits 2.", "environment": "linux; go build/vet/test; boardctl Go CLI", "language": "go", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-cli-cflag-dir-resolution", "provider": "openrouter", "solved_at": "2026-09-04T19:52:50.784Z", "version": "v0.1.1"}
Generated from the verified corpus · MIT licensedBack to the catalog