Commit graph

388 commits

Author SHA1 Message Date
Gas City Adopt-PR
567bd8483b ci(pr-risk): retire the embedded tier by committed flag; pr.yml gate fails closed
Review F1. PR Risk's coverage decision read the mutable RBE_WEST_WORKERS
variable in a different run from pr.yml's rbe job, so unsetting it and
re-running one workflow could leave both required checks green with
neither the legacy tier nor the Bazel lane having run the tier.

- Both workflows now commit BAZEL_RETIRES_LEGACY_EMBEDDED (policy-tested
  equal) and run the identical bazel-embedded-coverage job:
  covered = flag && pull_request && !fork && executor secret present.
  RBE_WEST_WORKERS is no longer read by PR Risk at all.
- pr.yml's ci-gate requires the job's result (BAZEL_EMBEDDED_COVERAGE)
  and BAZEL_EMBEDDED_RETIRED, which is red when covered but the Bazel
  embedded lane did not run remotely and pass (mode skip included).
- Revert is a commit of the flag to "false" in both workflows; in-flight
  PRs pick it up on their next push. The kill-switch runbook now flips
  the flag first.

Tests run both decision steps, bazel.yml's rbe step and pr.yml's real
gate step over every event/var/secret/fork/flag combination, with the
variable differing between the two runs, and require no double-green
without the tier.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 07:18:21 +00:00
Gas City Adopt-PR
e86f39bbdf ci(pr-risk): stand down legacy embedded tier where the gated Bazel lane runs it
D2 step 1. A new bazel-embedded-coverage job decides, from the same
expressions as bazel.yml's rbe job, whether pr.yml's Bazel call takes
execution mode remote on a same-repo pull_request (RBE_WEST_WORKERS on,
executor secret present, not a fork). Only then do test-embedded-storage,
test-embedded-conformance and test-embedded-cmd (27 jobs) skip, and PR
Risk's gate accepts those skips only then; a failed or missing decision is
red. Forks, Dependabot, secret-less runs, the farm switch unset and
merge_group keep the legacy tier. build-embedded keeps running: its
artifact feeds the proxied and server Dolt jobs.

The decision job reads no repository code and the secret only as an
emptiness test. scripts/pr_risk_bazel_coverage_test.go runs both actual
decision scripts over every event/var/secret/fork combination and requires
covered <=> (pull_request && Bazel mode remote), pins the shared env
expressions, checks pr.yml still requires BAZEL_EMBEDDED and shares PR
Risk's triggers, and simulates PR Risk's gate over every tier/decision.

