* test(credentials): make command fixtures Windows-portable (#5748)
Replace POSIX-only credential test commands with a shared shell-portable protocol, exercise their intended failure and non-invocation semantics on native Windows, and add the focused required CI selector.
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(ci): require each Windows credential fixture to pass
Include the standalone credentialcmd protocol test in the existing Windows
step. One package/test map drives both selection and exact terminal checks,
so missing, skipped, failed, or duplicate tests cannot report success.
Resolve native Go once and reuse it for the test invocation.
Bead: saa-cgh.66
Agent-Signature: unknown-model/unknown-reasoning
* test(ci): select the first Go application on PATH
Hosted Windows images can expose more than one Go application. Preserve
setup-go's PATH precedence, select one absolute application and reuse it.
Bead: saa-cgh.66
Agent-Signature: unknown-model/unknown-reasoning
* chore(bazel): sync BUILD.bazel srcs for the new credentialcmd test helper
Base landed the Bazel PR gates (#6881/#6887) after this PR was authored, so
the PR's new internal/testutil/credentialcmd package and internal/creds
testmain_test.go were never enumerated in any BUILD.bazel. Two already
enumerated test srcs (internal/creds/command_test.go and
internal/storage/dolt/gateway_credential_test.go) import the new package, so
`bazel build //internal/creds:all` fails GoCompilePkg without this.
Generated by `make bazel-sync` (gazelle); a second sync is a no-op. The
internal/storage/dolt version_staging_completeness_test.go srcs row is
pre-existing base drift that gazelle corrects in the same pass, not PR content.
* test(credentialcmd): pin the Windows gate's assertions and stop claiming foreign helpers
Maintainer review fixes for PR #5749, adoption iteration 1. The synthesis is
`approve` with no required changes; all four findings are minor or nit. A
maintainer bazel commit already exists on this branch, so the push was owed
regardless and none of these cost anything extra. No production code changes.
F1 — the new required Windows gate pinned its own wiring but almost none of its
assertions. The guard checked three package paths and one test name, so it
stayed green if someone dropped six of the nine test names from $expected,
deleted the `Action -in 'fail', 'skip'` throw, or deleted the exactly-one-PASS
loop -- leaving a required gate whose only real guarantee was "go test exited
0", which a fully skipped suite also satisfies. The pinned slice now carries all
nine test names plus both load-bearing guard tokens, keeping the file's existing
substring idiom.
F2 — the property the fixture exists for was unassertable end to end. Emit is
written to produce byte-exact stdout across sh and the Windows .cmd trampoline,
but parseCredential runs bytes.TrimSpace before every comparison, so every
existing assertion is blind to a trailing newline: a trampoline changed to
`echo %OUT%` would keep the whole suite green. TestCommandSourceRealShell now
wraps the existing credRunner package seam to capture the helper's stdout as the
shell produced it, and asserts it byte-exact. The real shell stays in the loop,
so this remains end-to-end rather than becoming a second in-process test.
F3 — Dispatch claimed any process where BEADS_TEST_CREDENTIAL_COMMAND_HELPER=1,
on the env alone and before inspecting argv, exiting 97 when the sentinel was
absent. command() arms that variable in the *parent* process and BEADS_-prefixed
variables reach every re-exec'd child through the integration allowlist, so the
first composition with a package that re-execs its own test binary -- which
internal/storage/dolt already does -- would have died with a wrong-subsystem
"missing protocol sentinel". Both gates are now required, and an env-armed
process without the sentinel falls through to its own TestMain.
The second half of that finding's prescription is deliberately NOT applied.
Adding BEADS_TEST_CREDENTIAL_COMMAND_HELPER to helperSubprocessSentinels reds
TestHelperSubprocessSentinelsAreComplete: that guard has a reverse-direction
control, and its regex looks for a literal os.Getenv("BEADS_..._HELPER") in
internal/storage/dolt's own test sources. This sentinel is read in
internal/testutil/credentialcmd, so the entry registers as a stale one. Measured,
not assumed -- the failure is "helperSubprocessSentinels lists
BEADS_TEST_CREDENTIAL_COMMAND_HELPER, but no test source reads it". With the
Dispatch gate fixed the entry also buys nothing: a dolt helper child already
carries its own sentinel, so isHelperSubprocess is true for it either way.
F4 — the exported constructors documented themselves as "returns a unique shell
command" while replacing PATH for the rest of the calling test, setting env vars
via t.Setenv (which bans t.Parallel), and silently rejecting an empty payload.
The shared contract is now stated once above the three of them, and Emit fails
fast with an explanation instead of letting the shell drop the empty payload
word and the helper exit 97. No caller passes an empty payload today.
Each fix was checked by reverting it and confirming its own pin reddens: the
dropped test name reds the guard by name; the trailing-newline wrong
implementation reds the new raw-stdout assertion while the sibling end-to-end
test stays green, which is the blindness the finding described; and reverting
the Dispatch gate reproduces `(97, true)`. `make bazel-sync` is a no-op -- every
edit landed in a file already enumerated in srcs.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>