Review F2. Since D2 step 1 the Bazel embedded lane is the tier's only
pre-merge run on same-repo PRs, so a cached PASS (stale, or a poisoned
entry in the shared farm action cache) or a cached run that never
re-exercises an intermittent -race finding would stand in for the legacy
jobs' -test.count=1 run. test:embedded now sets --nocache_test_results,
and the policy test requires it and forbids any other rc line that turns
test result caching back on.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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>
Who keeps the legacy tier, how the decision and gate work, the drift
guard, the residual cross-run race, the conformance.yml duplicate, and
how to revert (unset RBE_WEST_WORKERS).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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>
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>
* fix(preflight): share checkout lint authority
Move the Beads repository's native and Windows non-CGO lint policy into a checkout-owned Go driver. The supported Make/Bash wrapper and bd preflight now execute that same authority, while generic Go repositories retain their direct lint contract and formatting is rooted at the detected project.
Fixes#5300.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* docs(lint): clarify shared driver scope and timeout limits
Address PR #5780 review 5191123668. Document existing inherited-tag semantics and distinguish the wrapper/preflight driver from standalone workflow and pre-commit callers.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(lint): prefer the selected Windows Go toolchain (#6865)
Keep per-pass toolchain requests and deadlines while avoiding the extra auto-selection launcher under the linter. Nonstandard SDKs retain their original PATH.
Agent-Signature: codex-tui-gpt-6-astra-max on behalf of Ewen Cuthiell
* fix(lint): retain PATH for SDK directories containing separators (#6865)
Agent-Signature: codex-tui-gpt-6-astra-max on behalf of Ewen Cuthiell
* test(preflight): declare lint fixture executable for Bazel (#5300)
Agent-Signature: codex-tui-gpt-6-astra-max on behalf of Ewen Cuthiell
* fix(bazel): keep cmd/bd/testdata out of gazelle's package scan
PR #5780 adds the compilable fixture cmd/bd/testdata/preflight-go.go. Left to
itself gazelle generates a BUILD.bazel for cmd/bd/testdata, which makes it its
own package and then (a) empties cmd/bd's data = glob(["testdata/**"]) under the
default allow_empty = False and (b) puts testdata/preflight-go.go across a
package boundary from the preflight_go_fixture target that lists it.
bazel.yml's "BUILD files in sync" step runs `make bazel-sync` and fails on any
resulting drift, and fork PRs always run that job, so this was a live red whose
prescribed remedy ("commit the result") would have broken the build further.
Exclude the directory instead, and take gazelle's ordering for the data list.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(preflight): bound the lint deadline and report each check's scope
Review iteration 1 for PR #5780. Synthesis and scorecard both approve (975/1000,
no blocker or major), so this addresses non-gating findings only.
Finding 4 (Resource Lifecycle) - the 13-minute deadline could not bound the call
it guards. CombinedOutput collects through a pipe every descendant inherits, so
Wait kept blocking on a surviving golangci-lint after the context killed the
direct `go run` child. Measured on the same process shape (direct child killed at
1s, descendant holding the pipe for 8s): without WaitDelay the call returned in
8.00s, with WaitDelay in 1.50s. Sets cmd.WaitDelay so the deadline is a real
bound and the "lint check exceeded" line can actually print.
Also gates that line on err != nil, which retires the claude lane's nit (a): a
child that exits cleanly as the deadline fires is a pass, not a timeout. Measured
at the crossover, 68 of 300 passing runs would have carried a false "exceeded"
line; 0 after the gate.
Finding 1 (Change Impact) and nit 7 (Debuggability), one remedy - the PR re-roots
lint and fmt at preflightProjectRoot() but leaves runTestCheck in the caller's
cwd, so a --check run from a subdirectory mixes a repo-wide verdict with a
subtree-only one "with nothing in the output distinguishing them", and the
reported command is only reproducible from the root. CheckResult now carries the
directory each check resolved to, and the report prints it.
Took the synthesis's second arm (state the scope split) rather than re-rooting
runTestCheck, because re-rooting is a behaviour change neither lane priced: it
widens a subdirectory user's test run from 5 packages to 128, including every
Dolt-dependent package, on a repo whose full test gate the PR body already
discloses as red. The stated hazard is that the scopes are indistinguishable,
which reporting the directory discharges directly.
Finding 2 (Architectural Consistency), second clause - adds
TestBuildFlagsContractMatchesShellSource, which parses .buildflags and pins the
driver constants to it. The existing mirror test asserts today's values from the
Go side only, so the files could drift silently; buildEnvironment overrides
rather than merges -tags, so a tag added to .buildflags alone would be dropped
with every test still green. Each of the three legs was mutation-proved to red.
Declined, with the measurements that decided it:
- Finding 2's first clause (route the key comparisons through
internal/execenv.KeyEqualForOS). The two are provably equivalent today -
execenv's keyIdentityForWindows is strings.ToLower for the same documented
reason - so this is de-duplication, not a defect, and the hazard it closes
(os/exec key-identity semantics changing) is far less live than the
.buildflags drift the second clause pins. The faithful swap means threading
goos through five driver functions and ~27 test call sites in this PR's
centerpiece file, and it would put a non-stdlib dependency into pr-lint_lib,
which the binary currently does not have. Worth doing on its own footing, not
inside a non-gating cleanup.
- Nit 6 (parse GOFLAGS into fields instead of a substring test). .buildflags:22
guards its own append with `!= *gms_pure_go*`, a substring test, and the Go
code is a deliberate mirror of it. Making only the Go side stricter would
manufacture exactly the drift finding 2 warns about: on
GOFLAGS=-tags=gms_pure_go_x the shell would skip its append while the driver
performed one. The fix belongs to .buildflags and the driver together, and
.buildflags is outside this PR. The new mirror test now pins that agreement.
- Nit 5 (probe golangci-lint as well as `go`). The claude lane examined the
LookPath target change and recorded it as deliberate, with the driver's own
missing-linter error as the mitigation. The suggested alternative - have the
driver emit preflight's `--skip-lint` hint - puts a bd-specific flag into a
driver that CI also invokes, where that advice is wrong.
- Finding 3 (two false PR-body claims). Correcting the body is outward-facing
and belongs to finalize; stamped for it. Swept the in-tree copies: the PR's own
LINTING.md sentence "Toolchain requests, formatting, and lint deadlines are
unchanged" is scoped to the Windows SDK-preference paragraph it sits in and is
true there, so it is graded rather than repaired. CHANGELOG.md contains no
pr-lint entry, so the remedy's CHANGELOG half has no target in this PR.
Validation: go build, go vet and gofmt clean on the changed packages;
./scripts/pr-lint/ 12 pass / 2 Windows-only skip; ./scripts/prlintmake/ pass;
cmd/bd preflight selector pass; scripts/check-doc-freshness.sh PASSED;
make bazel-sync idempotent and bazel test //scripts/pr-lint:pr-lint_test PASSED.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(prlintmake): inject the pr-lint wrapper's gofmt shim through GOFMT
The merge with #6294 (be-gx8) left runPRLintWrapper relying on a
code path #6294 made deliberately loud. The helper put its gofmt shim
on PATH. Since #6294, fmt-check.sh resolves gofmt through
scripts/ci/gofmt-bin.sh, which ignores a PATH gofmt by design.
Both TestPRLintWrapper* tests still passed, but only via the
resolver's fallback. The go shim answers `go env GOVERSION` and
`go env GOROOT` with nothing, so gofmt-bin.sh warns "could not resolve
a gofmt from go.mod's go1.26.7 toolchain" and falls back to whatever
gofmt is first on PATH, which happened to be the shim. With GOFMT set
in the environment, which is #6294's documented override, the
resolver uses that value instead. Both tests then fail: exit status
127 from fmt-check.sh, and a missing aggregate failure diagnostic
because pr-lint.sh stops before `go run`. At the pre-merge head
(7f37ba5165) the same ambient GOFMT=/nonexistent run passed all 5
tests.
Pass the shim through GOFMT, as main's runFmtCheck does, and keep it
off PATH so only the go shim is found there. gofmt-bin.sh now returns
the override immediately, and the go shim sees only `version <shim>`
and `run ... ./scripts/pr-lint`. Both wrapper assertions, on the
driver arguments and on the failure diagnostic, are unchanged.
go test ./scripts/prlintmake/: 9/9 pass by default and 9/9 pass with
GOFMT=/nonexistent in the environment. Before this change the second
run was 7/9.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(list): union repeated --status/--state/--id; refuse repeated --type/--assignee
bd list's filter flags were plain pflag strings, so a repeated flag silently
kept only the last value: `--status open --status closed --status pinned`
filtered to pinned alone. A 477-issue census answered over 3 rows and nothing
in the output distinguished the narrowed answer from a correct one — worse for
scripts than humans, since a script pipes the clean-looking count onward. The
--status help text already warned about this, but a doc note does not reach a
script that already ran.
The fix follows what each filter's downstream shape permits:
- --status, --state, --id feed comma-separated OR sets, so repeats now union
into exactly the comma form: `--status open --status closed` builds
"open,closed". Single values and the comma form parse byte-identically to
before.
- --type and --assignee are single-valued all the way down. Joining --type
would surface as "invalid issue type: bug,epic" (loud but misdirected);
joining --assignee would exact-match nobody and return an empty result that
reads as a clean answer — the same defect in a new spelling. A repeat of
either now refuses at parse time, naming the flag.
Two invariants shape the value types. Setting the empty string fully resets
them, because `bd children` borrows listCmd's status flag with Set("all") and
a deferred Set(""). And gatherListInput clears them after copying values out,
because pflag values persist across in-process Execute() calls (the cmd/bd
test binary, library embedders) and an accumulating value would otherwise
leak one command's filter into the next.
Tests cover the union, the refusal (long and shorthand spellings), the
unchanged single/comma forms, the empty-string reset, and the cross-parse
isolation. All four repeated-flag tests fail against the previous flag
registrations.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(list): dedupe repeated filter values; lower Changed on reset (review follow-ups for #5739)
Two nits from review, both on cmd/bd/list_filter_flags.go:
- unionStringFlag.Set now dedupes per token, so `--status open --status open`
and `--status open --status open,closed --status closed` both build
"open,closed" instead of "open,open,closed,closed". Harmless inside the
IN (...) either way, but the joined value is what --json callers and error
messages echo back.
- resetListFilterFlags now lowers pflag's Changed bit on the five flags as
well as clearing the values, so it is a full reset rather than a half one;
the test helper that cleared Changed by hand is gone. The reset takes the
flag set as an argument instead of reading listCmd, because listCmd's
initializer reaches it via runListCore -> gatherListInput and referring
back would be an initialization cycle.
Tests: TestListRepeatedStatusDedupes and TestResetListFilterFlagsLowersChanged
cover the two changes; the existing eight are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BDokjpuq569c49NYTwcBPY
* fix(bazel): enumerate list_filter_flags{,_test}.go in cmd/bd srcs
This PR adds cmd/bd/list_filter_flags.go and cmd/bd/list_filter_flags_test.go,
but cmd/bd/BUILD.bazel carries explicit go_library/go_test srcs lists rather
than globs. That file is absent at this branch's merge base and was added on
main during the 177-commit advance, so the contributor's history never had it
to update.
Without the two entries, `bazel build --config=pure //cmd/bd:bd
//cmd/bd:bd_test` fails to compile bd_for_tests.a with six undefined symbols:
list.go:409,410,413,414,422 for the five list*Flag vars and list_input.go:48
for resetListFilterFlags.
Regenerated with `make bazel-sync` (gazelle): +2 srcs lines, no deps churn, and
a second sync is a no-op. `make bazel-sync-check` cannot see this class --
tools/bazel/go_srcs.py --check validates only the go_srcs filegroup globs --
but bazel.yml's sync step diffs the full `make bazel-sync` output and would
report the tree out of sync.
Validated: `bazel build --config=pure //cmd/bd:bd //cmd/bd:bd_test` exits 0
(exits 1 without this change), and //cmd/bd:bd_test runs the PR's 10 new tests
green (test.xml: 10 testcases, 0 failures, 0 errors).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* review: pin the three unpinned flag arms; correct the CHANGELOG claims
Maintainer review fixes for #5739 (review-loop iteration 1). The synthesis was
`approve` with zero blockers and zero majors, so every item here is non-gating;
applied because each is confined to this PR's own files, cheap, and carries no
behaviour change. A new commit rather than an amend: the existing maintainer
commit `21d287f4df` is the pre-review lane's BUILD.bazel drift repair, not a
review fixup.
Test Evidence Quality (minor): three reachable arms of the new registration had
no coverage. Added `TestListStateAndStatusArms` with a subtest each for the
hidden `--state` alias unioning like `--status`; a union containing `all` being
refused downstream rather than narrowed; and `--status` outranking `--state`
when both are given, which is `gatherListInput`'s documented fallback order.
Mutation-proved by making `unionStringFlag.Set` last-wins (the pre-PR
behaviour): the existing `TestListRepeatedStatusUnions` control and the first
two new subtests all red, while `--status outranks --state` stays green because
it pins the fallback order rather than the union - orthogonal, not vacuous.
The `all` arm is the interesting one: under last-wins the repeat kept only
`open`, so the `status "all" cannot be combined` guard was never reachable.
Release Safety (nit): the CHANGELOG's equivalence claim was one-directional and
omitted that third arm. Softened to "accumulate (duplicates collapse) instead of
overwriting" and added the clause that `--status all --status open` is refused
rather than narrowed.
Debuggability (nit), CHANGELOG arm: the quoted refusal was the inner error only.
pflag wraps it, so users actually see `invalid argument "epic" for "-t, --type"
flag: --type given more than once (already "bug"); pass a single value`, which is
now what the entry quotes - probed from a real `ParseFlags` call, not inferred.
Took this arm rather than dropping the `--%s` prefix from the inner error, since
that one changes a user-visible message and the reviewer offered it as the
alternative.
Architectural Consistency (nit): replaced the hand-rolled `slicesContains` with
stdlib `slices.Contains` and deleted the helper; `slices` is already used
elsewhere in this package.
Deliberately not done: the Change Impact minor's sibling-surface sweep, which
the finding itself scopes as "no change in this PR" plus a follow-up bead.
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: jwe <otaciaproject@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(embeddeddolt): use stored peer credentials for federation sync
bd federation add-peer promises stored credentials are used automatically
when syncing, but the embedded Fetch/PushTo/PullFrom paths read only the
DOLT_REMOTE_USER environment variable, so first sync against any
authenticated Dolt server presented the wrong identity. This is the
peer-path remainder of the class fixed for default remotes in #2543.
withPeerAuth mirrors server mode's withPeerCredentials: peer-store lookup
first, environment fallback for unknown remotes and credential-free peers
(federation sync iterates every dolt remote, so non-peer remotes must
keep their behavior). Stored credentials override the process-wide
DOLT_REMOTE_USER/DOLT_REMOTE_PASSWORD pair as a unit under a
federationEnvMutex, mirroring package dolt: the in-process Dolt engine
reads them from the process environment, so the override is serialized
and both variables are restored (or re-unset) afterward, including on
callback failure. A stored empty field unsets its variable rather than
inheriting an ambient value.
Fixes#5080
Agent-Signature: claude-code-claude-fable-5-unknown-reasoning on behalf of Michael Pursifull
* docs(embeddeddolt): clarify federationEnvMutex is separate from package dolt's lock
Review nit on #5085: the 'mirroring' phrasing read as if the two
packages shared one mutex. State explicitly that they are separate
locks and why per-package serialization suffices.
* fix(federation): actionable error when peer credentials cannot be decrypted
A database pulled to a second machine carries federation_peers rows
its local .beads-credential-key cannot decrypt, and every peer
operation died with a raw cipher error while bd federation status
blamed the network (Unreachable:). The failure semantics were right
(fail closed, matching server mode); the message said nothing about
the machine-local key or the fix.
Add storage.ErrCredentialKeyMismatch plus a shared wording helper
CredentialKeyMismatchError naming the key file as context and the
remediation (re-run bd federation add-peer on this machine). Both
backends wrap their decrypt failures with it: embeddeddolt at its
single decrypt funnel, dolt at its two read paths. GetFederationPeer
wraps now name the peer. bd federation status classifies the sentinel
with errors.Is and prints Local credential error instead of
Unreachable; the --json shape is unchanged and now pinned by test.
When the error fires is unchanged: same call sites, same fail-closed
semantics, no fallback to ambient credentials.
Tests pin the decrypt-failure branch in both backends (embeddeddolt
against a real store with a rotated key, dolt via sqlmock) and the
status classification end to end in the gated CLI harness.
Refs #5080
* fix(embeddeddolt): classify short ciphertext as credential-key mismatch
A stored peer password blob shorter than the GCM nonce returned a bare
'ciphertext too short' error, bypassing CredentialKeyMismatchError, so
federation status read that local corruption as an unreachable peer.
Route the branch through the same sentinel as a failed GCM open; the
remediation (re-add the peer on this machine) is identical.
Adds a short-ciphertext regression at the decrypt funnel.
Refs: gastownhall/beads#5214 (review, gap 1)
* fix(embeddeddolt): bind stored credentials to the remote URL; serialize env fallbacks
Two fixes to the shared withPeerAuth seam from the consolidation review:
- Stored peer credentials are now bound to the peer's canonical remote
URL, not only to a matching remote name. AddRemoteIfNotExists keeps
an existing same-name remote regardless of its URL, so a redirected
remote could receive the stored password. withPeerAuth now verifies
the live dolt_remotes URL against the peer row before any credential
is installed, failing closed on divergence and on a missing remote.
- The plain-remote and empty-credential fallback callbacks now run
under federationEnvMutex too. They previously called remoteAuthUser()
and the operation itself outside the lock, so a fallback operation
could observe a concurrent stored-peer operation's temporarily
installed DOLT_REMOTE_USER/DOLT_REMOTE_PASSWORD pair.
Adds three regressions: diverged-URL fail-closed, missing-remote
fail-closed, and env-fallback-does-not-observe-peer-credentials.
Refs: gastownhall/beads#5085 (review)
* style(dolt): use US spelling in the decrypt-funnel comments
The repo's misspell linter rejects 'Labelling' and 'labelled'. Comment
text only; no behavior change.
Refs: gastownhall/beads#5214 (CI)
* review: name the resolved credential-key path in the mismatch error
Maintainer review fixup for PR #5214 (adopt-pr iteration 1). Addresses the one
minor and the one nit from the review synthesis; both reviewers found 0 blockers
and 0 majors and the quality scorecard is approve (898/850).
Minor (Debuggability & Operability). All three CredentialKeyMismatchError call
sites passed the bare const credentialKeyFile, so the message claimed "the key
file .beads-credential-key is machine-local" without saying where it is. On the
dolt backend that basename is genuinely ambiguous: initCredentialKey resolves it
against s.beadsDir and falls back to the legacy s.dbPath as a transparent
migration, so during the migration window two files with that name can exist
carrying different keys. Pass filepath.Join(s.beadsDir, credentialKeyFile)
instead, at dolt/credentials.go and both embeddeddolt/federation.go sites. No
signature change: the parameter was already named keyFile and its doc comment
already describes it as machine-local.
beadsDir is provably non-empty at all three sites in production, verified in
source rather than assumed: dolt only reaches the funnel with a non-nil key, and
initCredentialKey leaves the key nil when beadsDir is empty; embeddeddolt's
ensureCredentialKey errors out when it is empty.
This lengthens a message the author pre-declared as a judgment call. The
synthesis adjudicated that carve-out deliberately: it covers the message's
wording and its single-line form, not which file the text identifies.
Nit (Test Evidence Quality). dolt's withPeerCredentials is the seam that carries
the sentinel into `bd federation status` on the default backend and had no
fails-closed pin, unlike its embedded twin TestWithPeerAuth_KeyMismatchFailsClosed.
Added one subtest on the existing sqlmock harness asserting the callback does not
run and the sentinel survives the seam's own wrap.
Both pins were proven non-vacuous by mutation, not assumed:
- Reverting the three call sites to the bare const reds all three dolt subtests
and all three embeddeddolt tests, with the original bare-basename text in the
diff output.
- Making withPeerCredentials swallow the decrypt error reds only the new subtest,
on exactly the two properties the nit named (callback ran; no failure).
The dolt test needed beadsDir set on its hand-built store: filepath.Join("",
credentialKeyFile) is the bare basename, so with beadsDir left empty the
resolved-path assertion would have passed vacuously. The embeddeddolt pin's
package-level const became a function of the store for the same reason — its
store has a real temp beadsDir, so the clause now pins the resolved path.
Validation: go vet rc=0 on all three packages; internal/storage, dolt
(3 tests incl. both negative/narrowing tests) and embeddeddolt (3 credential
tests) green; cmd/bd TestEmbeddedFederation 12/12 green including the PR's own
status_credential_key_mismatch e2e subtest. make bazel-sync-check rc=0 with zero
tracked drift — no new files and zero import changes, so no BUILD srcs or deps
can move.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Michael Pursifull <mike@arcaven.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>
* fix(prime): detect git remote from CWD, not BEADS_DIR context
primeHasGitRemote and isEphemeralBranch used GetRepoContext(), which
validates BEADS_DIR against isPathInSafeBoundary. Cross-home agent
sandboxes mount host workspaces under another account path; BEADS_DIR
validation fails and was misreported as "no git remote" even when
`git remote` in the process CWD succeeds.
Probe git in the process CWD (and explicit dir helper) independently of
RepoContext / BEADS_DIR. SEC-003 boundary on BEADS_DIR is unchanged.
Fixes#4927
* test(prime): drop inverted !cgo constraint so the regression test actually runs
The new test carried //go:build !cgo while all 255 sibling test files in
cmd/bd use //go:build cgo, so under the default cgo build the test was
excluded entirely and never exercised the fix it was written for.
Removing the constraint lets it run in both modes.
* test(prime): make the git-remote test hit the boundary it claims to, unify gitDirHasRemote
Review follow-up on #4927 (maphew):
The poison BEADS_DIR value didn't exist on disk, so it tripped
FindBeadsDir()=="" (context.go:107) rather than isPathInSafeBoundary
(context.go:112), even though the test comment implied it exercised the
boundary check. Both funnel into the same err!=nil->false bug so the old
test was a fair proxy, but it didn't test what it said. Seed a real
directory under a rejected prefix (/var/tmp) so BEADS_DIR actually reaches
isPathInSafeBoundary, and add a second case for the FindBeadsDir()=="" path
so both RepoContext failure modes are covered and asserted against
directly via beads.GetRepoContext().
gitDirHasRemote had no production caller — prime only went through
gitCWDHasRemote, so the helper carrying the test's assertions wasn't the
one prime used. Make gitCWDHasRemote delegate to gitDirHasRemote("") so
there is one implementation and the test exercises the real production
path.
* test(prime): scope the unsafe-location subcase to Unix
SEC-003's unsafePrefixes are hardcoded forward-slash literals matched
via strings.HasPrefix. On Windows, filepath.Join renders the fixture
path with backslashes, so the prefix never matches and the assertion
would fail with err == nil. Move it into its own subtest and skip on
GOOS=="windows" rather than deleting or weakening it, so Case 2 (the
nonexistent-BEADS_DIR path, which doesn't touch unsafePrefixes) still
runs on every platform.
gitDirHasRemote / gitCWDHasRemote / primeHasGitRemote are untouched.
* test(prime): delete obsolete unsafe_location_rejected subtest
Upstream added an ALLOW carve-out for /var/tmp in isPathInSafeBoundary
(af076b628, #5028) after this test was written. resolvedPathWithinRoot
resolves both sides, so the carve-out now admits the poison dir on all
platforms and the subtest's premise (that /var/tmp is boundary-rejected)
is false on current main. Delete it rather than retarget at another
unsafe prefix -- none are writable in CI, so a retargeted assertion
would silently no-op via the existing t.Skipf fallback.
The CWD-based checks are unaffected and stay unconditional; update the
surrounding comments since they described the fixture as "a
boundary-rejected BEADS_DIR", which is no longer accurate anywhere in
the file.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): sync cmd/bd BUILD.bazel srcs for prime_git_remote_test.go
Maintainer fixup during PR adoption. cmd/bd/BUILD.bazel enumerates an
explicit go_test srcs list, so the new prime_git_remote_test.go added by
this PR was not compiled into //cmd/bd:bd_test. bazel.yml (armed on this
fork PR: FORK=true => mode=local, not skip) runs make bazel-sync and
exit 1s on any resulting drift, and bazel-pure builds and runs
//cmd/bd:bd_test.
This hunk is the verbatim output of make bazel-sync (bazel run //:gazelle).
Verified: bazel build --config=pure //cmd/bd:bd_test exit 0 both ways;
bd_test -test.list went 1771 -> 1772 entries with
TestGitDirHasRemote_IndependentOfBeadsDir going 0 -> 1 and control
TestOutputContextFunction present in both arms. make bazel-sync is
idempotent (2nd run byte-identical). make bazel-sync-check exits 0 in
both states, so it cannot see this class.
* review(prime): address the three non-gating findings from PR review
Maintainer fixup for PR #5139 review iteration 1. The synthesis and the
quality scorecard both approve with no blocker or major findings; these are
the three non-gating maintainability items, all in scaffolding this PR
itself introduced.
- prime.go: delete the false clause in gitCWDHasRemote's doc comment ("so
the production path and the test-driven path share one implementation").
The pair has zero production callers -- the production probes build their
own command in primeGitCmd -- so the comment now records that instead. Per
the synthesis, only the false clause is removed: the following sentence is
accurate, and the fallback is deliberately NOT routed through the helper
merely to make the old sentence true.
- prime_git_remote_test.go: rename to TestPrimeGitProbes_IndependentOfBeadsDir
so the test names its real subject, and pin isEphemeralBranch -- the second
probe this fix repairs, and the source of the user-visible "ephemeral
branch" half of GH#4927 -- which previously had zero references in the file.
- prime.go: record that primeGitCmd's error result is always nil today and is
retained for future callers, so the now-unreachable err != nil arms are
documented rather than mistaken for live error handling.
The isEphemeralBranch pin asserts BOTH polarities under the same poisoned
BEADS_DIR, which is what the codex lane asked for: with a remote but no
upstream the branch really is ephemeral, and after a purely local upstream is
configured the same probe must flip. The two assertions differ by exactly the
two upstream-setup lines, so the pair is its own non-vacuity proof.
On the test finding I took the harm rather than the literal means. The
prescription offered "drop or retarget the gitDirHasRemote/gitCWDHasRemote
assertions", but dropping them would falsify the very sentence the first
finding asks to preserve ("the BEADS_DIR-independent primitive the GH#4927
regression test drives directly"). They are instead kept explicitly as the
fixture/oracle checks -- the alternative the review's own pre-merge checklist
blesses -- and the unpinned-coverage harm is discharged by the new
isEphemeralBranch assertions.
The probe assertions move from t.Fatal to t.Error so a regression in one
probe cannot mask another's. That is what makes the new pin measurable:
reverting primeGitCmd's GetRepoContext() fallback to "return nil, err" (go
build rc 0, so the arm is not vacuous) reds both primeHasGitRemote and the
upstream-configured isEphemeralBranch assertion, while gitCWDHasRemote and
the no-upstream control stay green -- confirming the oracle bypasses the fix,
and that the new assertion does not.
The rename supersedes the test name quoted in the preceding bazel-sync
commit. BUILD.bazel is untouched because the filename is unchanged, and
bd_test -test.list still holds 1772 entries with the new name present once,
the old name absent, and control TestOutputContextFunction present.
Verified: gofmt, go vet ./cmd/bd/, git diff --check, make bazel-sync (rc 0,
no drift), bazel build --config=pure //cmd/bd:bd_test (rc 0), and go test
./cmd/bd/ over the renamed test plus the prime/backup_auto suites that stub
the probe vars.
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* 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>
* test(feat): red — Add soft watchdog warning for long-running schema migrations (refs be-yyzzs)
* feat: green — Add soft watchdog warning for long-running schema migrations (refs be-yyzzs)
* fix(schema): address review follow-ups on migration watchdog doc citation (refs be-yyzzs, review be-sogif)
Round 1 review (be-sogif) flagged criterion 7: the soft-watchdog comment
at schema.go cited engdocs/plans/be-m65rs-migration-watchdog-scoping.md,
which was never landed to any reachable ref (only exists on PM's own
unmerged worktree branch). Replace the dangling file citation with an
inline summary of the rationale plus reachable citations: the existing
initSchema comment in store.go (migration 0047 as a concrete long-runner
example) and `bd show be-m65rs` for the full scoping decision. Comment-only
change; no functional/behavioral diff. gofmt/build/vet clean; full package
suite reconfirmed 132 PASS, 0 FAIL, 0 SKIP.
* test(schema): red — watchdog is silent off a tty, and ignores bare seconds
Both from review #5997.
TestRunMigrationsWatchdogSurvivesNonTTY drives runMigrations end to end
with a deliberately slow first migration body and a 10ms interval, with
the progress writer put in the state a non-tty caller really sees. It
fails with an empty buffer: runMigrations hands the watchdog the package
stderr var, which is io.Discard whenever os.Stderr is not a terminal, so
the warning is discarded under bd serve, systemd, CI and any piped
invocation — the exact cases where a migration running for twenty minutes
needs to be visible. On a tty it works, which is why this went unnoticed.
Asserting on the wiring rather than on a package variable, so the fix has
to actually reach the call site.
The interval table gains bare-seconds cases. store.go's parseTimeout — the
convention migrationWatchdogIntervalDuration's own doc comment claims to
follow — documents "bare numbers treated as seconds (e.g. \"90\")", and
this one does not, so an operator setting the value to 90 silently gets
5m.
Note the review's own example value, 300, cannot serve as the test input:
300s IS the 5m default, so it passes whether the value was parsed or
discarded. Using 90 and 600 instead, which distinguish.
watchdogStderr exists here but is not yet wired, so the red is behavioural
rather than a compile error.
Refs be-lotba.
* fix(schema): point the watchdog's last dangling citation at bd show be-m65rs
Review #5997 point 1. Round 2 replaced the citation on the call-site
comment but missed the one in runMigrationWithWatchdog's own doc comment,
which still named engdocs/plans/be-m65rs-migration-watchdog-scoping.md.
That path does not exist, and neither does engdocs/plans/ — so the comment
sent a reader after a file that was never committed.
Points it at bd show be-m65rs, matching what the call site already says.
This was the last engdocs/plans reference in the repo; a repo-wide grep for
that prefix is now empty, so the two comments can no longer disagree.
Refs be-lotba.
* fix(schema): send the migration watchdog WARN somewhere a non-tty caller sees
Review #5997 point 2. The package's stderr var is io.Discard whenever
os.Stderr is not a terminal (schema.go:26-37) — it was introduced for
routine per-migration progress lines, where discarding off a tty is
correct. Wiring the watchdog to it inherited that gating, so the WARN was
emitted only on an interactive terminal and silently dropped under bd
serve, systemd, CI and any piped invocation: precisely the situations
where a migration still running after twenty minutes is worth knowing
about. On a tty it worked, which is why it was not caught earlier.
Routes the watchdog through its own writer instead. This is not a new
convention for the package — remote_migrate_gate.go, smart_remote_migrate
_gate.go and both schema-skew notices in this file already write operator
warnings straight to os.Stderr, ungated, for the same reason. stderr keeps
its terminal gating and its progress lines.
Chose the writer over the alternative the review offered (scoping the doc
comment to "interactive runs"), since the feature's stated purpose in
be-m65rs is telling an operator reading logs that a migration is still
working — and logs are the non-tty case.
Turns TestRunMigrationsWatchdogSurvivesNonTTY green; it asserts through
runMigrations rather than on the package var, so the wiring at the call
site is what is under test.
Refs be-lotba.
* fix(schema): accept a bare-seconds watchdog interval, matching parseTimeout
Review #5997 nit. BEADS_MIGRATION_WATCHDOG_INTERVAL=300 fell back to the
5m default instead of meaning 300s, so an operator changing the value got
the number they were trying to change and no diagnostic.
The doc comment claimed to follow internal/storage/dolt/store.go's
timeoutFromEnv, but only its unset/invalid-falls-back shape. timeoutFromEnv
is a one-line wrapper; the contract lives in parseTimeout below it, which
retries an unparsable value as raw+"s" so bare numbers mean seconds. This
function skipped that half, so the comment promised a convention the code
did not implement. Now mirrors parseTimeout's full shape — including its
non-positive handling on both branches — and cites parseTimeout by name,
since that is where the behavior being mirrored actually is.
On the review's related note that d > 0 is the only floor: that is
deliberate and is also parseTimeout's only floor. Diverging here would
make the two disagree again, which is what produced this nit. Happy to add
a minimum on both together if you want one.
Not reused directly because parseTimeout is unexported in another package.
The interval table gains bare-seconds cases; 90 and 600 rather than the
review's 300, since 300s is the 5m default and so cannot distinguish
"parsed as seconds" from "fell back".
Refs be-lotba.
* docs(changelog): add the migration watchdog to Unreleased
Review #5997 nit: a new user-facing env var and a new WARN line earn an
Deliberately CHANGELOG only, not docs/reference/configuration.md — even
though BEADS_FSCK_TIMEOUT, the sibling this env var's parsing mirrors, has
a row in that page's table. docs/ describes the pinned release
(docs/cli-docs.pin is v1.2.2, which does not contain this feature) rather
than main, per engdocs/decisions/2026-07-17-docs-release-pin.md. The table
row belongs with the pin bump at release time; adding it now would
document a flag no released bd accepts.
Refs be-lotba.
* fix(bazel): list migration_watchdog_test.go in the schema go_test srcs
Base added internal/storage/schema/BUILD.bazel after this PR's merge base,
enumerating go_test srcs file by file. The PR's new migration_watchdog_test.go
was therefore absent from it, so under Bazel the target reported
"Executed 1 out of 1 test: 1 test passes" while running NONE of the new tests
("testing: warning: no tests to run") -- a silent green.
Measured both ways on the adopted head: without this entry 0 watchdog tests
run; with it, all 7 tests and 8 subtests execute and pass
(bazel test //internal/storage/schema:schema_test). The enumeration is
maintained at 100% repo-wide -- all 56 unlisted test files are
//go:build-tagged -- so this file would have been the only untagged omission.
Maintainer fixup applied during PR adoption's rebase gate. No contributor
code changed; the contributor could not have seen this file, which did not
exist at the merge base.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(schema): scope the watchdog promise to the migration body, stop the warner on panic
Maintainer fixup applied during PR adoption's review loop (iteration 1),
addressing the one major plus the three non-gating findings in the review
synthesis. No contributor commit was rewritten.
Major -- Change Impact / Blast Radius (scope). The watchdog wraps only
execMigrationBody, while a migration step also runs the dirty-table snapshot,
preMigrationRepair, the cursor INSERT and commitMigrationStep -- and this file
already says the per-step DOLT_ADD/DOLT_COMMIT is "the expensive, fallible part
of this step on the production embedded path". The CHANGELOG therefore
over-promised: it told users a wedged migration no longer "looked identical from
outside", which is false for a wedge in that commit. The synthesis offered two
arms and said explicitly not to do both. Taking the minimal-sufficient arm:
CHANGELOG.md now scopes the guarantee to the migration body and states that a
stall in the per-step commit is still quiet, and a comment at the call site
records that the narrow boundary is deliberate, and why. The extension arm was
declined on cost: widening the wrap means moving the snapshot/commit ordering
that carries this loop's atomic-commit contract (#4566, #4690), under a
strict-ordered sqlmock expectation set and the cross-package
migrateStepFaultHook tests -- more risk than an observability-only change should
carry. Measured: this fix leaves runMigrations at gocyclo 16 / gocognit 29,
byte-identical to before, whereas nesting the whole step in a closure would have
driven the cognitive score well past its current band.
Minor -- Resource Lifecycle & Cleanup. close(done)/wg.Wait() moved into a defer.
A panic out of fn skipped the straight-line close and orphaned the ticker
goroutine, which then went on warning about a migration that was no longer
running, for the life of the process, on the deliberately un-gated
watchdogStderr. Reachability is open rather than proven
(internal/httpapi/server.go:1406 recovers everything but http.ErrAbortHandler
and keeps serving), which is the argument for taking the one-keyword fix. Pinned
by a new test: against the pre-fix schema.go it reds with "3 WARN lines when the
panic unwound, 8 after a further 50ms"; with the defer it passes under -race.
Minor -- Test Evidence Quality. TestMigrationWatchdogIntervalDuration's
"unset_defaults_to_5m" arm never unset anything, so the ambient environment flowed
straight into the call. Two-arm control: with BEADS_MIGRATION_WATCHDOG_INTERVAL=600
exported the old arm reds ("= 10m0s; want 5m0s") and the fixed arm passes, with the
subtest confirmed to have actually run rather than being filtered out.
Nit -- Contract & Interface Fidelity. BEADS_MIGRATION_WATCHDOG_INTERVAL added to
docs/reference/configuration.md's env table, beside the BEADS_FSCK_TIMEOUT row
whose duration contract it mirrors.
Validation: go test ./internal/storage/schema/ -count=1 green (41s); 8 watchdog
tests + 8 subtests PASS, 0 SKIP, 0 FAIL; gofmt clean; go vet clean; git diff
--check clean; ./scripts/check-doc-freshness.sh PASSED.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(bazel): list golang.org/x/term in the schema go_test deps
migration_watchdog_test.go imports golang.org/x/term directly. Under Bazel
it compiled only through embed = [":schema"], but gazelle lists a test
file's own imports in the go_test's deps, so `bazel run //:gazelle`
rewrites this BUILD file. Since the base now gates PRs on the Bazel lanes,
BAZEL_TEST's "BUILD files in sync (gazelle, go_srcs, MODULE.bazel)" step
would fail on exactly this one line. This is the line gazelle produces.
Measured on the adopted head refreshed onto current main: the whole CI sync
step run locally (go_srcs.py --check, bazel run //:gazelle, go_srcs.py,
bazel mod tidy) leaves this line as the only drift in the repository.
With it, bazel test //internal/storage/schema:schema_test --config=ci
passes: 433 test cases, 0 failures, all 16 watchdog cases run (0 skipped),
and tools/bazel/check_testcases.py plus equivalence.py report no schema
divergence.
Maintainer fixup applied during PR adoption's pre-approval CI repair. No
contributor code changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* perf(ready): recurse the descendant walk off indexed base tables (be-qfm)
`bd ready --parent` and `bd blocked --parent` compute the parent's
transitive descendants with a recursive CTE whose edge relation was a
non-recursive `parent_edges` CTE over `dependencies UNION ALL
wisp_dependencies` with the typed target columns COALESCE'd into one.
Dolt cannot index through that wrapper: it materializes the relation and
re-scans it once per recursion row, so the walk costs (parent-child rows)
x (descendants) — 7.46 s for 483 descendants on a 4.6k-edge database,
about 14 ms per descendant, and past the shared pool's read deadline on
a busy server.
Build the walk in sqlbuild.DescendantWalkQuery instead: one anchor and
one recursive member per (dependency table x typed target column), each
joining the base table on a bare indexed column, with per-column IS NULL
guards reproducing the COALESCE precedence and the LOCATE cycle guard,
depth guard and parent-child filter carried onto every member. The
recursive members carry JOIN_ORDER(d,e) LOOKUP_JOIN(d,e): the cycle guard
references both join sides, and without the hints Dolt's planner keeps
the recursive working table on the inner side and scans the edge table
per iteration, which measured no faster than the wrapper shape and
flipped plans between runs. With them the frontier is the outer side and
every member is an index probe.
issueops.GetDescendantIDsInTx and domain/db.getDescendantIDs call the
builder; they had carried the same query text separately.
Measured on a local Dolt 2.2.4 sql-server with a generated forest of
4,541 issues, 4,500 parent-child rows and 500 descendants under the
probed parent (BenchmarkDescendantWalk, new): 1.26–2.28 s/op on main,
32–36 ms/op with this change. Same rows on every target kind, cycle
and depth limit (TestDescendantWalkReachesEveryTargetKindAndStopsOnCycles,
new; the conformance ReadyParentScopesToItsTransitiveDescendants cases on
all three backends).
Refs #6128
Co-authored-by: qcore/syl <q@withq.ai>
Agent-Signature: claude-code-claude-fable-5-max on behalf of a3ackerman
* test(embeddeddolt): gate the descendant-walk reference test on cgo (be-qfm)
The embedded-Dolt test tier is cgo-only and every sibling file carries
the build tag; this one did not, so the CGO_ENABLED=0 boundary job
compiled it against a package whose helpers were excluded and failed on
an undefined newTestEnv.
Refs #6128
Agent-Signature: claude-code-claude-fable-5-max on behalf of a3ackerman
* fix(review): sync BUILD.bazel srcs and resolve every dep target column in the descendants CTE
Maintainer fixup from the PR #6130 adoption review, iterations 1 and 2.
Bazel srcs gap (major, claude+codex). The four new .go files were absent from
the gazelle-managed go_library/go_test srcs lists, so
//internal/storage/sqlbuild did not contain DescendantWalkQuery and both
consumers failed to compile under Bazel:
internal/storage/issueops/blocked.go:170:13: undefined: sqlbuild.DescendantWalkQuery
internal/storage/issueops/blocked.go:171:13: undefined: sqlbuild.DescendantWalkArgs
`make bazel-sync` adds exactly the four srcs rows the review measured; the
fifth BUILD.bazel row is a deps entry this commit's own new test requires.
A second sync leaves the tree clean. Note that `make bazel-sync-check` and
tools/bazel/go_srcs.py --check pass falsely on a srcs gap -- they manage only
the go_srcs glob filegroups -- and bazel-autofix cannot absorb this one
because bazel.yml:313 guards the sync step on steps.bazel.outcome ==
'success', which a compile break never reaches.
buildDescendantsCTE target columns (major, codex). GetDescendants' walk
resolved a row's parent through COALESCE(depends_on_issue_id,
depends_on_wisp_id), omitting depends_on_external, while the classic ParentID
filter it mirrors resolves all three and the reference test this PR adds makes
a cross-prefix parent a pinned contract for the sibling walk. ck_dep_one_target
(migration 0041) leaves exactly one target column set, so an external-target
row coalesced to NULL and could never match an edge: adding the column is
strictly additive, and it closes a gap where the proxied-server
bd list --parent tree (and --watch) could not see a cross-prefix child or
its subtree, while the direct route's per-level ParentID filter listed them.
TestBuildDescendantsCTEResolvesEveryDepTargetColumn derives the expected
column set from sqlbuild.DepTargetExpr, so the two cannot drift again.
That finding's other half -- migrating these members to the per-(table,
column) shape -- is deliberately deferred to bd-tztam and recorded at the
site. buildDescendantsCTE is a different query ((id, src, via) projection, a
dotted-ID fallback recursion, hoisted per-level filter predicates, no depth
cap, no path cycle guard), sqlbuild exports no member-fragment API, and
per-column members would triple its branch count, which the predBundle
comment above it records as tripping the dolt 2.1.6 analyzer.
nullGuards precedence and column binding (minor, claude+codex; minor, codex).
TestDescendantWalkQueryReproducesDepTargetPrecedence pins the per-column
IS NULL guards, which no existing test could see: the shape test never asserts
on a guard and the reference test seeds exactly one target column per edge, so
emptying nullGuards left both new test files green. The expected counts are
derived from DepTargetExpr's column list rather than restated, so the same
test binds descendantWalkTargetCols to it. The review's prescribed
`DepTargetExpr = "COALESCE(" + strings.Join(descendantWalkTargetCols, ", ")
+ ")"` does not compile -- issueops/dependencies.go:58 and
domain/db/dependency.go:35,:37 consume it in const declarations -- so this
takes the unit-assertion arm the same finding offers.
LOOKUP_JOIN warning multiplicity (nit, codex). The doc comment now records
that the ignored-hint warning is raised once per hint comment, six per
includeWisps=true query.
Iteration 2 (two minors, gate impact none, on a 981/850 approve).
TestGetDescendantsCrossPrefixParent pins the widened COALESCE against real
rows, where the test above pins only query text. Its edges go through the
repository's own classifier, which routes any cross-prefix target to
depends_on_external even when both ends are local, and each of its four
edges is matched by a different edge member (issues and wisps, anchor and
recursive): reverting the column at any one member reds the case with a
different set of children missing. CHANGELOG.md gains a Fixed bullet for
the user-visible half of this change, the proxied-server bd list --parent
tree.
Validation: sqlbuild 31 PASS / 0 FAIL / 0 SKIP; full domain/db package green
against the real Dolt container (915 PASS / 0 FAIL / 0 SKIP, 49s),
including TestGetDescendantsCrossPrefixParent,
TestGetDescendantsDottedOrphans, TestGetDescendantsFilteredByStatus and
TestParityReadyBlockedDescendants; golangci-lint 2.10.1 reports 0 issues on
the three changed packages; go test -run Bazel ./scripts/ is 13 PASS / 0 FAIL,
including TestBazelTestTagsFollowTaxonomy; bazel test
//internal/storage/sqlbuild:sqlbuild_test PASSED and bazel build
//internal/storage/domain/db:db_test succeeds; a final make bazel-sync
leaves the tree unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: qcore/syl <q@withq.ai>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(dep): teach bd dep cycles to traverse tracks edges (gc-818bx)
Adds DetectCyclesRequest.IncludeTracks and a CanonicalMixedCyclePaths
walk so a molecule-root deadlock closing through a tracks edge (root
--blocks--> its own entry step, step --tracks--> root) is detectable,
while a cycle made entirely of tracks edges stays silent by
construction (guards against the PR #4933 false-positive regression).
Wired end to end: public issueops.DetectCyclesRequest -> pure
CanonicalMixedCyclePaths/AppendMixedCycleGraphInTx ->
DetectCycleReportInTx -> dolt/embeddeddolt/uow-domain transactional
wrappers -> `bd dep cycles --include-tracks`. Default request behavior
is unchanged (byte-identical code path when IncludeTracks is false).
Tests: pure-function unit tests for the new DFS variant (rotation,
parallel-edge dedup, self-loops, map-order determinism); conformance
cases against both dolt and embeddeddolt real backends plus the uow
provider (RunCycleDetectorIncludeTracksIgnoresAPureTracksLoop,
RunCycleDetectorIncludeTracksFindsTheMoleculeRootShape, and an added
DepTracks case in RunCycleDetectorFollowsOnlyBlockingEdges pinning the
default's exclusion); CLI-level flag registration and threading tests.
Scope: fix candidate 3 only, per gascity-pl's 2026-08-10 scope-narrowing
comment on gc-818bx (candidates 1/2 addressed upstream by gastownhall/
gascity PR #5202).
* fix(dep): find mixed cycles by SCC instead of single-pass DFS (gc-818bx)
CanonicalMixedCyclePaths could report no cycle for a graph that has a
qualifying one. A single global visited/onPath set only detects a back
edge to a node still on the active recursion stack, so a tracks-only
loop that fully closes and unwinds first (a->b->a) leaves b marked
visited-but-off-path by the time a scheduling edge into the same
component (a->c->b) is examined, and the c->b return edge is invisible
to the DFS.
Every internal edge of a strongly connected component lies on some
cycle within it, so replace the DFS with Tarjan's algorithm: find each
SCC, and for any SCC containing a scheduling edge, walk a deterministic
BFS return path back to that edge's source. Nodes, adjacency, SCC
membership, the chosen edge, and the return path are all sorted so the
result stays a pure function of the graph, matching the existing
determinism guarantee.
Adds the counterexample from exact-head review: a--tracks-->b,
b--tracks-->a, a--blocks-->c, c--tracks-->b, which the prior
implementation reported as acyclic despite the qualifying a->c->b->a
cycle.
* fix(dep): fail loudly if SCC path invariant breaks (gc-zo8a7)
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of sjarmak
* fix(dep): keep every default cycle in the --include-tracks report
CanonicalMixedCyclePaths emitted one cycle per strongly connected
component, so a tracks edge joining two separate blocks-only deadlocks
collapsed them into one reported cycle and --include-tracks could report
fewer cycles than the default walk.
The widened report is now the union of the default depth-first walk on the
scheduling-only subgraph and, for each blocks/conditional-blocks edge
inside a component of the widened graph, that edge closed by its shortest
return path over either edge type. The first set is the default report by
construction; the second adds cycles that close through tracks edges. Every
reported cycle still contains a scheduling edge, so tracks-only loops stay
out. The report holds at most one cycle per internal scheduling edge plus
the default cycles.
A missing return path inside a component is an invariant breach; it now
returns an error through DetectCycles instead of panicking.
* test(dep): pin tracks edge direction in the cycle detector contract
A two-node cycle reads the same under edge reversal, so the existing
IncludeTracks cases could not tell a walk that follows issue_id ->
depends_on_id from one that follows the reverse. The new three-node case
seeds a -> c (tracks), c -> b (blocks), b -> a (tracks), whose reported
path is a, c, b and becomes a, b, c if the edges are reversed.
Also refresh the cycledetector.go line citations this branch shifted.
* perf(dep): share one return-path search per target in the --include-tracks report
CanonicalMixedCyclePaths ran one breadth-first search per scheduling edge
inside a component, O(E(V+E)). On a dense tangle E grows with the square of
V, so the report grew with the fourth power of the component size.
Group the component's scheduling edges by target and close every edge into a
target from one shortestPathTree rooted there, confined to the component.
closeMixedCycle now reads the return path out of that tree and still returns
an error, never loops, when the tree does not reach the edge's source.
TestShortestPathTreeClosesEachEdgeAsAPerEdgeSearchDid checks over generated
graphs that each edge closes to the cycle reachPath produced for it alone,
ties included. BenchmarkCanonicalMixedCyclePathsDenseTangle (80 issues, a
blocks edge for every ordered pair, one tracks edge back): 26.3 ms and
27.8 MB per call before, 5.4 ms and 2.8 MB after.
* fix(dep): scope the --include-tracks guarantee and bound its output
Review iteration 1 (maintainer fixup) for the one gating major. The
IncludeTracks doc claimed that requiring "at least one blocks/
conditional-blocks edge" on every reported cycle is what keeps out the
`bd doctor` regression that "produced thousands of cycles". That rule is
NECESSARY, NOT SUFFICIENT. One tracks-only loop fuses everything it
touches into a single strongly connected component, after which every
scheduling edge inside that component lies on a cycle and is reported --
even where those scheduling edges alone are strictly acyclic and the
default walk reports nothing. A 10-step molecule whose entry step tracks
back to its root yields 9 reports against the default walk's 0.
The doc's own BOUND paragraph conceded the volume ("never more than twice
the distinct scheduling edges") while the paragraph above it claimed the
guard prevented it. The algorithm is correct and is unchanged; what was
wrong is the contract written over it, plus the absence of any cap on a
diagnostic that can now be edge-count sized.
A census found the claim in 5 sites, not the 2 the review cited:
issueops/cycledetector.go IncludeTracks field doc
internal/storage/issueops/cycle_report.go the BOUND paragraph
internal/storage/issueops/cycles.go AppendMixedCycleGraphInTx
cmd/bd/dep.go flag registration comment
internal/storage/issueops/cycle_report_test.go section header
backend/conformance/cycle_detector_contract.go:246 already scoped it
correctly ("a loop made entirely of tracks edges stays silent") and is
left alone. The PR body and the contributor's commit messages assert only
the true narrow rule, so neither needed correcting.
--limit caps the RENDERED list (default 50, 0 = no limit), matching the
idiom in list/search/stale/find_duplicates. It is a rendering cap and not
a narrower request because CycleReport.Cycles promises to omit no cycle:
the printed total stays the whole report's, the truncation says how much
it held back, and --json is never capped.
TestCanonicalMixedCyclePathsBoundsAFusedMoleculeByItsSchedulingEdges pins
the manufacture direction ...KeepsDeadlocksATracksEdgeFuses left open --
that one fuses two real deadlocks and checks neither is lost; this one
fuses none at all and still gets 9 reports.
Also taken, both non-gating: dropped the dormant
`json:"include_tracks,omitempty"` tag, since no serializer of
DetectCyclesRequest exists in the tree and handleDependencyCycles calls
requireNoQuery, so the tag advertised a wire contract the server refuses;
and added a comment naming the backend conformance cases as the only pin
on the row->edge admission switch.
Declined this iteration: factoring appendDependencyGraphInTx and
AppendMixedCycleGraphInTx onto one shared row loop (nit, gate impact
none). It restructures the SQL read path that, per the finding directly
above it, is pinned only at the conformance layer, and
appendDependencyGraphInTx also backs AppendSchedulingGraphInTx -- the
write-time gate behind every `bd dep add`. That is a wider blast radius
than a zero-gate-impact nit earns inside a fixup whose subject is a doc
overclaim; it belongs in its own change.
Validation: go build ./... clean; go vet clean on the 4 touched packages;
golangci-lint v2.10.1 reports 0 issues on issueops/...,
internal/storage/issueops/... and cmd/bd/...; internal/storage/issueops
full package 749 PASS / 0 FAIL / 0 SKIP (748 before, +1 new); cmd/bd
dep-cycles selector 9 PASS / 0 FAIL / 0 SKIP; internal/httpapi
Cycle|SpecParity 6 PASS / 0 FAIL. Mutation: making tracks edges unable to
fuse a component reds the new pin plus 5 incumbents (the feature dies);
reporting only one cycle per component reds the new pin ALONE (1 of 14),
so it covers a degradation no existing test catches.
Review iteration 2: the remedy above re-entered its own finding class. Both
iteration-2 items indict text THIS fixup wrote, not the contributor's.
The --limit cap is UNCONDITIONAL -- `if limit > 0 && len(shown) > limit` never
consults includeTracks -- yet every rationale iteration 1 wrote for it was
scoped to the widened walk, and the IncludeTracks field doc still closed with
"the base walk this type's doc above describes is unchanged". True of the walk;
false of its rendering, since plain `bd dep cycles` printed every cycle at base
and now prints at most 50. That is the same defect class as the major this
commit exists to fix: a doc claiming a scope the mechanism does not honor.
Of the two arms the review offered, only documenting the true scope is
available. Gating the cap on includeTracks reds this PR's own incumbent test:
printCycleReportForTest calls runDepCycles(false, limit), so
TestDepCyclesTruncatesTheRenderedListButNotTheCount/capped asserts the DEFAULT
walk truncates. Measured, not assumed -- that arm fails capped and
registered_default while no_limit passes. The implementation, the flag's help
string and the tests already agreed the cap is unconditional; only the prose
disagreed, so the prose moved:
cmd/bd/dep_cycles.go runDepCycles doc: the cap is unconditional, bounds
both walks, and names the behavior change vs base
cmd/bd/dep.go flag comment: caps both walks; the widened walk is
what makes the cap necessary, not what scopes it
issueops/cycledetector.go the "Default false" closer: the walk is unchanged,
its RENDERING is not
Also the nit: the opening paragraph argued no flag can narrow either question
while --limit had no carve-out, where IncludeTracks had one. It now says no flag
narrows the ANSWER, and that --limit caps only what is PRINTED.
New renderer arm "registered default" closes the gap the minor named: every
existing arm drove an explicit limit, so the shipped 50 was pinned only by
TestDepCyclesLimitFlagRegistration's DefValue != "0". It reads the default off
the command and renders past it, so it tracks whatever ships; ids are
fixed-width so "past the cap" cannot match as a prefix of one inside it.
Mutation (3 arms, control restored byte-identical by cp -- the fixset was
uncommitted): gate the cap on includeTracks => capped + registered_default RED;
default 50 -> 0 => LimitFlagRegistration + registered_default RED (the new arm
independently catches an unbounded default); shown[:limit+1] => capped +
registered_default RED, so the arm pins the boundary and not merely "some
truncation". no_limit stays green under all three by design.
Validation: gofmt clean, git diff --check clean, go build ./... rc=0, go vet
clean on cmd/bd and issueops, cmd/bd dep-cycles selector 9 PASS / 0 FAIL / 0
SKIP (same top-level roster, +1 subtest). No production behavior changed this
iteration -- doc text plus one test arm.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: sjarmak <t@t.co>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* docs(testutil): document migration-0032 hang and container-leak caveats (refs be-r7j5x)
Adds a comment near DoltDockerImage documenting two known limitations
of the podman-rootless + testcontainers-go real-server test harness:
- Schema migration 0032 hangs indefinitely over the sql-server wire
protocol in this harness only; not reachable on real GitHub Actions
CI or a bare-host-process dolt sql-server (be-j3szz).
- Containers can leak because Ryuk is disabled for this harness, so
there is no reap safety net if a test process skips its cleanup
(be-5kkk6).
No production code changes.
* docs(testutil): fix Ryuk-disabled citation and causal claim (refs be-ohrc0)
Round-1 review (be-ohrc0) flagged that the container-leak bullet cited
be-hsa9t for the TESTCONTAINERS_RYUK_DISABLED=true rationale and claimed
it was a workaround for this host's broken dockerd/containerd. Neither
is accurate: be-hsa9t is an unrelated git-remote E2BIG fix that never
mentions Ryuk or dockerd/containerd.
Corrects the citation to be-w3n2m (open, undecided) and the causal claim
to match its actual finding: under rootless podman, Ryuk frequently
cannot start because it wants the runtime socket.
No production code changes.
* docs(testing): move the Dolt container caveats out of DoltDockerImage
Review #6001 asked for this to leave the source file, on three grounds
that all check out.
CONTRIBUTING_PR_GUIDELINES.md line 33 is explicit — "Minimize inline code
comments … let the commit message and PR description carry the why" — and
a 23-line comment-only diff is the shape it names. DoltDockerImage is also
the wrong hook: it is the image pin guarded by test/docsync/doltpin_test.go
and read by container_provider.go and testdoltserver.go, so harness
lifecycle lore attached to it reaches every caller including CI.
The Ryuk sentence was also wrong as written. It claimed Ryuk "is disabled
for this harness (TESTCONTAINERS_RYUK_DISABLED=true)". This repository sets
that variable nowhere — not in Go, scripts/, the Makefile, or
.github/workflows/; the only tracked occurrences are release-gates/*.md,
which are records of operators' local podman runs. CI therefore runs with
Ryuk enabled, and the original text described a local shell as if it were
the repo's harness. Reworded to say what is true: the podman-rootless flow
generally requires disabling Ryuk by hand, and doing so is what removes the
safety net.
Both caveats now live in engdocs/TESTING.md as a sibling of "Test
Environment and Readiness", the section that already covers
BEADS_TEST_SKIP=dolt and BEADS_TEST_ENV_RUN_DOLT. Content is otherwise
preserved, including the be-j3szz / be-w3n2m / be-5kkk6 evidence chain, plus
a stray-container check and a pointer to testMainInner in beads_test.go.
engdocs/TESTING.md is not in check-doc-freshness.sh's DOCS list, so this
needs no inventory or freshness marker.
internal/testutil/testdoltcommon.go is now byte-identical to main.
Addresses the doc half of #6171. Refs be-8n9ns.
* docs(testing): scope the Dolt caveats to podman-rootless and fix the repro
Maintainer review fixes for PR #6001 (adopt-pr review iterations 1 and 2).
All edits are phrase-level and confined to engdocs/TESTING.md.
- Scope the causal claim to the podman-rootless path. CI runs the same
containerized wire path green on every risk-tier PR -- pr-risk.yml's
test-server-storage* jobs pull the pinned image precisely to defeat the
self-skip and run with no BEADS_TEST_SKIP=dolt -- so "the container
port-forwarding path" as a general cause is refuted by the repo's own CI,
and as written invited a Docker developer to dismiss a real 0032/initSchema
hang as a known harness limitation. Softened "Neither is reachable ... on
GitHub Actions" to "Neither failure mode manifests ...", which is what is
actually true.
- State every way a suite reaches a real dolt sql-server. The entry condition
named one mechanism (testcontainers-go) and one fallback (self-skip), but
the uow package the section uses as its repro also has suites that call
testutil.RequireDoltBinary and start a server from the local dolt CLI
(proxy.BackendLocalServer) with no container involved, and lanes that set
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 fail rather than skip. The sentence now
covers all three and scopes the two limitations to the containerized path.
The testcontainers leg says "by default" so it stays true once main's
BEADS_TEST_DOLT_SERVER=local backend section merges above it, without
forward-referencing a section this branch does not have.
- Attribute the two failure shapes separately. The fenced banner could not be
produced by the repro printed beside it: the uow entry points pass
context.Background(), so context deadline exceeded has no producer there;
the only 60s in the uow package is bo.MaxElapsedTime, a backoff budget that
backoff.Retry consults only between attempts and which therefore cannot
bound a hang inside one. The banner's only producer is store.go's
"failed to initialize schema: %w" inside newServerMode, the server-mode
store open, which runs initSchema with the caller's context -- so the doc
names that path. (Iteration 1 labelled it the embedded-store open, which
contradicted the section's own statement that the embedded/CLI engine does
not hang.) Kept the uow "sits until the package timeout" sentence (the
accurate half), dropped the unverifiable ~60s figure, and dropped the
"failed to create embedded DoltStore: " prefix, which has zero occurrences
in the tree, so the quoted line is greppable.
- Make the stray-container check runnable under the flow the section is about.
A bare docker ps talks to the CLI's default endpoint and returns a false
all-clear on exactly the leaked-container incident the paragraph cites; it
now carries DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock, the
form all six in-repo records of this flow use.
- Close the image-pin duplication without touching the guard, and make the
read fail loudly. The command read the tag from a hand-copy outside
test/docsync/doltpin_test.go's reach; it now reads it from
internal/testutil/testdoltcommon.go, resolved from the repository root with
git rev-parse --show-toplevel so it works from any directory in the tree.
An empty read would reproduce the false all-clear (docker ps --filter
ancestor= exits 0 listing nothing), so the tag is expanded as
${dolt_image:?...}, which refuses to run docker without it. A trailing
"[ -n ... ] || { ...; return 1; }" guard does not do that when pasted at an
interactive prompt: a top-level return stops neither bash nor zsh, and the
next line still runs docker with an empty filter. Deliberately NOT added to
doltpin_test.go's scanned set: doltPinImageRE requires the assignment form
DoltDockerImage = "..." which cannot appear in prose, and find() t.Fatalf's
on a miss, so that would red a currently green test.
Validation: git diff --check clean; go test ./test/docsync/ 8 PASS / 0 FAIL /
0 SKIP with TestDoltVersionPinsAgree green; scripts/check-doc-freshness.sh
exit 0; the snippet extracted from the doc passes bash -n and zsh -n, resolves
dolthub/dolt-sql-server:2.2.0 from the repository root and from a
subdirectory in interactive bash and zsh, and outside a repository prints the
error without running docker (checked against a stub docker).
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>
* 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>
* test(init): red — existing project with missing server DB must refuse init
be-5up5: server mode never has a local dolt/ directory, whether this is a
genuine fresh clone or an existing project whose database was lost from the
server — doltDirExists==false alone (GH#2433's signal) can't distinguish
them. Adds TestInitGuard_ExistingProjectMissingServerDB_Refuses, which spins
up a real dolt sql-server with no database and a metadata.json carrying a
non-empty project_id (proof of a prior real init). Currently fails: the
guard returns nil and lets init silently recreate the database as empty,
which is the 2026-08-11 fleet-wide data loss.
RED only — checkExistingBeadsDataAt is not yet fixed.
* fix(init): refuse to recreate a missing server-mode database (be-5up5)
bd init's server-mode "already initialized" check treated a missing or
unreachable database the same as a genuine fresh clone, silently
returning nil and letting init proceed to create an empty database —
even when metadata.json's project_id proved this was an existing
project whose database had gone missing (the 2026-08-11 fleet-wide
data loss).
Guard on cfg.ProjectID != "" to distinguish the two cases. An existing
project now gets a refusal (initGuardMissingServerDBMessage) that
names bd doctor / bd dolt status / bd backup restore as the recovery
path and explicitly does not recommend bd bootstrap, since bootstrap
has its own related mode-blind create bug (tracked separately). A new
--recreate-missing flag is required to opt into creating fresh in this
case — never implied by --force, config, or env. Genuine fresh clones
(empty project_id) are unaffected.
Also:
- doctor/gitignore.go: drop the "bd init (safe to re-run)" fix hint,
since re-running bd init is exactly the unsafe action this fix
prevents in the case that matters.
- storage/dolt/errors.go: the general "database not found" hint no
longer claims bd bootstrap is a safe first step for "an existing
project" — only for genuine fresh-clone / shared-server-recovery,
which is what the existing tests actually cover.
* test(init): pin exit_contract's bootstrap-not-recommended requirement (be-5up5)
TestInitGuard_ExistingProjectMissingServerDB_Refuses checked the refusal
and the absence of --force, but not the exit_contract's explicit "does
not recommend bd bootstrap for a server-mode workspace" requirement —
that was only verified by hand during self-review. Pin it directly, and
assert the message names an actual recovery path.
* test(init): cover --recreate-missing positive path (be-ab3b)
be-5up5's guard already correctly permits init to proceed when
--recreate-missing is set; only the negative path (flag absent -> refuse)
had test coverage. Adds TestInitGuard_ExistingProjectMissingServerDB_
RecreateMissingAllows, covering both guard sites the flag gates:
init.go:2566 (server reachable, database confirmed missing) and
init.go:2578 (server unreachable / errored during the check).
refs be-3mvz (review round 1 request-changes), closes be-ab3b
* chore: release gate PASS for bd init missing-server-DB guard fix (be-udx2)
* chore: record full pre-PR contributor check results for be-udx2 gate
* test(init): red — bd init --force recreates a missing server DB as empty
--force is a deprecated alias for --reinit-local (init.go ~395), and the
existing-data guard is gated on !reinitLocal (~763), so --force skips
checkExistingBeadsData — and with it the be-5up5 missing-database refusal
this PR added. The reinit path's own typed confirmation does not cover the
gap either: it keys on countExistingIssues, which returns 0 or an error in
exactly the case where the server-side database is missing, so no prompt
and no destroy token are ever required.
Net effect at this commit, measured against a real dolt sql-server
(2.2.3) holding no "myproject" database, with metadata.json carrying a
project_id:
$ bd init --force --prefix myproject --skip-hooks
...
Database: myproject
Issue prefix: myproject
Run bd quickstart to get started.
$ echo $?
0
$ ls <server data-dir>
config.yaml .dolt .doltcfg myproject <-- created, empty
An empty database at the name the real one used to occupy, exit 0, no
prompt. That is the 2026-08-11 fleet-wide data-loss reflex, reached
through the flag an operator in a panic is most likely to reach for.
This test drives the real binary because that is the only way to exercise
the --force -> reinitLocal -> "skip the guard" path end to end; a unit
test on the guard function cannot see that the caller never runs it.
Both subtests fail at this commit.
Reported in review of PR #5791 by bee-ghosttrack, item 1.
* fix(init): green — --reinit-local/--force cannot bypass the missing-DB guard
Add guardMissingServerDatabaseAt, a narrowed form of the be-5up5 refusal
that answers only one question — is this an already-initialized
server-mode project whose configured database is missing or
unconfirmable? — and run it on the reinitLocal path, which
checkExistingBeadsData never reaches.
The distinction the guard encodes: --reinit-local/--force authorize
destroying a database that EXISTS. They do not authorize inventing an
empty one where the configured database has gone missing. Only the
explicit, per-invocation --recreate-missing does that, which is what makes
that flag's "never implied by --force" help text an honest guarantee
rather than an aspiration. The review suggested softening that help text
instead; making the claim true seemed better than documenting that it
isn't.
Deliberately narrow. It returns nil for every state except the missing
database — no metadata, non-Dolt backend, non-server mode, empty
project_id, or a local dolt/ directory all fall through — so it never
resurrects the "already initialized" refusal that --reinit-local is
legitimately meant to bypass. The "stays silent on a fresh clone with no
project_id" subtest pins that boundary.
Same scenario as the previous commit, now:
$ bd init --force --prefix myproject --skip-hooks
Error:
(warn) Database "myproject" not found on server at 127.0.0.1:34813 ...
bd init will NOT create an empty database here — that would strand any
existing issue data behind a new, empty database of the same name.
$ echo $?
1
$ ls <server data-dir>
config.yaml .dolt .doltcfg <-- nothing created
Addresses review of PR #5791 by bee-ghosttrack, item 1.
* test(init): cover the unreachable-server refuse branch
Review of PR #5791, item 2. The PR claimed
TestInitGuard_ExistingProjectMissingServerDB_Refuses covered both guard
sites — server reachable with the database missing, and server unreachable
or errored while checking. It does not: that test starts a live dolt
sql-server, so it only ever exercises the first. The unreachable site had
coverage on the PERMIT side only (the BEADS_DOLT_SERVER_PORT=1 subtest of
_RecreateMissingAllows), which would not notice if its refusal were
dropped.
TestInitGuard_UnreachableServerRefuses closes that: port 1 is unreachable
by construction, so it needs no dolt binary and runs in the fast lane.
Also drops a comment reference to scripts/repro-bd-init-recreates-empty-db.sh,
which is not in the repo or in this diff (item 3, third bullet), and
describes the state the test sets up instead.
Addresses review of PR #5791 by bee-ghosttrack, item 2.
* docs(init-safety): document --recreate-missing and its known limits
Review of PR #5791, item 3 (doc drift), plus the non-blocking note.
The flag's own help pointed users at `bd help init-safety`, whose FLAG
SURFACE section did not list it — so the one place the help sends you was
the one place it was missing. Added there, stating plainly that it is
per-invocation only and never implied by --force/--reinit-local, config,
or env.
docs/recovery/init-safety.md gains an init-missing-server-db section (and
a TOC entry) covering the refusal users will actually hit: why the
fresh-clone and lost-database cases are indistinguishable from the local
filesystem in server mode, why the old "assume fresh clone" answer caused
the 2026-08-11 loss, and the three ways out in the order they should be
tried — diagnose the server first (a stopped server or wrong --data-dir
presents identically and needs no re-init), then restore from an export,
then --recreate-missing as the deliberate last resort.
Both limits the review flagged as non-blocking are recorded there and in
the guard comment rather than left as folklore:
- The guard keys on project_id, minted by GH#2372. A pre-GH#2372 workspace
carries none and is indistinguishable from a fresh clone, so it FAILS
OPEN. Accepted deliberately — failing closed would block legitimate
first inits on every such clone, and this guard's job is to stop a
silent recreate where prior initialization can be PROVEN, not to guess
where it cannot.
- Server mode only. Proxied-server mode returns early on a missing root
and never reaches the guard, and bd bootstrap has its own separate
mode-blind create path.
Addresses review of PR #5791 by bee-ghosttrack, item 3 and the
non-blocking notes.
* docs(changelog): record the --force missing-database bypass fix
Under Unreleased/Fixed. This is a behavior change to bd init --force on
every server-mode workspace whose database has gone missing, and it was
not recorded anywhere users read.
* fix(init): make the missing-server-database guard fire in shared-server mode
Review round 2, item 1 (blocking): the guard was a no-op in shared-server mode
— the topology of the 2026-08-11 data loss, and so the primary case.
guardMissingServerDatabaseAt statted doltserver.ResolveDoltDir(beadsDir) and
returned early when it was a directory, reading that as "there is local data to
protect". In shared mode ResolveDoltDir returns the machine-global
~/.beads/shared-server/dolt, and SharedDoltDir() MkdirAlls it
(internal/doltserver/doltserver.go:281). The stat therefore always succeeded and
checkDatabaseOnServer was never reached, while every per-project test kept
passing.
Fix per the reviewer's first option: test for THIS project's database directory
rather than the data directory that holds it. A Dolt data dir contains one
subdirectory per database, each with its own .dolt — verified on disk — so
<doltDir>/<dbName>/.dolt is the correct probe in BOTH modes, and it is strictly
more precise in per-project mode too: a data dir that exists but holds no
database for this project no longer counts as local data to protect.
Two new tests, both against a real dolt sql-server rather than an unreachable
port, covering the two cases the reviewer noted were uncovered:
TestInitGuard_SharedServerMode_MissingServerDB_Refuses
reachable server, database absent -> must refuse. This is the actual
loss shape. Reverting the one-line guard change turns it red with
"got nil error"; the pre-existing per-project tests stay green, so it
pins the shared-mode gap specifically.
TestInitGuard_SharedServerMode_PresentServerDB_Allows
reachable server, database present -> must NOT refuse, so --reinit-local
and ordinary reinit keep working. The reviewer verified this by hand and
flagged it as untested.
Also from the same review:
- docs/recovery/init-safety.md overstated the proxied limit. The proxied path
does not reach THIS guard (dispatch at init.go:619 precedes the
initAllowRecreateMissing assignment at :767), but it does reach the older
checkExistingBeadsData (init_proxied_server.go:89) — and because the flag is
never assigned there, --recreate-missing is inert under --proxied-server.
Documented as pre-existing rather than silently fixed.
- Shared-server mode now named explicitly in the same Limits section.
- checkExistingBeedsData typo corrected.
- The "### 3." heading wrapped onto a second line and rendered broken.
Verified: full TestInitGuard suite 15/15 PASS, 0 SKIP (12.1s), including all
pre-existing guard tests. go build ./... clean, gofmt clean, go vet clean.
Refs be-ok1tt, be-udx2.
* test(init): redirect the shared-mode fixtures with BEADS_SHARED_SERVER_DIR
Round-3 MINOR-2, unaddressed through round 4. The two shared-server tests
redirected HOME so SharedDoltDir() would resolve inside the test tree, but
SharedServerPath() reads BEADS_SHARED_SERVER_DIR first and only then falls
back to os.UserHomeDir(). An ambient BEADS_SHARED_SERVER_DIR — the override
that function's own comment advertises for testing — silently won, and the
pair then wrote into and asserted against the developer's real
~/.beads/shared-server/dolt, failing spuriously if a real "myproject" lived
there. HOME is also a no-op on Windows, where os.UserHomeDir() reads
%USERPROFILE%.
Set the variable the resolver actually consults first. No behavior change.
* test(init): make the present-database control pin the early return
Round-3 NIT-4, unaddressed through round 4, and demonstrated there: with the
local-database probe reverted, _SharedServerMode_PresentServerDB_Allows stayed
green, so it pinned nothing of the early return that commit rewrote. It
returned nil via the server check alone, because the fixture never gave this
project a database directory under the shared data dir.
Create that directory, the way a real shared-mode install has one, and then
assert the early return specifically: with the server made unreachable, the
local database directory alone must still satisfy the guard. Removing the
early return now turns this test red.
* test(init): red — the documented --recreate-missing recovery cannot reach its opt-in
Round-3 MAJOR-1 / round-4 finding 1. checkExistingBeadsDataAt derives "is this
project's database here?" from os.Stat(ResolveDoltDir(beadsDir)) — the DATA
directory, which exists on every initialized workspace (shared-server mode
MkdirAlls the machine-global one in SharedDoltDir; per-project mode MkdirAlls
it in ensureDoltInit). So the FR-010 missing-vs-present branch never runs and
both --recreate-missing opt-ins inside it are unreachable.
Four surfaces tell the operator to run `bd init --recreate-missing --prefix
<p>`: the flag help, `bd help init-safety`, docs/recovery/init-safety.md, and
the guard's own refusal text. That command exits 1 with a false "already
initialized" message pointing back at --reinit-local, which is the destructive
path. The documented recovery is a dead end and the only thing that works,
--reinit-local --recreate-missing, is named nowhere.
The existing _Refuses/_RecreateMissingAllows fixtures cannot see this: they
omit the data directory entirely, so their branch condition is true for the
wrong reason. These two add it, which is the state of every real workspace
whose server-side database was dropped.
Both fail at this commit.
* fix(init): green — probe this project's database directory, not the data dir holding it
Round-3 MAJOR-1 / round-4 finding 1. Test for <dolt-data-dir>/<database>/.dolt
instead of the data directory itself, so the FR-010 missing-vs-present branch
is reachable on an initialized workspace and `bd init --recreate-missing`
reaches its own opt-in. This is the same probe, for the same reason, that
guardMissingServerDatabaseAt already uses on the reinit path.
Making that branch reachable also exposes states the data-dir stat used to
shadow, and permitting them would be a new fail-open policy rather than a fix.
The clearest is a workspace that predates GH#2372: it carries no project_id,
so `existingProject` is false, and the branch would permit a silent empty
recreate on exactly the installed base this guard exists to protect. The
data-dir stat therefore stays — it stops being the gate and becomes the permit
condition, admitting only what the old probe already admitted, plus the
explicit per-invocation opt-in. Net behavior change is the opt-in becoming
reachable, and the false "already initialized" message being replaced by the
accurate missing-database refusal where the database is genuinely gone.
Choosing a better proof of prior local init is deliberately NOT done here.
project_id comes from git-tracked .beads/metadata.json, so a fresh clone
inherits one (round-4 finding 2); the replacement signal needs a different
answer in per-project and shared-server mode, and is tracked as its own
architecture decision on be-5pjhd. The known limit is now recorded in the
guard comment and in docs/recovery/init-safety.md rather than left implicit.
Tests: the two red tests from the previous commit now pass, and two more pin
the narrowing — a pre-project_id workspace with a local data dir stays blocked,
and --recreate-missing still opens it.
* docs: record the --recreate-missing fix and the fresh-clone project_id limit
Round-3 NIT-3 / round-4 finding 4: the round-3 probe change (data dir to
<dolt-data-dir>/<database>/.dolt) was never written down, and it is
user-visible wherever the data dir exists but the database is gone. Both that
and this round's --recreate-missing fix are now under [Unreleased] / ### Fixed.
The stray double blank line is gone with the section's move.
Also records, in docs/recovery/init-safety.md's "Limits worth knowing", that
project_id is inherited by a fresh clone because .beads/metadata.json is
git-tracked by default — the round-4 finding-2 gap this series deliberately
does not close. It fails in the safe direction and --recreate-missing is the
supported way through it; the replacement signal is tracked separately.
* docs(adr): ADR-0004 — proof-of-prior-init signal for the missing-database guards
Round-4 finding 2 asked what should replace project_id as the proof that a
workspace was initialized locally, and what the fail-open/fail-closed policy
should be per server mode. It needed a design decision rather than a
mechanical fix, so it was escalated; this records the answer.
The decision is to formalize what the code already does for local hosts and
keep project_id where nothing local can ever help. Presence of this project's
own <dolt-data-dir>/<database>/.dolt is unconditional proof, because the path
is gitignored and only a real local process creates it. Its ABSENCE, however,
cannot be promoted to proof in either direction: it looks identical whether
the workspace was never initialized here or was initialized here and lost its
storage — and the second is the shape of the 2026-08-11 incident. For a
genuinely remote host the probe is not merely silent today, it is structurally
silent forever, since the only code that creates that directory runs on local
server-management paths.
So project_id stays as the tier-2 fallback with its git-inheritance weakness
accepted, and --recreate-missing is the permanent resolution UX rather than a
stopgap. A local-only init marker and repurposing .local_version are recorded
as rejected, with reasons, so neither is re-proposed each review round.
Extends ADR 0002, which set the init safety invariants but left the evidence
question open.
* test(init): red — the reinit guard waves through a pre-project_id workspace
ADR-0004 follow-up 1. guardMissingServerDatabaseAt is the safety net for
--reinit-local and --force, which bypass checkExistingBeadsDataAt entirely. It
returns nil the moment cfg.ProjectID is empty, BEFORE it ever reaches the
per-database .dolt probe eighteen lines below.
checkExistingBeadsDataAt does the opposite: it probes first, and only falls
back to project_id — narrowed by the coarse-directory permit condition — when
that probe comes up empty. So a workspace initialized before GH#2372 minted
project_id, whose local Dolt storage has since been lost, is protected under
plain `bd init` and waved straight through under the two flags an operator
reaches for in a panic. The weaker path is the one behind --force.
Three tests through guardMissingServerDatabaseAt, mirroring the plain-init
trio: no project_id with a local data dir present must refuse; no project_id
with nothing local at all is a genuine fresh clone and must be allowed; and
--recreate-missing must still open the refused case.
The first fails at this commit. The other two pass, and pin the directions the
fix must not break.
* fix(init): green — probe the local database before consulting project_id
ADR-0004 follow-up 1. Move the per-database <dolt-data-dir>/<database>/.dolt
probe above the project_id check in guardMissingServerDatabaseAt, and run it
unconditionally, so this guard reasons in the same order as the plain-init
guard it backstops.
When the probe comes up empty and project_id is also absent, apply the same
coarse-directory permit condition checkExistingBeadsDataAt uses: allow only
when there is no local Dolt data directory either. A data directory with no
database in it still says this workspace has touched local Dolt storage, and
that is exactly the pre-GH#2372 lost-storage case the old early return waved
through under --reinit-local and --force.
One cell of the behavior matrix changes: no project_id, no local database, but
a local data directory present now refuses instead of returning nil.
Everything else is untouched, --recreate-missing still returns nil at the top
of the function, and a workspace with nothing local at all is still treated as
a fresh clone.
The comment records the shared-server asymmetry ADR-0004 accepts — there the
coarse directory is machine-global, so that cell is more conservative — as
settled rather than as an open defect, since it fails toward refuse and its
population only shrinks.
* docs: cite ADR-0004 from the plain-init guard, the recovery doc and CHANGELOG
The comment at checkExistingBeadsDataAt's project_id check said the limit was
"OPEN and tracked by be-5pjhd" and that the replacement signal was
"deliberately not made here". It is made now, so the comment says settled
instead of open, and points at the ADR rather than at a bead — with a note to
read it before reopening, since the two obvious alternatives are recorded
there as rejected rather than unconsidered.
docs/recovery/init-safety.md said the same thing in operator language and is
updated the same way, plus a new bullet stating that the guard now applies
equally to bd init, --reinit-local and --force. That equality is the
user-visible half of the fix and was not previously stated anywhere.
Its "Last reviewed" marker moves to today. The doc is freshness-tracked
against cmd/bd/init.go, which this series changes, and leaving the marker at
2026-09-08 would claim text written today had been reviewed eight days before
it existed.
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-udx2-init-missing-db-guard-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
* chore(bazel): enumerate init_guard_force_e2e_test.go in cmd/bd srcs
The PR adds cmd/bd/init_guard_force_e2e_test.go under a plain '//go:build cgo'
tag, which is the tag class cmd/bd/BUILD.bazel enumerates (the 23 unenumerated
test files in this package are all 'cgo && integration', 'scripttests' or
'chaos'). cmd/bd/BUILD.bazel is base-added, so the contributor's branch could
not have carried this row. Generated by 'make bazel-sync'; no hand edits.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(init): honor --recreate-missing on the proxied route; scope the refusal's evidence claim
Maintainer review fixes for PR #5791 (iteration 1). Five review minors; the
three substantive ones:
1. --recreate-missing was inert under --proxied-server. runInit dispatches to
runInitProxiedServer and returns before the assignment site, while
runInitProxiedServer calls checkExistingBeadsData, which reads the global —
so converting a server-mode workspace with a missing database to proxied
mode was refused despite the explicit opt-in, and the refusal named the
exact flag the operator had just passed. It failed closed, so there was no
data hazard, only a recovery dead-end. The assignment now sits beside its
flag read, upstream of every dispatch in runInit.
The PR's recovery runbook documented this inertness as "pre-existing
behaviour, not introduced here". The early dispatch is pre-existing, but
--recreate-missing is introduced by this PR, so the flag could not have had
pre-existing inertness. That paragraph is rewritten to the new behaviour.
2. initGuardMissingServerDBMessage asserted "metadata.json has a project_id"
unconditionally, but the --reinit-local/--force guard also emits it for a
workspace predating GH#2372 where only local Dolt storage proves prior use —
the population the CHANGELOG bullet names. The evidence sentence is now
selected by the caller, so the message never cites an artifact its caller
does not have. Pinned from both sides: the project_id cell must cite that
evidence, the no-project_id cell must not.
3. The new doc comment claimed initGuardServerMessage is "used when there is no
evidence either way". It has no production caller, so the contrast was
asserted as two live code paths. Reworded to intent. The dead message's
surviving "existing project -> bd bootstrap" sentence is pre-existing, is
pinned by four tests, and is left for a follow-up.
Also re-cited two stale path:line references by symbol and branch (the recovery
runbook's three, and a test comment's two), and expanded the else-branch comment
in checkExistingBeadsDataAt to cover the reachable-but-missing fall-through that
lands there — the branch's guards are correct for both cases only because their
conditions do not mention reachability.
Declined, with reasons, as out of scope for opportunistic cleanup: restructuring
the fall-through itself (a control-flow change in the diff's most complex
function, which both review lanes agree is behaviourally correct today);
rewording the caller-less message's bootstrap sentence (four pinned tests,
pre-existing); and adding --recreate-missing to the generated CLI reference
(the required check-doc-flags job passes at this head and seven other registered
initCmd flags are equally absent, so that page is not a flag enumeration).
Validation: go build ./... and go vet ./cmd/bd/ clean; gofmt clean;
go test ./cmd/bd/ -run 'TestInitGuard|TestCheckExistingBeadsData' ok (26 tests,
real Dolt servers); scripts/check-doc-freshness.sh PASSED; git diff --check
clean. The evidence pin was proved non-vacuous by mutation: forcing the reinit
call site back to an unconditional project_id claim reddens exactly the
no-project_id test and nothing else.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(doctor): drop the bd init hint from #5634's permissions warning
1d7629213b on this branch removed "bd init (safe to re-run)" from the
.beads/.gitignore fix hints, because re-running bd init is the unsafe
action be-5up5 guards against. #5634 (c33738d209) reached main while
this PR was open. It added a CheckGitignore warning for unexpected file
permissions that still carries the old hint, so after the merge it was
the only gitignore check that suggested bd init.
Give it the same "Run: bd doctor --fix" hint as the four other
gitignore warnings. That is a complete repair here: FixGitignore
restores mode 0600, and #5634's test already checks that the warning
clears after it runs.
TestCheckGitignore_WarnsOnLoosePermsWhenPatternComplete only checked
that Fix was non-empty. It now pins the exact hint. With the old
gitignore.go line put back, the test fails.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(init): name the real gitignore template in ADR-0004 and init.go
ADR-0004 and the matching comment in init.go both cite
`defaultGitignoreContent` in cmd/bd/doctor/gitignore.go as the place
that says .beads/metadata.json is git-tracked by default. No symbol by
that name exists, in this branch or in main's history. The constant
that says it is GitignoreTemplate. Its closing lines read "Config files
(metadata.json, config.yaml) are tracked by git by default since no
pattern above ignores them".
Rename the reference in both places. The claim itself is unchanged.
Neither file changes outside that one identifier.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(dolt): red — setupTwoProjectStores shares one testTimeout across two cold store opens (refs be-gvnsq)
* feat: green — setupTwoProjectStores shares one testTimeout across two cold store opens (refs be-gvnsq)
* chore: release gate PASS for be-5fap7
* test(storage/dolt): give every cold store open its own budget, and drop the test that proved nothing
Review findings 1-4 on PR #6256. All four are upheld; two of them are fixed by
deleting what this PR added.
Finding 1 (blocking) — TestStoreOpenContext_FreshBudgetPerCall did not exercise
the property it claimed. It asserted that two context.WithTimeout calls return
different deadlines, which is a property of the standard library. It never
named setupTwoProjectStores, New or DoltStore, so reverting setupTwoProjectStores
outright could not have turned it red. The gate record's "TDD red" was a compile
failure (storeOpenContext undefined pre-fix), not a behavioural one.
Deleted rather than replaced. The real property — a cold open must not inherit
a budget already spent by a previous open — is not observable from a unit test
without an injectable clock or injectable load, and writing a second test that
merely looks like it checks this would repeat the original mistake. The guard
is now structural instead: every two-open site routes through one helper.
Finding 2 (blocking) — the fix covered one site of five. Enumerating every
New(ctx, ...) in the package found SEVEN unfixed siblings, three more than the
review reported:
cross_project_test.go:307,320 PortCollision_SameDatabase (reported)
cross_project_test.go:812,829 IdentityCheck_..._ForeignRejected (reported)
cross_project_test.go:856,866 IdentityCheck_..._MatchingSucceeds (reported)
create_guard_test.go:273,291 CreateGuard_ExistingDB_WithData (reported)
cross_project_test.go:903,914 IdentityCheck_SoftSkip_NoLocalMetadata
cross_project_test.go:938,945 IdentityCheck_SoftSkip_EmptyDBProjectID
cross_project_test.go:976,996 IdentityCheck_Gateway_SkipsVerification
All extended rather than deferred; the shape is gone from the package.
Findings 3 and 4 (nits) — storeOpenContext() was byte-identical to
testContext(t) (dolt_test.go:59-62) minus t.Helper(), and the unconditional
500ms time.Sleep existed only to exercise it. Both removed with the test.
openStoreWithOwnBudget(t, cfg) replaces them. It does not duplicate
testContext: it composes it with the New call and the cancel, which is the
invariant all 14 call sites need. Cancelling the open context when the open
returns is safe for the reason the review already established — the context
bounds the open, not the returned store.
testTimeout's doc comment claimed "some tests set up two stores under one
context"; no longer true, corrected.
Net effect is a smaller diff than the reviewed version: -90/+44 across three
files, against +78/-7 in one.
Verified against a real dolthub/dolt-sql-server:2.2.0 container with ambient
BEADS_DOLT_SERVER_PORT unset: TestCrossProject 11/11 PASS 0 SKIP (193.4s),
TestCreateGuard 9/9 PASS 0 SKIP (35.3s). Zero SKIPs matters — these suites skip
rather than fail when the container cannot start.
Refs be-6sszs, be-gvnsq.
* docs(release-gates): correct the be-5fap7 "TDD red" claim and record the review response
The gate record called c2e896373 a TDD red with the new regression test
"confirmed failing pre-fix". The reviewer showed that failure was a compile
error — storeOpenContext did not exist before the fix commit — not a
behavioural red. A compile error is not evidence that a test guards a
behaviour, and that mislabel is what let a vacuous test through the gate.
Corrects the commit annotation and the scope paragraph, and adds an addendum
recording all four findings, the seven sibling sites (three more than the
review reported), and the container-verified test evidence.
Refs be-6sszs.
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-5fap7-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
* fix(test/dolt): give the cheap calls their own budget too, not just the opens
Review of PR #6256 found the per-open budget conversion incomplete at its own
headline function. In setupTwoProjectStores the shared ctx was created BEFORE
both cold opens and still guarded storeB.SetConfig after the second, and
context deadlines are absolute — so the own-budget opens drained it anyway.
Base failed iff d(openA)+d(SetA)+d(openB) > 45s; head failed iff the same sum
plus a millisecond SetConfig > 45s. The same runs failed either way: be-gvnsq
was relocated onto a cheaper call with a more misleading message, not fixed.
Changes:
- Add setConfigWithOwnBudget, the SetConfig twin of openStoreWithOwnBudget,
and route both setupTwoProjectStores writes through it. The shared ctx is
gone entirely, which is the shape the PR already demonstrates at
...SoftSkip_EmptyDBProjectID. Taking this arm over "move the ctx below the
storeB open" keeps the call order and every error-cleanup arm verbatim, and
leaves no residual shared deadline at all.
- Convert cross_project_test.go:783 (New(ctx, initCfg), landed by base commit
7a81e297d9 inside a function this PR had already converted) to
openStoreWithOwnBudget.
- Reword the testTimeout comment: the PR replaced a hedged claim with the
absolute "no test shares one deadline across two", which is false in 8
functions across 8 files at this head. It now states the helper's policy and
what a raw New(ctx, ...) still means. Converting the other 8 is follow-up
work, not this PR's obligation (65 raw sites repo-wide; this PR converted 16).
- Document on openStoreWithOwnBudget that per-open budgets do not by themselves
decouple the caller — the gap this review found — pointing at setupTestStore's
pre-existing note, which already stated the ordering rule the change missed.
Measured, two arms, same mutations (testTimeout 8s + a 9s sleep standing in for
a slow cold open, injected between the storeB open and the SetConfig after it):
pre-fix code FAIL "failed to set prefix for project B: begin write tx:
context deadline exceeded" <- the predicted relocation
post-fix code PASS
The load-dependent flake itself still has no deterministic pin; that remains an
accepted trade-off, as the contributor's dropped regression test found.
Not addressed here: the two create_guard_test.go conversions ADD a 45s bound
where ctx was context.Background(), rather than removing a coupling. That is a
framing note for the PR description, which this workflow edits at finalize.
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>
* fix(ci): resolve gofmt from go.mod's toolchain, not PATH (be-gx8)
gofmt's output is not stable across Go releases, so whichever binary runs
decides the formatting verdict. Three sites reached for a bare `gofmt` on
PATH -- scripts/ci/fmt-check.sh, the Makefile fmt target, and
.githooks/pre-commit -- and PATH belongs to whatever Go is installed
locally. CI has no such freedom: actions/setup-go installs exactly the
go.mod version via go-version-file.
GOTOOLCHAIN=auto does not correct for this, which is why `go env GOROOT`
or `go fmt` would not have been a fix either. The toolchain switch only
ever moves UP to satisfy the go directive, never down, so a host running
a newer Go keeps formatting with the newer gofmt. Measured against
go.mod's go 1.26.5 on a go1.27.0 host: 1.27 flags three
role_fixture_kit_test.go files that 1.26.5 calls clean, and no branch
touches them.
The failure ran in the dangerous direction. The required lint gate went
red on untouched code, which reads as "main's lint is broken" and poisons
the pre-existing-on-main judgement every PR author uses to decide whether
a red gate is theirs. Its own advice -- "Run 'make fmt' to fix
formatting" -- then rewrote those files into a form CI's pinned gofmt
rejects. The pre-commit hook did that same rewrite and re-staged it
silently on every Go commit, with nobody choosing it.
Route all three through one resolver rather than patch three sites, so
the next gofmt call site cannot drift. scripts/ci/gofmt-bin.sh names
go.mod's toolchain explicitly and reads GOROOT from it, short-circuiting
to a plain `go env GOROOT` when the host go already is the pinned version
(the CI case, so nothing is fetched where nothing needs fetching). A
fallback to the PATH binary stays available but warns loudly on stderr:
silently falling back is indistinguishable from resolving correctly, and
reintroduces exactly this skew. fmt-check.sh now prints the gofmt version
it used, so a skew presents as a skew instead of as a repo defect.
The new tests pin the resolution, not the reporting, because the
resolution is where the bug lived: every output assertion around the bare
gofmt stayed green. Reverting gofmt-bin.sh to `command -v gofmt` fails
all three. The pre-existing fmt-check tests move their shim from PATH to
GOFMT -- a PATH shim is now correctly ignored, so leaving them there
would have made them grade the real toolchain instead of the case they
name.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoN7f9TMmGTCLRpDPzSH4y
Executed-By: beadsrig/polecats/nux
* fix(ci): resolve gofmt from go.mod's toolchain directive, and declare it to Bazel
Maintainer review fixes for #6294 (adoption iterations 1 and 2, one squashed
commit). Sections 1-6 address all six findings in the attempt-1 synthesis; the
two majors are the substantive ones. Sections 7-8 address the two minors the
attempt-2 synthesis left (it decided approve, 1000/1000, no blocker or major).
1. Contract & Interface Fidelity (major, the scorecard's only Required Change).
gofmt-bin.sh read the `go` directive (1.26.5) while go.mod also carries
`toolchain go1.26.7`, and toolchain-first is the repo's own declared
precedence -- Makefile:85-90 exports GOTOOLCHAIN from the same pair for
every make target, and scripts/bazel_policy_test.go's goModToolchainVersion
is the same rule in Go. The consequence was not cosmetic: `go env GOVERSION`
at the repo root is go1.26.7 (the directive auto-switches), so the fast-path
test compared go1.26.7 against go1.26.5 and was false by construction on
every route, sending each required fmt-check run down the elif arm to fetch
a second, older toolchain. Parse `toolchain go<version>` first, fall back to
the `go` directive. Measured after the change: pinned=1.26.7, the fast path
fires (`go env GOVERSION` then `go env GOROOT`, no GOTOOLCHAIN= prefix and
nothing fetched), and `make fmt-check` now reports
`Using gofmt go1.26.7 (.../toolchain@v0.0.1-go1.26.7.../bin/gofmt)`.
.githooks/pre-commit:24's `go`-directive read is deliberately left alone --
its comment explains it is a golangci-lint pin for a different reason.
gofmtbin_test.go's helper now implements the same precedence, and
TestGofmtBinMatchesGoModDirective is renamed TestGofmtBinMatchesGoModToolchain
so the pinned contract is legible from the test name.
Deviation from the prescription, recorded deliberately: the review asked for
a helper "name" change as well. The name goModToolchainVersion already
described toolchain-first semantics; it was the implementation that did not.
Correcting the semantics is what removes the collision with
scripts/bazel_policy_test.go's identically-named, opposite-behaving helper,
so the name is kept and the doc comment now states the precedence and cites
both in-repo sources of it.
2. Release Safety (major). fmt-check.sh now execs a sibling script
unconditionally under `set -euo pipefail`. Live origin/main gives
//scripts/prlintmake a `data` list containing exactly ci/fmt-check.sh, so on
merge all three TestFmtCheck* cases would have died at rc 127 in the Bazel
runfiles sandbox -- the GOFMT short-circuit cannot rescue them because it
lives inside the missing script. Export ci/gofmt-bin.sh to
//scripts/prlintmake and put it in the target's `data`, and add
gofmtbin_test.go to `srcs` (it carries no build tag, so its omission was not
explained away).
Only ci/gofmt-bin.sh is exported here, not ci/fmt-check.sh: main already
exports that one for this same package, and a second exports_files call
naming the same file in one package is an error. This base predates both of
main's additions, which is also why editing the three-line go_test rule
conflicts with main's independent edit of it. Verified by materialising the
merge: every other file auto-merges and the resolution is the union of the
two attribute sets (srcs = both test files; data = both scripts plus
//:go.mod per section 7; keep main's deps on //internal/testutil/bazeltest).
That deps edge is load-bearing at main even though it was stale at this base:
main rewrote sourceRepoRoot to bazeltest.CallerDir, so the union must keep it.
3. Test Evidence Quality (minor). environment() starts from os.Environ(), so
deleting GOFMT from the override map did not unset it. Export it empty
instead -- gofmt-bin.sh reads `[[ -n "${GOFMT:-}" ]]`, so empty already is
its "not set" case, and the override test stays distinguishable by setting a
non-empty value.
4. Architectural Consistency (minor). "Every gofmt invocation in this repo goes
through here" was false at authoring: cmd/bd/preflight.go's doctor check is
a fourth front door on bare PATH gofmt. Scope the claim to the repo's
shell-side call sites (re-censused: fmt-check.sh, the Makefile fmt target,
and .githooks/pre-commit are the complete set; the two workflow "Check
gofmt" steps and scripts/ci/pr-lint.sh reach them through make fmt-check),
and name the in-binary exception with the reason it is one -- bd runs
against whatever project the user points it at, so it has no scripts/ci/ to
call. preflight.go is byte-identical at base, at HEAD and at origin/main, so
nothing in this PR widens it; converting it is a separate change.
5. Test Evidence Quality (minor). describe_gofmt's version-bearing arm had zero
coverage -- all three existing cases inject a bash script, for which
`go version` errors and only the bare-path arm can run. Add
TestFmtCheckReportsGofmtVersion against a real Go-built no-op binary, which
is the only shim shape `go version` can report on.
6. Error Handling & Resilience (nit). Warn (without refusing) when GOFMT names
something non-executable, so a typo is reported by the resolver that
accepted it rather than as a "not found" from whichever call site ran it;
and guard the fields index in the resolver test.
Mutation proofs, each red isolated to the intended test with the other six
green (7/7 pass unmutated, `go test ./scripts/prlintmake/`):
- revert the toolchain-first parse -> resolver returns the 1.26.5 gofmt and
TestGofmtBinMatchesGoModToolchain alone fails.
- delete describe_gofmt's `if command -v go` block (codex's own mutation,
previously all-green) -> TestFmtCheckReportsGofmtVersion alone fails, the
three incumbents stay green. That asymmetry is both the coverage-hole proof
and the proof the new case is not a duplicate.
- ambient GOFMT, two values x two arms: with the fix both /nonexistent and a
correctly-pinned gofmt leave all three resolver tests passing; with the
delete restored, /nonexistent fails TestGofmtBinMatchesGoModToolchain with a
message blaming the script, and a correctly-pinned value turns all three
green vacuously without the resolver ever running.
7. Release Safety (minor, iteration 2). The target now reads go.mod at run
time -- the resolver opens "$REPO_ROOT/go.mod" and the test helper opens
filepath.Join(sourceRepoRoot(), "go.mod"), where the base test read it not at
all -- but go.mod appeared in no `data` list, so the rule declared strictly
less than it uses. Add //:go.mod to //scripts/prlintmake's `data`. No new
export is needed: //:BUILD.bazel already exports go.mod publicly, and
//internal/storage/dolt and //internal/testutil/integration already consume
it as "//:go.mod" in `data`, so this is the sanctioned shape rather than a
new one.
8. Contract & Interface Fidelity (minor, iteration 2). `toolchain default` is a
legal go.mod directive value, and the parse matched on the field name alone,
so sub(/^go/, "", "default") no-opped and left pinned=default. Because that
is non-empty, neither the `go`-directive fallback nor the "no toolchain or go
directive" guard could fire, and the script degraded to the bare PATH gofmt
it exists to eliminate while a usable `go 1.26.5` sat two lines above. The
mangled "godefault" in the warning was the tell. Require the literal `go`
prefix, which is exactly what the repo's two other readers of this pair
already do (Makefile:85's `s/^toolchain go//p` and bazel_policy_test.go's
`^toolchain\s+go(\S+)\s*$`), so `default` falls through to the `go`
directive.
The same guard is added to gofmtbin_test.go's goModToolchainVersion, and that
is not redundant: strings.TrimPrefix("default", "go") returns "default"
unchanged and withPatchComponent leaves a dotless string alone, so the helper
mirrored the bug exactly and the test could never have caught it. Guarding
only the script would have left the test agreeing with a buggy resolver.
Measured on a synthetic tree, five arms (the script resolves REPO_ROOT from
its own location, so each arm is a copied script beside a written go.mod):
- `toolchain default` + `go 1.26.5`: before, /usr/local/go/bin/gofmt with
the "godefault" warning; after, the go1.26.5 toolchain gofmt -- i.e. the
`go` directive, identical to the arm where no toolchain line exists.
- `toolchain go1.26.7`: unchanged before and after (no regression).
- `go 1.26.5` alone: unchanged before and after (no regression).
- `toolchain default` with no `go` directive: now reaches the previously
bypassed "no toolchain or go directive" guard and falls back loudly, with
the correct message rather than the mangled one.
- `toolchain default` written before `go`: also resolves 1.26.5, so the
fallthrough is order-independent.
The Go helper's parse was checked over the same six inputs and now agrees
with the shell on every one.
No regression test is added for this case. Doing so would need a new
synthetic-go.mod fixture -- every existing case runs the real script against
the real repo go.mod through sourceRepoRoot() -- which is a new test
instrument rather than the prescribed remedy, on a finding whose gate impact
is none (go.mod carries `toolchain go1.26.7`, so nothing can fire today).
Iteration 2 validation: go test ./scripts/prlintmake/ -count=1 -v 7/7 PASS
(same roster as iteration 1, no test added or removed), go vet rc 0,
go test ./scripts/ -run 'Bazel|BUILD' 11/11 PASS (the BUILD-policy gate, run
because this touches a BUILD file), python3 tools/bazel/go_srcs.py --check
rc 0 (`srcs` is unchanged; only `data` moved), make fmt-check rc 0 still
reporting go1.26.7, shellcheck clean, git diff --check clean.
Also run: go vet ./scripts/prlintmake, go test ./scripts/... (all packages ok),
make fmt-check (rc 0), python3 tools/bazel/go_srcs.py --check (rc 0),
shellcheck on both changed scripts.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(doctor): tighten .beads/.gitignore perms even when patterns are complete
EnsureGitignoreForBeadsDir returned early when the file was already
pattern-complete, skipping the 0600 tightening below - so a complete file
with loose perms (0644 from an old bd, a checkout, or umask) never got
repaired. Hoist the permission repair above the early return and trigger
on any deviation from 0600, not just missing owner-write.
Adds the tests flagged in the #5285 review: pattern-complete-but-0644 gets
tightened with content byte-identical, and FixGitignore twice is
idempotent (no duplicate appends).
Agent-Signature: claude-fable-5-high on behalf of matt wilkie
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G74Vh4USrUkc9przesWyUJ
* fix(doctor): correct permission-warning wording and pin its branch
Maintainer review fixups for PR #5634 (adopt-pr review iteration 1). All
three changes are confined to the files this PR already touches.
- CheckGitignore reported "Loose permissions on .beads/.gitignore" for any
mode != 0600, which is factually inverted for a mode *stricter* than 0600:
a 0400 file was reported as loose and then widened to 0600 by --fix.
Reword to "Unexpected permissions"; Detail ("Mode is 0400, want 0600") and
Fix are unchanged. The check predicate is deliberately left alone --
normalizing to exactly 0600 is the stated policy at every writer of this
file, and EnsureGitignoreForBeadsDir must restore owner-write to keep its
append route working, so the widening is intended behavior, not a defect.
- TestCheckGitignore_WarnsOnLoosePermsWhenPatternComplete asserted only that
*a* warning fired. CheckGitignore also warns for a missing file and for
missing patterns, so if GitignoreTemplate ever drifted out of
requiredPatterns the test would stay green while the permission branch went
untested. Pin the branch: assert the message and the observed mode.
- Retarget the trailing os.Chmod comment. With the chmod hoisted above the
pattern check, its old "the file may predate the 0600 policy" rationale is
now handled upstream; the residual case it still guards is the hoisted
block's os.Stat failing (file removed between the ReadFile and the Stat,
where os.WriteFile then creates it under umask).
Validation: go test ./cmd/bd/doctor/ -run Gitignore green, go build, go vet,
gofmt all clean. The new assertions are mutation-proved: reverting the message
reds the message assert, and drifting requiredPatterns out of the template
reds both new asserts while the pre-fix Status-only shape stays green -- the
exact masking these assertions close.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(cmd/bd): reset repository caches around CWD fixtures (#5746)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(cmd/bd): pair the beads/git cache resets at the two remaining chdir fixtures
Maintainer review fixup for the adopt-pr review of #5747 (iteration 1,
synthesis approve, 0 blocker / 0 major).
Takes the single minor finding (Change Impact / Blast Radius). The PR
establishes that a one-sided cache reset around a chdir fixture is a
structural half-fix, but two sites in the same package still encoded
exactly one half each, failing in opposite directions:
- serve_registered_backend_test.go: had the beads-only pattern the PR
just deleted elsewhere (beads.ResetCaches + bare
t.Cleanup(beads.ResetCaches)). Converted to the paired closure the PR
uses, adding git.ResetCaches on both edges. The file was already cited
as the exemplar for the paired idiom at two other anchors; this was the
third, unfixed site.
- git_test_helpers.go: runInDir is the package's single helper for this
contract across 38 call sites, and it reset git only, never beads.
Added beads.ResetCaches beside both git.ResetCaches calls, and updated
the doc comment to state why the pair is required. No call-site churn.
Both caches key on the working directory, so clearing one leaves the
other answering for the previous directory.
Validation: go vet ./cmd/bd/ clean at CGO_ENABLED=1; the 22 test
functions that call runInDir plus TestServeRefusesStrictReadonlyOnARegisteredBackend
run 47/47 PASS, 0 SKIP.
Not taken: the optional shared chdirFixture(t, dir) helper the finding
suggests. It would churn all 38 call sites for no behavior change, which
is beyond what a maintainer fixup on an approved PR should carry.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* 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>
* fix(formula): substitute vars in step assignee, labels, and metadata
Cook and pour substituted title/description/notes/gate but copied
assignee, labels, and metadata through raw, so a poured bead carried
literal `{{var}}` text in all three.
- labels: every label-based query, filter, and automation silently stops
matching, and nothing errors (GH#5110).
- metadata: general keys came through literal; only a top-level "repo"
key on a gh:* gate was substituted (GH#5110).
- assignee: worse than cosmetic - close refuses when the actor doesn't
match the assignee, so every step of a poured molecule is unclosable
and the molecule can never advance (GH#5754).
internal/formula/expand.go already substituted assignee and labels on
the inline-expansion path, so the two paths disagreed on the same
fields; Step.Assignee is documented as "supports substitution" and
ExtractVariables already scanned it, meaning pour hard-failed demanding
a variable it then refused to resolve.
Both call sites are fixed together: runtime-mode cook feeds the proto
that pour clones, so a field left literal in either path ships a
placeholder onto the bead. Fixing cloneSubgraphInto covers pour, wisp,
bond, and the proxied-server paths, which all funnel through it.
substituteMetadataRepo is generalized to substituteMetadataVars, which
resolves every string leaf of the metadata JSON at any depth. This drops
the earlier gh:*-gate-only restriction (SF2/SF4): reading a `repo` key
AS a GitHub selector is only correct on a gh:* gate, but resolving a
{{var}} in it interprets the key not at all. The walk still decodes into
json.RawMessage, so untouched values stay byte-identical, and object
keys are never rewritten (a rewritten key could collide with a sibling).
The variable scan is widened to match: extractAllVariables (pour) and
ExtractVariables (cook) now cover assignee, labels, metadata strings,
notes, and await ID, so pour demands exactly the variables it resolves.
Undeclared handlebars are still filtered out by VarDefs.
Regression coverage asserts on a poured bead, and checks the assignee
via validation.AssigneeMatches rather than a string compare - a
substitution-only assertion would pass while the unclosable symptom
persisted.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore(formula): regenerate schema_gen.go after the types.go doc edits
TestSchemaGenIsCurrent holds schema_gen.go to a byte-for-byte rerun of
the generator over types.go, and the field docs are part of the
generated output — so the Labels/Metadata comment updates made it stale.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(mol bond): resolve vars like pour instead of demanding every handlebar
buildAttachCloneOpts demanded every variable extractAllVariables found in
the proto subgraph and applied no declared defaults, unlike pour
(cmd/bd/pour.go) and wisp (cmd/bd/wisp.go). Widening the scanned field set
to assignee, labels and metadata therefore widened bond's hard refusal
along with it: a proto whose label or metadata carried an undeclared
documentation handlebar, or a declared var carrying only a default, made
`bd mol bond` fail with "missing required variables" where it previously
succeeded.
Run applyVariableDefaults + extractRequiredVariables there, matching the
sibling call sites. extractRequiredVariables returns the unfiltered list
when VarDefs is nil, so a legacy template still requires every var it
mentions; the change is strictly a reduction in false failures. Applying
the defaults also puts them in opts.Vars, which is the map
cloneSubgraphInto actually substitutes from.
Also from review:
- docs/workflows/gates.md no longer enumerates a stale three-field list for
where `{{var}}` substitution applies.
- maxMetadataSubstitutionDepth's doc names walkJSONStrings (not the
long-gone substituteJSONVars) and says plainly that hitting the bound
deliberately ships a literal placeholder rather than erroring.
Reported-by: bee-ghosttrack
Agent-Signature: claude-code-opus-5-unknown-reasoning on behalf of Harry Miller
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* build(bazel): add the validation dep to the bd_test go_test (make bazel-sync)
mol_embedded_test.go and template_test.go now import internal/validation
directly (validation.AssigneeMatches, to check the substituted step
assignee), so gazelle emits //internal/validation on bd_test. bd_lib
already carries the dep, so bd_test compiles through embed, but gazelle
lists every direct test import on the go_test itself. cmd/bd/BUILD.bazel
landed on main after this PR branched, so the PR could not carry the
line; without it, bazel.yml's "BUILD files in sync" step fails in the
required Bazel / test lane. Generated by `make bazel-sync`.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
* fix(dolt): apply the pool read/write deadline knobs on every open path (be-4at)
BEADS_DOLT_POOL_READ_TIMEOUT / dolt.pool-read-timeout (and the write
twins) shipped in #5089 as the relief valve for overloaded shared
servers, but their env/config ladder lived only in applyResolvedConfig,
which runs for callers of NewFromConfig*. The CLI's own store open and
bd serve's provider hand-build their Config (resolveDoltServerConnection,
whose comment says it bypasses applyResolvedConfig) and go straight to
New, so every bd command in server mode kept the built-in 10s deadline
whatever the knob said: on a 31k-issue hub that is what made every
bd close of a bead with dependents die in its recompute with
"i/o timeout" while the documented knob did nothing.
Move the ladder into ApplyPoolTimeouts and run it from
applyConfigDefaults, the constructor step every open path shares;
applyResolvedConfig calls the same helper, so the two ladders cannot
drift again. Idempotent: a caller-set deadline still wins.
Reproduced on stock main against a scratch server-mode store:
bd sql "SELECT SLEEP(15)" died at ~10s with the env set to 60s and with
dolt.pool-read-timeout=60s in config. The new test pins the ladder at the
seam New calls (applyConfigDefaults) and the DSN it produces; it fails on
main with PoolReadTimeout = 0s.
Fixes#6144
Agent-Signature: claude-code-claude-fable-5-max on behalf of a3ackerman
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YFPUYZEQjsBK2nBjsSQTij
* fix(dolt): narrow the pool-deadline claim to DoltStore opens, disclose the import precedence (be-4at)
Review round:
- CHANGELOG: the ladder covers every DoltStore open (the CLI's store, bd
serve's store provider, library callers of New/NewFromConfig*); bd serve's
HTTP data path builds its own DSN without pool deadlines and is unchanged.
Operators of loaded servers are told the documented precedence now reaches
bd import too, which used to inherit the 5m long-read fallback
unconditionally because the CLI's knob value was always 0.
- applyPoolTimeouts is unexported (no out-of-package caller).
- The config.yaml rung falls back to config.GetStringFromDir(cfg.BeadsDir, …)
for library consumers, like the auto-start ladder above it.
- The "unset knobs" subtest resets the config package state, not only env.
- The "every open path" wording in the code comments narrowed to match.
Agent-Signature: claude-code-claude-fable-5-1-max on behalf of A3Ackerman
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LrzRcJhWSUH6SnU64gtFE
* fix(dolt): retarget base's poolCfg comment, drop the false serve-provider claim, cover the config.yaml rung
Maintainer fixup for the #6145 adoption. Two parts.
Rebase compose (original): base's comment above poolCfg said it was "shared by
the pool knobs below", which the deadline compose falsified -- after this PR
poolCfg has exactly one call site (dolt.max-conns). Retargeted to match.
Review fixes (iteration 1, all three non-gating minors; the nit is declined
below):
- The PR claimed `bd serve`'s store provider as a beneficiary of the relocated
ladder. It is not one: `grep -c -F 'dolt.New' cmd/bd/uow_factory.go` is 0, and
the tree says so itself at uow_factory.go:365-367 ("the DoltStore serve never
touches"). Dropped that clause from all three sites that carried it -- the
CHANGELOG bullet (both of its clauses), applyPoolTimeouts's doc comment, and
this test file's header. The surviving beneficiaries are verified rather than
merely shortened: cmd/bd/store_factory.go:76 does reach dolt.New, as do the
doctor paths, alongside library callers of New/NewFromConfig*. The separate
"`bd serve`'s HTTP data path ... is unchanged" sentence is true and is kept.
- Added a fourth subtest covering the config.yaml rung on the constructor path.
The three existing subtests only reach the env rung, so poolTimeoutFromConfig's
directory fallback -- the rung a library consumer that never called
config.Initialize depends on -- was pinned only for applyResolvedConfig
(TestApplyResolvedConfig in open_test.go). The new subtest mirrors that one
through applyConfigDefaults, which reads the directory off cfg.BeadsDir rather
than a parameter, and asserts the no-global-viper premise first so it cannot
pass vacuously. Proven load-bearing: disabling the GetStringFromDir rung fails
exactly two subtests, base's and this new one.
- Listed pool_timeouts_test.go in internal/storage/dolt/BUILD.bazel's go_test
srcs. At origin/main that list is an exact 223/223 match with the package's
test files, so it is gazelle-maintained and the PR's new file was the only
drift in the merged tree (223 srcs vs 224 on disk) -- which is what
.github/workflows/bazel.yml's `make bazel-sync` + git-status check reds on.
Added the single entry by hand rather than running a full sync, so no
base-owned rows come along.
Declined, deliberately: the nit proposing a `beadsDir string` parameter for
poolTimeoutFromConfig. The claude lane names that exact shape as the refactor
that silently re-opens #6144 while every existing pin stays green, and the two
items are coupled through their remedies. The coverage subtest above is the
precondition for it, so the ordering is recorded for a future change rather than
taken here; it is optional and out of scope for a non-gating nit.
Validation on this head: go build ./... and go vet ./internal/storage/dolt/
clean, gofmt clean, and -run
'^(TestApplyConfigDefaultsAppliesPoolTimeoutLadder|TestApplyResolvedConfig)$'
gives 2 top-level PASS / 17 subtests / 0 FAIL.
* fix(dolt): drop the last false serve-provider claim in applyConfigDefaults
d0f0b013fe removed "bd serve's store provider" from the list of
DoltStore opens that reach New in four places, but a fifth copy in
store.go's applyConfigDefaults comment survived: there the phrase wraps
across two comment lines, so a single-line grep for it misses it.
bd serve's HTTP data path builds its own ExternalDoltConfig and never
calls dolt.New (cmd/bd/uow_factory.go), so it does not get the pool
deadlines. Keep only what is true: the CLI's store and library callers
of New/NewFromConfig* all reach New, which is the only non-test caller
of newServerMode (the sole DoltStore constructor). This matches the
CHANGELOG entry's wording. Comment-only; no behavior change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(import): normalize optional timestamps to UTC on insert
On JSONL import, an optional timestamp carrying a non-UTC offset (e.g. a
closed_at of `...-04:00` from an older SQLite-era export) kept its local
wall-clock digits: created_at/updated_at were normalized to UTC on insert
but closed_at and the other optional pointer timestamps were not, so the
stored instant shifted by the host's UTC offset while every other field
round-tripped cleanly.
Add Issue.NormalizeOptionalTimestampsToUTC and call it from both insert
paths (embedded PrepareIssueForInsert and proxied-server
normalizeIssueTimestamps) so started_at, closed_at, compacted_at, due_at,
defer_until, lease_expires_at and heartbeat_at are converted to true UTC,
exactly as created_at/updated_at already are.
Fixes#5765
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(bazel): enumerate the two new UTC-normalization test files in go_test srcs
gazelle-generated, one line per package, both packages owned by this PR.
Each file is untagged so its go_test target owes the enumeration; the
in-package census showed the gap was exactly these two with zero
pre-existing untagged gaps (59 vs 58, 61 vs 60).
* review: correct the domain/db mechanism claim and pin the full timestamp set
Applies the two optional in-PR minors from the bd-s0msb iteration-1 review
synthesis (both Gate impact: none; the synthesis and scorecard both decided
approve with zero blockers and zero majors).
- normalize_timestamps_utc_test.go header claimed this route covers "the
proxied-server insert path share of #5765". It does not: domain/db runs on
go-sql-driver, whose DSN Loc defaults to time.UTC and which converts bound
time.Time values into that location on both the interpolate and prepared
paths, and no production DSN sets loc=. The embedded route is the one that
discards offsets, formatting in the value own zone via vitess
BuildBindVariable. Reworded to state the call is defense-in-depth for parity
with the embedded path. The test body is unchanged and still passes.
- NormalizeOptionalTimestampsToUTC hand-enumerates its 7 *time.Time fields to
keep the insert path free of reflection, but the two new tests assert only 5
of them, leaving LeaseExpiresAt and HeartbeatAt normalized yet unasserted, so
an 8th field added later would be skipped silently. Adds a reflection-driven
drift tripwire that walks Issue, sets every *time.Time to a fixed non-UTC
zone, and fails on any field left off UTC. Dropping &i.HeartbeatAt from the
helper reds it naming HeartbeatAt while both pre-existing tests stay green.
No production code changes. The tripwire went into the existing types_test.go,
so no new go_test src is owed in internal/types/BUILD.bazel.
---------
Co-authored-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(embeddeddolt): commit pending changes before push (#5433)
Every Pull variant (Pull, PullWithStrategy, PullRemoteWithStrategy,
PullRemote, PullFrom) auto-commits pending working-set changes first
(GH#2474, so a crashed command's leftovers don't make the merge
refuse to start), but no Push variant (Push, ForcePush, PushRemote,
PushTo) did. A write that landed in the working set but was never
explicitly committed -- auto-commit configured off, or a session that
ended right after a write with no intervening commit -- silently
pushed nothing new while `bd dolt push` still printed "Push
complete." and exited 0.
This is the half of #5433's silent-stall report the maintainer traced
and confirmed in code (issue comment, quoting exact line numbers this
matches on current main): "every Pull variant calls CommitPending
before pulling... no Push variant does... push never flushes the
working set, then prints 'Push complete.' on nil error with no
remote-ref or working-set check. Strongest hook for a narrow
push-honesty PR." Reporter confirmed: "Yes, please open the
push-honesty PR. That is the surface that actually cost us."
Scoped to exactly this half -- the confirmed, traced, mechanical gap
matching an already-established pattern (copy Pull's own guard to
Push). Did NOT attempt the harder half discussed in the same thread:
verifying the remote ref actually advanced and reporting honestly
when it didn't. That needs a deliberate design call the maintainer
themselves treated as separate (distinguishing a legitimate no-op
push, already in sync, from one that had something to send but
transferred nothing) and risks false positives if done carelessly --
a bigger change than this issue's narrowed scope asked for. Flagging
in the relay rather than guessing at that design.
Also confirmed the server-mode backend (internal/storage/dolt) has
the identical asymmetry -- Push/ForcePush/PushRemote all route through
pushToRemote, which likewise never calls CommitPending -- but the
issue's repro and the maintainer's trace are both embedded-mode
specific, so left server-mode untouched pending its own verification.
Does not claim to fix the mysterious full stall itself (bd dolt
commit also returning "Nothing to commit" while HEAD stays frozen,
even when called directly) -- the reporter and maintainer both
independently concluded that has no known deterministic trigger.
This closes one real, confirmed contributing gap: push not flushing
pending changes the way pull always has.
RED: added TestPushCommitsPendingChangesFirst, table-driven over all
four Push variants. Creates an issue (a genuinely pending, uncommitted
change -- verified via GetCurrentCommit before/after CreateIssue, so
the test would fail loudly if CreateIssue ever started auto-committing
on its own), then calls each Push variant and asserts HEAD moved.
Push/ForcePush/PushRemote route through the swappable vcPush/
vcForcePush vars (remote_peer_auth_test.go's existing
captureRemoteEntryPoints seam) so the test stops with errStopRemote
before any network IO; PushTo calls versioncontrolops.Push directly
with no equivalent seam, so it actually attempts the push and fails on
"remote not found" in this remote-less test store -- still proves
CommitPending ran first, since that failure only happens after this
fix's guard clause. All four failed pre-fix (HEAD did not move).
GREEN: all four pass after the fix.
Verified: full remote-verb/peer-auth suite (TestWithPeerAuth and its
variants, TestRemoteVerbsPresentStoredPeerCredentials,
TestRemoteVerbPlainRemote*) still green -- confirms this fix doesn't
disturb credential resolution or the swappable-seam test
infrastructure it shares. go vet clean, go build ./... clean across
the repo.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018c3vLFNVgPebSpCJrd8xTD
* chore(bazel): enumerate push_commit_pending_test.go in embeddeddolt go_test srcs
Generated by `bazel run //:gazelle`. The PR predates base's addition of
internal/storage/embeddeddolt/BUILD.bazel, so its new test file was not in
the explicit go_test srcs list; bazel would have silently run zero of its
cases. Base parity at the rebase base was 118/118 enumerated.
* fix(autopush): record post-push HEAD, and cover the clean-store push path
Maintainer review fixup for #5795 (adopt-pr review iteration 1).
Push now commits pending changes before pushing (GH#5433), so HEAD can move
across the call. maybeAutoPush read HEAD only before the push and recorded that
hash as LastCommit, which is now the parent of what was actually pushed, so the
next tick saw a mismatch and pushed once redundantly before re-latching. Route
the recorded hash through pushedCommitForState, which re-reads HEAD after a
successful push and falls back to the pre-push value if the re-read fails (the
push itself already succeeded, so dropping LastCommit would lose change
detection entirely).
Also:
- Add a clean-store arm to TestPushCommitsPendingChangesFirst. The guard relies
on commitAll(tolerateEmpty=true) mapping Dolt's "nothing to commit" to
(false, nil) for every push against an already-committed store, and nothing
in this package asserted it. Flipping that flag reds the new arm alone, with
the four pending-change arms still green.
- Correct the `bd dolt remote reset-data` confirmation, which promised the
remote is "rebuilt from local HEAD" while the push now adds a commit created
after the operator types y.
Not taken here, tracked separately: extending auto-push change detection to also
fire on a dirty working set (that gate predates this PR, so skipping it is an
incompleteness rather than a regression this PR introduces), and the PR-body
disclosure that push now commits on the auto-push and `bd sync` cadences.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(graph): route render modes through command writer (#5622)
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* test(output): ratchet list and graph stdout routing (#5617)
Replace the rejected source-shape census with typed forbidigo rules for process-stdout writes across list and graph files. Existing out-of-scope paths carry visible line-local exceptions; new sites fail lint by default.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* docs(lint): link graph diagnostics and exclusions (saa-cgh.75)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* 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>
* 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>
* test(scripts): resolve Git Bash explicitly on Windows
Add one test-only resolver that positively identifies Git Bash on Windows and use it in the doc-freshness and PR-preflight fixtures. Preserve ordinary PATH resolution on non-Windows hosts and leave the remaining #5727 callers for follow-up.
Part of #5727.
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* docs(testbash): state exact probe completion requirements
Document that capability scripts must be silent on both streams and reach
the sentinel epilogue without exiting the shell. Remove redundant startup
environment entries already stripped by the shared resolver.
Bead: saa-cgh.13
Agent-Signature: unknown-model/unknown-reasoning
* chore(bazel): sync BUILD files for scripts/internal/testbash
`make bazel-sync` output for the new `scripts/internal/testbash` package,
regenerated with `bazel run //:gazelle`:
- add the generated `scripts/internal/testbash/BUILD.bazel`
(`go_library testbash` + `go_test testbash_test`)
- add `//scripts/internal/testbash` to `//scripts:scripts_test` deps
Without this, `bazel.yml` fails two ways:
1. `bazel test //... --config=integration` (bazel.yml:592) is a hard compile
failure — `compilepkg: missing strict dependencies` for the
`scripts/internal/testbash` import in both `check_doc_freshness_test.go`
and `pr_preflight_test.go`. The default config builds clean because both
files are `//go:build integration`, so only the integration lane sees it.
2. The `BUILD files in sync` step (bazel.yml:310) exits 1 on the
`make bazel-sync` drift.
`make bazel-sync-check` (go_srcs globs only) and the repo's own
`TestBazel*` policy tests are both blind to this and pass either way.
* fix(testbash): pin the sanitization contract and split probe diagnostics
Maintainer review fixups for the adopt-pr review of PR #5730 (iteration 1,
synthesis approve / no blocker or major; all items were non-gating).
Finding 1 (minor, Test Evidence Quality) — the sanitization test's oracle was
the predicate under test. TestSanitizedEnvironmentRemovesBashAuthorityControls
validated the sanitized result by calling isBashAuthorityControl, the very
predicate sanitizedEnvironment filters with, so filter and oracle weakened in
lockstep and the assertion could not fail for any definition of the predicate.
It now asserts against the test's own controls literal and checks the
BASH_FUNC_ prefix class separately, pinning both the filter plumbing and the
key list. Proven with a three-arm control: fixed test + real predicate passes;
fixed test + a full `return false` neuter of isBashAuthorityControl now FAILS
(it previously passed); the original test + the same neuter still passes, so the
new failure is caused by this change and not by the mutation itself.
Finding 4 (nit, Debuggability) — a chatty-but-successful probe reported the
sentinel as unreached while its own quoted payload contained it. runProbe now
branches on strings.HasSuffix and emits a distinct "completed but wrote
unexpected output before the execution sentinel" message quoting only the stray
payload. The three existing assertions on "without the exact execution
sentinel" all cover cases whose output is empty (early exit, noexec), so none
of them can take the new branch; verified by execution.
Finding 3 (nit, Debuggability) — Probe's doc comment named only the three Bash
control classes while the implementation also strips GIT_EXEC_PATH. The comment
now documents Bash and Git authority controls explicitly.
Finding 2 (minor, Test Evidence Quality) is deliberately NOT taken here and
remains a non-gating follow-up. Its primary remedy — adding
./scripts/internal/testbash to the windows-latest leg — would execute four
//go:build windows tests that have never run on any lane, and the synthesis's
own Unresolved Uncertainty concerns MSYS2 PATH handling in exactly this
package's validateCandidate, which is not verifiable from Linux; a first-ever
execution that reds pr-preflight-platforms is not the "nearby, cheap, low-risk"
cleanup the operator contract allows. Its fallback arm only typechecks and
would edit repo-wide CI outside this PR's payload. Note that finding 1 reduces
finding 2's severity: the sanitization contract is now pinned on every Linux
lane instead of only incidentally on Windows.
Validation: go test ./scripts/internal/testbash ok; go test -run
'^TestDocFreshness|^TestPRPreflight' ./scripts ok, and ok again with
-tags=integration,gms_pure_go; gofmt clean; go vet clean; CGO_ENABLED=0
GOOS=windows go vet ./scripts/... and go build ./scripts/... both rc=0;
git diff --check clean. No files added or removed, so the generated
BUILD.bazel srcs are unchanged.
Contributor commits are untouched.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* 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
* feat(stats): count the rows the default listing suppresses
bd status counts the issues table; bd list hides gates and templates on
account of what they are. The two therefore disagree, and nothing
reconciles them: a teardown driven by bd list leaves a gate behind and
status reports a total the operator cannot account for from any listing.
Break the suppressed rows out as their own counts. TotalIssues keeps
counting the database, which is what a command titled "Issue Database
Status" should report; these say how much of that total no default
listing will show. Every backend's statistics path funnels through
ScanIssueCountsInTx, so one query serves all of them.
Infra types need no counterpart here: they live on the wisp plane, which
this query does not read.
* fix(status): disclose the counted rows bd list will not show
bd status reported "Total Issues: 2" for a workspace whose every listing
showed one, because gates and templates are suppressed from a default
bd list. Nothing connected the two numbers, so the remainder read as a
phantom -- most visibly after a teardown driven by bd list, which leaves
its gates behind and then cannot see them.
Report the suppressed rows under the summary they qualify, naming the
flag that reveals each kind. The breakdown is printed rather than a
single hidden-total, since a template gate would otherwise be counted
twice. Nothing is printed when there is nothing suppressed.
Stacked on the statistics counts that make this reportable.
* docs(api): put gate_issues and template_issues on the Statistics schema
The Statistics schema is pinned to types.Statistics, so the two new
counts were on the wire the moment the struct grew them, and
TestWireTagBijection fails the openapi gate until the spec says so:
Go fields with no spec property: [gate_issues template_issues]
Document both as a breakdown of total_issues rather than an addition to
it — they count rows the default `bd list` suppresses, which
total_issues already includes — and warn against summing them, since a
row can be both a gate and a template.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(status): give --assigned the same disclosure, and test the behavior
Three points from review.
1. `bd status --assigned` never printed the line. AssigneeStats does not
go through ScanIssueCountsInTx - it folds one actor's rows through
workapi.FoldStatsAssigneeSummary, which left both new fields zero. That
route's filter sets only Assignee, so IsTemplate stays nil and the
actor's gates and protos really ARE in those rows while
`bd list --assignee` suppresses both: the same reconciliation gap, one
scope down. The fold now counts them, and its doc says they are set
deliberately rather than borrowed from a workspace-wide answer.
2. The infra-type suppression is now explained rather than asserted away,
and the answer is that a durable infra row is NOT unreachable, so the
third breakdown is filed as GH#6439 rather than dismissed. Both the
plane routing and the listing's exclusions read the workspace-configured
types.infra set, and writing that key only invalidates a cache
(dolt/config.go) - it never moves rows already written. So durable rows
created while a type was not infra stay durable once it becomes one, and
a type evicted from the set creates durable rows outright, which the
create contract already pins ("evicted infra type",
issue_operations_contract.go). Counting them needs that configured set,
which ScanIssueCountsInTx - portable SQL with no config seam, called
from six backend sites - cannot reach; guessing with the built-in names
would be wrong in exactly the workspaces where it matters.
suppressedTypeSummary's doc now carries that reasoning.
3. The behavior itself had no test - both existing cases exercised a pure
string formatter, and would pass with the render call site deleted. Now:
- TestRenderStatusEmitsTheSuppressedRowsLine captures renderStatus's
stdout, asserts the line and both parts, and asserts it sits after the
totals it reconciles rather than in the extended block. It fails with
the call site removed ("renderStatus did not emit the disclosure
line"), plus a companion asserting the line is absent when there is
nothing to disclose.
- Three conformance cases in stats_reporter_contract.go, wired into all
three role wirings (dolt, embeddeddolt, uow), so the new SQL is
checked cross-backend rather than at one call site:
BreaksOutTheRowsTheDefaultListingSuppresses (with the negative rows a
loose predicate would also move), BreaksOutAGateThatIsAlsoATemplate
(the two suppressions are independent, so a proto's gate step counts
in both), and AssigneeStatsBreaksOutTheSuppressedRows for the fold.
statsReporterCounts and assertStatsReporterDelta carry the two fields.
All three are behavioral reds against zeroed counts, not compile
errors:
GateIssues moved by 0 (0 -> 0), want 1
TemplateIssues moved by 0 (0 -> 0), want 1
GateIssues = 0, want 1 - the actor's gate is in this answer but
not in `bd list --assignee`
4. Nit: pluralCount takes both spellings instead of appending "s", so a
caller with an irregular plural is not silently mis-served.
Also adds the CHANGELOG entry the behavior change was missing, including
the GH#6439 gap.
Reported-by: bee-ghosttrack
Agent-Signature: claude-code-opus-5-unknown-reasoning on behalf of Harry Miller
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(conformance): declare the new stats cases in the order the table runs them
TestRoleContractCasesCoverEveryContractCase checks more than coverage: the
roleContractCases table has to list cases in the order their contract file
DECLARES them, because that is the order the unit-of-work leg's runners use
and the order its config-writing cases depend on.
I declared all three new cases together, then registered the assignee one
with the other assignee cases in the table, so the two orders disagreed:
roleContractCases is out of declaration order at position 449: table
has RunStatsReporterAStatusOutsideTheTalliesIsCountedOnlyInTotal,
source has RunStatsReporterAssigneeStatsBreaksOutTheSuppressedRows
Fixed by moving the declaration rather than the table entry, since the
assignee case belongs beside the other assignee-scoped ones anyway - the
grouping the table already had was the correct one. Caught by CI because I
ran go vet over backend/conformance but not its tests; both now pass.
Agent-Signature: claude-code-opus-5-unknown-reasoning on behalf of Harry Miller
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs(changelog): move this PR's entry under [Unreleased]
The 1.3.0 cut renamed the old [Unreleased] block, so the entry this branch
added there now merges cleanly into the released [1.3.0] section (#6643).
Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(status): complete the disclosure's remedy and pin its population
Maintainer review fixes for PR #5763 (adopt-pr iteration 1). Four of the
five review findings taken; the nit is declined with its measurement.
Finding 2 (minor, gate impact minor) - the printed remedy was incomplete.
The two counters come from the same scan as TotalIssues and are status-blind
with it, but the flags they named lift only the TYPE exclusion, so a CLOSED
gate was counted while `bd list --include-gates` still would not show it.
Gates are closed as the work they guard completes, so that is the ordinary
case rather than an edge.
Took the "complete the hint" arm over the "scope the counters" arm. Every
other field ScanIssueCountsInTx fills is workspace-wide; the disclosure
exists to account for TotalIssues, a database number printed three lines
above it; and scoping these two to the listing's population would leave them
explaining nothing about the total they are broken out of. `--all` "replaces
the status exclusions only" and lifts no type exclusion of its own
(backend/conformance/reader_contract.go:487), so the two flags together are
exactly the remedy. Recorded the population in the types.go field comment,
the status.go doc, and the CHANGELOG, which printed the old example verbatim.
Finding 3 (minor) - the three new conformance cases seeded only open rows,
so a backend counting over every status and one counting only the listing's
population returned identical numbers on all of them. Added a closed gate and
a closed proto to the first case. Proved it now decides the question: scoping
both SQL SUMs with `AND status <> 'closed'` reds exactly that case
("GateIssues moved by 1 (0 -> 1), want 2") while the all-open sibling
BreaksOutAGateThatIsAlsoATemplate stays green.
Finding 4 (minor) - the normative role doc in issueops/statsreporter.go
enumerated only the six prior counts. Added the two to that scan's bullet and
corrected two statements this PR had falsified: the headline "six counts of
one set", and the AssigneeStats bullet's "the fold ... tallies the five
statuses and nothing else", which stopped being true when the fold gained the
two increments.
Finding 1 (minor, gate impact minor) - ran `make bazel-sync`. It proposed
exactly one line, `+ "status_suppressed_test.go"` in cmd/bd/BUILD.bazel, and
nothing else, confirmed by porcelain rather than by bazel-sync-check.
Generator-owned, not hand-edited.
Finding 5 (nit) - declined. The three helpers already in package main
(pluralIssue, pluralize, plural) all DERIVE the "s" and cannot render a
caller-chosen pair; the tree's one two-form helper, pluralWord, is unexported
in internal/storage/issueops, and exporting it so a CLI string could reach it
would add exported surface to a storage role for a cosmetic. Recorded that
trade in pluralCount's doc comment instead.
Validation: `go build ./...` and `go vet` (6 pkgs) clean, gofmt clean,
`git diff --check` clean; cmd/bd 4/4 named PASS, internal/httpapi
TestWireTagBijection|TestSpec* PASS, internal/workapi PASS,
internal/storage/uow TestStatsReporterContract 18/18 subtests PASS. Both new
pins are mutation-proved: reverting `--all` reds all four table cases, both
flag subtests and the render-path pin, while the absence assertion stays
green.
Not done here: the PR body carries the same stale example line
("1 gate (--include-gates)"). Review iterations do not touch the PR surface,
so that correction is stamped for finalize.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
The update operation had no way to express a claim, so an HTTP client of
`bd serve` had to refuse `bd update <id> --claim` outright. The request now
carries a `claim` boolean that passes straight through to
issueops.UpdateRequest.Claim on the same lifecycle role the direct route
uses, so the claim and the patch land in one transaction with the direct
route's semantics: same-actor re-claim is idempotent (changed: false), a
foreign holder is 409 already_claimed and an unclaimable status 409
not_claimable, both naming `claim` and carrying {id}:claim's extension
members (shared through claimRefusal), and a refused claim writes none of
the patch.
With claim: true the patch may be empty (the claim is the whole write).
claim beside expected_assignee, expected_status or force_assignee_transfer
is refused at the edge as a 400 naming `claim` rather than surfacing the
role's ErrValidation as the generic patch 400. No capability token: per the
document's version-skew rules, member presence is probed, and an older
server refuses `claim` as unknown_parameter before any database work.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Identify HOME and USERPROFILE in unsafe user-home diagnostics without changing path resolution or filesystem behavior.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
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>
* fix(cli): document that bd list --format exports the dependency graph
The --format help read "Output format: 'digraph' ..., 'dot' ..., or Go
template", which reads like a per-issue rendering knob. It is not. Every
non-dot format in outputFormattedList walks the dependency edges between
the listed issues and renders one line per edge, so `bd list --format
digraph` and `bd list --format '<template>'` print nothing at all and
exit 0 whenever no listed issue depends on another. Only 'dot' declares
nodes, so it is the one value that always produces output, which makes
the other two look broken rather than empty.
The template context is the edge too: .IssueID, .DependsOnID, .Type,
.Issue, .Dependency. Nothing named .ID exists at the top level, so a
plausible-looking `--format '{{.ID}}'` renders "<no value>".
Behavior is unchanged. This corrects the advertised surface and adds a
test that pins the edge scope the help now states, covering both halves
of it: no output when there are no dependencies, and no output when the
only dependency leaves the listed set. The second case is the one that
holds the endpoint-membership guard in place, so a listing cannot start
spilling edges to issues the caller filtered out.
Generated CLI docs are not regenerated: docs/cli-docs.pin builds them
from tag v1.1.0, not HEAD, so regenerating here would create drift.
./scripts/check-cli-docs-drift.sh --base main reports PASS.
* docs(cli): name 'json' in the bd list --format help
--format also accepts 'json', special-cased in gatherListInput to mean
--json. The rewritten help read as exhaustive over graph formats, so it
was wrong for exactly that value, which is the defect the rest of the
string is fixing.
Name it, and note the precedence: runListCore's --json branch returns
before the --format branch is reached, so --json wins when both are given.
Verified against a built binary. --format json is byte-identical to
--json, --format JSON matches too since the special case uses EqualFold,
and --json --format digraph prints the JSON listing rather than the edge
list that --format digraph prints on its own.
---------
Co-authored-by: postoso <postoso@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(prime): document all three PRIME.md fallback tiers in --help
bd prime --help named a single PRIME.md location ("the local clone or
resolved workspace"), which conflates the current-directory and
resolved-workspace tiers and omits the global fallback entirely.
readCustomPrimeContent checks three locations in order: .beads/PRIME.md
relative to the current directory and PRIME.md in the workspace .beads
directory (both introduced together in GH#876), then
~/.config/beads/PRIME.md (added for GH#2330). Users and agents had no
way to discover that order from --help.
Document all three tiers in lookup order: tier 1 is
current-directory-relative, not clone-wide; tier 2 is the .beads
directory bd resolves for this workspace (described by outcome, since
FindBeadsDir has several resolution paths, most of which follow a
redirect); tier 3 is the global config fallback. The lead-in notes that
the lookup runs only once bd resolves a workspace, since runPrime
returns before readCustomPrimeContent otherwise (emitting no content,
or an empty --hook-json envelope). The single long help line becomes a
short bullet list with no line longer than the surrounding text.
Add TestPrimeHelpMentionsAllFallbackTiers, which asserts the tiers are
documented and appear in their actual lookup order.
Fixes gastownhall/beads#6095
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(prime): spell out per-OS user config dir for tier (3) in --help
Follow-up to #6095 review on #6275 (bee-ghosttrack, MAJOR 1 + MAJOR 2).
Tier (3) of the PRIME.md lookup order named ~/.config/beads/PRIME.md as
the global path, but resolveGlobalPrimePath uses os.UserConfigDir(),
which is ~/Library/Application Support on macOS (XDG_CONFIG_HOME is not
consulted) and %AppData% on Windows. On those platforms the help text
pointed users at a file bd never reads, reproducing the confusion #6095
exists to fix. Reword tier (3) to name the user config dir and list the
Linux, macOS, and Windows spellings.
TestPrimeHelpMentionsAllFallbackTiers no longer pins the Linux spelling
as its tier-3 needle; it asserts the platform-neutral "user config dir"
wording, checks that all three per-OS paths appear (the help text is
static, so every spelling must be present), and includes the literal
(1)/(2)/(3) labels in the ordering needles so that swapping only the
labels fails.
Docs-only: resolveGlobalPrimePath is unchanged; aligning its location
with the ~/.config/beads credentials path is left for its own issue.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(prime): make the PRIME.md tier help accurate under -C
Maintainer review fixes for #6275, review iteration 1. Both lanes and the
quality scorecard returned approve with no required changes; this commit takes
the two non-gating items, both text-only.
Taken:
- Contract & Interface Fidelity (minor, both lanes). Tier (1) is resolved
against primeWorkspaceDir(), which returns the absolute -C target when -C is
set (prime.go:281-289), so "relative to the current directory" was wrong
under `bd -C dir prime`. And tier (2)'s "honors $BEADS_DIR" was imprecise:
applyChangeDirSelection does os.Setenv("BEADS_DIR", resolveChangeDirBeadsDir(
-C target)) (main.go:943-956) before the command runs, so an exported
$BEADS_DIR is silently outranked by -C. Both amendments are help text only.
Verified at source rather than taken from the finding. Note the review's
suggested wording was written in markdown; the surrounding help text uses no
backticks, so the amendment matches the block's own plain style.
- Test Evidence Quality (nit, codex + claude). The comment claimed a
label-only swap "still fails the ordering check below", but since the (N)
label sits inside each needle such a swap drives every strings.Index to -1,
which trips the presence t.Errorf while the ordering loop explicitly
continues past -1. Reworded to name the assertion that actually catches it.
As base drift already moved tier (1) under the -C target without updating
base's own primeCmd.Long, the PR remains a strict improvement over base prose
either way.
Validation: gofmt clean, go build ./cmd/bd/ and CGO_ENABLED=1 go vet ./cmd/bd/
clean. TestPrimeHelpMentionsAllFallbackTiers still PASSES -- its three needles
are prefixes of the amended lines, so the ordering pin is untouched. Under
-run Prime: 61 PASS / 1 FAIL / 3 SKIP, and the single failure
(TestPrimeBinaryPortfolio) is pre-existing host contention, proven by a control
run at the unmodified head c9cfb3e416 which fails identically with the same
cause ("cannot start dolt server on port ...: busy").
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(doctor): preserve redirect-source dolt_database for no-DB commands (be-xil)
selectedNoDBBeadsDir() (used by doctor/bootstrap/context/dolt no-DB
commands) resolves an ambient beads dir via beads.FindBeadsDir(), which
always follows a .beads/redirect internally before returning. By the
time prepareSelectedNoDBContext's own internal
preserveRedirectSourceDatabase call sees a beadsDir, it is already the
post-redirect target (which has no redirect file of its own), so the
source repo's configured dolt_database is silently never captured into
BEADS_DOLT_SERVER_DATABASE. doctor's Dolt health checks still open the
store via BEADS_DOLT_SERVER_DATABASE when set, so this left doctor
falling through to the shared target's own default database and
reporting a false "wrong database" diagnosis with a destructive --fix.
Call preserveRedirectSourceDatabase with the source dir explicitly
before selectedNoDBBeadsDir() resolves and loses that information,
mirroring the pattern already used by the store-requiring
PersistentPreRunE path just below it.
go build/vet ./cmd/bd/... clean; new regression test and sibling
PersistentPreRun tests pass.
* test(doctor): red — explicit --db target must override ambient redirect
Adds TestDoctorPersistentPreRunExplicitDBTargetOverridesAmbientRedirect,
covering both reviewers' round-1 change request: an explicit --db target
must not be shadowed by an ambient repo's unrelated redirect-source
database. Currently RED — preserveRedirectSourceDatabase() is called
unconditionally, so BEADS_DOLT_SERVER_DATABASE leaks the ambient repo's
redirect-source db past the explicit target.
refs be-fyt
* fix(doctor): green — guard redirect-source preservation on explicit --db
Round 1 of be-fyt review: preserveRedirectSourceDatabase() was called
unconditionally inside the skipsStoreInit branch, mirroring the guard
already present on the store-requiring sibling branch below it. Since
beads.GetRedirectInfo() always resolves from the ambient CWD repo's
local .beads regardless of --db/BEADS_DIR (bd-wayc3), an explicit
--db/BEADS_DB/BD_DB target's own database was silently shadowed by the
ambient repo's unrelated redirect-source database — reopening be-xil's
failure mode via a narrower trigger.
Fix: only preserve the redirect-source database when dbPath is unset,
matching the existing guard at the sibling call site.
TestDoctorPersistentPreRunExplicitDBTargetOverridesAmbientRedirect now
passes; full ./cmd/bd/... suite shows the identical 9 pre-existing
be-j8e-class failures as the pre-fix baseline, no new failures.
refs be-fyt
* docs(release-gates): add be-27c gate record
Explicit --db target must override ambient redirect-source database
(be-xil follow-on). PASS 7/7, independently re-verified.
* test(doctor): red — BEADS_DB/BD_DB leak past the redirect-source guard
The skipsStoreInit guard added in 848ed9f9 is spelled `dbPath == ""`, and
the PR body describes it as covering "an explicit --db, BEADS_DB, or BD_DB
target". It does not: main.go:1002-1004 only falls back to the configured
db when BEADS_DB, BD_DB and BEADS_DIR are all unset, so with either env var
set and no --db flag, dbPath stays "" and the guard reads "no explicit
target given" for a caller that gave a perfectly explicit one.
selectedNoDBBeadsDir (main.go:519, :523) does honor BEADS_DB and BD_DB, so
the two disagree: BEADS_DIR is correctly rebound to the explicit target
while the ambient repo's redirect-source database is preserved into
BEADS_DOLT_SERVER_DATABASE anyway. That is be-xil's "wrong database"
failure mode, still live for two of the three targets the guard names.
Both subtests fail at this commit:
BEADS_DOLT_SERVER_DATABASE = "ambient_source_db", want ""
(leaked past an explicit BEADS_DB target)
BEADS_DOLT_SERVER_DATABASE = "ambient_source_db", want ""
(leaked past an explicit BD_DB target)
Reported in review of PR #5774 by bee-ghosttrack, item 2.
* fix(doctor): green — guard on the explicit target, not on dbPath
Replace the `dbPath == ""` guard with explicitDBTargetGiven(), which asks
the question selectedNoDBBeadsDir asks — dbPath, BEADS_DB, or BD_DB — so
the two cannot drift apart again. Both subtests from the previous commit
now pass; the four pre-existing PersistentPreRun tests are unchanged.
Deliberately NOT keyed on PersistentFlags().Changed("db"), which the review
suggested as the condition. A --db value naming a *database* rather than a
path is moved to dbNameFromDBFlag and clears dbPath (main.go ~990), and it
is consumed only on the store-requiring path (~1553, proxied-server mode).
On the no-DB path selectedNoDBBeadsDir therefore finds no explicit
directory target and falls through to beads.FindBeadsDir(), which follows
the ambient repo's redirect — so the ambient workspace IS what gets
selected and its source database must still be preserved. Measured on the
previous commit with `bd doctor --db somebaredbname` in a redirected repo:
dbPath=""
BEADS_DIR=".../ambient-shared/.beads" ← ambient redirect target
BEADS_DOLT_SERVER_DATABASE="ambient_source_db" ← correctly preserved
Keying on Changed("db") suppresses that and reopens be-xil for
`bd doctor --db <name>`. TestDoctorPersistentPreRunBareDBNameStillPreserves-
AmbientSourceDatabase pins it: with Changed("db") in the predicate it fails
with `BEADS_DOLT_SERVER_DATABASE = "", want "ambient_source_db"`.
(A free function referencing rootCmd also cannot compile here — it forms an
initialization cycle through rootCmd's own PersistentPreRunE — so that
variant would need cmd threaded through, as selectedNoDBBeadsDir does.)
Addresses review of PR #5774 by bee-ghosttrack, item 2.
* docs(changelog): record the redirect-source database fixes
Both entries under Unreleased/Fixed: the be-xil preservation for no-DB
commands, and the be-fyt explicit-target guard on top of it. Called out in
review of PR #5774 by bee-ghosttrack as a non-blocking gap — this is a
behavior change to bd doctor/bootstrap on every redirected workspace and
was not recorded anywhere users read.
* test(doctor): compare BEADS_DIR canonically so macOS passes
CI caught this on macos-latest (the only failing check on this PR):
doctor_context_test.go:376:
BEADS_DIR = "/private/var/folders/.../ambient-shared/.beads",
want "/var/folders/.../ambient-shared/.beads"
Same directory. On macOS /var is a symlink to /private/var, so t.TempDir()
hands back the /var form while the value under test is resolved through
beads.FindBeadsDir() -> utils.CanonicalizePath, which runs EvalSymlinks.
A raw string compare therefore fails on macOS and nowhere else.
Both of the assertions added in this PR now canonicalize each side before
comparing. Only my two are touched: the pre-existing sibling assertions
reach BEADS_DIR via resolveCommandBeadsDir(dbPath), which does not
EvalSymlinks, so they are unaffected and left alone rather than churned.
Canonicalizing is a no-op where the path is already resolved, so this is
symmetric and cannot mask a genuine mismatch — the assertion still fails if
a different directory is selected. Verified utils.CanonicalizePath does
resolve symlinks with a throwaway probe (symlink in, real path out).
* docs(cli): correct the "cannot drift apart" claim, name the BEADS_DIR gap
Review item 5 (round 2, PR #5774) is right and the claim in the code was
wrong. explicitDBTargetGiven covers three routes; selectedNoDBBeadsDir
honors a fourth — BEADS_DIR != "" -> beads.FindBeadsDir() (~line 551) —
so the two predicates still disagree there, and the comment asserting they
"cannot drift apart again" pointed a future reader at exactly the wrong
conclusion.
Reproduced before writing this, rather than taking the review's probe on
faith. At this head, BEADS_TEST_SKIP=dolt, ambient repo git init-ed with
an active redirect and BEADS_DIR naming an unrelated target:
PROBE[git_repo]: BEADS_DIR=".../target/.beads"
BEADS_DOLT_SERVER_DATABASE="ambient_source_db" <- leaked
dbPath=""
--- FAIL: .../git_repo
--- PASS: .../plain_dir
The plain_dir control passes, which pins the defect to the bd-wayc3 branch:
GetRedirectInfo only reaches the ambient repo through findLocalBdsDirInRepo
(internal/beads/beads.go:394), which keys off git.GetRepoRoot() alone. Every
test in doctor_context_test.go builds a plain t.TempDir(), so the branch
production always takes has no coverage — that is the second half of it.
Comments only; no behavior change, and the gap is documented rather than
closed here deliberately. Emptiness is the wrong test for it: BEADS_DIR
pre-set to the redirect target is bd-wayc3's own case, where preservation is
wanted, so the fix has to compare BEADS_DIR against the redirect target.
That comparison, the git-repo fixture and the third test case are specified
in be-bf75p with the probe source attached.
gofmt/vet/build clean; go test ./cmd/bd/ -run
'TestDoctorPersistentPreRun|TestBootstrapPersistentPreRun' green.
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-27c-redirect-source-guard-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
---------
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
* 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
* fix(config): share subprocess key identity for Git routing (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* 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>
* 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
* test(execenv): exercise exported host policy wiring (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(worktree): explain startup Git environment scope (saa-cgh.23)
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(git): isolate domain role configuration from inherited routing (saa-cgh.109.5)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): probe the selected repository before configuring roles (saa-cgh.109.8)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(init): explain role probe discovery ceiling behavior (saa-cgh.109.8)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): bind proxied tail Git operations to selected directory (saa-cgh.109.14)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Keep init role operations on the captured selected Git context (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Align selected-tail fixtures with captured role authority (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): select project origin before proxied persistence (GH#6384) (saa-cgh.120.8)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): use branch-local origin lookup fixtures (GH#6384) (saa-cgh.120.8)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): distinguish inline origin and normalize SCP remotes (saa-cgh.120.8)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): discriminate inline origin URL rewriting (saa-cgh.120.8)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitenv): keep discovery fences out of the routing scrub
Maintainer review fixes for the three majors in iteration 1.
Finding 1 -- routingKeys conflated Git's *redirect* keys with its *fence*
keys. Scrubbing a redirect narrows the authority a child inherits, which is
this package's purpose; scrubbing a fence widens it. Remove
GIT_CEILING_DIRECTORIES and GIT_DISCOVERY_ACROSS_FILESYSTEM from the set and
document why they must stay out. Reproduced at this head: under
GIT_CEILING_DIRECTORIES=$P/child, `git -C $P/child/sub config beads.role
maintainer` is refused (exit 128); with the ceiling scrubbed it exits 0 and
writes the privileged role into $P/.git/config. This matters most at the four
cmd/bd/config.go role sites, which pass neither -C nor cmd.Dir, and `-C` names
a directory rather than a repository, so an explicit directory is not a
substitute for the fence.
The other half of that finding -- narrowing the GIT_CONFIG prefix so
GIT_CONFIG_NOSYSTEM/_GLOBAL/_SYSTEM survive -- is deliberately NOT applied
here. Open PR #6461 already implements it value-aware (isConfigSuppression
retains GIT_CONFIG_GLOBAL=/dev/null but still scrubs
GIT_CONFIG_GLOBAL=/tmp/evil), which is stricter than the key-only form the
review prescribed. Applying the key-only form here would make
IsRoutingKeyForOS return false for the whole key and bypass #6461's value
check once the two merge. The injection channel this package must close, the
GIT_CONFIG_COUNT/KEY_n/VALUE_n triple, is covered either way. Tracked in
bd-dz16y.
Finding 2 -- the comment at cmd/bd/config.go:202 claimed "All role commands
ignore inherited Git routing", but only the writers are scrubbed; the readers
that resolve maintainer-vs-contributor are not. Scope the claim to the writers
in that file and name the uncovered plane, rather than duplicating reader
scrubs that open PR #6461 already carries for internal/routing,
beads.RepoContext, bd config show and bd doctor role (hooks.go is carried by
#6454/#6463/#6464). Tracked in bd-dz16y.
Finding 3 -- the scrubbed startup probe gitDirsForRepo has two byte-identical
unscrubbed twins in internal/beads, so the PR created a config-from-repo-A /
workspace-from-repo-B divergence. Take the documentation arm: worktrees.md no
longer claims every startup probe scrubs. #6461 hardens both twins; the code
half is tracked in bd-5p25o.
Also drop the dead isRoleGitRepo helper (Finding 5): it ran the same argv,
Dir and scrubbed env as the gitUC.IsGitRepo call whose result it was compared
against, so it always equalled isRepo while doubling a git subprocess. Its
comment also asserted that dropping discovery ceilings is intended, which the
Finding 1 fix falsifies.
Tests: a unit pin that the two fences survive ScrubRoutingForOS on both POSIX
and Windows semantics, and a behavioural pin that a scrubbed `git config`
cannot escape an operator ceiling into the containing repository. Both were
verified red before this change (IsRoutingKeyForOS = true, want false;
"scrubbed git config escaped the operator's ceiling") and green after.
Iteration 2 (non-gating minors/nits; scorecard 881/1000 approve, no blockers
or majors remained).
The routingKeys doc split the two removed keys by polarity instead of calling
both "fences". GIT_CEILING_DIRECTORIES withholds authority, so the "removing
one widens" direction claim is true only of it. GIT_DISCOVERY_ACROSS_FILESYSTEM
is permit-only: git already stops at a filesystem boundary, unset IS the stop,
and the variable exists only to disable it, so retaining an inherited =1 can
only widen. Retention is kept deliberately -- scrubbing it would cost a
legitimate cross-mount checkout every `bd worktree` verb, the minor PR #6464
iteration 2 adjudicated -- and the comment now states the cost that buys:
base 566c84ba8 scrubbed both keys in scrubWorktreeRemovalGitEnv's own
hardcoded exactKeys list, so re-pointing that adapter at ScrubRoutingForOS
reverses base policy for this key. The losing side is recorded in bd-dz16y.
The fences pin now carries a GIT_DISCOVERY_ACROSS_FILESYSTEM=1 row; the
previous =0-only fixture pinned git's own default, so a value-aware scrub that
retained only the no-op value would have passed it (probed: =0 retained, =1
dropped).
The cmd/bd/config.go:202 enumeration named only unscrubbed readers, but
bd init's own role accessors are unscrubbed too and one is a WRITER
(getBeadsRole init.go:2990, setBeadsRole init.go:3004,
init_contributor.go:345, none passing Env, Dir or -C). So two writes can
disagree, not just a write and a read: `bd init --role` can persist beads.role
into the inherited-routing target while `bd config set` writes the scrubbed
one. Those files are outside this PR's range, so the claim is corrected here
and the code gap is tracked in bd-dz16y item 2.
The ceiling pin now enters the fenced directory with t.Chdir instead of
setting cmd.Dir, matching the four production role sites that pass neither -C
nor cmd.Dir. Re-verified red before the fix in the new shape ("scrubbed git
config escaped the operator's ceiling"), green after.
Pre-approval CI: repair the two-way collision with #6477, which landed on
main during this PR's review.
#6477 (cf683435e) narrowed GetConfig's error swallow: only exit 1 with empty
stderr still reads as "absent"; everything else, including exit 128, now
surfaces. Each side is green alone, but merged they red in both directions,
and both reds are interaction-only (verified: this head alone green, main
alone green, merged red).
- This PR's TestInitGitRepositoryUsesSelectedDirectory/captured_home asserted
`require.NoError` with the comment "The existing reader maps Git exit errors
to absence" -- naming the exact premise #6477 deleted. The malformed
captured-HOME config now surfaces instead of reading as "no role set", so
the case expects the error. What it pins is unchanged: the generic
constructor still resolves against the current caller environment.
- #6477's TestConfig_ReadFailuresAreNotMissing/invalid_routing_boolean poisons
GIT_CONFIG_NOSYSTEM and read beads.role. That key is precisely the one this
PR makes immune to inherited config routing, so the case could no longer
observe its own poison. Retargeted to a non-role key (test.marker still
exits 128 with the same diagnostic, verified), and the role leg inverted to
pin the immunity instead -- dropping the scrub turns that NoError back into
the exit-128 routing error, so the case now guards the hardening rather than
merely avoiding it.
Rebased onto main (511849496) to express the main-side half; the rebased tree
is byte-identical to `git merge-tree origin/main HEAD`, so this is the
combination that will land.
Validation on the refreshed head: build, gofmt, `git diff --check`, `go vet`
and `GOOS=windows CGO_ENABLED=0 go vet` over all 11 changed packages, all
clean. gitenv/execenv/githooksenv/gittraceenv/storage-domain-git/config/
metrics/scripts suites green. `BD_LINT_NEW_FROM_MERGE_BASE=511849496 make
ci-pr-lint`: 0 issues on both the linux and windows arms. cmd/bd was run with
one selector over both sides' changed test files at this head and at main
alone: the FAIL and SKIP sets are byte-identical (16 base-preexisting init/
workspacegate failures, one of which names another test's temp dir), so this
PR adds no new cmd/bd failure.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(init): note proxied-init fingerprints still inherit Git routing
Maintainer review fix for the one minor in relaunch iteration 1 (codex,
verified by the synthesis).
resolveProxiedInitRemoteURL now reads origin from the selected project
through the routing-scrubbed NewInitGitRepository, but the repo_id and
clone_id computed right after it still come from beads.ComputeRepoID and
beads.GetCloneID. Both reach git through runGitInRepo/mainRepoRootForPath
in internal/beads/fingerprint.go, which set only cmd.Dir and inherit the
process environment. Probed at 8e77aa3523 with a throwaway package that
calls the real functions: under a decoy GIT_DIR + GIT_WORK_TREE both IDs
equal the decoy repository's; under a missing GIT_DIR both fail with "not
a git repository"; with no routing both match the selected project.
The review offered two arms. Arm (b), naming these calls in the #6460
deferral note, would record a false plan: #6460 scrubs the EnsureGitRepo
bootstrap and leaves both fingerprint calls unchanged, and no open PR
touches fingerprint.go. Arm (a), scrubbing inside the fingerprint helpers,
changes which repository bd doctor, bd migrate and embedded bd init
fingerprint for users who export GIT_DIR on purpose; that policy change
needs its own review. So the #6460 note stays as it is (it is still true),
a comment at the fingerprint call site names the gap, and the code change
is filed. Tracked in bd-6e967, which also carries the review's nit (no
test pins the cwd wiring at the resolveProxiedInitRemoteURL call site).
Validation: git diff --check and gofmt clean; go vet -tags gms_pure_go
./cmd/bd clean; golangci-lint --new-from-merge-base=origin/main
./cmd/bd/... 0 issues; TestProxiedInitRemoteURLUsesSelectedProject
passes.
Agent-Signature: claude-code-unknown-model-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
* fix(show): render Created/Started/Updated in local timezone
bd show printed these stored-UTC timestamps as bare dates without
converting, so if it's already tomorrow in UTC, the whole calendar day
was wrong.
Storage is unchanged and still UTC, as is --json.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(show): stop swapping time.Local in TimestampsRenderLocal
TestFormatIssueMetadata_TimestampsRenderLocal assigned the process-global
time.Local to pin a Pacific zone. Every time.Now() in the process reads that
variable, including goroutines no test can synchronize with: a net/http
connection from the serve test winding down after it returns, and the event
collector Dolt starts at package init. The swap is a data race, and -race
reports it whenever the unsynchronized read is still in the detector's
history: Bazel prcore shard 9 on this PR, and the test run alone (3/3).
Hand the stamp over in a zone twelve hours ahead of time.Local instead, so
its own digits fall on the next calendar day on any machine and only a
conversion to local time prints the right date. No global is written, so
the test runs in parallel like its neighbors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Merge Queue <merge-queue@gascity.local>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
* 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>
`bd list --parent <shortid>` (the id without its project prefix, e.g.
"c7v" instead of "tm-c7v") errored "not found: issue c7v" instead of
resolving the same way `bd history <shortid>` already does (GH#4868).
getHierarchicalChildren called store.GetIssue(ctx, parentID) directly
on the raw CLI value with no partial-ID resolution step at all.
Fixed by calling the same utils.ResolvePartialID used by bd history,
right at the top of getHierarchicalChildren, mirroring history.go's
own error handling: a resolved ID replaces parentID; an ambiguous
match is a hard error; a genuine not-found falls through unchanged so
the existing "parent issue '%s' not found" message still fires with
the id the user actually typed.
Scoped to exactly the code path the issue's repro hits (local/embedded
mode's getHierarchicalChildren, used by plain `bd list --parent` and
`--tree --parent`). Did not extend to:
- gatherProxiedHierarchical (list_show_filter_modes.go/
list_proxied_server.go), the proxied-server equivalent -- history.go
itself documents that proxied mode has no local store to resolve
against and intentionally passes the raw ID through for the server's
own lookup to handle, so this isn't an oversight to fix, it's the
existing convention.
- `--json --parent <shortid>`, which takes an entirely different code
path (reader.List's own ListRequest filter, built by
BuildListFilter/LoadStoreListConfig, never touching
getHierarchicalChildren at all) and has the same underlying gap but
fails differently -- silently returns [] instead of erroring.
Confirmed via manual repro. A real, separate defect, but fixing it
means resolving in a materially different layer (the filter
builder, not a single CLI command's helper), which is a broader
change than this issue asked for.
- The same shape of bug in `bd create --parent`, `bd ready --parent`,
and `bd label --parent`, which independently call GetIssue on a raw
--parent value the same way. Noticed while tracing this, not
reported, not verified beyond a grep -- flagging rather than
expanding scope on unconfirmed instances.
RED: added TestEmbeddedList/parent_filter_short_id, a real embedded-
Dolt CLI subprocess test (BEADS_TEST_EMBEDDED_DOLT=1) using the plain
(non-JSON) render to match the issue's own repro and the existing
tree_parent test's pattern. First draft used bdListJSON and passed
trivially even pre-fix -- caught by checking which exact code branch
the JSON path takes (jsonOutput's early return in list.go, well before
getHierarchicalChildren) and confirming zero-debug-output during
manual tracing; switched to bdList once that was understood. Confirmed
RED against unfixed code (children missing from output) before writing
the fix.
GREEN: children appear via both the full ID and the short ID after
the fix.
Verified: full TestEmbeddedList suite (51 subtests) green, no
regressions -- ran twice, once after the initial fix and once after
correcting the test to hit the right code path. go vet clean.
Claude-Session: https://claude.ai/code/session_018c3vLFNVgPebSpCJrd8xTD
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
MigrateUpWithLock consumes the one-shot FreshBootstrapHealCapability before
issuing CALL DOLT_RESET('--hard'), deliberately, so that no later pass can
re-arm a second destructive reset. The consequence is that whatever that one
reset returns is final for the database: if it fails, the interrupted bootstrap
refuses every later migration with DirtyTablesError and the only way back is a
human running 'bd dolt commit'. The outer retry cannot help — isRetryableError
excludes a 1105 that is not one of two named startup recoveries, and the
capability is spent either way.
That is only safe if a reset can fail for reasons that would persist. Dolt can
also abort the statement from inside the server. Its own debug log shows the
reset starting and failing under a millisecond later with a bare "context
canceled", on a healthy pinned session with no other session on the server, no
GC running, and the statements either side of it succeeding:
m=2.6865 cid=35 Starting query SELECT COUNT(*) FROM dolt_log WHERE commit_hash = '...'
m=2.6871 cid=35 Query finished in 0 ms
m=2.6873 cid=35 Starting query CALL DOLT_RESET('--hard')
m=2.6881 cid=35 error running query ERR=context canceled CALL DOLT_RESET('--hard')
m=2.6883 cid=35 Starting query SELECT RELEASE_LOCK('bd_schema_init:heal_exact_creator')
m=2.6893 cid=35 Query finished in 1 ms
The caller's context has minutes left at that point and the next statement on
that same context and connection succeeds, so this is not our own cancellation
being reported back. It is what makes
TestFreshBootstrapHealIncarnation/exact_creator_heals_its_interrupted_bootstrap
fail on shard 12 of the Server Dolt Full Suite.
Retry the reset up to three times, 50ms apart, stopping early when ctx.Err() is
set — the caller's own cancellation is not transient and must not spend the
attempts that remain. This does not weaken the one-shot invariant:
DOLT_RESET('--hard') is idempotent and the retries stay inside a single
authorized heal, on the same locked session, for the same incarnation, against
one consumed capability. A reset that keeps failing still fails the migration
with both the original refusal and the reset error.
Refs: be-v3ms8
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(doltserver): red — ResolveServerMode ignores BEADS_DOLT_SERVER_PORT/BEADS_DOLT_PORT (refs be-9i0yq.1)
* feat(doltserver): green — ResolveServerMode honors BEADS_DOLT_SERVER_PORT/BEADS_DOLT_PORT (refs be-9i0yq.1)
* test(doltserver): isolate BEADS_DOLT_SERVER_PORT/BEADS_DOLT_PORT in ambient-blind tests (refs be-lbnk8)
TestResolveServerMode_Default, _EmbeddedMode, and _EmbeddedHonoredWithoutServerEnv
cleared BEADS_DOLT_SHARED_SERVER/BEADS_DOLT_SERVER_MODE via t.Setenv but never
cleared BEADS_DOLT_SERVER_PORT/BEADS_DOLT_PORT, so they silently depended on
ambient absence of those two vars. That held in clean CI but not in this rig
(BEADS_DOLT_SERVER_PORT=28231 ambient), where round-1's new env-port-aware
step 2c in ResolveServerMode correctly fired and these three regressed.
servermode.go is unchanged: its precedence logic was already correct, and the
round-1 tests (EnvPortImpliesExternal, EnvPortOverridesStaleEmbedded) already
prove it. This is a test-hermeticity fix matching the isolation pattern those
two tests already follow.
* fix(doltserver): green — killStaleServersForDir ignores ambient BEADS_DOLT_SERVER_PORT (refs be-lbnk8)
killStaleServersForDir's orphan-cleanup guard (GH#2430) called the public
ResolveServerMode, which treats an ambient BEADS_DOLT_SERVER_PORT/
BEADS_DOLT_PORT (set fleet-wide on multi-agent rigs purely to route bd's
own client connections) the same as a genuine "not my server" declaration
(explicit shared-server/host/port config). That collapsed connection-
routing into lifecycle-ownership, so the guard silently skipped orphan
cleanup for directories beads still owns whenever the ambient var was set.
Split ResolveServerMode into a shared resolveServerMode(dir, honorPortEnv)
implementation:
- ResolveServerMode(dir) = resolveServerMode(dir, true) — unchanged
behavior for all existing callers.
- resolveServerModeIgnoringPortEnv(dir) = resolveServerMode(dir, false) —
skips only the ambient-port-var check, used solely by
killStaleServersForDir's guard.
Audited the other three production ResolveServerMode call sites
(internal/storage/dolt/open.go:47+182, cmd/bd/bootstrap.go:914); all three
correctly want the ambient port var included (auto-start suppression and
clone-strategy selection both need to route to an already-running server),
so they are left calling the public ResolveServerMode unchanged. A fourth
call site (internal/storage/dolt/store.go:1602) already independently
short-circuits on the same env vars before it would ever reach
ResolveServerMode, so it was unaffected by construction. Audit findings
recorded in be-lbnk8's notes.
TestKillStaleServersPreservesOtherRepoServers (added in the prior round)
now passes; TestResolveServerMode_HostInferredExternal and
TestResolveServerMode_EnvHostBeatsEmbeddedMetadata remain the same two
pre-existing/unrelated failures confirmed at the parent commit (tracked
as be-wbyau).
* docs(release-gates): record be-lbnk8 gate PASS (ambient serverport scoping fix)
Deploy gate for be-mob5e (source review be-lbnk8, deploy commit
f5328d863153ecef94df9713ca2e3ed5e0ab0a95). 7/7 criteria PASS, with
two named non-blocking exceptions in the policy/lint lane (stale
.githooks/commit-msg marker check, and a stale golangci-lint
result-cache artifact referencing a deleted worktree) — both
environmental, independently verified, unrelated to the diff.
* fix(doltserver): exempt proxied-server from the port-env check, gate the carve-out
Check 2c classified any workspace with BEADS_DOLT_SERVER_PORT set as external
without either guard HostImpliesServerMode applies. The proxied-server
exemption is the one that bites: a proxied workspace reaches its server through
the proxy, so an ambient port does not describe its lifecycle, and our own
constellation runs dolt_mode: proxied-server with that variable set. 2c now
mirrors 2b's exemption.
The second HostImpliesServerMode guard -- any explicit non-empty DoltMode
suppresses inference -- is deliberately NOT mirrored, because
TestResolveServerMode_EnvPortOverridesStaleEmbedded pins the opposite for
dolt_mode=embedded on GH#2949 grounds. configfile.IsDoltServerMode has no port
check at all, so for that one combination the storage-mode and lifecycle
resolvers still disagree. That is a precedence question above this change, not
something to settle by picking whichever makes the tests green; the code says
so and it is tracked separately.
Adds TestKillStaleServersReapsOrphanUnderAmbientServerPort, the missing gate on
the resolveServerModeIgnoringPortEnv carve-out: it sets the port variable
itself rather than relying on the host exporting one, so it catches a
re-disabled GH#2430 anywhere. Red/green confirmed -- pointing the guard back at
the naive ResolveServerMode gives killed=[], want [222].
Two mode tests also stopped inheriting an ambient Dolt port.
TestResolveServerMode_EnvHostBeatsEmbeddedMetadata and
TestResolveServerMode_HostInferredExternal neutralize SHARED_SERVER,
SERVER_MODE and SERVER_HOST but never the port vars, so on a host that exports
one they asserted against it. The latter fails that way on origin/main too. The
whole internal/doltserver package now passes under this rig's real ambient
BEADS_DOLT_SERVER_PORT, which the previous body claimed and did not do.
Adds the CHANGELOG entry this user-visible auto-start change was missing.
(refs be-lbnk8)
* refactor(configfile): centralize the port-implies-server-mode rule
doltserver kept a private doltServerPortFromEnv plus an inline proxied-server
exemption -- a second copy of a rule that belongs beside HostImpliesServerMode.
Extract Config.PortImpliesServerMode with the same shape (proxied exemption,
then BEADS_DOLT_SERVER_PORT and the legacy BEADS_DOLT_PORT) and have
resolveServerMode's check 2c call it. No resolver changes behaviour.
Also corrects check 2c's doc comment, which was the actual defect the review
found rather than the code. It claimed the "explicit non-empty DoltMode
suppresses inference" guard was deliberately unmirrored and called that an
unresolved precedence question. HostImpliesServerMode does not work that way:
it reads BEADS_DOLT_SERVER_HOST at configfile.go:421-423 and can return there,
before the DoltMode suppression at :424-426 is ever reached. Real precedence is
env > explicit dolt_mode > persisted host, and 2c already mirrors every tier
with a port-side counterpart -- there is no persisted-port tier to guard,
because an explicit dolt_mode=embedded returns at check 3 before check 4 reads
metadata.json's dolt_server_port. Settled as be-yb2ai;
TestResolveServerMode_EnvPortOverridesStaleEmbedded keeps pinning it.
IsDoltServerMode deliberately does NOT consult the new predicate: it selects the
storage backend for every data command, a far wider blast radius than this
lifecycle-only change, and extending it needs its own call-site audit. The two
resolvers therefore still disagree for an unset/embedded dolt_mode plus a bare
port env var and no other server signal. That gap is documented at both sites
and owned by be-2nolj.
TestPortImpliesServerMode covers the new predicate directly: 14 cases over env
precedence, invalid/zero/negative ports, env-beats-explicit-dolt_mode, and the
proxied-server exemption including case-insensitivity. (refs be-lbnk8)
* docs(changelog): say the ambient port marks external, not "no longer suppresses auto-start"
The headline claimed an ambient BEADS_DOLT_SERVER_PORT "no longer suppresses
auto-start". This PR does the opposite: check 2c yields ServerModeExternal for
that var, resolveAutoStart (internal/storage/dolt/open.go:223) returns false on
External, and ensureServerRunning (internal/doltserver/doltserver.go:969-985)
refuses to start with "auto-start is suppressed because the server is
externally managed".
Only the reap clause was true. The headline now states both halves as they
behave, matching the entry's own body text.
Review round 3 blocking point 1 (bee-ghosttrack).
* docs(dolt): note that an ambient server port marks the workspace external
docs/architecture/dolt.md presented BEADS_DOLT_SERVER_PORT purely as the port
knob, in both the server-mode connection table and the environment-variable
table. Since check 2c it is also a lifecycle assertion: on a plain
non-shared, non-proxied workspace it resolves ServerModeExternal, so
auto-start is suppressed and PortSourceEnv -- documented at
internal/doltserver/doltserver.go:630 as an authoritative user assertion --
is unreachable for a bd-owned auto-start. A user setting it to pick a port
gets the "externally managed" refusal instead of a server.
Both sites now say so. proxied-server is called out as exempt; shared-server
already resolves external at check 2, before 2c is reached.
Review round 3 non-blocking point 2 (bee-ghosttrack).
* docs(servermode): cite GH#6181 for the IsDoltServerMode gap, not an invisible bead
Both cross-references for the deferred resolver-precedence gap pointed at
be-2nolj, an internal bead id maintainers cannot see -- the reason review
round 3 asked for a GitHub issue. bee-ghosttrack opened GH#6181
("doltserver: ResolveServerMode and configfile.IsDoltServerMode must share
one inference gate") from this review, which is exactly that tracker, so the
comments now name it.
Comment-only; no behavior change.
Review round 3 point 2 follow-up (bee-ghosttrack).
* feat: green — Fix: PR #5934's env-port check reclassifies bd's own server as shared, so it refuses to migrate (refs be-4yy5e)
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-lbnk8-serverport-ambient-scope-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
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
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>
* fix(worktree): preserve CRLF gitignore appends (#5670)
Choose CRLF only when the user repository's existing .gitignore delimiters are consistently CRLF. Preserve existing bytes and retain LF as the default for every other convention.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(worktree): complete trailing CR before a CRLF gitignore append
Append only LF when the last existing byte already supplies the CR in the
file's unambiguous CRLF convention. Preserve all existing bytes and cover the
exact output and repeated-add behavior.
Refs gastownhall/beads#5677
Agent: unknown-model/unknown-reasoning
* docs(worktree): clarify LF trailing CR completion (saa-cgh.83)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(worktree): reuse the shared gitignore line-ending detector (saa-cgh.83)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): keep line ending coverage with its shared owner (saa-cgh.83)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* build(bazel): enumerate worktree_gitignore_eol_test.go in cmd/bd go_test srcs
cmd/bd/BUILD.bazel lists go_test srcs explicitly (647 entries), so the new
untagged test file added by this PR is not compiled into //cmd/bd:bd_test.
`make bazel-sync-check` cannot see this: it only runs tools/bazel/go_srcs.py,
which manages the go_srcs filegroup glob, not the go_library/go_test srcs
lists. The bazel.yml "BUILD files in sync" step runs `make bazel-sync` and
fails on any resulting porcelain drift, so gazelle adding this entry would
red that job; the lane is armed for this fork PR via
`github.event.pull_request.head.repo.fork == true`.
This line is gazelle's own output: re-running `make bazel-sync` after it
leaves the file unchanged. With it, both of the PR's new tests execute under
bazel (TestAddToGitignoreCompletesTrailingCR PASS in shard 3/16,
TestAddToGitignorePreservesCRLFWhenAppending PASS in shard 4/16;
//cmd/bd:bd_test 8 PASS / 0 FAIL / 0 SKIP) instead of being silently
excluded from every bazel target.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(worktree): cover the CRLF append arm that uses the detected line ending
Maintainer review fix for PR #5677, adoption iteration 1. The synthesis is
`approve` with no required changes; the one actionable finding is a minor, and it
is taken because the PR already owes a push (the rebase needed a repair and a
maintainer bazel commit is already on the branch).
addToGitignore's `separator := lineEnding` is guarded twice: the block is only
entered when the file does not end in "\n", and inside it a trailing "\r" is
completed with a bare "\n" instead. So the detected "\r\n" is used for exactly one
shape -- a CRLF file whose final byte is neither, i.e. an unterminated final line.
Neither existing fixture reaches it: "a/\r\nb/\r" ends in CR and takes the
completion branch, and "node_modules/\r\n" ends in LF so the block is never
entered. internal/gitignore's own table already covers this input for the
detector; the call site that consumes it did not.
The new case asserts the exact bytes for initial "node_modules/\r\nbuild/", and
appends twice so idempotence is covered as well as CRLF correctness.
Mutation-proved: replacing `separator := lineEnding` with a hardcoded "\n" --
which would write the mixed-terminator .gitignore this PR exists to prevent --
reds ONLY this new test; all three pre-existing tests stay green. That is the
surviving mutant the review reported, and it is now dead.
The remaining nit asked for no change ("None required": the inline duplication of
the append policy is byte-for-byte nil today, deliberate because the O_APPEND
stream cannot take a whole-buffer API, and locked by exact-byte tests), so none
was made.
Not included: `make bazel-sync` also wants an `upgrade_smoke_loop_test.go` row in
scripts/BUILD.bazel. That is base drift, not PR content -- the row is absent at
this branch's rebase base (147047e153) but origin/main already carries it, 33
commits ahead -- so it heals on the next base refresh, and adding it here would
duplicate main's own fix on a file this PR does not touch.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(show): preserve last-touched in readonly mode (#5785)
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* chore(bazel): enumerate last_touched_readonly_test.go in cmd/bd go_test srcs
adopt-pr maintainer fixup for PR #5786. The PR adds a new
//go:build cgo test file to cmd/bd; gazelle enumerates plain-cgo
test srcs unconditionally (330 of 645 enumerated srcs at the base
carry exactly that tag), so the new file is a real srcs-enumeration
gap. Produced by `make bazel-sync`; no hand-edits.
* fix(last-touched): guard ClearLastTouched, name both readonly triggers, add CHANGELOG entry
Maintainer review fixup for the adopt-pr review of #5786 (iteration 1,
synthesis approve, 0 blocker / 0 major).
- CHANGELOG: add the missing [Unreleased]/Fixed entry naming --readonly,
bd show and .beads/last-touched, linking #5785. Anchored at the tail of
the Fixed list rather than its top, which is where main appends.
- last_touched.go:65: the comment said "Strict --readonly", but the guard
also fires when the flag is absent and readonly:true is set in config
(main.go:1124 folds the config key into readonlyMode). Reworded to match
the repo's canonical phrasing at serve.go:617-618.
- ClearLastTouched: take the same readonly early return. Removing the
marker is as much a mutation of workspace-local state as writing it, so
this makes the file's stated invariant true rather than narrowing the
comment to match the gap. Zero production callers today (definition plus
one non-readonly test caller), so no shipping behavior changes.
Declined, both non-gating and both "Required fix: None for merge": moving
the cmdCtx.ReadonlyMode write in PersistentPreRunE (serve.go:612-618
documents reading the global deliberately, and the divergence is latent
rather than live), and its conditional test arm, whose antecedent is false
once the hardening is declined.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(feat): red — Restore migration_0033_test.go round-trip test (up/down/up, 2K rows) (refs be-auu.5)
* feat: green — Restore migration_0033_test.go round-trip test (up/down/up, 2K rows) (refs be-auu.5)
No production code change: migration 0052 (D4v2 composite status/updated_at
index + defer_until index, renumbered from 0033) already shipped correctly
via 0268ba894 (PR #3662). This bead restores test coverage only; there is no
implementation gap for TestMigration0052_RoundTrip /
TestMigration0052_ExplainCapture to expose. Verification: go build ./... and
go vet ./internal/storage/dolt/... both clean; go test ./... exits 1
repo-wide via the pre-existing baseline documented in be-m0cy (91 distinct
failures across 9 unrelated packages) -- no new failures beyond that
baseline. The two new tests skip cleanly (no local Docker/Dolt server in
this sandbox), consistent with sibling be-auu.1/.2/.3 verification notes.
* chore(release-gate): PASS record for be-s424 (migration 0052 round-trip test)
All 7 criteria pass. Restores test coverage for migration 0052 (renumbered
from 0033), a composite-index migration already live in production via
PR #3662. Independently re-verified: 4/4 diff-owned tests PASS with real
podman/Dolt containers, build/vet/gofmt clean, single-file diff, clean
divergence from origin/main.
* fix(test): gate migration 0052 EXPLAIN capture on an env var, not short mode
scripts/check-testing-short.sh reserves testing.Short() for true
runtime/stress/large-fixture skips and fails the PR-policy lane on any
other use. TestMigration0052_ExplainCapture used it for a
diagnostic-artifact boundary, so "check testing.Short boundaries" failed
and took the CI Gate / Required aggregator down with it.
Switch to the environment-check idiom the policy message itself
recommends, matching the BEADS_RUN_DOLT_UPSTREAM_REPRO gate on the
sibling repro test in this package.
This also makes the test do what its doc comment already claimed --
"skipped unless explicitly opted in". The short-mode guard did the
opposite: it ran the test by default and skipped it only in the -short
lanes.
Verified locally:
- scripts/check-testing-short.sh passes (was the failing gate)
- gofmt, go vet, go build all clean
- default path skips in 0.00s, no container started
- opt-in path (BEADS_RUN_EXPLAIN_CAPTURE=1) passes against a real Dolt
container and captures both plans, confirming IndexedTableAccess on
[issues.status,issues.updated_at] and [issues.defer_until]
- TestMigration0052_RoundTrip still passes (16.15s)
Refs be-s424, be-wlv5.
* test(dolt): make the migration 0052 EXPLAIN capture a real regression gate
The PR body advertised "EXPLAIN-verified query-plan assertions", but
TestMigration0052_ExplainCapture only t.Logf'd the plan and could not
fail. Since the right index names demonstrably do appear, asserting on
them costs nothing and converts a one-shot diagnostic into a standing
planner-regression gate: if a schema change or Dolt upgrade silently
stops using idx_issues_status_updated_at — an index whose entire
justification is that these two queries use it — this now fails instead
of printing a plan nobody reads.
Each case gains a wantIndex substring, checked against the accumulated
plan text. Matching the column list rather than the index identifier is
deliberate: EXPLAIN FORMAT=TREE names columns, not the index name, so
that is the strongest claim the output actually supports.
Verified against a real Dolt container (dolthub/dolt-sql-server:2.2.0),
BEADS_RUN_EXPLAIN_CAPTURE=1, both subtests pass:
IndexedTableAccess(issues)
index: [issues.status,issues.updated_at]
filters: [{[in_progress, in_progress], (NULL, 2020-01-01 ...)}, ...]
IndexedTableAccess(issues)
index: [issues.defer_until]
filters: [{(2026-09-03 07:36:36 +0000 UTC, ∞)}]
and confirmed non-vacuous: substituting a bogus wantIndex fails the
corresponding subtest.
The plan is still logged unconditionally — it is the be-eei §8 guardrail 4
artifact, and on failure it reports what the planner actually chose rather
than only that it was not what we wanted. The test remains opt-in, so the
gate only bites when someone runs it; that is the same bargain the fixture
cost already forced, and an assertion is strictly better than the t.Logf
it replaces.
Addresses review of PR #5796 by bee-ghosttrack.
* test(dolt): make the 0052 helpers' comments match what they do
Four review nits, all cases of a comment promising more than the code
delivered. Three are fixed by correcting the code, one by correcting the
comment.
sortedKeys did not sort. Go randomizes map iteration, so the index names
in a failure message reordered between runs and two reports of the same
failure could not be compared. Now sorts.
verifySampleIssues said it checked title, status and type; it read the ID
and a title prefix. It now checks status and issue type too, recomputing
the expected values from the ordinal encoded in the id rather than from a
"before" snapshot — so the assertion cannot be satisfied by a value the
round-trip corrupted symmetrically. Confirmed non-vacuous: permuting the
expected status cycle fails with
sample verify date-idx-000000: status mutated to "open", want "closed"
sampleIssueIDs claimed an evenly-spaced sample but takes the first N by
id. Here the comment was the wrong half — determinism is what the
round-trip check needs, and ORDER BY id ASC LIMIT N already provides it,
so a spread would add cost for no coverage. Comment corrected to say what
it does, and why that is sufficient.
The RoundTrip header now records that its up→down→up DDL is only safe
because setupTestStore puts each test on its own Dolt branch
(testutil.StartTestBranch, dolt_test.go:173). Dropping
idx_issues_status_updated_at mid-run on the shared testSharedDB would be
a package-wide hazard rather than a local one, so the note names it as
load-bearing and warns against adding t.Parallel() or removing the branch.
Addresses the nits from review of PR #5796 by bee-ghosttrack.
* test(dolt): anchor the 0052 EXPLAIN assertions to the index node, not the predicate
Review round 2, blocking: the second assertion was vacuous. wantIndex
"issues.defer_until" matched the plan's Filter node, which echoes the query's
own predicate, so it passed on a full table scan — the exact regression this
gate exists to catch.
Mutation-tested against a real dolthub/dolt-sql-server:2.2.0 container by
dropping idx_issues_defer_until after the fixture seed:
index dropped + old bare "issues.defer_until" -> PASS (vacuous)
index dropped + new "index: [issues.defer_until]" -> FAIL (gate bites)
index present + new "index: [issues.defer_until]" -> PASS
The degraded plan is:
└─ Filter
├─ ((NOT(issues.defer_until IS NULL)) AND (issues.defer_until > ...))
└─ Table
├─ name: issues
Table, not IndexedTableAccess — and the Filter line still contains the bare
substring, which is why the old form could never fail. Both cases now match
the "index: [...]" wrapper, which appears only on an IndexedTableAccess node.
Case 1 was already anchored (its column list is comma-joined and does not
appear in its Filter), but it takes the same form for consistency.
The field comment now records why the wrapper is load-bearing, so the "match
the column list, not the index name" rationale is not read as license to drop
it again.
Also from the same review:
- The header told readers not to add t.Parallel() while setupTestStore calls
it itself (dolt_test.go:140) — every run prints "=== PAUSE". Replaced with
what is actually load-bearing: the per-test Dolt branch.
- Citation dolt_test.go:173 -> :174 (the StartTestBranch line).
- sampleIssueIDs scopes its query with WHERE id LIKE 'date-idx-%', so the
caller's strconv.Atoi cannot hard-fail on a foreign id sorting ahead of the
fixture.
Verified with a real container, ambient BEADS_DOLT_SERVER_PORT unset:
BEADS_RUN_EXPLAIN_CAPTURE=1 -> ExplainCapture PASS (7.82s, both subtests),
RoundTrip PASS (16.23s); default path -> ExplainCapture SKIP, RoundTrip PASS.
Refs be-n2y2o.
* docs(release-gates): correct the be-s424 gate accounting and record round 2
Review round 2, nit: the gate record still claimed "352 lines / 1 file" and
4/4 PASS. It is 439 lines across 2 files at the current head, and 3 PASS /
1 SKIP on the default path now that ExplainCapture is env-gated.
The per-criterion numbers were accurate for the commit the gate evaluated
(961aa8cdd), so they are scoped to it rather than rewritten, matching how the
same correction was made on PR #6221. The 4/4 count is labelled as the
BEADS_RUN_EXPLAIN_CAPTURE=1 count.
Adds a round-2 addendum with the mutation-test table proving the old
assertion vacuous and the new one load-bearing, plus the current accounting.
Refs be-n2y2o.
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-s424-migration-0052-roundtrip-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
* chore(bazel): add migration_0052_test.go to internal/storage/dolt go_test srcs
The PR adds an untagged internal/storage/dolt/migration_0052_test.go. That
package's BUILD.bazel is base-added since this branch's merge base and its
go_test srcs is an explicit 207-entry list, not a glob, so the new file was
silently omitted: //internal/storage/dolt:dolt_test would never compile the
PR's 439-line regression test.
Neither check tool can see this -- tools/bazel/go_srcs.py --check and
make bazel-sync-check both exit 0 on the unrepaired head, because they only
validate the go_srcs filegroup glob, never go_library/go_test srcs.
Base parity decides it is PR-introduced: at the upstream base the same census
shows a gap of exactly 15 files and all 15 carry //go:build integration
(0 untagged), so the enumeration is exhaustive for untagged tests. Repair is
make bazel-sync, which inserted the one srcs line alphabetically. No deps line
is owed: //internal/storage and //internal/types are already in go_test deps.
* test(dolt): assert the 0052 index composition and give the plan probes rows
Maintainer review fixes for PR #5796, adoption iteration 1. The synthesis is
`approve` with no required changes; all four findings are minor or nit, and the
Pre-Merge Checklist orders them by value if the file is being touched anyway.
It is, so all four are taken. No production code; the payload stays one test
file.
F1 — index assertions were name-only. The entire D4v2 justification for
idx_issues_status_updated_at is column ORDER (status as the equality prefix,
updated_at as the range suffix), but SHOW INDEX was reduced to a name set, so a
migration that created the composite as (updated_at, status), or restored the
legacy idx_issues_status on another column, produced an identical name set and
satisfied every assertion while leaving the index useless for the two queries it
exists for. indexNames becomes indexColumns and returns name -> columns in
key-part order; Seq_in_index and Column_name were already being scanned and
discarded one line before use, so this costs no extra query. The round-trip now
pins (status, updated_at), (defer_until), and the post-down legacy (status).
Renaming the helper rather than keeping a name that no longer describes it is
the one deviation from the prescription.
F2 — both EXPLAIN probes matched zero rows. seedDateIndexFixture deliberately
leaves date columns NULL, so defer_until IS NOT NULL was false everywhere and no
row was older than the stale cutoff: the plans were asserted over an empty match
set, which is the same output an empty table gives, so the 1K seed bought no
signal. shapeDatePredicateMinority backdates updated_at and sets defer_until on
10% of the fixture, and each probe now asserts a non-zero match count next to its
plan so a PASS cannot mean "matched nothing". A minority and not the whole
fixture, because a predicate matching every row is not a range scan the planner
has reason to serve from an index. updated_at is assigned in the same statement
as defer_until: the column is ON UPDATE CURRENT_TIMESTAMP, so an UPDATE that did
not name it would bump the rows back to now and re-empty the match set.
Measured: 67 of 1000 rows for the stale probe, 100 of 1000 for the deferred
probe, and the planner still picks both indexes under the row-bearing fixture.
That last point settles the open uncertainty the review disclosed rather than
asserted -- whether a non-empty match set would make Dolt switch away from the
index. It does not.
F3 — a comment claimed the ORDER BY needed "no sort step". The test's own
captured plan contains TopN(Limit: [50]; issues.updated_at ASC). Dolt runs
status IN (...) as two index range scans and merges them, so the composite buys
access, not global ordering. Reworded to say that; no assertion changes, since
the assertion (index use) was always true.
F4 — cited line numbers had drifted across the 278-commit base advance:
StartTestBranch is at :180 not :174, t.Parallel() at :146 not :140, testTimeout
is 45s not the "30s" quoted. The getChildrenOfDeferredParentsInTx citation named
internal/storage/dolt/ready_work.go, a file that does not exist -- it is
internal/storage/issueops/ready_work.go. Every citation is now a symbol plus a
package path, which is what stops this drifting again; none is a line number.
Each fix carries its own evidence. The column-order assertion was checked by
flipping the expectation to (updated_at, status): it fails with "column 1 is
\"status\"; want \"updated_at\"", which is the regression the name-only form
passed. Both tests run live against Dolt 2.2.0 -- RoundTrip 27.0s,
ExplainCapture 14.4s with BEADS_RUN_EXPLAIN_CAPTURE=1, all PASS.
---------
Co-authored-by: Gas City Adopt-PR <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* feat(update): add -l shorthand for --add-label, matching bd create -l
bd create registers labels as StringSliceP("labels", "l", ...), so
`bd create -l foo` works. `bd update -l foo` did not: cobra prints usage
and exits 1 on an unknown shorthand.
That is a correct failure but an easy one to miss. A caller copying the
create form has no reason to expect the flag to differ, and the failure
looks like help output rather than an error in a scrolled log. In one
deployment this left issues believed-labelled that were not, until
someone checked by hand.
Additive: --add-label is unchanged. -l maps to ADD rather than SET
because add is the non-destructive reading and matches what create -l
does on a new issue. -l was previously unregistered on updateCmd (its
shorthands are -s, -t, -e), so there is no collision.
go test ./cmd/bd/ -run Update passes.
Executed-By: mayor
* fix(update): drop backquotes from the --add-label usage string
pflag's UnquoteUsage reads the first backquoted span in a usage string as
the flag's ARGUMENT NAME, so "-l matches `bd create -l`" rendered the flag
as
-l, --add-label bd create -l Add labels (repeatable); ...
in `bd update --help`, where every sibling shows its type. It now reads
`-l, --add-label strings`, matching --remove-label and --set-labels.
Adds the shorthand assertion the review asked for, plus a guard on the
rendered argument name so the backquotes cannot come back unnoticed. Both
verified red before green: restoring the backquotes fails the second test
with the string it renders, dropping -l fails the first.
* build(bazel): list update_add_label_shorthand_test.go in cmd/bd go_test srcs
cmd/bd/BUILD.bazel's go_test enumerates test srcs explicitly rather than
globbing, so the PR's new test file is invisible to `bazel test //...`.
This is review iteration 1's one minor finding (Change Impact / Blast
Radius, gate impact minor).
The drift is merge-target-attributable and this PR is its sole source:
`bazel run //:gazelle -- -mode=diff cmd/bd` (bazel 9.2.0) proposes five
srcs entries and four deps here, but the other four srcs and all four
deps are already present at origin/main -- only this file is absent
there. The reviewers' `if:`-guard uncertainty resolves against the PR:
bazel.yml's `bazel-test` job, which owns the "BUILD files in sync" step,
is gated on `vars.RBE_WEST_WORKERS == 'true' || inputs.rbe == 'off' ||
github.event.pull_request.head.repo.fork == true`, and #6139 is a fork
PR, so the third disjunct holds and the job runs. That step runs
`make bazel-sync` and fails on any `git status --porcelain` output, and
bazel-autofix.yml only pushes its patch to same-repo branches (forks get
an apply recipe), so the drift would not self-heal.
Deviation from the prescribed remedy, deliberate: the finding said to run
`make bazel-sync`, but on this 25-commit-old base the generator would
also add the eight entries that are pure base staleness and already at
the merge target. Only the single PR-owned entry is added here, in
gazelle's own proposed position (sorted, between uow_factory_test.go and
update_claim_proxied_test.go).
Verified: re-running gazelle no longer proposes this file (the other
eight remain untouched); `make bazel-sync-check` rc=0; the 11 TestBazel*
/ TestCheckBuildTags* policy tests pass. Composition asserted inside the
tree CI actually builds -- `git merge-tree --write-tree origin/main
<probe>` rc=0, and the merged cmd/bd/BUILD.bazel differs from
origin/main's by exactly this one line, while the same merge without the
fix is byte-identical to origin/main's (control).
Contributor commits are untouched; no Go file changes.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(storage): be-s9d setup-shared-db visibility tests for dolt.New / initSharedSchema
Adds five tests pinning the behavioral contract that
testutil.SetupSharedTestDB must result in a database that is fully
visible to fresh MySQL sessions on the same Dolt server. The bug
under be-s9d (originally observed in the BEADS_TEST_EXTERNAL_DOLT_PORT
TestMain branch added in cfd38cda) is that CREATE DATABASE in
SetupSharedTestDB is left in the working set without an explicit
DOLT_COMMIT, so fresh connections that open their own session do not
see the new database. The reviewer's diagnosis (be-nx7 reconciliation
notes) calls out adding CALL DOLT_COMMIT after CREATE DATABASE, or
retry-with-USE in the external-port branch, as the fix surface.
State today (validator's failing tests, written before the fix):
PASS TestSetupSharedTestDB_FreshRawConnSeesDatabase
SHOW DATABASES on a fresh raw mysql conn does list the new db
(regression-guard for the existing-good behavior).
FAIL TestSetupSharedTestDB_NewStoreOpens
dolt.New() fails with "database not found" against a freshly
SetupSharedTestDB-created db, even though the prior test shows
SHOW DATABASES does see it. This is the literal failure mode
— the difference is dolt.New's initDB connection shape (empty
ServerUser, internal-built DSN) hits a stricter visibility
boundary than my User=root probe. Captures the bug.
PASS TestSetupSharedTestDB_FreshConnAfterSecondSetupCall
Idempotent CREATE-IF-NOT-EXISTS path stays visible across two
setup calls. Regression-guard for any DOLT_COMMIT side effect
the fix introduces.
PASS TestSetupSharedTestDB_RefusesProductionPort
FIREWALL guard against port 3307 (DefaultSQLPort) intact.
Defensive contract — must not regress through the be-s9d fix.
FAIL TestInitSharedSchema_AfterFreshDatabase
After initSharedSchema completes (all migrations apply,
DOLT_ADD + DOLT_COMMIT runs), a fresh connection's SHOW
TABLES returns zero rows. Schema commits on the
initSharedSchema session do not surface to other sessions —
the deeper invariant the fix must restore.
Both failing tests pass on the testcontainer path that masks the bug
in CreateIfMissing=true mode, which is why TestMain external-port is
the only place the suite-wide runtime hits it; my tests pin the
contract at the dolt.New / SHOW TABLES level so the fix is verifiable
without a second host-resident dolt sql-server. The benchstat-geomean
write-bench measurement that be-s9d also requests is a downstream
measurement task, not a test, and is not in this commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(testutil): wait for database visibility in SetupSharedTestDB (be-s9d)
The BEADS_TEST_EXTERNAL_DOLT_PORT branch added in cfd38cda was supposed to
let CI/dev runs target a host-resident dolt sql-server, but the polecat
tests added in 295b4552 surfaced a startup race: SetupSharedTestDB returns
right after CREATE DATABASE, and a sibling pool opened by dolt.New() inside
initSharedSchema can outrace the Dolt server's catalog refresh and fail
with "Error 1049 (HY000): database not found: <name>" — Dolt's own wording
from go-mysql-server, distinct from MySQL's "Unknown database" handled in
isRetryableError since GH-1851.
Three load-bearing changes:
1. testutil.SetupSharedTestDB now polls USE <dbName> on the same handle
with bounded exponential backoff (50ms → 1s, 10s deadline) before
returning. The catalog race is what 295b4552's
TestSetupSharedTestDB_NewStoreOpens / TestInitSharedSchema_AfterFreshDatabase
were pinning; both flip from RED → GREEN with this poll.
2. dolt.isRetryableError now also retries "database not found", same
reason as the existing "unknown database" branch (GH-1851). Defensive
backstop in case any code path opens a fresh pool against the new
database without first going through SetupSharedTestDB's poll.
3. testmain_test.go now sets BOTH BEADS_DOLT_SERVER_PORT and
BEADS_DOLT_PORT (and unsets both at end). applyConfigDefaults reads
BEADS_DOLT_SERVER_PORT first and only falls through to the legacy
BEADS_DOLT_PORT, so a pre-existing BEADS_DOLT_SERVER_PORT in the
surrounding agent shell (gc-beads-bd exports the rig's gc.endpoint
port) silently won over the testmain-set BEADS_DOLT_PORT and routed
the bench to the wrong server. Both branches (external-port +
testcontainer) pin both vars.
Tests exercising these paths (added in 295b4552):
PASS TestSetupSharedTestDB_FreshRawConnSeesDatabase
PASS TestSetupSharedTestDB_NewStoreOpens (was FAIL at baseline)
PASS TestSetupSharedTestDB_FreshConnAfterSecondSetupCall
PASS TestSetupSharedTestDB_RefusesProductionPort
PASS TestInitSharedSchema_AfterFreshDatabase (was FAIL at baseline)
Run with TESTCONTAINERS_RYUK_DISABLED=true BEADS_TEST_EXTERNAL_DOLT_PORT=33400.
Unblocks the 10K write-bench measurement called for in be-eei §8 guardrail 5
(CreateIssue/UpdateIssue regression vs pre-D4v2). Bench results to follow
in a separate be-s9d note.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: release gate PASS for shared-test-DB-visibility-waits theme (be-pow0)
* fix(testutil): narrow to test-only per review — drop retry-classifier change, reword visibility-wait comments
bee-ghosttrack's review (2026-09-03) on #5788 flagged that the
isRetryableError "database not found" case was a real production
behaviour change riding along in a PR described as test infrastructure:
it turns a genuinely-missing-database failure from immediate into a full
~30s backoff (serverRetryMaxElapsed) across six withRetryClassified call
sites. Dropping it entirely — SetupSharedTestDB's own visibility poll in
testdoltbranch.go already resolves the catalog race the classifier case
was meant to backstop, so it was never load-bearing for this fix.
Also rewords waitForDatabaseVisible's doc comment to describe what USE on
a pooled connection actually proves — that one connection observed the
catalog refresh, not a pool-wide guarantee, and that USE mutates that
connection's session default database as a side effect — and notes as a
comment (not a behaviour change) that the backoff cap can let delay reach
~1.6s before capping, which is harmless inside the 10s bound.
testmain_test.go's teardown also unset BEADS_DOLT_SERVER_PORT, the other
half of the same port-pin hunk the rebase already dropped in favour of
main's ambient-port FATAL guard (#5837); that half merged cleanly instead
of conflicting, so it survived silently until now. Removed — main never
sets that var, so unsetting it was dead code.
TestSetupSharedTestDB_NewStoreOpens and the rest of the visibility suite
still pass without the classifier change (podman testcontainer run: 5
PASS / 0 FAIL / 0 SKIP).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-pow0-shared-test-db-visibility-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
* fix(testutil): poll SHOW DATABASES exact-match for visibility, not USE (be-2wf6u)
waitForDatabaseVisible was polling USE <dbName>, which Dolt can satisfy by
auto-attaching a database to the session before the server's catalog (what
SHOW DATABASES and dolt.New() actually check) has registered it — a no-op
wait in exactly the racy just-created case it exists to guard against
(bee-ghosttrack PR #5788 R2 item 1).
Switch to the same SHOW DATABASES exact-match iteration
databaseExistsOnServer (internal/storage/dolt/store.go) already uses, via a
small local helper (databaseVisibleNow) rather than a cross-package import,
to avoid coupling internal/testutil to internal/storage/dolt for one
10-line check. Preserves the existing backoff/deadline/ctx-cancellation
shape and the "not visible after" bounded error.
Update the call-site and function-doc comments to stop claiming the wait
proves visibility "to a fresh connection" — success only guarantees the
polling connection's own view is current, not a guarantee for every
connection in db's pool. R1 already corrected the function doc to this
wording; the call site had drifted from it (R2 item 2... no, R1 nit,
flagged again in R2 follow-up).
TestWaitForDatabaseVisible_ReturnsBoundedErrorWhenNeverCreated pins the
bounded-failure contract as a falsifiability/regression guard, not an
old-vs-new discriminator: a name that is never created is a permanent
absence the old USE-based poll's retry branch already handled correctly by
coincidence. R2 itself found the real race too flaky to assert on directly
("a mutation probe... did not discriminate either, because the
fresh-connection test is flaky against its own 45s deadline"), so this test
is exactly what R2 prescribed instead. Its doc comment is corrected to say
so accurately.
Verified against a real Dolt container (TESTCONTAINERS_RYUK_DISABLED=true —
without it, Ryuk's reaper handshake times out on this host and produces a
container-setup failure that looks like a test failure but isn't):
internal/testutil full package green (25.9s), internal/storage/dolt's 5/5
visibility suite green (17.1s).
refs be-2wf6u
* chore(bazel): sync gazelle srcs/deps for PR #5788 test files
Maintainer fixup during adoption. `make bazel-sync` output only:
- internal/storage/dolt: enumerate the PR's new untagged setup_shared_db_test.go
in go_test srcs (without it Bazel silently runs 0 of the PR's 5 new tests).
- internal/testutil: gazelle-canonical deps for the two non-stdlib imports the
PR adds to the already-enumerated testdoltbranch_test.go.
Base parity at 4e4ebdb44 is 0 untagged gaps / 100 of 100 packages, so the
omission is PR-introduced. Idempotent on re-run.
* fix(testutil): review fixes for PR #5788 — firewall pin + doc accuracy
Maintainer fixup applying the iteration-1 review synthesis (4 of its 5
findings; all minor/nit, no blockers or majors).
- setup_shared_db_test.go: narrow TestSetupSharedTestDB_RefusesProductionPort
to the one token only the firewall emits ("production") and add a "dial tcp"
negative control. The old containsAny(err, "refused", "production", "3307")
was vacuous: the test carries no skipIfNoServer guard, so it also runs where
nothing listens on 3307, and there a deleted firewall falls through to
CREATE DATABASE and fails with "dial tcp 127.0.0.1:3307: connect: connection
refused" — a string matching both "refused" and "3307". Measured: the old
assertion is true for the firewall message AND that dial error; the new one
is true only for the firewall message. Same single-specific-needle pattern
as the sibling TestSetupSharedTestDB_RefusesAmbientPortMismatch.
- setup_shared_db_test.go: mark the be-nx7 DOLT_COMMIT diagnosis in the file
header as superseded by the catalog-refresh-race diagnosis — the wait
succeeds before any DOLT_COMMIT runs (initSharedSchema commits only after
SetupSharedTestDB returns), so a redundant post-CREATE DOLT_COMMIT is not
the completion of this fix.
- testdoltbranch.go: state the real bound. The deadline is checked before the
sleep, so the final capped delay lands past it — probes at
0/50/150/350/750/1550/3150/4750/6350/7950/9550/11150ms, i.e. ~11.2s
worst-case return over 12 probes, not the "~10s" the doc claimed. The cap
comment no longer asserts the total stays inside 10s.
- store.go: comment-only back-reference marking databaseExistsOnServer and
internal/testutil.databaseVisibleNow as a coupled mirror, so a future edit
to the consumer's predicate cannot silently diverge the fixture's probe.
The synthesis prescribed this arm over hoisting into doltutil precisely to
keep the PR's upstream-requested test-only narrowing (eea022b6e) intact; it
adds no production behavior.
Synthesis finding 3 (deleting the visibility wait is invisible to the
deterministic suite) carries "Required fix: None" — disclosed in-code and not
fixable without an injectable probe; left as recorded residual.
Validation: gofmt clean; go build + go vet on both packages; focused tests
green with the ambient BEADS_DOLT_* env scrubbed — internal/storage/dolt
5 PASS / 0 FAIL / 0 SKIP, internal/testutil 2 PASS / 0 FAIL / 0 SKIP.
make bazel-sync is a no-op (the added import is stdlib).
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>