Revert: unset RBE_WEST_WORKERS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 07:17:05 +00:00
Julian Knutsen
7a21446e6c
ci(bazel): require the integration lane on same-repo PRs (#7069)
pr.yml's bazel.yml call now passes integration: "on", and its ci-gate
requires BAZEL_INTEGRATION (bazel-integration's job.status output, a
missing result reading as skipped). The lane stays remote-only:
bazel-gate.sh allows it to skip in modes local (fork and Dependabot PRs,
until the farm has a read-only cache for them) and skip, never in remote.
bazel-farm.yml's advisory call runs it too.

The integration test step gets 45 minutes (job 55) for cold PR compiles;
the policy test keeps it at or above a 20-minute cold compile plus
.bazelrc's test:integration --test_timeout (the 1200s per-action cap).
The integration input (default "on") stays for callers that want the lane
off; pr.yml's call inputs are pinned, and the gate simulation now covers
the lane skipped, failed and cancelled in each mode.

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 23:56:33 -07:00
Vishnu J
8f195454ef
fix(winget): require PortableCommandAlias for GasTownHall.Beads (#5134)
* fix(winget): require PortableCommandAlias for GasTownHall.Beads

GasTownHall.Beads 1.1.0 on winget-pkgs only sets Commands: (search
metadata) and never creates WinGet\Links\bd.exe, so already-running
shells never see bd after install (GH#4908).

- Add canonical GasTownHall.Beads.installer.yaml with PortableCommandAlias
- update-winget.sh regenerates that package id for new releases
- Document both package ids and the Links requirement in winget/README
- Add check-winget-portable-alias.sh guard

Fixes #4908

* fix(winget): address maphew's PR #5134 review (grep bug, guard, CI wiring)

Maintainer commits requested by the PR author on the reviewer's behalf,
addressing maphew's 2026-07-29 review of PR #5134:

- scripts/update-winget.sh: `grep windows` matched both amd64 and arm64
  checksum lines, corrupting InstallerSha256 into an unparseable
  two-line value. Narrow to `grep windows_amd64` (mirrors the existing
  arm64 grep on the next block).
- scripts/update-winget.sh: quote the arm64 InstallerSha256 placeholder
  so 64 bare zero digits don't parse as a YAML integer, matching the
  quoting already used in the checked-in SteveYegge.beads.installer.yaml.
- scripts/check-winget-portable-alias.sh: replace the bare
  `grep -q PortableCommandAlias:` substring check with a yq-based parse,
  so a corrupted manifest (like the one above) fails the guard instead
  of reporting OK; also fail closed on an empty winget/ glob instead of
  silently exiting 0.
- .github/workflows/pr.yml, main.yml: run the guard in the existing
  check-build-tags job so it executes on every PR instead of only when
  someone remembers to invoke it by hand.

Locally verified: guard passes against the current checked-in
manifests, fails against a reproduction of the exact grep-bug
corruption, fails on an empty winget/ dir, and the generator produces
a yq-parseable manifest against a synthetic checksums.txt. shellcheck
clean; both workflow files parse as valid YAML.

* fix(winget): harden the PortableCommandAlias guard and its release docs

Maintainer review fixups for the adopt-pr review of PR #5134 (iteration 1,
synthesis approve / 0 blockers and 0 majors; all seven items were non-gating).
Scorecard 961/1000, Required Changes: None. Every edit site below is a line
this PR itself added.

Finding 1 (minor, Error Handling) — `yq -e ... >/dev/null 2>&1` collapsed three
distinct failures (yq absent at exit 127, unparseable manifest, alias genuinely
missing) into "missing valid PortableCommandAlias", defeating the script's own
stated rationale and pointing a debugger at manifests that are already correct.
The guard now names a missing yq up front and no longer discards stderr, so
yq's own diagnostic reaches the log of a required-gate job. yq is CI's first and
only yq consumer, running in a bare actions/checkout job, and sits outside the
host-tools inventory declared in scripts/BUILD.bazel; that is now stated where
the dependency lives.

Finding 4 (minor, Change Impact) — the glob is winget/*.installer.yaml but the
assertion was unconditional on installer type, so a future msi/exe/msix
manifest (no NestedInstallerFiles at all) would hard-fail a gate-feeding job
with no opt-out. Non-portable manifests are now classified out with a SKIP line.
The parse check deliberately precedes the class check: without that ordering an
unparseable manifest fails the NestedInstallerType test and is silently skipped
as "not portable", which is strictly worse than the behaviour being fixed.

Finding 2 (minor, Error Handling) — amd64 and arm64 had opposite failure
policies in one script: a missing amd64 checksum hard-fails, while a missing
arm64 checksum substituted 64 zeros and continued to success, disclosed only in
a source comment. The echoed "Next steps" block now ends in a loud
"DO NOT PUBLISH" warning naming the placeholder, emitted only when the fallback
actually fires.

  The finding's second arm — "teach the guard to reject an all-zero
  InstallerSha256" — is implemented as a WARNING rather than a failure, and
  that is a deliberate downgrade. winget/SteveYegge.beads.installer.yaml:15
  already carries exactly that placeholder for its arm64 entry; that file is
  base-owned and is not in this PR's six-file diff, so a fatal tripwire would
  turn a required check red over pre-existing content the PR never touched.
  The legacy heredoc in update-winget.sh emits no arm64 entry at all, so the
  placeholder is stale hand-authored state that the next generator run removes.
  Verified: the guard still exits 0 on the real tree and reports the warning.

Finding 3 (minor, Contract & Interface Fidelity) — a winget-pkgs version
directory needs a version + defaultLocale + installer set, but the repo carries
only GasTownHall.Beads.installer.yaml, so README step 2 as written produced a
set winget-pkgs validation rejects. Took the documentation arm: GasTownHall is
now steered to `wingetcreate update` (which supplies the other two manifests
from the published set) and the hand-copy path is marked as applying only to
the legacy id, which does have a complete three-file set. Generating two more
manifests would have changed the contribution's deliverable scope.

Finding 5 (nit, Architectural Consistency) — the first update-winget.sh run
overwrote the checked-in manifest with a three-line header, deleting this PR's
own GH#4908 rationale from the artifact whose purpose is to carry it. The
heredoc now emits the same header, plus a fresh ReleaseDate. Verified by
generating into a temp tree: the generated header is byte-identical to the
checked-in file's first ten lines.

Finding 6 (nit, Documentation Accuracy) — the README froze SteveYegge.beads at
the "0.30.x era" while the script rewrites all three of its manifests to the
new version. Note that the section already disclosed that both ids are
refreshed, so the residual gap was narrower than the finding stated: what was
missing is that the legacy id's version is bumped out of the era the table
advertises. That clause is now explicit.

Finding 7 (nit, Test Evidence Quality) — the guard's fail-closed behaviour was
pinned by nothing in-repo. Adds scripts/check_winget_portable_alias_test.go
with ten cases: alias present, alias missing, wrong alias, empty winget dir,
unparseable manifest (asserting it is neither skipped nor misreported and that
yq's stderr survives), missing yq, a skipped non-portable manifest, a violating
portable sibling of a skipped manifest, and the advisory placeholder warning.

  Deviates from the prescribed `requireHostTool(t, "yq")` on purpose.
  requireHostTool fails rather than skips under Bazel because
  //scripts:scripts_test is tagged host-tools, and that tag's declared
  inventory is "git, python3, awk, sed, find, grep and timeout" — yq is not in
  it, so the prescription would red the shared target on hosts that keep the
  promise the tag actually makes. A skip-only gate is used and the reason is
  recorded at the helper. Fixtures are synthetic so the target needs no new
  data dependency; the real manifests are covered by the check-build-tags job,
  which runs this script against the actual checkout.

Also fixed, found while editing and not raised by either lane: winget/README.md
told readers to run `grep windows` over checksums.txt, which is the exact
two-line ambiguity this PR fixed in the script (`grep windows` ->
`grep windows_amd64`). Before this PR the script and doc agreed; after it they
diverged, so the PR created the inconsistency. The doc now uses `grep windows_`
and says which line feeds which architecture.

Validation. `git diff --check` clean. The guard runs green on the real tree
(both manifests OK, rc=0) and on a freshly generated tree. go test ./scripts/
ok 21.7s (the package whose tests pin workflow content). Each new pin was
proven non-vacuous by reverting the corresponding fix and confirming the test
reds: dropping the class check reds the non-portable case; dropping the
placeholder tripwire reds the warning case; dropping the parse-before-classify
check reds the unparseable case; dropping the yq preflight reds the missing-yq
case; restoring `2>&1` reds the stderr assertion. All five arms red, and the
guard was restored byte-identical (md5 verified) after each. The arm64 warning
was exercised both ways against a stubbed curl: present arm64 checksum emits no
warning, absent one emits DO NOT PUBLISH.

New yq expressions stay inside the vocabulary shared by mikefarah yq v4 (what
ubuntu-latest ships) and python-yq/jq — identity, `==`, `[]`, `select` and
`-e`'s exit status — because only the pre-existing expression had been proven
green on mikefarah in CI, and this host has python-yq. Builtins the two flavours
spell differently (jq's `any(cond)` vs mikefarah's `any_c`) are avoided, and the
placeholder tripwire uses grep precisely because it looks for a known-bad
literal and so can only miss a bad value, never report OK on a manifest it
failed to parse.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
2026-09-30 20:24:59 -07:00
ecuthiell
61865bb0fe
test(init): make gateway credential fixtures portable across native shells (#5715) (#5725)
* test(init): make gateway credential fixture portable (#5715)

Replace shell-specific fixture commands with an opt-in test helper, exercise exact credential semantics under a restricted shell PATH without copied Windows PE fixtures, and require the focused suite in native Windows PR CI.

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* test(init): keep the original shell across native credential fixtures

Use a symlink to the original Unix shell so macOS AMFI does not reject a
copied system executable. Keep Windows cmd.exe and the test image in place,
internalize helper environment names and assert the typed helper exit code.

Run the six fixture cases through one Bash3.2-compatible driver in the
existing required three-host preflight matrix. Preserve the liveness check
name and optional macOS suite policy; reject missing or skipped execution.

Review: https://github.com/gastownhall/beads/pull/5725#pullrequestreview-5096996756
Bead: saa-cgh.47
Agent-Signature: unknown-model/unknown-reasoning

* test(ci): sync-check the native fixture list and stop forcing a second build graph

Maintainer review fixes for PR #5725, adoption iteration 1. The synthesis is
`approve` with no required changes; all findings are minor or nit. The rebase
lane had to repair this branch (`repaired_clean`, and the original head still
conflicts with main), so there is no accepted-as-is path and finalize owes a
push either way — these cost nothing extra.

Test evidence (minor): the `expected` array is, by its own comment, the single
list owning both test selection and required execution evidence -- but nothing
tied it back to the source file. A seventh TestApplyInitGatewayCredential*
fixture added later would fall out of the `-run` selector, lose native
macOS/Windows execution entirely, and still leave the driver exiting 0 with the
required gate green: precisely the "green because nothing ran" mode the per-name
PASS counting exists to prevent. The driver now compares the array against
`grep -Eo '^func TestApplyInitGatewayCredential[A-Za-z0-9_]*'` on
cmd/bd/init_gateway_test.go, by name and by count, before running anything, and
exits non-zero naming the offending fixture. That file is the whole population --
no same-prefix fixture lives in any other cmd/bd test file.

Release safety (minor): the driver sourced .buildflags and then forced
CGO_ENABLED=0, compiling a package graph disjoint from the ./cmd/bd build the
same job performs two steps earlier under the default. Re-measured under the
tags the steps use: `go list -deps -tags=gms_pure_go ./cmd/bd` is 1505 packages
with cgo and 742 without, and the differing cgo users include `net` and
`os/user`, whose build IDs propagate upward -- so nothing was reused and this
blocking, `cache: false` lane paid a second cold compile on macOS and Windows.
The export is dropped. Two consequences beyond the time: the step becomes
incremental, and the natively executed fixtures now exercise the same build of
cmd/bd that actually ships on those platforms rather than a nocgo one. The
comment now explains the build configuration, which is what the old one did not
do -- it explained why no database is needed, a separate question.

Debuggability (nit): the base comment above test-windows-liveness carried three
checkable mechanism clauses (the test is //go:build windows; the Ubuntu job
selects it by name but compiles it out; main.yml's Windows job runs only on
pushes to main). The replacement stated a conclusion a future maintainer cannot
verify, which is how a redundant-looking CI job gets deleted. The mechanisms are
restored and the new pr-preflight-platforms pointer is appended rather than
substituted.

The remaining nit asked for no change in this PR (the credential cache is keyed
by command string, which is harmless as shipped since neither the marker nor the
failure arm populates the cache) and none was made.

Validation: the driver runs green on Linux under the inherited default CGO --
6 of 6 fixtures PASS, exit 0 -- and the sync check was proved by appending an
unwired seventh fixture, which reds it with exit 1 naming that fixture, before
any test runs. `bash -n` clean, no shellcheck SC2086, and ./scripts/ stays green.

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:10:22 -07:00
ecuthiell
4e804885dd
test(credentials): make remaining credential-command fixtures native-Windows portable (#5748) (#5749)
* test(credentials): make command fixtures Windows-portable (#5748)

Replace POSIX-only credential test commands with a shared shell-portable protocol, exercise their intended failure and non-invocation semantics on native Windows, and add the focused required CI selector.

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* test(ci): require each Windows credential fixture to pass

Include the standalone credentialcmd protocol test in the existing Windows
step. One package/test map drives both selection and exact terminal checks,
so missing, skipped, failed, or duplicate tests cannot report success.
Resolve native Go once and reuse it for the test invocation.

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

* test(ci): select the first Go application on PATH

Hosted Windows images can expose more than one Go application. Preserve
setup-go's PATH precedence, select one absolute application and reuse it.

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

* chore(bazel): sync BUILD.bazel srcs for the new credentialcmd test helper

Base landed the Bazel PR gates (#6881/#6887) after this PR was authored, so
the PR's new internal/testutil/credentialcmd package and internal/creds
testmain_test.go were never enumerated in any BUILD.bazel. Two already
enumerated test srcs (internal/creds/command_test.go and
internal/storage/dolt/gateway_credential_test.go) import the new package, so
`bazel build //internal/creds:all` fails GoCompilePkg without this.

Generated by `make bazel-sync` (gazelle); a second sync is a no-op. The
internal/storage/dolt version_staging_completeness_test.go srcs row is
pre-existing base drift that gazelle corrects in the same pass, not PR content.

* test(credentialcmd): pin the Windows gate's assertions and stop claiming foreign helpers

Maintainer review fixes for PR #5749, adoption iteration 1. The synthesis is
`approve` with no required changes; all four findings are minor or nit. A
maintainer bazel commit already exists on this branch, so the push was owed
regardless and none of these cost anything extra. No production code changes.

F1 — the new required Windows gate pinned its own wiring but almost none of its
assertions. The guard checked three package paths and one test name, so it
stayed green if someone dropped six of the nine test names from $expected,
deleted the `Action -in 'fail', 'skip'` throw, or deleted the exactly-one-PASS
loop -- leaving a required gate whose only real guarantee was "go test exited
0", which a fully skipped suite also satisfies. The pinned slice now carries all
nine test names plus both load-bearing guard tokens, keeping the file's existing
substring idiom.

F2 — the property the fixture exists for was unassertable end to end. Emit is
written to produce byte-exact stdout across sh and the Windows .cmd trampoline,
but parseCredential runs bytes.TrimSpace before every comparison, so every
existing assertion is blind to a trailing newline: a trampoline changed to
`echo %OUT%` would keep the whole suite green. TestCommandSourceRealShell now
wraps the existing credRunner package seam to capture the helper's stdout as the
shell produced it, and asserts it byte-exact. The real shell stays in the loop,
so this remains end-to-end rather than becoming a second in-process test.

F3 — Dispatch claimed any process where BEADS_TEST_CREDENTIAL_COMMAND_HELPER=1,
on the env alone and before inspecting argv, exiting 97 when the sentinel was
absent. command() arms that variable in the *parent* process and BEADS_-prefixed
variables reach every re-exec'd child through the integration allowlist, so the
first composition with a package that re-execs its own test binary -- which
internal/storage/dolt already does -- would have died with a wrong-subsystem
"missing protocol sentinel". Both gates are now required, and an env-armed
process without the sentinel falls through to its own TestMain.

The second half of that finding's prescription is deliberately NOT applied.
Adding BEADS_TEST_CREDENTIAL_COMMAND_HELPER to helperSubprocessSentinels reds
TestHelperSubprocessSentinelsAreComplete: that guard has a reverse-direction
control, and its regex looks for a literal os.Getenv("BEADS_..._HELPER") in
internal/storage/dolt's own test sources. This sentinel is read in
internal/testutil/credentialcmd, so the entry registers as a stale one. Measured,
not assumed -- the failure is "helperSubprocessSentinels lists
BEADS_TEST_CREDENTIAL_COMMAND_HELPER, but no test source reads it". With the
Dispatch gate fixed the entry also buys nothing: a dolt helper child already
carries its own sentinel, so isHelperSubprocess is true for it either way.

F4 — the exported constructors documented themselves as "returns a unique shell
command" while replacing PATH for the rest of the calling test, setting env vars
via t.Setenv (which bans t.Parallel), and silently rejecting an empty payload.
The shared contract is now stated once above the three of them, and Emit fails
fast with an explanation instead of letting the shell drop the empty payload
word and the helper exit 97. No caller passes an empty payload today.

Each fix was checked by reverting it and confirming its own pin reddens: the
dropped test name reds the guard by name; the trailing-newline wrong
implementation reds the new raw-stdout assertion while the sibling end-to-end
test stays green, which is the blindness the finding described; and reverting
the Dispatch gate reproduces `(97, true)`. `make bazel-sync` is a no-op -- every
edit landed in a file already enumerated in srcs.

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 18:30:25 -07:00
Atirna
9ce991837d
ci: cross-compile release targets on PRs (#5684)
* ci: cross-compile release targets on PRs

Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Atirna

* ci(pr): pin the release-target cross-compilation gate and disclose its CGO boundary

Maintainer review fixup for #5684.

Disclose the coverage boundary on the new job. All eight legs build
CGO_ENABLED=0, but five of them stand for release binaries built at
CGO_ENABLED=1: bd-linux-amd64, bd-linux-arm64 and bd-windows-amd64 in
.goreleaser.yml, plus the darwin pair built natively by release.yml's
goreleaser-macos job. The cgo half of the tree (beads_cgo.go ->
internal/storage/embeddeddolt) is never compiled by this check, so a
break confined to it still passes green. Only android/arm64,
windows/arm64 and freebsd/amd64 replicate their release configuration
exactly. The comment also records that the ./... build scope is
deliberate extra coverage rather than an oversight, since every
.goreleaser.yml build id declares main: ./cmd/bd.

Pin the gate wiring. Nothing asserted the new job: deleting
CHECK_RELEASE_TARGET_CROSS_COMPILATION from CI_GATE_REQUIRED left
go test ./scripts/ fully green, against a repo convention of pinning
each load-bearing gate token by name.

Guard matrix/.goreleaser.yml drift in both directions, so a future
release target cannot go uncovered behind a green "release target
cross-compilation" check -- a failure mode worse than having no check,
because the check's existence implies the coverage it has lost.

Restore the Go module cache, matching the file's other multi-leg matrix
jobs. This is the largest matrix in the file and the only one building
the entire module.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-30 15:53:30 -07:00
Jim Wordelman
9d646fc887
fix(dolt): server-mode bd ready never wakes expired defers (re-proposes #6082) (#6424)
* test(dolt): red — defer auto-wake must run for classified-read-only server-mode opens (be-vbhpf)

TestServerModeDeferAutoWake exercises the same defer/wake contract as the
embedded and proxied-server variants, against a real dolt sql-server. Today
the sweep (DoltStore.wakeExpiredDefers) unconditionally skips whenever the
store is opened read-only — including when that read-only-ness comes purely
from command classification (bd ready/bd list are read-only for the CURRENT
project), which is indistinguishable, before the fix, from a strict
--readonly or foreign-project open that must never sweep.

RED: expired_dated_defer_wakes_on_ready and expired_dated_defer_wakes_on_list_ready
fail (issue never returns to open). dateless_defer_never_wakes and
future_dated_defer_stays_hidden pass today too, trivially (no sweep runs at
all pre-fix) — kept as regression guards for the GREEN step, which is where a
unit test proving classifiedRead=false still does NOT sweep belongs, since
that distinction doesn't exist yet at RED.

* feat: green — defer auto-wake runs for classified-read-only server-mode opens (refs be-vbhpf)

bd ready/bd list on a dolt-sql-server-backed store open with the store
classified read-only for command purposes; the lazy defer-wake sweep
silently early-returned before ever running, so expired defers never
woke unless something else opened the store writable first.

Threads a new ClassifiedRead flag through dolt.Config -> DoltStore,
set at the call site to exactly "read-only because of command
classification, not strict --readonly/preview/foreign-project"
(policy.readOnly && !readonlyMode && !previewMode in main.go).
wakeExpiredDefers's guard now delegates to a small extracted
predicate, deferWakeSweepEligible(readOnly, classifiedRead), so the
truth table can be unit-tested without a live store.

* chore: release gate PASS for be-6iglh-gate

* docs(release-gates): record the be-5fjqh rebase onto current main

origin/main advanced 6 commits past this branch's base and PR #6082 went
CONFLICTING; hourly pr-audit filed be-5fjqh. The branch is now rebased onto
0efe0adf5.

The only conflict was cmd/bd/main.go: this branch and e05000d64 (wy-sbgucn)
each append a field to the same dolt.Config literal at the same anchor line.
Resolved keep-both -- PoolReadTimeoutFallback and ClassifiedRead drive
disjoint code paths.

The addendum records the new base and SHAs, patch-id equivalence for the five
files that did not conflict, what was re-verified at the new base (build plus
the diff-owned tests, container-backed), and what was NOT re-run (the
full-suite and ci-pr-policy lanes still refer to the old base).

Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of Jim Wordelman

* docs(release-gates): record the be-qjern re-propose rebase and full re-gate

PR #6082 was closed and its branch deleted 2026-09-01 by an unknown actor
under the shared quad341 identity. Operator ruling 2026-09-08: accidental,
not a rejection — re-proposing. This addendum records a second self-rebase
onto current origin/main (zero conflicts this time), the full-suite and
ci-pr-policy re-gate the 09-01 addendum left outstanding (0 FAIL, policy
FAIL attributed to pre-existing be-mrl6j), and re-verification of both
diff-owned container-backed tests at the new HEAD.

refs be-qjern

* test(feat): red — add strict --readonly server-mode subtest to TestServerModeDeferAutoWake (refs be-acsyx)

* docs(release-gates): green — reword container-backed evidence claims, add nit-3 comment (refs be-acsyx)

bee-ghosttrack nit 2: TestDeferWakeSweepEligibleHonorsClassifiedRead is a
pure-function table test, not container-backed like TestServerModeDeferAutoWake
— reworded release-gates/be-6iglh-gate.md criteria 2(4) and 3 accordingly, and
attributed the preview/foreign-project claim to code structure at
cmd/bd/main.go:1485 rather than to that test. PR #6424 body reworded to match
(not part of this commit; edited via gh pr edit).

bee-ghosttrack nit 3 (optional): one-line comment on the unreachable
"classifiedRead without readOnly" table case explaining it documents totality,
not a reachable state.

Full suite: 0 FAIL. Targeted re-verification (TESTCONTAINERS_RYUK_DISABLED=true
to dodge host-load reaper flakiness): TestServerModeDeferAutoWake 5/5 subtests
PASS (12.427s), TestDeferWakeSweepEligibleHonorsClassifiedRead 4/4 subtests
PASS (5.957s).

* chore: remove leaked internal release-gate doc from PR branch

  release-gates/be-6iglh-gate.md

Tracked our internal gc-management/beads-rig release-gate checklist and
should never have been committed to this upstream branch -- it's process
residue from our deploy tooling, not part of the change itself.

Per maintainer bee-ghosttrack's request during review of PR #6571. The
root cause (our deploy tooling auto-committing this file) is already fixed
as of gm-qatxl1; this branch predates that fix, so this commit is cleanup
only -- no other content on this branch is touched.

Ref: be-lk7o3

* ci(proxied-shard): discover TestServerMode* entry points

Review finding (major, Test Evidence Quality): TestServerModeDeferAutoWake —
this PR's only end-to-end guard for the classified-read defer-wake fix — was
selected by no CI lane. The two lanes that set BEADS_TEST_PROXIED_SERVER=1
both shard through proxied-test-shard.sh, whose discovery grep matched only
`^func TestProxiedServer`, so the wiring lines at cmd/bd/main.go:1675 and
internal/storage/dolt/store.go:2136 had zero CI-executed coverage: the one
CI-reachable new test pins the pure predicate and cannot catch a mis-wired
flag.

Widen discovery to `^func Test(ProxiedServer|ServerMode)` in the shard script
and in scripts/ci/gen_proxied_shard_manifest.py so the two discovery patterns
stay in step, and widen the shard script's manifest-name validation to match.
That last part is load-bearing, not cosmetic: without it a regenerated
manifest containing a TestServerMode* row is rejected outright ("Invalid
shard manifest line") and the whole lane exits 1.

This also rescues the two pre-existing TestServerModeServe* suites, which
share the identical requireSharedProxiedServer gate and the same shared dolt
sql-server harness and were equally invisible — the unclosed class this PR
was following.

Verified: discovery goes 151 -> 154; a 15-shard BEADS_TEST_SHARD_LIST_ONLY=1
dry run assigns each of the 154 to exactly one shard with no pre-existing
test moved (the three land on shards 4/13/15 via hash fallback); the
pre-change script selects none of the three.

Also clarifies the reviewers' nit: the "foreign-project" exclusion named in
the new comments is not tested at the guard or in the policy expression —
those opens build their own dolt.Config and leave ClassifiedRead false, so
the guarantee is fail-closed by default.

Iteration-2 review (two minors, both non-gating): the fixup's own new prose
asserted two universals that measurement falsifies — the same class as the
nit above, reintroduced in the CI files this fixup added.

  * proxied-test-shard.sh claimed "Both families gate on
    requireSharedProxiedServer", contradicted two lines earlier by its own
    mention of the TestProxiedServerPathHelpers unit test. Transitive gate
    census over the 154 discovered entry points: 143 reach
    requireSharedProxiedServer, 10 reach the different helper
    requireProxiedServerEnv, and TestProxiedServerPathHelpers
    (cmd/bd/proxied_server_test.go, bare `package main`, three assert.Equal
    calls on path helpers) has no gate and no build tag, so it also runs in
    every ordinary `go test ./cmd/bd/` lane. Now scoped to the
    TestServerMode* family, which does gate uniformly (3/3), and the
    TestProxiedServer* side is described as mixed rather than generalized
    over.

  * main.yml claimed TestServerMode* discovery means "neither family can be
    silently left out of CI". Discovery is a non-recursive cmd/bd/*_test.go
    glob: 154 top-level matches versus 156 recursive, the difference being
    cmd/bd/doctor/database_test.go:60 and cmd/bd/doctor/dolt_test.go:126.
    Now scoped to the top-level entry points, and the comment names the
    residual hazard (a container-gated suite added under cmd/bd/<subpkg>/ is
    still never selected here) instead of implying it cannot happen.

Both edits are comment-only and behaviorally inert: non-comment lines are
byte-identical in both files, and the 15-shard BEADS_TEST_SHARD_LIST_ONLY=1
sweep is byte-identical before and after (154 assignments, 0 duplicates,
assigned set == discovered set, the three TestServerMode* still at 4/13/15).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* ci(bazel): add defer_wake_server_test.go to cmd/bd go_test srcs

Maintainer CI repair, generated by `make bazel-sync` (gazelle).

`cmd/bd/BUILD.bazel`'s `go_test` srcs is an explicit list, not a glob, so the
new `cmd/bd/defer_wake_server_test.go` was never compiled or run by the Bazel
lane. `Bazel / test` failed two required steps on the pushed head
`0a3f5e0047`:

  Go test equivalence:
    go test:  105 packages, 8988 top-level tests
    bazel:    107 go_test targets, 106 tested; 8987 top-level tests seen
    tests go test runs that Bazel did not (1):
      cmd/bd  TestServerModeDeferAutoWake
    EQUIVALENCE: FAIL

  BUILD files in sync (gazelle, go_srcs, MODULE.bazel): out of sync

`BAZEL_TEST` is listed in `CI_GATE_REQUIRED` for `CI Gate / Required`
(.github/workflows/pr.yml), so this is a required-lane red, not advisory.

That the missing test is this PR's own headline guard makes the repair squarely
in scope: the PR exists to close exactly this "no CI lane runs it" gap, and its
review fixup closed it for the proxied shard lane. The Bazel lane had the same
gap for a different reason.

Attribution: main's Bazel run at this PR's exact base 43a526b828 concluded
success, so the red is this branch's, not inherited.

Validation:
- `make bazel-sync` produces exactly this one line; a second run is a no-op
  (gazelle idempotent, md5 7d1d0549fcd466159451c02181661c78).
- Byte-identical to CI's own `bazel-sync-patch` artifact for this head
  (blob pair efec974..6dd76e3).
- srcs-only change: gazelle added no deps entry, so every import the new file
  needs was already declared.
- `bazel build //cmd/bd:bd_test` succeeds, and the generated
  `bd_test_/testmain.go` now enumerates TestServerModeDeferAutoWake, which is
  the row the equivalence check reported missing.
- `tools/bazel/go_srcs.py --check` was already clean, and `bazel mod tidy`
  produced no MODULE.bazel drift, so this single line is the whole repair.

No contributor commit is modified and no Go source changes.

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-30 15:53:22 -07:00
ecuthiell
713a7fb762
fix(make): preserve atomic Windows install replacement (#5638)
* fix(make): preserve atomic Windows replacement

Stage and rename bd.exe before enumerating legacy extensionless aliases. This avoids MSYS .exe fallback, preserves the working install when staging fails, and handles case variants and redirected install directories.

Extend the native Windows Make proof with failed-replacement preservation, uppercase-alias cleanup, and a real directory junction.

Fixes #5626

Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell

* fix(make): preserve directories during Windows alias cleanup

Exclude directories named bd or BD from extensionless alias removal and
document the existing MSYS find PATH dependency. Extend the native install
proof to preserve a nonempty BD directory and exact replacement contents.

Fixes #6196

* docs(make): clarify Windows alias traversal (saa-cgh.81)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* Clarify find predicate without assuming junction classification (saa-cgh.81)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
2026-09-30 15:46:44 -07:00
Julian Knutsen
a3b6dc9ac5
ci(bazel): remote-execution Bazel lanes for allowlisted fork authors (advisory) (#6994)
* ci(bazel): remote Bazel lanes for allowlisted fork authors (advisory)

Add bazel-farm.yml, a pull_request_target caller of bazel.yml. It gives the
RBE farm to fork PRs to main whose author and triggering user (sender: the
pusher on synchronize) are both on .github/bazel-farm-allowlist.txt, which
is read from the base commit. The list has julianknutsen, quad341, sjarmak
and csells, the same as gascity's blacksmith allowlist.

- authorize job: sparse checkout of github.sha that holds only the
  allowlist and .github/scripts/bazel-farm-authorize.sh; no token on disk,
  no secrets, event facts through env only. The script also checks fork vs
  base repo, the default branch, the action, and a 40-hex head SHA.
- farm job: calls bazel.yml with contents: read, exactly the four RBE
  secrets, checkout-sha pinned to the event's head SHA, and
  fork-farm: authorized.
- bazel.yml: new checkout-sha and fork-farm inputs (no-ops for pr.yml and
  nightly.yml). Every lane checks out inputs.checkout-sha with
  persist-credentials: false. The rbe job runs a fork remotely only for an
  authorized pull_request_target call, and then remote or skip, never
  local. PR concurrency also cancels on pull_request_target. The
  bazel-sync-patch upload is skipped on pull_request_target.

Advisory only: pr.yml is unchanged, so every fork PR still runs the local
Bazel lanes inside the enforced CI Gate / Required.

Policy tests pin the trigger and types, both jobs' conditions, the
allowlist source and contents, the pinned checkout, read-only permissions,
where secrets appear, no expressions in run scripts, per-PR concurrency,
the timeout, and that no workflow_run consumer can pick up a farm run.
TestBazelLaneIsGatedAlongsideLegacy now allows pull_request_target on a
bazel.yml caller for bazel-farm.yml only. 26 mutations were each caught
by these tests (sender check dropped, allowlist read from the PR head,
write permission added, event data interpolated into run, SHA pin dropped,
and others).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(ci): trusted-author fork PR farm design and threat model

Document bazel-farm.yml in the required-check topology:
- the design, and why it is advisory rather than part of the enforced
  gate;
- the gate options considered;
- the threat model: allowlist spoofing, sender vs. author, TOCTOU with the
  pinned SHA, workflow-file edits, script, label and comment injection,
  token scope, artifact poisoning, and farm and Actions cache poisoning;
- what can only be verified on GitHub.

The one capability a listed author gets beyond a same-repo PR is called
out as an accepted risk, with mitigations: pull_request_target runs use
the default branch's Actions cache scope.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): opt the farm's lane checkouts into fork-head checkout (F1)

actions/checkout@3d3c42e5 is v7.0.1, not v6, and v7 refuses to check out
a fork PR's head SHA on pull_request_target unless
allow-unsafe-pr-checkout is true. Every lane of an authorized farm run
therefore failed at checkout.

- Each bazel.yml lane checkout now sets allow-unsafe-pr-checkout to
  inputs.fork-farm == 'authorized' && github.event_name ==
  'pull_request_target'. That is false for every other caller and event.
- TestBazelWorkflowForkFarmInputs pins that exact expression. It also
  fails if the key appears anywhere else in the workflows (so never a
  literal true, and never on the authorize checkout).
- Relabel the checkout pin as # v7.0.1 in bazel.yml and bazel-farm.yml.
- Add the opt-in to the engdoc's design section and to the
  verify-on-GitHub list.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): verify everything restored from caches in Bazel lanes (F3)

A farm run executes PR code in the default branch's cache scope. GitHub's
own cache is read-only for pull_request_target: GitHub issues a read-only
token, and cache-mode defaults to read. Whether Blacksmith's colocated
cache enforces the same is unverified. So trusted runs no longer execute
anything they restore without verifying it first:

- setup-bazel: Bazelisk's home moves out of the runner cache to a fresh
  $RUNNER_TEMP/bazelisk-home, so the Bazel binary is never restored from
  a cache. BAZELISK_VERIFY_SHA256 is set to the release sha256 pinned for
  the .bazelversion version on each arch (9.2.0 amd64 and arm64). The
  wrapper step then re-checks every Bazel binary in that home.
- write-bazelrc.sh: add common --repo_contents_cache=. The repo contents
  cache holds extracted repos that Bazel never re-verifies. The
  content-addressable repository cache stays, since Bazel re-hashes it on
  every hit.
- Runner cache key bumped to bazel-repo-v3 (the content changed).
- bazel-test runs `go mod verify` right after the Go module cache restore.
- Policy tests:
  - cache-mode may only be read or none in bazel-farm.yml, bazel.yml and
    setup-bazel;
  - bazel.yml permissions are exactly contents: read;
  - the Bazel sha pin matches .bazelversion, and Bazelisk's home is
    outside the cache;
  - the binary is verified after download;
  - go mod verify follows every module cache restore;
  - the rc disables the repo contents cache.
- Engdoc and bazel-farm.yml header: corrected about GitHub's read-only
  cache, noted Blacksmith as unknown, and listed the full blast radius
  (release.yml hardening tracked separately). The canary design is in the
  rollout notes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): farm runs only the author's own fork, on opened/synchronize (F4)

"The sender is listed" did not prove that a listed user chose the head
commit:
- A listed author could open a PR whose head is a third party's fork, and
  that fork's owner could push between the author's review and "Create".
- A collaborator on a listed author's fork could push while the PR was
  closed or a draft (that push is skipped), and the author's later
  "Reopen" or "Ready for review" click would run it with secrets.

Changes:
- The authorize script requires the head repository owner's numeric id to
  equal the PR author's (HEAD_OWNER_ID, PR_AUTHOR_ID, passed via env).
- Drop the reopened and ready_for_review triggers, and the script now
  refuses those actions too. Drafts already run on opened and
  synchronize.
- Tests pin the trigger types and the new env, and add script cases:
  - cross-fork head, missing or non-numeric owner id;
  - reopened and ready_for_review refused;
  - unanchored action (xopenedx);
  - base-repo prefix (gastownhall/beads-evil). This covers two mutations
    the reviewer found surviving.
- Engdoc: the new checks, and the residual that stays the listed author's
  responsibility (commits pushed by fork collaborators).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): match the farm allowlist on numeric user ids (F5)

Logins are mutable: after a rename, anyone can register the old login,
and before this change they would then be listed as both author and
sender.

- The allowlist now holds one numeric user id per line, with the login as
  a comment. The ids were looked up with gh api users/<login> --jq .id.
- The authorize script matches PR_AUTHOR_ID and SENDER_ID
  (github.event.pull_request.user.id, github.event.sender.id). Logins are
  now used only in the log. An allowlist entry that is not a numeric id
  fails the job.
- Tests pin the id-to-login table and the SENDER_ID env. Script cases:
  - a renamed login re-registered with a new id (author and sender);
  - id prefix, suffix and leading zero;
  - an id that appears only in a comment;
  - listed ids with unlisted logins;
  - a PR from another listed user's fork;
  - broken allowlists (a login entry, a signed id).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(ci): farm re-run semantics and the add/remove-user procedure (F6)

A re-run replays the original event. It checks out the same pinned head
SHA, which is fine. It also reads the allowlist at the original base
commit, so a user removed from the list still gets the RBE secrets when
one of their old runs is re-run. Only users with write access can
re-run.

- Engdoc: how to add a user.
- Engdoc: how to remove a user. Merge the removal, then cancel and delete
  their farm runs (a gh api query by head-repository owner id). For
  cause, rotate RBE_TLS_CERT/KEY and have the farm revoke the old
  certificate; rotating also closes the re-run window.
- bazel-farm.yml header: points to the procedure.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): name the farm call "Bazel Farm", not "Bazel" (F7)

The farm's check runs were named "Bazel / <lane>", the same as pr.yml's.
Farm results are PR-controlled: PR code runs setup-bazel and can make a
lane exit 0. If a ruleset ever required a "Bazel / ..." check, a farm run
could satisfy it. The farm's checks are now "Bazel Farm / <lane>", and a
test pins the name and requires it to differ from pr.yml's bazel job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): run the farm authorize script in the C locale (F8)

Bash bracket ranges and ${v,,} depend on the locale. In en_US.UTF-8,
[0-9], [0-9a-f] and [A-Za-z] match some non-ASCII characters, and the
Kelvin sign lowercases to "k". This is not exploitable (GitHub ids,
logins and SHAs are ASCII, and the allowlist is maintainer-controlled),
but the script now exports LC_ALL=C.

The script tests now run under en_US.UTF-8 and add cases with non-ASCII
digits in ids and a non-ASCII character in the SHA. Without the export,
the SHA case fails, so the tests catch its removal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): farm authorize script runs on bash 3.2 (macOS)

${v,,} is bash >= 4; macOS runners' /bin/bash is 3.2, so the script's
tests failed there. Lowercase with tr under LC_ALL=C (ASCII only, as before).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 14:54:06 -07:00
ecuthiell
448c4b8621
test(prime): use native config root in global fixture (#5778)
* test(prime): use native config root in global fixture

The global PRIME override fixture staged Linux and macOS paths while the Windows child resolved os.UserConfigDir from inherited APPDATA. Build one isolated profile, ask the host for its native config directory, and stage the override only at that path. Production behavior is unchanged.

Related to #4638.

Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell

* test(prime): create advertised profiles and exercise Windows fixture

Create each isolated profile directory before exporting its path. Run the
global override through the shared test runner in the existing required
Windows job, rejecting absent, skipped or failed selected coverage.

Agent-Signature: unknown-model/unknown-reasoning

---------

Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 07:26:09 -07:00
Jim Wordelman
9c8be5e85f
ci: retry the module fetch in pr-policy-wrapper, not the build (#5901)
* ci: retry the module fetch in pr-policy-wrapper, not the build

PR Policy (wrapper timing) is a required check, and it is the one job in
pr.yml that can be failed by someone else's network. setup-go runs with
cache: false, so every run pulls the entire module graph from
proxy.golang.org, and nothing retries. A single proxy blip fails the check
outright.

Observed on a docs-only PR (one markdown file, +18/-0): the job died inside
a ~12s proxy.golang.org outage with

  stream error: stream ID NNN; INTERNAL_ERROR; received from peer

while 40 other jobs on the same commit, triggered at the same instant, built
the same module graph and passed. The split was by clock, not by content --
nothing about the change could have caused it.

Fetch the modules in their own retried step before the wrapper runs. With
the cache warm, the go build inside scripts/ci/pr-policy.sh compiles without
touching the network and stays unwrapped: a compile error still fails on the
first attempt rather than taking three, and an exhausted retry reports the
fetch as the cause instead of presenting a module outage as a build failure.

The loop mirrors the bounded apt-get steps in migration-test.yml and
release.yml: three attempts, a per-attempt timeout, a fixed backoff with none
after the last, and a step-level timeout-minutes above the resulting worst
case.

* ci: retry the module fetch in main.yml's pr-policy-wrapper too

pr.yml and main.yml carry byte-identical `pr-policy-wrapper` jobs. The
retry added in the previous commit covered only the pr.yml copy, so the
same unretried cold fetch stayed on the main-branch trigger — the job
this PR names is fixed in one workflow and not the other.

Mirrors the pr.yml step exactly: retries the fetch, never the build, and
fails load-bearing while naming the fetch so a module outage is not
reported as a build failure.

This is not a cache step, so the enumerated cache topology pinned by
TestGoCacheOwnershipTopology (scripts/ci_workflow_test.go) is untouched;
`go test ./scripts/` and actionlint are clean.

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 07:11:35 -07:00
Julian Knutsen
2d395d35af
ci(release): never restore Actions caches into release builds (#6966)
setup-go's default cache in release.yml is keyed predictably and falls back
to the default branch's Go module and build caches, which are restored
without re-verification before binaries are built, signed and attested.
Turn it off in every release job and pin that with a policy test.

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 04:39:23 -07:00
Julian Knutsen
e1b2e79484
ci: gate PRs on the Bazel lanes, alongside the legacy jobs (D1) (#6941)
* ci(bazel): gate the Bazel lane alongside the legacy jobs (D1)

pr.yml now calls bazel.yml (workflow_call) as its `bazel` job, and its
CI Gate / Required requires the call's aggregate (BAZEL) plus each gated
lane's result (BAZEL_TEST, BAZEL_PURE, BAZEL_EMBEDDED, BAZEL_DOLTSERVER).
No legacy job is removed: PR Core, build-artifacts, the pure-Go/js-wasm
check, domain+uow, contract corpus and pr-risk.yml's embedded tier stay
required (D2 is separate).

- bazel.yml drops its own pull_request/merge_group triggers, so a PR runs
  the lane once; push to main, workflow_dispatch and workflow_call stay.
- Every lane records job.status in an always() last step and exports it
  as a workflow_call output named after the job, next to the rbe job's
  rbe-mode / rbe-enabled.
- .github/scripts/bazel-gate.sh reads the call's rbe-mode/rbe-enabled and
  never re-derives the variable/fork/secret condition: mode skip allows
  every Bazel id to skip, local only the remote-only BAZEL_EMBEDDED,
  remote none; a missing or inconsistent mode fails the gate.
- bazel-integration runs in the PR call but stays advisory (its legacy
  counterparts in main.yml run only on push to main): no gate id, and the
  gate script excuses the aggregate failure only when that lane reported
  failure or cancelled in remote mode; the gated lanes are still checked
  on their own ids.
- Callers (pr.yml, nightly.yml) pass exactly the four RBE secrets that
  bazel.yml now declares, never `secrets: inherit`.
- Inside pr.yml's run the Bazel bd artifact is bazel-ci-build-artifacts,
  so it cannot collide with build-artifacts' ci-build-artifacts upload.
- bazel-autofix.yml now triggers on workflow "PR": the bazel-sync-patch
  artifact is uploaded inside the PR run, and "Bazel" runs are no longer
  PR events. Its security model is unchanged (base-branch checkout only,
  artifact read from the triggering run id, data-only patch).
- Policy tests (review D1 F3/F4/F7):
  - TestBazelLaneIsGatedAlongsideLegacy: every bazel.yml job is the rbe
    job, a gated lane (bazelLaneGateIDs) or an advisory lane with a
    reason; gate ids, env expressions and outputs are derived from that
    map; no re-derivation in the gate step or script.
  - TestBazelGateSimulation runs pr.yml's actual gate step over mode in
    {remote, local, skip} (pull_request and merge_group): the script's
    skips equal the ids whose job `if:` is false, and for each lane that
    should run, it alone skipped, failed or cancelled turns the gate red
    whatever the aggregate says; advisory, aggregate and invalid-mode
    cases too.
  - TestBazelArtifactNamesUniqueInCallerRuns: no artifact name collides
    within a pr.yml or nightly.yml run, following local workflow calls.
  - Autofix: workflow_run on "PR", which must upload bazel-sync-patch
    itself or through an unconditional local call.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): keep integration out of the PR call; pin the call's inputs (D1 review v2)

- N1: bazel.yml gains a string workflow_call input `integration`
  (default "on"); bazel-integration runs only when remote and
  `inputs.integration != 'off'`. A string, not a boolean: on push and
  dispatch the input is null, and null == false would silently stop the
  lane on main. pr.yml passes integration: "off" (main.yml's integration
  jobs, its legacy counterpart, run only on push to main). The gate no
  longer reads bazel-integration and bazel-gate.sh no longer excuses an
  aggregate failure: BAZEL is the call's result, red on a missing or
  inconsistent rbe mode.
- N3: pr.yml's call passes exactly build-artifact-name and
  integration: "off" (no rbe or other override).
- N4: bazel.yml's concurrency group never uses github.workflow (the
  caller's name in a call) and differs from each caller's group for every
  event, so the call cannot deadlock against pr.yml.
- N5: no caller of bazel.yml (pr.yml, nightly.yml) may have a
  pull_request_target or workflow_run trigger.
- Simulation: lanes' run modes are evaluated with pr.yml's call inputs;
  advisory lanes must not run in the PR call, gated lanes must run when
  remote.
- engdocs: runbook for main BUILD drift, a farm outage or the RBE cert
  expiry (~2027-09-27): fix main / renew, or unset RBE_WEST_WORKERS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(ci): record the enforced required-gates ruleset and PR Risk's renamed gate

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): gate the proxied-server and server-Dolt storage lanes

bazel-proxied and bazel-server-storage (remote-only, #6940) join the
gated lanes like bazel-embedded: pr.yml's ci-gate requires
BAZEL_PROXIED and BAZEL_SERVER_STORAGE, each read from the lane's
job.status output (always() recorder step, workflow_call output named
after the job). Both run in pr.yml's call (no integration switch).

bazel-gate.sh allows them to skip in mode local (forks, Dependabot:
pr-risk.yml's legacy tiers cover those PRs) and in mode skip, never in
mode remote. The gate simulation derives this from the jobs' ifs, so
each lane skipped, failed or cancelled in remote mode turns the gate
red. Jobs are renamed "proxied-server tier" / "server-Dolt storage tier"
(shown as "Bazel / ..." under pr.yml's call).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 03:33:20 -07:00
Julian Knutsen
d803ec9126
fix(dbproxy): retire the proxy when its Dolt backend exits cleanly (#6937)
* fix(dbproxy): retire the proxy when its Dolt backend exits cleanly

DoltServer supervised `dolt sql-server` with cmd.Wait inside an
errgroup, and Running read the errgroup context. errgroup cancels that
context only for a non-nil result, so a backend that shut down
gracefully (dolt exits 0 on SIGTERM) was reported as running forever.
The proxy's backend health watcher never fired: the proxy stayed up and
adoptable in front of a dead store. With --proxied-server-idle-timeout 0
(the setting Gas City uses) it never went away; `bd dolt status` said
"running" and every command, `bd ping` included, failed until
`bd dolt stop`.

The supervising goroutine now reports a clean exit as errBackendExited,
so Running flips on any backend exit and Stop treats it as benign. This
follows the existing proxied lifecycle contract (child death retires
the owned proxy; the next bd invocation starts a fresh proxy/backend
pair) rather than adding in-proxy restarts: spawn, adoption, stop
epochs and identity already live in the on-demand start path, and a
second restart loop inside the proxy would duplicate that and could
mask a crash-looping backend.

`bd dolt status` no longer headlines a proxy whose managed backend is
gone as "running"; it says the proxy is up but not serving and points
at `bd dolt stop` (for proxies from an older bd). The JSON payload is
unchanged. `bd ping` already verifies by running SELECT 1 through the
proxy, so after this fix a successful ping reflects a live pair.

Tests: DoltServer Running goes false after SIGTERM (clean exit) and
SIGKILL, and Stop succeeds; managed-local lane test that SIGTERMs the
backend with idle timeout 0 and requires the proxy to retire and
`bd ping --json` to succeed on a fresh pair; status render case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(dolt status): report running=false for a proxy over a dead managed backend

Review follow-up: the JSON running field now means "serving" (a live proxy
and, on a managed topology, a live dolt behind it), so scripts that key off
running alone are not fooled by a stranded proxy left by an older bd.
proxy_pid/proxy_port and backend_* are unchanged. Adds the PR link to the
CHANGELOG entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): resolve merge markers left by the origin/main merge

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.5 <noreply@anthropic.com>
2026-09-29 01:48:15 -07:00
Julian Knutsen
e7138e93af
ci(bazel): server-Dolt storage and proxied tiers on remote execution (#6940)
* test(integration): let SubprocessRunner reuse a prebuilt test binary

BEADS_TEST_SUBPROCESS_BINARY hands SubprocessRunner an already-built test
binary of the package instead of running `go test -c`, which no Bazel
action can do offline (it needs the module source tree and module cache).
A Bazel target passes the running go_test itself: the helper tests
(TestHelperSchemaInit, TestHelperMultiStore) live in the same package.
Unset, behavior is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(dolt): keep a lane's REQUIRE switch out of the leak-probe child

TestSuiteFixtureLeakFailsOwningSuite re-runs the suite with
BEADS_TEST_SKIP=dolt on purpose. When the parent runs under
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 (a fail-closed server lane), the child
inherited it and TestMain exited FATAL before the leak sweep the test
checks. Clear it in the child like the other suite-scoped variables.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(bazel): proxied-server and server-Dolt storage tiers (D6d, D6e)

PR Risk's "Test (Proxied Dolt Cmd N/15)" (also main.yml's) and "Test
(Server Dolt Conformance)" / "Test (Server Dolt Full Suite N/16)" as
Bazel variants against local dolt sql-servers (internal/testutil local
backend, pinned dolt from the test wrapper), fail-closed like the
dolt-server lane:

- //cmd/bd:bd_proxied_test: 15 shards; shard k runs the job's
  proxied-test-shard.sh k+1 15 through go_test_manifest_shard.sh over the
  race bd_test, non-race bd_for_tests as the subprocess bd,
  BEADS_TEST_PROXIED_SERVER=1, GOMAXPROCS=4. Tag dolt-server-proxied,
  --config=doltserver-proxied (the doltserver lane's build).
- //internal/storage/dolt:dolt_server_{conformance,full}_test over
  dolt_race_off (go_test_race_off of dolt_test: the jobs' binary is not
  race); the full suite runs server-storage-test-shard.sh k+1 16 with
  BEADS_TEST_ENV_RUN_DOLT=1 and hands SubprocessRunner its own binary.
  Tag dolt-server-integration, --config=doltserver-integration, whose
  build flags are exactly --config=integration's, so the tier shares that
  lane's compile (race-off deps land where bd_for_tests already is)
  instead of compiling the tagged graph a third time.
- dolt_test gains //internal/storage/schema:migrations as data (the
  PR4107/migration replay tests read ../schema/migrations).
- test_env.sh: BEADS_TEST_GIT_IDENTITY=1 writes the jobs' global git
  identity ("Configure Git"); the git-remote tests commit in fresh repos.
- Both tags join the taxonomy and bazelPRCoreExcludedTags, so prcore/ci
  and integration exclude them.

Per-shard names and statuses equal a replay of the jobs' commands
(container backend) for all 32 jobs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): run the proxied and server storage tiers remotely (advisory)

bazel-doltserver gains a second, remote-only step, `bazel test //...
--config=doltserver-proxied` (15 shards of ~5-10 min with a busy dolt
sql-server each do not fit a GitHub-hosted runner; forks and rbe=off keep
the local lane unchanged). bazel-integration gains `bazel test //...
--config=doltserver-integration`, which shares its build flags, so the
server storage tier compiles nothing the integration step has not. Both
steps write their own BEP, run check_testcases.py on it, run even when the
job's first test step failed, and upload logs on failure.

Policy (TestBazelDoltServerTiersMirrorPRRisk): each variant runs its jobs'
shard script with their shard total and has script + manifest in data;
the conformance variant passes the job's flags; the jobs' race/non-race
binaries and switches (BEADS_TEST_PROXIED_SERVER, BEADS_TEST_ENV_RUN_DOLT)
match; doltserver-integration's tags and race equal --config=integration's;
the steps are pinned to their jobs. checkDoltServerRules now holds all
three dolt-server lane tags to the local-backend, fail-closed,
remote-capable rules.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): run the proxied and server storage tiers in jobs of their own

Review of D6d/e: as steps of bazel-doltserver and bazel-integration the
tiers inherited those jobs' gating (a caller switching the integration
lane off would drop PR Risk's PR-time server tier; a gate requiring the
dolt-server lane would silently require the proxied tier too) and
lengthened their critical paths.

bazel-proxied (--config=doltserver-proxied, 15 shards) and
bazel-server-storage (--config=doltserver-integration: conformance + 16
shards) are remote-only jobs that need only rbe, each with its own BEP,
check_testcases.py step and log upload, 25-minute test step inside a
30-minute job. bazel-doltserver and bazel-integration are back to their
previous content, including the dolt-server step's 80-minute timeout for
local runs. The server tier shares bazel-integration's compiles through
the remote cache (same build flags).

The proxied tier mirrors PR Risk's race bd-cmd-test; main.yml's twin
job runs build-artifacts' non-race one, so Bazel is the stricter of the
two. Comments now say so, and the policy test pins main.yml's build so a
change there is noticed. Policy: the new jobs are pinned (command,
config, remote-only if, BEP + testcase steps, timeouts, log upload), and
no tier step may run in bazel-integration or bazel-doltserver.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 23:01:40 -07:00
Julian Knutsen
9116068c54
ci: give PR Risk's gate a distinct check name (#6939)
pr.yml and pr-risk.yml both reported a check run named "CI Gate / Required".
GitHub resolves required checks (and pr-preflight its rollup) latest-per-name,
so a red gate in one workflow could be masked by a later green one in the
other. Rename PR Risk's aggregate to "PR Risk Gate / Required" so both can be
required independently.

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 22:31:43 -07:00
Julian Knutsen
9cb22b790c
ci(bazel): decide RBE mode once (fixes Dependabot runs); add advisory integration lane (#6930)
* ci(bazel): decide the RBE execution mode once, in an rbe job

Dependabot PRs are same-repo (fork=false) but receive no Actions secrets,
so the per-job vars/fork conditions sent them down the remote path with
no executor: every lane ran locally on the 2-vCPU Blacksmith runner and
the remote-only embedded tier timed out (review D1 F1). The conditions
were also repeated in every job and re-read at different times (F5/F6).

A new first job, rbe, decides the mode from four booleans (the
RBE_WEST_WORKERS var, rbe input, fork, and whether RBE_WEST_EXECUTOR is
non-empty) and outputs mode=remote|local|skip plus enabled. Every lane
needs it and takes runs-on, if and the setup-bazel env from its outputs
alone; remote-only bazel-embedded skips unless remote, local-capable
lanes run on ubuntu-latest for forks, rbe=off and secret-less runs.
Same-repo runs still skip while the var is unset. The outputs are also
workflow_call outputs (rbe-enabled, rbe-mode) for a future gate.

Policy tests: every lane needs rbe and uses the pinned expressions; no
value outside the decision step mentions the var, inputs.rbe or fork;
the one extra secret reference is pinned to the emptiness test in the
decision step's env; and the step script is run for same-repo, push,
Dependabot, fork, rbe=off, var-unset and mixed-case scenarios.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): add the advisory bazel-integration job

Runs `bazel test //... --config=integration` (#6916, main.yml's
integration jobs) as its own job in bazel.yml: remote-only like
bazel-embedded (skipped unless the rbe job chose remote), 30-minute test
step inside a 40-minute job, BEP plus check_testcases.py, test logs on
failure. A separate job keeps ci's and integration's shared
bazel-testlogs apart (review-integration F3). No equivalence step:
equivalence.py's default mode is the --config=ci selection, and its job
mode needs the integration jobs' go test -json, which no run here has.

check_testcases.py gains --not-go LABEL for a tested non-Go target
(//tools/bazel:dolt_version_test, a plain sh_test the integration tag
filter keeps); an exemption for a target the BEP does not list fails.

Policy test pins the job's command (no extra filter, selector or remote
config), the count step, the log upload, its remote-only if, and that no
other job runs --config=integration (nor this one --config=ci or
equivalence.py); the .bazelrc tag filter stays pinned by
checkBazelrcIntegrationLane.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 19:05:41 -07:00
Julian Knutsen
90b84ea150
ci: auto-push Bazel BUILD sync fixes to PRs; harden docs autofix (#6907)
* ci(bazel): auto-push `make bazel-sync` fixes to PR branches

bazel.yml's BUILD sync step now writes the BUILD.bazel / MODULE.bazel /
MODULE.bazel.lock part of its drift as the bazel-sync-patch artifact
(scripts/ci/bazel-sync-patch.sh) and still fails. The new bazel-autofix.yml
workflow_run job (on "Bazel" and "PR") applies it with
scripts/bazel-autofix-push.sh: a sync commit on same-repo PR branches, an
idempotent apply-recipe comment on fork PRs.

Same security model as docs-autofix: the write-permission side never checks
out or runs PR code, extracts only the two expected regular files, and
refuses any patch naming a path outside an anchored allowlist (no hidden or
`..` segments, nothing under third_party/) or carrying a mode change,
symlink, rename or binary hunk; `git apply --index` and a post-apply check
back that up. Reuses the DOCS_AUTOFIX_TOKEN secret for the push.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(bazel): add bazel_autofix_push_test.go to scripts_test

`make bazel-sync` output, produced by scripts/ci/bazel-sync-patch.sh and
applied with scripts/bazel-autofix-push.sh as an end-to-end exercise of the
new autofix path.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): harden the bazel and docs autofix push scripts

Addresses the security review of the autofix pipeline, identically in
scripts/bazel-autofix-push.sh and scripts/docs-autofix-push.sh (the
security-critical functions are now shared verbatim):

- validate_patch refuses ANY "rename "/"copy " header (the legacy
  "rename old/new" form slipped past and, on docs-autofix, pushed a
  scripts.sh -> docs/cli-reference/x.md rename), checks every "index "
  line whatever its ids, takes creations/deletions/renames from
  `git apply --summary`, and reads names from `--numstat -z` (which
  names only the NEW path of a rename; the old comment was wrong).
- docs-autofix gains the post-apply staged re-check and a --check mode.
- The patch is applied to an index in a bare clone (read-tree +
  apply --cached + commit-tree): the PR tree never touches the disk.
  All git calls run with core.hooksPath=/dev/null, GIT_LFS_SKIP_SMUDGE=1.
- Push is leased: --force-with-lease=refs/heads/$HEAD_BRANCH:$HEAD_SHA.
- The PR must target this repo, and the head branch must be neither
  protected nor under a ruleset per the GitHub API (fail closed), on top
  of the name list.
- Only a marker comment written by github-actions[bot] is ever edited.
- bazel-autofix only pushes files in packages the PR changed
  (merge-base..head, computed from fetched refs), MODULE files only when
  go.mod/go.sum/MODULE changed; base-branch drift is left alone and
  listed, and a patch with nothing attributable gets a comment only.

Tests cover each reviewer attack for both scripts (--check and the full
flow against a local bare remote and fake gh), the staged check alone
with the validator disabled, spoofed comments, protection/ruleset/API
errors, the lease, main drift, and symlinked PR trees.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): trigger bazel-autofix on Bazel only; share job-level concurrency

- bazel-autofix.yml triggers only on "Bazel": pr.yml never calls
  bazel.yml, so "PR" runs never carry the artifact, and their completions
  cancelled real fixes through the workflow-level group. The policy test
  now requires the triggering workflow to run on pull_request and upload
  the consumed artifact instead of asserting the false claim.
- Both autofix workflows use one job-level concurrency group per head
  branch (autofix-<head repo>-<head branch>) without cancel-in-progress:
  skipped runs take no part, and the two bots queue instead of racing.
- Base checkouts use persist-credentials: false; docs-autofix extracts
  only cli-docs-freshness.patch, as a regular file, outside the workspace.
- Policy tests for the trigger, concurrency scope, checkout, and the
  scripts' shared guards (rename/index checks, comment author, lease,
  protection lookup, index-only apply, hook-free git).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): tighten autofix attribution, circuit breaker and PR selection

Re-review follow-ups for the bazel and docs autofix push scripts:

- Root package: paths outside any Bazel package (docs/, .github/,
  README.md, ...) no longer count as changing //:. Only root-level Go and
  build inputs (*.go, *.s, *.c, *.h, *.bzl, go.mod, go.sum, BUILD.bazel,
  MODULE.bazel*) make root BUILD.bazel drift the PR's, so main's root
  drift is not pushed onto a docs-only PR.
- Circuit breaker: the head subject is read from the fetched commit (no
  API), a failed read counts as non-convergent, and the check runs only
  once the PR's own staged fix is non-empty. A bot head whose remaining
  drift is main's now gets the "files this PR did not change" comment
  instead of a wrong "did not converge" one. Same in docs-autofix.
- PR selection: several open PRs can share one head branch. bazel picks
  the one whose number matches the artifact metadata (among PRs already
  matching head repo/branch/base repo; head sha still verified); without
  a unique match both scripts skip instead of taking .[0].
- The privileged clone fetches only the head (and, for bazel, base)
  branch into an init'ed bare partial repo instead of cloning every
  branch.
- docs-autofix job gets timeout-minutes: 10 (it shares a non-cancelling
  concurrency group with bazel-autofix).

Tests: docs-only/README/workflow/Makefile PRs with root drift get no push,
a root Go change gets root BUILD.bazel; breaker cases (bot head with own
vs main drift, unreadable subject) for both scripts; PR selection by
metadata and ambiguity; HEAD_SHA 40-hex guard; staged-check mode arm; a
--summary-only validator copy; both workflows' download steps run as
written against a fake gh (run-scoped artifact listing, only the named
files extracted, symlinked entries refused); timeout asserted for both
jobs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): bazel-autofix requires bash 4; skip its tests on macOS bash 3.2

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(ci): skip every autofix script test on bash < 4

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(bazel): sync internal/utils BUILD with main

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 17:23:27 -07:00
Bùi Phan Viết Cường
5cc896c8f0
fix(lint): suppress two darwin-only gosec findings and cross-lint the darwin build in CI (#6243)
* fix(lint): suppress two darwin-only gosec findings and cross-lint the darwin build in CI

scripts/ci/pr-lint.sh lints natively on the ubuntu runner plus one
GOOS=windows CGO_ENABLED=0 cross-lint, so files behind //go:build darwin
(and the !windows && !linux fallbacks) were never linted in CI. Linting the
darwin build reports two gosec findings that are clean on linux:

- internal/config/permissions_open_nonlinux.go: G304 on os.Open(path). The
  file comment already explains why it is safe (fixBeadsDirPermissions
  re-checks descriptor identity before chmod); it just had no directive.
- internal/utils/path_case_darwin.go: G103 on unsafe.Pointer. A directive
  existed but sat on the first line of a multi-line unix.Syscall call,
  while gosec reports the argument line four lines down, so it never
  covered the finding. It now sits on its own line above the statement,
  the placement cmd/bd/nocow_linux.go already uses.

Add a GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 cross-lint block to
pr-lint.sh mirroring the windows block (same flags, same lane scoping,
skipped when the native target already matches), and update the three
places that described the wrapper as two passes: engdocs/LINTING.md,
engdocs/CI_CLEANUP_PLAN.md and the comment in main.yml.

The darwin pass is compile-only on the Linux runner: no macOS runner, no
change to the pr-lint platform column. Like the windows pass it is
CGO_ENABLED=0, so darwin+cgo code stays outside its reach.

* docs(linting): bump the Last reviewed marker alongside the pr-lint change
2026-09-28 15:44:52 -07:00
Jim Wordelman
e0840ad2fa
fix: raise Differential Regression CI timeout budget (#6271)
* fix: green — Fix: differential-regression CI budget is under the suite's own passing wall time (5 spurious reds/day) (refs be-3r5pr)

* docs(release-gates): PASS 7/7 — be-kqg23 (differential-regression CI budget fix)

Deploy bead be-23wcp, source commit 3afba49b69.
All 7 criteria raw PASS, no waivers. 62 pre-existing make-test FAILs
attributed to tracked bead be-9ogs6 via 4-part proof. Criterion 3c
(CI-config-diff live-run): PR #6271's own "Differential Regression"
job ran green under the new 40m/45m budget. PR #6271 open against
gastownhall/beads (contributor-only rig — no merge-request routed).

* chore: remove leaked internal release-gate doc from PR branch

  release-gates/be-kqg23-gate.md

Tracked our internal gc-management/beads-rig release-gate checklist and
should never have been committed to this upstream branch -- it's process
residue from our deploy tooling, not part of the change itself.

Per maintainer bee-ghosttrack's request during review of PR #6571. The
root cause (our deploy tooling auto-committing this file) is already fixed
as of gm-qatxl1; this branch predates that fix, so this commit is cleanup
only -- no other content on this branch is touched.

Ref: be-lk7o3
2026-09-28 14:16:01 -07:00
Julian Knutsen
6daa06244b
build(bazel): integration-tag lane (--config=integration) matching main.yml (#6916)
* fix(test): keep TestDoltServer_StartStop_UnixSocket's socket path short

t.TempDir() nests the test's name, which alone pushes the socket path past
the 104-byte sun_path guard under any TMPDIR longer than /tmp: the Bazel test
wrapper's per-process TMPDIR (114 bytes) and macOS's /var/folders/... both
silently skipped the test that main.yml's integration job runs. Put the
socket in a short os.MkdirTemp directory instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(testutil): let SubprocessRunner build with a declared go command

SubprocessRunner.Build ran `go` from PATH. Under Bazel there is no Go
toolchain on PATH, so //internal/testutil/integration's
TestBuildErrorIsMaskedByChmod failed there. BEADS_TEST_GO_BINARY, resolved
like any other runfile, now names the go command; unset, it is still `go`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(bazel): integration-tag lane, --config=integration

main.yml's "Main Linux integration packages (N/6)" and "cmd/bd (N/8)" jobs
(and nightly's Full Test Suite) run every package with
-race -tags=integration,gms_pure_go, no -short and BEADS_TEST_SKIP=dolt.
Bazel never built the 55 `//go:build integration` files: gazelle drops a
file whose constraint names a tag it does not know.

- Root `gazelle:build_tags gms_pure_go,integration`: gazelle now lists the
  integration files in srcs and their imports in deps, and generates
  //internal/testutil/integration (integration files only). rules_go filters
  those files out of every other build, so --config=ci runs what it ran.
- --config=integration sets the tag for the whole build, like `go test
  -tags`, plus the jobs' race, BEADS_TEST_SKIP=dolt, -test.parallel=4 and a
  1200s/19m timeout pair (rbe-west's action limit; the jobs pass 30m). The
  same variants as PR core stay out (requires-docker, embedded, manual), so
  `bazel test //... --config=integration` runs the union of the 14 shards.
  A per-target gotags variant would not save the compile (gotags transitions
  the whole dep graph) and would need a second, duplicated target per package
  plus a tag to drop the plain one from this lane.
- //internal/testutil/integration:integration_test gets the pinned SDK's go
  for SubprocessRunner's `go test -c`.
- TestBazelIntegrationLaneMatchesMainWorkflow pins test:integration to
  main.yml's tags/race/BEADS_TEST_SKIP and gazelle's build_tags to a superset
  of the tags; bazel.yml's `make bazel-sync` diff already fails when a file
  gains the integration tag without a BUILD sync.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(bazel): sync scripts BUILD for upgrade_smoke_loop_test.go

make bazel-sync on current main adds the test file #6398 added.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): derive the integration lane's tag exclusions from PR core's

After main added the dolt-server tag, test:integration's filter still
selected those targets, and 5 of them fail under BEADS_TEST_SKIP=dolt. The
filter now excludes dolt-server, and the policy test no longer pins one
string: bazelPRCoreExcludedTags (kept equal to the taxonomy entries that say
"excluded from --config=prcore/ci") is the list both lanes check, the
integration lane minus the tags it runs. Every --test_tag_filters in the
lane or a config expanding it must exclude them, and no -test.short,
-test.skip, -test.run or --test_filter may reach it.

New tag integration-only for //internal/testutil/fixtures:fixtures_test and
//internal/testutil/integration:integration_test, whose tests are all
`//go:build integration`: --config=prcore/ci excludes them instead of
running two empty targets; --config=integration runs them. The .bazelrc
notes that ci and integration share bazel-testlogs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(bazel): note shared testlogs and dolt_test's subprocess build

bazel.yml's equivalence step reads bazel-testlogs, which --config=integration
shares with --config=ci, so a job running both lanes must check each right
after its own run. //internal/storage/dolt:dolt_test's SubprocessRunner tests
need a real `go test -c` with a module cache; they stay skipped under the
lane's BEADS_TEST_SKIP=dolt, so the target gets no go SDK data.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 14:11:34 -07:00
ecuthiell
4dc96f6f21
fix(config): identify native config environment in path errors (#6325)
* fix(config): name the native config environment source in errors

Identify APPDATA on Windows, HOME on Darwin/iOS, home on Plan9, and the
selected XDG_CONFIG_HOME or HOME source on other Unix hosts. Only error
labels change; the standard-library resolver and path precedence remain
the same, and the original wrapped error is retained.

Fixes #6314
Reported-by: bee-ghosttrack
Bead: saa-cgh.95
Agent-Signature: unknown-model/unknown-reasoning

* test(config): exercise native source diagnostics on the required platforms

Select the diagnostic parent and its two XDG states through one Bash3.2
driver in the existing three-host preflight matrix. Bind the declared OS
to Bash and the setup-selected Go host/target, retain child process status,
and reject missing, duplicate, unexpected, failed or skipped execution.

Preserve existing platform steps, job identity and required gate mapping.
Use the existing YAML workflow helpers to pin the new placement.

Follow-up: https://github.com/gastownhall/beads/issues/6314
Bead: saa-cgh.95
Agent-Signature: unknown-model/unknown-reasoning

* fix(config): keep native diagnostics with candidate builder (saa-cgh.95)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
2026-09-28 12:17:20 -07:00
ecuthiell
8c889c1f23
fix(make): use built candidate path in smoke targets (#6363)
* fix(make): quote build output paths (#5620)

Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell

* test(make): scope fake Go PATH to the native build proof

Restore the prior PATH in finally so later install scenarios do not inherit
the fake compiler. Check that the YAML-extracted here-string begins with its
shebang at byte zero; YAML's common block indentation is already removed.

Refs gastownhall/beads#5667
Agent: unknown-model/unknown-reasoning

* test(make): confine fake compiler environment to the build proof (saa-cgh.80)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(make): use built candidate path in smoke targets (saa-cgh.97)

Reported by bee-ghosttrack in gastownhall/beads#6340.

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(make): use shared build output for install (saa-cgh.97)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

---------

Co-authored-by: Bee <bee@ghosttrack.com>
2026-09-28 11:59:18 -07:00
Julian Knutsen
3d76cbd4e9
ci(bazel): dolt-server lane on remote execution (replaces the docker lane) (#6898)
* test(bazel): dolt-server lane for the storage domain + uow job

--config=doltserver runs pr.yml's "Test (storage domain + uow)" job as
remote-executable Bazel tests: each dolt-server target runs an existing
go_test binary with BEADS_TEST_DOLT_SERVER=local, so every Dolt server
is a `dolt sql-server` child of the test process, started from the
pinned dolt the test wrapper already ships. No docker, no
no-remote-exec, and BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 fails a target
whose server cannot start, so cached results are trustworthy.

- db_dolt_test, uow_dolt_test (8 shards), tracker_dolt_test,
  fix_dolt_test (4 shards, BEADS_FIX_REQUIRE_DOLT=1); GOMAXPROCS=4 like
  the job's runner.
- no -short twins of domain, domain/fs, domain/git and
  tracker/conformance, so the lane alone runs every package of the job.
- tag `dolt-server` in the taxonomy; test:prcore (and so test:ci)
  excludes it. The requires-docker variants stay as the A/B control.

Remote (default instance, --nocache_test_results): 9/9 PASS in 113 s
wall; longest shard 111 s (uow). Per-test statuses, subtests included,
equal the job's go test -json on the same tree: 0 differences.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): contract corpus on the dolt-server lane

protocol_dolt_test runs protocol_test as pr.yml's "Contract corpus" job
does (non-race via protocol_race_off, BEADS_PROTOCOL_REQUIRE_DOLT=1) with
the local dolt sql-server backend, in 8 shards, so the corpus golden,
determinism and conformance tests run on remote workers and cannot skip.

Remote: 8 shards, longest 53 s. 153 tests (151 PASS / 2 SKIP, subtests
included) equal the job's go test -json: 0 differences.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): run the dolt-server lane in place of the docker lane

bazel.yml's container-lane job becomes bazel-doltserver: `bazel test
//... --config=doltserver`, whose targets start their own dolt
sql-servers and so execute on the remote workers (locally for forks and
rbe=off) instead of against the runner's docker daemon. The docker lane
stays reachable as the A/B control: workflow_dispatch dolt-lane=docker
runs --config=docker in the same job, with the image pull that only it
needs. Still advisory; runner, rbe-west gate and secret handling are
unchanged. Policy test and TESTING.md follow.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): reap processes left in a test's private root on exit

A Bazel test timeout signals the test's process group, which misses the
detached bd db-proxy-child processes (Setsid) and the dolt sql-servers they
start. A proxy that died without its idle timeout left its server orphaned on
a persistent remote worker. test_env.sh's EXIT trap now kills every process of
the current user whose command line names the action's private mktemp root
(pkill -f, two passes; a /proc scan when pkill is absent) before removing it.
The root is unique per action and never in the wrapper's own argv; cleanup
still cannot change the test's exit status.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): fail closed on every dolt-server target, checked per rule

The no-short twins (domain, domain/fs, domain/git, tracker/conformance) now
pin BEADS_TEST_DOLT_SERVER=local and BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 like
the lane's other targets, so a Dolt-server test added to those packages fails
instead of skipping into a cached pass.

TestBazelDoltJobMirrorsContainerJobs checked the env with a file-wide
substring search, so a docker variant in the same BUILD file covered for a
dolt-server target that lost it. It now parses each rule tagged dolt-server
and requires both variables, BEADS_FIX_REQUIRE_DOLT on fix_dolt_test,
BEADS_PROTOCOL_REQUIRE_DOLT on protocol_dolt_test, and no no-remote-exec.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 05:17:36 -07:00
Julian Knutsen
6dbd9dbf65
ci(bazel): embedded-Dolt tier under Bazel, shard-for-shard with PR Risk (#6896)
* fix(test): find the module root only when the concurrency test builds its binary

TestConcurrencyMultiProcess looked up go.mod before checking
BEADS_TEST_EMBEDDED_TEST_BINARY, so a pre-built binary run outside a
checkout (Bazel's runfiles hold no go.mod) failed before using it. Only
the fallback go test -c build needs the module root.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): job-mode equivalence reports TestEmbedded tests Bazel ran extra

The extra-test check always ignored ^TestEmbedded names, the --config=ci
lane's implicit skip, so a job comparison of the embedded tier could not
see a Bazel variant running more TestEmbedded* tests than the CI job.
Apply the skip only outside --job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(bazel): embedded-Dolt tier variants and --config=embedded

PR Risk's embedded tier as embedded-tagged variants over the existing
race test binaries (no second compile):

- //cmd/bd:bd_embedded_test (20 shards) and
  //internal/storage/embeddeddolt:embeddeddolt_embedded_test (5 shards)
  run the jobs' own shard scripts through go_test_manifest_shard.sh, which
  maps Bazel shard k to the script's shard k+1 of n and stops the binary
  from sharding again. Each Bazel shard runs exactly the tests of the CI
  job with the same number (same discovery, committed manifest and hash
  fallback, binary flags). A plain -test.run ^TestEmbedded would not: nine
  TestEmbedded* functions outside *_embedded_test.go run in no CI job.
- embeddeddolt_conformance_core_test / _audit_test pass the conformance
  jobs' exact selectors and -test.timeout=30m.
- cmd shards use the race //cmd/bd:bd as BEADS_TEST_BD_BINARY, like the
  jobs' /tmp/bd-embedded-test.

test:embedded: race, tag filter embedded, build_tests_only, the jobs'
-test.parallel (4) and no -short/BEADS_TEST_SKIP; eternal is capped at
1200s, rbe-west's maximum action timeout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): run the embedded-Dolt tier in bazel.yml

New advisory job bazel-embedded (same runner, rbe-west gate and secret
handling as the other Bazel jobs) runs bazel test //... --config=embedded.
It is a job of its own so the tier's long race shards stay off
bazel-test's critical path and budget; it compiles nothing bazel-test does
not.

TestBazelEmbeddedJobMirrorsEmbeddedTier ties the config and variants to
pr-risk.yml: race builds, shard totals and scripts, BEADS_TEST_EMBEDDED_DOLT,
the race subprocess bd, the conformance selectors, and no -short.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(bazel): sync BUILD files after rebase onto main

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): Go timeouts below Bazel's 1200s cap for embedded variants

rbe-west caps actions at 1200s, so the eternal embedded variants are killed
there, and rules_go's wrapper ignores that SIGTERM: a hang ended as a bare
TIMEOUT without the goroutine dump the pr-risk.yml jobs rely on. The cmd
shards (job: -test.timeout=20m) and conformance core/audit (job: 30m) now
pass -test.timeout=19m, a documented deviation, so Go's timeout fires first.
Storage shards keep the job's 15m, which already does.

Correct the .bazelrc and BUILD comments that claimed the variants keep "the
jobs' own" timeouts, and state each target's effective limit. The policy
test now pins the 19m on the cmd shards and in place of the conformance
jobs' 30m (and flags a change of the jobs' value).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): fail bazel-embedded on targets or shards that ran no tests

The embedded variants inherit silent passes from PR Risk's shard scripts:
a shard the manifest assigns nothing exits 0 ("no tests assigned"), and a
manifest missing from the runfiles falls back to hash assignment, so every
shard still passes but no longer runs its job's tests.

- tools/bazel/check_testcases.py reads the run's BEP and fails if any tested
  target's test.xml, or any shard's, is missing or lists no top-level test
  (reusing equivalence.py's BEP and testlogs helpers). bazel-embedded writes
  a BEP and runs it after the tests; test logs now upload on any failure.
- The policy test requires each manifest-sharded variant's data to hold its
  shard script and the script's default manifest, and pins the new step.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): run bazel-embedded only with remote execution

Fork PRs and rbe=off dispatches ran the embedded-Dolt tier locally: 27 race
test processes (~7-10k test-seconds) plus the race compile of cmd/bd on one
GitHub-hosted runner, est. an hour or more per fork PR against the pool
whose job cap this track exists to relieve, while pr-risk.yml's embedded
jobs already run those tests for forks. bazel-embedded now runs only when
rbe-west is on (RBE_WEST_WORKERS, same repo, rbe != off); its job and step
timeouts shrink to the remote budget (60/50 min).

The policy test pins this job's if and keeps every other job on the shared
fork / rbe=off rule.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 04:41:10 -07:00
Julian Knutsen
671715bb8b
test(testutil): opt-in local dolt sql-server backend for Dolt-backed tests (#6891)
* test(testutil): local dolt sql-server backend behind the Dolt test server API

Add a second backend to internal/testutil behind the unchanged container
API (EnsureDoltContainerForTestMain, RequireDoltContainer,
StartIsolatedDoltContainer[Handle], NewContainerProvider,
RestartSharedDoltContainer, DoltContainerCrashed, IsolatedDoltContainer
Stop/Start/CurrentPort/Exec): the test process spawns `dolt sql-server`
from the pinned dolt CLI instead of a dolthub/dolt-sql-server container.

- BEADS_TEST_DOLT_SERVER=local|container selects it; unset keeps plain
  `go test` on the container (no behavior change) and makes `bazel test`
  use the local backend. Other values fail instead of guessing.
- The CLI (BEADS_TEST_DOLT_BINARY, else PATH) must be the image's version.
- Provisioned like testcontainers' dolt module: root@% (DOLT_ROOT_HOST=%),
  database beads_test, user test/test. Clean env, TZ=UTC, GOMAXPROCS=4,
  own dolt global config with metrics and the version check disabled.
- Loopback port picked here (dolt rejects -P 0), never 3307, retried when
  another process wins the port; readiness requires the server's own
  "Server ready" line plus a bounded ping, so a foreign listener on a
  contested port cannot pass for it.
- State lives under the TMPDIR captured at package init, outside every
  PinSuiteTempRoot root, so suite leak sweeps never see it. The server
  stays in the test's process group (bazel's group kill reaps it) with
  Pdeathsig on Linux.
- BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 now also makes every TestMain that
  only warned about an unavailable server exit 1
  (DoltUnavailableForTestMain), plus the shared proxied harness.
- dolt_benchmark_purge_test finds .dolt_dropped_databases relative to
  Exec's working directory (the data dir in both backends).
- TestDoltServerFingerprint checks each available backend against one
  checked-in fingerprint (users, grants, databases, server variables);
  local-backend tests cover the bind-race retry, 3307, crash detection,
  Stop/Start, Exec cwd, state outside the suite root, and teardown.
- Bazel: the requires-docker variants pin BEADS_TEST_DOLT_SERVER=container
  so the docker lane stays the container A/B control; the test wrapper's
  dolt global config disables metrics and the version check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(testutil): select the local Dolt test server only when asked for

Under Bazel an unset BEADS_TEST_DOLT_SERVER used to mean the local
backend, so every non-ci `bazel test` started servers for Dolt suites no
lane runs with one (//internal/storage/dolt:dolt_test went from a 16 s
skip to a timeout). Unset now means container everywhere: in a Bazel
action without docker that is the pre-existing warn+skip, and only a
target's env or --test_env=BEADS_TEST_DOLT_SERVER=local starts local
servers. Plain `go test` is unchanged.

The docker variants keep their container pin: a rule env beats
--test_env, so a local-backend invocation cannot flip the docker lane.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(testutil): harden the local Dolt test server's host footprint

- DOLT_DISABLE_EVENT_FLUSH=1 for every dolt the backend runs (and in the
  Bazel test wrapper): the metrics/versioncheck keys stop network calls
  but not the detached `dolt send-metrics` child each command forks on
  exit, which re-created the version probe's removed HOME (one leaked
  bdt-doltver-* per test process) and raced terminate's RemoveAll.
- Every bdt-dolt-*/bdt-doltver-* root records its owner PID, and the
  first use of the backend in a process removes this user's roots whose
  owner is dead (the SweepDeadSuiteRoots rule; a copy, since doltserver's
  tests import testutil). A panicking, timed-out or killed test binary,
  or a package whose TestMain never terminates the singleton, no longer
  leaks a 40-100 MB state dir per run.
- secure_file_priv is the state root's sfp/ directory, set through a
  per-launch --config file (dolt ignores other flags with --config): a
  local server runs as the test user on the host with a passwordless
  root@%, so LOAD_FILE / INTO OUTFILE must not reach the user's files.
  The fingerprint treats that path as the container's "".
- Fingerprint: character_set_server, collation_server,
  max_allowed_packet, transaction_isolation, lower_case_table_names,
  lower_case_file_system (compared on Linux only: APFS reports ON),
  wait_timeout, innodb_lock_wait_timeout.
- The local backend's own tests skip off Linux (no Pdeathsig, so a
  killed test binary would orphan servers on the macOS runners) unless
  BEADS_TEST_DOLT_SERVER=local asks for them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: compare the container and local Dolt test servers in the domain+uow job

TestDoltServerFingerprint's container half never ran in CI: only the
test-domain-uow job has both the pulled image and the pinned dolt CLI,
and it never ran ./internal/testutil. Run the fingerprint there (with
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 so the container half cannot skip)
so an image bump that drifts the container side fails in the PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 04:06:49 -07:00
Julian Knutsen
4e4ebdb443
feat(backup): proxied auto-backup on managed-local, serialized with bd backup sync (#6879)
* feat(backup): run opted-in auto-backup on a managed-local proxied server

#6584 routed the five `bd backup` verbs over the proxied provider on
managed-local, and #6694 made `bd backup status` admit the remaining gap:
the proxied arm of PersistentPostRunE never called runPostRunAutoBackup,
so backup.enabled=true was inert on every proxied workspace. Close it.

The proxied arm now calls the auto-backup hook before it closes the
provider, under the direct arm's maintenance gate (strict --readonly,
`bd serve`, a migration freeze) plus previews. maybeAutoBackup picks a
backend for the command: the direct store as before, or the proxied
provider's RunNonTx seam, which `bd backup sync` already uses.

The proxied backend is honored exactly where `bd backup sync` is: the
"backup sync" capability row's rule for this workspace's topology, so
managed-local only. Auto-backup registers a server-side backup remote,
which on a server bd does not own is global to every client; an implicit
trigger must not get further than the explicit verb. It never opens a
provider of its own: a command that opened none (`bd dolt stop`) or
closed it (restore) backs nothing up rather than relaunching the server.
The default stays OFF, as on every server-mode workspace.

The register/sync-to-a-local-dir sequence that DoltStore and
EmbeddedDoltStore each carried a copy of moves to
versioncontrolops.BackupToDir (and HEAD lookup to CurrentCommit), so the
proxied backend reuses it instead of adding a third copy.

Tests: TestManagedLocalProxiedAutoBackup (default off, opt-in writes a
restorable backup, change detection, `bd dolt stop` stays quiescent,
restore round trip with issue-set equality; fails against origin/main);
TestManagedLocalProxiedBackupRestoreRefusedWhileAttached pins the restore
design (refused while another bd client holds the workspace, serving
child untouched, succeeds once it detaches); unit tests for the backend
locality gate, the post-run wiring, the status note and BackupToDir.
Both managed-local tests, and the existing round trip, are added to the
proxied-local smoke lane's compiled-in list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(backup): serialize auto-backup and bd backup sync with a workspace backup lock

Review follow-up on #6879. Auto-backup and an explicit bd backup sync
both run under the command's SHARED workspace gate, so nothing stopped
them overlapping, and auto-backup's remove -> add -> sync on one fixed
remote name races a concurrent copy of itself.

A per-workspace flock (.beads/backup.lock, already gitignored by
*.lock) now serializes them in every mode. Auto-backup takes it
non-blocking and skips when held (the throttle is left alone, so a
later command retries). bd backup sync waits up to exclusiveGateWait -
the bound restore's exclusive gate acquisition uses - then fails with
"another backup is running for this workspace" before touching the
store. Restore needs no part in it: its exclusive workspace gate
already excludes every command that could hold the lock.

Tests: lock semantics (refusal while held, bounded wait, release),
auto-backup skipping while held and running once released, and sync
failing loudly without reaching the store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 02:45:58 -07:00
Julian Knutsen
fc4d7d3958
ci(bazel): PR-gate parity lanes (docker, pure-Go, js/wasm) + bd artifact (#6887)
* test(bazel): require exclude read-permission coverage in test:prcore

pr.yml's PR Core step sets BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1 so
TestAddExcludePatternsRefusesReadErrors fails, rather than skips, on a root
or non-POSIX executor. test:prcore now sets it too, and a policy test keeps
the two in step.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(bazel): compare Bazel runs with one CI job's go test results

equivalence.py --job takes a job's `go test -json` as the complete expected
set, so a Bazel selection can be shown to replace that job: every top-level
test the job ran must run under Bazel, no other test in those packages may,
and nothing the job passed may be skipped. --bep is repeatable (a job can map
to --config=ci plus --config=docker), and go_test_variant.sh sh_tests count,
since their go_test binary writes the same test.xml. In job mode a test seen
in several targets keeps its best status: the prcore run skips what the
docker variant exists to run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): docker-lane variant for internal/tracker

pr.yml's "Test (storage domain + uow)" job runs ./internal/tracker/... with
-race and without -short or BEADS_TEST_SKIP=dolt, so tracker's TestMain
starts the shared dolt container and all 112 top-level tests run. Under
--config=prcore they skip. tracker_docker_test reruns tracker_test that way
in the docker lane, and tracker's TestMain now fails instead of skipping when
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 and the container does not start.

The job's other packages (storage/domain, domain/fs, domain/git,
tracker/conformance) consult neither testing.Short nor the dolt skip, and
pass identically under --config=ci.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): publish the Bazel-built bd as a ci-build-artifacts artifact

