Repository navigation
Conversation
Add scripts/bats-shard, which selects shard I of N of test/bats/*.bats deterministically (LPT balancing by @test count, derived from the files on disk each run, so a new test file joins a shard automatically). It fails closed (exit 2) on a malformed or out-of-range spec, a missing directory, no .bats files, or an empty shard. scripts/test-acq-bats honors ACQ_BATS_SHARD=I/N on the GNU parallel, xargs fallback and serial paths; explicit file arguments still pass straight through. acq_setup_stubs clears ACQ_BATS_SHARD so a CI leg's shard spec cannot leak into the runner contract tests. Tests: test/bats/02-bats-shard.bats (partition completeness, determinism, add/remove stability, weighting, fail-closed specs) and runner tests in 01-test-runner.bats. Co-authored-by: OpenCode Agent <user@gsa.gov>
basiliskus
requested changes
Oct 29, 2026
basiliskus
left a comment
Contributor
There was a problem hiding this comment.
Verdict: request changes — f7069c9202c9214c3f005b49c9a1b7340d3c6cc2
One compatibility-gate gap needs fixing before merge:
.github/workflows/bash32-compat.yml:133-143: addscripts/bats-shardto the relevance filter. Otherwise, a future PR changing only this Bash-3.2-sensitive script will skip the real Bash 3.2 suite while the required gate reports success.
Assisted-by: OpenCode [gpt-5.6-sol-latest-guardrails-defaultv2] skill:change-review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖: AI agent (First Mate), AI-assisted change (OpenCode). Human review required before merge.
Context
The bash 3.2 offline-suite job takes 8.5 to 16 min for identical code depending on runner speed, and a merge-queue run of PR 611 was cancelled at the old limit with no failing test. This PR adds the shard-selection plumbing so the job can be split across a matrix. It does not change any workflow; the workflow change (commit
203c7b8) could not be pushed with the available token (noworkflowscope) and follows separately.Plan / what changed
scripts/bats-shard I/N [DIR]: new. Deterministic LPT balancing by@testcount, recomputed from the.batsfiles on disk on every run (no checked-in table; new files join a shard automatically). Fails closed (exit 2) on a malformed or out-of-range spec, missing dir, no files, or an empty shard.scripts/test-acq-bats: honorsACQ_BATS_SHARD=I/Non the parallel, xargs-fallback and serial paths. Explicit file args pass straight through. Invalid spec exits 2 before any test runs.test/bats/helper.bash:acq_setup_stubsunsetsACQ_BATS_SHARDso a CI leg's spec cannot leak into runner tests (found in adversarial review).test/bats/02-bats-shard.bats(11 tests: partition complete, no dupes, deterministic, add/remove stable, weighting, spaces in paths, fail-closed specs) and 5 runner tests in01-test-runner.bats..pre-commit-config.yaml(trigger regex) andCONTRIBUTING.md(docs).Verification
scripts/bats-shardfor N=1..5 on the real suite: union equals all 60 files, no duplicates. N=3 gives 20/20/21 files and 359/358/358 tests.scripts/run-shellcheck) clean;fix-exec-bits --checkOK;npm run lint:mdclean.ACQ_BATS_JOBS=1 scripts/test-acq-bats test/bats/01-test-runner.bats test/bats/02-bats-shard.batsall pass, also withACQ_BATS_SHARD=1/3exported.103-kit-fetch-lifecycle, a fixed 3 s subprocess timeout) passes when rerun alone; it is load-sensitive, unrelated to sharding.Rollback
Revert this commit. Nothing consumes
ACQ_BATS_SHARDuntil the workflow change lands; unsharded behavior is unchanged.Security impact
None to auth, secrets or data handling. No workflow, dependency or network changes in this PR. New script only reads
*.batsundertest/batsand prints paths.Follow-up (tracked separately)
Workflow matrix change (
.github/workflows/bash32-compat.yml, 3 shards,fail-fast: false, samegatejob and required-check nameacq offline suite under bash 3.2) needs a push by someone withworkflowscope.