Commit graph

2 commits

Author SHA1 Message Date
Julian Knutsen
dfbb28fad0 ci(bazel): run the scripts and source-walking tests remotely; retire their go test legs
//scripts:scripts_test and //scripts/check-versions:check-versions_test
drop their host-tools/no-remote-exec/no-remote-cache tags and run on the
rbe-west workers like every other target (the worker image ships bash, git,
python3, jq, yq, curl, openssl, unzip and coreutils; a missing tool fails the
test under Bazel rather than skipping it). Go comes in hermetically as the
registered SDK; check-versions.sh's `go build` is stood in for by the
Bazel-built checker.

The tests that walked the source checkout now get it as data:
tools/bazel/go_srcs.py keeps a managed `repo_files` filegroup in every
package and aggregates them into //:repo_files (exactly the tracked files
Bazel can see; make bazel-sync-check fails on a package without one).
scripts_test and docsync_test take it instead of hand-listed filegroups,
and every TEST_SRCDIR/IsBazel skip and go-test-only block in them is gone.
The release formula under .bazelignore'd .beads/ comes in through a
@beads_formulas local repository; npm-package/ and .claude/ are visible to
Bazel again (only their node_modules/worktrees stay ignored), so the npm
manifest release check and the AGENTS.md skill links run under Bazel too.
TestZZStdioNotLeaked falls back to TestMain's pre-run streams instead of
skipping in a shard without its baseline.

tools/bazel/equivalence_allowlist.txt shrinks from 20 skip entries to the
two cmd/bd tests of plain go test's own bd build fallback, which Bazel never
takes; pr-preflight-platforms now runs them on Linux, macOS and Windows. The
scripts-go-checks scripts-test and allowlisted legs, their scripts
(scripts-go-test.sh, allowlisted-go-tests.sh, run_allowlisted_go_tests.py)
and main.yml's --compile-only warm for them are removed. The vet leg stays
(ga-96smfk.18).

Refs: ga-96smfk.16

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 21:32:02 +00:00
ecuthiell
4183fa0509
test(scripts): resolve Git Bash explicitly on Windows (#5727) (#5730)
* test(scripts): resolve Git Bash explicitly on Windows

Add one test-only resolver that positively identifies Git Bash on Windows and use it in the doc-freshness and PR-preflight fixtures. Preserve ordinary PATH resolution on non-Windows hosts and leave the remaining #5727 callers for follow-up.

Part of #5727.

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>

* docs(testbash): state exact probe completion requirements

Document that capability scripts must be silent on both streams and reach
the sentinel epilogue without exiting the shell. Remove redundant startup
environment entries already stripped by the shared resolver.

Bead: saa-cgh.13
Agent-Signature: unknown-model/unknown-reasoning

* chore(bazel): sync BUILD files for scripts/internal/testbash

`make bazel-sync` output for the new `scripts/internal/testbash` package,
regenerated with `bazel run //:gazelle`:

- add the generated `scripts/internal/testbash/BUILD.bazel`
  (`go_library testbash` + `go_test testbash_test`)
- add `//scripts/internal/testbash` to `//scripts:scripts_test` deps

Without this, `bazel.yml` fails two ways:

1. `bazel test //... --config=integration` (bazel.yml:592) is a hard compile
   failure — `compilepkg: missing strict dependencies` for the
   `scripts/internal/testbash` import in both `check_doc_freshness_test.go`
   and `pr_preflight_test.go`. The default config builds clean because both
   files are `//go:build integration`, so only the integration lane sees it.
2. The `BUILD files in sync` step (bazel.yml:310) exits 1 on the
   `make bazel-sync` drift.

`make bazel-sync-check` (go_srcs globs only) and the repo's own
`TestBazel*` policy tests are both blind to this and pass either way.

* fix(testbash): pin the sanitization contract and split probe diagnostics

Maintainer review fixups for the adopt-pr review of PR #5730 (iteration 1,
synthesis approve / no blocker or major; all items were non-gating).

Finding 1 (minor, Test Evidence Quality) — the sanitization test's oracle was
the predicate under test. TestSanitizedEnvironmentRemovesBashAuthorityControls
validated the sanitized result by calling isBashAuthorityControl, the very
predicate sanitizedEnvironment filters with, so filter and oracle weakened in
lockstep and the assertion could not fail for any definition of the predicate.
It now asserts against the test's own controls literal and checks the
BASH_FUNC_ prefix class separately, pinning both the filter plumbing and the
key list. Proven with a three-arm control: fixed test + real predicate passes;
fixed test + a full `return false` neuter of isBashAuthorityControl now FAILS
(it previously passed); the original test + the same neuter still passes, so the
new failure is caused by this change and not by the mutation itself.

Finding 4 (nit, Debuggability) — a chatty-but-successful probe reported the
sentinel as unreached while its own quoted payload contained it. runProbe now
branches on strings.HasSuffix and emits a distinct "completed but wrote
unexpected output before the execution sentinel" message quoting only the stray
payload. The three existing assertions on "without the exact execution
sentinel" all cover cases whose output is empty (early exit, noexec), so none
of them can take the new branch; verified by execution.

Finding 3 (nit, Debuggability) — Probe's doc comment named only the three Bash
control classes while the implementation also strips GIT_EXEC_PATH. The comment
now documents Bash and Git authority controls explicitly.

Finding 2 (minor, Test Evidence Quality) is deliberately NOT taken here and
remains a non-gating follow-up. Its primary remedy — adding
./scripts/internal/testbash to the windows-latest leg — would execute four
//go:build windows tests that have never run on any lane, and the synthesis's
own Unresolved Uncertainty concerns MSYS2 PATH handling in exactly this
package's validateCandidate, which is not verifiable from Linux; a first-ever
execution that reds pr-preflight-platforms is not the "nearby, cheap, low-risk"
cleanup the operator contract allows. Its fallback arm only typechecks and
would edit repo-wide CI outside this PR's payload. Note that finding 1 reduces
finding 2's severity: the sanitization contract is now pinned on every Linux
lane instead of only incidentally on Windows.

Validation: go test ./scripts/internal/testbash ok; go test -run
'^TestDocFreshness|^TestPRPreflight' ./scripts ok, and ok again with
-tags=integration,gms_pure_go; gofmt clean; go vet clean; CGO_ENABLED=0
GOOS=windows go vet ./scripts/... and go build ./scripts/... both rc=0;
git diff --check clean. No files added or removed, so the generated
BUILD.bazel srcs are unchanged.

Contributor commits are untouched.

---------

Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
2026-09-30 15:50:28 -07:00