pr.yml's build-artifacts job uploads ci-build-artifacts (bd-linux-gms-pure,
SHA256SUMS, build-manifest.txt), which PR Core, the domain+uow job and both
package gates download and check with `sha256sum -c`. The Bazel lane now
uploads the same name and layout from //cmd/bd:bd_for_tests, the non-race
gms_pure_go cgo bd its own tests exec (//cmd/bd:bd is race-built under
--config=ci); test:ci downloads it under --remote_download_minimal. No
consumer is repointed yet.

A rules_go binary has no vcs.* or CGO_ENABLED build settings: `bd version`
shows no commit, and scripts/verify-cgo.sh would pass it vacuously. No
consumer of this artifact reads either; the manifest records the commit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): pure-Go and js/wasm lane for pr.yml's boundary job

pr.yml's "Check pure-Go and js/wasm boundaries (CGO_ENABLED=0)" job builds
bd and three test binaries with CGO off, runs a 16-name -short cmd/bd subset,
and runs the js/wasm hook refusal test under node with an exact count guard.
bazel.yml's new bazel-pure job does the same with Bazel binaries:

- --config=pure (--@rules_go//go/config:pure, -test.short) builds //cmd/bd:bd,
  bd_test, embeddeddolt_test and tracker_test, and runs bd_test unsharded
  with the job's -run selector (policy-tested to stay equal to pr.yml's).
