fix(build): harden build.sh (verify gate, derived deps, dev bench)#835
Merged
Conversation
- ./build.sh --verify now exits non-zero when the built binary fails the suite; previously CI saw green on a red verification run - build.sh runs under set -euo pipefail; missing embed markers abort instead of silently corrupting the artifact, and every build is gated behind bash -n - the embed list is derived from the entrypoint's source order (single source of truth) instead of a hand-maintained array; src/dev/ stays excluded and duplicate embeds are guarded by a visited list - drop eval when resolving $BASHUNIT_ROOT_DIR in sourced paths; anchor the source-line strip; unique temp file per build - set -u exposed dead code: the Windows checksum skip compared long-gone $_OS; check_os is now initialised and compares $_BASHUNIT_OS - the dev entrypoint never sourced src/benchmark.sh, so ./bashunit bench crashed with 'command not found' from a checkout while the built binary worked; source it and add an acceptance regression test Closes #834 Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
The new --verify gate exposed that verification had been silently crashing since 2025-06: six test files resolved repo resources through $BASHUNIT_ROOT_DIR, which points at the build output folder (no src/, no tools/) when the built binary runs the suite. - benchmark_test: drop the src source entirely; the entrypoint and the built binary both provide the module now - check_os_test / learn_test: resolve src/ relative to the test file - helpers_test / coverage_percent_test: use repo-cwd-relative paths, matching how the same helpers already source globals.sh - globals_test: observe caller_filename through a helper in the test file so the asserted frame no longer depends on the framework layout Verified green via BASHUNIT_BUILD_DIR runs on macOS bash 3.2 and ubuntu:24.04 (docker) — first fully passing verification since the gap opened. Closes #834 Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
--stop-on-failure and the report flags (--log-junit, --report-html, --report-tap, --report-json) were exported, so any nested bashunit run — bashunit's own acceptance tests under build.sh --verify, or a user's script under test that calls bashunit — inherited them. Nested runs aborted before rerun::persist wrote .bashunit/last-failed, overwrote the parent's report files, and blew the per-run awk fork budget: the exact three failures the new verify gate surfaced on ubuntu CI. These flags are this-process-only (parallel stop uses a flag file, sync stop uses exit codes, reports are written by the main shell after aggregation), so assign without export; export -n also strips the export attribute a `set -o allexport` .env load may have applied. Verified: official ./build.sh --verify green on macOS bash 3.2 and ubuntu:24.04 (docker, runner-like tooling), plus a leak-probe acceptance regression test that fails on the previous behaviour. Closes #834 Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
This was referenced Jul 19, 2026
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.
🤔 Background
Related #834
An audit of
build.shfound that--verifynever propagated a failing suite to CI, a missing embed marker could silently corrupt the artifact, and the hand-maintained deps list had drifted from the entrypoint — shippingbenchmark.shin the binary while./bashunit benchcrashed in dev mode.💡 Changes
bash -n; run underset -euo pipefailsourceorder (single source of truth), guard duplicate embeds, dropevalsrc/benchmark.shfrom the dev entrypoint and add an acceptance regression test forbashunit benchset -uexposed dead code: Windows checksum skip compared the long-gone$_OS; now uses initialised$_BASHUNIT_OShttps://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED