* test(protocol): pin §E3 exit 11 with a PTY harness (wy-vh5y8)
Exit 11 (ExitLocalExistsRefused) is returned only from the interactive
typed-confirmation abort in `bd init --reinit-local` (cmd/bd/init.go, behind
term.IsTerminal on stdin); the non-interactive branch of the same guard returns
12, so no piped-stdin subprocess could produce 11. WP4 (wy-ge2h8) therefore
left TestProtocol_ExitCode11_LocalExistsRefused skipped.
Un-skip it with a PTY-backed run: allocate a pty (creack/pty, a test-only dep
already in go.sum), drive `bd init --reinit-local` against a workspace seeded
with one issue, answer the "Type 'destroy N issues' to confirm:" prompt with
the WRONG text, and assert exit 11 — distinct from the 12 a bad --destroy-token
yields. Also asserts the abort is a no-op (the seeded issue survives). Windows
skips (no unix PTY).
creack/pty is imported only from _test.go, so it is a test-only dependency; no
new non-test dependency enters go.mod.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(build): register github.com/creack/pty with Bazel and Nix
The exit-11 PTY test imports github.com/creack/pty, a new direct
require in go.mod. The base's generated build manifests predate it:
- Bazel (`make bazel-sync`): //cmd/bd/protocol:protocol_test failed
"missing strict dependencies" on the import, and go_deps reported
com_github_creack_pty missing from use_repo. The sync adds it to
MODULE.bazel's use_repo and adds @com_github_creack_pty//:pty to
protocol_test's deps. protocol_race_off, protocol_docker_test and
protocol_dolt_test all wrap protocol_test, so that one deps line
covers them. Running the same sync on the base changes nothing.
- Nix: default.nix sets proxyVendor = true, so vendorHash covers the
module download set of go.mod's requires, and the new require
changes it. Regenerated via the nixos/nix container: the go-modules
fixed-output derivation now builds with no hash mismatch, and the
unwrapped package compiles cmd/bd.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(protocol): fix exit-code header, name a skipped reinit prompt
Review fixups, adopt-pr review loop iteration 1 (synthesis approve,
scorecard 981/1000, no blocker or major findings).
Taken:
- Header (Finding 2): it said all three refusal codes (10/11/12) refuse
before bd opens any store. That stopped being true once exit 11 ran:
its typed confirmation fires only after --reinit-local counts the
issues in a seeded workspace, so that test pays for a full store, as
130 does. The header now says 10 and 12 are store-free and 11 and 130
are not.
- Prompt-skip diagnostic (Finding 3): runInitReinitPreflight skips the
confirmation, with no warning, when countExistingIssues errors (it
has its own 5s timeout) or counts zero. The review expected that skip
to exit 0 in the early-exit arm. A mutation run with the seed issue
dropped shows it does not: the reinit goes on and blocks at init's
next TTY prompt, "Change role? [y/N]:", so the test fails at the
prompt deadline. The deadline arm now names the skip when the output
lacks the "Re-initializing will destroy" warning. Failure path only.
Declined:
- Shared prompt harness (Finding 1): extracting it rewrites the
base-owned 130 test (pipes, SIGINT, t.Parallel) into a new helper
after review. The synthesis allows accepting the duplication in the
reply to the reviewer instead.
- Redundant "!= 12" check (Finding 4): it mirrors the 12 test's own
"codes must stay distinct" check, so the tests keep one idiom.
Validation: gofmt and go vet are clean. TestProtocol_ExitCode10/11/12/130
pass against the dolthub/dolt-sql-server:2.2.0 test container with
BEADS_PROTOCOL_REQUIRE_DOLT=1, so exit 11 ran rather than skipped. The
seed-dropped mutant fails with the new message.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>