- --config=js-wasm builds //internal/hooks:hooks_test for js/wasm
  (--use_target_platform_for_tests satisfies the test toolchain; nothing is
  tested by Bazel under it); the Go SDK's go_js_wasm_exec runs it under node
  with pr.yml's selector and count guard, verbatim.

rules_go compiles every declared dep, and gazelle's deps ignore the cgo
constraint of beads' embedded-Dolt files, so a pure build compiled dolt's
store/nbs and failed in github.com/dolthub/gozstd (cgo only; go build never
imports it with CGO_ENABLED=0). third_party/patches/gozstd_nocgo.patch adds
panicking !cgo stubs for the API dolt uses.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): run prcore tests with -test.parallel=4 like pr-core.sh

pr-core.sh runs go test -parallel 4. test:prcore passed no -test.parallel,
so Go defaulted to GOMAXPROCS: the executor's core count (192 on a farm
worker) instead of a runner's 4, which let dozens of t.Parallel bd
subprocesses run at once. A policy test keeps the value equal to
pr-core.sh's GO_TEST_PARALLEL default.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): -test.parallel=4 in the pure lane

pr.yml's pure-Go job passes no -parallel, so go test uses GOMAXPROCS, 4 on
ubuntu-latest; under Bazel the default would be the executor's core count.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): run the contract corpus non-race in the docker lane

pr.yml's Contract corpus job runs go test ./cmd/bd/protocol without -race,
but --config=docker races every target. protocol_docker_test now runs
:protocol_race_off, protocol_test built through a race=false transition
(tools/bazel/race.bzl), so no second go_test rule has to track gazelle's
srcs. Tagged manual so other lanes do not build it; the extra non-race work
is protocol_test's link plus ~100 test-only libraries.

The docker lane also mirrors the jobs' concurrency now: they pass no -p or
-parallel, so go test uses GOMAXPROCS, 4 on ubuntu-latest, for both; the
lane runs at most 4 test processes (so at most 4 dolt containers start at
once) with -test.parallel=4. It writes -test.v test.xml like test:ci, for
equivalence.py.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): run the docker lane in bazel.yml

New advisory job bazel-docker runs `bazel test //... --config=docker` on
ubuntu-latest after pre-pulling the dolt image like pr.yml's container jobs.
The requires-docker variants (domain/db, uow, tracker, doctor/fix,
protocol) run on the runner against its docker daemon (no-remote-exec);
their builds use remote execution when setup-bazel configured it. With
bazel-test's --config=ci this covers "Test (storage domain + uow)" and
"Contract corpus". The lane name is one env var, so a hermetic dolt-server
lane can replace it.

Policy tests now cover every bazel.yml job: an exact job list, timeouts, no
continue-on-error, pinned actions (setup-node added), one setup-bazel step
per job as the only secret reader, cache saves only in bazel-test, plus
job-specific mirrors of pr.yml (the docker job's runner, image pull and
lane; a requires-docker target in each container-backed package).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* perf(bazel): build the non-race contract corpus in bd_for_tests' configuration

go_test_race_off only set race=false, while rules_go's go_transition (as
used by //cmd/bd:bd_for_tests, race = "off") also records the overridden
value in original_race. The two non-race configurations differed, so the
docker lane (and --config=ci, which builds protocol_docker_test through
//...) compiled the whole dolt graph twice without race. Record
original_race the same way: aquery GoCompilePkg for
deps(protocol_docker_test) under race drops from ~2630 actions in two
configurations to 1359 in one.

Fix the BUILD comment: manual does not keep protocol_race_off out of other
lanes' builds; protocol_docker_test pulls it in.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): job-mode equivalence fails on any target's failure or missing test.xml

In --job mode a test seen in several targets keeps its best status, so a
failure in one variant was hidden when another target passed the test, and
a go_test_variant.sh sh_test without a test.xml was skipped silently. List
every failed test per target and every target in the job's packages whose
test.xml is missing, and fail on either.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): gate pure-lane contamination, never cache docker-lane results

