* revert: drop the journaled ownership handoff API from the release branch (#6281)
This reverts commit 74e25cba15, restoring the
release branch to the exact tree validated as v1.3.0-rc.2.
#6281 landed one commit past rc.2, so no release candidate ever exercised it.
Nothing imports `internal/ownershiphandoff` and no command registers it — the
package is unreachable from any `bd` entry point, so removing it cannot change
shipped behavior. It is superseded by a redesign that builds a fresh
`internal/ownershiphandoffv2` and deletes this package outright, and its
Hooks/Execute shape is the scaffolding of an architecture the owner rejected.
The commit never landed on main, so this is release-branch-only and nothing is
lost anywhere else. Reverting also returns
engdocs/design/ownership-handoff-contract.md to its prospective voice, which is
accurate again now that the implementation it described is gone.
* release: stamp 1.3.0 and date the changelog entry to the release day
`verify-version-consistency` in .github/workflows/release.yml compares the tag
name against the `Version = ` constant in cmd/bd/version.go and fails the job on
any mismatch, so a v1.3.0 tag against the 1.3.0-rc.2 stamp would abort the
pipeline before it built anything.
Bumped with ./scripts/update-versions.sh 1.3.0, which carries the stamp into all
seven version files, the two uv.lock entries, the ten githook managed-section
markers and the winres strings. The winres numeric file_version/product_version
and the manifest assemblyIdentity never carried the prerelease suffix and are
unchanged. ./scripts/check-versions.sh passes 24/24.
CHANGELOG.md's [1.3.0] heading carried 2026-08-28, the branch-cut date, which
predated both of its own release candidates. It and the matching
cmd/bd/info.go versionChanges entry now read 2026-09-15, the release date. The
section's reviewed content is untouched and [Unreleased] remains empty.
Dating the entry truthfully also forced its position. versionChanges is
reverse-chronological and getVersionsSince treats array index as recency, so
TestGetVersionsSinceOrder failed: the 1.3.0 entry still sat below its own rc.1
and rc.2, where the branch-cut date had made it look like the oldest of the
three. The entry moves to the head of the array, byte for byte unchanged. That
restores the strict date ordering and fixes the behavior it was hiding — an
rc.2 tester upgrading to the release now gets the [1.3.0] digest from
`bd upgrade review` instead of being told there is nothing new.
100 lines
4.1 KiB
Bash
Executable file
100 lines
4.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Pre-commit hook: auto-format with gofmt and lint with golangci-lint.
|
|
# Installed via: git config core.hooksPath .githooks
|
|
# See also: make install (sets hooksPath automatically)
|
|
|
|
set -euo pipefail
|
|
|
|
# Only check staged Go files (Added, Copied, Modified). No early exit here:
|
|
# the beads section at the bottom must run for non-Go commits too.
|
|
staged_go_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.go')
|
|
if [ -n "$staged_go_files" ]; then
|
|
# Build golangci-lint from source so it is never a stale global binary, and
|
|
# pin the version to the one CI uses (.github/workflows/{pr,main}.yml).
|
|
GOLANGCI_LINT="go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1"
|
|
|
|
# Build it with the repo's own Go, the way CI does. In CI, actions/setup-go
|
|
# installs the go.mod version and exports GOTOOLCHAIN=local. Locally
|
|
# GOTOOLCHAIN defaults to "auto", and for a pkg@version build that honours
|
|
# golangci-lint's own toolchain directive instead: it downgrades to
|
|
# go1.25.12, which then refuses this repo's newer go directive at config
|
|
# load ("the Go language version (go1.25) used to build golangci-lint is
|
|
# lower than the targeted Go version") and fails every Go commit. Pinning to
|
|
# the go directive reproduces CI's resolution on any host toolchain.
|
|
go_toolchain="go$(awk '$1 == "go" { print $2; exit }' go.mod)"
|
|
if [ "$go_toolchain" = "go" ]; then
|
|
echo >&2 "pre-commit: no go directive in go.mod; cannot pin the lint toolchain"
|
|
exit 1
|
|
fi
|
|
|
|
# Auto-format and re-stage
|
|
echo "$staged_go_files" | xargs gofmt -w
|
|
echo "$staged_go_files" | xargs git add
|
|
|
|
# Lint changed code with auto-fix; block on remaining issues.
|
|
# CGO_ENABLED=0 avoids typecheck failures from CGO-only dependencies
|
|
# (e.g., dolthub/go-icu-regex) that require system headers not always present.
|
|
CGO_ENABLED=0 GOTOOLCHAIN="$go_toolchain" $GOLANGCI_LINT run --new-from-rev=HEAD --fix || exit 1
|
|
|
|
# Re-stage any auto-fixes from the linter
|
|
echo "$staged_go_files" | xargs git add
|
|
fi
|
|
|
|
# --- BEGIN BEADS INTEGRATION v1.3.0 ---
|
|
# This section is managed by beads. Do not remove these markers.
|
|
if command -v bd >/dev/null 2>&1; then
|
|
export BD_GIT_HOOK=1
|
|
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
|
case "$_bd_timeout" in
|
|
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
|
*[1-9]*) _bd_timeout_invalid=0 ;;
|
|
*) _bd_timeout_invalid=1 ;;
|
|
esac
|
|
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
|
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
|
_bd_timeout=300
|
|
fi
|
|
_bd_timeout_backend=none
|
|
_bd_timeout_command=
|
|
for _bd_timeout_candidate in timeout gtimeout; do
|
|
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
|
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
|
case "$_bd_timeout_version" in
|
|
"timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
|
esac
|
|
fi
|
|
fi
|
|
done
|
|
if [ -n "$_bd_timeout_command" ]; then
|
|
_bd_timeout_backend=coreutils
|
|
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
|
|
_bd_exit=0
|
|
else
|
|
_bd_exit=$?
|
|
fi
|
|
elif command -v perl >/dev/null 2>&1; then
|
|
_bd_timeout_backend=perl
|
|
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
|
|
_bd_exit=0
|
|
else
|
|
_bd_exit=$?
|
|
fi
|
|
else
|
|
echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
|
if bd hooks run pre-commit "$@"; then
|
|
_bd_exit=0
|
|
else
|
|
_bd_exit=$?
|
|
fi
|
|
fi
|
|
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
|
echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
|
|
_bd_exit=0
|
|
fi
|
|
if [ "$_bd_exit" -eq 3 ]; then
|
|
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
|
|
_bd_exit=0
|
|
fi
|
|
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
|
fi
|
|
# --- END BEADS INTEGRATION v1.3.0 ---
|