* fix: make release-version checks shell-free (#5533) Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell * fix(release): preserve checker status and explain gate failures (saa-cgh.16) Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell * docs: retain release-pinned CLI references (saa-cgh.16) Preserve corrected live preflight help while generated references continue to match docs/cli-docs.pin v1.2.2. Fix the exact two-line hosted docs-policy failure without changing pin authority. Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell * fix(versioncheck): carry base's release gates into the Go checker The base branch gained three release-metadata gates in scripts/check-versions.sh after this PR's merge point (release: prep v1.3.0,b3ef65c854): the Copilot plugin manifest, the four winres.json Windows PE version fields, and manifest.xml's assemblyIdentity version. This PR replaces that shell body with the Go authority, so adopting it as-written would have silently dropped all three — each one guards a file whose bump is a sed anchored on the old value, so a drifted copy no-ops and ships advertising the previous version. Port them into internal/versioncheck so the shell-free checker enforces the same set: - source gains an optional expected() so a surface can derive its required value; the Windows PE numeric fields must be purely numeric and so carry the prerelease-stripped form, and manifest.xml carries the four-part form. - readWinresVersionField reads the nested RT_VERSION resource path through the existing duplicate-key-checked JSON helpers. - readManifestAssemblyVersion anchors on line start, since the XML declaration also carries a version attribute. Also regenerate the Bazel BUILD files (make bazel-sync). cmd/bd/BUILD.bazel enumerates srcs explicitly, so the PR's new preflight_versions.go was missing from it and //cmd/bd:bd_lib failed to compile with `undefined: runBeadsVersionSyncCheck`; gazelle adds that src, the //internal/versioncheck dep edge, and BUILD files for the two new packages. Known follow-up for review: the PR's TestRepositoryReleaseVersionsMatch and TestPrePushHookOrdinaryPushWorksWithSystemBash read repository files directly, so they need `data` runfiles to pass under `bazel test` (advisory lane only). * fix(versioncheck): stop the release gate over-claiming docs coverage; distinguish --expect mismatch Maintainer review fixup for iteration 1 (both findings minor, non-gating; scorecard 915/850 approve with Required Changes: None). Contract & Interface Fidelity (claude + codex): the success line claimed "Version files and released-docs policy pass" while the checker reads no documentation surface, and it replaced the shell predecessor's explicit disclaimer that the docs release line and docs/cli-docs.pin are manual release steps. Restore the base wording ("Version files in sync at: <v>") plus the disclaimer, and update the three pins in main_test.go. This also repairs a consumer neither review lane censused: the tracked release runbook .beads/formulas/beads-release.formula.toml:475 instructs the operator that the gate "must print `✓ Version files in sync at: <version>` before you continue" — the renamed string had silently broken that acceptance check. Grepping the new spelling finds nothing; the breakage only shows up when grepping the old one. Error Handling & Resilience (codex): --expect mismatch reused exit 1, so .githooks/pre-push answered a tag/checkout mismatch with the version-drift remedy ("Fix with: scripts/update-versions.sh <version>") — advice that would rewrite every release surface to the wrong version. Give that case status 3 and add the matching hook branch pointing at CONTRIBUTING's actual rule. Only two --expect call sites exist: release.yml:45 (bare non-zero check, unaffected) and this hook. Verified at this head: check-versions.sh rc=0 (24 green rows, all three ported base gates); exit taxonomy 0/2/3 as documented; go test ./internal/versioncheck/ ./scripts/check-versions/ PASS=65 FAIL=0 SKIP=0; cmd/bd TestTrackedManagedHookSectionsMatchGenerator ok (hook edit sits above the generator-managed markers); gofmt/vet clean. Both fixes proven non-vacuous by mutating each back and requiring red. Declined as out of cleanup scope, recorded for follow-up: making TestRepositoryReleaseVersionsMatch fixture-based (redesigns the PR's own test architecture and interacts with the deliberate untracked-discovery pin at check_test.go:174; harm measured local-only) and declaring bazel data runfiles (gate impact none — no BAZEL key in either CI_GATE_REQUIRED map at this base; the remedy needs root filegroups that touch scripts/bazel_policy_test.go invariants). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(versioncheck): declare the release-gate tests' repo inputs as Bazel data Base commite1b2e79484(#6941) promoted the seven BAZEL* lanes into pr.yml's CI_GATE_REQUIRED after this branch's merge point, so the two packages this PR adds are now graded by a required check. Both reach real repository files through a hand-rolled filepath.Join("..", ".."), which resolves outside the runfiles tree, and `bazel test //...` failed on them: TestRepositoryReleaseVersionsMatch open ../../cmd/bd/version.go: no such file or directory TestPrePushHookOrdinaryPushWorksWithSystemBash runfiles .githooks/pre-push: No such file or directory Resolve the root through internal/testutil/bazeltest.RepoRoot, the base's helper for exactly this, which reduces to the previous behavior under plain `go test`; and declare the inputs as data through a //:release_metadata_files filegroup aggregating the surfaces versioncheck.releaseSources gates, the canonical version it compares them against, the uv.lock pin and the tracked hooks, exported from the packages that own them. The filegroup is hand-listed because releaseSources is itself a closed list: a newly gated surface must be added there too, and until it is the test fails under Bazel. The shell entrypoint's exit-status subtests build the checker from source at the repository root, which cannot work against a runfiles tree that has no go.mod, so they skip under Bazel and keep running under `go test`. The guard sits inside each subtest, not above the loop, so the ordinary-push assertion still reports as run rather than hiding behind a skip. Validation: `go test ./internal/versioncheck/ ./scripts/check-versions/` is unchanged at 65 pass / 0 skip, with all three entrypoint subtests still executing; both targets pass `bazel test --config=ci`; //scripts:scripts_test (the tag-taxonomy and Bazel policy tests) passes; `bazel build //...` is clean across 321 targets; `make bazel-sync` reports no drift and is idempotent. * test(versioncheck): stop declaring the bazelignored npm manifest as Bazel data The required `Bazel / test` lane failed on the refreshed head in fork-PR CI: TestRepositoryReleaseVersionsMatch npm package.json: open .../versioncheck_test.runfiles/_main/ npm-package/package.json: no such file or directory (expected 1.3.0) npm-package/ is in .bazelignore (#6798), so Bazel never links it into the execroot, and a local sandbox cannot stage npm-package/package.json even though //:release_metadata_files named it and analysis accepted the label. It resolved only under remote execution, where the client uploads the file from the workspace. That is how the previous fixup's `bazel test --config=ci` passed on a host whose bazelrc defaults to remote execution. Fork PRs get no remote-execution secrets, so CI runs the test in processwrapper-sandbox, where it fails. Drop the entry from the filegroup. Under Bazel only, let TestRepositoryReleaseVersionsMatch tolerate exactly that surface's absence: the file must be missing, and every other gated surface, the uv.lock pin and the hook markers must pass. The test logs the gap. This mirrors the base's skipReleaseFormulaUnderBazel for the bazelignored .beads/. `go test`, which sees the real checkout, still checks the npm manifest. Validation: forcing local execution the way fork CI runs (`bazel test --config=ci --nocache_test_results --remote_executor= --strategy=TestRunner=processwrapper-sandbox`) reproduced the failure before the change. After it, //internal/versioncheck:versioncheck_test, //scripts/check-versions:check-versions_test and //scripts:scripts_test pass (3 of 3 executed), and both release-gate targets also pass under remote execution. Drifting a declared surface still fails the sandboxed run. The tolerance was probed through TEST_SRCDIR and BEADS_TEST_REPO_ROOT: each of these still fails: - another drifted surface - a present but mismatched npm manifest - an unreadable canonical version - plain `go test` with the manifest missing `go test ./internal/versioncheck/ ./scripts/check-versions/`, golangci-lint and `make bazel-sync-check` are clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
29 lines
1.1 KiB
Bash
Executable file
29 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
# Compatibility entrypoint for the authoritative Go release-version checker.
|
|
# Run this before committing version bumps.
|
|
|
|
set -euo pipefail
|
|
|
|
if ! command -v go >/dev/null 2>&1; then
|
|
echo "Release version checker unavailable: install Go and add it to PATH." >&2
|
|
exit 127
|
|
fi
|
|
|
|
script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
|
|
repo_root="$(cd "$script_dir/.." && pwd)"
|
|
|
|
cd "$repo_root"
|
|
if ! checker_dir="$(mktemp -d "${TMPDIR:-/tmp}/beads-check-versions.XXXXXX")"; then
|
|
echo "Release version checker unavailable: cannot create a temporary directory." >&2
|
|
exit 127
|
|
fi
|
|
trap 'rm -rf -- "$checker_dir"' EXIT
|
|
# An explicit .exe name works on Unix and native Windows alike.
|
|
checker="$checker_dir/check-versions.exe"
|
|
if ! go build -tags=gms_pure_go -o "$checker" ./scripts/check-versions; then
|
|
echo "Release version checker unavailable: Go could not build it." >&2
|
|
exit 127
|
|
fi
|
|
# Running the binary preserves usage status 2, validation status 1 and --expect
|
|
# mismatch status 3; go run collapses them to 1 and adds its own diagnostic.
|
|
"$checker" "$@"
|