- gozstd_nocgo.patch: the stubs' package init panics, so a pure binary
  that links gozstd (which CGO_ENABLED=0 go build rejects at compile time)
  fails at startup. bazel-pure starts every pure artifact (bd version, and
  embeddeddolt_test/tracker_test with -test.run=^$; bd_test runs its
  subset) so contamination fails the lane.
- test:docker --nocache_test_results: the requires-docker variants depend on
  host state no action key covers, like the container jobs' -count=1.
  build:remote-exec --noremote_upload_local_results in the committed rc, so
  local runs cannot seed the shared cache with host-dependent results.
- The artifact packaging moves to scripts/ci/package-bazel-bd.sh, which
  sources .buildflags itself; sourcing it in bazel.yml exempted the whole
  workflow from the build-tag scan.
- bazel-pure and bazel-docker use bazel-test's runs-on (Blacksmith when
  remote execution is possible); the policy test pins it for every job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): put the pure and docker lanes behind the rbe-west gate

Apply bazel-test's rbe-west setup-bazel env (RBE_WEST_EXECUTOR, instance
oss, RBE_WEST_WORKERS) and its job if to bazel-pure and bazel-docker, so
same-repo runs of all three lanes skip together until the variable is set
and forks and rbe=off dispatches still run locally. The policy test pins
runs-on, if and the setup-bazel env for every bazel.yml job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): run the js/wasm hook test with a minimal environment

wasm_exec.js caps argv+env size, and the Blacksmith runner's environment
exceeds it ("total length of command line and environment variables
exceeds limit").

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 02:03:51 -07:00
Julian Knutsen
2ec0b2f072
feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than, --limit (#6883)
* feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than

An orchestrator's wisp retention step deletes every closed row in the
wisps table older than N hours, except a closed wisp that an
open/hooked/in_progress wisp depends on through parent-child, tracks or
blocks. `bd purge` could not express that: it selected the ephemeral
TIER (so closed --no-history beads, which live in the wisps table, were
left behind), it deleted a closed molecule root whose step was still
open, and it floored --older-than hours to whole days (36h swept rows
24h old). All three land together so `bd purge --wisps-plane
--older-than 168h --force` covers that step.

Live-dependent protection (issueops.SweepRequest.ProtectLiveDependents,
SweepSkips.LiveDependent): a candidate is held back when a live row
depends on it through a SweepLiveDependentEdgeTypes edge (parent-child,
tracks, blocks), read from both dependency tables. "Live" is the same
not-done set the reference scan uses, custom statuses included, so it
is a superset of open/hooked/in_progress. `bd purge` always asks for it
(no opt-out: removing live work's root is `bd delete`'s job); `bd prune`
does not. Reported as live_dependent_skipped in --json.

Wisps-plane selector (issueops.SweepWispsPlane, `--wisps-plane`): the
candidates are every closed row in the wisps TABLE, whatever its
ephemeral/no_history/wisp_type values, via a new single-plane search
(issueops.SearchWispsPlaneInTx) that the store backends call directly
and the unit-of-work provider reaches through
IssueUseCase.SearchWispsPlane, so embedded, server and proxied share one
body. It reaches durable-tier (no-history) rows, so it carries the
durable tier's require-a-filter gate.

--older-than (purge and prune): day values keep their meaning (7, 7d,
2w); anything else is a Go duration taken exactly (36h, 168h, 90m).

Tests: three new Sweeper contract cases (wisps plane clears the whole
table, wisps plane requires a filter, protects live dependents) run on
dolt, embeddeddolt and the uow provider; workapi unit tests; a CLI
retention scenario run in embedded, shared proxied and managed-local
proxied modes (fails against origin/main); TestParseOlderThan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(uow): classify IssueUseCase.SearchWispsPlane as a read in the notifying parity partition

TestRecordingIssueUseCaseCoversItsSurface requires every IssueUseCase
method to be either wrapped by the notifying decorator or exempted with
the reason it fires no hook. SearchWispsPlane reads state and changes
none, like SearchIssues beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(purge): refuse out-of-range --older-than; add --limit for bounded drains; cross-plane protection test

Review follow-ups on #6883.

--older-than: a day count past what a time.Duration holds (213504d,
30501w) used to wrap silently — 213504d became 25m26s, which on a
destructive command selected almost every closed row. It is now refused
as out of range; ParseDuration already refused oversized h/m/s values.

--limit N (issueops.SweepRequest.Limit, SweepResult.Remaining): one
purge deletes at most N rows, oldest closed_at first (then id), after
every protection, and reports the rest. --json adds remaining and
has_more when --limit is given. At ~15ms/row on the proxied path a
single unbounded sweep of a large backlog can outlive a caller's
deadline, roll back, and never clear; a bounded loop cannot. Negative
limits are ErrValidation at the role and refused at the CLI.

Tests: TestParseOlderThan out-of-range rows; contract cases
LimitTakesTheOldestClosedFirst and ProtectsLiveDependentsAcrossPlanes
(a live issues-table bead depending on a closed wisp via parent-child,
tracks and blocks keeps it) on dolt, embeddeddolt and uow; workapi
units for the ordering and the negative-limit refusal; the CLI
retention scenario now drains with --limit 1 and checks the overflow
refusal. CHANGELOG notes that sub-day Nh values used to round UP to a
day (12h is now taken exactly) and lists the protection under Changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:57:24 -07:00
Julian Knutsen
6da2a43477
ci(bazel): advisory Bazel workflow + go test/Bazel equivalence check (#6881)
* ci(bazel): add advisory Bazel workflow and setup-bazel action

Add .github/workflows/bazel.yml, a side-by-side lane that runs
`bazel test //... --config=ci` (PR Core parity) on pull_request,
merge_group, push to main and workflow_dispatch. It is advisory: not in
ci-gate's CI_GATE_REQUIRED.

.github/actions/setup-bazel installs a sha256-pinned Bazelisk (Bazel from
.bazelversion), restores the runner cache (--disk_cache and
--repository_cache only), and writes a CI bazelrc outside the workspace
and outside the cached directory. Remote execution is enabled only when
BAZEL_REMOTE_EXECUTOR, RBE_TLS_CERT and RBE_TLS_KEY are all set (base64
PEM cert/key; optional RBE_TLS_CA, RBE_INSTANCE); none set (fork PRs, or
workflow_dispatch rbe=off) runs locally; a partial set fails. The endpoint
and its bare host are masked. The rc logic lives in write-bazelrc.sh so it
is testable offline.

The runner cache is saved only by push-to-main runs under a run-unique key
and restored by prefix, so it never freezes at its first save and PRs do
not churn the quota. The job also reports the tier (T1/T2/local) and
wall time in the step summary, runs tools/bazel/critpath.py against the
profile, and checks BUILD drift with make bazel-sync-check plus
make bazel-sync and a clean git status.

tools/bazel/critpath.py reports the critical path as the sum of the
chained "critical path component" events rather than the longest one (a
cold race build: 395s over 75 components, where the single-component
version printed 69s and a false scheduling gap), lists the longest
members and Bazel's processes: cache line, and checks a report-only
budget (warning annotation, exit 0) unless --enforce is given.

scripts/ci_workflow_test.go covers the new lane: not wired into any gate,
every action SHA-pinned to the repo's released SHAs, no monolithic
actions/cache, no unbounded apt-get, the cache topology, secrets only
reaching setup-bazel, --profile after `test`, and the rc writer's
none/partial/full/invalid-PEM/secret-dir-in-workspace behaviour.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): check go test / Bazel test equivalence in the Bazel lane

tools/bazel/equivalence.py compares the Go tests `bazel test //...
--config=ci` ran with the ones pr.yml's go test lanes run, so a tag
filter, a stray manual tag, a package without a go_test target, or a
shard that runs zero tests cannot shrink the Bazel lane while it stays
green:

- package set: every package `go list -race -tags gms_pure_go` reports
  with test files has a go_test target (bazel query);
- test-name set: every top-level TestXxx in the files go list selects
  (minus ^TestEmbedded, as PR Core skips) appears as a testcase in the
  test.xml of a go_test target this invocation tested (from the BEP);
  runtime skips count as run. Tests Bazel ran that go test would not
  are divergences too.

Expected differences go in tools/bazel/equivalence_allowlist.txt, one
justified line each (empty today); unused entries are reported.
Results go to the step summary; the full listing with --details.

.bazelrc test:ci now sets GO_TEST_WRAP_TESTV=1 (rules_go lists passing
tests in test.xml only under -test.v) and downloads test.xml despite
--remote_download_minimal.

The Bazel workflow runs the check after the critical-path report, and
nightly.yml calls the workflow (suite "bazel", and on schedule) with the
full listing.

Verified locally against a remote --config=ci run: 103 packages and
8843 tests on both sides. Tagging //internal/gitignore:gitignore_test
manual keeps `bazel test` green but fails the check, listing its two
tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(fs): run RepoContextAndRole from its own git repo

The test relied on its working directory being inside a git checkout to
make BEADS_DIR external to the CWD repo. Under Bazel the working
directory is the runfiles tree, not a git repository, so RepoContext
failed with "not a git repository" and the test skipped itself.
Create a second temporary repo and chdir into it instead; go test keeps
passing and Bazel now runs the assertions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bazel): fail equivalence on tests Bazel skips but go test passes

The equivalence docstring claimed runtime skips count as run because go
test skips them the same way. It does not: against PR Core's go test
-json on the same commit, 11 tests passed under go test and skipped
under Bazel while the check printed ok with an empty allowlist.

- equivalence.py --go-test-json compares per-test status with the
  Bazel test.xml: passed under go test and skipped under Bazel is a
  divergence; other status differences are listed, not failed. The
  in-job (PR) run cannot see skip divergences and says so.
- The allowlist gains a `skip` kind (`<pkg> <test> skip  # why`, the
  justification still mandatory) and lists the 10 intentional skips:
  cmd/bd TestGOMODCACHENotUnderTestHome and TestZZStdioNotLeaked, and
  the scripts policy tests that walk the source checkout. The eleventh,
  fs TestContextRepository_RepoContextAndRole, is fixed in the test.
- scripts/ci/pr-core.sh writes `go test -json` to
  BEADS_PR_CORE_GO_TEST_JSON when set (same flags otherwise).
- nightly.yml runs that in a new job, uploads the JSON, and calls
  bazel.yml with go-test-json-artifact, which downloads it and passes
  --go-test-json to the equivalence step.

Verified on a remote `bazel test //... --config=ci` run: ok with the
allowlist; a TEST_SRCDIR-only t.Skip injected into
internal/gitignore TestAppendLines fails the check (and passes the
name-only in-job check, as documented).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): freeze the runner cache per lock, mask key material, tighten policy

Runner cache: every push to main saved ~2.3 GB (repository cache, disk
cache, Bazelisk) under a run-unique key, on a repo already over its
Actions cache quota. The cache now holds only the repository cache and
Bazelisk, whose content is fixed by .bazelversion and MODULE.bazel.lock:
exact key bazel-repo-v2-<os>-<hash>, restore falls back to the previous
lock's entry, and only a push to main that missed the key saves. No
--disk_cache in either mode (remote runs have the remote cache; local
runs never used it). About 2 GB per lock change.

Credentials:
- write-bazelrc.sh masks every non-armor line of each decoded PEM
  (cert, key, CA). GitHub only masks the base64 value as stored. The CA
  used to be decoded inside the rc redirect, so its mask commands would
  have gone into the rc; it is decoded first now.
- The CI rc sets build:remote-exec --noremote_upload_local_results, so
  CI never writes locally executed (PR-code) results into the shared
  action cache. Developer rcs keep Bazel's default.
- RBE_INSTANCE stays optional; an empty one is a ::warning.
- bazel.yml's header states the accepted risk: same-repo PR code runs
  with the RBE client certificate (as in gascity); forks never get it;
  what is in place and what is pending a human decision.

Policy tests (each proved with a scratch mutation that now fails):
triggers must be exactly pull_request, merge_group, push,
workflow_dispatch and workflow_call (no pull_request_target); secrets
may appear only in the setup-bazel step's env, not in workflow or job
env, run, with or if; no continue-on-error anywhere in bazel.yml or
setup-bazel; the cache-save if is matched exactly; the critical-path
and equivalence steps must end with the bare script call and the test
step with exit "$rc", with no exit 0, || true, || :, ; true, set +e or
trap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(ci): record the same-repo RBE decision in bazel.yml

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): bazel wrapper version check; keep go-test prose out of the build-tag scan

The wrapper prepends --bazelrc, so 'bazel --version' reached the server
as an unknown startup option; ask bazelisk directly. check-build-tags
matched 'go test' in workflow prose and step names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): run the RBE lane on Blacksmith runners; mask the executor's IPs

GitHub-hosted runners are refused by the remote-execution edge; the
Blacksmith pool (as in gascity) is admitted and does not count against
GitHub's concurrent-job cap. Forks and rbe=off keep ubuntu-latest.
Bazel prints the resolved executor address in connection errors, so mask
every address the endpoint host resolves to.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): target rbe-west (instance oss) behind RBE_WEST_WORKERS

The original edge does not admit CI runners. Mirror gascity: remote
execution uses secrets.RBE_WEST_EXECUTOR and instance oss when the repo
variable RBE_WEST_WORKERS is true; same-repo runs are skipped until then
instead of failing, while forks and rbe=off still run locally.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 23:05:21 -07:00
Rongjun GENG
686bc798cb
fix(prime): honor shared-server mode consistently across bd prime's store resolution paths (#6589)
* fix(store-factory): honor shared-server mode in prime's store resolution

newDoltStoreFromConfig and its read-only sibling
openNonMutatingStoreFromConfig checked only cfg.IsDoltServerMode(),
which deliberately does not read dolt.shared-server from config.yaml
(to avoid a circular import with the doltserver package). A workspace
with config.yaml tracked but metadata.json gitignored as machine-local
state — the common shape of a linked git worktree — left
configfile.Load returning (nil, nil), so both paths silently fell
through to the embedded backend and created a phantom database named
"beads" instead of reaching the real shared server.

cmd/bd/main.go's own top-level command resolution already compensates
for this exact gap (GH#3817), but bd prime resolves its store through
a separate path (formatMemoriesForPrime -> ensureStoreActiveForPrime
-> ensureStoreActiveWithContext -> newDoltStoreFromConfig) that never
got the same fix. Centralized the compensation into
effectiveServerMode so the two internal paths and main.go's own
resolution cannot drift from each other again.

Fixes #6551.

* fix(store-factory): route read-only shared mode

* fix(store-factory): reach the !cgo twins and scope shared-server per workspace

Maintainer review fixes for PR #6589 (GH#6551). Addresses the three majors in
the review synthesis, plus the two non-gating items, and corrects two false
claims in the PR's own new prose.

1. major — the !cgo twins kept the unfixed gate, and "centralizing the check
   here keeps them from drifting again" was structurally false.
   effectiveServerMode sat behind //go:build cgo, so store_factory_nocgo.go's
   own copies of newDoltStoreFromConfig / newReadOnlyStoreFromConfig could not
   call it: the released CGO_ENABLED=0 binaries (.goreleaser.yml ships three)
   still ignored shared-server in the exact GH#6551 shape, and there the
   fallthrough is the "reinstall with embedded support" refusal rather than a
   phantom database — actively misleading, in the one build where a shared
   server is the only usable backend. Moved the helper to a new untagged file,
   store_factory_server_mode.go, and called it at all four sites. The
   centralization claim is now true rather than reworded, and the new file's
   header records why it must stay untagged.

2. major — TestPrimeCfgNilHonorsSharedServer was vacuous. Two separate causes,
   both fixed:
   - the beads dir had no files at all, so hasBeadsProjectFiles was false,
     FindBeadsDir() returned "" and ensureStoreActiveWithContext refused with
     ErrNoBeadsDatabase before the factory was reached. It now gets the
     config.yaml the reported shape actually has, which is simultaneously
     discoverable and still metadata.json-less.
   - it exported BEADS_DOLT_SHARED_SERVER=1, which the OLD gate already
     honored, so the A/B stayed green on unfixed code even after the first
     fix. The env var is now deliberately empty: the config.yaml layer is the
     whole of the base gap. Renamed to TestPrimeHonorsSharedServerConfigYaml,
     because the "cfg == nil" mechanism the old name asserts does not happen at
     this call site — normalizeLoadedConfig substitutes DefaultConfig() before
     the gate, so the gate's `cfg != nil` conjunct never short-circuited here.
     The same false mechanism is corrected in TestEffectiveServerMode's comment.
   Also added the positive assertion the test lacked: it now requires the
   captured output to name the port it pinned, so a refusal before store
   resolution can no longer pass. Confirmed by A/B against the reverted gate.

3. major — cross-workspace opens resolved activation from the launcher's
   process-global config, contradicting the invariant three lines above the
   gate. doltserver.IsSharedServerMode() reads process-global state, but
   routed.go:214, create.go:408 and init_contributor.go:330 pass a foreign
   beadsDir, so a launcher enabling shared-server in its own config.yaml could
   retarget a workspace that explicitly asked for embedded — a connect failure
   or a same-named database holding someone else's rows.
   effectiveServerMode now takes beadsDir and resolves the yaml layer against
   it via config.WorkspaceYamlValueStrictWithLocal (config.yaml only in the
   first iteration; see item 4 below). The env arm stays machine-global
   (configfile.IsDoltServerMode already honors it above an explicit dolt_mode,
   so that is base-equivalent), and the process-wide merge is still consulted
   when the target declares no dolt_mode of its own — which preserves both the
   GH#6551 headline fix and base behavior, since IsDoltServerMode falls through
   to config.yaml only when c.DoltMode == "". Purely workspace-scoping the read
   as prescribed would have dropped the user-global layer, which viper merges,
   and regressed the fix it was meant to protect.
   Shared-server mode still wins over a stale metadata.json dolt_mode=embedded
   for the bound workspace (main.go:1710 / shouldUseExternalDoltStatus,
   GH#2946); TestEffectiveServerModeResolvesYamlPerWorkspace pins both halves
   of that pair, and each half was mutation-proved to fail independently.

Non-gating, taken because they were adjacent:
- TestEffectiveServerMode's false-case assertions are now hermetic
  (config.ResetForTesting + HOME/BEADS_DIR scoping), matching its sibling.
- the new assertion no longer matches on internal/storage/dolt's connection
  prose; it uses errors.Is(err, syscall.ECONNREFUSED) and the port the test
  itself pins, both owned outside the package this PR does not own.

Required by fix 1 rather than optional: routing the !cgo factories through
effectiveServerMode makes them consult ambient config, which reds the two
pre-existing TestNocgoNew*FromConfig flag-suggestion tests on any machine with
dolt.shared-server enabled. Both now isolate those signals first, verified by
running them with BEADS_DOLT_SHARED_SERVER=1.

Tests: TestNocgoFactoriesHonorSharedServer is new and is the missing behavioral
half of fix 1 — the cgo-tagged tests cannot observe the !cgo twins and the
pure-Go CI job only checks compilation. Each of its two arms was proved by
reverting one !cgo call site at a time.

Validated: gofmt, git diff --check, go build and go vet under both CGO_ENABLED
settings, and every touched test individually in both lanes under a private
temp root (the shared /tmp suite-root sweeper races sibling agent sessions; see
the pre-review CI note).

Iteration 2 of the maintainer review found one new major, introduced by fix 3
itself, plus four non-gating items. All five are addressed here.

4. major -- the workspace-scoped read dropped the config.local.yaml layer, so
   the four factories resolved dolt.shared-server differently from main.go,
   bootstrap, doctor and migrate-dolt-mode: the same resolver-divergence class
   GH#6551 is an instance of, newly introduced by scoping the read. Initialize
   merges .beads/config.local.yaml LAST (the file-loading block at the end of
   Initialize), i.e. at the
   highest priority, and it is the documented place for machine-specific
   settings that must not be committed (docs/reference/configuration.md).
   dolt.shared-server is exactly that kind of state while .beads/config.yaml is
   git-tracked, so "the repo tracks it, this machine opts out" is the ordinary
   use of the escape hatch -- this repo is itself that shape. The divergence ran
   both ways and the enabling direction was the silent one: config.yaml false
   (what `bd dolt shared-server off` persists) plus a local true fell through to
   embeddeddolt.Open and re-created the GH#6551 phantom database with no error.
   Added config.WorkspaceYamlValueStrictWithLocal beside WorkspaceYamlValueStrict
   so the layering lives in the package that owns it, and pointed the helper at
   it. Each layer keeps the strict contract -- absent file or absent key falls
   through, unreadable/unparseable/non-scalar is an error -- which matches
   Initialize, since it fails outright on a config.local.yaml it cannot merge.
   config.local.yaml's name is now a config constant used by both readers, so
   the merged and workspace-scoped paths cannot drift onto different files.
   TestEffectiveServerModeHonorsWorkspaceLocalYaml pins both directions and uses
   the merged config.GetBool as its oracle, so the assertion cannot drift from
   the layer order it pins; reverting to the config.yaml-only reader fails both
   arms independently. The config package's own contract test additionally pins
   the order, the fallthrough when the local file is silent on the key, and the
   error on a malformed local file; inverting the two layers fails it.
   The prescription asked for cast.ToBool parsing. Used strconv.ParseBool
   instead: spf13/cast is an indirect dependency, ParseBool is exactly what
   cast.ToBool calls for a string (so "1"/"t"/"T"/"TRUE" resolve here as they do
   everywhere else, which was the point), and it matches migrationSharedTopology,
   the in-tree precedent for parsing this key from this reader. An unparseable
   value is viper's false too, and now says so.
   Corrected the parity claim the finding named: for the bound workspace these
   are the same two files the process-wide merge reads, which is true only now.

Non-gating items from iteration 2, taken because the iteration was already
forced and all four live in code this fixup owns:
- the read-only factory's positive discriminator was a near-tautology: the
  pinned port was "1", OR'd with errors.Is(ECONNREFUSED), so the string half
  matched any errno, timestamp or port containing that digit and held up
  wherever the dial error was not ECONNREFUSED. Pinned 59998 instead, five
  distinctive digits like the prime sibling. Verified both halves now fire
  independently, so neither is carrying the other.
- the new !cgo behavioral pin ran in no CI lane: the pure-Go cmd/bd test step is
  a name allowlist and omitted it, so the exact single-call-site regression this
  commit mutation-simulated would have passed every job. Added the three Nocgo
  test names to that -run group in both pr.yml and main.yml. The three pass
  under -tags gms_pure_go, CGO_ENABLED=0, -short in 0.4s with no server, and
  reverting store_factory_nocgo.go's first call site now reds that lane --
  failing only the mutated arm, so per-site discrimination is preserved. (This
  also retires the "the pure-Go CI job only checks compilation" note above: that
  job does run a named subset, and now it runs these.)
- the unreadable-config.yaml arm degraded silently and its comment claimed the
  opposite: it said the configfile.Load error path "refuses to degrade to the
  embedded default", but returning false IS the degrade to embedded here. Kept
  the conservative false (main.go degrades identically on the same corrupt
  input, so it is parity, and a target whose own config is unreadable must not
  be retargeted by the LAUNCHER's config), added a debug.Logf so the discarded
  parse error is recoverable, and corrected the comment to describe what the
  code does.
- TestNocgoFactoriesHonorSharedServer's discriminator was negative-only, the
  one-sidedness class this commit fixed twice elsewhere: any future pre-gate
  refusal would have passed it without the shared-server arm running. Added the
  positive half the siblings use, against its own distinctive pinned port.

Iteration 2 validation: gofmt, git diff --check, go build ./... and go vet under
both CGO_ENABLED settings, the full internal/config suite, the cmd/bd
store-factory and prime shared-server tests (including the 30s flagship binary
test), and the exact pure-Go CI step command with the widened allowlist. Every
fix above was mutation-proved, each arm separately.

Iteration 3 of the maintainer review returned approve with no blocker or major
finding: one minor and five nits. All but one are addressed here, amended into
this same fixup rather than stacked.

5. minor -- the layered reader honored a lone config.local.yaml, so the fixed
   divergence survived at the edge of the fix. Initialize hangs its local merge
   off the project config.yaml it actually found (primaryConfigPath, assigned
   only where an os.Stat on a config.yaml succeeded), so a .beads holding
   config.local.yaml ALONE is never merged: config.GetBool answers from defaults
   while the four patched factories answered from the local file. Same
   resolver-divergence class as item 4, one-directional instead of two, and loud
   (a split-brain connect failure) rather than a phantom database.
   Took the "require the pair" arm rather than only narrowing the prose. A
   reader whose entire contract is "resolve the way Initialize's merged reader
   does" should satisfy that contract instead of documenting where it does not,
   and the permissive read left it the single resolver in the tree that honors a
   file nothing else reads -- the divergence pointed the other way. Two lines in
   WorkspaceYamlValueStrictWithLocal; a stat error other than not-exist drops the
   layer too, matching Initialize, whose own probes for a project config.yaml
   fail the same way, and the tracked read then surfaces that error instead of
   swallowing it.
   Added the missing table arm (local only, no tracked config.yaml) and mutation-
   proved the guard in both directions: neutralizing it reds that arm alone, with
   the divergent ("true", true) answer, while all seven incumbent arms stay green;
   always dropping the local layer reds the two override arms and the malformed-
   local arm while the new one stays green. The guard fires on exactly the
   population it was written for.
   Both parity claims now state Initialize's condition as well as its order
   (store_factory_server_mode.go, yaml_config.go).

Nits, taken because amending this fixup costs nothing extra:
- the !cgo test's own comment still told the reader the pure-Go job "only checks
  that the package compiles" -- in the commit that allowlisted that test by name
  in both workflows. It reads as license to drop the name, which would retire
  exactly the coverage iteration 2 bought. It now says the job runs this test by
  name in pr.yml and main.yml, and that the test name and both allowlists must
  move together.
- three new doc comments cited loadConfigFiles, which does not exist; the merge
  is inline at the end of Initialize. All three now cite Initialize, as does
  item 4 of this message.
- the new constants' justification claimed they keep the merged reader and the
  workspace-scoped reader from drifting onto different files, but only the local
  path was switched -- Initialize still spells config.yaml literally everywhere
  it probes for one. Narrowed the comment to what the constants actually bind,
  rather than rewriting config-path literals this PR has no other reason to move.
- the three pinned "nothing listens here" ports (59997/59998/59999) sat inside
  the kernel's ephemeral range (32768-60999 here and on the GitHub runners).
  That only became load-bearing because the two discriminator fixes worked: the
  assertions now mean "we dialed THIS port and were refused", so a process that
  bound :0 and landed there would answer the dial and red a correct
  implementation. Moved all three to 19997/19998/19999. Each move is proved live
  by the assertion that names its constant -- the prime test still finds its port
  in the captured output.

Declined: switching migrationSharedTopology (migrate_dolt_mode.go:1238) to the
layered reader. Both lanes graded it optional and explicitly non-regressing --
migrate has always read config.yaml only -- and it is a production behavior
change to `bd migrate dolt-mode` that no further review pass would see, on an
iteration that is otherwise approve. It belongs with the five other unlayered
IsDoltServerMode resolvers iteration 2 recorded (where.go:143,
context_cmd.go:140, doctor/database.go:311, doctor/shared_store.go:45,
doctor/server.go:73) as follow-up.

Iteration 3 validation: gofmt, git diff --check, go vet in the default,
CGO_ENABLED=0/gms_pure_go and GOOS=windows modes, the full internal/config
suite, the five cmd/bd resolver and call-site tests including the 33s prime
binary test at its new port, the migrate-dolt-mode topology test, and the exact
pure-Go CI step command (ok, 0.44s).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 10:32:56 -07:00
Tomasz Feliksik
33bed587e0
Accept uutils coreutils timeout in generated hooks, and check the shims against real implementations (#6561)
* Accept uutils coreutils timeout in generated hooks

The generated hook selects a timeout helper only when its --version
banner starts with "timeout (GNU coreutils) ". uutils coreutils reports
"timeout (uutils coreutils) " with the same command line and the same
exit 124 on expiry, so hosts that ship it (Ubuntu 25.10+, NixOS with
uutils-coreutils-noprefix) silently fell through to the Perl alarm, or
to the unbounded direct run when Perl is absent. Follow-up from #5522,
tracked in #5541.

- Widen the identity allowlist to uutils; the match stays by banner so
  Windows timeout.exe is still never probed (#5503).
- Add a backend-selection case using the GNU stub with the uutils
  banner: fails on the old shim (selects gtimeout), passes with the
  widening.
- Regenerate the managed sections in the tracked .githooks/* so
  TestTrackedManagedHookSectionsMatchGenerator stays green.
- Update the hook-timeout passages in docs/reference/git-integration.md
  and troubleshooting.md, which described the probe as GNU-only.

Verified on NixOS with uutils 0.10.0 as /run/current-system/sw/bin/timeout:
with Perl removed from PATH and a bd that hangs, the old shim runs
"without timeout" for the full duration; the new shim expires at
BEADS_HOOK_TIMEOUT and continues.

Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of Tomasz Feliksik

* Regenerate tracked .githooks managed sections with make githooks-regen

TestTrackedManagedHookSectionsMatchGenerator holds the managed section in
each tracked .githooks/* byte-equal to the cmd/bd/hooks.go generator, but
nothing regenerated them: after a generator change a contributor had to
splice the new section in by hand, and the failure only dumped both
texts. The v1.2.0 bump reddened main this way (ce20a64bb), and #6561 shipped
its first revision with the five hooks stale.

- BD_UPDATE_GOLDEN=1 makes the test rewrite the section in place, keeping
  everything around the markers (the project's own hook logic) untouched.
  Same switch the package's events golden already uses.
- `make githooks-regen` wraps it, next to `corpus-regen`.
- The drift failure now names that command.
- The exactly-one-section check runs before any rewrite.

Verified: drifting one byte inside .githooks/pre-push fails the test with
the hint; `make githooks-regen` restores the file to the same blob SHA;
the test is green again.

Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of Tomasz Feliksik

* Check the tracked hook shims against real timeout implementations

The Go tests pin the shim's helper selection with scripted stand-ins, so
they can only encode what the author believes each real `timeout` does.
That is where the last two defects lived: uutils prints a banner the
allowlist did not know (#5541), and busybox — which #5541 suggests
adding — exits 143 on expiry rather than 124, so allowlisting it would
turn every deadline into a failed hook and a blocked push.

checks.nix adds a flake check that runs the tracked .githooks/* managed
sections (held equal to the generator by
TestTrackedManagedHookSectionsMatchGenerator) against the binaries
themselves: GNU coreutils, uutils, busybox and toybox `timeout`, each
with and without perl, under dash, bash and busybox ash, for all five
hooks — 150 cases. Expectations come from a model of the contract (the
allowlist as data), so widening it is one line here and the binaries
either agree or they do not.

A fake bd on the shim's restricted PATH blocks on a held-open fifo until
a helper kills it, records the signal and re-raises it, so each case
asserts the backend that ran (TERM from timeout, ALRM from perl's alarm)
and not merely that the shim finished. No clock: a helper that fails to
kill the fake trips the harness's own `timeout 10`. Every case asserts
exit 0, since anything else blocks the user's push. Reading .githooks/*
instead of building bd keeps it at ~1 s and off the Go build's critical
path; CI's test-nix job runs it after its existing help-text smoke test.

Mutation-checked: restoring main's GNU-only sections fails all 30 uutils
cases (15 unbounded, 15 on the perl backend); allowlisting busybox with
a loosened probe fails all 30 busybox cases with hook exit 143.

Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of Tomasz Feliksik

* Run the hook-timeout check under the gtimeout candidate name too

The shim probes `timeout` and then `gtimeout`, but the matrix only ever
put a binary named `timeout` on PATH, so the second candidate was never
run against a real implementation. Whether a helper is accepted under
that name depends on what its banner does with argv[0].

Measured: the uutils multicall dispatches on the argv[0] SUFFIX
(src/bin/coreutils.rs, `binary_as_util.ends_with(util)`) and then prints
the canonical utility name — invoked as gtimeout it reports
"timeout (uutils coreutils) 0.8.0" (this flake's nixos-25.11 pin; 0.11.0
identical), which the allowlist accepts. busybox and toybox know no
gtimeout applet and fail the probe outright, rejected as before. GNU is
immune by construction: Homebrew's gtimeout is a separate binary whose
banner is the fixed "timeout (GNU coreutils) 9.11"; nixpkgs' coreutils
is a single-binary multicall that refuses a foreign name ("unknown
program 'gtimeout'"), so it gets no variant here.

Each multicall is now also installed on a case PATH as `gtimeout` ALONE
(`installs`, derived from `implementations`; `backendFor` stays keyed on
the implementation, so the model's claim is "uutils is allowlisted
whatever it is called"). 240 cases on Linux, 80 on darwin (no busybox or
toybox there, and no busybox-ash shell). The shadowed
`out=` inside run_case is `case_out` now: it only survived because every
case is a backgrounded subshell, and a de-backgrounded case would have
died on the final `touch "$out"`.

Mutation-checked: installing the variant as `xtimeout` (a name the shim
never probes) fails exactly the 30 uutils-as-gtimeout cases — 15 with
nothing killing the fake bd, 15 on the perl backend (ALRM) instead of
coreutils; restored, 240 of 240 pass. The busybox/toybox variants cannot
distinguish (their expectation is rejection either way); their weight is
that the probe does not blow up on a foreign name.

* Run the flake checks on main too, by nix flake check; docs wording

pr-risk.yml's test-nix job ran the hook-timeout check on PRs only; the
byte-identical job in main.yml never got the step, so post-merge main
never ran it. Both jobs now run `nix flake check -L`: no hardcoded
`x86_64-linux` (the step beside it, `nix run .#default`, was already
system-agnostic), and a check added to checks.nix runs without a
workflow edit. checks.aarch64-darwin and .x86_64-darwin evaluate.

Measured on ubuntu-latest with a cold Nix store (fork run 35700791032,
this tree, 240 cases): `nix flake check -L` 3.6 s including substitution
of uutils, busybox, toybox, dash and perl; 0.08 s warm — beside the
4 min 9 s the existing `nix run .#default` step spends building bd in
the same job. The 10-minute timeout is not in question.

git-integration.md: on Git for Windows the preferred deadline backend is
"a coreutils timeout (GNU or uutils)", not GNU alone, since both now
qualify. troubleshooting.md: reflow a ragged paragraph.

* review: close the duplicated contracts around the uutils timeout accept

Maintainer review fixes for #6561. No change to the shim's behavior or to the
generated/tracked hook sections.

- cmd/bd/hooks_timeout_process_test.go: the uutils fixture was built with
  strings.Replace, which returns its input unchanged when the pattern is
  absent, so a later edit to the GNU stub's banner would silently degenerate
  the uutils case into a second copy of the GNU one — still green, no longer
  testing the new accept. Hoist the derivation and fail loudly when the banner
  no longer matches.
- cmd/bd/hooks_timeout_process_test.go: findHookProcessGNUTimeout held a second,
  un-widened copy of the identity allowlist, so on exactly the hosts this PR
  exists for (uutils timeout, no gtimeout) the only Go test that drives a real
  timeout binary skipped with a reason the fix had just made false. Widen the
  probe's case, rename it findHookProcessCoreutilsTimeout, and reword the skip
  and the subtest. Measured against stub PATHs: uutils goes rc=1 -> rc=0, GNU
  stays rc=0, a busybox banner stays rc=1.
- cmd/bd/init_hooks_test.go: TestGenerateHookSection_Timeout asserted only the
  GNU alternative, so deleting the new uutils one from the generator left the
  structural contract green (verified: it passes under that mutation before
  this change, and reports "section missing uutils coreutils identity check"
  after). Add the companion assertion.
- cmd/bd/init_hooks_test.go, Makefile: the regen arm rewrites tracked source
  files, so give it its own BD_UPDATE_HOOKS_GOLDEN rather than the package's
  shared BD_UPDATE_GOLDEN — an unscoped `BD_UPDATE_GOLDEN=1 go test ./cmd/bd/`
  used to turn genuine hook drift into a silent working-tree rewrite that
  reported PASS.
- cmd/bd/init_hooks_test.go: locate the managed section by marker prefix
  instead of the versioned marker line. Tracked hooks drift both from generator
  content and from the release version stamp; the exact-line lookup made the
  second class fatal ("tracked hook missing ...") before the regen arm was
  reachable, so `make githooks-regen` failed at exactly the moment a release
  engineer reaches for it. The versioned markers are still verified — they are
  part of the byte compare.
- checks.nix: the `rc -eq 124` safety-net verdict discarded both $case_out and
  the already-captured $signal, so the one failure mode that is intermittent
  and not locally reproducible was also the only one with no diagnostics.
  Report them like the `rc -ne 0` branch below it.
- docs/reference/troubleshooting.md, docs/reference/git-integration.md: mirror
  the coreutils wording across both docs this PR touches, and generalize the
  re-install guidance in both. Managed sections are never reported Outdated
  (getHookVersion returns IsShim for them and computeHookStatuses gates on
  !IsShim), so nothing tells an existing install it is stale; the sentence was
  still scoped to the older name-only check (#5503).
- CHANGELOG.md: add the [Unreleased] entry for #5541, worded to the actual
  scope — with Perl installed the shim still reached the Perl alarm arm, so the
  lost deadline bit uutils hosts without Perl — say that existing installs must
  run `bd hooks install` once, and drop the claim that stock NixOS ships uutils
  (this PR's own checks.nix takes GNU from pkgs.coreutils).

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 03:38:45 -07:00
ecuthiell
79631656c0
fix(config): pin role writes to a fresh common-config context (#6454)
* fix(exec): match Windows environment key identity (#5618)

Centralize os/exec-compatible environment-key comparison and use it for credential, metrics, Git-hook, trace, and repro subprocess filters. Preserve exact Unix semantics and Unicode near-collisions.

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

* fix(worktree): scrub inherited Git routing state

Establish CWD as the worktree repository boundary before discovery can consume inherited Git routing. Fence the startup config probe, clear routing in-process before root pre-run discovery, and retain command-owned subprocess scrubbing as defense in depth without changing PID or signal semantics.

Fixes #5531

Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell

* refactor(worktree): explain owned filtering and remove an unused shim

Document why filtering the fresh routing slice in place is safe and call
the shared routing-key classifier directly from tests. Retain the two
forwarders used by production worktree subprocess/removal paths.

Review: https://github.com/gastownhall/beads/pull/5623#pullrequestreview-5098421671
Bead: saa-cgh.23
Agent-Signature: unknown-model/unknown-reasoning

* fix(config): isolate identity and tracked-file Git probes from routing

Reuse the worktree routing owner for GetIdentity and isGitTracked so
explicit cwd/path selection is not displaced by inherited repository,
index or injected config state. Preserve identity precedence and the
tracked-secret refusal contract, with real target/decoy regressions.

Follow-up: https://github.com/gastownhall/beads/issues/6222
Dependency: https://github.com/gastownhall/beads/pull/5623
Reported-by: bee-ghosttrack
Bead: saa-cgh.93
Agent-Signature: unknown-model/unknown-reasoning

* test(execenv): exercise every environment operation under both host rules

Thread the host choice through narrow private helpers behind the existing
exported functions. Keep one normalization owner and retain native wrapper
tests; the additional table covers both host branches for equality, prefix
matching, last-wins lookup, filtering and input preservation.

Review: https://github.com/gastownhall/beads/pull/5672#pullrequestreview-5096948965
Bead: saa-cgh.78
Agent-Signature: unknown-model/unknown-reasoning

* docs(worktree): explain startup Git environment scope (saa-cgh.23)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(execenv): exercise exported host policy wiring (saa-cgh.78)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(config): share subprocess key identity for Git routing (saa-cgh.93)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(hooks): isolate tracked-file guard from Git routing (saa-cgh.98)

Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6356.

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(config): isolate role commands from Git routing (saa-cgh.99)

Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6357.

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(env): exercise shared key helpers on native Windows (saa-cgh.78)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* refactor(gitenv): share key parsing and normalize routing membership once (saa-cgh.93)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* docs(config): explain role command routing policy (saa-cgh.99)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(hooks): retain legitimate inherited tracking context (saa-cgh.98)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(hooks): isolate trusted global configuration fixture (saa-cgh.98)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(hooks): isolate role cleanup in the selected repository (saa-cgh.109.4)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(hooks): reset only common local role configuration (saa-cgh.109.10)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(hooks): scope hooks-path cleanup to selected common config (saa-cgh.109.11)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(hooks): make worktree role preservation independent (saa-cgh.120)

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* Report selected config read failures during hook reset (saa-cgh.120)

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* fix(hooks): keep successful config stdout separate from diagnostics (saa-cgh.120)

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* fix(config): pin role writes to fresh common context (GH#6384) (saa-cgh.120.3)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(config): retain Git diagnostics from role writes (saa-cgh.120.3)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(config): assert the actual Git lock diagnostic (saa-cgh.120.3)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(config,hooks): restore the inherited-tracking fallback in the secret guard

Maintainer review fixes for PR #6454 (adopt-pr iteration 1). The scorecard
approved at 913/1000 with no blocker or major surviving synthesis; these are
the non-gating findings that were cheap to close while the fixup was open.

Finding 1 (minor, security) is the only in-range regression in the report. The
range switched internal/config.isGitTracked from the inherited environment to
gitenv.ScrubRouting only, so a config.yaml tracked solely through legitimate
routing -- a bare repository whose work tree is named by GIT_DIR/GIT_WORK_TREE
-- reported untracked, and a secret-key write that upstream-base refused was
silently allowed. Restores the scrubbed-then-inherited union the same stack
already gave cmd/bd.isGitTrackedFile.

Finding 4 (nit) composes with it rather than conflicting, so both land as one
change: the inherited probe now runs only when the scrubbed probe failed for a
configuration reason. git's exit codes discriminate exactly -- 0 tracked, 1
repository reached but path untracked (final), 128 no reachable repository --
so the ordinary untracked-hook miss no longer spawns a second `git ls-files`
while the bare-work-tree fallback is preserved.

Finding 2 (minor). scrubWorktreeRemovalGitEnvForOS keyed its stricter
no-optional-locks policy on strings.ToUpper while the rest of the PR uses
execenv key identity. The two disagree in both directions on Windows:
GIT_OPTIONAL_LOCKS with a dotted capital I (U+0130) survived the scrub although
Git honors it, and GIT_OPTIONAL_LOCK with a long s (U+017F) was dropped
although os/exec keeps it distinct. normalizeWorktreeGitEnvKey is deleted in
favour of execenv.KeyEqualForOS. Base applied ToUpper on all platforms, so this
is a consistency fix in newly rewritten code, not a regression.

Finding 5 (nit). The comment above resetHooksPathIfBeadsManaged's probe
asserted that repoRoot and commonDir share the cached Git context. Probed
false: with cwd A and GIT_DIR=B/.git, `git rev-parse --git-common-dir
--show-toplevel` prints B/.git and A. Restated as intent.

Finding 3 (scrubGitHookEnv is a fifth, strictly weaker routing scrubber) is
deliberately not taken here: cmd/bd/export_auto.go is untouched by this range,
so the hazard is byte-identical at base, and the synthesis scoped it to a
follow-up bead rather than growing this stack.

Each fix is mutation-proved. Reverting isGitTracked reds only the new
TestSecretGitTrackingHonorsInheritedBareWorkTree -- including "refusal = <nil>",
the actual security consequence -- while the incumbent decoy test stays green,
so the pin adds coverage rather than duplicating it. Restoring ToUpper reds
only the new Windows row, showing both directions at once.
TestGuardHookWritePathHonorsInheritedRepository gains a fixture guard asserting
its scrubbed probe fails for a configuration reason rather than exit 1, so a
future fixture change cannot silently make the fallback unreachable.
scrubWorktreeRemovalGitEnvForOS had no test at all before this.

Green locally: ./internal/config, ./internal/execenv, ./internal/gitenv,
./internal/githooksenv, ./internal/gittraceenv, ./internal/metrics, ./scripts,
./internal/beads (the GIT_CONFIG_GLOBAL blast radius neither reviewer ran), and
a blast-radius cmd/bd run over the hooks, worktree, role and uninstall suites.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 02:00:16 -07:00
ecuthiell
08fc8abb86
docs(ci): update shared cloud routing shard rationale (#6432)
* test(dolt): verify shared cloud auth fixture without a time limit (saa-cgh.107)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(dolt): require cloud routing server in the opted-in full suite (saa-cgh.107)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(dolt): count successfully registered cloud auth cases (saa-cgh.107)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test: describe current shared cloud-auth shard fixture (saa-cgh.119)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
2026-09-27 01:57:07 -07:00
ecuthiell
5ecc9b0a41
refactor(init): retire the unused global-ignore writer (#6452)
* fix(gitignore): preserve CRLF when appending project rules (saa-cgh.96)

Reported by bee-ghosttrack in gastownhall/beads#6343.

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(gitignore): pin detector edge cases and clarify append behavior (saa-cgh.96)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(gitignore): preserve line endings in Git exclude appends (saa-cgh.104)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* refactor(gitignore): share append byte composition (saa-cgh.105)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(gitignore): clarify exclude fixture path variable (saa-cgh.104)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* docs(gitignore): explain append aliasing and trailing CR completion (saa-cgh.105)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(gitignore): refuse exclude writes after read errors (saa-cgh.110)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* refactor(gitignore): use shared composition for exclude rules (saa-cgh.111)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(gitignore): omit the empty exclude leading separator (saa-cgh.112)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(init): refuse unreadable global ignore files (saa-cgh.115)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(init): own global ignore fixture working directory (saa-cgh.115)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* fix(init): preserve line endings in global ignore appends (saa-cgh.116)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(init): cover dangling global ignore symlinks (saa-cgh.120)

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* Use a literal CRLF fixture for global ignore composition (saa-cgh.120)

Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell

* refactor(init): retire the unused global-ignore writer (saa-cgh.120.5)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
2026-09-27 01:34:19 -07:00
Jim Wordelman
6e36c3f19c
ci: raise proxied Dolt cmd test job timeout, add step timeout, refresh shard manifest (#6689)
* ci(proxied-cmd): green — give the proxied-shard job its own step timeout, refresh manifest (refs be-bruke)

The job-level timeout-minutes was the only backstop for the "Test
proxied-server cmd shard" step, and it counts the "Download binaries"
step too — so a slow download alone could exhaust the job budget and
kill an otherwise-healthy shard's test run with no way to tell the two
failure modes apart. Give the test step its own 16m timeout inside the
existing 30m job budget, and regenerate the bin-packed shard manifest
via scripts/ci/gen_proxied_shard_manifest.py so it stays in sync with
the current TestProxiedServer* set (0 drift, all 15 shards fallback:0).

* ci(proxied-cmd): mirror the shard timeouts onto the main lane, regen the manifest at the adoption base

Adoption review of #6689, iteration 1 — three minor findings, applied here
rather than deferred.

main.yml's `test-proxied-cmd` is the same job as pr-risk.yml's twin — same
proxied-test-shard.sh, same manifest, same total 15 — behind a
download/verify step inside a 20m budget with no step timeout, so the exact
ambiguous-timeout failure mode this PR removes from the PR lane survived on
the post-merge lane, which is where triage happens with nobody watching.
Mirror both edits (job 20m -> 30m, step 16m) and record the ordering at the
step, since it is not obvious from the site that 16m is deliberately below
the script's own -test.timeout=15m plus setup.

The manifest's only record of the cost proxy's two known blind spots lived
in a hand-written comment block the regeneration deleted:
TestProxiedServerListSortRetiresTheWalk seeds 1400 rows and walks the
listing three ways off a single init, and TestProxiedServerServeReadParity
is the CLI/HTTP read-parity oracle whose presence in this gate-required lane
is what makes the anti-drift claim enforced. Re-adding prose to a generated
file would just be deleted again, so it moves into the generator's emitted
header.

Base drift since authoring left the refreshed manifest one test stale —
#6584 added TestProxiedServerBackupRefusedOnExternalTopology, which
hash-distributed to shard 14 — so "0 drift, all 15 shards fallback:0" was
already false on the merge base. Benign (unlisted tests hash-distribute and
still run, and drift removed no name, so the strict parser's stale-entry
hard-fail was unreachable), but the stated deliverable did not hold.
Regenerated at the adoption base: 149 of 149 discovered tests listed,
fallback:0 on every shard, peak load unchanged at 39 estimated inits. That
figure is a point-in-time measurement, not an invariant: nothing in CI diffs
the committed manifest against a regeneration, so it re-drifts the moment
the next TestProxiedServer* lands. A freshness step
(`gen_proxied_shard_manifest.py 15 | diff - <manifest>`) on a lane already
triggered by .github/scripts/* would make it one; that is follow-up scope.

Verified: the generator reproduces the committed manifest byte-identically;
BEADS_TEST_SHARD_LIST_ONLY=1 across all 15 shards assigns all 149 discovered
TestProxiedServer* functions exactly once with no duplicates or orphans;
actionlint clean on both workflows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-26 07:17:03 -07:00
Julian Knutsen
9fdd8f628d
test(tracker): add real UOW proxy conformance fixture (#6445)
* test(tracker): add real proxy UOW conformance fixture (ga-p9iuv.25.1)

Agent-Signature: Codex (unknown-model; unknown-reasoning)

* test(tracker): harden proxy fixture evidence (ga-p9iuv.25.1)

Agent-Signature: Codex (unknown-model; unknown-reasoning)

* test(tracker): route conformance fetch through HTTP double

Agent-Signature: Codex (unknown-model; unknown-reasoning)

* fix(review): address adopt-pr review findings on the proxy conformance fixture

Gating major (synthesis Finding 1, option b): the suite certified
direct-vs-proxied parity while its two legs ran on divergent persisted
state. `seedTrackerConformance` seeded `Labels: ["old"]` through
`tracker.Store.CreateIssue`, which is not label-faithful across the
backends — the direct store persists `issue.Labels` via `PersistLabels`,
while the UOW store creates through `domain.CreateIssueParams{Issue:
issue}` with `Labels` unset and the domain create writes labels only
from `params.Labels`. Probed on both real backends: direct read back
["old"], proxied read back nil.

Drop the seed labels so both legs start identical, and document the
create-path blind spot in `run.go` and in the seed helper. The
production defect it exposes is pre-existing at base and is tracked in
bd-p0n1 with the required fix (pass `Labels` in `uowStore.CreateIssue`
plus engine-create normalization, since the domain label insert
hard-errors on an empty label that direct `PersistLabels` accepts).

Non-gating findings folded in:

- Finding 2: sort in the fake's `normalizedLabels` so it matches the
  production `normalizedStringSlice` it mirrors; both real legs read
  labels back ORDER BY label, so the divergence would have inverted the
  fixture's authority on the first multi-label assertion.
- Finding 3: drop the `api_only_does_not_open_uow` open-count assertion
  and the "prove ... does not initialize persistence" wording. Both
  in-repo adopters supply synthetic API-only callbacks that never call
  the opener, so the assertion could not fail. The subtest now routes
  through `newSetup` like its siblings and is named for what it checks.
- Finding 4: assert the pulled dependency through `Snapshot.Dependencies`
  and retire the parallel `DependencyExists` callback. One mechanism
  instead of two, and it makes the field the dry-run and refusal
  DeepEqual comparisons already carry load-bearing.
- Finding 5: add scoped `paths:` entries for this suite to the
  proxied-local smoke lane, which matched none of these files and only
  ran via manual dispatch. Keyed to the lane's own selector rather than
  `internal/tracker/**` so unrelated tracker churn does not fire it.
  Also assert `TestManagedLocalProxiedTrackerUOWConformance` is compiled
  into the lane, so the trigger and the coverage stay honest together.

Validation: `go test ./internal/tracker/conformance ./internal/tracker`;
`TestDirectTrackerConformance` and
`TestManagedLocalProxiedTrackerUOWConformance` both green against real
embedded-Dolt and managed-local proxied backends.

Current review fixes (gcg-699284130204931139):
- Restore optional mutation-count assertions on the map-backed leg to catch
  state-identical writes; compare both issue planes in all snapshots and
  include tracker push-hash metadata on real backends.
- Add a normal-lane UOW update test for label trimming, deduplication,
  sorting, omitted labels, and explicit empty-label replacement.
- Fully populate the fake wisp-only seed, remove unused open accounting,
  isolate and decode the API-only response, and select the proxied lane
  when either shared tracker seam changes.

Focused validation: tracker and conformance packages; both real backend
conformance suites (all six subtests each); make ci-pr-lint on Linux and
Windows. Overlay probes confirmed the unit test fails without normalization
and the no-mutation assertion fails for a state-identical write.

Full make test was run once: the two serve failures reproduce on base
71c4cd08b (the role-identity test under atomic coverage, and the server-start
test without an events-journal backend). The remaining stderr/configuration
failures pass on base and head after clearing inherited BD_OTEL_* and
BEADS_DOLT_SERVER_USER. These unrelated base/environment failures were not
changed in this review fixup.

Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen
2026-09-23 02:19:18 -07:00
Julian Knutsen
4b9a40f631
test: cover direct and proxied workflow front doors (#6303)
* test: cover direct and proxied workflow front doors

* test: run workflow parity coverage in CI (ga-p9iuv.14.2)

Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen

* fix(review): trigger the managed-local lane on its own test files

Maintainer fixup for adopt-pr review of #6303.

Synthesis/scorecard Finding 1 (minor, codex): the managed-local proxied
lane is the only place BEADS_TEST_PROXIED_LOCAL=1 is set, yet none of its
push/pull_request `paths:` patterns matched
cmd/bd/mol_frontdoor_managed_local_integration_test.go. The new parity
test could therefore only reach CI via merge_group:/workflow_dispatch: or
an unrelated path touch -- never on an edit to the file itself.

Add 'cmd/bd/*managed_local*' to both filters. Verified by re-deriving the
filters with GitHub's glob semantics (`*` does not cross `/`): the file
goes from unmatched to matched on both triggers, and the pattern matches
no other file in cmd/bd.

Also close the same gap for cmd/bd/proxied_outage_reconnect_integration_test.go,
which hosts TestManagedLocalProxiedOutageReconnectContract and was equally
unmatched. This is pre-existing (not introduced by #6303) and was not part
of the reported finding, but it is the identical defect in the identical
two lists: after this change every cmd/bd file defining a
TestManagedLocalProxied* test triggers the lane that runs it.

The lane's -test.list assertion is a subset check over a fixed name list,
so neither test needs to be added there.

Validated: actionlint clean, YAML parses, git diff --check clean, and the
before/after filter derivation above. No production or test code changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 15:10:59 -07:00
Julian Knutsen
146919ca19
fix(dolt): contain bd dolt start on proxied workspaces; make bd dolt status truthful (#6577)
* fix(dolt): contain `bd dolt start` on proxied workspaces; make `bd dolt status` truthful

`bd dolt start` knew nothing about proxied-server mode, and the default
proxied root IS `.beads/dolt` (internal/doltserver/physical_root.go:113-127).
With the proxy tree down it launched an unsupervised `dolt sql-server`
directly over that root; the next ordinary bd command then failed with
`invalid connection` because the relaunched proxy found a foreign server on
its port. With the tree up it adopted the proxy's own dolt child into bd's
classic PID/port records, leaving two managers for one process.

`bd dolt status` read the classic pidfile, which proxied mode never writes,
and reported "not running" against a healthy backend — the wrong answer that
sent operators to `bd dolt start` in the first place.

start is now a typed refusal (`proxy.dolt_start.conflict`): the proxy owns
its child's lifecycle, and an idle reaper means a "started" postcondition bd
could not honor beyond the idle window. status reads the proxy's own records
and reports the proxy and its backend separately, starting nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(dolt): compare canonical proxied status roots (bd-y6iz)

Address PR #6577 review F3 by resolving both existing root paths before
comparison and checking resolution errors. Exercise the existing managed-local
topology test through a workspace symlink so Linux catches the macOS path
alias regression while preserving all process and lifecycle assertions.

Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-22 15:06:06 -07:00
Julian Knutsen
403e27c6de
ci: add needs-triage inbox labeling (mirrors gastownhall/gascity) (#6622)
Beads has had no intake labeling: 829 open issues and 388 open PRs carry no
kind/priority/status label, so the hourly PM triage patrol (Sarah, ADR-006),
which only fetches status/needs-triage items, has processed a single item
since 2026-07-17.

Adds the five gascity workflows with the bot login swapped to
gascityinc-sarah[bot]:
- triage-label: add status/needs-triage on issue/PR open, reopen, ready_for_review (skips drafts)
- remove-needs-triage: drop the inbox label when a non-status label is applied by anyone but the PM App
- request-needs-info / remove-needs-info / close-stale-needs: the needs-info / needs-repro lifecycle the triage framework emits

Existing open items are not relabeled by this change; a one-off backfill is a
separate, explicit step.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-19 14:37:19 -07:00
Julian Knutsen
b3d17caa6d Merge release/1.3.0 into main (post-tag forward-port)
Forward-ports the 38 commits that shipped on release/1.3.0 (tagged v1.3.0 at
f45b249ce) into main, as RELEASING.md mandates after a tag. None of them had
ever been forward-ported. Recorded as a merge so main becomes a superset of
the release branch and the lineage is in the history.

Migration ordinal collision (the reason this needed a human-shaped merge):
both branches independently claimed clone-local ignored slot 0026 under
different filenames, so git merged both in with no conflict and left the
series with two migrations at ordinal 26 — a single-integer cursor cannot
address that, and migrationSource.list() panics on it.

Main's ignored/0026_add_wisps_current_revision is renumbered to 0027.
Release's 0026_dep_rekey_dedup_marker is in the shipped v1.3.0 tag, so field
stores have already recorded it at 26 and it can never move; main's twin has
never shipped in any release, so it is the one that is free to move. 0027 was
unused in the ignored series (both sides topped out at 26).

This trips check-migration-hygiene.sh Check C (frozen migrations), which has
no exemption mechanism. That is expected and accepted: breaking the collision
requires a rename, and the ignored series' cursor table is itself dolt-ignored,
so its content hashes are clone-local and never participate in the cross-clone
ContentHashSkew comparison that Check C exists to protect. Main's 0067 body is
deliberately NOT edited for the same reason in reverse — it is main-plane and
its hash IS compared across clones.

Conflicts resolved:

  CHANGELOG.md                       release's finalized [1.3.0] section kept
                                     byte-identical; main's two unreleased
                                     entries (#6023, #5859) moved up under
                                     [Unreleased] where they belong
  cmd/bd/init_safety.go              union — release's added paragraph is
  cmd/bd/init_safety_help.go         accurate against the merged code (three
                                     exit-12 sources, incl. init.go:3147)
  internal/storage/uow/dolt_sql_provider.go
                                     kept main's newProvider refactor AND
                                     release's readOnly field/assertion;
                                     newProvider gained readOnly: opts.readOnly
                                     so release's read-through-refused-migration
                                     behavior survives main's refactor
  .github/workflows/main.yml         single -timeout=30m per release's #6091
  scripts/ci_workflow_test.go        design (flag on the invocation, not in
                                     matrix.test-flags); the shadowed 25m in
                                     matrix.test-flags removed
  scripts/migration-test/lib/versions.sh
                                     union — main's darwin/arm64 corpus plus
                                     release's v1.2.2 linux/amd64 entry
  integrations/beads-mcp/uv.lock     ruff 0.16.5 (release, newer); block is
                                     internally consistent, uv lock --check ok
  default.nix                        vendorHash left at main's value and is
                                     KNOWN STALE — see below

Version stamp lands at 1.3.0 (main had been sitting at the previously-released
1.2.2, this project's between-releases pattern). check-versions.sh: 24/24.

Known follow-up: default.nix vendorHash. The merged go.mod/go.sum is a genuine
union (release's kin-openapi/oapi-codegen bumps + main's newer Dolt stack) and
matches neither side, so neither recorded hash is correct. It must be
regenerated with scripts/update-nix-vendorhash.sh. The repo's automatic fixer
(update-vendor-hash.yml) is dependabot-only and will not run on this PR.
2026-09-15 22:09:13 +00:00
dependabot[bot]
819ebd5e8e
chore(deps): bump DeterminateSystems/determinate-nix-action (#6042)
Bumps the actions group with 1 update: [DeterminateSystems/determinate-nix-action](https://github.com/determinatesystems/determinate-nix-action).


Updates `DeterminateSystems/determinate-nix-action` from 3.21.9 to 3.22.2
- [Release notes](https://github.com/determinatesystems/determinate-nix-action/releases)
- [Commits](61cbfe2efc...527f17dd63)

---
updated-dependencies:
- dependency-name: DeterminateSystems/determinate-nix-action
  dependency-version: 3.22.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 17:41:12 -07:00
Jim Wordelman
ea89b160fb
Align proxied-local-smoke Dolt CLI pin with measured 2.2.0 (refs be-egcj2.3) (#6002)
* test(feat): red — Align dolt-sql-server test container version with host DOLT_VERSION pin (refs be-egcj2.3)

* feat: green — Align dolt-sql-server test container version with host DOLT_VERSION pin (refs be-egcj2.3)

* chore(ci): retrigger CI after transient golangci-lint schema-fetch timeout (refs be-fjj0i)
2026-09-02 17:38:29 -07:00
Julian Knutsen
6e60ca26d3
ci(macos): give the macOS test lane the 30m timeout the Linux lane already has (#6121)
* ci(macos): give the macOS test lane the 30m timeout the Linux lane already has

#6091 gave scripts/ci/pr-core.sh an explicit -timeout=30m because ./cmd/bd
has outgrown Go's implicit 10m per-package default. The macOS lanes invoke
`go test` inline in workflow YAML and never got the same treatment, so they
still run against a 10m wall.

Measured macOS ./cmd/bd durations across 17 recent runs: 357, 387, 389, 418,
419, 422, 486, 494, 536, 542, 547, 549, 558, 560, 590, 597, 600 — a coin flip
against 600s. #6091's own macOS lane passed at 596.719s, 3.3s of margin.

No single test is responsible, so when the alarm fires the panic names
whichever test was in flight and reads like a hang rather than the package
running out of clock.

30m is not a new number: main.yml's integration shards, ci-measurements.yml
and nightly.yml already give this same code 30m on every -race lane.

Changed:
  - pr.yml Test (macos-latest)
  - main.yml Test (macos-latest), and the ubuntu-latest coverage lane beside
    it, which runs the same ./... under -race with coverage on and also had
    no explicit timeout
  - ci-measurements.yml "macos short" and "pr-core" — the measurement twins
    of the above, which at 10m clip their own longest samples into panics

In main.yml the flag sits on the invocation rather than in matrix.test-flags
so editing the matrix cannot silently drop it.

De-slowing or sharding ./cmd/bd is the real fix and belongs on main; this
only stops the clock from being the thing that fails.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(ci): pin the macOS lanes' explicit -timeout=30m

TestMacOSTestJobsReuseWorkspaceBDBinary asserts the macOS `Test` step's
`run` string verbatim, so adding -timeout=30m to pr.yml and main.yml left
the test still asserting the pre-change command. Both the macOS lane and
PR Core failed on it:

    ci_workflow_test.go:282: step "Test" run = "... -timeout=30m ...",
        want "... -skip '^TestEmbedded' ./..."

Update the two pinned strings so the tripwire guards the commands the
lanes actually run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-02 17:15:46 -07:00
Bee
fa53c7e2a6 ci(main): bound the Test matrix's per-package deadline (wy-5b5fbl)
Both legs of main.yml's `test` matrix run every package in one `./...`
invocation with no `-timeout`, so they rode go test's DEFAULT 10m
per-package deadline. cmd/bd has outgrown it: scripts/test.sh already
documents the floor for local runs (~1090s of test time / ~18min wall for
cmd/bd, which is why TEST_TIMEOUT defaults to 25m there), and on
2026-09-01 main run 33497003321 failed twice with
`panic: test timed out after 10m0s` in cmd/bd AND, as collateral in the
same parallel coverage pass, internal/storage/uow — with DIFFERENT tests
only 1-12s in flight on each attempt (a package-wide crawl on the 2-core
coverage-instrumented runner, not a hang), while a rerun of the identical
tree passed.

Give both legs the repo's own 25m per-package deadline and keep it inside
one finite job budget (`timeout-minutes: 45`), the shape
test-embedded-conformance already documents: the go deadline fires first
and prints goroutine stacks, so a REAL hang stays diagnosable instead of
being cut off by a bare job kill.

The ubuntu leg's `matrix.test-flags` is dead config — its coverage step
hardcodes its own flags — so the ubuntu deadline goes on the gotestsum
line and the macOS one on `test-flags`, the only leg that reads it.
scripts/ci_workflow_test.go pins that macOS string exactly, so the
ratchet moves with it (adversarial review F1: without this the diff is a
deterministic red on main and on every PR).

Verified: go test -count=1 ./scripts rc=0 (the ci_workflow ratchet over
the patched main.yml); actionlint .github/workflows/main.yml rc=0.
2026-09-01 05:23:00 -07:00
Julian Knutsen
b3ef65c854
release: prep v1.3.0 — version bump, changelog rollup, release process docs, formula fixes (#6038)
* chore: bump version to 1.3.0

Runs scripts/update-versions.sh 1.3.0, the sanctioned path per RELEASING.md.
Covers everything scripts/check-versions.sh gates: cmd/bd/version.go, the
three plugin manifests plus the marketplace, the MCP pyproject/__init__/
uv.lock pin, npm-package/package.json, the tracked .githooks managed-section
markers, default.nix and the Windows PE resource metadata.

scripts/check-versions.sh passes at 1.3.0.

* docs(changelog): roll up [1.3.0] for 2026-08-28

Creates the [1.3.0] section dated 2026-08-28 and leaves [Unreleased] empty
but present.

- Rolls up everything that was under [Unreleased].
- Adds a 'Breaking changes for v1.2.2 users' section. v1.2.2 shipped the
  v1.1.2 tree, so its users never received [1.2.1]; the five behavioral
  breaks documented there are restated (close policy on bd update -s, search
  including closed, the interactive-only last-touched fallback, bd human list
  status handling, dolt push/sync remote-adoption consent) with a pointer to
  the historical section rather than a copy of it. The two breaks new in
  1.3.0 (BEADS_DOLT_PORT precedence, actor '--' decoding) are indexed here
  and written up in full under Changed.
- Adds upgrade notes: first invocation auto-migrates v53 -> v66 (13
  migrations, 0054..0066, verified against the embedded migrations dir);
  per-step progress on stderr is TTY-gated, so CI sees nothing; back up
  first; the forward skew guard means co-resident older binaries refuse the
  store, so a shared-store fleet upgrades together; rollback via the recovery
  runbook's cursor-rollback procedure.
- Adds entries for eight changes that had no changelog line at all, each
  verified against the code on this branch: --profile -> --cpu-profile with
  no alias (#5126); the one-time content-derived aux-row id rekey, main 0061
  (#5150); events becoming clone-local, 0062 (#5162); the interactions.jsonl
  sidecar becoming opt-in behind audit.enabled (#4688); bd import erroring on
  redirected stdin with no source (#5171); auto-backup defaulting off under a
  sql-server (wy-zrmqr); bd hooks install --chain/--force becoming no-ops
  under marker sections (#5284); the new *.gate.lock workspace/physical-root
  gate files (#5046, #5093); and purge/prune tier selection (#5995).
- Moves the 'sort on listIssues' entry (#5666) out of [1.2.2] and into
  [1.3.0]. Its commit 8aaefe2d4 is not an ancestor of the v1.2.2 tag, so it
  never shipped in that release.

* feat(info): add the 1.3.0 versionChanges entry

RELEASING.md makes cmd/bd/info.go a required release step: versionChanges is
the channel 'bd info --whats-new' uses to tell an agent what changed under it.
The entry matches the existing format and carries the same upgrade notes as
CHANGELOG's [1.3.0] — the v53->v66 migration and its cost, the fleet
implication of the forward skew guard, the rollback pointer, the seven
behavioral breaks a v1.2.2 user meets, and the headline changes.

* docs(releasing): document the release-branch process, fix the semver wording, close the audited checklist gaps

Release-branch process (now in use for 1.3.0): a new 'Release Branches'
section covers cutting release/x.y.z from a SHA green on both Main and
Nightly Full Tests, landing every release-targeted change as a PR based on
the release branch and labeled status/needs-review-auto, tagging from the
branch, and forward-porting to main afterwards. Hotfixes are folded into the
same shape rather than a parallel one.

Semver: MAJOR is now removals and incompatible interface changes; documented
behavioral breaks that ship with migration notes are a MINOR bump, with the
obligation that makes that legitimate (CHANGELOG entry naming the override,
plus an info.go summary). 1.3.0 is cited as the worked example.

Checklist gaps the audit found: cross-compiling every goreleaser target
before tagging (GH#5662 — PR CI builds none of them, and the freebsd break
burned the v1.2.0 tag), the docs cutover (cli-docs.pin bump plus regen, and
the hand-maintained release line on docs/index.md, which had gone stale at
1.1.0), a release-notes rollup check for both an unemptied [Unreleased] and
entries misfiled under a previous tag, an explicit check-versions.sh gate,
and the info.go entry.

Also retires the bump-version.sh instructions: that script has been a
deprecation stub that exits 1 for some time, so the document's primary
version-bump instruction could not work. Replaced with update-versions.sh
plus check-versions.sh, and the file list corrected against what the script
touches now (uv.lock, the copilot plugin, the .githooks markers, winres) —
the old list named cmd/bd/templates/hooks/* and PLUGIN.md, neither of which
it writes. 'The Easy Way' now names the release molecule; release.sh is a
gateway that prints it.

Fixes the drifted table of contents while in the area.

* fix(release-formula): bump via update-versions.sh, verify via check-versions.sh

The formula carried its own hand-rolled copy of the version bump, and it had
drifted from the scripts it was copied from. bump-plugin-json pointed at
claude-plugin/.claude-plugin/plugin.json, a path that has not existed since
the plugins moved under plugins/beads/ — so the step would have failed
outright — and the copy covered none of the files added to the gate since:
the codex and copilot plugin manifests, integrations/beads-mcp/uv.lock, and
the BEADS INTEGRATION markers in .githooks/*. A release driven by this
formula would either die on the stale path or ship inconsistent versions,
which is how the v1.1.1 tag burned (stale uv.lock, discovered only in the
tag-triggered run) and how the v1.2.0 bump reddened main (stale hook
markers).

Replaces the seven hand-rolled bump steps with one that runs
scripts/update-versions.sh, which is the sanctioned path and cannot drift
from itself, and turns verify-versions into scripts/check-versions.sh — the
same gate the release-tag pre-push hook and CI run — instead of a grep list
that has to be maintained in parallel with the real one. Both steps carry the
two failure modes worth knowing about: uv missing (leaves uv.lock stale, fails
only after the tag exists) and the hook markers being rewritten wholesale
rather than matched.

Also renames push-main to reflect the release-branch process now documented
in RELEASING.md, and adds the forward-port reminder there.

Verified: each listed file checked against scripts/update-versions.sh and
scripts/check-versions.sh as they exist on this branch, and against a real
./scripts/update-versions.sh 1.3.0 run. go test ./scripts/ -run Release
passes (the formula still parses, and the cleanup-stale-dolt-orphans,
verify-homebrew-core and local-install assertions are untouched).

* docs: point the release banner at 1.3.0 and tell 1.2.2 users what this upgrade costs

The docs homepage carries a hand-maintained 'These docs are for the X.Y.Z
release' line that nothing generates or validates, so it had gone stale at
1.1.0 while the CLI docs pin had already moved to v1.2.2. It now names 1.3.0
and sends the reader to Upgrading first, since this upgrade crosses a schema
migration. RELEASING.md now carries a checklist item for it.

docs/getting-started/upgrading.md was entirely version-agnostic: strong on
mechanism (install methods, hooks, the remote-migrate gate, backup-first,
the multi-clone flow) and silent on which release you are coming from. A
1.2.2 user could read the whole page without learning that their database is
at v53 and that this step crosses 13 migrations. Adds an 'Upgrading to 1.3.0'
section covering the v53->v66 jump and why it is bigger than a routine one,
the slower first invocation and its TTY-gated per-step progress, the
forward-skew consequence for a shared store (upgrade every client together),
and the cursor-rollback runbook. It links to the backup and multi-clone
procedures already on the page rather than restating them.

Also adds the schema-version-mismatch runbook to the Recovery index table.
It was reachable only from the sidebar and the CHANGELOG, and the new
Upgrading section links to it.

Generated docs untouched: scripts/check-cli-docs-drift.sh passes against the
v1.2.2 pin, and the pin bump is a post-tag step (generate-cli-docs.sh builds
bd from the pinned tag, which does not exist until v1.3.0 is pushed).
go test ./test/docsync and scripts/check-doc-freshness.sh pass.

* fix(release-notes): correct the backup advice, the migration count, and the breaks undercount

Review round on #6038. Four findings, all of which made the upgrade notes
actively misleading rather than merely incomplete.

CRITICAL — bare 'bd backup' takes no backup. backupCmd is a runless cobra
parent (no Run/RunE, children init/sync/restore/remove/status, no default),
so cobra prints usage and exits 0 without writing anything. A user following
'bd backup' before an irreversible 27-migration upgrade sees help text and
proceeds believing a snapshot exists; in a script, 'bd backup && ...' proceeds
on exit 0. Replaced with 'bd backup init <path>' then 'bd backup sync' in
CHANGELOG, info.go and upgrading.md, and said in each place that bare
'bd backup' takes no backup.

Also CRITICAL, same class: the backup had no ordering rule. Under 1.3.0
'bd export' triggers autoMigrateOnVersionBump before it exports, so a backup
taken after installing is a post-migration snapshot that cannot protect
against the migration going wrong. All three copies now say to back up with
the OLD binary before installing, and carry the neighbouring rule that
remote-backed stores must finish 'bd dolt push' first, since the
pending-migration gate refuses push/pull too.

Migration count: '13' was the main series only. schema.go runs the main
source then the ignored source through the same 'Applying migration %04d'
printer, and the ignored series moves 0011 -> 0025 here, so the run is ~27
migrations and the counter visibly restarts from 0066 back to 0012. That
backwards jump is exactly the signature an operator reads as a loop and
kills — while these same notes say 'do not interrupt it'. All three copies
now state ~27, show the restart in sample output with real migration names,
and label it as not a restart.

Breaks undercount: 'seven' read as an enumeration, but [1.2.1] carries three
more entries explicitly labelled BREAKING that a v1.2.2 user also meets.
Retitled as highlights with an explicit pointer to the full [1.2.1] section,
and added the three: '--readonly serve' now refused (load-bearing next to the
'restart any long-running bd serve' advice — it will not come back up), the
config kv-plane drop, and the backend package's orphan-handling removal. The
info.go entry gets the same pointer and the same three, since 'bd info' is the
only copy reachable after installing.

Upgrade-time reader is now pointed at 'bd upgrade review', which computes the
delta since the previously-run version via getVersionsSince, instead of
'bd info --whats-new', whose showWhatsNew loops the entire versionChanges
array with no cap (~80 entries) to deliver the ~11 relevant bullets.

* fix(check-versions): gate the copilot manifest and the winres files, stop overclaiming

Three review findings, all cases where the gate said more than it checked.

Copilot manifest was bumped but never gated. update-versions.sh:101 rewrites
plugins/beads/.copilot-plugin/plugin.json with a sed anchored on the OLD
version, and check-versions.sh never read the file — the string 'copilot' did
not appear in it. That is the same drift class that carried stale .githooks
markers through v1.2.0: once the file drifts the bump silently no-ops on it,
the green line prints, the pre-push hook and CI pass, and the Copilot plugin
ships advertising the previous version. Now gated. Verified it fails: drifting
the file to 1.2.2 reddens the run and exits 1.

winres was verified by nothing after the formula rewrite deleted the steps
that grepped it. Restored as real gates rather than formula prose, since
manifest.xml's <assemblyIdentity> version has no backstop at all —
gen-winres.sh re-derives winres.json's numeric fields from version.go at build
time, but the manifest's version is embedded verbatim, and update-versions.sh
rewrites it with a sed anchored on the old base version. Prerelease-correct:
file_version/product_version and the manifest's four-part version are checked
against the BASE version while FileVersion/ProductVersion are checked against
the full string, which is what update-versions.sh writes. The manifest grep is
anchored at line start because the XML declaration also carries a version=
attribute. Verified it fails on drift.

The success line claimed a 'released-docs policy pass' for a check that no
longer exists — the script reads no docs file — while this same release adds
a MANUAL docs-cutover checklist item precisely because nothing automated
covers docs. An operator reading that line would reasonably skip the manual
checks. Now says version files only, and names the manual steps. The two
vestigial echoes left behind by the deleted check are gone.

The failure remedy was also wrong, and wrong in the direction that loops the
operator: it said to re-run update-versions.sh, which derives CURRENT_VERSION
from cmd/bd/version.go (line 70) and substitutes old->new literally. After the
first bump version.go already holds the new version, so a re-run rewrites
new->new and no-ops on exactly the drifted file the gate just named. Verified
empirically — with the copilot manifest and manifest.xml drifted to 1.2.2,
'update-versions.sh 1.3.0' prints 'Bumping: 1.3.0 → 1.3.0' and leaves both at
1.2.2. Only the githooks markers (wholesale regex) and uv.lock (uv lock) heal
on a re-run, and the message now says so and gives the three remedies that
actually work.

shellcheck clean.

* docs(releasing): make the release-branch policy internally consistent

The policy landed in the previous commit but three procedures in the same
files still contradicted it, and the formula implemented the wrong one.

RELEASING.md said 'Nothing is pushed straight to the release branch' and then,
150 lines down, direct-pushed the release branch and minted the tag before the
merge. Two concrete failures: with branch protection the push is rejected
after the tag already exists locally, and with a squash merge the tag points
at a commit that is not an ancestor of release/x.y.z — goreleaser packages
CHANGELOG.md FROM THE TAG into every published archive, so the release ships
the pre-review notes. Both the CHANGELOG-commit block and the bump block now
open a PR, and tagging is a separate step against the merged commit. The
literal 'git push origin main' under the substitution blockquote is gone, as
is the direct push in the docs-pin block.

The formula implemented the wrong order too: commit-release -> create-tag ->
push-main. Reordered to commit-release -> push-main (land the PR) -> create-tag
(on the merged commit) -> push-tag, and create-tag now states why the order
matters.

preflight-pull was untouched by the last commit and still hard-coded main:
divergence recovery was 'git reset --hard origin/main'. Running the molecule on
a release branch and following that destroys the reviewed release-prep commit
and leaves the operator tagging an untested main SHA — precisely the failure
the policy exists to prevent. It now pins the release branch into a variable
first and resets to that; the backup branch moved to Option 1 rather than
Option 3.

'git push origin release/{{version}}' broke every prerelease run: the branch
convention is release/x.y.z, so an RC rendered release/1.3.0-rc.1 and failed
with 'src refspec does not match any', and the forward-port 'git log
main..release/{{version}}' then died on an unknown revision. Now derives the
base version and says why.

The RC workflow still cut tags from the tip of main, which is what the new
policy calls 'a SHA nobody has fully tested' — and worse, an RC exists to
validate the SHA the stable release ships, while the stable tag now comes off
the release branch, so it validated a different SHA by construction. RCs are
now cut on the base version's release branch, and promotion stays on it.

Accuracy fixes in the same pass: verify-versions no longer claims the (now
corrected) 'released-docs policy' string or tells the operator to re-run the
bump — a no-op after the first run, proven in the previous commit — and no
longer prints a prerelease-broken 'grep -c {{version}} winres.json # 4', which
yields 2 for an RC because the numeric PE fields carry the base version. It
now points at check-versions.sh, which gates winres correctly. The 'three
plugin manifests' and 'compares everything else against it' claims are
corrected to match what the script actually reads, and RELEASING.md names
default.nix and README.md as bumped-but-ungated.

go test ./scripts/ and ./test/docsync/ pass; formula still parses and the DAG
is acyclic.

* ci: run PR workflows on release/** branches

Release-targeted PRs currently run almost no CI. pr.yml, pr-risk.yml,
conformance.yml, regression.yml and cross-version-smoke.yml all declare
'pull_request: branches: [ main ]', and every push trigger in the repo is
'branches: [main]' or 'tags: v*'. So a push to release/1.3.0 fires zero
workflows, and a PR based on it gets only the three workflows with no branch
filter (migration-test, nix-build on its paths, docs-mintlify).

That puts the new release-branch policy on a contradiction: it routes the
version bump and 'any fix the release validation turns up' onto a branch where
they land with no unit, lint, conformance or regression coverage, and the
first full signal is the tag build — where a failure burns the tag by this
document's own rule. The policy was written to stop tagging untested SHAs and
was quietly producing them.

Adds release/** to the pull_request branch filter of those five. Push triggers
are deliberately left alone: release branches take changes through PRs, so the
pull_request event is the one that matters, and widening push would double
every run on merge.

cross-version-smoke is the highest-value of the five here — a release-targeted
PR is exactly where cross-version upgrade breakage is most expensive to find
at tag time.

This PR is the vehicle because it targets release/1.3.0, so the new filters
take effect for its own subsequent pushes.

All five files parse; go test ./scripts/ (which includes the workflow lint
tests) passes.

* docs: reconcile the 1.3.0 upgrade notes with the merged release set

Merging origin/release/1.3.0 changed three facts the upgrade notes assert.

Migration count. The merge added ignored/0026_dep_rekey_dedup_marker (#6045),
so the clone-local series now runs 0012 -> 0026, not 0012 -> 0025. Recounted
from the tree: 13 main-series (0054..0066, unchanged) + 15 clone-local = ~28,
not ~27. Corrected in CHANGELOG, cmd/bd/info.go and upgrading.md, including
the trailing line count in the 'counter restarts' explanation.

Shared servers. #6048 (#5920, #5043) means a shared dolt sql-server is no
longer auto-migrated at all — it waits for explicit consent via
'bd migrate schema'. The notes said flatly that 'the first invocation migrates
your schema in place', which is now true only for embedded/local stores and
would have sent a shared-server operator looking for a migration that never
runs. All three copies now scope that claim and point at the new 'Shared
servers' section upgrading.md gained in the same merge. Verified
'bd migrate schema' exists (cmd/bd/migrate.go:848) and that --global is a root
persistent flag (main.go:818), so the cited invocations are real.

#5896. The auto-export entry said #5896 'stays open for embedded mode, where
bd delete still wedges auto-export'. #6059 closed exactly that. Reworded to
point at the store-history heal rather than claiming a live bug.

check-versions.sh 25/25 green, go build ./... clean, go test ./scripts/... and
./test/docsync/ pass, check-cli-docs-drift and check-doc-freshness pass.

* docs(changelog): fold in the proposed changelog lines from the merged 1.3.0 set

Adds the 'proposed changelog' text carried in the bodies of the PRs that
merged into release/1.3.0 after this rollup was first written. Text is the
authors' own; where a body gave it in conventional-commit form rather than as
a bullet, the sentence is preserved and only the 'fix(scope):' prefix dropped
and a bold lead added to match the section.

Changed: #6048 (two bullets — shared-store consent, and the smart gate's
first-mover/fast-forward arms going embedded-only), #6036 (exported packages
marked EXPERIMENTAL), #6053's revision-token bullet, #6049 (migration-test and
upgrade-smoke wisp-plane coverage).

Fixed: #6040 (server-mode lost updates), #6044 (removed-backend rejection),
#6045 (convergent dependency rekey), #6046 (tracked ignored_schema_migrations
heal), #6054 (ignored-cursor floor clamp), #6059 (delete-wedge heal), #6057
(full GC after flatten/compact), #6060 (--storage-class routes), #6061
(journal actor attribution), #6062 (proxied/gateway init errors), and #6053's
two typed-JSON bullets.

Security: new subsection for #6047 (Go 1.26.7 toolchain bump closing seven
reachable stdlib advisories, plus the dependency bumps clearing all 25).
Placed after Fixed per Keep a Changelog ordering.

Documentation: #6052's multi-rig/proxied gate limitation. Its body calls it a
release-notes line rather than a changelog line, so it may want moving.

Contributor credit carried where the PR body gives it: #6040 keeps its
'Reported and fixed by @nova-submodules' sentence, and #6044 gains a note that
its detection helper is ported from @steveyegge's #4740. NOTE: #5064 (aux
row-key encoding drift) carries credit to @marcodelpin in its body but no
proposed changelog line, so it has no entry here — flagging rather than
inventing one.

#6043 was a REPLACEMENT, not an addition: it asked for the existing
MIGRATION-FREEZE bullet to be swapped for vendor-neutral text. Done — the old
bullet named the gt CLI, 'town root' and 'gt migrate thaw'; the new one
describes the generic marker discovery, exit code 14, and the wider set of
maintenance that stands down.

#6055 and #6056 were still OPEN at the time of writing. Their four proposed
lines are included but fenced in a PROVISIONAL HTML comment block that says to
delete it before tagging if either PR does not land.

check-versions.sh 25/25, go build clean, go test ./scripts/... and
./test/docsync/ pass, check-cli-docs-drift and check-doc-freshness pass.

* docs(changelog): credit the three carried contributor fixes

Adds the entries for the merged PRs that carried contributor work but shipped
no proposed changelog line of their own, in the maintainer's supplied wording,
expanded to the surrounding entries' voice.

ATTRIBUTION CORRECTED on #5064. The supplied wording read 'Reported by
@marcodelpin, fixed by @maphew'; the PR body says the opposite. Its '## Credit'
section: 'The fix is @marcodelpin's, from 767d5dcd on their fork... The
diagnosis behind it — the chunk-level characterisation, the negative result on
the minimised fixture, the dolt 2.1.10 re-test, the recover-rows verification —
is theirs too... isSchemaEncodingDriftErr and its table-driven test come from
that commit.' @maphew (the PR author) absorbed it with a review-requested
semantic rework. Written as 'Diagnosis and fix by @marcodelpin, carried and
reworked by @maphew' so the contributor is not demoted to reporter of a bug
they also fixed.

Scope corrected on the same entry. The supplied wording reads as new behavior,
but git grep against the v1.1.2 tag finds both isSchemaEncodingDriftErr and
aux_row_rekey_drifted already present in internal/storage/schema/
aux_row_id_backfill.go — v1.2.2 is the v1.1.2 tree, so v1.2.2 users already
have this fix, and it is already documented under [1.1.2]. #5064 carries it
onto the main line. The entry says so, so a v1.2.2 reader does not conclude
they were exposed and go looking for a migration that does not concern them.

#5783 and #6037 verified against their PR bodies before writing; both supplied
claims hold. #5783: Config.LenientOpen reached server mode but newServerMode
never read it and the field's doc comment said 'Ignored in server mode', so the
dirty-table refusal's own recovery command could not run — and server mode has
no 'move the directory aside and re-bootstrap' alternative. #6037: bd init
persists a git-origin-derived sync.remote into the tracked config by design,
bootstrap rejected exactly that shape before the origin auto-detect, and
Action=='none' conflated 'already exists' with 'refused', printing a success
tick and exiting 0 having created nothing.

Also notes in the PROVISIONAL fence that the RC is gated on #6055/#6056
merging, so the fence comes off at RC-prep time rather than being an open
question.

check-versions.sh 25/25, go test ./test/docsync/ passes.

* fix(release): create release-prep branch before pushing it

The new release-branch/prep-PR flow pushed `release-prep/v<version>`
without ever creating that branch, so `push-main` (and the RELEASING.md
runbook) failed on first run with
`error: src refspec release-prep/v<version> does not match any`.

Add `git checkout -b` before each prep-branch push — the formula
`push-main` step and both RELEASING.md landing snippets — so the branch
exists before it is pushed, mirroring the existing `REL_BRANCH` guard in
the same step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-30 22:19:35 -07:00
Julian Knutsen
d530cddfa6
ci: add advisory cyclomatic complexity reporting (#6081)
* ci: add advisory cyclomatic complexity reporting (bd-7g21)

Add a pinned gocyclo report, checked-in baseline, stable-key PR diff, and opt-in guard for shipped Go code. Run the report on every PR as a non-required artifact while maintainers measure signal quality; preserve existing complexity as grandfathered debt.

Agent-Signature: unknown-model/unknown-reasoning

* test(protocol): refresh dependency removal corpus
2026-08-30 19:05:17 -07:00
Julian Knutsen
362eecc6bf
test(migration): wisp-plane upgrade corpus — seed and assert the ignored-plane classes the 1.3.0 chain depends on (#6049)
* test(migration): seed and assert the wisp plane on the v1.1.2 upgrade lane

The migration-test harness has never seeded a wisp. Its shared fixture is three
issues, a dependency, a label and a comment, and thirteen version lanes assert
its exact `length == 3` shape — so the plane that 1.3.0's chain actually
rewrites (wisps, wisp_dependencies, wisp_comments, leases, events and the
ignored-migration cursor) reaches the candidate empty, and every migration in
main 0054-0066 plus ignored 0012-0025 runs as DDL over zero rows.

Add a separate `run_wisp_plane_upgrade` lane in its own workspace, dispatched
after the shared embedded lane the way the v0.55.4 second lane already is, so
no existing assertion changes. It seeds two issues and five wisps covering the
open, closed, blocked-by-issue, blocked-by-wisp and conditional-blocks classes,
plus a wisp comment, a wisp label, an issue-blocked-by-wisp edge through
dependencies.depends_on_wisp_id, and a file:// Dolt remote published with the
old binary.

There is no `bd dolt sql`, so plane state is read with the already-pinned
external Dolt v2.1.8 CLI as a read-only oracle. `dolt sql -q` can exit 0 on
failure, so every read is decided by its CSV payload rather than its status.

Assertions and the trap each one guards:

  - wisp survival and row counts        gc must not collect a fresh closed wisp
  - updated_at stability                0059/ignored-0015 derived-state restamp
  - is_blocked truth table + bd blocked the wisp-aware blocker predicate
  - dolt_ignore superset                the #5947 read-before-write clobber
  - dolt_status clean                   migrations must not leave dirty tables
  - events row count across 0062        the drop/commit/recreate flip
  - leases + granted_node present       the #5366 contradicted-cursor replay
  - unblock on close                    blocks vs conditional-blocks release
  - journal shape + wisp writability    0064/0066 and 0060 storage_class
  - full-fingerprint second open        the ignored track, which `Schema
                                        already at vN` cannot see at all

That last one matters most: MigrateUp reports `applied` from the main track
only and never adds appliedIgnored, so the harness's existing no-op check is
structurally blind to an ignored-track replay. The fingerprint is the only
guard there is.

Extend the pinned-runtime gate and the workflow's Dolt install step to the
wisp-capable versions, which now need that binary as an oracle. Cache keys are
untouched: corpora are seeded fresh per run and the cache holds only release
binaries keyed by asset checksum.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(migration): extend the wisp lane to v1.1.0 and the pre-split v1.0.1 regime

v1.1.2 alone only proves the post-split regime. v1.0.1 is the one source in the
corpus that still stores wisp dependencies in the legacy single-target shape
(issue_id, depends_on_id) and has no ignored-migration cursor at all, so it is
the only lane where the candidate has to perform the ignored/0003-0005 split,
the 0047 delegate repair and the 0058 heal on populated rows, and bootstrap the
ignored cursor from nothing rather than find both already done.

Add verify_wisp_dependency_split: the three split target columns exist, the
legacy column is gone, and each seeded edge lands on the right target —
wisp-on-issue and conditional-blocks in depends_on_issue_id, wisp-on-wisp in
depends_on_wisp_id, and the issue-on-wisp edge in the main dependencies table's
depends_on_wisp_id. Mis-homing those rows is the "duplicate primary key given"
hazard class in migrations/README.md, and it is invisible to every count-based
check.

Make verify_no_restamp regime-aware, because which migrations replay is a
property of the source cursor. 0059 and ignored/0015 self-assign
`updated_at = updated_at`; their predecessors 0046, 0047 and ignored/0007 do
not. A v1.0.1 store replays all of them, so every non-closed row legitimately
moves. A v1.1.x store has 0046/0047 behind its main cursor, so issues must not
move at all — but its ignored cursor says 0011 while leases.granted_node does
not exist, the sentinel disbelieves the cursor, and the ignored series replays
anyway (#5366), dragging in unguarded ignored/0007.

What is gated in both regimes is the part that is unconditionally true: closed
rows never move, because every recompute is scoped
`WHERE status NOT IN ('closed', 'pinned')`. That bites the moment one forgets
its scope. The tighter guard on everything else is the idempotence fingerprint,
which requires a second open to move nothing at all.

Record the per-version capability probe results as a table rather than leaving
them as assumptions, and run bd doctor quick on every wisp lane instead of only
the ones with a remote.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(smoke): add a tolerant wisp-plane scenario to the release gate

cross-version-smoke.yml runs upgrade-smoke-test.sh as the release gate, and all
six of its scenarios work entirely in the versioned plane. The wisp tables
therefore reach the candidate empty, and 0054-0066 plus ignored 0012-0025 only
ever run as DDL over zero rows — the same blind spot Scenario 6 was written to
close for the dependencies split.

Scenario 7 seeds a wisp with the old binary, gives it a blocker edge so the
is_blocked recompute has real work to do, upgrades, and then checks the
surfaces that break when the replay is wrong: the wisp is still listed, the
blocker queries stay wisp-aware without erroring, the wisp is still writable
through the migrated storage_class default, and doctor quick is happy.

The matrix reaches back thirty releases on a tag push, so a binary that cannot
create a wisp or cannot produce a parseable id passes with a SKIP instead of
failing. Same tolerant, grep-based, dependency-free style as the rest of the
file: no jq, no Dolt CLI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(migration): cover the #5816 dirty tracked wisp-table state

#5816 is still open: an ignored-named table that is tracked at HEAD *and* dirty,
with ignored migrations pending, hard-locks the open. Nothing in either upgrade
harness has ever constructed that state, so the containment surface is
untested.

It is not reachable from clean OSS lineage — every release since v0.63.3
registers the dolt_ignore patterns before creating the tables — so the scenario
builds it deliberately: force-add and commit the wisp tables through the pinned
Dolt CLI, then dirty one again with an ordinary old-binary wisp write. That is
the shape real clones from forks and older-behavior lineages arrive in, and it
is the only place this file issues DML through the oracle.

Because the bug is open, the scenario deliberately does not gate on whether the
candidate accepts or refuses. It gates on what must hold either way: the
command terminates rather than hard-locking, and no wisp rows are lost. A
refusal additionally has to name the dirty tables instead of failing opaquely.
Carries a TODO(#5816) to tighten to must-succeed once the fix lands.

Observed on the current candidate: a clean refusal in about a second naming
`wisps`, with all rows intact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(migration): add v1.2.2 to the corpus and make the lane dispatch array-driven

v1.2.2 is the tag field upgrades actually start from — the recovery release that
superseded the accidental v1.2.1 — and it has never been in this corpus. It is
the v1.1.2 tree re-tagged, so it adds no new storage regime; it closes the
"the exact tag in the field was never tested" gap for the price of one matrix
job.

Adding it exposed a latent trap: the dispatch loop carried its own hardcoded
copy of the embedded-Dolt version list, so a version added to
EMBEDDED_DOLT_VERSIONS in lib/versions.sh was silently routed into the
server-Dolt bridge lane instead, and failed there with a confusing "candidate
list did not refuse with explicit migration is required". Dispatch on
membership of the array that already declares the corpus, so the list exists
once.

Asset checksum verified against the published beads_1.2.2_linux_amd64.tar.gz.
No existing cache-identity string changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-28 23:24:39 -07:00
Marco Del Pin
71377f2769
ci: run internal/storage/dbproxy/server on Windows at PR time (follow-up to #5820) (#6033)
* ci: run internal/storage/dbproxy/server on Windows at PR time

#5820 made the package's path handling platform-portable, but no
PR-triggered job executed it on Windows - the platform those paths
target - so a path-shaped regression stayed invisible until someone ran
the suite by hand (the #5820 review merged on a windows/amd64
attestation for exactly that reason, and asked for this lane as a
follow-up).

Same shape as the existing focused Windows jobs (liveness, doltversion,
worktree-remove): one small windows-latest job running exactly this
package. Spawn tests Skipf loudly without a dolt binary; unix-socket
cases skip on Windows by design; the portability class runs without
either.

* ci: say why the Windows dbproxy job is not in the merge gate (yet)

Adversarial review flagged that test-windows-dbproxy-server is absent from
ci-gate's needs / CI_GATE_REQUIRED / env map, so it can go red while
'CI Gate / Required' stays green - a guard that does not gate.

The absence is intentional, but it was SILENT, and this file has a written
convention for exactly that (test-macos, line ~806): a new job runs on every
PR and its promotion to required-for-merge is a separate maintainer call. So
this states the choice inline and names the three edits that would promote it,
rather than an outside contributor adding their own new job to the required
gate unilaterally.

---------

Co-authored-by: Marco Del Pin <marco@omniaevo.it>
2026-08-27 19:38:35 -07:00