#7671 fences graph workspaces in cmd/bd: command admission, the store
factories and the other CLI paths refuse one, and #7722 extends that
fence to a .beads holding the graph-preview-format marker whatever its
metadata says. But the public library opens (beads.OpenBestAvailable,
OpenBestAvailableWith, OpenFromConfig, OpenGated) and the Dolt store's
metadata-driven constructors (NewFromConfig, NewFromConfigWithOptions,
NewFromConfigWithCLIOptions) still opened either kind of graph workspace
as an Issue store and ran Issue schema migrations into the graph
database (or, with no metadata beside the marker, created an Issue
database inside the graph workspace).
- Move the typed refusal into internal/configfile
(UnsupportedWorkspaceFormatError with BeadsDir, GraphMode and
FormatMarker; CheckWorkspaceFormat; GraphFormatMarkerFile;
HasGraphFormatMarker) with byte-identical text and hints for both the
graph_mode and the marker refusal, and move cmd/bd's discovery
pre-checks there as LoadAndCheckWorkspaceFormat and
CheckDiscoveredWorkspaceFormat (LoadForDiscovery, which never migrates
a legacy config.json; unreadable metadata beside the marker is refused
as the marker's format). cmd/bd's checkWorkspaceFormat,
loadAndCheckWorkspaceFormat, hasGraphFormatMarker and
checkDiscoveredWorkspaceFormat become thin delegates, so the CLI keeps
its behaviour (exit 16 with the same hints) and every caller of them is
unchanged; bootstrap's ancestor walk builds the configfile type.
- Every public metadata-driven open runs CheckDiscoveredWorkspaceFormat
as its first statement: before OpenGated takes its gates and before
OpenBestAvailableWith's Load can migrate config.json. A refused open
leaves the workspace byte-identical. The type is exported as
beads.UnsupportedWorkspaceFormatError.
- The Dolt constructors run CheckDiscoveredWorkspaceFormat before
configfile.Load, so a graph workspace marked only by a legacy
config.json, or by the marker beside stripped, missing or unparseable
metadata, is refused before Load can migrate it into metadata.json
(and drop graph_* keys this build does not know). requireDoltBackend
re-checks the loaded config as a backstop, so they also refuse before
resolving a server or writing a port file or Dolt root.
Tests: configfile unit tests for both refusals (exact marker text and
hint, graph_mode winning over the marker, unparseable metadata with and
without the marker); the public opens and the three Dolt constructors
against graph_mode workspaces and against marker-only, stripped
(metadata.json and legacy config.json), server, explicit dependency and
unparseable-metadata marker workspaces, each refused with the typed
error and the workspace left unchanged.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The graph-mode fence decides a workspace's format from graph_mode in its
metadata alone. Graph-preview builds also write a
.beads/graph-preview-format marker before metadata.json (donnabox fork
commit deea8d57df, Donna Box), so that an interrupted or metadata-lost
graph workspace stays fenced. bd ignored the marker. When a bd that
predates graph_mode had rewritten metadata.json without the field, bd
opened the graph database by its recorded name and `bd list` ran Issue
schema initialization against it. When metadata.json was never written
or was lost, bd fell back to the default database name and created an
Issue database inside the graph workspace, and `bd init` initialized an
Issue workspace there.
checkWorkspaceFormat now also refuses a beadsDir that holds anything at
graph-preview-format, whatever its content and whatever the metadata
says (absent, stripped, or an explicit "dependency"). The graph_mode
check still runs first, so a normal graph workspace is still reported
by its graph_mode. The refusal is the same typed error with its own
message and a hint to restore metadata.json, so every call site, the
--json rendering and exit code 16 (ExitUnsupportedWorkspaceFormat) are
unchanged. An empty beadsDir never probes the working directory.
loadAndCheckWorkspaceFormat reads the metadata with LoadForDiscovery
and refuses metadata that cannot be parsed beside the marker as the
marker's format: the marker alone declares it. Command admission
(guardLegacyUpgradeWorkspaceForInit) uses it, and
checkDiscoveredWorkspaceFormat now delegates to it, so the paths that
check before a migrating configfile.Load (the four store factories,
create --repo's ensureBeadsDirForPath and dry-run target open, the bd
dolt loaders, bootstrap's undiscovered walk) refuse a marked workspace
too, with or without readable metadata. Other metadata load failures
are still left to the caller's own load, so a malformed legacy
config.json without the marker keeps create --repo's
auto-initialization.
bootstrap's ancestor walk (findParentConfig) refuses an ancestor that
holds the marker without metadata it can read, as it refuses one whose
metadata declares graph_mode. It used to skip a marker-only ancestor
and take a more distant workspace's metadata or the defaults, and to
report a marked ancestor with unparseable metadata as a load failure
(exit 1). With the check in checkWorkspaceFormat, bootstrap in a .beads
holding only the marker refuses it (exit 16) instead of reporting no
workspace.
validateConfiguredBackend returns early for nil metadata, so its
backstop covers the marker only when metadata was loaded; every caller
runs admission or checkDiscoveredWorkspaceFormat on the same beadsDir
first, and its comment now says so.
Tests: guard unit tests for marker-only, metadata lost, stripped
(metadata.json and legacy config.json), server, explicit dependency,
unparseable metadata, marker over a legacy Dolt root, and arbitrary
marker content; the four store factories (cgo, and the CGO_ENABLED=0
copies goreleaser ships) with stripped, missing and, for cgo,
unparseable metadata beside the marker; findParentConfig with a marked
ancestor below an ordinary workspace; the exit-code mapping;
ensureBeadsDirForPath with a malformed config.json with and without the
marker; and the subprocess e2e matrices (in-workspace commands, plain
`bd init`, and the outside entry points: create --repo, create
--dry-run, --db, BEADS_DB, init --proxied-server, bootstrap below it)
extended with four marker fixtures that must exit 16 with the marker
refusal and leave .beads byte-identical, while store-less commands
still run. The e2e subprocess timeout goes from 10s to 20s: refused
runs finish in well under a second, but an unrefused one creates or
opens a database and can approach 10s under load, so without the
fence the rows fail on their assertion rather than on the timeout.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(list): pin orderSiblingsByDeps ready-set ordering under a sort-derived comparator
Drive orderSiblingsByDeps with compareIssuesForTree("closed", false) over
shuffled input so the caller-supplied compare at the initial ready-set sort
and the post-pop re-sort is exercised with an ordering that disagrees with
priority. Exact-order assertion: dropping or re-hardcoding the post-pop sort
only swaps pa-b and pa-v.
AC: AC-1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5c973b4ba9)
Ported-From: opus/5c973b4ba9d93def077dfabe8186622052abffd5
AC: AC-1
* test(list): pin orderSiblingsByDeps cycle fallback under a sort-derived comparator
A two-node scheduling cycle where priority and ID favor pa-x but --sort
closed favors pa-y: the cycle fallback must follow the caller's compare.
AC: AC-2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d29c4611e6)
Ported-From: opus/d29c4611e63422cee2ff9aee9cf2a9719b5dff71
AC: AC-2
* test(list): pin --deps scheduling ordering under --sort closed in the tree
Render the tree with depsMode=scheduling and sortBy=closed at both the root
level and under one parent: the blocks edge must still put dep before late,
while the requested sort (not priority) puts the unlinked free first. Covers
both orderSiblingsByDeps call sites in list_tree.go.
AC: AC-3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f434dcd5e4)
Ported-From: opus/f434dcd5e47643121c1b4f882f57c7bc68fc69a9
AC: AC-3
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(configfile): carry graph_mode and graph_* binding through Save
Graph-preview builds of bd persist a per-workspace format in
metadata.json: "graph_mode": "link" plus graph_scope_url,
graph_authority_id, graph_workspace, graph_schema_version and
graph_ready, beside an ordinary Dolt backend. configfile.Config had no
such fields, so every Save, and Load's config.json -> metadata.json
migration, rewrote the file without them, turning a graph workspace's
metadata into an ordinary Issue workspace's.
Config now carries the marker and the binding as omitempty fields, so
a Save round-trips them unchanged and metadata.json written for an
ordinary workspace is byte-for-byte what it was. GetGraphMode resolves
the marker: absent or "dependency" is the historical default, "link"
is recognized, and any other value is an error rather than a fallback
to the Issue store. Nothing in this build opens a non-default mode;
the CLI refusal follows in the next commit.
Ported from the donnabox fork commit deea8d57df (graph_mode.go,
graph_mode_test.go and the configfile.go fields), without any graph
code. The binding-survives-Save and omitted-from-ordinary-metadata
tests are new.
Co-authored-by: Donna Box <dbox@boxenllc.com>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cli): refuse graph_mode workspaces before opening them
A workspace whose metadata.json declares a graph_mode other than
"dependency" holds a graph database behind an ordinary Dolt backend,
and nothing else in its metadata says so. bd admitted it like any
current workspace: `bd list` ran the Issue schema initialization
against the graph database (beads_graph_<id>), `bd init --force` wrote
a .gitignore and a .beads/dolt root into it, `bd dolt start` started a
server for it, and `bd doctor` reported on it as an Issue store.
guardLegacyUpgradeWorkspace, the admission check every store-opening
command, store-less command with workspace effects, init, doctor and
bootstrap already run before touching a workspace, now refuses such a
workspace first, before the legacy classifications that would admit
it or report it as a legacy store to migrate. An unknown graph_mode
value is refused the same way. The refusal is a typed error naming the
workspace and the format, rendered with a hint (as JSON under --json)
and exit code 16, ExitUnsupportedWorkspaceFormat, so a wrapper can
tell "needs a different bd build" from a generic failure.
`bd version`, `bd --version`, `bd help` and completion stay exempt, as
they are for legacy workspaces. validateConfiguredBackend refuses the
same metadata, which covers the store-open paths that skip command
admission (routed writes, cross-repository reads, create --repo).
Tests: guard and store-factory unit tests; a subprocess e2e test that
show/list/create/context/where/dolt start/doctor/bootstrap/init are
refused with exit 16 and leave .beads byte-identical (metadata.json and
legacy config.json, link and unknown markers, embedded and server
layouts), and that store-less commands still run; an embedded test
that an ordinary workspace, with the marker absent or "dependency",
still creates and lists issues and keeps the marker through a
metadata.json rewrite.
The guard hunk and graph_mode_admission_e2e_test.go are ported from
the donnabox fork commit deea8d57df; the exit code, rendering, store
factory backstop and remaining tests are new.
Co-authored-by: Donna Box <dbox@boxenllc.com>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cli): refuse graph workspaces reached outside command admission
Command admission refuses a graph_mode workspace a command runs in, but
bd also reaches workspaces before or without admission: a create --repo
target, the path --db or BEADS_DB names, and the stores the factories
open for routed and cross-repository work. On those paths a workspace
marked only by a legacy config.json was changed before anything refused
it: configfile.Load migrates config.json into metadata.json before the
format check sees the loaded metadata, and create --repo initialized
such a target as a new workspace. Where the refusal did come, create
reported it with exit 1 rather than 16.
- checkDiscoveredWorkspaceFormat checks a workspace's metadata as
configfile.LoadForDiscovery reads it, which never rewrites it.
ensureBeadsDirForPath, the dry-run target open and the four store
factories (cgo and nocgo builds) run it before their own load.
- resolveBeadsDirForDBPath and findDatabaseInBeadsDir locate a
workspace with LoadForDiscovery, so resolving --db, BEADS_DB or a
create target no longer migrates it.
- bd create renders a refused target as the workspace refusal, exit 16
with its hint, on the initializing and both dry-run paths. A dry run
without --parent opens no target, so it now checks a local one before
rendering the preview (checkRepoTargetFormat).
- bd bootstrap, when discovery finds no workspace, reads each .beads
from the working directory up to the repository root without
migrating it and refuses one in a format this build cannot open, the
way commands without a workspace already do. A .beads marked only by
config.json is passed over by discovery, so bootstrap reported "no
workspace" there instead of exit 16. The walk now returns its
candidates (undiscoveredWorkspaceCandidates) to both checks: handing
it the check as a func(string) error made gosec's G702 taint analysis
connect BEADS_DIR to every func(string) error that runs git.
- backendNameForErrorFraming reads with LoadForDiscovery, and
loadDoltBackendConfig, bd dolt status and bd dolt show refuse a graph
workspace before their migrating configfile.Load. Admission refuses
first on every path that reaches them today; this keeps a new caller
from migrating a legacy config.json before the refusal.
- The CHANGELOG entry and the configfile comment now claim what holds:
a routed read fails without touching a graph workspace but not with
code 16, and a Save keeps only the known graph_* fields, with the
tags graph-preview builds declare. workspace_gate.go no longer lists
the pre-gate discovery reads as migrating.
- New e2e rows run create --repo from a workspace and from outside one,
create --dry-run with and without --parent, --db, BEADS_DB, init
--proxied-server, bootstrap in a workspace nested in a graph one, and
the hook shim's bd hooks run pre-commit against every fixture; each
refusal must exit 16 and name the format and the hint. bootstrap in a
workspace marked only by config.json now refuses like the other
commands. The store factory test also runs on a config.json graph
workspace, TestWorkspaceMetadataReadersLeaveGraphWorkspaceUnchanged
covers the framing, bd dolt loader and diagnostic reads, and
TestNocgoStoreFactoriesRefuseGraphWorkspace covers the CGO_ENABLED=0
factories; bazel.yml's pure lane runs it by name (PURE_CMD_BD_TESTS,
pinned in scripts/ci_workflow_test.go).
Measured with gocyclo/gocognit: every function this changes stays below
the PR's worst changed function (guardLegacyUpgradeWorkspaceForInit
29/28, resolveBeadsDirForDBPath 26/36); showDoltConfig is 19/31 (was
18/30) and guardUndiscoveredLegacyWorkspace 3/3 (was 9/12).
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Donna Box <dbox@boxenllc.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
The root //:go_srcs filegroup is glob(["**/*.go"]), and a glob follows the
checkout's bazel-bin/bazel-out/bazel-testlogs/bazel-beads symlinks into the
output tree. CI's test step is the first build in a fresh checkout, so it never
sees them, but in any checkout that has built before every test that reads
//:go_srcs (bd_test, bd_embedded_test, bd_embedded_part2_test,
bd_dolt_server_test, bd_proxied_test, bd_managed_local_test) gains the output
base's .go files: their inputs differ on every run, they are never cached, and
loading grows with the output tree.
Measured on main 2563f021ed with the symlinks present, `bazel test
//cmd/bd:bd_test --config=ci --test_filter='^TestResolveCommitHash$'` twice:
both runs executed all 16 shards remotely, and the analysed graph grew from
20,773 to 56,941 configured targets (14 s, then 25 s). With this change the
second run is `(cached)` in 3.6 s. In agent worktrees the glob had reached
433,026 output-tree files, a cached re-run took 36 s to load against ~3 s
without them, and 135 of 202 blocking test minutes of the factory's beads
seats went to these six targets (formula-overhead audit 4; bead ga-ylpbsy.24).
tools/bazel/go_srcs.py gives the root block exclude = ["bazel-*/**"] (the
same pattern ROOT_REPO_FILES_EXCLUDE already uses for //:repo_files); only
the root BUILD.bazel changes. CI's action keys do not change: its checkout has
no such files. scripts/bazel_policy_test.go's
TestBazelRootGoSrcsSkipsConvenienceSymlinks fails without the exclude.
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
After a successful human-output create/show/list/ready, bd may append a
"💡 Tip:" line chosen by a probability roll whose RNG is clock-seeded
unless BEADS_TIP_SEED is set. run_scenario env_clear()s and passes only
PATH/HOME/TMPDIR + BEADS_TEST_MODE=1, so on a host with ~/.claude (claude_setup
tip eligible, p=0.6) every bd process rolled independently and out-of-scope
human-output scenarios (create_human_readable_output, show_short_mode_text,
show_multiple_short, ready_empty_no_issues_plain, ...) diverged main-vs-main.
Pass BEADS_TIP_SEED=1214 to every step for both reference and candidate.
Go math/rand's first Float64() for that seed is 0.0000159, so the
highest-priority eligible tip always wins its roll. Where the host makes a
tip eligible, it stays visible and lands on a deterministic step, so a change
to which tip prints, on which step, or to its text (including a tip leaking
into --json) still diverges instead of being normalized away. Where no tip is
eligible (no ~/.claude, beads plugin enabled, or a `bd prime` hook) none
prints and tip changes go unobserved; the README now says so.
The new unit test spawns printenv through run_scenario. That races the
existing stub-bd test, which writes its stub with std::fs::write and then
execs it: a fork while the write fd is open makes the exec fail with ETXTBSY
(rust-lang/rust#114554). Serialize both spawning tests on a SPAWN mutex.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): repair the embedded-gated tests that rotted while no lane ran them
These tests skip unless BEADS_TEST_EMBEDDED_DOLT=1 but no CI lane selected
them, so they rotted unseen. Running them shows:
- TestEventsTailFollowReportsTruncationOnTheStream raced on a plain
bytes.Buffer that os/exec's copy goroutine writes while the test polls it.
Use the package's syncBuffer.
- TestCorruptMetadataDiagnosticsRunAndDataFailsLoud still asserted that
doctor and init run on a corrupt metadata.json. #4857 deliberately made
every workspace command refuse instead (pinned for doctor by
TestDoctorRejectsCorruptMetadataBeforeSharedServerChecks). Rewrite it to
the shipped contract as TestEmbeddedCorruptMetadataFailsLoudUntilRestored:
version warns, doctor/list/init refuse naming the file without touching
it, and restoring the file brings the data back.
- dolt_remote_origin_guard_embedded_test.go was tagged
`embeddeddolt && cgo`, a tag no lane sets, so it never compiled in CI
(gazelle left it out of bd_test srcs). Retag it `cgo`, as #4153 did for
its dolt_local_only sibling, and add it to srcs. Drop its four bd doctor
git-origin tests: bd doctor runs no checks on an embedded workspace
(GH#3794), so two could never pass and two passed vacuously on empty
output. Rename the surviving tests into the TestEmbedded* prefix.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(embedded): run every BEADS_TEST_EMBEDDED_DOLT-gated cmd/bd test in the embedded lane
The embedded-Dolt cmd lane selected tests with
grep '^func TestEmbedded' cmd/bd/*_embedded_test.go, and only its two
Bazel targets set BEADS_TEST_EMBEDDED_DOLT. A test that skips without the
variable but missed the name prefix or the file suffix skipped in every
lane and reported green: 92 of them, including #7203's --if-revision CLI
coverage (TestIfRevisionMatchAndMismatch, TestReassignFenceCLI, ...).
- embedded-test-shard.sh and gen_embedded_cmd_shard_manifest.py select
TestEmbedded* by name across cmd/bd/*_test.go, as proxied-test-shard.sh
does, leaving authors one rule.
- Rename the gated tests into the TestEmbedded* prefix
(TestDoctorEmbedded<X> -> TestEmbeddedDoctor<X>) and update every
reference.
- Place the new names with gen_embedded_cmd_shard_manifest.py 100
--weights=duration --write (incremental).
- Add TestEmbeddedGatedTestsRunInTheEmbeddedLane: it walks cmd/bd's tests
for any that reach os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" and fails
if a shard of the lane never lists one. The proxied guard's helpers now
take the variable and the script; a fixture test pins the walk.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(httpclient): remember the server's external-dependency policy across processes
Every bd ready over an HTTP workspace fetched GET /v0/beads/context before
its listing. listReadyWork itself needs no handshake; the fetch came from the
external-dependency decorator asking ServerEnforcesExternalDependencyPolicy
whether the server already applies the policy. In a one-shot CLI that is one
extra round trip per process (about 54 ms at a 52 ms RTT) to relearn a bit
that only changes when the server is restarted with a different composition.
The store opened from a workspace now keeps that answer in the user cache
directory (beads/http-policy/), keyed by the server URL and the project the
workspace pinned at bd connect, for BEADS_HTTP_POLICY_CACHE_TTL (5 minutes by
default; off disables it). A fresh entry answers the probe without dialing; a
handshake this process already holds wins and refreshes the entry. A
workspace with no project pin, and a store an embedder opens through
OpenWith, are not cached. Writing the entry is best effort.
The staleness this allows is bounded by the TTL: a server restarted without
the policy within the window is still trusted to enforce it until the entry
ages out. Carrying the policy on every response would close that window but
needs a server change and does nothing for servers already deployed.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): claims and closes ask the server for the policy, never the cache
Review follow-up to the policy cache. The claim and close guards (direct
claim, claim-next, batch close, the lifecycle close and claim, and the legacy
ClaimReadyIssue and CloseIssueChecked) handshake anyway, and a stale cached
"the server enforces it" would stand down their client-side refusal of
externally blocked work. Those entry points now mark their context with
storage.WithLivePolicyProbe, and httpclient.Store answers such a probe from
the server, refreshing the cache entry. Reads keep the cached answer.
Tests: externaldeps TestClaimsAndClosesAskForALivePolicyProbe and
TestRemoteClaimsAndClosesAskForALivePolicyProbe pin which entry points probe
live (every claim and close) and which do not (ready listings), over a local
and a remote store; httpclient TestALiveProbeSkipsThePolicyCache pins the
store side; TestPolicyCacheRefusesEntriesItCannotTrust now also covers an
entry written for another server URL.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(ready): skip the countReadyWork request when bd ready --json prints no total
Over a remote backend, bd ready --json sent GET /v0/beads/ready and then,
whenever the page came back with has_more, GET /v0/beads/ready:count, only to
put "of N" into the stderr hint. Without BD_JSON_ENVELOPE nothing else prints
the total, so that second request (about 120 ms at a 52 ms RTT) bought a
number no caller reads.
On a remote backend without the envelope, bd ready --json now lists one row
past the limit and says whether more exist without saying how many, in the
wording the proxied route already uses. A local store keeps the in-band total
it takes in the page's own transaction, and the envelope keeps
pagination.total. A --max-rows cap at or below the limit keeps the counted
listing, so the extra row never trips the cap.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ready): say "1 ready issue", not "1 ready issues", in the no-total hint
Review follow-up. The hint the remote --json path shares with the proxied
route now agrees in number; both routes take it from readyHiddenHint, so
they stay one wording.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(startup): initialize packages on four Ps, not every CPU
bd links several thousand packages whose init functions allocate about
20 MB before main runs, which triggers four or five garbage collections.
Each one starts mark workers and stops the world across every P, and on a
large host that costs more than the collection itself: on a 192-CPU machine
`bd version` spent about 20 of its 110 ms there, paid again by every bd
process a script or an orchestrator starts.
internal/initprocs lowers GOMAXPROCS to 4 for the duration of package
initialization. It imports only runtime and syscall, so it initializes
ahead of the heavy packages, and main hands GOMAXPROCS back first thing:
to the GOMAXPROCS environment value when one is set, else to the runtime
default, which keeps tracking the CPU limit.
cmd/bd's TestMain does the same hand-back, since tests never run main, and
resets the -test.parallel default testing derived from the capped count.
Measured on that host (40 runs each, `bd version`): p50 103 -> 86 ms.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(initprocs): tell an explicit GOMAXPROCS hand-back from the runtime default
Review follow-up. TestDoneHonorsAnExplicitGOMAXPROCS swaps the two runtime
calls for recorders and pins that Done restores the exact value when
GOMAXPROCS is set and calls SetDefaultGOMAXPROCS when it is not; the earlier
test only saw the resulting count, which is the same either way on a host
whose default equals the saved value.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): name the connect failure when bd serve cannot be reached
A workspace whose server does not answer reported the transport's text:
`cannot reach bd serve at https://host:30699: Get "https://host:30699/v0/beads/context":
dial tcp 100.85.56.42:30699: i/o timeout`. It names the request rather than
the address that failed, and says nothing about what a dial timeout usually
means. An operator chasing an unreachable store had to know that "i/o
timeout" on a dial means the SYN went unanswered.
A request whose connection could not be opened now fails with a
*wire.DialError inside the *ConnectError: a refused connect names the
address and says nothing is listening there; a connect that times out names
the address that never answered, how long the attempt waited, and that a
firewall dropping the connection or a down host is the usual cause; a host
name that does not resolve is named as such. The transport's error stays
reachable through Unwrap, so errors.Is checks (ECONNREFUSED, timeouts) and
*ConnectError classification are unchanged, and a dial the caller canceled
keeps its own error. The events:watch connect gets the same classification.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): keep the transport's dial text in connect errors
Review follow-up. The refused and DNS messages dropped "connection refused"
and "dial tcp", the vocabulary gc's text classifier matches to tell an
unavailable store from other failures; without it the dispatcher's serve
loop exits and control beads are quarantined. Every DialError message now
ends with the transport's own *net.OpError text in brackets, after the
explanation.
TestACanceledDialIsTheCallersOwn now actually reaches the ctx.Err() guard:
its round tripper cancels and hands back a genuine refused dial, which the
guard alone keeps from becoming a DialError (removing the guard fails it).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(agents): bazel test is authoritative; agents never run go test
Agents run tests only with `bazel test`, also while iterating on one
behavior: AGENTS.md shows the focused form
(`bazel test //cmd/bd:bd_test --config=ci --test_filter='^TestName$'`), the
target naming, that one --test_filter covers every target, that a cached
result for unchanged inputs is the same evidence, and that a new test file
needs `make bazel-sync` before Bazel runs it. `go test` (`./scripts/test.sh`,
`make test-go`) stays a convenience for humans working offline. TESTING.md's
focused red/green row and its plain-go-test section say the same.
Why: on the maintainer-city factory host, seats' own uncached `go test`
reruns of the same packages are the largest tool cost in adopt-pr, while
`bazel test` there executes on rbe-west and returns an unchanged target's
cached result in seconds.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(agents): check that a focused test ran; exempt golden regeneration
Review fixes for #7695 (iterations 1 and 2).
The focused form exits 0 with "1 test passes" when the test never ran: a
filter that matches nothing, an integration-tagged file --config=ci does not
compile, the TestEmbedded* name skip, a -short skip, and a parent test whose
every subtest skipped (Go still prints "--- PASS" for the parent). It now
adds --test_output=all, and a run counts only when its log shows
"--- PASS: <TestName>" and no "--- SKIP" for the test or a <TestName>/...
subtest; a subtest that skips by design is left out with a subtest filter.
engdocs/TESTING.md gains "Check That the Test Ran"; AGENTS.md links there
instead of restating it. The section names the tests --config=ci does not
run and the way into each:
- Dolt-backed: the three --test_env flags, or the test's Dolt lane.
- -short-gated: --test_arg=-test.short=false.
- integration-tagged: --config=integration; the Dolt-backed ones of cmd/bd,
tests/regression and internal/storage/dolt run in their Dolt-server lane
target, whose env the suite needs. No lane runs those of other packages
with Dolt, so a failure there is compared with the base commit first.
- TestEmbedded*: --test_arg=-test.skip= lifts the name skip; a test that
then still skips for BEADS_TEST_EMBEDDED_DOLT=1 runs in its package's
embedded-tagged target under --config=embedded (the cmd/bd and
internal/storage/embeddeddolt targets are named).
- files BUILD.bazel does not list: make bazel-sync.
A lane's sh_test can hand the test binary its own -test.run, which
overrides --test_filter, so a trailing --test_arg=-test.run with sharding
disabled selects the test there. In a sharded target the other shards print
"testing: warning: no tests to run". The section also gives the
target-naming rule.
Golden regeneration (make corpus-regen, make githooks-regen,
BD_UPDATE_GOLDEN=1 ... go test, -update-ledger-doc) writes the source tree,
which a Bazel test cannot do: it runs from its runfiles tree, and on
rbe-west update mode fails with "permission denied". AGENTS.md and the new
"Regenerating Golden Files" section exempt these go test runs; where a host
refuses go test even for them, a maintainer regenerates. The factory seat
shim (gastownhall/workflows#102, scripts/seat-bin/go) still refuses update
mode and needs the same carve-out there.
Also: the plain-go-test opener scopes "humans working offline" to the
runner and its go test targets, so the Dolt-backend, fixture and
testing.Short() rules still bind agents; make ci-pr-core is marked plain go
test; the beads-docs skill's docsync gate is the Bazel target; RELEASING.md
and engdocs/RELEASE-STABILITY-GATE.md name the regression suite's Bazel
target (//tests/regression:regression_test under --config=doltserver-cmd)
in place of make test-regression, which is plain go test.
Measured on rbe-west (exit 0 unless noted). Iteration 1, at c4d5409895:
- a mistyped filter, and //internal/compact TestNew (integration-tagged)
under --config=ci: "testing: warning: no tests to run"
- TestNew under --config=integration: "--- SKIP" (BEADS_TEST_SKIP=dolt);
with the Dolt flags added it runs (and fails, exit 3, on the local
backend: its store finds no "beads" database; outside this PR)
- TestConcurrentHeartbeatReclaimClose with the Dolt flags: "--- SKIP"
(short mode); plus --test_arg=-test.short=false: "--- PASS"
- //cmd/bd:bd_embedded_test, sharding disabled: --test_filter alone ran
TestEmbeddedUpdateConcurrent (manifest shard 1's test); the trailing
-test.run ran "--- PASS: TestEmbeddedShowBasicsAndJSON"
- //scripts:go_test_sources_test
TestEmbeddedCmdShardManifestBareWriteIsIdempotent: --config=ci "no tests
to run"; plus --test_arg=-test.skip=: "--- PASS"
Iteration 2, at b1d25543aa (the same Go inputs):
- //internal/storage/dolt:dolt_test TestMoveIssuePersistenceInTxTransitions
under --config=ci: "--- PASS" for the parent and "--- SKIP" for all 6
subtests (BEADS_TEST_SKIP=dolt), "1 test passes"; with the Dolt flags and
--test_filter='^TestMoveIssuePersistenceInTxTransitions$/^persistent-to-ephemeral$'
"--- PASS" for the parent and that subtest only, no "--- SKIP"
- //internal/storage/embeddeddolt:embeddeddolt_test
TestEmbeddedRemoteMigrateGate_BlocksReopen under --config=ci plus
--test_arg=-test.skip=: "--- SKIP" (BEADS_TEST_EMBEDDED_DOLT unset);
//internal/storage/embeddeddolt:embeddeddolt_embedded_test under
--config=embedded, sharding disabled, trailing -test.run: "--- PASS"
(the shard script listed 433 tests; only the named one ran)
- --config=ci plus --test_arg=-test.skip=: "--- PASS" for //tools/nogo
TestEmbeddedConfigIsTheRepositoryConfig and //internal/tracker
TestEmbeddedDoltExternalRefChangedAfterUsesHistoryFastPath
- sharding disabled, trailing -test.run: "--- PASS" for
//internal/storage/dolt:dolt_server_full_test
TestWispDeleteCascade_TransactionDeleteIssue under
--config=doltserver-integration, and for //cmd/bd:bd_dolt_server_test
TestCLI_ReopenClearsDeferUntil under --config=doltserver-cmd
- make check-docs: exit 0 (docsync: 10 test cases ran, none skipped)
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): keep bd setup claude --global's section in ~/.claude/CLAUDE.md
bd setup claude --global put its hook in ~/.claude/settings.json but wrote
the managed beads section into the current directory's CLAUDE.md, and
--remove --global stripped it from there. Run from $HOME it created
~/CLAUDE.md with project scaffolding, which stops Claude Code reading
AGENTS.md in projects below it; run inside a project it removed the
section that project's own install had written, leaving its hooks.
A global install and removal now manage the section in Claude Code's
user-level ~/.claude/CLAUDE.md (created holding only the section, no
project scaffolding), with hints naming bd setup claude --global. With
global or plugin hooks, --check reports that file when the project's
instructions have no beads section; a project install is still judged
on the project's file alone. Project installs are unchanged.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): render the user-level CLAUDE.md section independently of the project
~/.claude/CLAUDE.md is shared by every project, but bd setup claude --global
rendered and --check judged its section with the current directory's beads
config (sync.remote, sync.git-remote, no-push). From a project with a remote
and one without, --check called the other's install stale and its hint
flipped the file back. The user-level file now always renders with the
default options, so install and --check agree across projects.
Also pin --check's fallback to the project's file and project hint when
neither file has a section, tell existing --global users to re-run it, and
name ~/.claude/CLAUDE.md in the ide-setup recipe table.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): judge the user-level Claude files from $HOME and ~/.claude
Run from the home directory, the project's .claude/settings.json is the
global one, so bd setup claude --check reported a global install as project
hooks and judged ~/CLAUDE.md; its "Run: bd setup claude" hint then created
the ~/CLAUDE.md a global install exists to avoid. Run from ~/.claude, the
project's CLAUDE.md is the user-level file, and --check judged it with that
directory's render options and the project hint.
--check now reports hooks as global from $HOME and judges the user-level
file there and from ~/.claude with the fixed options and the --global hint.
With user-level hooks and no section in either file it names --global
unless the project has its own CLAUDE.md. A --remove run from $HOME, which
removes the global hooks, also removes the user-level section.
The init agent-artifact test ran bd setup claude with HOME at the project,
so its checks would now see a home directory; it gets a separate HOME and
its goldens are unchanged.
Rebase note (maintainer): rebased onto main after #7678 merged; main's
agent-artifact harness already runs bd with a separate HOME, so this
commit's harness edits to cmd/bd/agent_artifacts_embedded_test.go were
dropped.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(setup): pin --check's user-level choice beside project instructions
With global hooks, --check judges ~/.claude/CLAUDE.md when the project's
own CLAUDE.md has no beads section but the user-level file has one, and
when run from the home directory whose ~/CLAUDE.md has no section. Nothing
exercised either half of that condition: replacing it with false left the
suite and goldens green. Add a subtest for each; each now fails when its
half of the condition is dropped.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): name --global when --check finds no hooks from $HOME
From the home directory --check with no hooks said 'Run: bd setup claude'.
Following it runs a project install there, which creates ~/CLAUDE.md with
project scaffolding, the file that stops Claude Code reading AGENTS.md in
the projects below it. The missing-section hint at home already names
--global; make the missing-hooks hint match, with a subtest.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(setup): qualify the --global CHANGELOG entry; watch ~/.claude/CLAUDE.md
The CHANGELOG said --check from the home directory judges the user-level
files, but a beads section still in ~/CLAUDE.md is judged instead, and
the --global hint for a missing section applies only when the project has
no CLAUDE.md of its own. Say both, mention the new missing-hooks hint at
home, and re-wrap the paragraph.
The embedded agent-artifact harness comment said a global install writes
$HOME/CLAUDE.md; it now writes $HOME/.claude/CLAUDE.md. Track that path
too and reword the comment. The bd init goldens do not change.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): word the user-level CLAUDE.md section for repositories that use beads
bd setup claude --global writes its section to ~/.claude/CLAUDE.md, which
Claude Code loads in every project, but rendered it with the project
wording: "This project uses bd (beads)" and "Use bd for ALL task tracking —
do NOT use TodoWrite". In a repository without beads that told the agent to
give up its own task tools and pointed it at bd, whose answer there is
"run 'bd init'", while the global hook, bd prime, stays silent outside a
workspace.
RenderOpts.UserLevel rewords the opening line and the task-tracking rules of
both profiles so they apply only in beads repositories. The global env fixes
it through agents.UserLevelRenderOpts, so install, in-place update and
--check agree on the hash from every directory, and a project-worded section
left in ~/.claude/CLAUDE.md reads as stale and is reworded by --global. The
new minimal-user and full-user variants are pinned by golden and hash; the
project rendering is unchanged.
Also pin sameDir's symlink following: --check from a symlink to $HOME or to
~/.claude still judges the user-level files.
Refreshed onto main past #7692, whose --remove takes the blank lines
around the section with it and whose setup appends a section after one
blank line: claude-setup-global-beside-project-install.golden no longer
records the old hole (an extra blank line before the appended section,
two left behind by --remove --global).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
run_scenario always ran `bd init -p <prefix> --quiet` before a scenario's
steps. 43 deterministic catalog scenarios start with their own
`init --prefix X --non-interactive ...`; in 40 of them that step always hit
"This workspace is already initialized" (exit 1), pinning the double-init
refusal instead of a real init. The other 3 fail flag validation first,
which is what they test, and are unchanged. Their later steps (the commands
they are named for) ran against the harness's own pre-init and are
unaffected.
A scenario whose first step's command token is `init` now owns
initialization (Scenario::owns_init) and starts in an empty workspace; every
other scenario keeps the pre-init, and a later `init` step stays a re-init.
The pre-init decision is the pure harness_init() helper, and the step loop
is run_steps(), which takes the command runner as a closure.
normalize() now collapses the `Repository ID`/`Clone ID` values a real init
prints (hashed from the random workspace path) to <REPO_ID>/<CLONE_ID>.
init_proxied_server_not_implemented is marked deterministic:false: its
premise is stale and, un-masked, it starts a managed dolt sql-server.
New tests cover the owns_init rule, the harness_init decision, the
run_steps argv sequence (via a recording closure) and the fingerprint
normalization. None spawns a process, so none can hit the write-then-exec
ETXTBSY race against the suite's process-spawning tests.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A new AGENTS.md written by bd init rendered its managed section with the
HasRemote/NoPush rule, but wrote the template text around it verbatim, so
the Quick Reference still listed `bd dolt push` in workspaces with no Dolt
remote or declared no-push. Add EmbeddedDefaultWithOpts, sharing one
omitsDoltPush predicate with the managed-section renderer, and use it for
new AGENTS.md files. Managed-section bytes and hashes are unchanged; an
existing AGENTS.md and a custom --agents-template are written as before.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(timeparsing): export IsCompactDuration
The query lexer keeps its own copy of the compact-duration unit set, and
that copy has drifted from the grammar: it accepts the uppercase units
H D W M Y, which ParseCompactDuration rejects. Export the classifier so
the lexer can ask timeparsing instead of keeping a copy, and pin that it
agrees with ParseCompactDuration on every row, uppercase spellings
included.
AC: AC-1
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(query): classify durations with timeparsing.IsCompactDuration
The query lexer kept its own copy of the compact-duration unit set:
isDurationSuffix for single runes and durationWords for "min". The copy
had drifted. It accepted H D W M Y, which the case-sensitive grammar
rejects, so "created>30M" reached the evaluator as a duration and failed
with the internal error `not a compact duration: "-30M"`, quoting a value
the user never typed.
Classify the whole digit-led lexeme with timeparsing.IsCompactDuration
and delete the copy (isDurationSuffix, durationWords, acceptDurationWord).
Uppercase units now lex as identifiers and fail as an unparseable time;
every lowercase input lexes as before. A unit added to compactDurationRe
now reaches the lexer with no edit here: with "sec" added to the regex
alone, TestCompactDurationGrammarReachesQueryPlane fails on the old lexer
and passes on this one. Retire that test's text naming the deleted copy.
AC: AC-2
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin that uppercase duration units lex as identifiers
"updated>30M", "updated>30H" and "label=30D" lex the value as one
TokenIdent with the text as typed; "updated>30m" and "updated>+30d"
still lex as TokenDuration. On the base lexer the three uppercase rows
fail (typed DURATION).
AC: AC-3
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin the error for an uppercase duration unit
created>, updated<, closed>= and started<= compared to 30M, 30D, 30W,
30Y, 30H or 1H, alone or in "... OR status=open", fail with
`cannot parse time expression: "<value as typed>"`, never with the
internal `not a compact duration` error and never quoting the negated
"-<value>". 30MIN and 30Min, which always took this path, are the
controls. On the base lexer 30 of the 40 subtests fail; the 10 controls
pass.
AC: AC-4
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): bind the lexer's duration grammar to timeparsing both ways
TestCompactDurationGrammarReachesQueryPlane asserted only that every
suffix ParseCompactDuration accepts lexes as a duration. Assert the
reverse too: a suffix it rejects must not lex as TokenDuration, or the
evaluator fails on it with ParseCompactDuration's internal error about a
negated value. Widen the candidates to every one- and two-letter ASCII
suffix in either case, every three-letter lowercase one, and every case
spelling of an accepted three-letter unit.
On the base lexer the reverse sweep fails on exactly [D H M W Y]. A
mutant that case-folds before classifying fails it on those plus the
seven other spellings of "min".
AC: AC-5
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin that a signed uppercase unit stops at the parser
"created>+30M" and "created>-30M" fail Parse and EvaluateAt with
`unexpected token "M" at position 11 (expected end of query)`, as
"created>+30x" already does: a signed digit run has no identifier
fallback, so "+30" is a number and "M" a stray token. On the base lexer
both parsed as a duration and failed in the evaluator with
`not a compact duration: "-30M"` and `"--30M"`; the +30x control passes
on both.
AC: AC-6
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin the values rejecting uppercase units leaves alone
At a fixed now, created>+30d is still 30 days ago, updated>5pm still
17:00 that day, and label=30M / title=30M still filter the literal
"30M". TestQueryMinutesUnitResolvesAgo already pins created>30m (30
months ago) and created>30min (30 minutes ago). These rows pass on the
base lexer as well, which is the point; a lexer mutant that stops typing
signed lexemes as durations fails the +30d row.
AC: AC-7
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(config): stop bd config set truncating config.yaml at a 64 KiB line
updateYamlKey's flat-key path reads config.yaml through a default
bufio.Scanner and never checked scanner.Err(). A line of
bufio.MaxScanTokenSize (65,536) bytes or more makes Scan return false
partway through the document, so the function returned the lines read
so far with a nil error and setYamlConfigAtPath wrote them over the
file, dropping the long line and everything after it. Measured at
5c9c02ab77: a 65,550-byte document came back as the 8-byte
`k1: "zz"` when the key was present, and as 16 bytes when it was absent
(the new key appended onto the truncated prefix).
Check scanner.Err() after the loop and refuse with an error that wraps
bufio.ErrTooLong. It is returned before setYamlConfigAtPath's
os.WriteFile, so `bd config set` and `set-many` now fail and leave the
file as it was. The guard returns only on a scan error, so a document
whose lines all fit gets the same rewrite as before. Unset
(commentOutYamlKey) already splits instead of scanning, and dotted keys
rewrite through yaml.Node, so neither needs it.
TestUpdateYamlKeyRejectsOversizeLine fails at the base (nil error, 8-
and 16-byte results) and passes with the guard. Adds a CHANGELOG
Fixed entry.
AC: AC-1
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin that a line just under the scanner limit still rewrites
The oversize-line refusal must fire only at the bufio.Scanner cliff. The
default scanner buffer holds bufio.MaxScanTokenSize (65,536) bytes, so a
line of 65,535 bytes still fits with its newline, and updateYamlKey has
to give a document with such a line the same rewrite a short document
gets: the key replaced in place when present, appended when absent.
Adds both rows to TestUpdateYamlKeyRejectsOversizeLine. They pass at the
base and with the AC-1 guard, which returns only on a scan error. Two
over-eager variants of the guard pass the existing yaml tests and the
AC-1 rows but fail these rows: capping the scanner buffer at
MaxScanTokenSize-1, and a pre-scan length check that refuses a line of
MaxScanTokenSize-1 bytes.
AC: AC-2
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin that a refused bd config set leaves config.yaml unchanged
setYamlConfigAtPath reads config.yaml, rewrites it through
updateYamlKey, and writes the result back. The AC-1 guard makes
updateYamlKey refuse a document with a line of bufio.MaxScanTokenSize
bytes or more, and setYamlConfigAtPath returns that error before its
os.WriteFile, so the file is never touched. No test covered that order.
TestSetYamlConfigAtPathOversizeLineLeavesFileUntouched writes a
config.yaml with a 65,538-byte comment line, sets no-db, and checks that
the error wraps bufio.ErrTooLong and that the file still holds all
65,563 of its bytes. At 5c9c02ab77 it fails both checks: a nil error,
and the file cut to the 11-byte `no-db: true`. It passes with the AC-1
guard and needs no code change of its own. A variant that writes the
file before returning the error fails the byte check (0 bytes left), and
one that swallows the error fails the error check.
AC: AC-3
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): say set-many keeps keys it wrote before a refused one
The entry said `bd config set` and `set-many` both fail and leave
config.yaml as it was. That holds for `set`, and for a `set-many` whose
first config.yaml key is the refused one. But `set-many` writes its
config.yaml pairs one at a time, in argument order, and returns on the
first error with no rollback, so a key listed before the refused
undotted key (a dotted `sync.remote`, say) is already on disk when the
command exits 1.
Measured at 0d3aa63761 with a 70,000-byte comment line in config.yaml:
`bd config set-many sync.remote=git@example.com:o/r.git actor=bob`
exits 1 and adds the `sync:` block (70,039 -> 70,083 bytes);
`set-many actor=bob sync.remote=...` and `bd config set actor bob` exit
1 and leave the file byte-identical.
de330c3e7f's message makes the same claim; this commit does not rewrite
it.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
outputDotFormat declared nodes and edges in the order of the list page it
was handed. The default page order breaks priority ties by created_at at
one-second precision, so two equal-priority issues swapped places depending
on whether they were created in the same second, and the proxied route's
edge query orders by source only. The same graph printed different bytes
(Oracle A list_dot_format_dependency_edges flipped between runs).
Declare nodes in byte order of id and each node's edges in byte order of
(target, type), on copies of the caller's slices. --sort and --limit still
choose which issues are listed.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): pin vet policy to module toolchain (wy-kk1b9a)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Steve Yegge
* test(bazel): report an unavailable pinned toolchain as a missing host tool
Review fixes for #7668 (adopt-pr iterations 1-2).
The GOTOOLCHAIN pin added a failure path that base did not have. A host
that runs another Go release and cannot fetch go.mod's toolchain
(offline, GOPROXY=off, empty module cache) failed
TestPRRunsGoTestsBazelSkips with a bare "exit status 1": cmd.Output()
keeps the go command's stderr in the ExitError, and t.Fatal printed
only the status.
- Report the failure through skipOrFailWithoutHostTool, naming the
pinned version and the go command's stderr when it printed any.
Plain go test skips; Bazel still fails, and there the registered SDK
is go.mod's toolchain, so nothing is fetched.
- Compare VET_PASSES in a subtest, so the skip covers only the check
that needs the toolchain. Given the parent's t, it skipped the whole
test, and with it the six checks after it that read only the
checkout. A failed subtest still fails the parent, so Bazel stays
fail-closed.
- Pad a two-component version ("go 1.26" with no toolchain line) to
go1.26.0 in goToolchainName, as scripts/ci/gofmt-bin.sh does.
GOTOOLCHAIN=go1.26 is rejected as a language version, not a
toolchain version. A table test pins 1.26, 1.26.7 and 1.26rc1.
- Say in the helper comment that the pin overrides an ambient
GOTOOLCHAIN, local included, and may download into GOMODCACHE.
Validated with go1.26.7-built test binaries under env -i, GOPROXY=off,
with an empty HOME and module cache unless noted:
- go1.26.9 host: the VET_PASSES subtest skips, naming go1.26.7 and
"toolchain not available", and the parent passes. With a planted
scripts/ci/go-test-vet.sh the parent fails, as on base; iteration 1
skipped the whole test there (rc 0). Same on go1.26.5 with
GOTOOLCHAIN=local.
- go1.27.1 host with go1.26.7 cached: passes; base fails on
stdversion. go1.26.7 host: passes.
- Bazel branch (TEST_SRCDIR, BEADS_TEST_GO): SDK go1.26.7 passes. SDK
go1.26.9 fails the subtest and the parent with "executor lacks a
host tool". A non-executable SDK path ends the message with the exec
error, with no dangling ": ".
- go.mod "go 1.26" without a toolchain line: passes on go1.26.0 and
under Bazel with SDK go1.26.0; a go1.26.9 host skips, naming
go1.26.0. Iteration 1's unpadded mutant only skipped under plain go
test (it failed under Bazel); the table test now fails it, and fails
mutants that count dots or drop the regex anchors.
- go test ./scripts on go1.26.7: 306 pass, 0 fail, 1 skip; the only
outcomes not on iteration 1 (305/0/1) are the two new tests passing.
go vet ./scripts and the pinned gofmt -l are clean.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(config): keep config.yaml's trailing newline on bd config set
updateYamlKey's flat-key path, which `bd config set` takes for every
single-segment key, read the document with bufio.Scanner and joined the
lines back with "\n". ScanLines drops the final terminator, so the result
was exactly one newline short of any terminated config.yaml:
"issue_prefix: vp\ndolt.mode: server\n" came back without its final
newline, a spurious no-newline-at-end-of-file change in a git-tracked file.
Re-attach the input's own trailing run at the return, the tail
commentOutYamlKey got for the unset side in #6749. One statement covers
both the in-place and the appended branch, and a document without a
trailing newline still does not acquire one. The TODO that recorded the
defect is removed in the next commit.
The test file's header now covers both verbs; the set test follows the
unset ones.
AC: AC-1
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(config): drop the TODO that deferred the bd config set newline fix
The TODO above updateYamlKey's return recorded that `bd config set` was
knowingly left one newline short, as a scope call in #6749. The previous
commit fixed that, so the TODO now describes a defect that no longer exists.
Check: searching internal/config/yaml_config.go for the phrase
"`bd config set` is knowingly left unfixed" finds one match at the base
and none after this commit.
AC: AC-11
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin a set's blank-line trailing run, not just a final newline
A config.yaml that ends in one or two blank lines came back from
`bd config set` one newline short, so the output still ended in "\n".
Compare the exact trailing run, as the unset table does, so that loss
stays visible. Both rows fail on the base code (run "\n" vs "\n\n", and
"\n\n" vs "\n\n\n") and pass with the tail fix.
AC: AC-2
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin the appended key's terminator on bd config set
When the key is absent, updateYamlKey appends it as the new last line,
and the old join left that line unterminated: "x\n" came back
"x\n\nnewkey: \"v\"". Pin the exact output for "x\n", where the separator
blank line is kept and the newline follows the new key, plus a table row
for the trailing run. Both fail on the base code and pass with the tail
fix.
AC: AC-3
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin a set appended over a blank-line tail
For "x\n\n" without the key, the existing blank line already separates,
so updateYamlKey adds no second one and the document's own two-newline
run now follows the new key: "x\n\nnewkey: \"v\"\n\n". Restoring a single
newline would leave this exact shape one short again, so pin it exactly,
plus the matching table row. Both fail on the base code, which returned
"x\n\nnewkey: \"v\"", and pass with the tail fix.
AC: AC-4
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin that a set does not invent a trailing newline
The repair re-attaches the document's own trailing run instead of appending
a newline, so a config.yaml that ends without one still ends without one
after `bd config set`. Pin that for both branches: a present key rewritten
in place, and an absent key appended as the new last line.
This passes on the base as well; it is a pin on "preserve, not append".
The always-append mutant (`return out + "\n", nil`) turns both inputs red.
AC: AC-5
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin a set's output on a CRLF config.yaml
A set of a single-segment key has always rewritten a CRLF document to LF,
because the scan drops each line's "\r". What the old join added on top was
a missing terminator: "actor: a\r\nother: x\r\n" came back
"actor: \"b\"\nother: x". With the restored tail it comes back
"actor: \"b\"\nother: x\n", which is also how an unset of the same document
ends.
Pin the exact output, and check the trailing run against commentOutYamlKey
on the same input, in a subtest named after unset's CRLF subtest. It fails
on the base (exact and parity) and passes with the tail from AC-1.
AC: AC-6
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(config): keep a CRLF config.yaml's blank-line tail on bd config set
The restored tail measures the trailing run on the raw content, where
strings.TrimRight(content, "\n") stops at the last "\r". On a CRLF file the
re-attached run was therefore always a bare "\n", however many blank lines
followed: "actor: a\r\nother: x\r\n\r\n\r\n" came back "…x\n", one newline
shorter than even the base's "…x\n\n".
Normalize CRLF the way commentOutYamlKey does before the scan, so the run is
the LF run and a set ends the file exactly as an unset of the same document
does. The scan output is unchanged, since ScanLines already drops each
line's "\r". The line sits below the nested dispatch, not at the top: some
updateNestedYamlKey branches carry "\r" through on untouched lines, and
this fix leaves that path alone.
Also correct the comment on unset's CRLF subtest, which still blamed a
leftover "\r" for the bare-"\n" tail; commentOutYamlKey normalizes up front,
so that mechanism no longer exists and the new set cases contradict it.
AC: AC-7
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin the trailing newline through SetYamlConfig
setYamlConfigAtPath writes updateYamlKey's output verbatim, so the dropped
newline reached the git-tracked config.yaml. Add the writer-level twin of
TestUnsetThroughTheFileKeepsTheTrailingNewline: a .beads/config.yaml ending
in a blank line, BEADS_DIR pointed at it, SetYamlConfig("actor", "bob"),
and the re-read file must keep its "\n\n" run. It first checks that the
value landed, so an untouched file cannot pass.
On the base the run comes back "\n"; with the tail from AC-1 it is "\n\n".
AC: AC-8
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(config): pin that a set of a dotted key bypasses the CRLF normalization
The CRLF normalization in updateYamlKey sits below the nested dispatch on
purpose. replaceFlatKeyLine and appendNestedYamlKey keep "\r" on the lines
they leave alone, so hoisting the line above the dispatch would silently
change what a dotted-key set writes:
"issue_prefix: vp\r\ndolt.mode: server\r\n" comes back
"issue_prefix: vp\r\ndolt.mode: \"embedded\"\n" today and would lose the
first "\r".
Compare updateYamlKey with updateNestedYamlKey on four CRLF documents for
dolt.mode: a literal dotted key, a nested block, an absent key, and a
comment-only document. This passes on the base as well; it pins the
boundary, not the nested writer's outputs. The hoisted mutant turns the
literal-dotted-key and comment-only rows red; the other two are re-marshalled
to LF either way.
AC: AC-9
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(config): append an absent key after a blank-line tail as one line
updateYamlKey's flat path appends an absent key after the scan's empty
tokens for the file's trailing blank lines, so those blank lines already
sit ahead of the new line; the tail rule then re-attached content's whole
run after it as well. A set of a new single-segment key on a file ending
in blank lines therefore repeated them at EOF: "x\n\n" came back
"x\n\nnewkey: \"v\"\n\n", "x\n\n\n" came back
"x\n\n\nnewkey: \"v\"\n\n\n", and CRLF "x\r\n\r\n" came back
"x\n\nnewkey: \"v\"\n\n" -- the diff noise this PR exists to remove.
The appended branch now re-attaches only the one terminator
bufio.Scanner dropped, and only when content had it; the in-place branch
keeps the TrimRight + content's-run rule it shares with
commentOutYamlKey. The appended-key subtest now wants
"x\n\nnewkey: \"v\"\n", adds "x\n\n\n" and CRLF rows, and drops the
comment claiming a single terminator would leave it one newline short.
The suffix-run table drops its blank-tail append row, whose expectation
assumed the file's run follows the key, and
TestSetOfAnAbsentKeyThroughTheFileAddsOneLine pins the shape through
SetYamlConfig. The doc comment states the nested boundary and the tail
rule.
Not changed here: the unchecked scanner.Err() is #7670's fix (its guard
lands right after this scan loop, and ./internal/config/ is green on the
union of both PRs). The stale bufio.Scanner narration in
commentOutYamlKey's comment stays a follow-up, since #7613 edits that
function.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* fix(cli): refuse backup init/sync/remove and import under --readonly
Strict --readonly is meant to refuse every command that writes, with
"Error: operation '<op>' is not allowed in read-only mode" and exit 1.
bd backup init, backup sync, backup remove and bd import never called
CheckReadonly, so that gate never refused them:
- On a server-mode store they ran to completion under --readonly:
backup init and backup remove rewrote or emptied the server's
dolt_backups registry, backup sync wrote the backup destination, and
import wrote issues.
- On an embedded store they failed only because the store was opened
read-only, with the storage layer's "store is read-only" text, and
backup sync took the backup lock first and left .beads/backup.lock
behind.
The three backup verbs now call CheckReadonly first in their RunE, as
the other write commands do. Its migration-freeze half is redundant for
them: their leaf names are not on the read-only list and they have no
preview flag, so PersistentPreRunE's early freeze gate refuses them
first.
bd import calls it only when --readonly is set. CheckReadonly also
answers a migration freeze, and does so by exiting the process, while
runImport answers a freeze by returning the error so cleanup still
runs; guarding the call leaves that path exactly as it was.
bd import --dry-run is refused too. The preview opens the store
read-only and writes nothing, so this is a policy choice. It matches
create --dry-run (also refused under --readonly) and import's own
freeze posture: a migration freeze already refuses import --dry-run
(TestImportBlockedDuringMigrationFreeze), and CheckReadonly treats the
two gates as one. The cost is small, since the same preview runs
without --readonly. bd backup status and bd backup itself (a command
group that only prints help) stay allowed.
TestBackupAndImportBlockedInReadonlyMode runs each command, plus
import --dry-run, under --readonly and --readonly --sandbox against an
embedded workspace and one on the Dolt test server. Each row expects
exit 1, exactly the standard refusal on stderr, an empty stdout, and
nothing changed: the .beads tree, the backup destination, the issue
count, and, in server mode, the dolt_backups registry.
TestBackupStatusAndListWorkInReadonlyMode is the control showing that
backup status and list still run.
Ported from the versioned-beads fork: b86df6a9eb (test) and
5a067acc56 (fix). The comment on TestImportBlockedDuringMigrationFreeze
is updated, since runImport now calls CheckReadonly under --readonly.
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(backup): refuse --readonly backup restore before the exclusive gate
A restore replaces the store, so strict --readonly must refuse it.
Nothing did:
- In server mode no storage layer stops the connection, so
`bd --readonly backup restore --force` ran to the end: exit 0,
"Restore complete", and the store was replaced.
- In embedded mode the command took the EXCLUSIVE workspace gate first,
leaving the holder sidecars (.beads.gate.lock.info,
.beads/embeddeddolt.gate.lock.info) behind, and was stopped only
later by the storage layer's "store is read-only".
acquireCommandWorkspaceGates now calls CheckReadonly("backup restore")
first for the exclusive (restore) case when readonlyMode is set. That
is before any gate file is created or the store is opened, so nothing
is held and the exit skips no release. The guard checks readonlyMode
alone, so a restore without --readonly, including one refused by a
migration freeze, keeps its existing order. The restore RunE also calls
CheckReadonly first, as every write command does.
This does not depend on the strict-readonly SHARED-gate change
(workspacegate.Options.ReadOnly): the refusal comes before any gate is
built.
The one visible change in proxied-server mode, where every --readonly
command is already refused: `bd --readonly backup restore` now gets
this standard refusal (plain text, exit 1). Before, the proxy
capability refusal answered it (exit 1, typed JSON under --json), and
only after the exclusive gate had been taken.
TestEmbeddedBackupRestoreStrictReadonly and
TestBackupRestoreStrictReadonlyServerMode run the built bd as a
subprocess, because CheckReadonly exits. The workspace's live store
holds three issues and its backup holds two. Each test asserts the
standard refusal with exit 1 and an empty stdout, no storage-layer
message, an unchanged project directory and .beads tree, and an
unchanged issue count. Each runs under --readonly and under
--readonly --sandbox. A control restores without --readonly and
expects two issues, so "unchanged" cannot be vacuous.
Ported from the versioned-beads fork: 1cd5f1c202 (test) and
6ac79d6207 (fix). The fork's test used a dirEntryNames helper that
belongs to its separate SHARED-gate change. It is inlined here so this
change compiles and lands on its own in either order. The server test's
comment is corrected too: the fixture's backup and the restore both run
inside the server at the same path, so it passes against a
containerized test server as well as a local one.
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): leave a current agents-file beads section untouched
installAgents rewrote the instructions file whenever it found a beads
marker, discarding ReplaceSectionWithOpts' changed flag and error. A rerun
of `bd setup claude` (and `bd init`, which runs it) replaced a byte-identical
CLAUDE.md with a new file (new inode, fresh mtime, mode reset to 0644) and
reported "Updated existing beads section", while bd init's updateAgentFile
reported AGENTS.md current in the same run. A section whose END marker was
lost or came before BEGIN was likewise "updated" without change.
Mirror updateAgentFile: write only when the section changes, report
"<file> already has the current beads section" otherwise, and return
ErrMalformedMarkers instead of rewriting. claude/gemini warn and continue;
factory/opencode/mux fail (mux before installing its .mux hooks), per their
existing error policies. Tests pin inode, mode and mtime of the untouched
file and the claude/mux policies for both malformed-marker shapes. Goldens
updated for the new rerun message.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(setup): keep CLAUDE.md's beads block when the AGENTS.md update fails
When CLAUDE.md is an @AGENTS.md stub that still holds a beads block,
installClaude strips that block once the redirect is active, gated only on
installAgents not having skipped a symlinked AGENTS.md. It ignored
installAgents' error, so now that installAgents returns ErrMalformedMarkers
instead of writing a malformed AGENTS.md back, the strip deleted the stub's
block while AGENTS.md kept no usable section, and the warning named
CLAUDE.md. Base had the same end state behind a false "Updated" report; the
new error is what makes the failure detectable, so the gate belongs here.
Gate the strip on a nil installAgents error too, so it runs only once
AGENTS.md holds the current section (written now or already current), and
name the file that failed in the warning (AGENTS.md when redirected). A
redirect subtest in TestInstallClaudeWarnsOnMalformedMarkers pins both, for
both malformed shapes: dropping the gate reds it on CLAUDE.md's content,
inode, mtime and mode, and naming CLAUDE.md again reds it on the warning.
Also correct updateBeadsSectionWithProfile's doc comment, which claimed an
error string it never returned: it returns the content unchanged when the
section cannot be replaced. The CHANGELOG entry notes the redirect case.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* test(cmd/bd): pin mixed-case dep tree --format Mermaid through the CLI
TestDepTreeFormatMermaidCaseInsensitive calls isMermaidTreeFormat directly,
so reverting the runDepTree dispatch to formatStr == "mermaid" (the PR #6646
bug) kept every test green. Add a --format Mermaid call to the embedded
tree_format_mermaid subtest so the flag-to-renderer wiring is pinned.
AC: AC-1
AC: AC-2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c325246d4a)
Ported-From: opus/c325246d4a8e4cd5f60f9548053b5385e20a4d2e
AC: AC-1
* test(cmd/bd): record AC-2 mutant evidence for the mixed-case pin
No code change: AC-2 is the mutant-killing property of the row added in
the AC-1 commit. Evidence (bazel test //cmd/bd:bd_test --config=ci
--test_filter='TestDepTreeFormat|TestEmbeddedDepBTreeAndCycles/tree_format_mermaid'
--test_arg=-test.skip= --test_env=BEADS_TEST_EMBEDDED_DOLT=1
--test_output=all):
- Mutant M1 (cmd/bd/dep_tree.go:153 changed to formatStr == "mermaid",
isMermaidTreeFormat left intact), row absent: all targeted tests pass —
the hole.
- M1 applied, row present: TestEmbeddedDepBTreeAndCycles/tree_format_mermaid
FAILS with the plain-text fall-through header ("Dependency tree for"),
while TestDepTreeFormatMermaidCaseInsensitive, TestDepTreeFormatFlag and
the lowercase e2e row stay green.
- M1 reverted, row kept: all pass; no SKIPs in any run.
AC: AC-2
Agent-Signature: claude-code-glm-5.3-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Code <noreply@anthropic.com>
(cherry picked from commit 38df0c5b22)
Ported-From: glm/38df0c5b224c41fa312dd130b8e7fe378d74b0b4
AC: AC-2
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(cmd/bd): pin comments_omitted on the embedded wisp count-only view
show_json_wisp_comment_count asserted comment_count and the absent
comments slice but never read comments_omitted, the flag the GH#5565
fix unlocks. A regression that stops setting it stayed green here.
AC: AC-1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9b5be54bdf)
Ported-From: opus/9b5be54bdf3c4ef69f5b8eaf68770b26b102ff35
AC: AC-1
* test(cmd/bd): add the embedded --include-comments wisp twin
The proxied plane pins a wisp's comment behavior with a pair of
subtests; the embedded plane had only the count-only half. Add
show_json_wisp_comments_include_streams, which asserts that
--include-comments streams both of a wisp's comments, and let
bdShowDetails carry extra flags after --json.
AC: AC-2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d1795e55f1)
Ported-From: opus/d1795e55f15710e3112a37852361f577d42eeff9
AC: AC-2
* test(cmd/bd): pin count and omitted flag on the embedded wisp include view
GH#5565's symptom was --include-comments returning rows the count said
did not exist. Assert the include payload's comment_count matches the
streamed rows and that comments_omitted stays absent (omitempty) when
rows are present.
AC: AC-3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit ae43c79065)
Ported-From: opus/ae43c790652261e5d004bdc1b23b768a391ce8a9
AC: AC-3
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
`bd setup claude --remove` (and the factory, mux, opencode and gemini
recipes that share removeBeadsSection) cut exactly the managed section
and kept the blank lines that set it off, leaving a 3-line hole in the
CLAUDE.md bd init writes. installAgents then appended a re-added section
after two blank lines, so every remove/re-add cycle grew the file.
removeBeadsSection now drops the line breaks next to the section (never
text): the surrounding text is rejoined with one blank line, or none if
the section had none; a section at the top leaves no leading blank
lines and one at the bottom leaves a single final line break. CRLF is
preserved, and a marker sharing its line with text is still cut
exactly. installAgents appends like bd init's updateAgentFile: ensure a
final newline, then one blank line. remove(add(x)) == x for a file
ending in a newline, and after the first remove, setup and --remove
toggle between the same two files; a re-added section goes at the end.
Goldens regenerated with BD_UPDATE_GOLDEN=1.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bd init --quiet still printed "✓ Removed SessionStart hook" and
"✓ Removed PreCompact hook" when the project's .claude/settings.json (or
the legacy settings.local.json) carried the bare `bd prime` hooks an older
bd registered. removeHookCommand printed with fmt.Printf straight to the
process stdout, bypassing the discarding writer that --quiet hands the
project installers.
removeHookCommand now takes the caller's writer; Claude and Gemini pass
env.stdout at every call site. bd setup claude/gemini print the same
lines in the same order; quiet init drops them while still migrating the
hooks. This is the removal half of the #7186 class; #7195 covers
addHookCommand and the two changes merge cleanly in either order.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The scoreboard dumped every in-scope failure to the host-global
/tmp/oracle-a-failures.txt, and run-oracle-a.sh copied it into its scratch
dir only after scoring finished. A concurrent scoreboard (another worktree,
a shard, another user) finishing in between overwrote or swapped the
detail, so a failing run could print nothing or another run's divergence.
The scoreboard now honors ORACLE_FAILURES_FILE (unset or empty keeps the
historical /tmp default for standalone use), and run-oracle-a.sh points it
at $SCRATCH/oracle-a-failures.txt and prints that file directly. The cp
and the /tmp fallback are gone.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
run-oracle-a.sh's EXIT trap removed its reference worktree only when
`git worktree list --porcelain | grep -qF "$REF_SRC"` matched. Under
pipefail that check reported a registered worktree as absent in two ways:
grep -q exits on its first match while git is still writing a large
listing, so git dies of SIGPIPE (141) and the pipeline fails; and git
lists the resolved path, which $REF_SRC never matches when $TMPDIR has a
trailing slash or runs through a symlink (both macOS defaults). Either
way the ref-src registration leaked as a prunable worktree.
Run `git worktree remove --force` unconditionally. It resolves the path
itself and fails harmlessly (silenced, `|| true`) when nothing is
registered, so cleanup is idempotent and exit codes are unchanged.
TestOracleAScriptRemovesItsReferenceWorktree runs the real script in a
fixture repo with a stand-in go that fails the reference build, covering
a >3 MB listing, a trailing-slash TMPDIR, a symlinked TMPDIR, and a run
that dies before the worktree is added.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(http): bd link over a connected HTTP workspace, through the DependencyEditor role
bd link wrote through the store's raw AddDependencyWithOptions, which the
HTTP client refuses by design (D8), so every bd link failed on an HTTP
workspace whatever the type. Its direct route now writes through the
DependencyEditor role with the helper bd dep add uses
(addDependencyEdgesDirect), which serves local stores and HTTP workspaces
alike: over HTTP one dependencies:add request, and the server already takes
any 1-32 character type.
link keeps its own checks before the write (and before the dial): the
dotted-child rule and the type's length only, never bd dep add's
well-known-type list. The proxied-server route is unchanged.
backend/http TestE2E_LinkOverHTTP covers owned-by and the other roadmap
types, the empty and over-long type refusals (no write reaches the server),
and the typed conflict for an edge of another type.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/39201892756
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
showIssueAsOf reported each failed AS OF lookup on stderr and continued, but never counted what it read and returned nil, so a bad ref (an instant or a versioned-history address the Dolt AS OF read does not take, an unknown branch or commit) or an issue absent at the ref exited 0 with an empty stdout, under --json too. Its proxied-server twin, runShowProxiedAsOf, returned nothing and its dispatcher returned nil.
Both now count the issues they read and, when that is zero, end the way plain bd show ends a batch that found nothing: show's JSON error envelope on stdout under --json, a bare exit 1 otherwise, with the per-id reasons still on stderr. A batch that reads at least one issue still exits 0, as plain show's does. The read itself is unchanged (Dolt AS OF).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): pin the command tree and representative --help output
Add two in-process goldens for the bd command surface, so any added,
removed, hidden or reworded command or flag fails until the goldens are
regenerated and shows up as a reviewed testdata diff:
- TestCommandTreeGolden walks the whole cobra tree (hidden commands
included) and records, per command, Use, Aliases, Short, Long, Example,
group, hidden/deprecated state, runnability and annotations, plus every
local and persistent flag it defines (name, shorthand, type, default,
usage, hidden, deprecation, annotations). Output is sorted and rendered
twice to prove it is deterministic.
- TestCommandHelpGolden runs `bd <cmd> --help` through rootCmd for root,
create, show, list, update, close, version, versions, config and serve.
--help returns before the root pre-run, so no store is opened; color
escapes are stripped. The snapshots are byte-identical to a built bd
binary's --help output.
Both run from a fresh ordinary (dependency-mode) workspace: a
.beads/metadata.json with no graph marker and no database behind it.
The tree is primed the way the binary is (main()'s help command and its
--all/--doc/--list/--docs-root flags, ExecuteC's completion command), and
cobra's history-dependent pieces (the lazily added per-command --help flag,
the __complete request commands) are excluded, so the result does not
depend on which in-process tests ran first. The help runs reset every flag
afterwards so a later in-process command does not inherit --help.
docs/cli-docs.pin holds check-doc-flags at the v1.2.2 release, so drift on
main is not caught there; these goldens are the live guard. They pin the
cgo build (the !cgo build swaps in a federation stub). Regenerate with
BD_UPDATE_GOLDEN=1 go test -tags gms_pure_go ./cmd/bd -run '^TestCommand(Tree|Help)Golden$'.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): keep the command goldens from merging flags into the shared tree
TestCommandTreeGolden read each command's flags through
LocalNonPersistentFlags, and TestCommandHelpGolden dispatches
`bd serve --help`. Both run cobra's mergePersistentFlags, which copies
every inherited persistent flag (--json, --db, ...) into the command's
own flag set for the rest of the process. TestServeFlags pins serveCmd's
exact flag set, so it failed whenever a golden test ran before it in the
same test binary: tree then serve flags, help then serve flags, and
-test.shuffle seeds 2 and 3, on the PR head and on its merge with main.
CI passes only because bd_test's 16 Bazel shards happen to run them in
different processes. Of 37 candidate tests, TestServeFlags is the only
one affected.
- goldenLocalFlags reads the set LocalNonPersistentFlags reports without
calling it: c.Flags() minus c's own persistent flags and minus
inherited copies. Like cobra, it treats a flag as inherited only if it
is the nearest ancestor's own *pflag.Flag, so copies left by an
earlier in-process execution are skipped and a flag that shadows an
inherited one still renders.
- TestCommandTreeGolden fails if rendering changes the number of flags
in any command's flag set.
- TestCommandHelpGolden calls restoreServeGlobals, which re-registers
serveCmd's flags after the `bd serve --help` dispatch.
Review minors:
- The regeneration command (doc comment, failure-message constant,
tree.golden header) sets CGO_ENABLED=1. Without cgo the file does not
build, so the command matches no test and exits 0.
- enterOrdinaryWorkspaceForGolden calls isolateBeadsDirForTest.
- renderCommandHelpGolden's comment says when the ANSI strip matters.
- cmd/bd/AGENTS.md lists the goldens under "Adding a command" and
"Guard tests".
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* test(setup): pin the Claude agent artifacts bd init and bd setup claude write
Before-parity pin P11. Nothing pinned the agent artifacts byte for byte, so
a change to them -- a new hook event in .claude/settings.json, new text in
the minimal CLAUDE.md/AGENTS.md template and with it a new marker hash that
marks every installed section stale -- could land without anyone seeing
the user-visible diff. These goldens make any such change a reviewed diff.
- internal/templates/agents: TestManagedSectionGolden pins each managed
section (minimal and full profile, with and without a Dolt remote)
markers included; TestManagedSectionHashes pins their marker hashes as
hand-maintained literals; NoPush is pinned to render the no-remote bytes.
- cmd/bd/setup: TestClaudeSetupArtifactsGolden records transcripts of
bd setup claude, --check and --remove (project, --stealth, --global, a
user's own settings and CLAUDE.md, a stale section, a legacy
settings.local.json install, a CLAUDE.md that imports AGENTS.md): each
step's result and output, and the settings and instruction files it
creates, changes or deletes. TestClaudePluginManifestHookEvents pins the
hook events and commands the beads Claude plugin declares.
- cmd/bd: TestEmbeddedInitAgentArtifactsGolden runs a real bd init (default
and --agents-profile full) and then bd setup claude --check, --remove and
a reinstall through the binary, with exit codes.
A managed section in a transcript is shown by its marker line and a
pointer to the template golden it is checked to match byte for byte, so a
template change shows up once in full and as a hash bump wherever it lands.
Regenerate with BD_UPDATE_GOLDEN=1.
CI companions: the new test files and testdata in BUILD.bazel (bd_test
gains its internal/templates/agents dep), and the new TestEmbedded* in the
100-shard embedded cmd manifest (incremental --write).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(setup): drop BD_OTEL_* and split HOME in the agent artifact golden
TestEmbeddedInitAgentArtifactsGolden pins bd's stderr byte for byte, but
bdEnv passes the caller's BD_OTEL_* variables through, and bd prints a
deprecation warning on stderr for a legacy one (BD_OTEL_METRICS_URL,
BD_OTEL_LOGS_URL, BD_OTEL_STDOUT=true) before it checks whether
telemetry is on. On a host that exports them (agent hosts do; CI does
not), both scenarios failed at the first stderr block with no code
drift.
The test now runs bd init and every bd setup claude step with
agentArtifactEnv: bdEnv(dir) without BD_OTEL_* and OTEL_*. It filters
the env slice instead of calling clearTelemetryEnv, which uses t.Setenv
and so cannot run in these parallel tests.
The same helper gives bd a HOME of its own instead of bdEnv's HOME ==
project. With the two equal, a bd that wrote the hook and CLAUDE.md into
the home directory instead of the project passed every pin. The
transcript now also records $HOME/.claude/settings.json and
$HOME/CLAUDE.md, and output paths under HOME read $HOME. bd init runs
the steps bdInit does (git repo, seeded schema) with that env.
The test doc now names what it does not pin: a proxied-server bd init
(no Codex section, HasRemote from its own remote URL), a bd init with a
remote, and the Cursor files. It also says a change to AGENTS.md's
wrapper text or Codex section can fail only here.
The goldens are unchanged.
Validation (env -i, go1.26.7, GOFLAGS=-mod=readonly, GOPROXY=off,
BEADS_TEST_EMBEDDED_DOLT=1, -tags gms_pure_go):
- the golden passes in a clean env; with BD_OTEL_METRICS_URL=x
BD_OTEL_LOGS_URL=y; with every legacy selector plus BD_OTEL_ENABLED
and OTEL_EXPORTER_OTLP_ENDPOINT; and under -race;
- the previous test with BD_OTEL_METRICS_URL=x BD_OTEL_LOGS_URL=y fails
at golden line 132 on the deprecation warning;
- swapping homeDir and projectDir in setup's defaultClaudeEnv passes the
previous test and fails this one at golden line 5 (the transcript
shows created $HOME/.claude/settings.json).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* test(cmd/bd): pin workspace discovery refusal text and exit codes
Add before-parity pins for what an ordinary bd prints, and with which
exit code, when workspace discovery cannot select a usable workspace:
- no .beads, an empty .beads, or a .beads with config.yaml but no
metadata.json and no database ("no beads database found", and bd
where's text and --json refusals);
- a corrupt metadata.json, for list, create, where (all refuse) and
version (warns, exits 0);
- an exported BEADS_DIR naming a missing path, an empty directory, a
regular file or a corrupt workspace, run from a corrupt workspace so a
fallback to cwd discovery would show;
- .beads/.env: BEADS_DIR routing, an exported BEADS_DIR winning, BEADS_DB
routing bd where but not a data command, BD_JSON applying only in the
selected workspace, and a .env BD_BACKEND not being refused;
- .beads/redirect: missing and non-workspace targets (warning, then the
source), a corrupt target, a chain, and a redirect behind BEADS_DIR;
- --db paths and names, and BEADS_DB / BD_DB, including the two
inconsistencies main has today (a data command ignores BD_DB, and lets
a discoverable cwd workspace shadow BEADS_DB, while bd where honors
both);
- BD_BACKEND / BD_DATABASE_BACKEND being refused before any of the
above, for store-less commands too.
The cases use workspaces with a corrupt metadata.json as sentinels: the
refusal names the metadata.json it failed to parse, which shows the
directory discovery selected without opening a store, so the store-less
pins need neither Dolt nor cgo. One embedded-Dolt pin covers the
store-backed .env case: BD_READONLY=true in .beads/.env refuses a write
with the read-only text and exit 1, reads still run, and an exported
BD_READONLY wins over the file.
These pin today's origin/main, not an ideal. A change that reorders
admission, discovery or checkBlockedEnvVars in the root PersistentPreRunE
now has to change an expectation here and is reviewed as a test diff.
Built from the merge base with the graph fork (46aa59cc65), bd passes
every store-less pin; the fork tip fails two (a BEADS_DIR naming a
regular file exits 5 with graph_not_initialized instead of exit 1, also
when BD_BACKEND is set).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): keep the discovery pins independent of PATH and cgo
The version case under TestDiscoveryRefusalPinsCorruptMetadata pinned
bd version's full stderr. bd version also appends a "Warning: multiple
'bd' binaries found in PATH" block when the caller's PATH holds more
than one distinct bd binary (a release install plus a dev build, or
Homebrew plus go install), and the fixture passes the caller's PATH
through. Such a machine failed the pin spuriously. normalize now drops
that block from stderr, as it already drops the sandbox auto-detection
notice, so the rest of the case is still pinned exactly.
The file also said the store-less pins need no cgo. They need a cgo bd.
A CGO_ENABLED=0 bd is server-only, and its no-database hints add "run
'bd doctor' to diagnose", so a CGO_ENABLED=0 go test of the package
failed 16 cases on the hint wording alone. The file now builds only
with cgo, and its header says why. CI runs none of these in its
CGO_ENABLED=0 lane, whose -run subset is fixed by PURE_CMD_BD_TESTS.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): pin a working-directory .beads that is a regular file
The ExplicitBeadsDir pins cover a BEADS_DIR that names a regular file.
This adds the same case reached by the working-directory walk instead:
a project whose .beads is a regular file. bd list and bd where both exit
1 with "Error: loading config: reading config: open
$ROOT/p/.beads/metadata.json: not a directory".
bd built from the fork merge base 46aa59cc65 passes both cases. The
fork tip b9eebc31f8 fails both: it exits 5 with "graph_not_initialized:
open $ROOT/p/.beads/graph-preview-format: not a directory", the same
reorder the BEADS_DIR pin already catches.
A .beads that is an unreadable directory (chmod 000) splits main and
the fork the same way, but it is not pinned: a test run as root can
still read the directory.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): close the embedded discovery pin's environment
Maintainer fixup from the adoption review of #7677.
TestEmbeddedDiscoveryPinsEnvFileReadonly compares bd's output exactly,
but its run helper started from bdEnv, which drops only BEADS_* and
BD_ROUTING_MODE. Every other BD_* the caller exported reached bd: with
BD_OTEL_METRICS_URL/BD_OTEL_LOGS_URL set (as on agent hosts) the
deprecation warning lands in front of the read-only refusal, with
BD_JSON_ENVELOPE=1 the empty list is printed as an envelope, and in a
sandbox the "Sandbox detected" notice precedes the refusal; each failed
the pin. The run helper now uses the store-less pins' closed environment,
factored out of discoveryPinFixture.baseEnv as discoveryPinEnv (HOME stays
the directory bd init used), and drops the sandbox notice from stderr
with the same discoveryPinSandboxNotice pattern normalize now uses.
normalize collapsed every consecutive repeat of a stderr line, which also
hid a doubled "Error:" line. It now folds only repeated
"Warning: redirect" lines, the ones discovery prints once per re-resolve.
blocked-backend-not-checked used a corrupt-metadata sentinel, whose
bind-time refusal comes before the legacy guard, so a blocked-variable
check added after .env loading would not have changed its output. It now
uses a config.yaml-only workspace and pins discovery's no-database
refusal.
Measured with the PR head's bd and test binaries under env -i:
- the embedded pin passes on a clean environment and failed with
BD_OTEL_*, BD_JSON_ENVELOPE=1, or kill(2) returning EPERM (strace
inject); with this change it passes in all of them, plus an exported
XDG_CONFIG_HOME, an existing BD_MIGRATION_FREEZE_FILE and the agent
host's BD_*/BEADS_* set;
- it still fails when .beads/.env overrides the caller (gotenv.OverLoad)
or is not loaded;
- the store-less suite passes 54/54 subtests; a bd that prints the
legacy-guard error twice now fails 12 of them, and a bd that checks
the blocked variables again after the legacy guard now fails
blocked-backend-not-checked; both passed the suite before.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* fix(workspacegate): strict --readonly never creates workspace gate files
Strict --readonly is mutation-free by policy (effectiveRootStorePolicy),
but the command chokepoint took its SHARED workspace gates with
O_CREATE|O_RDWR. On a workspace no bd command had gated yet, a strict
readonly command therefore left <project>/.beads.gate.lock and the
physical-root gate file (.beads/embeddeddolt.gate.lock or
.beads/dolt.gate.lock) behind.
Add workspacegate.Options.ReadOnly. A Shared acquisition with it opens
the gate file O_RDONLY (the idiom ExclusiveHolder already uses) and never
creates it. A gate file that does not exist means nothing has ever been
gated there, so Acquire succeeds with an empty handle whose Release is a
no-op. An existing gate file is held SHARED as before, so maintenance
still sees the command and a live exclusive holder still makes it wait
and then refuses it. The option is ignored for Exclusive: maintenance has
to be able to create the file it locks.
ReadOnly composes with the fair, bounded waiting from #7225 without
changes to it: the writer-fairness probe (ExclusiveQueued) already opens
the intent file read-only and treats a missing one as nothing queued, so
a waiting ReadOnly acquisition creates no .intent or .info file either.
readonly_wait_test.go pins that seam.
The chokepoint passes ReadOnly: readonlyMode in the SHARED branch. Every
other command keeps creating the gate files, which is what makes it
visible to maintenance. Residual, documented at the chokepoint: on a
workspace that has never been gated, a strict readonly command is
invisible to a maintenance operation that starts while it runs.
Ported from the versioned-beads integration fork (donnabox):
0c86e2b205 (red tests), bac6ff95dc (fix), b7a4f96a5a (fair-wait tests),
2af5a664dc (BUILD.bazel registration), and the #7225 conflict resolution
in 9d128f8c51. The fork's `--readonly backup restore` refusal
(6ac79d6207) is a separate change and is not included.
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cli): release the previous command's workspace gate before acquiring
acquireCommandWorkspaceGates stored its new handle over whatever
workspaceGateHandle already held. cobra skips PersistentPostRunE when
RunE fails, so in a process that runs more than one command (tests,
embedders) a command could start with the previous command's handle
still set. Two things then went wrong:
- on the paths that take no new gate (no .beads on disk, a failed or
fail-open acquisition) the stale handle stayed set, so the previous
workspace stayed held for the whole command;
- on a successful acquisition the stale handle was overwritten without
being released, so its flock stayed held on the previous workspace
until the garbage collector closed the file, and a maintenance
operation there was turned away by a command that had finished.
Release any held handle first. In a single-command bd process the handle
is always nil at that point, so this is a no-op there.
Ported from the versioned-beads integration fork (donnabox): 3a25b42ed1
(cherry-pick of ad87442c92). The test
TestAcquireCommandWorkspaceGatesReleasesThePreviousCommandsHold is new
here and covers the successful-acquisition case the fork's tests do not.
Co-authored-by: Donna Box <dbox@boxenllc.com>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cli): close a stale store before the leading gate release
Review fixups for #7672, apply-fixes iteration 1.
The leading releaseWorkspaceGates() that the second commit added to the
chokepoint was the only production release without a
closeStoreBeforeGateRelease() first. When an in-process command's RunE
fails, Cobra skips PersistentPostRunE. The next command in the same
process then dropped that command's gates while its store and provider
were still open, and later overwrote and leaked them. Close them first,
as every other release path does. The current command assigns
store/uowProvider only after the chokepoint, so anything set there
belongs to the previous command. Only multi-command processes (tests,
embedders) are affected; production runs one command per process.
A strict --readonly hold on a never-gated workspace locks nothing. The
chokepoint still exported this PID in BEADS_GATE_SHARED_HOLDER_PID, so bd
children skipped the writer-fairness queue behind a parent that blocks
no exclusive acquirer. Add Handle.Empty and MultiHandle.Empty, and
advertise only when at least one gate is actually locked.
Tests:
- A regression test runs the chokepoint over a stub store and provider.
It pins that both close while the previous command's gate is still
held.
- A marker test forces advertiseSharedHoldEnabled on. It pins that a
hold of nothing is not advertised, and that the hold is advertised
once the gate files exist.
- The strict-readonly chokepoint subtests now require a handle that
holds nothing. SHARED fail-open leaves no handle, so these subtests
now fail the review's W2 mutant, which passed them before.
- A package test covers Empty.
The posture comment now says the gate follows the strict flag only.
Allowlisted reads and --dry-run/--inspect previews still create the gate
files.
Not changed: `bd --readonly backup restore` still creates gate files on
its exclusive acquisition. This PR covers shared gates only. Sibling #7673
refuses a strict-readonly restore before it takes the exclusive gate.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Donna Box <dbox@boxenllc.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* test(oracle-a): normalize the per-write revision token so main-vs-main is clean
Since #5535, `bd show --json` publishes `"revision"`, the decimal spelling
of the row's row_lock. Every create and status/ownership write remints that
token from crypto/rand (issueops.freshRowLock), so it differs between any
two runs of the same scenario. The harness did not normalize it, so Oracle A
failed against itself: on the curated tier, origin/main vs origin/main scored
31 pass / 13 fail in scope, and each failure was a `show --json` step that
differed only in `"revision"`.
normalize() now collapses a non-zero decimal `"revision"` string to `<REV>`.
It keeps everything else literal: the member name, its presence and its
string type, "0" (a row that was never stamped), number-typed values, other
`*_revision` members, and escaped text inside a JSON string. A new unit test
covers each of these cases.
Curated tier, REF_REF=origin/main, run against itself: before 31 pass /
13 fail in scope (0/1 out of scope); after 44 pass / 0 fail (1/0).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(oracle-a): normalize the per-run workspace path
Each scenario runs in a fresh tempfile::tempdir(), so any bd output that
echoes the workspace path differs on every run. When origin/main's bd was
captured twice with the deep tier (ORACLE_CATALOG=1, 546 scenarios), 40
catalog scenarios differed only in that path. All 40 start with their own
`init --prefix X --non-interactive` step, which runs in a workspace the
harness already initialized and fails with "Found existing Dolt database:
/tmp/.tmpXXXXXX/.beads/embeddeddolt/X".
run_scenario now hands normalize_in_workspace() the exact workspace path
and its symlink-resolved spelling, and that function replaces only those
strings with <WORKSPACE>, longest first. Other paths stay literal, so no
stable value is collapsed. All 40 scenarios are out of scope, so in-scope
counts do not change.
Deep tier, origin/main's bd against itself, scored by the scoreboard:
- base harness: 256 pass / 67 fail in scope, 154 / 69 out of scope.
- with both normalizers: 323 / 0 in scope, 219 / 4 out of scope.
The out-of-scope remainder changes from run to run and none of it is a
field value. It comes from randomized "Tip:" lines in human output and one
unordered `list --format dot`.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(oracle-a): document and pin the <REV> match scope and the workspace wiring (mc-ro9kg)
Review fixes for #7680, iteration 1.
revision_regex runs over the raw stdout/stderr text before any JSON
parse, so it collapses every "revision" member holding a non-zero
decimal string, at any depth and in plain text, not only the
bd show --json issue token. That includes a user metadata key named
revision, which the in-scope --set-metadata/--metadata flags can set,
so a change to its value passes the gate. The regex comment and a new
README "What green does NOT prove" bullet now say so, and
normalize_collapses_revision_by_member_name_at_any_depth pins the
scope: a nested metadata member and plain text are collapsed, while a
metadata key with any other name still gates. The old test name said
nothing else was collapsed; it is now
normalize_collapses_non_zero_revision_strings.
run_scenario_collapses_the_workspace_in_both_step_streams runs
run_scenario against a stub bd that prints its cwd on stdout and its
resolved path on stderr, and expects <WORKSPACE> in both. Before, the
two normalize_in_workspace calls in run_scenario could be reverted with
every unit test and the curated tier still green.
The remint wording in the comment and the README now names every
writer (create, update, close, reopen, claim and unclaim) instead of
only status/ownership writes.
Tests: cargo test --locked --offline (7 passed), clippy clean, no new
rustfmt hunks. Mutants, each in its own copy and target dir: reverting
either or both normalize_in_workspace calls fails the run_scenario
test; skipping a nested metadata member, or matching only after { or
",", fails the scope test.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* test(domain/db): pin the statements the history-off upsert Insert issues
The participation_generation write fence (#6943) gave domain/db Insert's
upsert path (CreateOnly unset: the quick, todo, gate and batch proxied
servers' create) an existence probe ahead of the upsert, skipped while
versioned history is off. Pin that skip with a sqlmock statement-sequence
test: with history off, the upsert into issues and into wisps issues
exactly the three statements the pre-stack code (4a67d0d028) issues --
the upsert, the created event's same-content scan and its insert -- and
nothing else.
The mock is reached through internal/storage/sqlcount, and the pin also
requires exactly three statements to reach the driver. sqlmock alone
answers an unscripted statement with an error and fails only if the
caller returns it, so a best-effort read whose error Insert dropped would
pass its checks; the count catches it. The history-on run of the same
script is the control: the probe (and the mint after it) must make the
pin refuse it, which shows the script is exhaustive and that Insert reads
the transaction's scope.
Passes on 4a67d0d028 and on main; main issues no extra read with history
off. Before-parity pin P2 (Insert half) from the fork gap analysis, for
gastownhall/beads#6132 / #6135.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(issueops): pin the statements the history-off defer-wake sweep issues
Port the fork's sqlmock pin of WakeExpiredDefersInTx with versioned
history off (donnabox/codex/preview3-source-catchup-46aa 11c74cb575):
a one-row sweep issues exactly the expired-row SELECT, the UPDATE, the
event's same-content SELECT and INSERT, and the empty wisps pass, so any
read added before or after waking a row while history is off fails the
pin. It passes on main unchanged and guards the fork's wake-skip change,
which checks each expired row against the mint before waking it and must
keep that check free with history off.
Adapted for main: the doc no longer describes the fork's pre-wake check
as existing; a history-on run of the same script is added as the control
(the mint's read must make the pin refuse it), so the pin cannot pass
vacuously; and the mock is reached through internal/storage/sqlcount, so
the pin also requires exactly five statements to reach the driver. That
catches a read whose error the sweep swallowed, which sqlmock alone does
not see. Passes on 4a67d0d028 and on main. Before-parity pin P2 (wake
half), for gastownhall/beads#6132 / #6135.
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): versioned-history flag-off differential against pre-stack goldens
gastownhall/beads#6132 and #6135 require a differential test proving that
with versioned history off (the default) storage behaves byte-identically
to before the feature. Existing coverage stops short of that:
TestDualWriteContractFlagOff only counts version rows, the
participation-generation contracts check one column, and createbatchequiv
runs its batch with history on over a column subset.
Add internal/storage/historyoffequiv. Each leg (embedded Dolt, Dolt
server, unit of work) runs one scripted mutation set through its own
front doors on a store whose history was never turned on:
- on the issues plane, every write role: creates, batch create, apply
batch, updates, the no-op update, reparent, dependency add/remove,
comments, claim/heartbeat/release, lease reclaim, metadata CAS,
close/reopen, batch close with a refused item, defer and wake, delete;
- the persistence moves in both directions;
- on the wisps plane, the roles again: create, update and the no-op
update, dependency add/remove, comment, metadata CAS, close/reopen,
apply batch, batch close, release, defer and wake (the sweep's wisps
pass), delete, a forced close of a no-history wisp, and the refusals
the lease roles' contracts give a wisp (Claim, Heartbeat; Reclaim finds
nothing);
- each leg's own surface: the store legs' DoltStorage methods (import
upsert, promotion, RunInTransaction, ...) and the uow leg's
CreateOnly-unset domain upsert and importer.
Neither reclaim sweep finds an expired lease, since no role can age one.
The harness then dumps every column of every base table, plus the
scenario's Dolt commit messages and the final dolt_status, and compares
per-table SHA-256 digests with goldens recorded by running the same
harness against origin/main 4a67d0d028, the commit before the stack
(#6943, #6661, #6664).
The only tolerated differences are listed in schemaAdditions: the stack's
new columns (issues/wisps.participation_generation,
issue_versions.removed_restriction) must be NULL in every row and are
then left out of the digest; its new table (epoch_minted_addresses) must
be empty; its own migration bookkeeping rows (0070-0072, ignored/0028)
may each be there once. Recording and checking apply that rule the same
way, so a golden re-recorded from main is byte-identical to the
pre-stack one (verified on all three legs). The package doc says how the
goldens are kept: a later migration whose schema flag-off leaves
untouched adds its own schemaAdditions entry; a deliberate flag-off
change, a scenario change or an engine rendering change re-records them
and shows the dump diff. Wall-clock instants, wall-clock-derived ids and
random tokens are masked by explicit, documented rules found by diffing
two runs; instants the scenario supplies stay verbatim, so a write that
starts overwriting one still shows.
All three legs pass on main. Before-parity pin P1 from the fork gap
analysis; the new embedded test is placed in the 40-shard storage block.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jim Wordelman <jim@wordelman.name>
* test(cli): pin --format json == --json on show, list, ready and memories
Before-parity pin P7 (gap analysis 2026-10-17, section 5a). The hidden
root --format flag is an alias for --json (GH#2612). It is a root
persistent flag, so a subcommand that registers a --format of its own
shadows it (the GH#6278 hazard): `bd list` already does and passes `json`
through by hand, and a graph-preview fork that added a local --format to
`bd show` made `bd show ID --format json` exit nonzero.
TestEmbeddedFormatJSONAliasMatchesJSON runs show, list, ready and memories
with --json and then with `--format json`, `--format=json` and a leading
`bd --format json <verb>`, and requires exit 0 and byte-identical stdout.
It adds bdRunStreams, a small helper returning stdout, stderr and the exit
status separately, which the following pins reuse.
The new TestEmbedded* function is listed in the bd_test srcs and placed in
the 100-shard embedded cmd manifest by
gen_embedded_cmd_shard_manifest.py --write (incremental).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cli): pin the ordinary --if-revision compare-and-swap contract
Before-parity pin P8 (gap analysis 2026-10-17, section 5a). --if-revision
is the decimal int64 compare-and-swap merged in #7203, and gascity's
bdstore_conditional.go classifier reads both its exit status and its
machine body. A second, opaque-token meaning for the same flag in another
kind of workspace must leave the ordinary one unchanged.
TestEmbeddedIfRevisionOrdinaryCAS pins, through the real binary:
- a stale decimal token on update, close, assign and delete (preview
and --force) exits 13, prints nothing on stdout, writes nothing, and
ends stderr with a precondition_failed body naming the id and the
expected and current revisions as exact JSON integers;
- a non-decimal token exits 1 with the "invalid --if-revision" refusal
in text and --json modes, never 13, and writes nothing;
- the current token applies on update, close, assign and delete.
It is the ordinary-workspace half of
TestGraphPreviewIfRevisionOutsideLinkModeIsUpstreamCAS from the
donnabox/codex/preview3-source-catchup-46aa branch (added in 3d16d826be,
revised in 1640940fa9, 3ff2fe73ce, 55dbb61156, 653369305a and
97446d1f08), ported onto this package's embedded helpers. The port drops
the graph-only forget refusal, extends the stale and non-decimal cases
from update/delete to close and assign, and compares revisions as
json.Number rather than float64, since they are int64 values past 2^53.
It is named TestEmbedded* so the bazel-embedded lane, which discovers
`^func TestEmbedded` in *_embedded_test.go, runs it; the existing
TestIfRevisionMatchAndMismatch is not discovered there. The file is
listed in the bd_test srcs and placed in the 100-shard embedded cmd
manifest by gen_embedded_cmd_shard_manifest.py --write (incremental).
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Donna Box <dbox@boxenllc.com>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cli): pin version, config set, history and show --as-of shapes
Before-parity pin P10 (gap analysis 2026-10-17, section 5a): the
store-less and history-adjacent commands a later versioned-history or
graph slice could change by accident.
- TestEmbeddedVersionOutputShape: `bd version` with no arguments exits
0 and prints one "bd version <version> (<build>...)" line, in a
workspace and outside one; --json is one object with version, build
and schema_version (plus commit and branch when known) agreeing with
the text line, and --format json prints the same document; an
argument exits 1 and points at `bd versions <arg>` (#6661), on stderr
or as the --json error, through the real binary rather than RunE.
- TestEmbeddedConfigSetOtherKeysSkipTheVersionedHistoryScan: in a store
holding a row the pre-enable scan refuses over, `bd config set` and
`bd config set-many` of another key with the value "true" exit 0,
store it, print no refusal and leave the switch off; the switch
itself is still refused afterwards, as a control.
- TestEmbeddedHistoryAndShowAsOfReadDoltCommits: with versioned history
recording, `bd history <id> --json` is still the Dolt-commit history
(an array of CommitHash/Committer/CommitDate/Issue entries with full
32-character Dolt hashes, no recorded-version fields, and the same
hashes in the text output), and `bd show <id> --as-of <hash>` with a
hash from it is the Dolt AS OF read in show's JSON shape, not the
R7.1 as-of read over issue_versions; `--as-of main` reads the branch
head.
The three TestEmbedded* functions are placed in the 100-shard embedded
cmd manifest by gen_embedded_cmd_shard_manifest.py --write (incremental).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Donna Box <dbox@boxenllc.com>
* test(httpapi): pin the startup event's capabilities and database source
TestStartupLines and TestStartupNamesTheDatabaseSource check the
event=startup line by substring, and neither reads its capabilities
field. A server could print one capability list and advertise another
on GET /v0/beads/context, or a new kind of database source could
relabel the line, and both tests would stay green.
TestStartupEventPublishesTheAdvertisedCapabilitiesAndSource parses the
line back into its fields and pins, for the provider and roles sources
with and without the external-dependency policy: the exact field
sequence, db=provider|roles, and a capabilities value equal to the
handshake's list joined with commas. It is a before-parity pin: a
future alternative source on the same server must leave this line
unchanged for the Issue API's two sources.
Test-only; no behavior change.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(serve): pin ordinary-workspace bd serve under BD_GRAPH_MODE=dependency
bd reads no BD_GRAPH_MODE today. "dependency" names the format every
existing workspace already has, so any later reader of that variable
(a graph-mode serve dispatch, for example) has to keep serving an
ordinary workspace through runServe exactly as it does now. These
tests pin that before such a reader exists.
Each test runs bd serve twice in one workspace, once with the variable
unset and once with BD_GRAPH_MODE=dependency. It requires the
event=startup and event=limits lines to match byte for byte apart
from the ephemeral port, and the GET /v0/beads/context bodies to be
equal. Each run is also checked against what runServe builds: the
serveResolvedMode label, the db source, and a startup capabilities
field equal to the handshake's list. Two runs that were both routed
somewhere else therefore cannot pass by agreeing with each other.
- TestServeOrdinaryWorkspaceIgnoresGraphModeDependency: in-process
through rootCmd (PersistentPreRunE included), on the store source of
a registered-backend workspace. Runs in bd_test.
- TestServerModeServeIgnoresGraphModeDependency: a real bd on a
`bd init --server` workspace, which uses the provider source. Gated
on BEADS_TEST_PROXIED_SERVER like the other TestServerMode* tests,
and placed in the proxied 34-shard manifest by
gen_proxied_shard_manifest.py --write (incremental).
The new file is listed in cmd/bd/BUILD.bazel's bd_test srcs.
Test-only; no behavior change.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(serve): stop the in-process graph-mode pin hanging when serve fails
serveInProcessSnapshot's cleanup decided whether the server was still
running by looking at rootCancel. That holds for a clean run, which
clears rootCancel in PersistentPostRunE. A run whose RunE returns an
error skips PersistentPostRunE, so rootCancel stays set even though the
main flow has already read the run's only result from done. The
cleanup then called rootCancel and blocked on done for good, and the
failure surfaced as a test-binary timeout panic that takes the whole
bd_test shard with it instead of a FAIL for this test.
The cleanup now keys on whether done has been read. A serve that binds,
answers, and then returns an error (one way a future graph-serve
dispatch could regress) now fails in about 5s with "bd serve returned
<err>, want a clean shutdown". A failure before done is read (a bad
GET, say) still cancels the server and waits for it.
Test-only; no behavior change.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(init): admit a retried `bd init --server` over an empty .beads/dolt
A first `bd init --server` that cannot reach its server fails after
creating the local Dolt root, leaving an empty .beads/dolt, no
.local_version witness, and no config.yaml/metadata.json recording the
server choice. The legacy-upgrade guard runs before init writes that
choice, so it saw an embedded-looking workspace with a local Dolt root
and refused every retry as a "legacy Dolt workspace"; no bd command could
repair it.
guardLegacyUpgradeWorkspaceForInit(beadsDir, initSelectsServer) carries
init's already-resolved server intent into the guard. It is consulted
for exactly one decision: an empty, witness-less .beads/dolt is admitted,
the same admission a workspace that records server mode already gets
(#6935). It is deliberately not folded into the workspace's own server
mode, so a non-empty root with an unreadable witness and an embedded
repository beside a non-empty root keep their current outcomes.
guardLegacyUpgradeWorkspace is now the initSelectsServer=false wrapper,
and only init's main guard call passes the flag; the proxied-server
init path keeps the plain wrapper.
Ported from the versioned-beads fork (donnabox/codex/preview3-source-
catchup-46aa), commits bc8d72182a (red) and 5bdfbfe5e2 (green). The
fork's graph_mode refusal in the same function is graph-preview-only
and is not carried here.
Tests: TestLegacyUpgradeGuardForInitAdmitsEmptyDoltRoot and
TestLegacyUpgradeGuardForInitAdmissionStaysNarrow pin the admission and
its narrowness at the guard; TestInitServerFlagAdmitsEmptyDoltRootWithoutConfig
and TestInitServerFlagRetryAfterFailedFirstAttempt run the real binary
against the test Dolt server and fail on main with the legacy refusal.
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(init): `bd init --server --external` must not auto-start a server
`--external` declares the Dolt server managed outside bd ("skip server
startup", per its help), but init builds its dolt.Config by hand with
`AutoStart: initServerMode && BEADS_DOLT_AUTO_START != "0"`, so the flag
never reached the auto-start decision. A `bd init --server --external`
that named no port therefore ran dolt and tried to start a repo-local
sql-server. A named port was already declared external by rule 2c
(#5934), but its failure still advised `bd dolt start`, the one thing
--external says bd must not do, and each route (host:port, socket,
shared server, auto-start pinned off) worded the failure differently.
- AutoStart is now `initServerMode && !externalServer && ...`.
- externalServerUnreachableMessage rewrites only a failed dial
(*net.OpError with Op "dial") under --external: it names the endpoint
that was dialed and says bd did not start a server. A dial to port 0
means no port was named, so that message asks for --server-port or
BEADS_DOLT_SERVER_PORT and offers no default (GH#2098, GH#2372). Any
other open failure keeps its own text.
Ported from the versioned-beads fork (donnabox/codex/preview3-source-
catchup-46aa), commits 234ca3d502 and a601a80e77 (red/green), 03a64a1aba
(socket helper rename), and a6ca0536c9 and 397fc4c69e (red/green: no-port
arm and wording). The fork's graph-preview dispatch at the top of init
and its --skip-hooks help text change are graph-only and not carried.
The TestInitExternalProvisionerShape doc comment is corrected: on main
every provisioner cell is a control (a named port is already external),
not a reproduction.
Tests: TestInitServerExternalDeadPortStartsNoServer,
TestInitServerExternalNoPortStartsNoServer and
TestInitExternalUnreachableMessage run the real binary against a dolt
shim that records every launch and fail on main;
TestInitSharedServerExternalDeadPortStillFails,
TestInitServerWithoutNamedPortStillStartsServer and
TestInitExternalProvisionerShape are controls; and
TestExternalServerUnreachableMessage pins which errors are rewritten.
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(conformance): un-skip R16 CAS + R20 epoch tests with honest not-implemented stubs
Wires all 10 ExpectedRevisionFixture-gated Run* functions and both
EpochFixture-gated Run* functions to real (non-nil) hooks on all three
storage legs (dolt, embeddeddolt, uow), replacing the Phase 0 all-nil
fixtures that made these cases t.Skip.
Every wired hook is an unconditional "not implemented yet" stub rather
than a partial-real implementation. This is deliberate: every Run*
function under test calls its primary hook (CompareAndSetVersion, or
CurrentEpoch/MintUnderEpoch) first, before any other hook, so a stub
that errors unconditionally on that first call guarantees deterministic
RED with zero risk of an accidental pass -- a concern that's concrete,
not hypothetical, since at least one case
(RunExpectedRevisionAcceptsAWriteNamingNoVersion) would go green under
a partially-real read/unconditional-write strategy backed by Phase 1's
already-persisted current_revision/store_epoch columns.
Each case now fails for its documented reason: most via a direct
t.Fatalf quoting the stub's "not implemented" error, and two
(RefusalIsDistinguishableFromNotFound,
RefusalIsDistinguishableFromValidationFailure) via a clean want/got
mismatch against the sentinel errors they expect.
Explicitly out of scope and untouched: CrossRecordInvariantFixture
(R16.1) and the non-epoch RetentionFixture cases (R17) -- confirmed via
test run that TestRetentionContract still reports PASS with all 13
subtests SKIP on every leg.
TestEveryLegWiresEveryRoleContract (internal/storage/leg_contract_wiring_test.go)
is a source-level AST naming check independent of hook nil-ness; all 12
entrypoints were already called by every leg pre-change, so this lock
was satisfied before and remains satisfied after.
Sentinel error messages reference be-x5jqd.3 (R16 CAS implementation)
and be-x5jqd.4 (R20 epoch enforcement implementation), the two builder
children this un-skip unblocks.
Verified via go build ./..., go vet ./..., and go test -tags cgo across
all three legs: all 10 R16 + 2 R20 subtests FAIL for the documented
reason, TestRetentionContract unaffected.
Bead: be-x5jqd.1
* feat: green — Implement R20 epoch-transition enforcement (refs be-x5jqd.4)
* fix(epoch): honor R20-n's retained-mapping exception in StillServes/Resolve
StillServesInTx and ResolveEpochInTx only ever checked whether the
literal queried address's own row matched the current epoch. Per R20-n
(#5898 rev 9), a version that survives an epoch transition keeps its
prior-epoch address resolving once its id has been carried forward into
the current epoch (via CurrentAddressForInTx or a fresh
MintUnderEpochInTx) — that carried-forward row wasn't being consulted,
so a legitimately retained address would wrongly stop resolving.
Add mintedIDHasAddressAtEpochInTx and consult it as a fallback in both
functions when the queried address's own row is stale. Addresses whose
id was never carried forward are unaffected (row.mintedID has no row
at the current epoch, same false/GoneReorganization answer as before).
Round-2 response to be-rskwc's causal_disproof finding: the merge-base
commit FAILed honestly on this defect, this branch's tdd_green SKIPped
instead (attribution_evidence). This fix is real and verified via a new
sqlmock unit test (TestStillServesInTxHonorsARetainedMapping et al.),
but does not by itself flip
TestEpochContract/EpochBumpVoidsOnlyAddressesOfVersionsNoLongerServed
from SKIP to PASS: that test's own construction mints two records
identically and never carries either forward before comparing
StillServes on both, so no backend implementation can make them differ
(escalation follows on a needs-mayor bead).
refs be-x5jqd.4, be-rskwc round 2
* test(feat): red — harden EpochBumpVoidsOnlyAddressesOfVersionsNoLongerServed (refs be-9fiaw)
Per mayor ruling on be-9fiaw: fix the test rather than waive it. The
fixture already lets record-a survive an epoch bump by minting it again
under the new epoch; record-b, never re-minted, does not survive. That
asymmetry was previously only discovered after the fact (skip if
StillServes agreed for both addresses), which meant the case could pass
by observing either polarity. Assert the concrete expected values
instead: servesA must be true, servesB must be false. This makes the
case deterministically exercise both halves of R20-n, and closes a
latent gap where a backend with the polarity reversed could have
silently passed via the old discover-then-swap logic.
* fix(schema): renumber epoch_minted_addresses to 0070, linearizing our own slot collision (refs be-hs42e.7)
R20's epoch_minted_addresses and R7.1's removed_restriction both claimed
migration slot 0069 on parallel sibling branches. Neither contained the
other, so nothing in either branch's own CI could see the union: each was
green alone, and the second to merge would panic checkNoDuplicateVersions at
store open -- before any command's RunE, so every bd invocation bricks rather
than one package reddening. Same hazard bee reproduced for #6358 vs #6008.
This linearizes them instead of leaving it to merge order. R7.1 keeps 0069:
it is published beneath #6661 and cannot move without rewriting a branch a
reviewer is reading. R20 stops being a sibling, rebases onto R7.1, and takes
the next contiguous slot.
Contiguity is why the renumber could not be done pre-emptively in either
branch alone: TestAllMigrationsSQLAppliesThroughDoltCLIAndRecordsLatestVersion
asserts COUNT(*) == LatestVersion(), so a jump to a far slot fails until the
gap is filled. The order had to be settled first.
- migrations/0069_add_epoch_minted_addresses.{up,down}.sql -> 0070_*
- migration_0069_add_epoch_minted_addresses_test.go -> migration_0070_*, with
TestLatestVersionIncludesMigration0069 -> ...0070 (want 70)
- 0069_add_removed_restriction_test.go retires its own LatestVersion pin in
favour of 0070's, keeping the one-pin-at-a-time chain 0068 -> 0069 -> 0070
cli_migrations.go needs no change: its only override is R7.1's guarded
PREPARE, which keeps 0069. The epoch migration is a plain unguarded
CREATE TABLE IF NOT EXISTS and needs none.
Verified: TestEmbeddedMigrationSourcesHaveNoDuplicateVersions,
TestLatestVersionIncludesMigration0070,
TestAllMigrationsSQLAppliesThroughDoltCLIAndRecordsLatestVersion (applies the
full 0001..0070 chain through the dolt CLI),
TestBundleMigrationsWithPreparedALTERAreOverriddenOrJustified and
TestAllMigrationsSQLUsesDirectDDLForKnownCLIIncompatibilities all pass.
go build ./... and go vet ./... clean.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(feat): red — Fix PR #6664: restore R16 honest-skip (stale be-x5jqd.3 premise) + address bee's 2 blockers on epoch_cas.go (refs be-ah0jf)
* feat: green — Fix PR #6664: restore R16 honest-skip (stale be-x5jqd.3 premise) + address bee's 2 blockers on epoch_cas.go (refs be-ah0jf)
* test(feat): red — Review: Fix PR #6664: restore R16 honest-skip (stale be-x5jqd.3 premise) + address bee's 2 blockers on epoch_cas.go (refs be-yj55d)
* feat: green — Review: Fix PR #6664: restore R16 honest-skip (stale be-x5jqd.3 premise) + address bee's 2 blockers on epoch_cas.go (refs be-yj55d)
* docs(epoch): cite epoch_minted_addresses as migration 0071
Upstream's 0069_widen_issue_versions_datetime_precision (#6675) took slot
0069 first, so removed_restriction moved to 0070 and epoch_minted_addresses
to 0071. The three epoch_cas.go headers still named 0070.
Rebase note (maintainer): the migration is now 0072, per the landing-order
ruling (#6943's participation_generation is 0070 and #6661's
removed_restriction is 0071); the commit "chore(schema): renumber
epoch_minted_addresses to 0072 after #6661's 0071" updates these three
headers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(feat): red — move #6664's Dolt server leg to post-transaction publish for store_epoch and epoch_minted_addresses (latent lost-update pattern)
Tests only. On the commit before this one they fail for these reasons:
- the server leg publishes store_epoch / epoch_minted_addresses inside the open
SQL transaction (DOLT_ADD before COMMIT) for BumpEpoch, MintUnderEpoch and
CurrentAddressFor: the lost-update hazard documented on doltAddAndCommitInTx
- MintUnderEpoch and CurrentAddressFor stage only epoch_minted_addresses, so the
first mint leaves store_epoch modified in the working set, on both legs
(#6664 Major 2, reproduced with Status() on a real server and embedded)
- BumpEpoch must surface a Dolt commit that fails after its SQL commit, while
the mint paths keep their rows
- ensureStoreEpochRow seeds with INSERT IGNORE and reads the row back
TestMintOverlappingABumpCommitsAnAddressThatIsAlreadyGone characterizes current
behaviour and passes now: a mint overlapping a bump commits an address the bump
already voided. Its doc comment records why that is left as it is.
* feat: green — move #6664's Dolt server leg to post-transaction publish for store_epoch and epoch_minted_addresses (latent lost-update pattern)
Server leg (internal/storage/dolt/epoch_cas.go): BumpEpoch, MintUnderEpoch and
CurrentAddressFor no longer stage and Dolt-commit inside the open SQL
transaction. The two mint paths publish through runIssueOperationTxWithMessage,
which commits the SQL transaction first. BumpEpoch commits it, then publishes
with doltAddAndCommitPostTx and RETURNS a failed Dolt commit: a bump that is
committed but unpublished must not read as success.
Both legs: a mint stages store_epoch with epoch_minted_addresses, because the
first mint inserts the singleton row (#6664 Major 2). The set lives in
issueops.EpochMintDirtyTables so the legs cannot drift from what the body writes.
issueops: ensureStoreEpochRow seeds with INSERT IGNORE and reads the row back,
as version_history.go does for the same row.
Not changed, on purpose: a mint overlapping a concurrent bump can still commit an
address the bump already voided. Dolt has no lock for it and the only conflicting
write would overwrite bumped_at/bumped_reason; see the doc comment on
TestMintOverlappingABumpCommitsAnAddressThatIsAlreadyGone. One comment in that
test file is reworded; no test logic changed since the red commit.
* chore(bazel): bazel-sync (gazelle) for the two new epoch test files
Only the two go_test srcs entries for the test files this branch adds:
epoch_cas_publish_test.go (dolt) and epoch_cas_status_test.go (embeddeddolt).
gazelle wanted nothing else for them (no deps change).
* test(conformance): add the optional EpochFixture.LoseVersion capability
Record survival explicitly instead of inferring it (gastownhall/beads#6664,
review 5360880888, Major 1). Once an address stays served unless its own row
says the store lost it, the only way for the contract to produce a Gone
address is an explicit loss, so the contract needs a way to say "the store
lost this Version".
LoseVersion is additive and optional: no existing field changes signature,
and a nil LoseVersion makes the cases that need one skip with a named reason.
It is its own commit so that it can be judged, or replaced, on its own: the
same semantics could ride on BumpEpoch taking a lost set, and only the
plumbing would differ. Nothing uses it yet.
* chore(epoch): add signature-only stubs for the survival rework
The tests that follow exercise BumpEpochCarryingInTx, LoseVersionInTx,
ErrEpochAddressNotServed and the BumpEpochCarrying and LoseVersion store
methods (gastownhall/beads#6664, review 5360880888). Stubs give those names
so the tree builds and the tests fail for their real, behavioural reasons
instead of failing to compile.
No logic: ErrEpochAddressNotServed is a sentinel, BumpEpochCarrying advances
the counter exactly as BumpEpoch does and carries nothing, and LoseVersion
returns "not implemented". The next commit adds the tests; the one after
replaces these bodies.
* test(feat): red — record survival explicitly in epoch_minted_addresses, make CurrentAddressFor read-only, carry on a token-scheme change
Tests for the survival rework of gastownhall/beads#6664 (review 5360880888:
Major 1, Minors 3 and 4). Every test is written before any production change.
- Contract: the earlier mint-driven R20-n case is restated as three named
phases (a survivor and a lost Version, loss is terminal, survival needs no
upkeep), plus three new cases for a token-scheme change (carry the live
lineages and only those, a carried address keeps resolving across later
bumps, a lost address stays Gone across a scheme change). All three legs
register them and wire LoseVersion and the carrying bump.
- Shared body: unit tests for the row-based resolver (exactly the address's
row and the epoch, fail closed on a row from a future epoch), a read-only
CurrentAddressFor with typed errors, LoseVersion, a bump that writes only
store_epoch, a mint that never hands back a lost address, and the
per-database counter (Minor 3). Minor 4 gets a guard that no address in the
test file is written by hand.
- Real engine: the carry on the embedded leg (one carry row per live id, the
lineage root, the collision rule, a row from a future epoch, a rewound
counter, database-wide, lost lineages), the publication sets of every
writer, and on the server leg the overlap of a mint with a bump (now a Live
survivor) and a deterministic mint-after-loss interleaving that must not
revive the lost address.
- Migration 0071 byte pin and a real-dolt shape check for carried_from,
gone_at_epoch, the carried_from index and the gone-not-before-mint CHECK.
These fail on the current code, and some do not build yet because
BumpEpochCarryingInTx, LoseVersionInTx, ErrEpochAddressNotServed and the store
methods they exercise do not exist.
* feat: green — record survival explicitly in epoch_minted_addresses, make CurrentAddressFor read-only, carry on a token-scheme change
The survival rework of gastownhall/beads#6664 (review 5360880888: Major 1,
Minors 3 and 4). An address's status is now a function of its own row and the
current epoch, never inferred from other rows.
- Migration 0071 (edited in place; no new slot, no ALTER): the table gains
carried_from, gone_at_epoch, an index on carried_from and a CHECK that a loss
epoch is not before the mint epoch.
- Shared body: Live unless gone_at_epoch is set, and a row from an epoch that
has not happened yet fails closed; the chain query is deleted. CurrentAddressFor
only reads and returns typed errors. LoseVersion marks a whole lineage lost,
once, guarded by gone_at_epoch IS NULL. BumpEpochCarrying (token-scheme change)
writes one carry row per live lineage naming the lineage root, resolves a
shared-id collision by carrying the newest and losing the rest, and fails if a
row already sits at the new epoch. A mint only inserts its own root row and
never hands back an address that is not served. A restore or reinit bump
still writes only store_epoch.
- Both Dolt legs: BumpEpochCarrying publishes store_epoch and
epoch_minted_addresses, LoseVersion publishes epoch_minted_addresses and
returns a failed publication, and CurrentAddressFor runs on the read path and
publishes nothing. The per-database epoch counter (Minor 3) and the
requirement that a caller of the carrying bump hold the workspace gate
exclusively are documented where they apply.
One change to tests written in the previous commit: the three real-server
publication probes that only need a clean working set now open a database of
their own, as the overlap tests do, instead of queueing on the shared test
database's schema-init lock. Its five-second acquire timeout ran out under load
and failed two of them; no assertion changed.
* test(dolt): run the epoch contract on a database of its own
TestEpochContract set up through setupTestStore, which puts every parallel
test on the shared test database and queues their schema initialization on one
lock with a five-second acquire timeout. Under host load a setup that waits
behind another parallel test's runs out of it and fails at its first line with
"schema migration lock unavailable: timeout". That failed the unchanged
first-mint test twice in the dolt lane once this change had added tests to it,
and the contract's own setup is exposed to the same timeout.
The contract now opens a database of its own, the way the overlap tests and the
publication probes already do, so this change adds no contention on the shared
database's lock. No assertion changed.
* docs: replace internal tracker ids in the epoch comments and test names with plain descriptions
Comment and text edits only; no behavior changes and no line is added or
removed (21 lines are replaced one for one). Each replaced line named an
internal tracker id in a header, a test comment, a failure message or the
migration header; it now says what it meant in plain words or cites the
upstream issue or pull request. The EpochFixture API lines and the already
published commit messages are left as they were.
* ci: list this PR's embedded storage tests in the embedded shard manifest
#7156 made the embedded-Dolt tier's shard manifests exact-once (50 cmd
shards, 15 storage shards), so every embedded test must be listed. This PR
adds eleven embedded storage tests and no embedded cmd tests; this commit is
exactly what the generators write for them:
python3 scripts/ci/gen_embedded_cmd_shard_manifest.py 50 --weights=duration --write
python3 scripts/ci/gen_embedded_storage_shard_manifest.py 15 --weights=duration --write
Incremental: 11 lines added, none moved; the cmd manifest is unchanged.
Rebase note (maintainer): regenerated on current main, whose embedded storage
manifest uses a 40-shard block; the generator's incremental output placed
these tests at shards 7, 9, 11, 20, 21, 28, 31, 32, 33, 34 and 36 of 40, one
test per shard (gen_embedded_storage_shard_manifest.py 40 --weights=duration
--write; --check passes).
* chore(bazel): bazel-sync for the epoch sources and migration 0071
The BUILD files did not list epoch_cas.go in the dolt, embeddeddolt and
issueops libraries, issueops' epoch_cas_test.go, or migration 0071 and its
test, so Bazel could not compile those packages' tests. This is exactly the
patch make bazel-sync writes (gazelle plus go_srcs.py; the PR's BUILD-sync
CI step printed it): 4 files, 6 lines, nothing else.
Rebase note (maintainer): the migration is now 0072, per the landing-order
ruling (#6943's participation_generation is 0070 and #6661's
removed_restriction is 0071); the commit "chore(schema): renumber
epoch_minted_addresses to 0072 after #6661's 0071" renames these BUILD
entries. On the rebased base, this commit's internal/storage/schema/BUILD.bazel
hunk is merged with the base's 0070 and 0071 entries.
* chore(schema): renumber epoch_minted_addresses to 0072 after #6661's 0071
Migrations are numbered by landing order. #6943 (participation_generation,
the versioned-history write fence) owns main-plane 0070 and #6661
(removed_restriction) owns 0071, so this PR's epoch_minted_addresses
migration moves to the next free slot, 0072. The rename is done here, as one
maintainer commit, rather than inside the replayed commits, so the history
shows exactly what changed relative to the PR as reviewed.
- migrations/0071_add_epoch_minted_addresses.{up,down}.sql become 0072_*.
Neither header names its own number, so the SQL and its comments are
unchanged. Neither file exists on main, #6943 or #6661, so this is not an
edit to a shipped migration.
- cli_migrations.go needs nothing: the migration is a plain CREATE TABLE IF
NOT EXISTS with no CLI-bundle override.
- migration_0071_add_epoch_minted_addresses_test.go becomes
migration_0072_add_epoch_minted_addresses_test.go; its consts, tests and
messages say 0072, it owns the one LatestVersion pin (72), and its slot
history now records the move past #6943's 0070.
TestLatestVersionIncludesMigration0071 in #6661's removed_restriction test
was already retired to a pointer comment by the rebase's resolution of
"renumber epoch_minted_addresses to 0070"; that comment now names
TestLatestVersionIncludesMigration0072 and its file.
- BUILD.bazel embedsrcs/srcs, and the three epoch_cas.go headers (dolt,
embeddeddolt, issueops) that cite the migration number.
The intermediate commits of the rebase are not expected to build, for two
reasons:
- a duplicate migration version: the PR's epoch_minted_addresses migration
shares 0069 with main's 0069_widen_issue_versions_datetime_precision until
the PR's own "renumber epoch_minted_addresses to 0070", and from there
shares 0071 with #6661's removed_restriction until this commit;
- a helper-name collision: from the PR's "feat: green — Fix PR #6664: restore
R16 honest-skip ... (refs be-ah0jf)" on, internal/storage/issueops declares
readStoreEpochInTx twice, once in #6943's version_history.go and once in
this PR's epoch_cas.go, until "fix(epoch): rename #6664's read-only
store_epoch read past #6943's readStoreEpochInTx" later in this stack.
This commit ends the duplicate version, but it still does not compile on its
own because of the collision; the stack builds from the rename commit on.
Checked at the tip of the stack, where the rename has landed: go test
./internal/storage/schema/... with the dolt CLI lane
(including TestAllMigrationsSQLAppliesThroughDoltCLIAndRecordsLatestVersion
and TestMigration0072RecordsSurvivalInTheAddressTableThroughDoltCLI), and
scripts/check-migration-hygiene.sh with BASE_SHA=origin/main and
BASE_SHA=vh/6661-rebase.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(epoch): waive #6664's three new epoch contracts on main's http leg
main gained an HTTP storage leg (#7247) after this PR's base, and
TestEveryLegWiresEveryRoleContract requires every leg to name or waive every
role contract. This PR adds three EpochFixture cases
(RunTokenSchemeChangeCarriesLiveAddressesAndOnlyThose,
RunACarriedAddressKeepsResolvingAcrossLaterBumps and
RunALostAddressStaysGoneAcrossASchemeChange); dolt, embeddeddolt and uow wire
them, and the http leg did not name them.
They are waived on the http leg with the existing
retentionEpochNoRoleWaiverReason, which already covers every other
RetentionFixture/EpochFixture case there: EpochFixture is raw storage hooks
(CurrentEpoch, BumpEpoch, MintUnderEpoch, StillServes, Resolve,
CurrentAddressFor, LoseVersion) with no publicops role behind them,
and internal/httpclient is a remote client with no epoch counter or address
table of its own. The constant's doc comment now counts eighteen cases.
Test-only; no production code changes. After this, the http leg's only
unnamed entrypoints are #6943's seven RunParticipationGeneration* contracts,
whose waivers belong to #6943.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(epoch): rename #6664's read-only store_epoch read past #6943's readStoreEpochInTx
#6943's "a create stamps participation even when the row is flagged
no-history" (7c00d65fa6) adds readStoreEpochInTx to version_history.go: the
mint's read of store_epoch, which SEEDS the singleton row when it is absent.
This PR's epoch_cas.go already declared a readStoreEpochInTx of its own, so
the package stopped compiling once #6664 was stacked on that commit.
The two cannot be folded into one. This PR's helper is deliberately
read-only: an absent row answers epoch 1 without writing, so
CurrentEpochInTx, StillServesInTx, ResolveEpochInTx, CurrentAddressForInTx and
LoseVersionInTx never write from a read (review item B4, pinned by
TestCurrentAddressForNeverReseedsAnAbsentStoreEpochRow and
TestCurrentAddressForWritesAndPublishesNothing). Calling #6943's seeding read
from those paths would break that.
So #6664's helper becomes readStoreEpochWithoutSeedingInTx, and its doc
comment says why it is not readStoreEpochInTx. The five call sites and the
ensureStoreEpochRow comment that names it follow. No behavior changes on
either side: #6943's mint path keeps its seeding read, and this PR's read-only
paths keep theirs. (ensureStoreEpochRow, which BumpEpochInTx and
MintUnderEpochInTx use, now has the same body as #6943's readStoreEpochInTx;
it is left as it is rather than folded in here.)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): say exactly why the retention and epoch contracts stay waived on http
All but four of the participation-generation contracts (#6943's write
fence) now run over the served wire
(internal/httpclient/served_participation_generation_test.go): their subject
is a create or an update, which the client can send, and the fixture reads
the reference store's raw columns. The four stay waived, because the
mutation each needs has no form on the wire. This checked whether the
eighteen RetentionFixture/EpochFixture cases waived on the http leg,
including the three this PR adds, can be wired the same way. They cannot,
cheaply or otherwise, without a new wire operation:
- every EpochFixture hook (CurrentEpoch, BumpEpoch, MintUnderEpoch,
StillServes, Resolve, CurrentAddressFor, LoseVersion) is the operation
under test, not a seed or a raw read. Those operations are methods on the
concrete *DoltStore and *EmbeddedDoltStore over issueops' *InTx bodies, on
no storage interface, no publicops role and no wire operation. Every call
path into them starts in a test: the methods are called only from each
store leg's own _test.go files (its EpochFixture, which the conformance
contracts drive, and its epoch tests), and the *InTx bodies only from those
methods, from each other and from tests (the uow leg's fixture through a
test-only type assertion, and issueops' and the dolt leg's own tests). No
command, role or server handler reaches them, so no client mutation
touches epoch state either;
- RetentionFixture's hooks (Resolve, Remove, Hold, ForceRemove, Erase, Mint)
are implemented by no backend yet (every store leg wires them nil and its
cases skip), and the wire has no removal, hold, erasure or gone/unknown
resolve to bind them to.
Binding the epoch hooks to the reference store behind the served env would
pass, but as a property of that store, which the store legs already pin,
never of the client. So the waivers stay; retentionEpochNoRoleWaiverReason's
comment and reason string now say the above, in the shape #6661 gave
asOfReadNoHTTPWireWaiverReason, instead of the earlier general "raw storage
hooks with no publicops role" wording.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(epoch): report applied-but-unpublished epoch writes as indeterminate, bound address length, verify dup-key mints
Maintainer fixup for the #6664 review (adopt-pr attempt 1, iteration 1).
Major 1, applied writes reported as failed. An epoch writer whose SQL
commit has landed, or may have, now wraps storage.ErrCommitIndeterminate
on both legs and hands back what it applied, so nothing replays a bump
that has already advanced the counter:
- embedded BumpEpoch and BumpEpochCarrying return the new epoch with the
error (failedBump), and MintUnderEpoch its address;
- server bumps wrap the sentinel on every Dolt failure after the SQL
commit, including a failed staged-set read (unpublishedBump), and so
does LoseVersion; an indeterminate SQL commit returns the epoch or
address it may have committed, and a definite (typed MySQL) commit
error returns neither.
Tests: TestEpochWritesReportAnUnpublishedCommitAsIndeterminate (new,
embedded, through an afterSQLCommit seam in runTransactionWithMessage);
on the server leg TestEpochWritesMarkAFailedStagedReadIndeterminate,
TestEpochWritesReturnWhatAnIndeterminateSQLCommitMayHaveApplied and
TestEpochWritesReturnNothingWhenTheSQLCommitFailsDefinitely, and the
sentinel asserted in every publication-failure test.
Major 2, address overflow. MintUnderEpochInTx refuses a pair whose
address would outgrow epoch_minted_addresses.address (VARCHAR(255)) at
the widest epoch the counter can reach, with a typed
ErrEpochAddressTooLong, so a carry can never fail on a lineage that
gained an epoch digit.
Major 3, duplicate-key mint. A duplicate key from the mint's INSERT is
no longer success: the row is read again and the mint stands only if
this transaction sees it served; a Gone row fails the mint with
ErrEpochAddressNotServed, an unreadable one with the duplicate-key
error. Measured on dolt-sql-server 2.2.0, the stale-snapshot INSERT does
not report a duplicate key at all: its COMMIT fails with Error 1213 and
the retried mint answers ErrEpochAddressNotServed
(TestAMintRacingTheMintAndLossOfItsAddressConflictsAtCommit).
Minors:
- absent store_epoch row: sqlmock cases pin that CurrentEpoch,
StillServes, Resolve, CurrentAddressFor and LoseVersion never seed it;
switching any of the five to the seeding reader now fails the test;
- the server publication tests mint their address instead of writing it
by hand, and TestEpochCASTestsBuildEveryAddressWithEpochAddress scans
that file too (issueops_test gains //internal/storage/dolt:go_srcs as
data);
- stale text: the duplicate-key and carry comments, the issueops
header's CompareAndSetVersionInTx citation, the embedded header's
parity claim, and the 0072 header's "upserts the same row" (0072 is
past the frozen floor).
Declined, for the owner:
- a scheme-change carry voids an older live lineage re-minted after a
restore: rule (a), document and pin it, or rule (b), resolve the loser
to the winner's carry, is a design call about R20-n, not a review fix;
- the uow epoch fixtures' in-transaction DOLT_COMMIT('-Am'): test-only
fixtures with no production caller; routing them through RunTxScoped
is follow-up work.
Validation: go build ./...; go vet; nogo (bazel --config=nogo) on
issueops, dolt and embeddeddolt; issueops epoch tests; the dolt epoch
tests against a real dolt-sql-server (56 pass) and the fake-backed
publication tests; embedded epoch tests with BEADS_TEST_EMBEDDED_DOLT=1;
uow epoch contract; the schema package; the address guard under bazel
in the local sandbox. All 14 overlay mutants of the fixes are killed.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Jim Wordelman <mayor@quad341.uk>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* test(conformance): author R7.1 as-of-read conformance contract
Adds a new Phase 0 conformance contract for R7.1 (as-of reads,
gastownhall/beads#6136, design doc #5898 rev 9) -- no fixture existed for
this anywhere in backend/conformance/, so this is authored from scratch,
not un-skipped.
AsOfReadFixture supplies three hooks: Resolve (the read under test),
MintAt (seeds a version at a controlled accept-time), and
MakeUnanswerable (arranges a Gone/Unknown refusal independently of
RetentionFixture/EpochFixture's own removal machinery, since R7.1's
refusal is a sibling contract to R17/R20, not a dependent of them).
Five Run* functions cover the bead's five required-coverage points
verbatim:
- selector accepts either an instant or a version address, and both name
the same answer when they resolve to the same version;
- resolution returns the latest version at-or-before T, with a version
accepted after T strictly excluded even when close by;
- a served result reports the exact address it served;
- an unanswerable read refuses as a typed Gone*/Unknown outcome with a
reason, and never substitutes a neighboring version, the nearest
surviving version, or current state -- asserted directly by requiring
Address == "" on every refusal;
- local completeness only (TC3): a lineage minted into one of two stores
resolves there and refuses Unknown (FR-06) on the store that never
received it, asserting nothing about agreement between the two.
The file's doc comment states the Memory-plane-consumer-policy non-goal
explicitly (closed-before-T boundary, sibling exclusion, supersession
exclusion are consumer policy per #5877, not part of this primitive) so
the gap reads as deliberate scope, not an oversight.
Wired onto all three storage legs (dolt, embeddeddolt, uow) with
unconditional "not implemented" stubs rather than partial-real hooks, so
every case fails via MintAt on its first fixture call -- deterministic
RED with no risk of an accidental pass, per the precedent set by
be-x5jqd.1. Sentinel error messages reference be-x5jqd.5, the
implementation child this suite is written ahead of.
TestEveryLegWiresEveryRoleContract requires zero waivers: all 5 new
entrypoints are fully wired (not nil) on all three legs.
Branch cut from the rebased be-2h167 head (5fdfb92fe5).
Verified via go build ./..., go vet ./..., gofmt -l, and go test -tags
cgo across all three legs: all 5 new subtests (8 counting the 4-way
Gone/Unknown table) FAIL for the documented reason,
TestEveryLegWiresEveryRoleContract passes cleanly on all three legs, and
TestVersionedHistoryPhase0RunsInFullSkipMode is unaffected.
Bead: be-x5jqd.2
* fix(history): refuse metadata integers binary64 cannot hold exactly (refs be-wdlod, #6358 follow-up)
canonicalDurableState canonicalizes numbers per RFC 8785 (JCS), which
renders every number as an IEEE-754 binary64 double regardless of
magnitude. An integer-valued metadata literal past 2^53-1 therefore
rounds to a DIFFERENT VALUE on the way into durable_state -- not a
formatting change, a value change -- which can collapse two distinct
issue states onto one durable_state and therefore one content token.
refuseUnrepresentableIntegers is the fix: an admission gate, one layer
above the JCS step, that parses each JSON number literal exactly with
math/big (never float64 -- float64 rounding is the exact thing being
guarded against) and refuses whenever the literal's VALUE, not its
spelling, is an integer whose magnitude exceeds 2^53-1. Value-not-form
matters because the first cut of this gate skipped any literal
containing '.', 'e', or 'E' outright, reasoning that non-integer forms
round-trip losslessly -- true for genuinely fractional literals, but
not for an integer VALUE spelled in decimal or exponential form: QA
found that 9007199254740993.0 and 9.007199254740993e15 walked straight
past that first gate and canonicalized to the same colliding target as
the bare literal. The predicate now inspects the value via
big.Rat.SetString/.IsInt, so all three spellings are refused alike.
1e300 is refused too, no notation carve-out: it denotes the integer
10^300, and binary64 spacing near that magnitude is roughly 2^248 --
vastly wider than the collision window at the 2^53 boundary this gate
exists to close. Admitting that spelling while refusing 9007199254740993
would be the same defect with a bigger window (mayor's ruling, citing
this collision-window argument as decisive). Non-integer values stay
admissible past the bound (1.5e300 is fine): ES6 shortest-round-trip
formatting is a bijection on doubles, so two non-integer literals
collide only if they already denoted the same double before this gate
ever ran, and a fractional literal never carried a promise of exact
decimal storage the way an integer -- an id, a count, a timestamp --
carries a promise of exactness that silent rounding would corrupt.
jcsCanonicalize is canonicalDurableState's RFC 8785 step pulled out on
its own, below the gate rather than behind it, because refusing 1e300
puts the admission policy at odds with one of this store's own spec-
conformance fixtures: testdata/jcs/input/values.json, one of the 10
official RFC 8785 vectors shipped verbatim from the spec's reference
suite (not authored here), itself contains 1E30. RFC 8785 conformance
is a claim about the canonicalizer, not about this store's admission
policy, so TestCanonicalDurableStateIsJCS now runs all 10 shipped
vectors -- values.json included, still asserting 1E30 folds to 1e+30
per spec -- through the ungated jcsCanonicalize, while its two local ad
hoc cases keep exercising the full gated canonicalDurableState, since
neither conflicts and both are more faithful to production traffic that
way. The gate's own refusal of that magnitude is pinned separately, on
its own terms, in version_history_integer_admission_test.go.
Severity is MINOR, not MAJOR: Dolt's JSON column type already
renormalizes metadata to float64 on every read regardless of this gate
(measured on dolt 2.2.3: 9007199254740993 reads back as
9007199254740992, 1e300 as 1e+300), which converges two distinct
in-memory states to one stored state before any version row is minted.
The collision this gate closes is therefore unreachable through normal
bd update traffic on this backend; it stays real for off-path writes --
bd sql, a hand-written JSONL import, or a TEXT-column backend -- which
is why this landed as a follow-up rather than gating Phase 2 itself.
Verified clean: a full module compile; static analysis over the
storage tree; the complete issueops package suite (260 subtests); the
schema package suite; and the broader storage tree, apart from one
dolt-package test that fails identically against the pre-this-diff
baseline (a Dolt server port collision with a concurrent session's
process on this host) -- confirmed pre-existing and environmental, not
caused by this change.
* feat(issueops): implement R7.1 as-of read's store-layer primitive (be-x5jqd.5)
Turns backend/conformance/versioned_read_contract.go (authored RED in
6aefdce60, gastownhall/beads#5898 rev 9, #6136) towards GREEN. This
commit lands the shared production seam; wiring the three per-leg
fixtures (dolt, embeddeddolt, uow) onto it is a follow-up commit.
asof_read.go (new): AsOfReadInTx resolves an AsOfSelector (an instant
or a previously-served version address) to one issue_versions row --
the latest version accepted at or before T, everything later strictly
excluded -- and reports either its state and address, or a typed
refusal (gone-retention/gone-erasure/gone-reorganization/unknown) with
a reason. storeID is accepted only for signature parity with the
fixture hook shape (Design D: the conformance suite's own ad hoc
dispatch string selects among per-leg isolated test stores; issue_versions
carries no store_id column, matching CurrentEpochInTx's precedent).
AsOfRestriction is string-backed, unlike R20's int-backed
EpochRestriction, because it round-trips directly through the new
removed_restriction column with a plain cast.
Migration 0069 adds issue_versions.removed_restriction VARCHAR(30),
nullable (NULL = live, never a stored value). Sits alongside removed_at/
removed_reason (migration 0067, virgin until this slice); AsOfReadInTx
only READS all three -- a future R17 is the real writer via hold/remove/
erase primitives, no collision. Guarded PREPARE + CLI direct-DDL
override + schema_test.go hygiene entries, all modeled on 0068's
pattern; TestLatestVersionIncludesMigration0068 is superseded per the
one-pin-at-a-time convention.
version_history.go: splits RecordVersionInTx into a versionedHistoryEnabled-
gated wrapper and a new exported RecordVersionAtInTx, both delegating to
a shared recordVersionAtInTx(..., at time.Time) body. RecordVersionAtInTx
is test-support only -- ungated, caller-chosen timestamp -- so an as-of-
read fixture's MintAt hook can mint version rows dated in the past
without flipping a store's history-enabled flag. No behavior change for
existing RecordVersionInTx callers.
The new/moved code shifted which function each completeness guard sees
as the enclosing write site, so all three needed updating, not bypassing:
- row_lock_guard_test.go's funcNameExemptions key moves from
RecordVersionInTx to recordVersionAtInTx (the write's new actual
enclosing function), reasoning extended to cover both callers.
- journal_completeness_test.go's beadDMLExemptions and
version_completeness_test.go's versionExemptions each gain a
RecordVersionAtInTx entry mirroring RecordVersionInTx's own (test-
support twin, no production caller, no mutation of its own to
journal/mint beyond the seam itself).
Also fixed a latent test-helper gotcha found while writing the 0069
Dolt-CLI test: queryDoltCSV trims the whole `dolt sql -r csv` output
before parsing, so a row whose ONLY selected column is NULL renders as
a bare blank line that strings.TrimSpace silently swallows when it's
the trailing line, collapsing "one row, NULL value" into "zero rows".
Fixed by selecting a non-NULL anchor column (issue_id) alongside the
column under test.
Verification performed: full module compile and static analysis, gofmt
clean; the complete internal/storage/schema suite with the real-Dolt-CLI
lane enabled; and the complete internal/storage/issueops suite,
including every completeness/row-lock structural guard -- all clean.
* feat(issueops): wire dolt, embeddeddolt, and uow onto R7.1 as-of read (be-x5jqd.5)
Turns backend/conformance/versioned_read_contract.go fully GREEN
(authored RED in 6aefdce60, gastownhall/beads#5898 rev 9, #6136): this
follows up on 4da98a9a8's shared production seam by wiring all three
storage legs' AsOfReadFixture (Resolve/MintAt/MakeUnanswerable) onto
issueops.AsOfReadInTx, per that commit's own stated plan.
Each leg's asOfReadHarness is Design D's dispatch table: the
conformance suite invents storeID strings to select among N isolated
stores, and isolating them is entirely the harness's job --
AsOfReadInTx itself stays storeID-oblivious. The three legs differ
only in how they get that isolation cheaply:
- dolt: one shared testcontainer, N randomly-named databases
- embeddeddolt: N fully independent on-disk databases
- uow: one shared dolt sql-server subprocess (NewDoltServerUOWProvider's
adoption semantics collapse repeat calls against the same root dir
onto the same process), N randomly-named databases
All three harnesses are Fatalf/Skip-free below their own
TestAsOfReadContract body: AsOfReadFixture's hooks carry no *testing.T
of their own and run from inside t.Run subtest closures (sometimes
nested two deep), where FailNow/SkipNow would panic with "subtest may
have called FailNow on a parent test". Failures instead flow back as a
plain error into conformance.RunAsOfReadXXX, which Fatalfs correctly
on the subtest's own goroutine.
Two small companion fixes surfaced while wiring the legs on:
- issueops.asOfVersionAddress -> AsOfVersionAddress (exported): each
leg's MintAt needs to build the exact token its own
RecordVersionAtInTx write will resolve against, from a different
package than issueops.
- recordVersionAtInTx now truncates `at` to whole seconds before
writing it to issue_versions.change_at (DATETIME, migration 0067).
Measured on dolt 2.2.3: the column ROUNDS a sub-second value rather
than truncating it, so a change_at of 13:32:04.77 lands at 13:32:05
-- strictly later than the instant it was meant to record. That
breaks resolveAsOfRevisionInTx's "at or before T" comparison
(asof_read.go) for any T between the true instant and the rounded-
up one. This is a production correctness fix, not test-only:
RecordVersionInTx hits the identical hazard on every real
time.Now().UTC() call whose nanosecond component rounds up.
Verification performed:
- uow: TestAsOfReadContract green standalone (5 subtests, 4 nested
restriction variants) and the full uow package green in isolation
(673s, includes pre-existing TestReleaserContract and everything
else). A `go test ./internal/storage/...` full-tree sweep flagged
uow FAIL via a 600s hang inside TestReleaserContract's migration
lock -- traced to cross-package parallel resource contention from
running the whole storage tree's dolt-sql-server-spinning suites
concurrently, not a regression: the same test is clean when the
package runs alone.
- embeddeddolt: TestAsOfReadContract green (22.89s, all subtests and
all 4 restriction variants).
- dolt: skipped on this host -- no Docker for the leg's testcontainer,
the same pre-existing skipIfNoDolt gate the whole dolt package
already runs under, unrelated to this change.
- TestEveryLegWiresEveryRoleContract and
TestEveryContractImporterInTheStorageTreeIsRegistered both pass for
all three legs.
- gofmt clean; whole-module build and vet clean.
Bead: be-x5jqd.5
* feat(versions): bd versions + a config switch for versioned history (refs be-hs42e.6.2)
Versioned history has been buildable but not usable: migrations 0067+ create
issue_versions, and the Phase 2 writer fills it, but SetVersionedHistoryEnabled
was a Go method nothing in cmd/bd ever called. There was no supported way for a
person to turn the feature on, and no way at all to read it back without raw
Dolt SQL. This adds the switch and a reader.
- versioned-history.enabled (env BD_VERSIONED_HISTORY_ENABLED), default off,
applied at the top of wireStorageDecorators. It MUST run on the raw store:
the capability is a type assertion and no decorator forwards it, so applying
it after a wrap would silently leave history off while the config said it was
on. TestVersionedHistoryConfigAppliesToTheRawStore pins the ordering, and
fails rather than skips if a decorator ever starts forwarding.
- storage.VersionLister + issueops.ListVersionsInTx over issue_versions, on the
dolt and embeddeddolt legs. A narrow capability rather than a Storage method,
following ExternalRefHistoryQuerier: a backend that cannot know must be able
to say so instead of answering "none".
- bd versions <id>, with three distinguishable outcomes rather than two. Off,
unsupported, and empty are different answers with different fixes; an empty
list is a claim about the bead, and returning it for the other two would be a
wrong answer rather than an empty one. The four removal restrictions render
as four sentences, and unknown (no lineage knowledge here) is not gone.
- REV is printed as a local ordinal with a footer saying so. It is deliberately
NOT presented as a citable address: AsOfVersionAddress mints over the ordinal,
two clones can both hold revision 8 of the same bead, and the durable
version_id primary key has not landed. An address printed now would break
every citation once it does.
- bd version <id> now points at bd versions <id> instead of printing bd's own
build and looking like the bead has no history. Bare bd version is unchanged.
No migration: 0067/0068/0069 already carry every column this reads.
Verified on a scratch store: create + 2 updates + close with the flag on lists
4 attributed versions; with the flag off, 0 rows in issue_versions and the
command refuses naming the key.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(versions): emit local_revision, not revision, in --json (bee's #5898 consumer read)
types.Issue already ships `json:"revision"` (types.go:1206) and it is the
row-lock CAS token — an unrelated value, and a string where this one is an
int64. Emitting "revision" from the versions payload would put two meanings
and two types on one key in the place machines read: the `bd version`
collision again, with worse consequences, since a script that learned one
shape gets the other and cannot tell.
local_revision also carries the non-citability with the value rather than
only in a footer no script parses, and needs no rename when version_id lands
beside it.
Raised by @bee-ghosttrack's consumer read on #5898, who reported a couple of
hundred script files parsing `bd … --json` — this is the part of the surface
they would actually touch. Pinned by
TestVersionsJSONDoesNotCollideWithIssueRevision.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(versions): make the advertised switch actually switch it on (#6661 review)
@bee-ghosttrack's blocking finding: the help text and the off-refusal both
told the user to run `bd config set versioned-history.enabled true`, and that
command did not turn the feature on. The key is not yaml-only, so `bd config
set` routed it to the workspace DATABASE; both readers called config.GetBool,
which is viper (yaml + env) only. The user ran exactly what they were told,
was told it was set, and recording stayed off — configured on, actually off,
one layer up from the decorator-ordering hazard this command already guards.
Takes bee's option (b): read the switch from the store's own config, where
`bd config set` already writes it. That also makes recording a property of
the STORE rather than of whoever is calling, which is what closes finding 2 —
two clients of one sql-server can no longer disagree about whether a write is
recorded.
The two planes are OR'd rather than ranked. The hazard is a write that fails
to record, never one that records when it needn't, so either saying yes is
enough and neither can silently switch the other off. BD_VERSIONED_HISTORY_ENABLED
still works for a one-off run. A store with no settings plane (proxied, no-db)
falls back to viper instead of failing the command.
Also from that review:
- finding 3: the read no longer refuses just because recording is off. A store
that recorded for a month and was switched off HAS versions; refusing made a
claim about the store from a fact about this invocation's config, which
VersionLister's own doc says are independent. Rows are listed either way,
with a note when recording is currently off; refuse-with-remedy only when
off AND empty.
- finding 4: an unresolved id with no versions is "no such bead", not "none
yet". Falling through on an unresolved id stays right — a deleted bead can
still have versions — but only until the answer is empty.
- finding 5: the ordering test's escape hatch is t.Fatal, not t.Skip; a skip
returned before the assertion that actually guards the ordering. The
storage_chain.go doc cited a test name that never existed. version_lister.go
promised a list of compile-time assertions that was not there; the
assertions now exist in each leg's own package, where they can compile.
- `versioned-history.` is a recognized config prefix, so the set no longer
prints "not a recognized config key" immediately before confirming the set.
Test: TestVersionedHistorySwitchRoundTrip_Embedded drives the real
`bd config set` through to a real `bd versions` against a real store, with
BD_VERSIONED_HISTORY_ENABLED cleared so a pass proves the store setting
carried it alone. This is the round trip bee asked for, and it is the only
shape that could have caught the original defect — a fake-backed unit test
cannot see a disagreement between two real planes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs(versions): name what the OR'd switch planes cost (#6661 review)
@bee-ghosttrack, round 2: with the two planes OR'd rather than ranked, the
consequence worth naming is that once the store setting says on,
BD_VERSIONED_HISTORY_ENABLED=0 cannot countermand it for a single run. The
help now says so, and says where to turn it off instead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(versions): gate the wiring store read on the capability, not a recover (#6661 review)
@bee-ghosttrack's round-3 blocking finding. wireStorageDecorators reads the
versioned-history switch off the raw store on every bd invocation, and did so
before anything established that the store could use the answer. cmd/bd's own
fakeProbingDoltStore embeds a nil storage.DoltStorage, so the promoted
WorkspaceConfig SIGSEGV'd at wiring time -- and a panic takes the whole test
binary down, which is why one unguarded read showed up as two red CI steps
(Test (macos-latest), PR Core (wrapper timing)) rather than one failed test.
Takes the fix bee prescribed: assert storage.VersionedHistoryConfigurer first
and read the store plane only when the store could act on the answer.
The previous round fixed this with a recover plus a WorkspaceConfig on the
fake, and left a comment arguing that no capability assertion could work. That
argument was wrong, and wrong in a specific way worth recording: it reasoned
about asserting WorkspaceConfig, which IS declared on storage.DoltStorage and
so matches every store including the nil-embedding fake. bee proposed
asserting VersionedHistoryConfigurer, which is a different interface --
SetVersionedHistoryEnabled is NOT part of DoltStorage, so the fake does not
promote it and does not satisfy it. The comment rebutted a fix that had not
been proposed. It now states what is actually true.
So the fake goes back to byte-identical with the pushed head: the wiring fix
fixes that test without touching it, as bee said it would, and the fake keeps
the "only the methods below may be called" constraint its own doc asserts.
The recover stays, as a backstop rather than the guard. It covers what the
assertion does not: versionedHistoryEnabled is also called from `bd versions`,
where the read is the point and no capability gate precedes it, and a store
that DOES implement the capability can still have a half-built settings plane.
The viper plane is still read first and unconditionally, so a set-but-unsupported
store still reaches applyVersionedHistoryConfig and still gets its warning. Only
the store-plane read is gated. The one case that loses a warning is a store whose
own settings plane says true but which lacks the capability -- and `bd config
set` could not have written that plane on such a store to begin with.
Tests, split so each layer fails for its own reason:
- TestWireStorageDecoratorsSkipsTheStoreReadForANonConfigurer asserts calls == 0,
not merely that it survived. "It survived" is what the recover delivers too,
which is how this regressed the first time.
- TestWireStorageDecoratorsSurvivesAStoreThatCannotAnswer keeps the recover's
case, now on a store that IS a configurer so the guard lets it through.
- TestVersionedHistoryEnabledForWiringReadsTheStoreWhenItCanRecord pins that the
guard did not stop reading the plane finding 1 existed to start reading.
Mutation-verified both ways: removing the guard fails the first test on
calls=1/want=0 while everything still "passes" by surviving; removing the
recover leaves the first test green and fails only the second.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(versions): name the embedded round-trip so CI selects it (#6661 review)
@bee-ghosttrack's round-3 finding 2. The round-trip test that proves the two
config planes agree ran only on the author's machine.
.github/scripts/embedded-test-shard.sh discovers what to run with
`grep -rh '^func TestEmbedded' cmd/bd/*_embedded_test.go` and validates
manifest entries against ^TestEmbedded[A-Za-z0-9_]+$.
TestVersionedHistorySwitchRoundTrip_Embedded matched neither, so the only
lane that sets BEADS_TEST_EMBEDDED_DOLT=1 for cmd/bd never selected it; the
generic Test jobs run without that env, where the test's own guard skipped it.
Skipped and passed look alike from outside, which is what made it invisible.
Renaming is the whole fix -- a test absent from the shard manifest still gets
a shard from the fallback distribution. Verified by running the script's own
selector over the tree and confirming the new name is discovered.
The rationale is now a comment on the test, because the old name reads more
naturally and nothing else in the file explains why the prefix is load-bearing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(versions): drop the dead fixture, name the empty arm (#6661 review)
@bee-ghosttrack's round-3 finding 3. TestVersionsRefusesWhenFlagOff built a
backend holding one recorded version, handed it to nothing, and ended in
`_ = backend`.
The fixture was load-bearing for the assertion the test was named after --
that the read was refused BEFORE the backend was consulted. Finding 3 removed
that behaviour on purpose, so the assertion went with it; the fixture stayed
behind, unused, under a name still promising the old contract.
Renamed to TestVersionsOffAndEmptyRefusesWithRemedy for what it actually pins,
moved beside TestVersionsOffButRecordedStillLists so the two read as the pair
they are -- recording off decides the FOOTER, never whether to read; off with
rows lists them, off and empty is the one case that refuses -- and the dead
fixture is gone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(proxy): give bd versions a capability row, a typed refusal (#6661)
main's proxied-server capability registry (#6582) requires every command
path to carry a row, and TestProxyCapabilityRegistryCoversCommandTree
fails for `bd versions`, which this PR adds.
It is refused, reason unimplemented, rather than permitted. It is a pure
read (issueops.ListVersionsInTx in one read transaction), so nothing
about it is unsafe on a shared backend and "design" would be wrong. But
it reaches the backend only through the optional storage.VersionLister,
which the dolt and embedded stores implement and the uow provider does
not. Permitting it would open the proxied provider in the root pre-run
(starting the proxy and dolt) and then fail untyped at
errVersionsUnsupported. The row refuses with proxy.versions.unsupported
before any side effect, and its tracking names the missing piece: a
VersionLister over the proxied uow provider (tracker #6132).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(uow): register verified shutdown cleanup in TestAsOfReadContract (#6661)
main's TestEveryServerFixtureRegistersVerifiedCleanup (#6441) requires
every server fixture to use verifiedShutdownCleanup(t, storeRootDir)
instead of calling proxy.Shutdown directly, so a shutdown that refuses
cannot leave a live dolt sql-server behind a green run. TestAsOfReadContract
still had its own proxy.Shutdown cleanup that only logged the error.
The cleanup is registered at the same point, so the LIFO ordering the
harness relies on (every provider closed before the shared server stops)
is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* style(schema): gofmt cli_migrations.go after the 0070 renumber
The rebase onto upstream's 0069_widen_issue_versions_datetime_precision
(#6675) joined its const and the renumbered 0070 comment without the
separating blank line, which make fmt-check rejects.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(history): stop flooring change_at now that 0069 widened it (refs be-hs42e.10)
recordVersionAtInTx carried `at = at.Truncate(time.Second)`. That was correct
while 0067's plain DATETIME was in force: Dolt's datetime(0) does not truncate
sub-second input, it ROUNDS half-up, so a change_at could be stored strictly
LATER than the instant it recorded and break AsOfReadInTx's "latest version
accepted at or before T". Flooring first left nothing to round.
Migration 0069 widened change_at and removed_at to DATETIME(6), which removes
the rounding entirely and makes the floor actively harmful — it threw away the
microseconds the widening exists to keep. Two versions minted in the same
second collapsed onto one stored value and stopped being distinguishable by
change_at, which defeats --at, the only PORTABLE selector the read surface
offers while revision stays a per-store ordinal and no durable version address
has shipped.
This was measured, not inferred. On a store carrying both the widening and the
floor, four versions minted inside one second all read back 15:40:38.000000:
the column could hold microseconds and the writer refused to supply them. Two
correct fixes cancelling each other, and only the second one was visible.
removed_at needs no matching change: MarkLatestVersionRemovedInTx already
passes time.Now().UTC() straight through and was never floored. Audited rather
than assumed.
Pinned by TestRecordVersionKeepsSubSecondChangeAt (embeddeddolt), which mints
two versions 500ms apart inside one second and asserts both that the
fractional part survives and that the two differ. Verified it FAILS with the
floor restored — reporting exactly the 11:04:07.000000 collapse — and passes
without it, so it is a real guard rather than a test that passes either way.
The column's own half of the contract stays pinned by
TestMigration0069ChangeAtSurvivesSubSecondPrecisionThroughDoltCLI.
Also drops this branch's own tx-minting guard commit, which upstream landed
independently as #6833.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(feat): red — Activate versioned history in every store and provider factory, each store reading its own #6661 switch (stacked on #6661) (refs be-qxq70)
Tests first, all failing on the right reasons at fb6e219d6a (#6661's head):
- D1: on real embedded stores a routed update, a routed close and
`bd create --repo` into a rig whose OWN row is on each gain 0
issue_versions rows, want 1; the control (a write inside the rig) gains 1.
- D3: BD_VERSIONED_HISTORY_ENABLED=1 records into no routed store, and =0 is
shown not to switch off a store whose row is on.
- D4: TestEveryStoreConstructionActivatesVersionedHistory flags all 9 store and
provider factories, and its mutation probe reports "probed 0 of 9".
- wiring: wireStorageDecorators still reads the store's row (1 read) and
switches it on; activation belongs to the factories.
- internal/versionedhistory (does not exist yet) and the doctor repair opener:
the resolver, the provider read (K1), the error-vs-absent diagnostics and the
shared-activation requirement.
* feat: green — Activate versioned history in every store and provider factory, each store reading its own #6661 switch (stacked on #6661) (refs be-qxq70)
Stacked on #6661 (fb6e219d6a). #6661's plane and approved commits are
unchanged: the switch stays a row of the store's own config table, OR'd with
viper, and `bd config set versioned-history.enabled true` still writes that
row and not config.yaml.
The defect: applyVersionedHistoryConfig ran only from wireStorageDecorators, so
the one store a command opens for its own workspace was activated and every
store built by newDoltStoreFromConfig (prefix-routed update/close, `bd create
--repo`, the direct-mode open) was not. With the switch on they recorded no
issue_versions row while the command reported success.
- Activation moves to where a store or unit-of-work provider is constructed
(the store_factory.go/_nocgo.go twins, uow_factory.go's two provider
constructors, the personal-migration planning store, and bd doctor's repair
opener), on the raw store, before anything can wrap it. wireStorageDecorators
no longer activates, so each store's row is read once per open.
- One resolver, in internal/versionedhistory, reachable from doctor/fix which
cannot import package main. #6661's semantics are preserved: one key
spelling, viper first, then the capability check, then the row read, with
the recover backstop. The behavior-preserving refactor of #6661's
versioned_history_switch.go / storage_chain.go is the only edit to files
#6661 introduced; the resolver tests moved with the code, assertions
unchanged.
- K1: a provider has no DoltStorage, so its row is read through a unit of work
(NewUOW + ConfigUseCase().GetConfig) at construction: a pooled connection,
one SELECT, rolled back. The constructors have already run initSchema, so
this starts no server and creates nothing. It does not fall back to viper
alone.
- A row read that errors resolves to off but is reported under BD_DEBUG; an
absent row stays silent.
- Docs (configuration.md), a CHANGELOG entry, and a hint at `bd config set ...
true` time that the setting replicates and is single-writer only.
The bazel-sync run also wanted unrelated BUILD entries for files that already
exist at #6661's head (versions.go, versioned_read_contract.go, ...); they are
not part of this change and are left out.
* test(feat): green — a served mutation records from the provider's own row, on a real server (refs be-qxq70)
K1 is the one place the resolver cannot ask a DoltStorage: `bd serve` against a
server-mode workspace writes through a unit-of-work provider, so its flag is
read through NewUOW + ConfigUseCase().GetConfig at construction. The fakes in
internal/versionedhistory prove the read; this proves it WORKS against a real
Dolt server at that moment (pool open, database selected, schema migrated).
Two server-mode workspaces on the shared test container: the one whose own row
says on records a served HTTP mutation (+1 issue_versions row), the one with no
row records none.
Measured both ways: passes with the provider activation in place, and fails
("added 0 issue_versions row(s), want 1") with it deleted from both provider
constructors in uow_factory.go.
Proxied lane only (BEADS_TEST_PROXIED_SERVER=1 BEADS_TEST_ENV_RUN_DOLT=1
TESTCONTAINERS_RYUK_DISABLED=true), like TestServeActivatesTheEventsJournal, so
it skips in a plain make test.
* test(feat): red — #6661 review round, small items: findings 2, 4, 5, 6 and 8
Tests for the small findings in the second review round on #6661.
- 2: `bd versions` must decide "recording" from the store's own setting.
BD_VERSIONED_HISTORY_ENABLED=1 with the store's row unset and nothing
recorded must refuse, not answer "none yet"; the help text must not offer
the variable as a per-run switch for a read.
- 4: `bd versions --json` is one object, {"versions": [...], "recording":
bool}, with [] rather than null when nothing is recorded.
- 5: AsOfReadInTx reports any stored removed_restriction outside its four
values, "live" included, as unknown.
- 6: the 0070 header spells the restriction vocabulary with the underscore
spellings the code stores and compares.
- 8: `bd version <arg>` exits 1 and points at `bd versions <arg>`. This one
pins behaviour the branch already has, so it passes at red; it was shown
to fail with the guard removed.
Item 7 is a comment-only fix and has no test.
* feat: green — #6661 review round, small items: findings 2, 4, 5, 6 and 7
- 2: `bd versions` reports the store's own setting. It read the environment
and config.yaml as well, so BD_VERSIONED_HISTORY_ENABLED=1 made a store that
never recorded answer "No versions recorded yet" instead of refusing with
the remedy. It only reads, so those planes cannot make the store record.
The "for one run" hint is dropped from the help and the refusal, since it
could only ever produce the wrong answer.
- 4: `bd versions --json` is always {"versions": [...], "recording": bool},
with [] rather than null when nothing is recorded. Previously a bare array,
or null, and no recording flag.
- 5: AsOfReadInTx reports a stored removed_restriction outside its four
values, "live" included, as unknown instead of passing it through.
- 6: the 0070 header and its test use the underscore spellings the code
stores and compares. 0070 is unreleased, and this changes its content hash.
- 7: comment only. DATETIME(6) still rounds to the microsecond; the comment
said 0069 removed the rounding entirely.
* test(fix): red — #6661 number admission: fractions past the bound, exponent cost, pre-enable scan
Tests for the review round on the number-admission gate, written before the change:
- a fraction whose nearest double is at or past 2^53 is refused (9007199254740993.5,
9007199254740994.5, 9007199254740991.5), and the gate is closed under its own
canonicalization, checked as a property over a corpus
- classification depends on magnitude, not on the size of an exponent: 1e100000000 and
-1e400 are refusals, 1e-100000000 and 1e-400 are admitted, and allocation does not grow
with the exponent
- the sentinel's text names the I-JSON exact-integer range
- CheckMetadataVersionable agrees with the mint, and FindUnversionableMetadata finds what
the mint would refuse and skips what it never versions
- bd config set versioned-history.enabled true refuses, writing nothing, over rows the mint
would refuse, and false never scans
Guards that pass before and after by design: the verdict on every literal as the store
returns it, the mint's refusal writing nothing, and, on the server and embedded legs, the
store-level property that no two literals reading back as different numbers share a canonical
form. Those store tests also log what each Dolt holds for a number outside the range when
history is off, and pin that a later write to such a row is refused once history is on.
* fix: green — #6661 number admission: the nearest-double rule, ParseFloat classification, a pre-enable scan at the switch
The admission gate now refuses a JSON number literal if and only if the binary64 nearest to it
has magnitude above 2^53-1, or it overflows, whatever the literal's spelling:
- a fraction that rounds to or past 2^53 (9007199254740993.5, 9007199254740994.5,
9007199254740991.5) is refused, so the gate is closed under its own canonicalization
- literals are classified with strconv.ParseFloat, linear in their length, so 1e1000000 no
longer builds a million-digit integer inside the writer's transaction; an overflow is the
sentinel and a magnitude too small for binary64 is admitted; math/big is gone
- the sentinel reads "number is outside the I-JSON exact-integer range (magnitude above
2^53-1)"; ErrIntegerNotRepresentable keeps its name, with a comment saying why
- ordinary fractions such as 0.1 stay admitted; no verdict on a value the store hands back
changes
The header now says what the mint's refusal is: an integrity backstop inside the writer's
transaction, not an admission policy for metadata.
bd config set versioned-history.enabled true now checks the store first. It reads every issue
the mint would version, runs the mint's own function over each one's metadata
(issueops.CheckMetadataVersionable, through issueops.FindUnversionableMetadata), and refuses,
writing nothing, while any is refused, printing the count, the ids and the fix. There is no
override; setting it false never scans. The environment and config.yaml planes do not pass
through the command and rely on the refusal at write time.
Also: docs and a CHANGELOG entry, and comments in the existing admission tests that described
the old rule.
* test(fix): keep the exponent-cost allocation test stable under the race detector
TestNumberAdmissionAllocationsDoNotGrowWithTheExponent compared two
independently averaged allocation counts with a strict >. Under -race
sync.Pool drops one Put in four at random, and the refusal's fmt.Errorf
takes its printer from a pool, so a call now and then allocates one more
than it would. The test failed on most runs of `go test -race -short`, the
flag set of the required lane, and never without -race.
That noise only ever adds allocations, so compare the fewest allocations
over many single-call samples instead. The comparison stays strict, and it
still fails on the exact big.Rat gate this test exists to keep out (49
allocations for 1e1000000 against 36 for 1e400). The doc comment no longer
claims the count is deterministic under -race.
* test(fix): red — set-many skips the pre-enable scan; pin what the scan reads
bd config set-many versioned-history.enabled=true switches versioned history
on with no pre-enable scan: only bd config set makes it. With a row holding a
number outside the I-JSON exact-integer range the setting is turned on and the
next write to that row fails. The new embedded test drives the real verb over
such a row and expects the whole batch to be refused, writing nothing.
The scan's own embedded test only used open issues, so deleting AllFlag or
IncludeAllTypes, or replacing the unlimited Limit, left it green. It now adds a
closed, a pinned and a gate offender, and a second test imports more rows than
one default page and expects every one of them counted.
* fix: green — bd config set-many runs the pre-enable scan for versioned-history.enabled
bd config set refuses to turn versioned history on while an issue holds
metadata a version could not record. bd config set-many writes the same
setting through a validation loop of its own and made no such check, so it
switched history on over a row whose next write then failed. It now runs the
same check for that one key inside its validation loop, before any pair of
the batch is written, so a refusal stores nothing. The check reads through
the accessor it already used on both routes: the store the command has
opened on the direct route, the provider on the proxied one.
* chore: strip internal tracker ids from the comments and tests across #6661's range
Comment and test-text changes only; no behaviour changes. Across every commit from the
merge-base with upstream main to here, the comments and tests named internal tracker ids
(one bead id in eleven comments and in one test failure message, an example id in the
`bd version` guard's comment, and an internal decision's attribution in the huge-exponent
admission test). They now cite gastownhall/beads#5898 and #6136 only, which is what a reader
of the public branch can follow.
The 0070 migration's header comment is one of the edits. That migration is new on this branch
(it does not exist on upstream main), so the change is not an edit to a shipped migration, but
it does change the file's content hash; the schema tests that compute hashes are self-consistent.
Text that already exists on upstream main is left as it is, even where it mentions an id: this
commit does not rewrite lines the range did not add.
* chore(bazel): bazel-sync (gazelle) for the #6661 range
* fix(bazel): give fix_test the store.go its activation guard parses
TestVersionedHistoryDoctorRepairOpenerUsesTheSharedActivation parses
store.go from its working directory. `go test` runs in the package
directory, so the file is there. A Bazel test only sees its declared
runfiles, so the test failed with
parse store.go: open store.go: no such file or directory
in //cmd/bd/doctor/fix:fix_test (--config=ci) and in shard 1 of
//cmd/bd/doctor/fix:fix_dolt_test (--config=doltserver), which runs the
same binary through data = [":fix_test"].
Declare store.go as data on fix_test.
* test(fix): red — the pre-enable scan must check the whole issue, as the mint does
bd config set versioned-history.enabled true runs a check over every issue
before it turns history on. The check looked at each issue's metadata alone,
while the mint canonicalizes the whole issue. A gate's timeout is a
time.Duration that a version holds as nanoseconds, so a gate whose timeout is
past 2^53-1 ns (about 104.25 days) holds a number outside the I-JSON
exact-integer range: the mint refuses every write to it, the scan never
looked, and the switch could be turned on over it.
- The agreement test's domain widens from metadata documents to whole issues:
the metadata corpus, plus timeouts at 2500h (admitted), 2600h, 8760h and
-2600h (refused), exactly 2^53-1 ns (admitted) and 2^53 ns (refused).
- The scan test covers a gate over 105 days and expects the verdict to name
the field, "timeout".
- The mint-level refusal test covers the same gate and expects the refusal to
name the field as well as the literal, for a number in metadata too.
- An end-to-end test on the direct route and one on the proxied route create
gates with bd gate create --timeout, expect the enable to refuse and name
them, and expect the issues the scan names to be exactly the issues whose
next write the mint refuses.
- Three guards keep the scan's lite read from hiding a number: every column it
leaves out is a string or a list of strings, nothing the mint adds and the
scan does not load can hold a number, and no exported check over part of an
issue exists beside the one the mint runs. Each guard is also run against
shapes it must refuse, so it cannot pass by finding nothing.
The new symbols (CheckIssueVersionable, FindUnversionable and the Field of
UnversionableIssue) do not exist yet, so the issueops tests do not build.
* fix: green — the pre-enable scan runs the mint's own check over the whole issue
The check behind bd config set versioned-history.enabled true looked at each
issue's metadata alone. The mint canonicalizes the whole issue, and a gate's
timeout, a time.Duration held as nanoseconds, is a number outside the I-JSON
exact-integer range once it is past 2^53-1 ns (about 104.25 days). The mint
refuses every write to such a gate, the scan cleared the switch over it, and
the first write after that failed.
CheckIssueVersionable is now exactly canonicalDurableState's refusal over the
whole issue, and FindUnversionable runs it over every issue the mint would
version. It replaces FindUnversionableMetadata, and CheckMetadataVersionable
is gone, so no check over part of an issue is exported beside the one the mint
runs. A refusal names the top-level field it found the value in ("metadata",
"timeout") as well as the literal, on the mint and on the scan; the field is
located only after a refusal, so a write that is admitted still reads the
document once. A gate timeout above 2^53-1 ns is unrecordable by policy: it is
refused at the write, named by field and documented, not re-encoded.
The refusal at the switch gives the fix for each field. For a number in
metadata that is bd update --metadata or --unset-metadata, which works with
history on or off because a version is recorded from the state after the write.
For a gate timeout, which bd update cannot change, it is removing the gate with
bd delete, or setting the timeout_ns column with bd sql while history is off;
bd sql needs a server-backed store, and the text says so. It also says the
check runs once, now: a writer that does not record (an older bd, bd sql, a
pull from a clone that had history off) can add such a row afterwards, and the
first write to it then fails with the same refusal. Making the check and the
write of the setting one transaction would narrow that window, not close it.
Corrected in the comments, the docs and the changelog as well: an import is not
a path that skips the mint, since it goes through the same batch create; and
Dolt's JSON column collapses duplicate keys when it stores a document, so on a
Dolt store neither the scan nor the mint can see one, and the duplicate-key
refusal is a defence for a backend that keeps them.
* test(fix): red — the listing must answer as the as-of read does; the SDK opens must be accounted for
Three review findings on the versioned-history change and one wording fix,
tests first.
- A removed version's restriction. AsOfReadInTx answers a stored value outside
the four-value vocabulary (a NULL or empty column, "live", a hyphenated or
arbitrary string) as unknown, but ListVersionsInTx hands the column back as
stored, for every row, and the label bd versions prints passes such a string
through. A table test runs the listing and the as-of read on the same stored
value, for a version that was removed and one that was not, and expects the
same answer, and none for a version that was never removed. The label gets
the same out-of-vocabulary values and is expected to render what unknown
renders.
- The SDK's store opens. The shared construction guard now scans the repository
root as well, so the Go SDK's five opens (Open, OpenFromConfig and OpenGated,
and OpenBestAvailable in each build-tag twin) are noticed. Nothing accounts
for them yet, so both guards fail on exactly those five sites.
- A bytes bound beside the allocation-count bound on the number admission
gate. A classifier that builds the number it is asked about makes one
allocation whatever the exponent, so the count bound passes it, and the bytes
grow. The fewest bytes one call allocates for a literal with a huge exponent
must be no more than for a small one plus a margin. It passes today, because
the gate never builds the number; it fails for a gate that does.
- The refusal at the switch names the gate remedy as bd delete <id> --force,
says that without --force bd only previews, and says that removing the gate
unblocks anything it was blocking. The embedded and proxied end-to-end tests
expect all three.
* fix: green — the listing answers as the as-of read does; the SDK opens are accounted for
Three review findings on the versioned-history change and one wording fix.
A removed version's restriction. A stored removed_restriction is a free string,
and only the four values of the vocabulary are answers. The as-of read already
reported anything else (a NULL or empty column, "live", a hyphenated or
arbitrary string) as unknown, but the listing handed the column back as stored,
for every row, and the label bd versions prints passed it through.
NormalizeRemovedRestriction is now the one place that decision is made.
AsOfReadInTx calls it; ListVersionsInTx calls it for a version that was removed
and gives a version that was not removed no restriction; and restrictionLabel
renders through it. The listing, its JSON and the label now say what the as-of
read says for the same row.
The SDK's store opens. The Go SDK's five opens (Open, OpenFromConfig and
OpenGated, and OpenBestAvailable in each build-tag twin) apply neither per-store
switch, the events journal's or versioned history's, and they still do not.
Applying them would change the library's behavior for every embedder, so that
is a separate change; this one declares the boundary. The shared construction
guard now accounts for the five with one exemption reason that is true of both
switches, so a new SDK open is noticed rather than missed, and its staleness
check keeps the exemptions honest. The docs gain one bullet saying that writers
built on the SDK do not apply the switch.
The bytes bound on the number admission gate needs no production change: the
gate never builds the number, which is what the bound pins.
The refusal at the switch now names the gate remedy as bd delete <id> --force,
says that without --force bd only previews, and says that removing the gate
also unblocks anything it was blocking. The docs line says the same. For a gate
that blocks an issue, bd delete without --force prints a preview and exits 1,
and with --force the gate is removed and what it blocked is ready again.
* test(bazel): declare the root package's Go source as data for //cmd/bd:bd_test
The shared store-construction scan now reads the repository root, where the Go
SDK's opens live, but //cmd/bd:bd_test declared none of the root package's
source. Under bazel test the scan therefore saw an empty directory, reported
the five SDK exemptions as no longer matching a store construction site, and
failed the events-journal guard, while go test, which sees the whole checkout,
passed.
List the root in tools/bazel/go_srcs.py so the generator emits its managed
go_srcs filegroup there, and add that filegroup to bd_test's data. The new
block is the generator's own output and nothing else changes.
* ci: list the switch scan's proxied gate-timeout test in the 30-shard manifest
Upstream main (#7129) moved the proxied-server tier to 30 duration-balanced
shards, and TestProxiedShardManifestGeneratorNotStale requires every
TestProxiedServer*/TestServerMode* test exactly once in that block. This
branch adds TestProxiedServerVersionedHistorySwitchRefusesAnUnrecordableGateTimeout
(cmd/bd/versioned_history_switch_scan_proxied_integration_test.go), so the
block needs its line. Written by the generator itself:
python3 scripts/ci/gen_proxied_shard_manifest.py 30 --weights=duration --write
(one line, shard 8); --check exits 0 afterwards.
Rebase note (maintainer): regenerated on current main, whose proxied-server
tier uses 34 shards; the generator's incremental output
(gen_proxied_shard_manifest.py 34 --weights=duration --write) placed this
test at shard 6 of the 34-shard block.
* ci: list the PR's embedded versioned-history tests in the embedded shard manifests
#7156 made the embedded-Dolt tier's shard manifests exact-once (50 cmd
shards, 15 storage shards), so every embedded test must be listed. This PR
adds five embedded cmd tests and three embedded storage tests; this commit is
exactly what the generators write for them:
python3 scripts/ci/gen_embedded_cmd_shard_manifest.py 50 --weights=duration --write
python3 scripts/ci/gen_embedded_storage_shard_manifest.py 15 --weights=duration --write
Incremental: 8 lines added, none moved.
Rebase note (maintainer): regenerated on current main, whose embedded
manifests use 100 cmd shards and 40 storage shards; the generator's
incremental output placed these tests at cmd shards 55
(TestEmbeddedVersionedHistorySwitchScansEveryRowNotOnePage), 56
(...SwitchRoundTrip), 57 (...SwitchRefusesUnversionableMetadata), 58
(...SwitchRefusesAnUnrecordableGateTimeout) and 59
(...SetManyRefusesUnversionableMetadata) of the 100-shard block, and at
storage shards 5 (TestRecordVersionKeepsSubSecondChangeAt), 6
(TestVersionedHistoryKeepsNumbersTheStoreDistinguishesApart) and 23
(TestAsOfReadContract) of the 40-shard block.
* test: exempt OpenBestAvailableWith, where #7188 moved the SDK's store construction
Upstream #7188 split beads.OpenBestAvailable: it now delegates to the new
OpenBestAvailableWith, which builds the store. This PR's two construction
guards (TestEveryStoreConstructionActivatesTheEventsJournal and
TestEveryStoreConstructionActivatesVersionedHistory) share one exemption
list keyed by function, so after merging main they flagged
OpenBestAvailableWith as an unexempted construction site and reported the
OpenBestAvailable entries as stale. The two build-tag twins' keys now name
OpenBestAvailableWith. The reason is unchanged: it is the SDK's library
surface for embedders, and no code in the bd binary calls it. gofmt
realigned the three neighbouring entries.
* chore(schema): renumber removed_restriction to 0071 after #6943's 0070
Migrations are numbered by landing order. #6943 (participation_generation,
the versioned-history write fence) lands first and owns main-plane 0070 and
ignored/0028, so this PR's removed_restriction migration moves to the next
free slot, 0071. The rename is done here, as one maintainer commit, rather
than inside the replayed commits, so the history shows exactly what changed
relative to the PR as reviewed; the intermediate commits of the rebase carry
a duplicate 0070 and are not expected to build.
- migrations/0070_add_removed_restriction.{up,down}.sql become 0071_*, with
their header comments updated (the SQL itself is unchanged). Neither file
exists on main or on #6943, so this is not an edit to a shipped migration.
- cli_migrations.go: the CLI-bundle override is keyed to the new file name
and renamed cliMigration0071AddRemovedRestriction, and its const now sits
after 0070's.
- migration_0070_add_removed_restriction_test.go becomes
migration_0071_add_removed_restriction_test.go; its tests and messages say
0071, and it now owns the one LatestVersion pin (71).
TestLatestVersionIncludesMigration0070 in #6943's participation_generation
test is superseded by it and replaced by the usual pointer comment, and
0069's pointer comment now names the 0070 file that superseded it.
- schema_test.go hygiene comments, BUILD.bazel embedsrcs/srcs, and the
asof_read.go comment that cited the migration number.
Checked: go test ./internal/storage/schema/... (with the dolt CLI lane,
including TestAllMigrationsSQLAppliesThroughDoltCLIAndRecordsLatestVersion)
and scripts/check-migration-hygiene.sh against origin/main and against
#6943's tip.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(versions): reconcile #6661's tests and docs with #6943's write fence
#6943's write fence (design §16.2b) makes an update-shaped write to a legacy
record -- one whose participation_generation is NULL because it was created
while versioned history was off -- a skip, not a refusal: the fence returns
before the snapshot is canonicalized, so nothing is versioned and the mint's
admission gate never runs. Several of #6661's tests seed rows with history
off and then expect a later write to them to be versioned or refused, and
several comments say every later write to an offending row fails. On a tree
that carries both PRs those tests fail and those comments are wrong.
This ports, without changing their substance, the fence-integration commits
Jim Wordelman wrote for the donnabox integration fork, where both PRs were
already folded together:
- eff898db80 / 5d2e5a2ac4 (issueops, dolt, embeddeddolt): the mocked mint
sequence scripts the fence's participation_generation read; the number
fidelity test splits phase 2 into 2a (a legacy row is written, not
versioned, not refused, stays NULL) and 2b (a participating row is
refused and left untouched); TestRecordVersionInTxSkipsALegacyRowBefore-
TheAdmissionGate pins the fence's order against the gate.
- e0ad9d1e3c / 1528022dfa (cmd/bd): the switch round trip and the routing/env
end-to-end tests build the rows they expect a version for after the setting
is on, and assert that the pre-setting seeds gain nothing.
- 18b9015bf5 (cmd/bd): the embedded and proxied gate-timeout scan tests assert
the whole scan-vs-mint truth table (legacy offenders are named by the scan
but not refused by the mint; participating offenders are both).
- 5929ebd50c / 8ce872be03 (comments, CHANGELOG, configuration reference): the
mint's refusal binds rows that participate in history; the pre-enable scan
cannot see participation, so it over-approximates in the safe direction.
Left out on purpose: the fork's mintSkipsRow helper and defer-wake sweep
change, and its bd doctor "Versionable Issues" check and the docs that point
at it; none of those are part of #6661 or #6943.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jim Wordelman <jim@wordelman.name>
* test(versions): adapt #6661's guards to what main changed under it
Three test-side adjustments for code that landed on main after #6661's last
merge of it; no production code changes.
- internal/storage/leg_contract_wiring_test.go: main gained an HTTP storage
leg, and TestEveryLegWiresEveryRoleContract requires every leg to name or
waive every role contract. The five R7.1 as-of read contracts this PR adds
are a storage capability the HTTP client does not serve (internal/httpclient
answers AsOf with an explicit unsupported error, and the wire has no
instant/address selector or gone/unknown refusal), so they are waived on
the http leg with that reason, as the donnabox integration fork does.
- cmd/bd/versioned_history_construction_test.go: main split
newDoltStoreFromConfig into two thin wrappers over openDoltStoreFromConfig,
which is where the activation defer now lives (this rebase's resolution of
the activation commit), so the factory guard keys on that body.
- cmd/bd/versioned_history_serve_e2e_test.go: main's
TestProxiedGatedTestsRunInTheProxiedLane requires a test that skips unless
BEADS_TEST_PROXIED_SERVER=1 to be one the proxied lane selects, so
TestVersionedHistoryServeActivatesTheProviderFromItsOwnRow becomes
TestProxiedServerVersionedHistoryServeActivatesTheProviderFromItsOwnRow,
and the 34-shard proxied manifest gains its line (written by
gen_proxied_shard_manifest.py 34 --weights=duration --write, incremental;
--check passes).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(bazel): emit go_srcs.py's managed blocks for internal/versionedhistory
Main's tools/bazel/go_srcs.py now manages a repo_files filegroup block in
every package BUILD file, lists those filegroups in the root BUILD.bazel's
aggregates, and lists every go_library in tools/bazel's release_cross_build
target. internal/versionedhistory is a package this PR adds, so after the
rebase those managed blocks were stale and TestBazelGoSrcsBlocksCurrent
(go test ./scripts/...) failed. This is the generator's own output
(python3 tools/bazel/go_srcs.py) and nothing else; --check passes
afterwards.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(versions): don't publish change_agent in bd versions --json
`bd versions <id> --json` prints storage.IssueVersion as-is, so every JSON
tag on that struct is part of a public contract. Provenance V2
(gastownhall/beads#7510, as ruled by the maintainer) removes the ad hoc
agent field in favour of an actor chain; shipping a "change_agent" key now
would make a public contract out of a field that is on its way out.
IssueVersion.ChangeAgent is now tagged json:"-". Nothing else changes: the
issue_versions.change_agent column (migration 0067) stays, ListVersionsInTx
still reads it, change_actor and change_message are still published, and
the human listing never showed the agent. No doc or golden named the key.
TestVersionsJSONDoesNotPublishChangeAgent pins the absence with a non-empty
value, so an omitempty-style regression would still fail, and pins that
change_actor and change_message are still there.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(issueops): pin what the unfenced test-support mint does on #6943's new paths
#6943's two fixes to the shared mint body -- (a) no issues row means no
mint and no error, and (b) a create-shaped call on a new issues-table row
flagged no-history stamps participation_generation without minting -- were
written for its two kinds. This PR's shared body has a third,
mintUnfenced, behind RecordVersionAtInTx (the R7.1 as-of fixtures'
controlled-timestamp mint). The rebase resolution decided what (a) and (b)
mean for it; this pins that decision:
- (a) applies. It is the plane rule (FR-8: the table that holds the row
decides its plane), not the fence, and the unfenced kind already honoured
the flag-based form of the same rule (IsWisp). Without it, an unfenced
mint for an unflagged wisps-table row would insert a version row that no
issues row points at. The shared body's issues-table read now runs for
all three kinds; only the update kind acts on the value it reads.
- (b) does not apply. The unfenced mint never declares participation, so a
flagged row returns right after the snapshot, as before: no read, no
stamp.
- The fence still does not apply: a legacy row is minted, and the closing
UPDATE advances current_revision alone.
TestRecordVersionAtInTxKeepsThePlaneRuleButNotTheFence scripts each of
those three sequences exactly with sqlmock.
TestTestSupportMintsStayOutsideTheShapeSplit places RecordVersionAtInTx
outside #6943's create / dual-shape / update classification explicitly (it
is the seam's exempt twin, not a mutation entry point or mint site): it must
be in none of the shape lists, stay in versionExemptions, and reach neither
RecordVersionForCreateInTx (it never stamps) nor RecordVersionInTx (whose
gate and fence would stop the as-of fixtures minting history-off rows). The
row-lock guard's exemption comment for recordVersionAtInTx already names the
stamp-only UPDATE: #6943's own wording of it (all three UPDATE issues
statements) was carried into that exemption when the as-of read commit was
replayed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): say exactly why the as-of read contracts stay waived on http
#6943 now runs most of its participation-generation contracts over the
served wire (internal/httpclient/served_participation_generation_test.go):
their subject is a create or an update, which the client can send, and the
fixture reads the reference store's raw columns. This checked whether the
five R7.1 as-of read contracts can be wired the same way. They cannot,
cheaply or otherwise, without a new wire operation:
- their subject is the read itself (AsOfReadFixture.Resolve), and R7.1's
read, issueops.AsOfReadInTx, is reached by no publicops role and served
by no wire operation;
- the wire carries neither selector (an instant or a served version
address) nor the gone/unknown refusal the read answers with;
- the client's only point-in-time read, DoltStorage.AsOf, is a Dolt
commit-ref read, not R7.1, and is on the client's D8 unsupported
allowlist.
Binding Resolve to the reference store behind the served env would pass,
but as a property of that store, which the store legs already pin, never
of the client. So the waiver stays; its comment and reason string now say
the above instead of the earlier shorthand ("HTTP AsOf is explicitly
unsupported"), which conflated the client's commit-ref AsOf with R7.1.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(versions): describe what the write fence does to beads that predate recording
With #6943's write fence (design §16.2b) a bead that existed before
versioned history was turned on (participation_generation NULL) is legacy:
an update-shaped write to it is skipped, so it is never versioned however
often it is edited. Several user-facing strings from #6661 still described
the behaviour before the fence, and an independent review reproduced each
with a built bd (a legacy bead edited twice after enabling still lists no
versions; a legacy bead the switch refuses over is written without refusal
under BD_VERSIONED_HISTORY_ENABLED=1). Text only; no behaviour changes.
- bd versions help: only beads created while recording is on are versioned;
a bead that already existed is legacy and editing it records nothing; no
backfill. (Was: "a bead edited yesterday shows nothing until it is
edited again".)
- bd versions empty listing: drops "yet" and says why the list is empty -- a
bead created while recording is on always has its create version, so an
empty list means the bead predates recording (or was made by a writer
that was not recording), or is no-history or a wisp. The line still
starts "No versions recorded for <id>", which the switch round-trip test
pins.
- bd versions with recording off: only beads created after it is turned on
are versioned.
- bd config set versioned-history.enabled true refusal: Jim's scan stays as
conservative as he made it -- it cannot see participation, and a legacy
row can still be minted create-shaped if it re-enters the issues plane --
but the text now says a listed issue's writes are refused only if it
participates (created while history was on, or entered the issues plane
while it was on), and that legacy issues are listed because the check
cannot tell. The closing line says the same of a value a non-recording
writer adds later.
- docs/reference/configuration.md: the section opener says every accepted
change to an issue created while history is on is snapshotted, and that a
pre-existing issue is legacy; the "participates" parenthetical drops "or
written" (a write never stamps participation; only a create-shaped mint
does) and names entering the issues plane, matching the refusal text.
CHANGELOG already says "if it participates in history" and is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(versions): keep updated_at across update-shaped version mints
The update-shaped mint ended with UPDATE issues SET current_revision = ?
WHERE id = ?. current_revision always changes there, so the column's
ON UPDATE CURRENT_TIMESTAMP clause fired: with versioned history on, every
label, dependency or import write moved issues.updated_at to the session's
wall clock (local time, read back as UTC). An import with
RejectStaleUpserts then stored the wall clock instead of the source's
updated_at, and the source's next genuine edit was rejected as stale. The
statement now assigns updated_at to itself, the rule #4298, blocked_state.go's
mark/unmark templates and the create-shaped mint statements already follow,
so history on leaves updated_at exactly where history off does. It is the
one statement every production update-shaped mint ends with.
Tests:
- TestEmbeddedMintLeavesUpdatedAtWhereHistoryOffDoes (embeddeddolt) ages a
bead, adds and removes a label and a dependency, and runs two
RejectStaleUpserts imports, with history off first as the control. With
the fix reverted, history on fails all six arms (updated_at reads the
wall clock, and the later source edit is rejected as stale); history off
passes either way.
- RunParticipationGenerationFlagOffSkipsUpdateOnParticipatingRecord, wired
on the dolt, embeddeddolt, uow and http legs: a record created with the
flag on and updated with it off mints nothing and keeps its
current_revision. Every other flag-off case uses a legacy record, which
the fence stops first, so with RecordVersionInTx's gate removed this is
the only case that fails, on all four legs. That gate is the single entry
for every production update-shaped mint, so the one update arm covers
label and close writes too.
- The sqlmock pin of the statement (version_history_preenable_scan_test.go)
and the journal-completeness exemption comment follow the new SQL.
- The createbatchequiv issues_updated_at goldens of small, depadd,
import458 and import458-reject-stale are re-recorded. They pinned the
wall-clock bump, so each row minted a second time (eq-n2; eq-db1 and
eq-dl; eq-b3 and eq-b250) had dropped out of the compared set; CI's
embedded and server legs both printed the new digests. Recorded on
embedded Dolt, the fix-reverted tree reproduces every committed golden
byte for byte, HEAD moves only these four digests, and its rows equal
the history-off rows in every scenario. GoldenDirEnv's comment lists it
as the goldens' third deliberate change.
- The new embedded test has its line in the storage shard manifest
(gen_embedded_storage_shard_manifest.py 40 --weights=duration --write),
so TestStorageEmbeddedShardManifestGeneratorNotStale stays green. It sits
after TestEmbeddedEveryAcceptedLifecycleMutationMintsOneVersion rather
than at the end of the file, where #7646 appends its own test, so the two
PRs still merge without a conflict in that file.
Docs:
- CHANGELOG: the feature's two entries under ### Fixed described fixes to a
switch no released bd has. One ### Added entry replaces them, covering
bd versions, the versioned-history.enabled switch and its per-store
semantics, the pre-enable check, the single-writer caveat, migration 0071
and the bd version <arg> refusal.
- The bd versions help, its recording-off refusal and empty-listing note,
and the opening paragraph of the configuration doc's Versioned Issue
History section now state the rule the pre-enable refusal prints: a bead
participates if it was created, or entered the issues plane (a wisp
promoted or made persistent), while recording was on.
bd version: the "did you mean bd versions" refusal now runs after the
command's metrics event is created, like the other in-RunE argument
refusals, so a mistyped bd version <id> is counted as a version invocation
instead of going uncounted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
---------
Co-authored-by: Jim Wordelman <mayor@quad341.uk>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* schema+storage: restore 0068, move participation_generation to 0070 (be-blvmg)
MAYOR RULING 2026-09-29 on tracker be-waare: migration 0068 shipped to
origin/main as attribution_status-only (be-v33pa). be-h89oq's lineage had
appended participation_generation steps 4-5 to that same file while it was
still unmerged, which check-migration-hygiene.sh Check C correctly rejects
once 0068 is frozen on main. This restores 0068 to origin/main's exact
content and re-homes the participation_generation column (issues + wisps,
design section 16.3 steps 4-5, be-dt74u amendment) in a new migration 0070,
with its clone-local ignored/0028 twin for wisps. Ports back the
participation_generation write-fence consumer code (RecordVersionInTx in
internal/storage/issueops/version_history.go and its callers) and the
dualwrite contract tests that exercise it.
RED: the CLI-bundle direct-DDL override for 0070's guarded PREPARE/ALTER
pair is not yet registered in cli_migrations.go, so
TestBundleMigrationsWithPreparedALTERAreOverriddenOrJustified,
TestMigration0070AddsParticipationGeneration, and
TestAllMigrationsSQLUsesDirectDDLForKnownCLIIncompatibilities fail --
correctly: a fresh CLI-built bundle would silently omit the column
(dolthub/dolt#11345) while a runtime-migrated store has it.
git diff origin/main -- internal/storage/schema/migrations/0068_*.sql is
empty, confirming 0068 is untouched.
Agent-Signature: model=claude-sonnet-5; reasoning=high
* schema: register CLI-bundle direct-DDL override for migration 0070 (be-blvmg)
GREEN: adds cliMigration0070AddParticipationGeneration and its dispatch
entries (cliCompatibleMigrationSQL, cliSubstituteAssumesWispTables), the
same pre-2.3 Dolt CLI PREPARE/ALTER escape hatch 0067's wisps.current_revision
and 0068's attribution_status already use (dolthub/dolt#11345). Makes
TestBundleMigrationsWithPreparedALTERAreOverriddenOrJustified,
TestMigration0070AddsParticipationGeneration, and
TestAllMigrationsSQLUsesDirectDDLForKnownCLIIncompatibilities pass: a
fresh CLI-built bundle now carries participation_generation on both
issues and wisps, matching what a runtime-migrated store gets.
scripts/check-migration-hygiene.sh checks A-D pass; 0068 remains
byte-identical to origin/main.
Agent-Signature: model=claude-sonnet-5; reasoning=high
* build: bazel-sync BUILD.bazel for migration 0070 files (be-blvmg)
make bazel-sync (gazelle) picked up two files the RED commit added that
the hand-ported BUILD.bazel hadn't listed yet: 0070's embedded .up.sql in
the go_library embedsrcs and migration_0070_add_participation_generation_test.go
in the go_test srcs.
Agent-Signature: model=claude-sonnet-5; reasoning=high
* test(feat): red — Fix: enable history before fixtures in TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit — PR #6943's §16.2b write fence leaves its flag-off neighbor legacy, so the delete mints 0 rows (stacked on 44418b3) (refs be-fyaja)
* feat: green — Fix: enable history before fixtures in TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit — PR #6943's §16.2b write fence leaves its flag-off neighbor legacy, so the delete mints 0 rows (stacked on 44418b3)
(refs be-fyaja)
* test(conformance): pin that a wisp reaching the issues plane begins its history (be-31mnz)
Review feedback on #6943, blocker 1: with the flag on, a promoted wisp is
never versioned. None of the five RunParticipationGeneration* cases reaches
a promotion, so nothing caught it.
Two contract cases, wired on all three legs:
- RunParticipationGenerationWispPromotionBeginsHistory: create a wisp with
the flag on, promote it, and require a stamped participation_generation,
one version row, and +1 on the next update.
- RunParticipationGenerationWispPersistenceMoveBeginsHistory: the same
check for a persistence-mode update (bd update --persistent). This mints
at a different site than promotion on every leg: the guarded update's one
end-of-update mint on dolt and embeddeddolt, and
MoveIssuePersistenceInTx's own on uow.
"Wisp" is in the names because this contract already says "promoted" in
R2.3's sense (ProceedsForPromotedRecord), which is a different operation.
The fixture gains CreateWisp, PromoteWisp and MovePersistent closures, and
each leg's FixtureKitIsWired checks them.
Red at this commit on the embedded leg: after the arrival there are 0 rows
and participation_generation is NULL, and after the update there are still
0 rows. A flag-on durable create goes 1 -> 2 in the same store.
* fix(issueops): mint a wisp's first issues-plane version create-shaped (be-31mnz)
Review feedback on #6943, blocker 1. A promotion, or a persistence move out
of the wisps table, inserts a new issues row. A wisp never declares
participation (FR-8), so that row's participation_generation is NULL. Both
sites minted through the update-shaped RecordVersionInTx, and the section
16.2b fence read the NULL as legacy and skipped the mint. Nothing stamps the
column later, so every later update skipped too, and a record created with
versioned history on was never versioned.
These sites now use RecordVersionForCreateInTx, which stamps the column and
mints version 1, as a create on the issues plane does:
- PromoteFromEphemeralInTx (promote.go).
- MoveIssuePersistenceInTx's move out of the wisps table.
- ExecuteUpdate's one end-of-update mint (execution.go), when its
persistence patch did that move. This is the site bd update --persistent
reaches on the dolt and embeddeddolt legs, and the review did not list
it. PersistenceMoveResult.EnteredIssuesPlane tells ExecuteUpdate which
entry point to use.
One site the review named stays update-shaped on purpose:
MoveIssuePersistenceInTx's same-plane repair, which clears a stray wisp
flag on a row already in issues. That row keeps its own
participation_generation. A row created with the flag on still mints. A
legacy row stays legacy, because a repair is an ordinary write and R2.3
says an ordinary write does not promote it. A create-shaped mint there
would stamp the legacy row and start versioning it.
* docs(schema): 0070 must precede turning versioned history on (be-31mnz)
Review note on #6943 (schema skew). The write fence reads
participation_generation on every flag-on mint of an issues-plane row. On a
store that has not applied 0070 the read fails, and the mutation fails with
it instead of skipping. The migration header now says so, and says that the
flag-off path (the default) returns before the read, so a store below 0070
writes exactly as before.
Comment only. 0070 is not on main, so check-migration-hygiene's frozen-file
check does not apply to it, and no test pins its bytes.
* test(dolt): a persistence repair keeps the row's own participation (be-31mnz)
Pins why MoveIssuePersistenceInTx's same-plane repair stays update-shaped
while promotion and a move out of the wisps table became create-shaped (the
previous commit). The repair clears a stray wisp flag on a row that already
lives in issues, so the row keeps its own participation_generation.
TestPersistenceRepairKeepsTheRowsOwnParticipation runs the repair with
versioned history on for a legacy row (created with the flag off) and a
participating row (created with it on), through both repair entry points:
MoveIssuePersistenceInTx and a guarded update with a persistence patch. They
mint at different sites. The legacy row must stay NULL and mint nothing,
since R2.3 says an ordinary write does not promote it. The participating row
must mint one version. participation_generation must not change in either
case.
It fails if the repair mint is create-shaped, which would stamp and start
versioning the legacy row.
* test(dolt): a delete's rewrite of a legacy neighbor mints nothing (be-31mnz)
Folded in from bee's R1 on #6961, note 1. Once
TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit started creating
its neighbor with history on, nothing covered a delete whose neighbor was
created with history off. Under the section 16.2b fence, the expected result
for that case is different: the rewrite still runs, but it mints nothing.
TestDualWriteDeleteSkipsALegacyNeighborsRewrite creates the fixtures with
history off, turns history on, and force-deletes the cited target. It then
checks four things: the rewrite ran (ReferencesUpdated=1), the neighbor has
no issue_versions rows, its participation_generation is still NULL, and
dolt_status is clean for issue_versions, store_epoch and issues.
* test(embeddeddolt): batch-created rows are stamped with the participation generation
A batch create writes its rows first and mints each created row's first
version last, after the creation-time edges land. The mint has to stay
create-shaped for rows the batch inserted (stamping participation_generation
from the store epoch) and update-shaped for rows it only upserted over
(skipped while the row is a legacy row), so the per-row isNew has to survive
the deferral to the batch's final mint pass.
Pin that on the embedded engine:
- brand-new explicit-id rows are stamped with the store epoch and get one
version row each, and match the same input run one row at a time with the
batch-create fast paths off (5 rows, and 250 rows across three INSERT
statements);
- a legacy row the batch upserts over keeps a NULL participation_generation
and gets no version row, while the new rows beside it are stamped;
- with versioned history off, no row is stamped and no version row is written.
* ci(bazel): enroll the participation-generation tests in the embedded shards
The embedded-Dolt shard manifest has to name every top-level Test* in
internal/storage/embeddeddolt, or the exact-once coverage check fails.
The two participation-generation fence tests were written before that
check landed on main, and the batch-create stamping test is new, so none
of the three is listed yet. Add them to the 15-shard block as the
generator's incremental output: three inserted lines, no existing
assignment moves.
Also list the new batch-create test file in the embeddeddolt_test srcs,
in sorted position, so the Bazel target compiles it alongside the Go
build. Its imports are already among that target's deps.
Rebase note (maintainer): on current main the embedded storage manifest
uses a 40-shard block; the generator's incremental output placed these
three tests in shards 18, 19 and 39 and re-sorted one existing shard-12
line.
* fix(issueops): keep a created row's updated_at when its first version is minted
Minting a version is bookkeeping. It must not change a user-visible column
of the row it versions.
The create-shaped mint stamps participation_generation with an UPDATE of the
issues row. issues.updated_at is ON UPDATE CURRENT_TIMESTAMP, so an UPDATE
that changes any other column and does not name updated_at rewrites it with
the clock. Before the stamp, a row's first mint left current_revision at its
column default of 1, so the UPDATE changed nothing and the clause never
fired. The stamp moves participation_generation from NULL to the store
epoch, so the clause fires on every row whose first version is minted and
replaces the updated_at an import supplies.
Set updated_at to itself in the stamp, as the blocked-state recompute in
issueops/blocked_state.go already does, so the timestamp the row was created
with survives. Add a regression that batch-creates rows with a supplied
updated_at and requires both the stamp and the unchanged timestamp.
* test(createbatchequiv): re-record the digests the participation-generation fence moves
The fence does not re-mint rows that predate the stamp: a row whose
participation_generation is still NULL gets no new version when a batch
touches it. Main mints one, so six recorded entries move.
The issue_versions entry of five scenarios loses the versions main mints
for rows that predate the stamp: three rows in small, all eleven in
depadd, all fifteen in waitsfor, four in import458 and two in
import458-reject-stale. In depadd, eq-db1 and eq-dl are the only rows
main mints more than once, and each of those mints moves their updated_at
off the fixture date. The fence skips them, so the two rows keep the
fixture date and join the issues_updated_at entry.
No other table, list or counter digest changes, and the fast and per-row
bodies already agree in every scenario. The digests were recorded with
the embedded backend. The doc comment on GoldenDirEnv now says which
entries were re-recorded.
* test(storage): waive the participation-generation contracts on the http leg
main's #7247 (6d21d337ad, "a served http conformance leg") registered a
fourth leg, http, after this PR's original base. The PR's seven
RunParticipationGeneration* entrypoints are neither wired nor waived there,
so TestEveryLegWiresEveryRoleContract/http fails on the rebased branch.
ParticipationGenerationFixture toggles the store's own versioned-history
write flag and reads the raw participation_generation column back: store
write-fence bookkeeping (design §16.2b), not a publicops role the HTTP
client serves. Waive the seven cases on http with a named reason, the same
waiver the donnabox fork carries (09e7ce05af), and keep the gap visible
until a supported HTTP surface is designed and tested.
go test ./internal/storage/ -run TestEveryLegWiresEveryRoleContract now
passes on dolt, embeddeddolt, http and uow.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(issueops): decide the fence's plane by the table that holds the row
recordVersionInTx chose the plane from the row's flags (IsWisp: Ephemeral
|| NoHistory) and then read participation_generation from the issues table
only. A wisps-TABLE row can carry neither flag, so it passed the IsWisp
return and the issues read failed with sql.ErrNoRows, aborting the whole
mutation whenever versioned history is on. Two producers:
- bd mol squash clears an ephemeral root's flag in place
(UpdateIssue {"wisp": false}, after the root's close, in the squash's
one transaction); update.go and the uow repository's Update both mint
after it unconditionally.
- import's "wisp_plane" marker (WispPlaneOverride = &true, flags false)
routes the row to wisps, and the batch create mints it create-shaped.
On origin/main the same paths do not fail but mint a stray issue_versions
row for a wisps-table row, an FR-8 leak (wisps are never versioned).
Fix: no issues row means nothing to version. ErrNoRows on the
participation_generation read now returns nil (no version, no error) for
update- and create-shaped calls alike. That read is the right signal and
IsActiveWispInTx is not: GetIssueInTx has already resolved the row, so
ErrNoRows on the issues read can only mean "not in issues", which is
exactly the question the fence has to answer before it stamps or advances
an issues row. It costs no extra query. IsActiveWispInTx asks the inverse
question ("is it in wisps?") with one more query per mint, and it folds
every error, including a transient one, into "not a wisp".
Tests come first, as three new conformance contracts with three new
ParticipationGenerationFixture hooks (ClearWispFlag, SquashWispRoot,
CreateUnflaggedWisp). They are wired on the dolt, embeddeddolt and uow legs
as subtests of each leg's TestParticipationGenerationFence (no new
top-level test, so the shard manifests do not change) and waived on http
with participationGenerationRawStoreWaiverReason:
RunParticipationGenerationWispFlagClearMintsNothing (create wisp,
UpdateIssue {"wisp": false}: no error, 0 versions)
RunParticipationGenerationWispRootSquashMintsNothing (close +
UpdateIssue {"wisp": false} in one transaction: no error, 0 versions)
RunParticipationGenerationUnflaggedWispCreateMintsNothing (CreateIssues
with WispPlaneOverride=&true, flags false: no error, 0 versions)
Red before the fix, green after, run both ways:
embeddeddolt (BEADS_TEST_EMBEDDED_DOLT=1): all three FAIL with
"versioned history: read participation_generation for pg-...: sql: no
rows in result set"; all three PASS after.
uow: all three FAIL with the same error; all three PASS after.
dolt (BEADS_TEST_DOLT_SERVER=local): WispRootSquash and UnflaggedWispCreate
FAIL with the same error; both PASS after. WispFlagClear passes both
ways on this leg. The store-level wisp update (updateWisp) runs in a
transaction versioned history never scopes, so it never reaches the
mint. For the same reason the leg's SquashWispRoot hook turns the events
journal on for its one transaction: that pins the wisp writes to the
scoped regular transaction, as in a journal-enabled workspace, so that
case does reach the seam.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(issueops): a create stamps participation even when the row is flagged no-history
A create-shaped mint (RecordVersionForCreateInTx) of a brand-new
ISSUES-TABLE row that carries NoHistory or Ephemeral returned at the IsWisp
check before the isCreate stamp, so participation_generation stayed NULL
although the row was created with versioned history on.
Import produces exactly that row: bd-r9uce keeps a promoted no-history
wisp's durable row on the issues plane with its stray no_history=true
(import_shared.go applyImportWispPlane: WispPlaneOverride = &false). When
bd update --persistent later repairs the flag, it is a same-plane normalize
whose mint is update-shaped by design (persistence.go: "A row created with
the flag on proceeds; a legacy row stays legacy"). The NULL column made the
fence read the row as legacy, so the repair and every later update were
fenced and the row was never versioned. origin/main versions it after the
repair (0, then 1, then 2 rows).
Fix: on a create-shaped call, a flagged row that the issues table holds
gets participation_generation stamped from store_epoch.epoch, the same
source the minting stamp uses, read in the same transaction. No version is
minted and updated_at is kept (SET ..., updated_at = updated_at), then the
call returns. Update-shaped calls on flagged rows still return before any
read. The table check from the previous commit now runs ahead of the IsWisp
branch for create-shaped calls, so a flagged wisps-table row (the common
wisp create) still mints and stamps nothing. That costs a create-shaped
call on a flagged wisp one primary-key miss on issues, and only while
versioned history is on. The store_epoch read/seed moves into
readStoreEpochInTx so both stamps share it.
Tests first:
- New conformance contract
RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation and
hook CreateNoHistoryIssue. Wired on dolt, embeddeddolt and uow as a
TestParticipationGenerationFence subtest and waived on http. With
history on: create {NoHistory: true, WispPlaneOverride: &false} gives
participation_generation non-NULL and 0 versions. The persistent repair
(MovePersistent) then gives 1 version, and an update-shaped edit
(MutateExisting, a title edit) gives 2.
- New subtest
TestCreateBatchParticipationGeneration/NoHistoryRowIsStampedUnversionedAndKeepsTheCallersUpdatedAt
(embeddeddolt): a batch of such rows with a supplied updated_at comes
out stamped, unversioned, and with updated_at unchanged.
Red before the fix, green after, run both ways:
dolt (BEADS_TEST_DOLT_SERVER=local), embeddeddolt
(BEADS_TEST_EMBEDDED_DOLT=1), uow: the contract FAILS on all three legs
("participation_generation for pg-no-history-create is NULL ...", then
"= 0 after the persistent repair, want 1", then "went from 0 to 0 ...
want exactly +1"). It PASSES on all three after.
embeddeddolt subtest: FAILS before the fix ("store_epoch has no row after
the batch, so nothing stamped the 5 rows"). With the fix minus the
updated_at = updated_at clause it FAILS on every row's updated_at. It
PASSES with the full fix.
No new top-level Test*, so the shard manifests do not change. The
createbatchequiv goldens are unchanged: the dolt and embeddeddolt
equivalence tests pass.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs: fix comments the rebase left stale
Comment-only.
- createbatchequiv.GoldenDirEnv said "One deliberate behavior change since
... nothing else moved" and then listed a second re-record, the
participation-generation fence's. It now says there are two deliberate
changes, puts each in its own paragraph, and scopes "nothing else moved"
to apply.json, the only golden the first change touched.
- issueops CreateIssueResult.isNew and deferredVersion still described one
write path. After main's #7205, a row written by deferredCreates'
multi-row INSERT reaches finishCreateIssueInTx(..., true) directly
(create_batch_cache.go flush) and never passes through InsertIssueIfNew
or CreateIssueInTxWithResult. isNew is InsertIssueIfNew's result on the
per-row path and always true for a multi-row-INSERT row. deferredVersion
is filled from both paths.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(issueops): pin the create/update shape split in the version guard
TestEveryVersionedEntryPointMints counts RecordVersionInTx and
RecordVersionForCreateInTx as one seam. A create-shaped site that fell back
to the update-shaped entry therefore stayed green, though the fence then
reads the new row's NULL participation_generation as legacy and the record
is never versioned. The reverse case also stayed green: an update path that
reached the create-shaped entry would stamp an existing legacy row and
promote it, which R2.3 forbids.
Add the split to the structural guard. It is two small tests over the same
journalscan fixpoint and mintVersion edge discipline, with no AST changes:
- TestCreateShapedEntryPointsMintCreateShaped: the create-shaped mint sites
(finishCreateIssueInTx, CreateIssuesInTxWithContext,
PromoteFromEphemeralInTx, moveIssuePersistenceInTx, executeUpdate) must
each call RecordVersionForCreateInTx themselves. A delegate is not enough
here, because executeUpdate runs its move with mintVersion=false and a
batch switches finishCreateIssueInTx's mint off at run time. Every
create-shaped entry point, the delegates and #7205's
deferredCreates.flush included, must reach it.
- TestUpdateShapedEntryPointsNeverMintCreateShaped: every other
versionedEntryPoint must not reach RecordVersionForCreateInTx. The
exception is ApplyBatchInTx, which runs create and update items together
and is listed as mixed with a reason.
Mutation-checked, each probe reverted afterwards. executeUpdate's
EnteredIssuesPlane mint, PromoteFromEphemeralInTx's mint, or the batch's
deferred create-shaped mint switched to RecordVersionInTx: each fails the
create half. update.go's end-of-update mint switched to
RecordVersionForCreateInTx: fails the update half for UpdateIssueInTx and
every entry point that writes through it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(issueops): hold the dual-shape mint sites to both halves of the split
f006c871c5 listed executeUpdate, moveIssuePersistenceInTx,
finishCreateIssueInTx and CreateIssuesInTxWithContext (and the
ExecuteUpdate/MoveIssuePersistenceInTx/create wrappers that delegate to
them) as create-shaped, so TestUpdateShapedEntryPointsNeverMintCreateShaped
skipped them. Each one also mints update-shaped, on its existing-row or
same-plane branch, which is the common path: a guarded update of an
existing row, the bd update --persistent repair of an issues-plane row's
flags, a create or batch create that resolved to a row already there.
Switching that branch to RecordVersionForCreateInTx stamped a legacy row
out of legacy (R2.3), and every guard stayed green.
Split the lists by what each function actually mints:
- versionCreateShapedMintSites keeps only the pure create-shaped site,
PromoteFromEphemeralInTx. It must call RecordVersionForCreateInTx and
must not call RecordVersionInTx.
- versionDualShapeMintSites names the four, each with its two branches.
TestDualShapeMintSitesCallBothEntries requires each to call BOTH entries
directly. A delegate does not count, for the same mintVersion=false and
DeferVersionMint reasons as before.
- versionCreateShapedEntryPoints keeps PromoteFromEphemeralInTx and
deferredCreates.flush, which passes isNew=true for every row.
- versionDualShapeEntryPoints replaces versionMixedShapeEntryPoints. It
holds ApplyBatchInTx and the create, persistence-move and guarded-update
entries that delegate to a dual-shape site, each with a reason. Each must
reach both entries transitively.
The update half skips the create-shaped and dual-shape entry points, as
before. The update-shaped branch inside a dual-shape site is now the new
test's to pin.
Mutation-checked in a throwaway worktree. Switching the update-shaped mint
to RecordVersionForCreateInTx at execution.go:301, persistence.go:97,
create.go:260 or create.go:499 now fails
TestDualShapeMintSitesCallBothEntries for that site. Before this commit,
the whole issueops package stayed green under each of these switches.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(httpclient): run the participation-generation fence over the served wire
edd3b72a1a waived all eleven ParticipationGeneration contracts on the http
leg, saying the client had "no write flag to toggle and no raw column to
read". That reason was wrong. served_dualwrite_history_test.go already
flips the reference store's VersionedHistoryConfigurer and reads its raw
columns, with the client driving the mutation. The waiver also hid the
one harness that runs the fence behind the update a connected workspace
actually sends. Every store leg's MutateExisting is store.UpdateIssue,
but the served Lifecycle.Update reaches the guarded update,
ExecuteUpdate.
Add served_participation_generation_test.go on the same pattern:
- Bound to the client: Mutate is Lifecycle.Create, MutateExisting is
Lifecycle.Update, MovePersistent is the persistence-mode
Lifecycle.Update that bd update --persistent sends, and PromoteWisp is
issueops.Promote over the client's Reader/Lifecycle/Commenter, the
entry bd promote dials over http.
- Bound to the reference store, as before: SetFlag, the CreateWisp seed,
and the raw reads.
TestServedParticipationGenerationFence runs seven cases:
CreateWithFlagOnStampsAValue, CreateWithFlagOffLeavesLegacyNull,
SkipsUpdateOnLegacyRecord, ProceedsForPromotedRecord,
FenceIgnoresSchemaSkewHatch, WispPromotionBeginsHistory and
WispPersistenceMoveBeginsHistory. All seven pass, and no case turned up a
server-side fence bug.
Four cases stay waived, now with a reason that names the actual wire gap
(participationGenerationWireGapWaiverReason):
- WispFlagClearMintsNothing: the in-place {"wisp": false} is an untyped
UpdateIssue, and IssuePatch.Persistence moves the row instead.
- WispRootSquashMintsNothing: it needs RunInTransaction. That and
UpdateIssue are both on the client's unsupported allowlist (D8).
- UnflaggedWispCreateMintsNothing and
NoHistoryIssueCreateDeclaresParticipation: both need WispPlaneOverride,
which every create shape on the wire drops
(roleIgnoredCreateIssueMembers).
The new file is listed in httpclient_test's srcs. The served lane deals
unpinned tests round-robin, so no shard manifest names it.
Mutation-checked in a throwaway worktree. With execution.go:301 (the
guarded update's update-shaped mint) switched to
RecordVersionForCreateInTx, SkipsUpdateOnLegacyRecord and
FenceIgnoresSchemaSkewHatch fail here ("version row count for
hpg-legacy-skip went from 0 to 1"). The embeddeddolt and uow
Participation|DualWrite|Version suites stay green under the same probe.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(conformance): an update never stamps a legacy no-history row
7c00d65fa6 made the seam write participation_generation on a flagged
(NoHistory or Ephemeral) issues-table row when the call is create-shaped.
Only the early `if IsWisp(issue) && !isCreate { return nil }` keeps an
update-shaped call out of that branch, and nothing pinned it. The new
contract and its subtest covered only the positive, create-shaped side.
With the early return dropped, an ordinary update stamped a legacy
no-history row out of legacy (R2.3), and every suite stayed green.
Add RunParticipationGenerationLegacyNoHistoryIssueStaysLegacy beside
NoHistoryIssueCreateDeclaresParticipation as its negative twin:
1. Create the no-history issues-table row with the flag OFF.
2. Turn the flag on and run MutateExisting. participation_generation must
stay NULL, with 0 versions and current_revision unchanged.
3. Run MovePersistent, the bd update --persistent repair that clears the
flag in place. The repair is update-shaped too, so the same three
things must still hold.
Wired on all four legs: dolt, embeddeddolt, uow and http. On http the
case exercises the client's Lifecycle.Update and persistence update.
Their precondition, the flag-off no-history create, is seeded through
the reference store, because no client create can land that row in the
issues table. That gap is also why the case whose SUBJECT is that create
stays waived on http.
Mutation-checked in a throwaway worktree, with the early return made
`if false && IsWisp(issue) && !isCreate`. The new case fails on all four
legs and is the only case that fails:
"participation_generation for pg-no-history-legacy = 1 after an
update-shaped mutation with the flag on, want NULL" (dolt server leg,
embeddeddolt, uow and http). At tip it passes on all four.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(issueops): say which table and which mint the fence comments mean
Comment and doc corrections. No code changes.
- RecordVersionForCreateInTx's doc comment covered a flagged issues-table
row but not a wisps-table row. A row the wisps table holds mints and
stamps nothing, whatever its flags say: there is no issues row to stamp
(FR-8). That holds for an ordinary wisp create and for import's
unflagged "wisp_plane" row.
- The no-history stamp branch said the bd update --persistent repair mints
update-shaped "(MoveIssuePersistenceInTx)". That is true only on the
unit-of-work path. On dolt and embeddeddolt the repair goes through the
guarded update: executeUpdate runs moveIssuePersistenceInTx with
mintVersion=false and mints once at its own end. The fixture's
MovePersistent doc already says this.
- VERSIONED-BEADS-WRITE-PATHS.md row 13 still credited the whole wisp
exclusion to `RecordVersionInTx returns on IsWisp` and called every case
a NO-OP. After ec52d29030, the table holding the row decides its plane:
only an update-shaped call on a flagged wisp returns on IsWisp. Every
other wisps-table row, including an unflagged one, is excluded by the
issues-table participation_generation read, which finds no row. After
7c00d65fa6, a create-shaped call on a flagged issues-table row is
stamped but not versioned, so the row says that too.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(conformance): the wisps-table cases check the row is still a wisp
runWispTableRowMintsNothing asserted 0 versions but never checked its own
precondition, that the wisps table still holds the row. Suppose a step
moved the row onto the issues plane through an update-shaped mint. That
mint would hit the new row's NULL participation_generation and be fenced,
so the count stayed 0 and the case passed without saying anything about
a wisps-table row.
- Add an InWispsTable hook to ParticipationGenerationFixture and bind it
on dolt, embeddeddolt and uow as a raw wisps-table count. The
wisps-table body now Fatals if the row is not in the wisps table after
its steps. Each leg's KitIsWired test checks the hook. On http it
stays nil with the other wisps-table hooks, whose cases are waived
there.
- The dolt ClearWispFlag hook now bites. A bare store.UpdateIssue on a
wisp goes through updateWisp, whose transaction versioned history never
scopes. So WispFlagClearMintsNothing passed on dolt with or without the
ec52d29030 fix, as that commit's message admits. The hook now runs the
lone flag clear in a RunInTransaction with the events journal on: the
journal-enabled shape the SquashWispRoot hook already uses.
- Both hooks go through a new withEventsJournal helper. It restores the
store's previous journal setting rather than unconditionally setting it
to false afterwards, which assumed the store started with the journal
off.
Mutation-checked in throwaway worktrees:
- With version_history.go at ec52d29030^, dolt's WispFlagClearMintsNothing
now fails ("read participation_generation for pg-flag-clear: sql: no
rows in result set"). It used to pass there.
- Embedded ClearWispFlag rerouted as a flag-off persistence move followed
by a flag-on title update: the case fails on the new precondition ("is
not in the wisps table after flag-clear"). With the precondition
disabled, the same probe passes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(storage): review fixups for the participation_generation fence
The review of d17b716115 approved the PR with no required changes and
raised four minors and three nits. Each one below says what changed and
why, or why it did not.
Minor 1, the upsert create's new-or-existing choice was untested. The
unit-of-work create that is not CreateOnly (bd batch, bd todo, tracker
sync and mol port) inserts through an upsert, and db.Insert's existed
probe picks the mint's shape; forcing it either way shipped green. The
new uow TestParticipationGenerationUpsertCreate pins all three outcomes:
a new row is stamped and begins its history, a legacy row the upsert
resolves to stays legacy with no version, and a participating row mints
exactly one more. No served-route case is added because every served
create is CreateOnly (uow createParams), so the http wire cannot reach
this branch. The cmd/bd proxied-server batch and todo creates call this
same use-case method.
Minor 2, an update-shaped mint still lets issues.updated_at move
through ON UPDATE CURRENT_TIMESTAMP. Not changed here. The maintainer
listed it on the PR as follow-up (2), and the approving review of
d17b716115 accepted carrying it as a follow-up. It does not change
the fence's contract as pinned.
Minor 3, the depadd and waitsfor goldens had been re-recorded to zero
issue_versions rows. Their seeds run with history off, so every seeded
row was legacy and the harness stopped checking the dependency-add,
close and reopen mints. Both scenarios now stamp their seeded
issues-table rows after the seed (stampParticipation; wisps stay
unstamped). Their goldens are back to main's pre-fence files byte for
byte: depadd mints 11 version rows and waitsfor 15. The fenced legacy
outcome stays pinned by small, import458 and import458-reject-stale. A
run scenario that mints no version row now fails rather than recording
an empty digest.
Minor 4, PromoteFromEphemeralInTx always minted create-shaped. When the
issues plane already held the id (the dual presence GH#4455 records),
its upsert resolved to that row and the create-shaped mint stamped a
legacy record (R2.3). It now keeps InsertIssueIfNew's isNew and mints
update-shaped for an existing row, as finishCreateIssueInTx does. The
version guard lists it as a dual-shape mint site and entry point, and
PromoteOverDualPresenceKeepsLegacy pins the behavior at run time.
Nit 1: with versioned history off, db.Insert skips the existed probe,
since both mint entries return before reading anything. A create costs
the round trips it did before the fence.
Nit 2: the MINT COST comment now counts the fence read (about 6 to 7
round trips) and no longer says the snapshot reads current_revision;
the fence read can select it for #6379's ordinal seed. Moving that read
now would only add a column nothing consumes yet.
Nit 3: the http leg's participation-generation wire-gap waiver opens as
PENDING and names the wire mutation that would retire each case.
Validation, in a scrubbed env with -tags=gms_pure_go on embedded and
server Dolt (all pass, none skipped):
- uow: TestParticipationGenerationFence, its FixtureKitIsWired check
and TestParticipationGenerationUpsertCreate with its 4 subtests.
- embeddeddolt: the create-batch equivalence parts (small/depadd,
apply/waitsfor), the parts-coverage guard, the large scenarios, and
the fence and kit.
- dolt: TestCreateBatchFastPathsMatchPerRow_Dolt, the fence,
FenceIgnoresSchemaSkewHatch and the kit.
- httpclient: TestServedParticipationGenerationFence.
- TestEveryLegWiresEveryRoleContract, the issueops structural guards,
and the issueops, storage and domain/db packages.
Eleven mutants, graded in 13 runs, each fail the test meant to catch
them:
- upsert always create-shaped or always update-shaped;
- the probe guard inverted;
- promote always create-shaped or always update-shaped;
- the seed left unstamped;
- the dependency-add, close or reopen mint dropped;
- two on-disk single-entry promotes.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(storage): a wisp upsert must not stamp a legacy issues twin
domain/db's Insert chose the mint shape of its upsert (the create that
is not CreateOnly) from an existence probe of the target table. For a
wisps-table insert that probe asks the wrong plane: the seam snapshots
the issues table first (GetIssueInTx), so when the issues plane already
held the id as a legacy row, the wisp create took the create-shaped
mint and stamped and versioned that untouched twin. An ordinary wisp
write promoted a legacy record, which R2.3 forbids. bd mol port and the
proxied mol and wisp writers call CreateWisp this way. It is latent
until versioned history is enabled (#6661).
A wisps-table insert never creates an issues row, so it now mints
update-shaped, without the probe. The fence leaves a legacy twin alone,
a wisp-only id still mints nothing through either entry (FR-8), and a
participating twin mints the one version main already minted for it.
Insert's comment now records that last case: the dual presence
predates the fence, and this upsert does not refuse it the way
issueops' create path does.
TestParticipationGenerationUpsertCreate gains
WispOverLegacyIssuesRowKeepsItLegacy, which fails against the previous
dispatch (twin stamped, one version row). Also from review: the version
shape guard names the dual-shape site its parse cannot see, and the
row-lock exemption comment counts all three of the seam's UPDATE issues
statements.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
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.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* fix(bootstrap): cut the host part before stripping userinfo (mc-gcmer)
urlHostname stripped userinfo through the first "@" anywhere in the URL,
before cutting out the host part, so an "@" in a path, query or fragment
picked the host: https://my-dolt.example.com/x@github.com/path read as
github.com. isGitCodeRepoURL then called it a forge, and doltRemoteURL
rewrote what is really a Dolt remotesapi URL to git+https:// (the GH#3339
class). The SCP branch made the same split, so both
my-dolt.example.com:org/x@github.com:db and the local path
./backups/me@github.com:db read as github.com too.
Cut the host part first, then strip userinfo through its last "@":
- scheme URLs: the authority, ending at the first "/", "?" or "#". That is
the host net/url dials, and Dolt's earl.Parse hands scheme URLs to
net/url. Taking the last "@" matches net/url too, so
https://a@b@github.com/org/db is now a forge, as Dolt would dial it,
instead of going raw to the remotesapi client (the #4421 class).
- SCP: everything before the first ":", unless a "/" comes first (a local
path) - the split doltremote.FromGitURL makes.
TestIsGitCodeRepoURL gains the path/query/fragment-@, SCP path-@,
local-path-@ and last-@ cases, 7 of them red before this change, plus
userinfo controls in both URL forms that stay green.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bootstrap): scrub credentials from the Bootstrap failed message (mc-gcmer)
An unencoded "#" or "?" in a sync.remote password ends the URL's
authority early, so urlHostname no longer reads the remote as a forge and
bootstrap clones it as configured. The clone error then carries the URL,
password included, twice: sanitizeURL passes through a URL net/url cannot
parse, and Dolt's "invalid remote url:" repeats it. Scrub the error with
scrubURLCredentials where "Bootstrap failed:" prints it.
TestEmbeddedBootstrapCloneFailureScrubsCredentials pins this; it fails
against the pre-fix binary for both "pa#ss" and "pa?ss", and the new test
is registered in the embedded shard manifest.
Also add a forgeSyncRemoteForms row for multi-@ userinfo without a .git
suffix, so the routing pin covers a URL only its host can make a forge.
The row fails with the base urlHostname.
Review: PR #7616 synthesis F1 (minor) and F5 (nit).
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sqlbuild): bind time bounds as their UTC instant
BuildIssueFilterClauses bound every time bound (created/updated/closed/
started/defer/due, after and before) as tc.v.Format(time.RFC3339), which
keeps the value's offset. The columns hold UTC wall clock, and an engine
whose timestamp column carries no zone reads a literal's wall clock and
drops the offset, so a bound spelled +02:00 would compare two hours late.
Bind tc.v.UTC().Format(time.RFC3339): the same instant, spelled in UTC, at
whole seconds. Dolt already converts an offset literal to UTC and bd's
client resolves bounds to UTC, so no answer changes on any backend here;
this keeps the shared builder correct for every engine.
TestTimeBoundsBindTheUTCInstant pins all twelve bounds to the UTC spelling
of a +02:00 instant with a sub-second remainder.
Also correct the AfterCreatedAt comment, which justified the time.Time
cursor binding by a SQLite backend that no longer exists.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sqlbuild): bind the keyset cursor as its UTC instant too
Review fixups on #7655.
BuildIssueFilterClauses bound IssueFilter.AfterCreatedAt as the caller's
time.Time, unconverted. The embedded Dolt driver sends a time.Time as its
wall clock with no zone (vitess BuildBindVariable formats it as
"2006-01-02 15:04:05.000000"), and the columns hold UTC wall clock, so a
cursor in another zone paged from the wrong position there: the keyset
walk with +02:00 cursors re-delivers rows on embedded Dolt.
go-sql-driver/mysql converts to the connection's zone (UTC) first, so
server Dolt was unaffected. Bind filter.AfterCreatedAt.UTC(), still a
time.Time, and reword the comment, which claimed the driver carries the
instant. TestKeysetCursorBindsTheUTCInstant pins the cursor args of both
orders.
The httpapi query.timestamp comment and the
TestListFilterTimeBoundsAreNormalizedToUTC doc justified the route's UTC
normalization by the old sink behavior (formatting a bound in its own
zone). They now say sqlbuild binds every range bound in UTC and the
route's normalization is its own guard in front of that.
The CHANGELOG bullet gets a bold lead, covers the cursor, and drops the
blank line that made the Fixed list loose.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* wy-qlvlmf: test(cmd/bd): stop tests from mutating the host checkout's .git; guard it in TestMain
On 2026-10-16 a 'go test ./cmd/bd' run from a linked worktree rewrote the
host rig's shared .git/config (core.bare=true, extensions.worktreeConfig,
remote.origin.url replaced by metadata_test's fixture URL, user identity,
core.hooksPath) and its hooks dir, leaving every worktree of that clone
answering 'fatal: this operation must be run in a work tree' (r880).
Root causes, all one class — fixture git commands routed at the repository
the test process itself lives in instead of a fixture the test owns:
- TestRunApplyAllOK ran runApply(false) (a LIVE apply: hook reinstall,
hooksPath mkdir) with no fixture, against the package cwd's repo.
- runGitForBootstrapTest treated dir=="" as 'inherit package cwd'.
- doctor/fix setupGitRepoInDir swallowed git config failures non-fatally
and ran with whatever git routing env (GIT_DIR, GIT_WORK_TREE) leaked in.
Fixes:
- TestRunApplyAllOK / TestRunApplyDryRun now chdir into an isolated
git+.beads fixture (isolatedApplyFixture + runInDir).
- runGitForBootstrapTest: empty dir gets a neutral t.TempDir() cwd, never
the package cwd; env scrubbed of git routing vars.
- initGitRepoAt / doctor setupGitRepoInDir / doctor-fix setupGitRepoInDir:
refuse an empty dir, fail on ANY git error, scrub routing env.
- testMainInner scrubs git routing env process-wide at startup.
- TestMain's repo guard now also snapshots the checkout's own git state
(common .git/config, config.worktree, common hooks dir) and reddens the
run on any diff, naming the mutated file.
Guard vacuity check: a probe test writing one key into the checkout's
.git/config passes individually and reddens the suite via the guard.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/39013861275
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* test(cmd/bd): scrub doctor suites, keep git fences, key-level config guard (wy-qlvlmf)
Maintainer fixup on top of #7650 by cat, for the first review's three
majors, minor and nit, and three of the second review's minors.
- Doctor suites: the leaked-GIT_DIR vector was still open in
cmd/bd/doctor and cmd/bd/doctor/fix. Their four TestMains now unset
the repository-location env first (testutil.UnsetGitRepoLocationEnv),
and the three initGitTemplate copies plus
testutil.ForceRepoLocalHooksPath run git with a filtered env. With
GIT_DIR/GIT_WORK_TREE leaked at a decoy repo, the PR head wrote
core.hooksPath into the decoy and failed 120 doctor tests; with this
commit all three packages pass and the decoy stays byte-identical.
- Narrower scrub: the process-wide scrub also removed
GIT_CEILING_DIRECTORIES and the GIT_CONFIG_* fences that
tools/bazel/test_env.sh and scripts/ci/lib/test-env.sh set on purpose.
testutil.WithoutGitRepoLocationEnv removes only GIT_DIR, GIT_WORK_TREE,
GIT_COMMON_DIR, GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY,
GIT_ALTERNATE_OBJECT_DIRECTORIES, GIT_NAMESPACE and the legacy
GIT_CONFIG (which sends `git config` reads and writes to the file it
names, even under -C). Keys match exactly, so GIT_CEILING_DIRECTORIES,
GIT_CONFIG_GLOBAL and GIT_CONFIG_NOSYSTEM stay. Every helper that
built its own scrubbed env now uses it.
- Guard false reds: the TestMain guard compared the shared common config
byte for byte, so a sibling worktree's routine branch write failed a
passing run. It now diffs `git config --list -z` key by key.
branch.<name>.* keys, and a remote other than origin added or removed
whole, print a NOTE and leave the exit code alone. Any other key
(including origin appearing or disappearing, and a changed key of a
remote that exists before and after), any config.worktree change, any
hook file change or an unparseable config still fails the run.
- config.worktree: the guard also snapshots a main checkout's own
config.worktree, which sits in the common dir. With
extensions.worktreeConfig set its keys override the shared config, and
before this an escaped `git config --worktree` write there went
unreported.
- Report: changed keys are named with values redacted, deleted and new
files are reported as such, pre-run copies of the changed files are
saved (0700 dir, 0600 files) and their path printed, and a failure to
locate the checkout's git dirs prints a warning instead of disarming
the guard silently.
- doctor setupGitRepoInDir stat-checks its dir like the doctor/fix copy.
New tests: internal/testutil/git_env_test.go, and
cmd/bd/test_repo_git_guard_test.go (real-git fixtures for locating the
git dirs, classifying writes, config parsing and the report).
Validation: ./scripts/test.sh ./cmd/bd in a scratch clone with GIT_DIR
leaked at a decoy (ok; decoy and the clone's .git unchanged; guard
quiet); bazel test --config=ci for testutil, doctor, doctor/fix,
fmt_test and the new bd_test guard tests; make ci-pr-lint;
tools/bazel/go_srcs.py --check.
Second review: leaving GIT_CONFIG out of the scrub fails
TestWithoutGitRepoLocationEnvKeepsWrapperGitControls and
TestForceRepoLocalHooksPathIgnoresLeakedGitDir; the old main-checkout
config.worktree path fails TestLocateRepoGitDirs/main_checkout and the
new config.worktree case; treating origin like any other remote fails
the new origin added and removed cases. In a scratch main-checkout clone
with extensions.worktreeConfig set, a test that wrote
`git config --worktree user.email` into the checkout now fails the
suite (exit 1, an ERROR naming .git/config.worktree). bazel test
--config=ci passes for testutil, fmt_test and the bd_test guard tests.
Not in this commit: the same scrub in beads_test_env_enter
(scripts/ci/lib/test-env.sh) and tools/bazel/test_env.sh, which would
cover the packages outside cmd/bd that still write to the clone under a
hook-leaked GIT_DIR. That predates this PR and is left to a follow-up.
Co-authored-by: cat <cino@ghosttrack.com>
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: cat <cino@ghosttrack.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* feat(http): bd blocked over bd serve (blocked.list) through issueops.BlockedLister
`bd blocked` refused against an HTTP workspace: it called the legacy
GetBlockedIssues, which the HTTP backend stubs as unsupported. It now runs
one role on every route, and bd serve publishes that role.
- Role: issueops.BlockedLister.ListBlocked(BlockedRequest{ParentID, Labels,
LabelsAny, ExcludeLabels}) -> BlockedResult{Items}. One body,
internal/storage/issueops.ExecuteListBlockedInTx over the unchanged
GetBlockedIssuesInTx; labels normalized in the role (BlockedFilter);
Items never nil and in a total order (priority, created_at desc, id).
- Legs: DoltStore (read tx), EmbeddedDoltStore (read conn), uow (read unit
of work through the use case's GetBlockedIssues, so the
external-dependency uow decorator applies). Census: storage.DoltStorage
gains BlockedLister(); HookFiringStore passes it through (a read),
telemetry wraps it, uow.notifyingProvider, externaldeps.uowProvider and
httpapi.timedProvider build it.
- externaldeps.Store.BlockedLister is built over its own GetBlockedIssues,
so local `bd blocked` output is unchanged. Over a remote store it takes
the server's listing when the server advertises
policy.external_dependencies, else decorates the server's listing here
through EdgeReader and BatchGetter (decorateBlocked, factored out of
GetBlockedIssues).
- Wire: GET /v0/beads/blocked (listBlockedIssues; parent, label,
label_any, exclude_label) answering BlockedPage {items, has_more} with
the new x-go-type-pinned BlockedIssue schema, behind the new
blocked.list token. apigen and the wire-shape golden regenerated; the
golden diff is additive only, so wire_revision stays 2.
Config.BlockedLister is a required role, wired in bd serve.
- Client: httpclient.Store.BlockedLister dials through Store.dispatch, so
an older server is refused BEFORE the dial with *wire.CapabilityError
naming blocked.list. The legacy Store.GetBlockedIssues rides the role
(page and row cap applied to its answer) and leaves the unsupported
shell. Divergence ledger row F-blocked retired.
- CLI: `bd blocked` takes BlockedLister() from the store on the direct
routes and from the provider's BlockedListerSource on the proxied route;
runBlockedProxiedServer is deleted. --json output is the same rows in
the same order, [] when empty.
Tests: backend/conformance RunBlockedLister (10 cases: direct blocker,
child attributed to its blocked parent, closed blocker, wisp plane, pinned
status, parent filter, label filters with normalization, order, empty
slice, request not mutated) on dolt, embedded, uow and the served HTTP
client; httpapi handler tests (mapping, unknown/repeated params,
projection, capability); httpclient stub tests (pre-dial refusal naming
the token, encoding, projection, legacy door paging); skew and vocabulary
counts; TestE2E_BlockedOverHTTP (served `bd blocked --json` equals the
local command's after mapping ids and timestamps, member order included,
external blocker named, older-server refusal with no dial); corpus
gc-blocked re-marked and gc-blocked-parent added, both pending until the
reference server advertises blocked.list.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(blocked): pin server-side external decoration, refuse has_more, serve the legacy door over http
Review fixes for the blocked.list slice.
- Server-side external decoration is now pinned on the compositions bd
serve answers from. TestWrapUOWProviderBlockedListerNamesExternalBlockers
lists through the wrapped unit-of-work provider's own BlockedLister
accessor (the bd serve provider path) and requires an external-only row
and a mixed row to carry their external: refs; building that lister over
the inner provider fails it. TestServedBlockedListerCarriesExternalRefs-
WhenTheServerEnforces serves the store-shaped composition
(externaldeps.Store.BlockedLister, policy advertised) and requires the
operation's own answer, through the undecorated client role, to carry the
refs, and the client's decorated chain to return it unchanged; serving
the inner store's lister fails it.
- The client refuses an answer reporting has_more with the new typed
httpclient.TruncatedListingError instead of returning a short listing:
the operation has no cursor, and a caller reads a missing row as
unblocked. The legacy door inherits it.
- externaldeps.Store.GetBlockedIssues over an http store reads the extra
sources through the served roles (EdgeReader, BatchGetter) instead of the
raw GetIssuesByIDs / GetDependencyRecordsForIssues the http backend
refuses, and the decoration skips the source read when there is nothing
to load. The legacy door on the CLI chain (bd mol stale, the wisp
commands) now answers over http in both policy modes;
TestServedLegacyGetBlockedIssuesThroughTheDecorator pins it, paging
included. bd ready --explain still refuses on its other raw reads; the
CHANGELOG says so.
- Docs: the spec and the retired F-blocked ledger row state that the
listing is unpaged, bounded by the client's 32 MiB response limit
(refused, never read in part), and that has_more is refused.
- Contract: new cases for waits-for and conditional-blocks blockers, no
type exclusions (gate, epic), and a stale flag with no nameable blocker
(on the legs that can write the column: dolt, embedded; skipped
elsewhere with the reason). Order seeds explicit created_at values with
five rows tied on priority and created_at, two of them wisps, so only the
id tiebreak orders them; dropping the tiebreak now fails every run.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(blocked): bd blocked --flags, the blocked flag per id from stdin
`bd blocked --flags [--json]` reads ids from stdin, one per line (blank
lines and repeats ignored), and prints the blocked flag bd holds for each:
with --json, [{"id","is_blocked"}] in the order the ids were first given,
omitting an id that names no row on either plane, [] for no input. It is
the readiness column a consumer otherwise had to read with `bd sql`, so no
such consumer needs a local-only command.
It is the FLAG, not the listing: `bd blocked` narrows the stored flag to
rows it can name a blocker for, and --flags does not, so a row whose flag
is set with no nameable blocker reads true here and is absent from the
listing. Where the external-dependency policy applies, an unsatisfied
external: blocker sets the flag, as it keeps the row out of `bd ready`.
One library entry on every route: issueops.BlockedFlags over the route's
BlockingAnnotator (the store's accessor on dolt, embedded and HTTP, the
provider's on the proxied route). Over HTTP that is listBlockingAnnotations
with is_blocked behind dependencies.blocking.isBlocked; a server without
that token is refused before the dial, naming it. No wire change. The
listing's filter flags are refused with --flags rather than ignored.
Tests: TestE2E_BlockedFlagsOverHTTP (served JSON equals the local command's
after mapping ids to titles, unknown id omitted, repeat collapsed, [] on
empty stdin, filters refused; a stale-flagged row with no blocker reads
true and is absent from `bd blocked --json`, which fails if --flags is
derived from the listing; an older server's handshake refused naming the
token with no dial); TestProxiedServerBlocked/flags_reads_ids_from_stdin on
the proxied route; corpus gc-blocked-flags, pending until the reference
server advertises the token. CHANGELOG entry.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(blocked): bd blocked --flags --raw, the stored is_blocked column
`bd blocked --flags --raw [--json]` answers the stored is_blocked column
for each id read from stdin, exactly what reading is_blocked from the issues
and wisps tables returns, without the external-dependency policy: a row
blocked only by an unsatisfied external: ref reads false (the policy-aware
--flags reads true), and a stale flag reads true either way. Same output
shape as --flags. This lets a consumer move off a `bd sql` read of the
column with no change in what it reads. The default --flags is unchanged.
The role is taken from beneath every decorator: storage.UnwrapStore on the
direct routes, uow.UnwrapProvider on the proxied route. Over HTTP the
innermost store is the http client, whose annotation read is the server's
answer: against a server that does not advertise
policy.external_dependencies that answer is the column, and --raw is
served. A server that advertises it decorates the flag it answers, the v0
wire has no member asking it for the column, and the decorated flag cannot
be turned back into the column client-side, so --raw against such a server
is refused before the annotation read, naming the token, rather than
answered with the decorated flag. --raw without --flags is refused.
Tests: TestE2E_BlockedFlagsOverHTTP/raw_is_the_stored_column (served --raw
equals local --raw; the externally-blocked-only row reads true with --flags
and false with --raw on both; locally blocked rows agree; a stale-flagged
row reads true in both modes; --raw without --flags exits 1; a server
advertising the policy refuses --raw with no annotation request);
TestProxiedServerBlocked/flags_raw_is_the_stored_column; corpus
gc-blocked-flags-raw (pending until the reference server advertises
dependencies.blocking.isBlocked). Routing --raw through the decorated
annotator fails the e2e. CHANGELOG entry.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(changelog): bd blocked --flags --raw is for the local and proxied routes
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(blocked): give the e2e gate-kid its own priority; document --flags answers closed ids
TestE2E_BlockedOverHTTP seeded gate-parent and gate-kid at one priority, so
when both landed in the same second their order fell to the generated ids,
which differ between the local and the served workspace: the comparison
failed intermittently. gate-kid now has its own priority. Ten runs on the
embedded lane pass.
bd blocked --flags answers a closed id too, with its stored flag; a SQL read
of the column filtered on status <> 'closed' leaves it out. Said in the
command's doc and the CHANGELOG.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(blocked): apply label filters to external-only blocked rows
The external-dependency policy appends a row blocked only by an
unsatisfied external: ref after the label query has run, so --label,
--label-any and --exclude-label never judged it: bd blocked and
GET /v0/beads/blocked listed it whatever its labels, on every route.
Both decorators now filter those rows by the request's labels. The uow
decorator reads them through GetMany, chunked at MaxGetManyIDs, so their
labels are hydrated; GetIssuesByIDs left them empty, which also printed
them unlabelled on the proxied route.
Review fixes (adopt-pr apply-fixes, iteration 1):
- major #1: label filters on external-only rows in the store and uow
decorators, with absence-asserting arms in the unit, served httpclient
(server- and client-enforced policy), e2e and proxied tiers; the spec
and the role doc say such rows are narrowed like every other row.
- minor #2: the policy.external_dependencies token prose names the
blocked listing (spec, routes.go, regenerated types.gen.go).
- minor #6: SERVE_RUNBOOK and the allowUnlimited comment record the
blocked listing's unbounded whole-set answer and why.
- minor #10: BlockedLister telemetry-outermost and typed-unsupported pins
beside the ReadyCounter pair, plus the externaldeps wrap pin.
- nit #9: F-blocked names --flags --raw's refusal against a server that
applies the policy (ledger.go and the regenerated ledger doc).
- nit #11: the remote BlockedLister no longer builds a local lister it
then discards.
Review fixes (adopt-pr apply-fixes, iteration 2; the review approved at
940 with one minor and two nits, none gating):
- minor (the --flags refusal list was unpinned): the new
TestBlockedFlagsRefusesEveryListingFilter pins blockedFlagFilterFlags
to the flags blockedCmd registers, in both directions. Every
registered flag except --flags and --raw must be refused, and every
entry must name a registered flag. The test walks Flags() rather than
LocalFlags(), so it does not merge the root's persistent flags into
blockedCmd, and it skips inherited root flags and cobra's --help.
Mutants:
- four fail it: a new filter flag left off the list, a dropped
entry, a misspelled entry, and --raw added to the list;
- a simulated earlier in-process run (merged root flags plus --help)
stays green, and fails once either skip is removed.
- nit (the remote branch's span): the remote BlockedLister comment now
says why that lister is not wrapped again. The inner lister already
carries telemetry's span, so wrapping would nest a second span of the
same name. The comment also says what runs outside that span.
- nit (duplicated order comparator): left as is. finishBlockedIssues
predates this PR, so merging the two sorts would refactor existing
code with no review pass left after this one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* feat(list): bd list's remaining filters over http behind issues.list.filters
Over http every `bd list` filter beyond the created bounds and the title,
id and no-assignee scope refused (time bounds, priority range, text and external-ref
matches, spec, label pattern/regex, exclude-type, no-parent, no-labels,
empty-description, pinned/no-pinned, deferred, overdue, mol/wisp type).
The library entry already applied all of them: issueops.Reader.List via
workapi.BuildListFilter, shared by the CLI and the handler. This adds
only the wire.
- Server: GET /v0/beads/issues decodes 29 new optional parameters
(listFilterParams, decode only; countIssues' names where it already
spells the filter) into the existing ListRequest, behind one new
behavior token, issues.list.filters. mol_type/wisp_type are closed
enums refused by name (an empty value too). wire_revision stays 2;
apigen and the wireshape golden are regenerated (additive only).
- Every RFC 3339 bound the listing and count decode is normalized to UTC,
so an offset-bearing bound selects what its Z twin does on a zone-less
timestamp column.
- workapi.BuildListFilter refuses PinnedFlag with NoPinnedFlag
(ErrValidation, the CLI's own sentence) instead of letting PinnedFlag
win; over http that is a 400 on no_pinned.
- Client: the encoder sends the members (encode.ListFiltersMembers, one
list read by the encoder, the pre-dial gate and a spec-parity test).
Against a server not advertising the token, httpReader.List refuses
before dialing with ErrUnsupported naming issues.list.filters. The 29
E-ListRequest ledger refusal rows retire; the ledger doc is updated;
skew flag mappings added.
- Tests: handler decode/parity/enum/UTC/malformed/pinned-pair tests;
encode member/gate/spec parity and bound encoding; per-member
ride-behind-token and pre-dial skew refusal; two new Reader contract
cases on every leg (dolt, embedded, uow, served): the eight time
bounds at exact boundaries (strict, whole-second truncation, NULL never
matches, +02:00 equals UTC) and one in/out row per remaining family;
three served Reader cases unparked; TestE2E_ListFilterParityOverHTTP
(served == embedded, masked server refuses naming the token, no dial);
five corpus shapes marked pending until the reference server profile
advertises the token.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(list): exclude_status on listIssues, the 30th issues.list.filters member
issueops.ListRequest gains ExcludeStatus: statuses to leave out of a
listing, appended to the default exclusions (never re-admitting what they
hide), comma-separated or repeated, and validated against the workspace's
statuses by the same rule CountRequest.ExcludeStatus uses (an unknown name
is ErrValidation). The rule moves into one shared function,
workapi.ParseExcludeStatus, called by both builders. With AllFlag it reads
the active set without enumerating every status, so an http-backed caller
can list O(active) rows instead of the whole history.
- Server: listIssues decodes a repeatable `exclude_status` under the same
issues.list.filters token (no new token); an unknown name is a 400 on
exclude_status. apigen and the wireshape golden are regenerated
(additive).
- Client: the encoder sends it and it joins encode.ListFiltersMembers, so
the pre-dial gate asks for the token.
- It is refused together with ReadyFlag, like the other members the ready
query cannot carry.
- No `bd list --exclude-status` flag yet (it would need the CLI docs
regenerated); the member is reachable through the library and the wire.
Tests: builder unit test (append, AllFlag, comma split, unknown name);
handler decode and 400; encoder, round-trip and gate; Reader contract
cases on every leg (active set under AllFlag, repeated and comma values,
adds to the defaults, narrows an explicit Status, unknown name refused).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(list): label_regex compile errors are 400s; review polish for list filters
- An invalid `label_regex` on GET /v0/beads/issues, /v0/beads/ready and
/v0/beads/ready:count is now `400 invalid_argument` (`invalid_value` on
`label_regex`) instead of `500 internal`. The database still compiles
the pattern in its own dialect; a request that sent a regex and earned
the engine's "regular expression is invalid" refusal is attributed to
the parameter (failRegexReadErr). The same text on a request with no
regex stays a server fault.
- mol_type and wisp_type refuse each other's vocabulary (tests pin
`mol_type=heartbeat` and `wisp_type=swarm`), so the call-site
allowlist, not just the spec enum, is covered.
- exclude_status with a workspace custom status: leg tests on the
embedded store and over the served wire (accepted and applied; a name in
no vocabulary refused). ReaderFixture cannot configure custom statuses,
so these sit beside the count's twin rather than in the contract.
- The search e2e gains a positive arm: --desc-contains returns exactly the
row whose description carries the token.
- Docs: `all` plus `exclude_status` keeps every status not named (pinned,
hooked and custom done/frozen included unless named), not "the active
set"; label_regex documents its 400. A corpus source line is made
neutral; a test message says 30.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(list): compose issues.list.filters with the --title-contains fold
#7631, now on main, folds `bd list --title-contains` onto listIssues
`title` and refuses the TitleContains left over from a --title and
--title-contains pair that differs, because the listing then had one
title parameter. This branch publishes `title_contains` behind
issues.list.filters, so that leftover now rides it beside `title` and
the server applies both. Neither half is dropped, and against a server
without the token the pre-dial gate refuses, naming issues.list.filters.
- encode.FoldTitleContains still runs first; its doc now says where a
differing pair goes.
- Tests: the fold table expects `title` plus `title_contains` for a
differing pair, including the ſ/s pair strings.EqualFold would match;
the differing-pair refusal names issues.list.filters; the
list_filters_test sweep pairs its TitleContains probe with a differing
TitleSearch, since a lone one asks only for issues.list.title; the e2e
differing-pair refusal becomes a listFilterShapes row that answers
exactly child-a over http and embedded, and refuses before dialing
without the token.
- The gc-polecat-closed-after corpus shape's pending reason also names
issues.list.title. The CHANGELOG --title-contains entry no longer
lists the differing pair and --closed-after as refused.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/39013611268
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* fix(list): serve --priority-max in search parity, refuse the parent pair
The proxied tier's search parity table still expected a remote
`bd search --priority-max 1` to refuse, because listIssues could not
carry it. This branch serves priority_max behind issues.list.filters,
so the remote route answered and the dolt-race shard went red in
TestProxiedServerSearchRoutesAgree. The row now expects the answer on
every route. It was the last wireCan=false row; the branch stays, with
a comment, for the next flag listIssues cannot carry.
- ParentID with NoParent: a served listing now carries no_parent beside
parent, and ANDing the two answered only the edge-less rows under the
parent's dotted id. BuildListFilter refuses the pair with
ErrValidation, in the sentence bd list and BuildCountFilter already
use, so issueops.Reader.List refuses it on every backend and the
listing answers 400 on no_parent. Pinned by a builder test, a reader
conformance case (dolt, embedded, uow, served http) and two httpapi
tests.
- POST /v0/beads/issues:claimNext shares the ready listing's
label_regex but answered a pattern the database cannot compile with
500. It now gives the listing's 400 invalid_value on label_regex,
through the helper the listing's mapping is split into.
- The descendant walk's ledger rows said listIssues publishes no
parameter for members it now serves behind issues.list.filters. They
now say the walk does not send them yet, and that --flat or --json
asks listIssues directly. The ExcludeStatus, Pinned and ExcludeTypes
rows, the parentwalk.go header, the walk table's doc and two walk test
comments are corrected the same way, and the ledger doc is
regenerated. parentWalkRefusals notes that a member moved off the list
must check issues.list.filters itself, because the walk dials past
the listing's pre-dial gate.
- Spec: the listing's no_parent documents the pair's 400, the count's
exclude_status no longer says it has no listing counterpart, and
claimNext's label_regex documents its 400. types.gen.go is
regenerated. Comment-only: countFilters, and readyScopeFields'
ExcludeStatus entry.
- CHANGELOG and README say the default `bd list --parent` tree view
does not carry the new filters yet; the label_regex entry names
claimNext, and a Changed entry records the parent-pair refusal.
Second review pass: docs and comments only, no behavior change.
- The prose copies of the issues.list.filters member set now match
ListFiltersMembers: CapIssuesListFilters and wire.CapListFilters name
the status exclusion, and the spec's capabilities text names
label-regex.
- Every time bound on the listing and the count goes through
q.timestamp, which normalizes it to UTC, and sqlbuild compares it
strictly at whole-second precision. listIssues' created_before and
created_after, and countIssues' created, updated and closed bounds,
now say so in the words the new listing bounds use. The count's
updated bounds also say what they filter, and its closed bounds say
that a NULL closed_at never matches. types.gen.go is regenerated.
- README and CHANGELOG: `--flat` or `--json` applies the filters to the
parent's direct children, not its whole subtree.
- The 29 listRefusal rows this branch serves stay deleted rather than
kept as retired rows, as #7550 deleted its TitleSearch, IDFilter and
NoAssignee rows when it served them. The CHANGELOG now says the rows
are removed, not retired.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* fix(gate): add-waiter retries contention the store gave up replaying
bd gate add-waiter writes the whole waiter list guarded by the version it
read and retried only ErrVersionMismatch. A convoy adder therefore failed
when its write ended in contention the backend stopped replaying: a
serialization failure or deadlock (Dolt/MySQL 1213/1205, Postgres
40001/40P01, uow.IsSerializationError) on a direct route, or a 503 busy
(wire.ErrBusy) over HTTP, which bd serve sends when its admission limiter
refuses or its transaction retry budget is spent.
gateAddWaiterLostRound now retries those like a version miss, under the
same jittered backoff and 20-write bound, and a busy answer's Retry-After
raises that round's wait, capped at 2s (gateAddWaiterRetryWait).
The retry is safe because of how a round is built, not because a 503 means
nothing was written: the client maps any 503 to wire.ErrBusy, and a gateway
can answer 503 after the write committed. Each round re-reads the gate,
deduplicates and writes the whole list guarded by the version it read, so a
landed write is found on the re-read (the waiter is never added twice) and a
stale list never overwrites a newer one. A server fault (500, e.g. an
indeterminate commit) and an unreachable database are still returned at
once.
TestAddGateWaiterRetriesTransientContention pins the three retried
spellings, the bound, busy-after-commit (one write, the waiter once), the
500 / db-unavailable / other-SQLSTATE non-retries, and the capped
Retry-After. It is red without the fix.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(gate): bound add-waiter's contention retries and honor Retry-After
Review fixups for #7648.
- A write lost to contention reaches addGateWaiter only after the store or
bd serve has spent a whole replay budget on it (withRetryTx: 5s, 15s in
server mode; bd serve's: 15s), so retrying it under the 20-write bound a
version miss gets could hold an adder for minutes (about five on the
direct server-mode route). Contended writes now get their own bound,
gateAddWaiterContentionRetries = 2, like the HTTP client's for a busy
read. They still count against gateAddWaiterMaxAttempts, and version
misses keep the 20. The const doc states the worst case: three 15s
budgets and two 5s waits, about a minute.
- A busy answer's Retry-After is waited out as sent, plus the jittered
backoff, instead of being capped at 2s. bd serve asks for 5s after a
spent budget because a convoy back sooner holds slots and starves reads,
and the wire client already bounds the header. The jitter keeps adders
answered busy together from retrying together.
- When the last write the bounds allow is answered busy, one more read
checks the gate before the command fails, with no wait first. A 503 (a
gateway's, say) can answer a write that committed, and every earlier
round's re-read would have found it; the last write has no round left.
A waiter found there is reported as already registered, and a read that
fails confirms nothing.
- The exhaustion error says "changed on every one of N attempts" only when
no write was contended. Otherwise it reads "no write to X was confirmed
in N attempts (K answered busy or lost to write contention)": it names
the contention, so the operator of a busy server is not sent looking for
a concurrent writer, and it does not claim that nothing landed.
- gateAddWaiterContended names what maps to each class: Dolt/MySQL
1213/1205 and SQLSTATE 40001/40P01 on the direct route, and wire.ErrBusy
from bd serve's busy answer or from a 503 with no code or an unknown one
(db_unavailable and events_watch_saturated map to their own sentinels).
It also says why Dolt's 1105 "@autocommit transaction rolled back" is
not admitted: Dolt raises it for conflicts that a merge inside the
transaction left behind, while a write lost to a concurrent writer comes
back as 1213.
- Tests: 1213 and 1205 rows built as *mysql.MySQLError (the default Dolt
route's shape), the contention bound for busy and for 1213 with no wait
after the last contended write, version misses not spending it, the
three exhaustion wordings, a 5s Retry-After waited whole plus the
jitter, a busy answer to the last write at either bound that landed and
is found by the extra read, and a failed extra read that confirms
nothing. Thirteen mutants each fail at least one subtest: no bound, busy
only counted, version misses counted, no jitter, the 2s cap, the old
wording, an off-by-one bound, no extra read, an extra read that ignores
the waiter, one that takes a failed read as landed, a wait before it, a
wait at the end of each round, and the bound checked after the wait.
- CHANGELOG entry updated to match.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* fix(http): serve bd list --title-contains by folding it onto title
`bd list --title-contains X` refused against an HTTP workspace because
listIssues publishes no title_contains parameter. The store compiles
TitleContains and TitleSearch to the same predicate (LOWER(title) LIKE
'%v%'), so the client now folds TitleContains onto TitleSearch before the
pre-dial gate (encode.FoldTitleContains) when TitleSearch is empty or equal.
The request then rides the existing `title` parameter behind
issues.list.title, and against a server without that token it refuses before
dialing, naming the token. A --title and --title-contains that differ still
refuse: the listing has one title parameter and dropping either value would
widen the answer.
No wire change. The ledger row E-ListRequest.TitleContains narrows to the
differing pair.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(http): fold case-only title pairs and qualify the CHANGELOG
Review fixups for #7631.
- FoldTitleContains also folds a pair that differs only in letter case.
The store binds each value as '%' + strings.ToLower(v) + '%', so a pair
equal under strings.ToLower is one predicate. It does not use
strings.EqualFold, which matches pairs such as "ſ" and "s" that lower to
different patterns. Unit cases pin both directions, and the served test
answers a case-only pair like the single flags.
- CHANGELOG: name what still refuses over HTTP: a pair that differs other
than in case, either flag with --parent in the default tree view, and
--closed-after, which gascity's polecat pre-flight lookup of recently
closed beads (step 3d) uses.
- Corpus: add gc-polecat-title-contains-closed-after, the 3d lookup,
pending until the reference server advertises issues.list.title and
listIssues carries closed_after (E-ListRequest.ClosedAfter).
- Drop two assertions that could not fail (a request passed by value
cannot be mutated), and bring the e2e shape header, the
tokenedListFilters comment, the encoder table comment and the
E-ListRequest.TitleContains ledger row (doc regenerated) up to date.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* fix(http): gate create, add-waiter and discover through the library roles
bd gate create, bd gate add-waiter and bd gate discover wrote through the
legacy CreateIssue, AddDependency and map-based UpdateIssue, which the http
store does not implement, so over a connected HTTP workspace each failed
before any gate member reached the wire. They now run through the roles on
every route (direct, proxied server, http):
- gate create is ONE Lifecycle.Create carrying the gate members and a
reverse blocks edge from the blocked issue to the new gate: atomic on
every route, one createIssue over http behind issues.create.gates. The
proxied-server route's private unit of work is gone; it uses the same
role.
- gate add-waiter reads through Reader.Get, deduplicates, and writes the
whole waiter list through Lifecycle.Update guarded by the row version it
read, retrying up to three times on ErrVersionMismatch, so concurrent
adders cannot lose each other's waiter. Over http: issues.update.gates.
- gate discover lists through issueops.ListGates and records the run ID
through the same Lifecycle await_id patch gate check makes; bd close's
gh:run persist (updateGateAwaitID) takes the same path.
- Against a server without the token, each refuses before any write,
naming the token.
- gate discover skips template gates, as gate check already does, instead
of recording a run ID on a proto every later pour copies.
Tests: unit tests for the one-Create shape, the refusal, the add-waiter CAS
retry, and discover over ListGates with its template skip;
backend/http TestE2E_GatesOverHTTP (advertised and masked); four served
corpus shapes, pending until the reference server advertises the gate
tokens (verified to pass against a profile that does). CHANGELOG.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(gate): add-waiter backs off under contention; discover fails on a failed write
Review follow-ups to the gate CLI port.
- gate add-waiter's guarded write retried three times with no wait, so a
convoy of workers registering on one gate at once failed all but a few
(the proxied route's old unit of work had served them all). Each retry
now waits a jittered, doubling backoff (10 ms to 400 ms, drawn from
[d/2, d)), for at most 20 writes. The bound is attempts, not wall time:
under a loaded server one round takes seconds, and a wall-clock budget
failed the convoy after two or three rounds. A cancelled wait stops the
loop. TestProxiedServerGateAddWaiterConvoy (direct SQL and
proxied, real Dolt server) and TestE2E_GatesOverHTTP's concurrent case
run 11 simultaneous adders (one duplicate): all exit 0, every waiter
present once.
- gate discover counts only the gates whose run ID was recorded and exits
non-zero when any matched gate's write failed; it used to print the
refused gate as updated and exit 0. TestE2E_GatesOverHTTP covers
discover with and without issues.update.gates (fake gh).
- TestServedGateCheckOverAwaitTypedGates masks issues.update.gates itself,
so upgrading reference_server.json does not turn its gh:run case into a
different test.
- The discover listing test asserts closed gates are not listed.
- CHANGELOG: discover's template skip and add-waiter's template refusal
are behavior changes on the local routes; gate create refuses
a negative --timeout; gate create/add-waiter follow dolt.auto-commit and
use the role's commit messages; the proxied create no longer journals
dependency_added.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(import): tolerate only typed dependency refusals, not walk-query errors
With SkipDependencyValidationErrors set (the import mode), the dependency
pass recorded ANY error from checkHierarchy/checkCycle as a skipped edge
and continued. That included failed walk queries (an untranslated
statement, a statement timeout, a dropped connection), so an import could
commit without the edge and report the SQL error only as a skip reason;
on a backend whose transaction aborts on a failed statement, the import
failed later at an unrelated statement with the real cause hidden.
Tolerate only the typed refusals (ErrSelfDependency, ErrDependencyCycle,
*DependencyHierarchyConflictError) via isDependencyValidationRefusal and
return every other error, keeping the %w chain so serialization retry and
error classification apply.
Tests: sqlmock cases where the hierarchy and cycle walks fail under import
mode, on both the per-edge statements and the batch graph, must abort the
pass; typed refusals on both shapes are still skipped. Removing the
predicate fails both error tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(import): record the dependency-check fix in the CHANGELOG; tidy two test comments
Review fixups for #7630.
- CHANGELOG (Unreleased, Fixed): bd import now fails when a dependency
check's own query fails, instead of reporting the SQL error as a skipped
dependency and, on Dolt, committing without the edge. Refused edges (a
self-dependency, a cycle, a hierarchy conflict) are still skipped. docs/
is left alone because it tracks the pinned release (v1.2.2).
- create_test.go: two doc comments kept the line breaks left where the
internal tracker IDs were removed. They are reflowed into sentences; no
test logic changes.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(roles): issueops.Heartbeater role on the dolt, embedded and uow legs
Adds issueops.Heartbeater.Heartbeat(HeartbeatRequest{Actor, IssueID}) ->
HeartbeatResult{IssueID, Holder, HeartbeatAt, LeaseExpiresAt, Rearmed},
the lease refresh behind `bd heartbeat`, as its own role with its own
accessor.
- One body: internal/storage/issueops.ExecuteHeartbeatInTx validates
(*HeartbeatFieldError for a blank/over-long actor or empty id), refuses
a wisp, then runs RenewLeaseInTx, which is HeartbeatIssueInTx's body
reporting the renewal. HeartbeatIssueInTx is now a wrapper, so the legacy
HeartbeatIssue legs answer the same text and sentinels.
- The refresh is fenced on the holder AND on the live claim: after the
holder-fenced UPDATE, a read in the same transaction requires the issue
to be in_progress under the holder (the `update leases set` prefix and
the one IF() the Postgres dialect rewrites are unchanged; a Postgres port
should expect more serialization retries from that read). A refusal deletes the caller's orphaned lease
row, and the legs commit that refusal.
- A refresh writes only the lease row: no row_lock, version, updated_at,
event, journal entry, Dolt commit or hook. A re-arm (a live hand-doled
claim with no lease row the caller holds) is recorded as a mutation:
row_lock reminted, updated_at stamped, a lease_rearmed event, a journal
entry, a version, a Dolt commit (LeaseRearmVersionCommit) and on_update.
The remint makes a re-arm collide with a racing release or close instead
of leaving an orphaned lease on an open or closed issue (a pre-existing
race on every Dolt route). Rearmed is true only when a row was created:
a same-second refresh (0 changed rows on embedded Dolt) or a holder
spelled differently refreshes the existing row in place and keeps its
granted_at/granted_node. Reported times are rounded to whole seconds,
the stored values; the binds stay unrounded so a same-second refresh is
never a 0-row UPDATE on Dolt.
- Typed refusals: an absent id is ErrNotFound; a foreign holder is
*LeaseConflictError{Holder} wrapping ErrAlreadyClaimed; a wisp
(Ephemeral) or no live claim is *LeaseConflictError wrapping the new
ErrLeaseNotHeld, which also matches ErrNotClaimable.
- Legs: DoltStore and EmbeddedDoltStore through the issue-operation
funnel (DOLT_ADD of the named tables, then DOLT_COMMIT -m, after the SQL
commit); uow.NewHeartbeater through the new uow.RunTxScoped: a refresh or
a refusal commits with the plain SQL COMMIT (no working-set scan, no Dolt
commit, nothing another writer left uncommitted is swept), and a re-arm
commits through the new ScopedCommitter (DOLT_ADD of exactly its tables,
DOLT_COMMIT -m, never -Am). The legacy HeartbeatIssue doors commit a
re-arm the same way and keep a refusal's orphan delete, and the
proxied-server `bd heartbeat` route runs the role's body with the same
scoped commit.
- Census: storage.Storage gains Heartbeater(); HookFiringStore wraps it
(fires on_update for a re-arm only, RoleFiresHooks knows it), telemetry
wraps it, httpapi.timedProvider, uow.notifyingProvider (records a re-arm)
and externaldeps.uowProvider build it; the journal and version guards
list the heartbeat family as entry points; the httpclient unsupported
shell is regenerated and Heartbeater sits on its unsupported allowlist
until the wire lands.
Conformance: RunHeartbeater* (18 cases) on dolt, embedded dolt and uow:
refresh post-state with the stored times pinned to the result; no
row_lock/current_revision/updated_at/events/journal/issue_versions/
version-control/hook change; a guarded write with the pre-heartbeat
revision still lands; foreign holder refused against an aged lease;
refused after close/release/reclaim/status move; wisp refused; hand-doled
claim re-armed as a mutation; same-second heartbeat is not a re-arm;
orphaned leases on released, closed and reassigned issues refused and
deleted; a refresh and a refusal against a dirty working set make no
commit and leave the other writer's change uncommitted, and a re-arm
commits only its own tables; absent id; request rules; no request mutation. The http leg is
waived until the wire lands.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpapi): POST /v0/beads/issues/{id}:heartbeat behind issues.heartbeat
Publishes issueops.Heartbeater on bd serve as heartbeatIssue, the served
lease refresh behind `bd heartbeat`.
- Spec: the operation, HeartbeatIssueRequest {actor} and
HeartbeatIssueResponse {id, holder, heartbeat_at, lease_expires_at,
rearmed}; no `revision` (a refresh writes nothing to the row) and no
expected_version (the fence is the holder and the live claim).
issues.heartbeat joins the capability vocabulary and lease_not_held
(409) the Problem.code list; `reason: ephemeral` qualifies it for a
wisp. apigen and the wire-shape golden are regenerated; the golden diff
is additive only, so wire_revision stays 2.
- Server: route row on the custom-method dispatcher, handleHeartbeat in
heartbeat.go (claim's actor rules via bodyActor, unknown member and
query refusals), Config.Heartbeater as a required role (sourceRoles,
roleSourceNames, the per-request uow.HeartbeaterSource accessor).
failHeartbeat maps *LeaseConflictError typed fields: a foreign holder
is the claim's conflict shape (already_claimed + assignee +
issue_status); no live claim, a wisp included, is the new
lease_not_held (+ issue_status, + reason: ephemeral for a wisp), matched
before the generic arms so ErrLeaseNotHeld's ErrNotClaimable never
surfaces as not_claimable. Its detail names the one state the refusing
transaction found (closed, open and not claimed, an ephemeral wisp, ...).
- bd serve wires the role from its peeled store (serveRoleSource gains
Heartbeater); the serve stub stores, the corpus and e2e harnesses, the
served harness and the encode oracle bind it.
- Wire client vocabulary: OpHeartbeatIssue/issues.heartbeat and
MethodHeartbeat are CLASSIFIED (the capability set-equality gate),
ReasonEphemeral is pinned to the server's, and lease_not_held rebuilds
*LeaseConflictError{Status, Ephemeral} wrapping ErrLeaseNotHeld in the
native words (the code-table set-equality gate). No accessor yet.
Tests: heartbeat_test.go (request mapping and projection, edge refusals,
every role refusal with its code, members and state-specific detail, the
code row, the capability). The served-http Heartbeater leg
(served_heartbeater_test.go, 18 cases) runs the contract against a real
bd serve through a test-local dial over the store's own dispatch, and the
http-leg waivers are deleted.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(http): bd heartbeat over http through httpclient.Heartbeater
The client leg of the served lease refresh, and `bd heartbeat` on the
role for every route.
- httpclient.Store.Heartbeater (heartbeater.go) dials POST
/v0/beads/issues/{id}:heartbeat through Store.dispatch, so
issues.heartbeat is preflighted: an older server is refused BEFORE the
dial with *wire.CapabilityError naming the token (unwraps to
*storage.ErrUnsupported{Capability: "issues.heartbeat"}); it never falls
back to a re-claim or a metadata stamp.
- The role's request rules are restated before the dial
(validateHeartbeatRequest, pinned to
storeops.ValidateHeartbeatRequest): blank/over-long actor, empty id, each
a *HeartbeatFieldError.
- Problem mapping: already_claimed (which the shared table rebuilds as the
claim's ClaimConflictError) becomes *issueops.LeaseConflictError naming
the holder and wrapping ErrAlreadyClaimed, in the native words ("issue
already claimed by <holder>"); lease_not_held already arrives as
LeaseConflictError (Ephemeral from `reason`); not_found is ErrNotFound;
invalid_argument on `actor` is the role's field error.
- Idempotent: true, the one write this client marks replayable (a repeat
only moves the expiry later; a replay after a reclaim fails the fence).
- Legacy Store.HeartbeatIssue rides the role. Both leave the generated
shell and completeness_test's unsupported allowlist.
- `bd heartbeat` takes Heartbeater() from the resolved store on the direct
routes (dolt, embedded, http) and from the provider's HeartbeaterSource
on the proxied route (exact id resolution in a read unit of work, then
the role); runHeartbeatProxiedServer and heartbeat_proxied_server.go are
deleted. Success output and exit codes are unchanged; refusal text
changes per route (see CHANGELOG).
Tests: heartbeater_test.go (stub server: preflight refusal naming the
token with no POST, request/answer projection, each refusal's typed
mapping including the wisp's reason, the 503 replay, pre-dial validation,
validator parity, the legacy door). served_heartbeater_test.go runs the
18-case contract through env.subject.Heartbeater(), with
HookedHeartbeater wired off a HookFiringStore. TestE2E_HeartbeatOverHTTP:
real bd against an in-process serve: holder ok with revision and
updated_at unchanged and a guarded write with the pre-heartbeat revision
landing; a non-holder refused against an aged lease that stays untouched;
closed, wisp and unclaimed refused, each naming its own state; an older
server's handshake refused naming issues.heartbeat with no write. Corpus
shapes gc-heartbeat, -non-holder, -closed, -wisp pending until
reference_server.json advertises the token. CHANGELOG entry for the whole
track, including the orphaned-lease race fix.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/38875641041
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* fix(heartbeat): roll back a no-issue refusal; restate refresh vs re-arm
Review fixes for #7600 (adopt-pr apply-fixes, iterations 1-2).
Legacy HeartbeatIssue doors commit a refusal only when it read the issue.
The dolt and embedded HeartbeatIssue callbacks committed every
LeaseRenewalRefusal, including Found=false (the issue read failed). That
refusal deletes nothing, but it can follow a fast-path UPDATE that
already extended an orphan lease row's expiry, so committing it kept the
extension. issueops.LeaseRenewalRefusalCommits now gates the commit on
Found, the rule the Heartbeater role's HeartbeatRefusalCommits applies.
New tests on both legs pin both arms: a no-issue orphan's expiry is
unchanged, and a released issue's orphan is deleted.
Refresh vs re-arm contract docs. Comments, Long help, the OpenAPI spec
and the generated apigen still said every heartbeat writes only the
lease row, makes no Dolt commit and fires no hook. A re-arm is recorded
as a mutation: it remints the revision, records an event and a version
entry, commits once (LeaseRearmVersionCommit) and fires on_update
through the wrapping hook decorator. Restated in domain, uow, issueops,
storage.go (why RoleFiresHooks answers true, so bd serve takes the
heartbeater off a peeled store), cmd/bd heartbeat and serve, httpapi,
httpclient, the spec (apigen regenerated), and the conformance and
contract-test docs.
Minor review findings:
- The 409 already_claimed and lease_not_held details now end "nothing
on the issue was written": the refusal may have deleted and committed
the caller's orphan lease row.
- docs/multi-agent/federation.md and the CHANGELOG entry describe the
spelling-mismatch heartbeat: the row is refreshed in place and keeps
granted_at and granted_node; only a re-arm stamps this node. The
embedded spelling test pins both columns, and the lease.go comments
say "refreshed in place" instead of "re-arms".
- The refusal's orphan delete judges the holder under actorMatches, as
the in-place refresh does (iteration 2). It matched holder = ? on the
actor as sent, so a dead claim's orphan held under another spelling
of the caller (gastown.mayor, heartbeat as gastown__mayor) survived
the refusal until TTL. The refused closure now reads the row's holder
and deletes that stored holder only when actorMatches(holder, actor).
Both TestHeartbeatIssueCommitsARefusalOnlyWhenItReadTheIssue twins
gain a cross-spelling arm (row deleted) and a control: another
identity's row (gastown.dog-3) survives.
Not changed: `bd heartbeat --json` still omits `rearmed`, since adding
it changes a CLI JSON contract (follow-up). The federation.md paragraph
post-dates the v1.2.2 docs pin, so documenting this main-only behaviour
there is a maintainer call under
engdocs/decisions/2026-07-17-docs-release-pin.md section 1.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(uow): run the scoped re-arm's Dolt commit after the SQL commit
The proxied-server heartbeat commits a re-arm with doltServerTx.CommitScoped,
which ran DOLT_ADD per table and DOLT_COMMIT('-m') INSIDE the open
transaction, before the SQL COMMIT. DOLT_ADD stages whole tables from the
session's transaction root, so that Dolt commit was built from the re-arm's
start snapshot: an issues row another session changed while the re-arm was
open (a write still only in the working set, as in batch mode or before that
writer's own Dolt commit) was staged at its old value, and HEAD disagreed
with the rows every reader sees. This is the LatentLabsSpace/NEXUS#92
ordering the DoltStore funnel (runIssueOperationTxWithMessage) already
avoids, and the review's major finding on this PR.
CommitScoped now commits the SQL transaction first, then stages exactly the
named tables (plus the versioned-history tables) and makes the Dolt commit on
the same pinned connection, the uow twin of doltAddAndCommitPostTx:
- a serialization failure of the SQL COMMIT is still returned, so
RunTxScoped replays the unit of work;
- the Dolt commit runs detached on its own budget and replays only conflicts
that leave nothing behind: serialization failures and Dolt's 1105
"@autocommit transaction rolled back" (new isDoltAutocommitRollbackError,
mirroring the DoltStore classifier of the same name);
- nothing staged, or "nothing to commit", is not an error: a concurrent
writer's Dolt commit already took the row. A "nothing to commit" past the
staged check is logged, as the funnel logs it, so the missing audit line
is explicable;
- any other failure is logged, never returned. The data is committed, and
returning it would make RunTxScoped replay a committed re-arm, which would
then report a refresh. The session is poisoned rather than pooled, since
its state is unknown. uow records no metrics, so that log line is the
drop's only signal; bd.db.post_tx_commit_dropped counts only the funnel's.
Statements go through schema.DrainCall, retiring the local drainCall fork
(review nit).
Tests: five sqlmock tests pin the order (SQL COMMIT before any DOLT_ADD),
the swallow-and-poison path, the 1105 retry, the returned serialization
failure and the empty-commit tolerance; each fails against the previous
CommitScoped. TestIsDoltAutocommitRollbackError carries the DoltStore
classifier's table over to the uow copy, plus the prefix boundary; dropping
the prefix branch, the prefix's period, the 1105 check or the type check
each fails a case. TestHeartbeaterRearmKeepsAConcurrentWrite is the
real-Dolt regression: a change to another issues row made while the
re-arm's transaction is open must be at HEAD after the re-arm's Dolt
commit. Its working-set-only writer fails on the old ordering (dolt
2.1.8); the writer that Dolt-commits its own change passes on both and is
kept as coverage.
Review follow-ups folded in (comments, a file move and a test; the
absorption log line above is the only behaviour change among them):
- the freshRowLock invariant and its row_lock_guard_test.go mirror name the
re-arm as the one deliberate remint without a lifecycle-field change,
load-bearing for the release/close collision;
- httpclient: "a write is never retried" (wire/client.go, stall_retry.go)
and "only a read's answer is yes" (dispatch.go) now allow for the
Idempotent heartbeat, and httpHeartbeater and issueops.HeartbeatResult
document that a replayed heartbeat can report Rearmed false after a
committed re-arm, with the guarded write's revision check as the backstop;
- the proxied route moves back to cmd/bd/heartbeat_proxied_server.go, the
file family cmd/bd/AGENTS.md prescribes;
- the ScopedCommitter and RunTxScoped docs no longer say every other
writer's uncommitted change stays out of the commit: a staged table is
committed whole, so such a change to a named table rides in the re-arm's
commit, as it does in the funnel, and only other tables keep theirs;
- commitStagedTables says its drop is log-only, the absorption is logged,
and the uow classifier gets its table test (see Tests).
Not folded in: the base-owned IssueUseCase.Heartbeat /
IssueSQLRepository.HeartbeatIssue door, dead in production since the
proxied route moved to the Heartbeater role. Its one caller is the
notifying hook-parity test (uow/notifying_test.go), and moving that case
onto the Heartbeater means re-deriving its RenewLease hook semantics, so it
is left for a follow-up.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* fix(mol): route bond operand resolution like show/update/close (closes#4714)
bd mol bond resolved operands with utils.ResolvePartialID against the local
store only, so a bead that lived in a routed store failed with
"'<id>' not found (not an issue ID or formula name)" — even though bd show
resolved the same ID. This broke `gt sling <bead> <rig>`, which cooks the
default formula and bonds it to a rig-routed bead.
- Resolve operands through resolveAndGetIssueForMutation, the same routing
fallback bd show/update/close use (local, then prefix-routed rig via
routes.jsonl, then contributor auto-routing). Write-intent so a prefix-routed
target opens writable and the bond commits where the bead lives.
- Run the bond mutation against the store that owns the resolved issue instead
of the global local store; reject a bond whose two operands resolve to
different stores rather than writing to the wrong database.
- Route the --dry-run preview read-only so it previews routed operands too.
- Add TestResolveMolBondOperandRouting covering local and routed resolution.
Same routing-parity fix as #3608/#3609 for bd close.
* fix(mol): fail fast on read-only routed stores, share same-rig bond handles
Address the two structural issues from the #4720 review beyond the rebase
itself (the rebase already preserves main's unconditional formula fallback
from #3874 instead of reintroducing the looksLikeFormulaName gate):
- Routed operands resolve but couldn't be bonded: contributor auto-routing
deliberately opens stores read-only (they hydrate foreign projects that
must never be mutated), yet the bond selected that store and dispatched
mutations that only failed at the store layer. Operand resolution now
mirrors resolveCloseTargets explicitly (local, then prefix-routed
write-intent, then the shared auto-routed read-only handle) and records
writability per operand; pickBondStore rejects a bond pinned to a
read-only store with a clear message before any mutation is attempted.
TestMolBondPrefixRoutedWriteThrough now verifies the actual dependency
write commits in the routed database, not just resolution, and
TestMolBondAutoRoutedReadOnlyFailsFast covers the fail-fast path.
- Same routed database compared as two different stores: pickBondStore
compared Go handle identity, but each route-open constructs a fresh store
in server mode, so two operands in the same routed rig were wrongly
rejected as cross-store. Both operands of a bond now share one routed
handle (an already-opened routed store is tried before opening another),
and sameBondStore falls back to StoreLocator identity (CLIDir pins the
concrete database) for separately-opened handles onto the same database.
TestSameBondStoreSeparateHandles covers the two-handle case directly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(mol): validate routed bond homes before mutation
Discover bond operands read-only, enforce dry-run parity and cross-store policy before writable reopen, unwrap decorated store identities, preserve actionable route failures, and verify the accepted home after reopen.
Co-authored-by: Johan Snyman <johan.snyman@orange.com>
Agent-Signature: codex-gpt-5.6-sol-high on behalf of matt wilkie
* fix(mol): reconcile routed bond discovery with #5253 var validation
The rebase onto current main carried two silent regressions the Aug 16
review named: the discovery-based resolution (which replaced
resolveOrDescribe on the direct-store path) never validated --var values,
so `bd mol bond --dry-run <formula> <x> --var bad=...` previewed success
for a bond execution refuses — exactly the false preview #5253 fixed —
and materializeMolBondOperand wrapped every cook error as
"'%s' not found as issue or formula", re-introducing the ErrVarValidation
double-wrap #5253 removed from resolveOrCookToSubgraph.
discoverMolBondOperand now takes the provided vars and runs
formula.ValidateProvidedVars on its formula fallback, so --dry-run and
execution reject the bond identically, before any writable reopen.
materializeMolBondOperand passes formula.ErrVarValidation through
unwrapped, matching resolveOrCookToSubgraph and pour/wisp.
Agent-Signature: claude-fable-5 on behalf of R0SEWT
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(mol): review polish — fs.ErrNotExist, hook-isolated test repos, auto-route coverage
Three non-blocking notes from the Aug 16 review:
- routed.go: errors.Is(err, fs.ErrNotExist) instead of the legacy
os.IsNotExist, so the not-found check keeps working if loadPrefixRoutes
ever starts wrapping its open error.
- mol_bond_routing_test.go: pin core.hooksPath to .git/hooks after each
git init (the initGitRepoAt convention), so a developer or CI box with a
global hooksPath override never runs foreign hooks inside test repos.
- The widened openAutoRoutedStore behavior (maintainer/default auto-routes
open writable for any validated write-intent resolver, not just mol bond)
now has both the CHANGELOG sentence and a write-through test:
TestMaintainerAutoRouteMutationWritesThrough drives
resolveAndGetIssueForMutation — the bd update resolver — through a
maintainer auto-route, commits a real update there, and re-reads it via a
fresh routed read.
Agent-Signature: claude-fable-5 on behalf of R0SEWT
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(mol): carry main's #5761 formula validation into routed bond discovery
Rebase adaptation for #4720 onto main b303d494df. The PR moved the direct
(non-proxied) `bd mol bond` path off resolveOrDescribe and
resolveOrCookToSubgraph onto discoverMolBondOperand and
materializeMolBondOperand. Main's #5761 meanwhile fixed the old pair so a
--dry-run fails on exactly what the real bond fails on; the new pair did not
have that fix:
- discoverMolBondOperand loaded the formula with parser.LoadByName, which
never runs Formula.Validate, so a --dry-run previewed a successful bond for
a formula the cook rejects (e.g. a waits_for gate with no spawner). It also
validated --var values against the unmerged formula, so a var whose enum is
declared only in a parent went unchecked. Discovery now resolves the
formula with parser.Resolve first, the way resolveAndCookFormulaWithVars
does, and wraps both failures the way the cook does, so --dry-run and
execution report the same message.
- materializeMolBondOperand passed only formula.ErrVarValidation through
unwrapped. A formula that fails validation was reported as "not found as
issue or formula". formula.ErrValidation now passes through too, as in
main's resolveOrCookToSubgraph.
TestDiscoverMolBondOperandRejectsWhatMaterializeRejects and
TestDiscoverMolBondOperandValidatesVarsAgainstTheMergedFormula assert the two
phases against each other, like main's TestBondDryRun* pair does for the
proxied route.
Also:
- The PR's routing tests now pass the `exact` argument that main's #5393
added to resolveViaPrefixRoutingWithAccess. They pass false, which keeps
the partial-ID resolution the tests were written against.
- The PR's three new cgo test files are added to the bd_test srcs. This is
`make bazel-sync` output on the merged tree, and it touches nothing else.
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: Rody Vilchez <102562850+R0SEWT@users.noreply.github.com>
* test(mol): rebuild the RepoContext cache in the PR's role-routing tests
Rebase adaptation for #4720 onto main b303d494df. Main's #5243 moved
auto-routing role detection onto beads.GetRepoContext(), which caches the
repo context once per process; before it, role detection ran
routing.DetectUserRole(".") on every call. The PR's auto-routing tests chdir
into a fresh repo and set beads.role there, so after the rebase they read
the context an earlier test built for its own, now-deleted repo. There
beads.role is unset, and the remote-URL fallback finds no origin and answers
maintainer:
- TestMolBondAutoRoutedReadOnlyFailsFast fails whenever a role-routing test
ran before it in the same binary (reproducible alone with -count=2):
discovery looks for the contributor operand in the local store and reports
it not found.
- TestDiscoverMolBondOperandRouting/maintainer_routed_issue and
TestMaintainerAutoRouteMutationWritesThrough still pass, but only because
that fallback is also maintainer; they never read the beads.role they
configure.
Each test now calls resetRepoContextCachesForTest after its chdir, as #5243
did for main's own role-routing tests (TestResolveCloseTargets, which
TestDiscoverMolBondOperandRouting mirrors, and the routing_read tests).
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: Rody Vilchez <102562850+R0SEWT@users.noreply.github.com>
* fix(routing): open maintainer auto-routes writable for exact-match writes
#5393 landed after this PR was written. It moved `bd comment` and
`bd comments add` off resolveAndGetIssueForMutation onto a new
resolveAndGetIssueForMutationExact. This PR widens the former's auto-route
tier for write intent: a maintainer/default target opens writable, while a
contributor target stays read-only and MutationForbidden. On the PR's
original base that widening covered comment writes. After the rebase the
exact resolver still opened every auto-route read-only, so comment writes
lost it and the CHANGELOG's "any validated write-intent resolver" no longer
held.
The exact resolver is meant to keep the mutation resolver's routing
fallbacks and only tighten matching (#5393: it "keeps the existing
cross-rig prefix-routing and contributor auto-routing fallbacks intact").
Its auto tier now takes the same write-intent path. Matching stays exact,
and the abbreviation-refusal precedence is unchanged.
TestMaintainerAutoRouteExactMutationWritesThrough pins the change: the
routed store must not be read-only, and a comment written through it must
commit in the planning database. Without this change the read-only check
fails. The write itself still succeeds, because a server-mode read-only
open does not refuse it.
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: Rody Vilchez <102562850+R0SEWT@users.noreply.github.com>
* fix(routing): harden routed writes and surface routing failures
Review fixes for #4720.
bd close resolved its batch's shared auto-route through
openRoutedReadStore, so the route opened read-only even though every
other write-intent resolver opened it writable. The shared handle now
opens through openAutoRoutedStore with write intent, so the close commits
where the issue lives.
A contributor auto-route now opens writable for write-intent callers, as
maintainer and default routes do. The refusal the previous revision added
(errContributorRouteMutationForbidden, contributorRouteRefusal,
RoutedResult.MutationForbidden) is gone. A contributor's route target is
their own planning repository, the one bd create writes to:
docs/multi-agent/multi-repo-migration.md and
examples/contributor-workflow/README.md have the contributor claim and
close planning issues from the fork, and GH#2345, beads-0km and GH#3608
made bd show, update and close reach those issues. The read-only rule
came from #4389's review fixes (e8ae7a291a), which kept "contributor
auto-routing" read-only to preserve the bd-6dnrw.32/GH#3231 guarantee
that "routed reads never mutate a foreign project's history". That
guarantee is about reads, and the planning repository is not a foreign
project. Base therefore split by backend: a server-mode bd update, close
or comment of a planning issue committed, because a read-only server
store accepts the write, while the embedded store refused it with "store
is read-only". Refusing in every resolver would have broken the
documented workflow on both backends. bd mol bond was the only command
that checked MutationForbidden, so its check goes too, and a bond of
planning issues commits in the planning repository like any other routed
write. Reads through every route stay read-only. This reverses the
previous revision's stance and is flagged here as a maintainer call.
bd unclaim now resolves its issue through resolveAndGetIssueForMutation,
as bd update --claim does, so a routed issue opens writable; with the
read resolver an embedded routed target refused the release with "store
is read-only". Like bd close, it commits a routed change itself
(commitPendingIfEmbedded), since the post-run auto-commit covers only the
local store. bd human respond and dismiss already opened their target
writable but never committed it, so on an embedded workspace the close
sat uncommitted in the routed repository's working set; they now commit
it the same way. resolveAndGetIssueWithRoutingAccess's
writablePrefixRoute parameter is renamed writable, since it now governs
auto routes too.
A routed commit that fails no longer looks like success, and a retry
commits it. bd unclaim printed "Unclaimed" (or listed the issue in its
--json output) even when the release's routed commit failed; it now
reports the commit error and leaves the issue out. The failed commit
leaves the release, or the close human respond and dismiss make, in the
routed repository's working set. There a retry finds the issue
unassigned or already closed and refuses before it reaches its commit,
and nothing else commits a routed target. On that refusal unclaim,
respond and dismiss now commit the pending write before reporting it,
through commitRoutedWrite, which their success paths share.
A routed write never creates the target's database. The routed open runs
before the lookup it serves, so an embedded open of a repository that had
not been bootstrapped yet created an empty database that outlived an id
that missed; bd bootstrap then took it for the real one and skipped the
clone from sync.remote. openRoutedTargetStore's writable branch now opens
through newExistingDoltStoreFromConfig, which refuses an embedded
workspace without a database (embeddeddolt.HasRepository) before the
sanitize migration can rewrite anything there. A server-mode open already
never creates one.
resolveAndGetIssueForMutation already returned a routing failure (an
unreadable routes.jsonl, a routed store that fails to open) as itself. The
exact resolver and bd close still fell through to "no issue found
matching", which misstates why the lookup missed. All of them now share
isRoutingFailure. The exact resolver checks its abbreviation refusal first,
so the auto tier still gets its chance at an exact match. A prefix route
whose target has no usable metadata.json now names the route and the file
and says why the file could not be used.
An auto-routed store now opens the target's own dolt_database, as a prefix
route already did. Otherwise BEADS_DOLT_SERVER_DATABASE, which names the
launching workspace's database, would point a server-mode open at the wrong
database on a shared server. openRoutedTargetStore holds that override for
both route kinds. A write refuses a target whose metadata.json cannot be
read or parsed or names no dolt_database (autoRouteTargetDatabase) instead
of falling back to that variable. A target with no metadata.json at all
opens, read or written, the only embedded database it holds
(embeddeddolt.Databases), or the default database
(configfile.DefaultDoltDatabase) when it holds none or several.
Contributor setup leaves the planning repository without one until the
first routed bd create writes it, and names its database the way any
workspace without metadata.json does, BEADS_DOLT_SERVER_DATABASE first.
The open would otherwise resolve that name again from the launcher's
variable, so when the two differed a read that missed failed with
"database not found" and a write that missed created a database beside
the one setup created. A server-mode target holds no embedded database,
so with the variable set such a route now opens the default database
rather than the launcher's, which is what it opens without the variable.
A read of a target whose metadata.json is unreadable or names no
database keeps the lenient lookup it had.
bd mol bond's routed home now gets the external-dependency policy and
nothing else, as wireExternalDependencyPolicy asks of routed stores. The
launching workspace's hooks and telemetry no longer wrap writes into
another rig. runMolBond's tail is split into planMolBond, openMolBondHome,
materializeMolBondOperands and bondMolBondOperands, which takes it from
cyclomatic 26 down to 10 or less per function. getIssueWithRouting and the
resolveViaAutoRouting wrapper had no callers left and are removed.
Tests:
- TestMaintainerAutoRouteMutationWritesThrough now checks that the routed
store is writable. Without that check it passes even against a read-only
open, because a server-mode read-only store accepts the write.
- TestAutoRouteCloseTargetWriteIntent covers bd close's write intent for a
maintainer route.
- TestContributorAutoRouteWritesThrough replaces
TestContributorAutoRouteRefusesWriteIntent: an update, a comment and a
close through a contributor route each open the target writable and
commit, a read through the same route stays read-only, and a missing id
stays a plain not-found.
- TestEmbeddedContributorRoutedWritesCommitInPlanning runs bd update
--claim, unclaim, comment, close, human respond and human dismiss
through the bd binary in a contributor checkout. Each advances the
planning database's HEAD, and the issues end up closed there and absent
from the fork's database. The embedded shard manifest gains the test.
- TestMolBondContributorAutoRoutedWriteThrough replaces
TestMolBondAutoRoutedReadOnlyFailsFast: bd mol bond's pipeline bonds two
planning issues through a contributor route, and a fresh routed read
sees the dependency; setupAutoRoute now seeds extra planning issues for
it. TestDiscoverMolBondOperandRouting's contributor case now expects the
writable reopen.
- TestResolveCloseTargets keeps base's contributor cases (beads-0km); the
previous revision had moved them to routing.maintainer.
- TestRoutedWriteDoesNotCreateTargetDatabase (in-process) and
TestEmbeddedRoutedWriteMissDoesNotCreateTargetDatabase (the bd binary)
check that a missed write through a prefix route and through a
maintainer auto-route leaves an embedded target that has not been
bootstrapped without an embeddeddolt directory. The embedded shard
manifest gains the test.
- TestRoutedMutationResolversReportRoutingFailures runs each write-intent
resolver against an auto route whose store fails to open, an auto route
whose target's metadata.json names no dolt_database while
BEADS_DOLT_SERVER_DATABASE names the launcher's, and a prefix route
whose target cannot load.
- TestAutoRouteTargetDatabase covers a write and a read of a target whose
metadata.json names a database, is missing, names none, or cannot be
parsed; a missing one yields the target's only embedded database, or
the default database when it holds none or several, either way.
TestDatabases covers the listing, which applies HasRepository's .dolt
marker probe to each database.
- TestAutoRouteMissWithoutMetadataIgnoresEnv runs a missed read and a
missed write through an auto-route to a target that has one database
but no metadata.json: the default database while
BEADS_DOLT_SERVER_DATABASE names the launcher's, and a database named
after the launcher's with the variable set and unset at use. Each miss
must report not found and leave the target holding only its database.
- TestRoutedWriteRetryCommitsFailedCommit fails the routed commit of bd
unclaim (text and --json), human respond and human dismiss with an
invalid --dolt-auto-commit. The run must fail with nothing on stdout and
leave the routed repository's HEAD as it was; a retry must report its
refusal and commit the write there.
- TestAutoRouteOpensTargetDatabaseDespiteEnv checks the target-database
change.
- The auto-routing tests clear BEADS_ROUTING_MODE and BD_ROUTING_MODE
through neutralizeRoutingModeEnv. Viper ranks them above the
routing.mode the tests write, so a host that exports either var never
routes. bdEnv, which builds the bd binary's environment in the
embedded tests, now drops BD_ROUTING_MODE as it drops BEADS_*; agent
hosts export it, and TestEmbeddedContributorRoutedWritesCommitInPlanning
failed on such a host.
TestEmbeddedRoutedWriteMissDoesNotCreateTargetDatabase no longer needs
its own envWithout.
- Reverting each fix turns its test red: the contributor read-only clamp
(the contributor tests above), unclaim's resolver or commit and the
respond and dismiss commits (the matching step of the embedded test),
and each autoRouteTargetDatabase rule. So does dropping unclaim's,
respond's or dismiss's retry commit, or unclaim's skip of a release
whose commit failed (TestRoutedWriteRetryCommitsFailedCommit); either
earlier no-metadata.json rule, the variable, which leaves the stray
database the review reported, or a fixed default database, which fails
the read of a target setup named after the variable
(TestAutoRouteMissWithoutMetadataIgnoresEnv and
TestAutoRouteTargetDatabase), and taking the first of several databases
(TestAutoRouteTargetDatabase); and bdEnv's BD_ROUTING_MODE drop, on a
host that exports BD_ROUTING_MODE=off (both embedded tests).
The CHANGELOG entry now records that every auto-route opens writable for
the commands that change an existing issue, the unclaim and human
respond/dismiss commits, that a routed write never creates the target's
database, and the target-database and routing-failure changes.
docs/multi-agent/routing.md says that write commands follow every route,
contributor, maintainer and default alike, never create the routed
repository's database, and refuse a target whose metadata.json is
unreadable or names no dolt_database. Both say that an auto-route opens
a target with no metadata.json at the one embedded database it holds, or
its default database when it holds none or several, while a prefix route
always needs the target's dolt_database. That page documents
behavior that is not in a release yet, which the docs release-pin
decision (engdocs/decisions/2026-07-17-docs-release-pin.md §1) would
leave undocumented. The review asked for docs that match the behavior,
as feature PRs #6508, #5855, #5997 and #5092 also did, so it is flagged
here as a maintainer call.
Open, and not changed here. bd close has the same retry gap on base: a
re-close of an issue that a failed routed commit left closed counts as
already closed and never commits that store (mutatedStores).
commitPendingIfEmbedded gates on the launcher's mode (isEmbeddedMode),
not the routed store's, so a server-mode launcher that opens an embedded
routed repository would leave the write uncommitted there. That gate is
shared by every routed write command and is not exercised here.
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: Rody Vilchez <102562850+R0SEWT@users.noreply.github.com>
* ci(shards): list TestDatabases in the 40-shard embedded storage manifest
The routed-write hardening added TestDatabases to
internal/storage/embeddeddolt/detection_test.go without a slot in the
Bazel-only 40-shard block of .github/scripts/embedded-storage-test-shards.txt,
so gen_embedded_storage_shard_manifest.py 40 --weights=duration --check
reported it missing and TestStorageEmbeddedShardManifestGeneratorNotStale
(go test ./scripts) failed.
Regenerated with the repository command
(gen_embedded_storage_shard_manifest.py 40 --weights=duration --write);
the incremental pack adds exactly one line, on shard 25.
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: Rody Vilchez <102562850+R0SEWT@users.noreply.github.com>
---------
Co-authored-by: Rody Vilchez <102562850+R0SEWT@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
* perf(dolt): sweep the circuit-breaker dir once per process and age out closed files
CleanStaleCircuitBreakerFiles is documented as an init-time cleanup that
is "fast — typically 0-2 files", but it reads every breaker file in the
live directory on every server-mode store open. Two things made that the
dominant fixed cost of a bd write on a busy dev host:
- Every host:port:db a process opens leaves a closed-state file behind,
and ephemeral test-server ports mint a new name each time. Closed files
in the live directory were never removed, so one host's
$TMPDIR/beads-circuit held 2335 of them.
- A write command opens its store twice — the non-mutating preview open
for the workspace-identity check (be-0gfcs), then the writable open —
and each open ran the full sweep. One `bd update` opened 4755 breaker
files.
The store-open path now sweeps at most once per process
(cleanStaleCircuitBreakerFilesOnce); bd doctor --fix still calls the
sweep directly. And the live directory ages out closed files untouched
for 24 h exactly as the legacy /tmp/beads-circuit sweep already did
(legacyClosedSweepTTL becomes closedSweepTTL for both). A closed file
that old is indistinguishable from no file: readState reads an absent
file as closed, and a closed state's failure count only matters inside
circuitFailureWindow. A breaker in use is rewritten on every successful
open, so its mtime stays fresh and it is kept.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(dolt): pin closedSweepTTL's 24h width; document what the sweep removes
Maintainer fixup for the PR #7593 review (iteration 1; all non-gating):
- TestCleanStaleCircuitBreakerFiles_AgesOutClosedLiveFiles stamps its closed
files at literal ages instead of ones derived from closedSweepTTL: a file
idle 25h must go and one idle 23h must survive. A TTL lowered to
5m/61s/30s/22h or raised to 26h/48h, or a use site compared against
circuitStaleTTL, now fails the test; every one of them passed before.
- CleanStaleCircuitBreakerFiles' godoc lists the closed-file age-out and the
corrupt-file removal it already does, which directories it sweeps, and that
store open reaches it once per process while bd doctor --fix calls it
directly.
- The cleanServerCircuitState seam notes that a test driving the real sweep
through it must start a fresh staleCircuitSweep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(issueops): gate members on create and update, one bounds validator
The library half of serving gate await fields. Every local leg already
stores await_type, await_id, timeout and waiters on create, and await_id
on update; this adds the two missing pieces.
- IssuePatch.Waiters: a whole-value replacement of the waiter list (nil
or empty clears, stored as []), mapped by UpdateFields and by the
unit-of-work updateSpec, deep-copied by CloneUpdateRequest, and
classified as a non-coordination signal on the dolt leg. Duplicates are
stored as given; dedup stays the CLI's.
- ValidateGateFields / ValidateGatePatch with *issueops.GateFieldError
{Field, Detail} wrapping ErrValidation, mirroring ReclaimFieldError so a
front door can name the member. The rules are the columns' only:
await_type <= 32 characters, await_id <= 255 characters, the JSON
waiter list <= one TEXT column (65535 bytes), and timeout >= 0. No
await_type allowlist, no gate-type-only rule, no timer-needs-timeout
rule. Run from ValidatePublicCreateRequest (every create shape on every
backend) and ValidateUpdateRequest (await_id, waiters).
- Conformance: LifecycleCreate WritesTheGateMembers / BoundsTheGateMembers,
LifecycleUpdate PatchesTheGateMembers / BoundsTheGateMembers and
BatchApply CarriesTheGateMembers, each bound asserted from both sides,
wired on the dolt, embedded and uow legs and parked on the http leg on
the live refusal rows until the wire slices land.
- httpclient: IssuePatch.Waiters is refused before the dial on both patch
documents under a new W-IssuePatch.Waiters row (refuse-not-drop), until
the wire publishes it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpapi): publish the gate members on create and update
The wire half of serving gate await fields, over the library slice.
- createIssue and the issues:batchApply create item publish await_type,
await_id, timeout (nanoseconds, the encoding Issue.timeout reads back)
and waiters, behind the new behavior token issues.create.gates (one token
for both create shapes, the issues.create.defaultPriority precedent).
- updateIssue's patch and the batchApply update item's patch publish
await_id and waiters (whole-value replacement; [] clears), behind
issues.update.gates. await_type and timeout are not patch members: no
local update route changes them. Neither is nullable; null is refused
naming the member, as on title.
- The handlers only decode and project (createGateMembers,
patchGateMembers). The wire is no stricter than the library: every bound
is the role's *issueops.GateFieldError (await_type <= 32, await_id <=
255, the JSON waiter list <= one TEXT column, timeout >= 0), mapped to the
existing 400 invalid_argument with param naming the member at its level
(await_type, patch.waiters, items[i].create.timeout,
items[i].update.patch.await_id). The spec mirrors exactly that:
maxLength 32/255 and minimum 0, and no minLength/maxLength/maxItems on
waiters. Blank and duplicate waiters and any await_type reach the role
untouched.
- Spec: the four schemas, the capability prose, and the stale sentences
(createIssue's "await_* publishes on no operation, read or write" and the
patch's "spec_id and await_id publish nowhere yet"). apigen regenerated
(from the remote drift test's diff), wireshape golden regenerated:
additive entries and sides only, wire_revision stays 2.
- Client: the two tokens are mirrored in wire.behaviorCapabilities so the
vocabulary stays set-equal with the server's. The client still refuses
every gate member before the dial (the client slice flips that); the write-ledger
pending sets name the newly published members under their live refusal
rows, and the W-CreateRequest.Issue / W-IssuePatch.AwaitID /
W-IssuePatch.Waiters reasons, the served-leg park reasons and the S4b
waiver now say the server publishes them and this client does not send
them yet.
Tests: internal/httpapi/gate_fields_test.go pins member mapping on all four
bodies, clear-by-empty on both patches, null and unpublished-member refusal,
GateFieldError -> param at every nesting level, and both tokens advertised.
Mutating the handlers (dropping the mapping, the GateFieldError arms or the
tokens) turns them red.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpclient): send the gate members behind their tokens
The client half of serving gate await fields, over the wire slice.
- Create: await_type, await_id, timeout (nanoseconds) and waiters join the
create vocabulary on createIssue and batchApply create items (now
twenty-four members), sent verbatim when populated. Patch: await_id (by
presence; "" clears) and waiters (whole-value; nil/empty travels as [])
are encoded on both updateIssue's and the batchApply update item's patch.
- Token gate before the dial: a create naming any gate member needs
issues.create.gates, a patch naming one needs issues.update.gates. Without
the token the request refuses with wire.NewCapabilityError naming it
(typed ErrUnsupported{Capability}), never a dropped member. batchApply
checks the whole plan once, so no partial plan is sent. A request naming
no gate member never reads either token. Store.requireCapabilityBeforeDial
is the shared helper; requirePersistenceMove now uses it.
- Bounds read back typed: the server's 400 invalid_argument/invalid_value
whose param names a gate member at any level (await_type, patch.waiters,
items[i].create.timeout, items[i].update.patch.await_id) is rebuilt as the
role's *issueops.GateFieldError, the problem kept in the chain (and a batch
refusal still becomes its *ItemError). Without this the served bounds
contracts could not pass.
- Ledger: W-IssuePatch.AwaitID RETIRED; the library slice's W-IssuePatch.Waiters row
deleted (it never shipped outside this branch); W-CreateRequest.Issue and
W-CreateItem.Issue no longer cover the gate members; new
W-CreateRequest.Gates (refuse, Capability issues.create.gates) records the
token-gated late refusal for both create shapes. engdocs ledger
regenerated from Ledger() (262 rows: 201 refuse, 34 degrade, 27 retired).
- Write-ledger table: the wire slice's pending sets are flipped into carried.
- Served leg: the five gate cases (LifecycleCreate Writes/Bounds,
LifecycleUpdate Patches/Bounds, BatchApply Carries) are un-parked and run;
the S4b waiver and served comments now say await_id is sent.
Tests: internal/httpclient/gate_fields_test.go (encode on all four bodies,
clears, old-server refusal per member naming the token with no dial, no
partial batchApply plan, plain requests unaffected on old and new servers,
GateFieldError rebuilt from the problem). Disabling the three pre-dial
checks turns the refusal tests red.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/38841144413
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* docs(issueops): say the gate timeout rule is no column's
The gate validator's doc said its rules were the stored columns' and that
no command line can produce a negative timeout. The widths are the
columns' (VARCHAR(32), VARCHAR(255), TEXT), but timeout_ns is a BIGINT,
so a non-negative timeout is a rule no column enforces; the wire
publishes it as minimum 0. The raw store creates (CreateIssue,
CreateIssues) and import do not run the validator, so bd gate create
--timeout=-5m, a formula step's gate.timeout and a template clone still
store a negative timeout until they move onto the role.
Also say that GateFieldError.Detail is prose whose HTTP copy ends with
the server's own clause, so a caller dispatches on Field, and why a
create omits an empty waiter list while a patch sends [] to clear it.
Comments only; no behaviour change.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(corpus): gh:run await_id persist refuses by the missing gate token
#7604 (now on main) made bd gate check persist a gh:run gate's discovered
run ID through Lifecycle.Update. Its served test expected the HTTP
client's W-IssuePatch.AwaitID refusal, which persistGateCheckAwaitID
rewords to name await_id. This PR retires that row: the patch carries
await_id behind issues.update.gates. Through the reference proxy, whose
server advertises no gate token, the persist is now refused before the
dial by the capability error ("bd serve at ... does not advertise
capability "issues.update.gates", which updateIssue requires"), so the
merged tree failed the subtest's await_id and updateIssue assertions.
The subtest now expects that refusal: no writes, the error names the
gate, the missing token and the server, no role or store method leaks,
and await_id is untouched. persistGateCheckAwaitID already returns a
capability error as the role raised it (#7604 pins that), so no code
changes. Against a server that advertises the token the persist goes
through: a scratch probe against the in-process server recorded
await_id=4242 and closed the gate.
Also correct the gate.go comment and the CHANGELOG entry that still said
the HTTP client refuses every await_id patch.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* perf(list): read only the listed issues' dependency edges
`bd list`'s text renderings (the default tree, --deps, --parent, --format
and --watch) loaded every dependency record in the workspace through
GetAllDependencyRecords to draw one page. On a local store that is one
query. Over a connected HTTP workspace it is a walk of the whole workspace:
every issue id at 200 per request, then every id's edges at 100 per
request. `bd list --limit 20` against the ~3.8k-issue maintainer-city
workspace made 62 sequential requests and took ~5.7 s at ~50 ms a round
trip, where `bd list --json` makes 5.
Every rendering reads only edges a listed issue owns. The tree nests a
child under a parent only when both are listed, and looks the edge up
under the child. Sibling ordering, the --deps annotations and the gate
decoration read the listed node's own edges, and --format prints edges
between listed issues. An unlisted issue's edge onto a listed one, or a
parent off the page, is never read. listDependencyRecords reads exactly
those edges through the EdgeReader role, which every backend serves (the
http store refuses the raw GetDependencyRecordsForIssues batch method).
Over http that is one anchored listDependencies request per 100 listed
ids.
Through a logging proxy in front of the production bd serve, list
--limit 20 goes from 62 requests / 5.7 s to 6 / 0.49 s with
byte-identical output; every changed mode (--deps, --deps=all, --format
digraph/dot, --sort, --status, --ready, --limit 200, --limit 0, --parent)
prints the same bytes as before. On a local store a default page is as
fast or faster; a listing that covers most of a large durable store pays
batched reads instead of one table scan (+0.07 s at 1,000 rows, +0.46 s
at 4,000 on embedded Dolt).
Tests:
- backend/http TestE2E_ListTextRenderingsReadOnlyTheListedIssuesEdges:
over a served workspace, the tree, --deps=all, a --limit cut, the
--parent tree and --format digraph each make one listDependencies
request naming exactly the listed ids, and at most one request more
than the --json page. Failing first: the old read enumerated every id
(all=true) and anchored the hidden closed issue too.
- cmd/bd: the page read equals GetAllDependencyRecords restricted to the
page on Dolt server and embedded stores (both planes, every edge type,
gates, external refs), and every text rendering prints the same bytes
from either map; a runListCore spy pins one page read and no
store-wide read; pure tests over an adversarial fixture (edges unlisted
issues own pointing at listed ones, parents off the page, dotted
children, a parent-child cycle) guard the renderers.
Refs: ga-nrnrlr.5
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(http): seed the list page-edges e2e with one graph apply
TestE2E_ListTextRenderingsReadOnlyTheListedIssuesEdges ran 26 s on
http_served_test's round-robin shard in CI, which made that shard the
embedded lane's longest test action (172 s). Most of it was subprocesses:
five creates and a close to seed, plus a --json budget run per case.
The fixture is now one `bd create --graph` plus the close (the batch
create cannot carry a closed row's closed_at over the wire), and one
`bd list --json` run is the budget for every page case, since its request
count does not depend on the page size. 16 subprocesses become 9. All
five cases still fail against the old GetAllDependencyRecords call
sites: each edge read anchors the hidden closed issue, and the four page
cases make 7 requests against the --json page's 5.
Refs: ga-nrnrlr.5
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(http): gate check's bead sighting goes through Lifecycle.Update (issues.update)
The bead-gate sighting was written through the legacy map-based
UpdateIssue, which the http store does not implement, so the refusal
happened client-side and no issues.update was ever sent: every open bead
gate with an open target failed on every sweep over HTTP.
- recordSeen and the gh:run await_id persist now go through the Lifecycle
role (updateGateThroughLifecycle): a single-key metadata set for the
sighting, an AwaitID patch for the run. The http client still refuses the
await_id patch before the dial (W-IssuePatch.AwaitID); the gate's error now
names the await_id update instead of a Go method.
- backend/http/corpus TestServedGateCheckOverAwaitTypedGates seeds
await-typed gates in the served store and proves, through the reference
proxy: --dry-run writes nothing, timers close, the bead sighting persists,
merged gh:pr gates close, and the gh:run persist refuses by name with
await_id untouched.
- CHANGELOG corrected.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cmd/bd): gate check skips template gates; narrow the await_id reword
Review fixes for the gate-check sighting change.
- A persisted proto's gates (bd cook --persist) are templates, and
issueops.ListGates lists them with the open gates. bd gate check now
leaves them out of its listing's query: GateListRequest gains
ExcludeTemplates, which only listOpenGatesWith sets, and it adds
`template=false` to the expression, so the cut at --limit counts only
the gates that remain. bd gate list leaves it unset and still lists
templates. Dropping them from the page after the cut would let a page
of a proto's gates (newer than the live ones at the same priority)
fill --limit: the sweep would print "No open gates found." and exit 0
with the live gates unchecked. filterCheckableGates, which both the
direct and the proxied-server routes select through, keeps the skip
as a backstop. Before this, each route mishandled templates in its
own way:
- Direct route: the Lifecycle role refused the sighting and await_id
writes, so the sweep failed every time, after a gh:run template had
already queried GitHub. In a local workspace, an expired template
timer gate was closed in the proto.
- Over HTTP: bd serve refused the close with 409 template_read_only.
- Proxied-server route: the template timer gate was closed and a
sighting was stamped on the template bead gate, silently.
- persistGateCheckAwaitID rewords only the HTTP wire's
W-IssuePatch.AwaitID refusal. The new message names the run, await_id
and the bd serve URL, and advises checking the gate in a local
workspace: giving it a numeric run ID would be the same await_id edit
the wire refuses. The error chain is kept, so *storage.ErrUnsupported
and the ledger row stay reachable. Every other error comes back as the
role raised it, including a capability the server does not advertise
(#7589's issues.update.gates) and a local backend's ErrUnsupported.
Before, every ErrUnsupported got the same sentence.
- Tests:
- Unit: the template skip for every type filter; a sweep over template
gates beside a live one; ListGates putting `template=false` in the
query under ExcludeTemplates, and gate check's listing setting it;
the reword and its chain; the pass-through cases; the sighting patch
matching its map form.
- Embedded: a cooked proto's gh:run, bead and timer gates are
untouched, and gh is never run. With --limit 1 behind that proto's
gates, a live expired timer gate is checked and closed.
- Proxied-server: template timer and bead gates stay open and
unstamped. With --limit 1 behind two newer template timer gates, the
live one is checked and closed.
- Served: the template gates are untouched, and the gh:run error names
the server. --dry-run --limit 3 behind three template gates checks
three live gates.
- Each --limit case first shows, through bd gate list, that a template
leads the listing.
- Against the PR-head bd, the embedded, proxied and served template
cases fail. Against a bd that skips templates after the cut, the
three --limit cases fail, printing "No open gates found." and
exiting 0.
- bd_test gains the //internal/httpclient{,/encode} deps (gazelle-checked).
The embedded shard manifest lists both TestEmbeddedGateCheck* tests.
The CHANGELOG notes the template skip, that templates take no row of
--limit, and the new wording.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* fix(init): refuse to initialize directly in the home directory
`bd init` in a directory that isn't a git repo (and has no explicit
BEADS_DIR) unconditionally `git init`s the directory, writes agent
scaffolding (CLAUDE.md, AGENTS.md, .gitignore, .agents/, .codex/,
.claude/settings.json), and commits — with no confirmation. Run in the
home directory this silently turns $HOME into a git repository and can
clobber an existing ~/CLAUDE.md. It's worse under --non-interactive
(auto-engaged whenever stdin isn't a TTY, i.e. whenever an agent runs
`bd init`): all of it happens with zero prompt (GH#4635).
Refuse the init when the current directory is the user's home directory
and it isn't already a git repo (and no explicit BEADS_DIR was given),
with a clear error pointing at the alternatives (cd into a project, or
set BEADS_DIR). The common fresh-project flow (mkdir proj && cd proj &&
bd init) and already-git-tracked homes are unaffected.
The guard runs as the first statement in init's RunE, ahead of every
path that has an effect. Position is the whole fix: --reinit-local /
--force reach countExistingIssues, which opens a real store (creating
the data directory, able to run migrations), and --proxied-server
dispatches to runInitProxiedServer -> EnsureGitRepo, i.e. a `git init`
in the current directory. Both run long before the point where a guard
placed with the rest of the path validation would fire.
Home is resolved from the OS account database (user.Current) in
preference to $HOME, so the guard keys off the real account home even
when $HOME is repointed — which this repo's own tests do constantly.
Both sources are best-effort: a CGO-free build's user.Current() falls
back to os.UserHomeDir() (i.e. $HOME on Unix) when the account is absent
from the passwd database, so this is a preference, not a guarantee of
$HOME-independence. Mirrors the home resolution in internal/beads'
isPathInSafeBoundary.
Tests: TestIsUserHomeDir and TestGuardInitInHomeDir cover the decision
(resolver stubbed, so the real home is never touched);
TestInitCommand_RefusesInHomeDirBeforeAnySideEffect runs the actual
command for plain / --reinit-local / --force / --proxied-server and
asserts not just the refusal but that nothing — .git, .beads, CLAUDE.md,
AGENTS.md, .gitignore, .agents, .codex, .claude — exists afterwards.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(init): key the home guard on caller intent, and give it a named exit code
Three blocking items, two reviewers converging on the first.
1. The guard read os.Getenv("BEADS_DIR") as "the user explicitly opted in".
It is not. Cobra's root PersistentPreRunE runs before RunE and, for a
no-DB command like init, resolves a beads dir and exports it
(selectedNoDBBeadsDir -> prepareSelectedNoDBContext ->
prepareSelectedCommandContext). That resolution bottoms out in
beads.FindBeadsDir(), which accepts any ancestor .beads/ for which
hasBeadsProjectFiles is true - and a config.yaml alone is enough. That is
the shape of this project's own legacy user-level ~/.beads/config.yaml,
so anyone carrying it got BEADS_DIR set for them and the guard failed
open. `bd -C <dir> init` opened the same hole, and that one does not even
move the working directory the scaffolding lands in.
The damage is not self-cancelling. The `git init` half is separately
gated on the same env so it stayed skipped, but the agent scaffolding is
not gated at all: addAgentsInstructions, InstallClaudeProject,
InstallCodexProject and InstallCursorProject all write relative to CWD.
So the bypass still clobbered ~/CLAUDE.md, ~/AGENTS.md and
~/.claude/settings.json - the files the guard exists to protect.
beadsDirFromCaller captures BEADS_DIR as the process INHERITED it, at
package initialization, which the language guarantees runs before main
and therefore before any bd code exports one of its own. The guard
consults that snapshot, so the question it asks is "did the caller name a
beads dir", not "does the process env happen to have one".
2. The refusal skipped all three of init's refusal conventions.
ExitHomeDirRefused = 13 joins 10/11/12, the message is printed and the
error carries only the code (the ExitLocalExistsRefused pattern), and
docs/recovery/init-safety.md gains an init-home-refused anchor - TOC
entry, symptom, why, three recovery paths, and the script-branching
snippet - which the message points at. `bd help init-safety` lists it.
NOT added: a cmd/bd/protocol case. That corpus states that §E3 freezes
10/11/12/130 and that a new stable code requires a spec revision, so
asserting 13 there would be claiming wire status the spec has not
granted. The constant plus the docs anchor give the refusal the same
in-repo scriptability without that claim; say the word if the spec should
be revised and I will add the corpus case too.
3. CHANGELOG [Unreleased] entry, citing #4635 and stating the scope limits.
Also from review: the message's BEADS_DIR escape hatch said "set BEADS_DIR
if you really mean to initialize here", which is not what happens - an
explicit BEADS_DIR makes hasExplicitBeadsDir true, skipping the git init and
the CWD-local .beads. It now says so.
Test coverage answers the point both reviewers made about the RunE-only
tests. TestInitThroughRootCmd_RefusesInHomeDirWithDiscoveredBeadsDir runs
through rootCmd.Execute, in a home carrying only .beads/config.yaml, and
asserts the precondition (pre-run really does discover it) before asserting
the refusal and that no scaffolding landed. --backend names a backend that
cannot exist as a circuit breaker, so a future fail-open stops there instead
of building a store in someone's home directory. Against the old code it
reproduces maphew's observation verbatim:
init ran past the home guard and got as far as backend selection:
unknown backend "review4795-home-guard-sentinel"
plus a unit case pinning that a bd-exported BEADS_DIR is not caller opt-in.
Reported-by: maphew, 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(init): harden the home-dir guard (opt-out, git probe, exit 15)
Maintainer fixup on top of #4795 by harry-miller-trimble, for the three
majors and three of the minors from the adopt-pr review, the major, the
minor and the nit from its second round, and two of the minors from its
third. The contributor's commits are unchanged.
The BEADS_DIR opt-out still set up $HOME (major). The refusal said
`BEADS_DIR=<path>/.beads bd init` writes nothing in the home directory,
but an explicit BEADS_DIR only skips the git init. The agent files
(CLAUDE.md, AGENTS.md, .claude/, .codex/, .cursor/, .agents/) are
written relative to the working directory whatever BEADS_DIR says, and a
BEADS_DIR under $HOME counts as local, so ~/.gitignore was appended to
as well. guardInitInHomeDir now returns keepHomeClean for that case.
RunE forces skipAgents, which the proxied route also reads from its
input, and both routes gate the project .gitignore on keepHomeClean.
Init prints a note saying so, with a `bd setup <recipe> --global`
pointer for anyone who wanted an integration everywhere.
The refusal text, the CHANGELOG entry and the recovery playbook now say
what the opt-out does: it sets up only the named workspace, after a
`mkdir -p`, because init refuses a BEADS_DIR whose parent does not
exist. They no longer say nothing else is written, because Dolt and
metrics keep their own state under $HOME. The refusal's Why also stops
saying init overwrites existing files: it installs into them, and in
$HOME those are user-wide agent settings.
TestInitInUntrackedHomeWithCallerBeadsDir_SetsUpOnlyTheWorkspace runs
the direct route end to end against a Dolt server, once with the
workspace outside the home and once under it. Every seeded file must
come out unchanged, with nothing added. The proxied route's agent-file
and .gitignore gates are not covered by a test: there is no in-process
proxied init fixture to drive them.
The tracked-home probe trusted git's routing environment (major).
isGitRepo() is a plain `git rev-parse --git-dir`, so an inherited
GIT_DIR, or a home that only sits inside an enclosing work tree, stood
the guard down. Init's own git-init decision scrubs that environment,
then runs git init in the home and installs agent files into it. The
guard now asks isGitWorkTreeRoot(cwd), which runs
`rev-parse --show-toplevel` through initArtifactGitCommand and matches
the result against the home itself. Two new subtests pin both false
positives. Each asserts that isGitRepo() still reports true, so the
subtests keep reproducing the old probe.
Exit 13 was already taken (major). It is ExitGuardMismatch, "racer won,
skip gracefully", and 14 is ExitMigrationFrozen, so a wrapper branching
on exit codes would read this refusal as a benign skip. The refusal now
exits 15. The change is in init_safety.go, `bd help init-safety`,
ADR 0002, the playbook and the CHANGELOG. ADR 0002 also notes that 15
sits outside the protocol v0 §E3 freeze pinned in
cmd/bd/protocol/exit_codes_init_test.go.
The opt-out still set up a repository around the home (second round,
major). The tracked-home probe sends a home that only sits inside an
enclosing work tree, such as a dotfiles or monorepo checkout above it,
to the BEADS_DIR opt-out. Git finds that repository from the home, so
init set it up as the project: core.hooksPath, beads.role, fork routing
and the fork exclude, its origin as the workspace's Dolt remote, and a
bootstrap commit. That commit staged the home's legacy ~/.beads and then
whatever agent files the home holds, ~/.codex/auth.json among them, and
committed them with --no-verify. The proxied route did the same from its
tail.
keepHomeClean now also means "outside every repository". It is only
true when the home is not a work-tree root, so no repository git finds
from there is the home's own. On the direct route, RunE forces skipHooks
beside skipAgents; projectRoleRepo holds the six isInitRoleGitRepo
gates (the role prompt and pins, the GH#2950 safety net, fork routing,
the fork exclude) to keepHomeClean; and both origin-as-remote gates, the
bootstrap commit and the upstream advice are gated on it. On the proxied
route, the tail's isRepo probe, which gates the role, the fork exclude,
the commit and the upstream advice, and resolveProxiedInitRemoteURL are
gated on it; skipHooks reaches the tail through its input. What a flag
asks for still happens: --stealth and --setup-exclude write their
exclude, and an explicit --remote or a configured sync remote is still
used. The note, the refusal text, the CHANGELOG entry and the playbook
say what the opt-out leaves alone. Gating the commit also drops the
"skipped bootstrap commit" note the opt-out printed from an untracked
home.
Tests for it:
- The end-to-end test gains home_inside_a_repository. The home sits in
a repository with one commit and an origin, and holds a legacy
~/.beads; init runs without --quiet. The repository must keep its one
commit, nothing staged and its .git/config byte for byte (so no
core.hooksPath or beads.role). The workspace must not take its origin
as its Dolt remote, and init must print the note and no upstream
advice. The repository has no upstream remote, because fork routing
would create ~/.beads-planning under the suite's real HOME.
- TestProxiedInitTailKeepHomeCleanLeavesEnclosingRepoAlone runs the
proxied tail from a home inside a repository with an origin and an
upstream, so the fork exclude would fire. It requires no fork
exclude, no commit, nothing staged and the same .git/config.
- TestProxiedInitRemoteURLUsesSelectedProject gains a keep_home_clean
row (the origin is not used) and a configured_keep_home_clean row (a
configured remote still is).
- The guard's enclosing-repository subtest also checks that a caller
BEADS_DIR there returns keepHomeClean.
Second-round minor and nit:
- beadsDirFromCaller's comment and the playbook say why a BEADS_DIR read
from a .beads/.env does not count as the caller's, although
beadsDirProvidedAtStartup counts it for role detection. From the home
that file is the legacy ~/.beads/.env, so counting it would let the
same discovered ~/.beads opt out of the guard.
- The guard tests use t.Chdir, and the hand-rolled chdir helper is gone.
Validation: the init, home-guard and proxied-init tests pass against
the Dolt test container, as do the embedded init lane and the
proxied-server init integration tests. Mutation checks:
- Dropping the forced skipAgents fails both workspace subtests.
- Dropping the .gitignore gate fails the under-home subtest.
- Restoring the plain isGitRepo() probe fails both new false-positive
subtests.
- Disabling the guard fails every refusal test at the sentinel backend.
- Second round: dropping the forced skipHooks, the projectRoleRepo
gate, the commit gate, the late origin gate, the upstream advice gate
or the note each fails home_inside_a_repository on its own check.
Dropping the proxied tail's gate fails the tail test, and dropping the
proxied remote gate fails the keep_home_clean row. The third round
pins the early origin gate (below).
Third-round minors:
- The early origin gate picks the remote the early remote-safety check
probes, and a failed probe counts as Dolt history. The end-to-end
test gains unreachable_origin_reinit_local and
unreachable_origin_force: the home sits in a repository whose origin
path holds nothing, and init runs with --reinit-local or with --force.
Both must succeed and leave the repository as it was. Dropping the
early gate makes init probe that origin and refuse both rows with
exit 10.
- The playbook, the CHANGELOG entry and guardInitInHomeDir's comment
name the flags that still change the repository around the home:
--stealth and --setup-exclude write its .git/info/exclude, and the
interactive --contributor and --team wizards work in it (beads.role,
and possibly a sync branch). The opt-out's note is unchanged: none of
those writes is on its list.
Left for a follow-up:
- The proxied route's .gitignore gate is still unpinned. It needs an
in-process proxied init fixture, or the
`useLocalBeads && beadsDirIsLocal && !keepHomeClean` predicate pulled
out into a table-tested helper.
- Both routes still record the enclosing repository's origin-derived
repo_id, and its clone_id, on an opt-out workspace. That predates this
PR for every explicit-BEADS_DIR init and writes nothing to the
repository; skipping it is a behavior change of its own.
Third-round validation: the home-guard, init-tail and proxied-remote
tests pass in a hermetic env -i run against the Dolt 2.2.0 CI pin (41
tests and subtests, none skipped). Dropping !keepHomeClean from the
early origin gate fails both new rows with exit 10 and leaves the other
three rows passing. go vet, gofmt, the docsync test and the doc
freshness check pass.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Harry Miller <harry_miller@trimble.com>
---------
Co-authored-by: Harry Miller <harry_miller@trimble.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* feat(storage): add CommitConfigOnly — scoped config-table commit (GH#4078)
Generic Commit() excludes the config table by design (GH#2455) and
CommitWithConfig stages everything via '-Am' — neither can commit an
intentional config write without sweeping concurrent operations' dirty
tables in server mode. CommitConfigOnly stages ONLY config (via the
existing doltAddAndCommit helper) and commits it.
- VersionControl interface method with GH#4078/GH#2455 rationale
- DoltStore: scoped DOLT_ADD('config') + DOLT_COMMIT
- EmbeddedDoltStore: aliases Commit — single-process, so '-Am' cannot
sweep concurrent work (same rationale as its CommitWithConfig alias)
- Tests against a real dolt-sql-server container: scoped commit lands,
concurrent dirty issues row survives uncommitted, and generic
Commit()'s config exclusion is pinned as a regression guard
(cherry picked from commit 61ba8f05c9)
Carry note: rebased onto b1bee123b. The two version_control.go conflicts
were additive (upstream added CommitMergeResolution/CommitAll in the same
spot); resolved by keeping both sides, no change to this commit's code.
* feat(storage): CommitConfigUserKVOnly — screen memory commits to kv.* rows (GH#4078)
Carry reconciliation for the #4383 review: CommitConfigOnly stages the whole
config table, so a memory write's commit in server mode could sweep a
concurrent writer's half-applied internal key (issue_prefix above all), the
row-level form of the GH#2455 hazard. The review asked for #4412's kv.*
screen at the remember/forget sites.
CommitConfigUserKVOnly applies that screen before the scoped commit: if any
dirty config row is outside kv.*, it commits nothing and names the keys,
pointing at `bd dolt commit` (CommitAll), the same remedy the pre-pull
refusal gives. User kv.* rows already dirty are committed with the memory,
as the pre-pull auto-commit would. The screen query moves out of
assertDirtyConfigUserKVOnly into dirtyInternalConfigKeys so both paths share
it; the pre-pull refusal text is unchanged. Embedded aliases Commit, as its
CommitConfigOnly does.
Also softens the CommitConfigOnly interface doc (review nit): embedded mode
commits the whole working set, not only config.
Tests (server container): user kv.* rows commit; a dirty internal key is
refused with HEAD and the working set untouched.
* fix(storage): stage config's lookup-table projections with CommitConfigOnly (GH#4078)
Carry reconciliation for a change on main since #4383 was written:
SetConfig now writes status.custom into custom_statuses and types.custom into
custom_types in the same transaction as the config row (SyncConfigTables),
and reads of those sets are table-first. CommitConfigOnly staged config
alone, so `bd config set status.custom ...` in server mode would commit the
row and leave its projection dirty: HEAD would carry the new string with the
old lookup set, the split the projection exists to prevent. The
transactional SetConfig already marks the synced table dirty for this reason.
CommitConfigOnly now stages config plus issueops.ConfigProjectionTables(),
a list kept next to SyncConfigTables. Clean tables stage nothing, and the
projections are written only from config, so no other kind of work is
swept. CommitConfigUserKVOnly keeps staging config alone: memory rows have
no projection.
Test (server container): status.custom and types.custom writes leave
config, custom_statuses and custom_types all clean after CommitConfigOnly.
* fix(cli): commit config writes in server mode — remember/forget/config set (GH#4078)
In server mode nothing ever commits config-table writes: maybeAutoCommit
skips SQL-server modes entirely, and the explicit flush commands call
Commit(), which excludes config (GH#2455) and silently no-ops on a
config-only working set. Every bd remember / bd config set then strands
the working set dirty and the next 'bd dolt pull' fails with 'cannot
merge with uncommitted changes' until a manual raw-SQL flush.
commitConfigWrite commits the config table immediately after an
intentional config write, scoped via CommitConfigOnly so concurrent
operations' dirty tables are never swept. Server modes only — embedded
'-Am' auto-commit and the unflagged-writes sweep already cover config.
This restores the v1.0.1 always-commit behavior from PR #3052 that the
unified-PostRun refactor regressed.
Wired sites: bd remember, bd forget, bd config set, bd config unset,
bd config set-many (one commit for the whole batch). Commit failures
surface loudly per each site's error convention.
(cherry picked from commit 64f77a1963)
Carry note: rebased onto b1bee123b. config set/unset now write through the
WorkspaceConfig role and remember/forget through the memoryops role, so the
conflict resolution re-anchors each commitConfigWrite call right after that
site's noteDirectConfigWrite/noteDirectMemoryWrite (set-many: after its
direct-route store.SetConfig loop) and uses each RunE's current error
convention (return HandleError / HandleErrorRespectJSON instead of os.Exit).
No change to commitConfigWrite or its tests in this commit.
* fix(cli): reconcile commitConfigWrite with current main (GH#4078)
Carry reconciliation on top of the cherry-picked commit, for two things
that changed on main since #4383 was written:
- Proxied route: proxied mode never opens a store, and its WorkspaceConfig
and memory roles commit each write inside their own unit of work
(noteDirectConfigWrite / noteDirectMemoryWrite say so). commitConfigWrite
now returns early on usesProxiedServer() instead of relying on the nil
store, and the proxied test asserts the no-op.
- dolt.auto-commit: bd-4wamg made batch/off real deferral in server mode,
and #5830 made `bd dolt commit` commit config (CommitAll). A config write
under batch/off now defers with every other server-mode write instead of
committing regardless; mode on (the default) commits as before. This
matches embedded mode, where the PersistentPostRun auto-commit honors the
same setting.
The doc comment drops the stale "-Am auto-commit and unflagged-writes
sweep" wording and says why rename-prefix and migrate are not wired.
* fix(cli): commit remember/forget through the kv.*-screened variant (GH#4078)
Carry reconciliation for the #4383 review: bd remember and bd forget write
user kv.* data, so their server-mode commit now goes through
CommitConfigUserKVOnly via a new commitMemoryWrite helper. A dirty internal
config key from another writer is refused with the keys named and the
`bd dolt commit` remedy, instead of being swept into the memory's commit.
bd config set/unset/set-many keep CommitConfigOnly: the operator is writing
config deliberately there, the same trust level as `bd dolt commit`.
commitConfigWrite and commitMemoryWrite share one guard path
(commitConfigTable), so both no-op on embedded, proxied, and batch/off.
* docs: changelog entries for the GH#4078 config-commit fixes
Server-mode config writes (bd remember/forget, config set/unset/set-many)
now commit immediately via the scoped CommitConfigOnly, and the explicit
'bd dolt commit'/'bd vc commit' are config-inclusive and truthful.
(cherry picked from commit c412b96b96)
Carry note: rebased onto b1bee123b. The hunk's old context now sits in a
released section, so it is moved under [Unreleased] > Fixed. The second
entry (bd dolt commit / bd vc commit) is dropped: that fix landed separately
as #5830 (CommitAll) and is already in the changelog.
* docs(changelog): update the GH#4078 entry for the carried fix
Rewords the cherry-picked entry for what the fix does on today's main:
batch/off defer config writes like every other server-mode write, the
commit stages config's lookup-table projections, remember/forget are
screened to kv.*, and #4412's pre-pull commit now absorbs dirty kv.* rows,
so the pull-side symptom is a refusal on internal keys rather than the
merge error. Drops the #2455 link, which does not resolve in this repo
(the number is a source-comment reference).
* test(cli): pin server-mode config writes leave no config dirt (GH#4078)
User-level regression test for the carried fix, on the direct SQL-server
route against the suite's Dolt server: bd remember, bd config set
(status.custom), bd config set-many (types.custom + status.custom), bd
config unset and bd forget must each leave config, custom_statuses and
custom_types clean in dolt_status. A final step dirties an internal config
key out of band and checks that bd remember refuses, names the key, and
leaves config dirty for bd dolt commit.
On b1bee123b (without the fix) it fails at its first step:
after bd remember --key gh4078 server-mode memory: config left
uncommitted in the working set (GH#4078)
With memory writes routed through the unscreened commit, it fails at the
last step: bd remember committed over a dirty internal config key.
* docs(cli): say why config writes skip the kv.* screen (GH#4078)
commitConfigWrite stages every dirty config row, while commitMemoryWrite
refuses internal keys. Record the reason in the code, not only in the
commit history: bd config set/unset/set-many are deliberate config
writes, the same trust level as bd dolt commit.
* build(bazel): list the GH#4078 test files in BUILD srcs
The rows the Bazel / test job's 'BUILD files in sync' check printed at ec27abd1d. Without them the Bazel tiers never run config_commit_write_test.go, config_commit_server_integration_test.go or commit_config_test.go, and the server-Dolt storage tier fails its shard check for the six storage tests.
* fix(storage): say the kv.* write is already saved when the screen refuses (GH#4078)
When CommitConfigUserKVOnly refuses, the memory row's SQL transaction has already committed, so exit 1 read as 'not stored'. The refusal now says the write is in the working set and that bd dolt commit publishes it with those keys.
* fix(httpclient): add the scoped config commits to the no-op commit family
The PR adds CommitConfigOnly and CommitConfigUserKVOnly to
storage.VersionControl. Since the PR's merge base, main added
internal/httpclient, whose Store asserts storage.DoltStorage, so the
tree merged with main did not build (*Store does not implement
storage.DoltStorage: missing method CommitConfigOnly).
Add both methods to httpclient's commit family as no-ops, for that
family's D3 reason: a write over this client is durable once the server
answers, so there is nothing to flush, and refusing would fail a command
whose write already landed. Regenerate unsupported_gen.go: only its
trailer count moves (201 -> 203 methods), because both methods are
hand-written rather than stubbed. Extend the two tests that pin the
family by name, TestCommitFamilyIsNoOp and
TestCommitFamilyIsNotOnTheUnsupportedMap, to cover both methods.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Eddie the Engineer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: sms <114885497+seanmartinsmith@users.noreply.github.com>
* fix(config): screen the staged set, warn on refused memory commits (GH#4078)
Review fixes for the adopted PR, iterations 1 and 2.
CommitConfigUserKVOnly screened the working set on one pooled
connection and staged config on another, so an internal key written in
between (issue_prefix above all) was committed with a memory: the
GH#2455 hazard the screen exists to refuse. The screen, DOLT_ADD and
DOLT_COMMIT now share one pinned connection (stageAndCommit), and the
screen runs twice: on the working set before DOLT_ADD, and on what
DOLT_ADD actually staged after it, because sessions on one branch share
the working set. A refusal after staging unstages config again with
DOLT_RESET, so the refused rows are not left staged for the next commit
on the branch. Two residuals are documented at the code: another commit
path's own DOLT_ADD of config landing between the second screen and
DOLT_COMMIT is absorbed, as for every scoped commit, and the table-wide
reset can unstage such a commit's config staging. The refusal is now a
*storage.ConfigCommitRefusedError carrying the keys.
The two config-table commits also stop widening their staging list
with the versioned-history tables: a config write mints no version
rows, and that list's issues table swept concurrent issue work into a
config or memory commit.
bd remember and bd forget exited 1 after their write had landed
whenever a non-kv.* config key was dirty, including keys bd's own
unwired writers leave, such as the issue_prefix of bd rename-prefix.
They now warn on stderr with the keys named and exit 0, as v1.0.1
(#3052) did on a failed memory commit. Under --json they add
committed: false, commit_error and dirty_config_keys, only when the
commit did not happen, so a committed write's payload keeps its shape.
The CHANGELOG entry now says so instead of claiming that the refusal
restores the v1.0.1 behavior.
bd config unset of a yaml-only secret key deleted the credential row an
older bd had stored, but never committed the delete, so HEAD, which
bd dolt push publishes, kept the credential while --json reported
database_row_removed. The delete is now committed like any other config
write. A failed commit is a warning, and database_commit_failed under
--json, because the delete and the YAML unset both landed.
A commit error the store marks storage.ErrCommitIndeterminate, such as
a connection lost during DOLT_COMMIT, may have landed, so neither
surface reports it as a definite non-commit any more. --json adds
commit_indeterminate (remember, forget) or
database_commit_indeterminate (the secret-row unset) beside
committed: false and database_commit_failed, which stay, so a consumer
that reads only those is still told to commit; the secret-row warning
and the note a failed YAML unset carries say the removal may not be
committed and point at bd dolt commit.
commitConfigWrite's doc now says why a failed commit fails the config
verbs while the memory verbs only warn, and names bd kv set/clear and
the kv.memory rows bd import writes as config writes it does not wire
yet. CommitWithConfig's interface doc drops bd config set, which on
the SQL-server route now commits through CommitConfigOnly, and points a
command committing only its own config write at the scoped commits.
Tests: a live-store test writes an internal key between the screen and
DOLT_ADD and requires a refusal that moves no HEAD and leaves nothing
staged; a sqlmock test pins the refusal SQL, including a failed
unstage; a versioned-history-on test requires a dirty issues table to
stay dirty through both scoped commits; cmd/bd fakes pin the
warn-and-succeed contract, the JSON fields, the secret-row commit, and
the indeterminate qualifiers in both payloads and both texts; and the
server E2E gains a secret-row step plus a bd rename-prefix step ahead
of bd remember and bd forget.
Pre-approval CI repair: tools/nogo/unvalidated_integration_tests.txt
now lists the PR's integration-tagged
cmd/bd/config_commit_server_integration_test.go. Since #7486 no nogo
lane analyzes integration-tagged test files, and
TestUnvalidatedIntegrationTestsFileIsExact requires the list to name
every one of them, so the new file failed //scripts:nogo_integration_scan_test
in the Bazel test and integration lanes.
Left for follow-ups, both pre-existing and not changed here: the
review's projection minor (config delete paths do not reconcile
custom_statuses/custom_types), and committing bd kv set/clear and
bd import's kv.memory rows on the SQL-server route.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: sms <114885497+seanmartinsmith@users.noreply.github.com>
---------
Co-authored-by: Aaron Lippold <lippold@gmail.com>
Co-authored-by: sms <114885497+seanmartinsmith@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(doctor): detect parent→child hierarchy-blocking deps
checkChildParentDependenciesDB and --fix-child-parent only matched
child→parent blocks edges. parent→child blocks (bd dep add parent child)
deadlocks ready-work the same way but was invisible to doctor (GH#4814).
Extend the SQL predicate and fix to both directions; reword messages.
Fixes#4814
* fix(doctor): require real parent-child edge for reversed-direction detection
Addresses bee-ghosttrack's CHANGES_REQUESTED review on PR #5131:
- The parent->child arm added for GH#4814 flagged/deleted any dotted-ID
pair regardless of whether a real parent-child edge existed, so a
healthy "epic blocks on an orphaned-dotted subtask" edge (no
structural link, e.g. after a reparent or import) was misclassified
as a deadlock and deleted alongside genuine ones. Both the checker
(cmd/bd/doctor/validation.go) and the fixer
(cmd/bd/doctor/fix/validation.go) now require an EXISTS parent-child
edge for that arm; the legacy child->parent arm stays prefix-based
since it's already write-time-guarded.
- Added a reversed-direction destructive test (real parent-child edge +
waits-for deadlock, since blocks/conditional-blocks in this direction
are already rejected at write time once a real edge exists) and a
survivor test (dotted ID, no real edge). Both were verified to fail
against the pre-fix query and pass against the fix.
- Tagged detected rows with their direction (child->parent /
parent->child) in doctor output, and reworded the agent/CLI-facing
messages that only described the child->parent direction.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(doctor): keep Child-Parent scoped to child→parent edges
This PR taught the Child-Parent check and `bd doctor --fix
--fix-child-parent` to also match a parent that blocks on, or waits
for, its own child (#4814: "either direction deadlocks"). Since #6602
(gastownhall/beads#6506) the parent-child cascade propagates only
exogenous blockedness, so that edge holds back the parent, not the
child: it is a close gate. On a base with #6602 the new arm warned
"may cause deadlock" on working gates, and the fixer deleted them,
after which the parent could close before its children.
That holds while every parent-child chain up from the gated child
reaches the parent within the cascade's four-level walk (issueops
subtreeWalkDepth). A gated child that also has a parent outside the
gating parent's subtree is still locked out of bd ready while doctor
reports OK. That is a cascade defect, tracked as bd-eoxqs0, not a
reason for doctor to delete the gate, so this change refers to #4814
rather than fixing it.
Restore cmd/bd/doctor.go, doctor/agent.go, doctor_fix.go,
doctor/validation.go and doctor/fix/validation.go to main. The check,
its fixer, the flag help and the agent enrichment keep their
child→parent scope and wording, and the generated CLI docs match again.
Parent Close Gates (checkParentBlocksOwnChildDB) stays the one owner of
the parent→own-descendant shape. A comment at both query sites says why
the reverse shape is not matched and names the cascade's two limits.
Replace the two tests that encoded the expired premise with behavioral
ones, built the way `bd create --parent` writes a tree (dotted ids and
real parent-child edges): a live waits-for gate onto one child and a
legacy raw blocks row onto another. With the is_blocked flags inverted
first, a full recompute leaves the children ready and the parent
blocked; Child-Parent stays OK; Parent Close Gates lists the blocks row;
and the --fix-child-parent pass, through the blocked-state recompute
that runs last, keeps every edge and restores every flag. Against the
PR's previous code both tests fail: the check warns on both gates, and
the fixer deletes both rows and leaves the parent ready. The
dotted-id-only tests from this PR stay as scope pins.
Refs #4814
Refs #5131
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Vishnu Jayavel <vishnuj81093@gmail.com>
---------
Co-authored-by: Vishnu Jayavel <vishnuj81093@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(federation): treat missing peer row as credential-free remote
federation status/fetch failed with "failed to get peer credentials:
not found: federation peer origin" when the Dolt remote existed but no
federation_peers credential row was stored (add-peer without --user, or
sync.remote bootstrap). That made status report Reachable=false while
bd dolt pull/push succeeded (GH#4837).
withPeerCredentials now treats storage.ErrNotFound as empty credentials
so normal Dolt credential discovery applies. Decryption and other errors
remain fatal.
Fixes#4837
* test(federation): cover withPeerCredentials missing-row path; expect Dolt unknown-remote error
TestFilteredPushUsesDedicatedLongTimeoutConnection asserted the pre-fix
"failed to get peer credentials" error for "nonexistent-peer". Under this
PR a name with no federation_peers row is a credential-free remote, so the
push proceeds to Dolt and fails there with "remote 'nonexistent-peer' not
found". Assert that instead; waitForPoolWait and
assertFederationStagingBranchAbsent are unchanged.
Add TestWithPeerCredentialsMissingPeerRow (server mode, skipIfNoServer):
withPeerCredentials on a name with no row invokes fn exactly once with nil
credentials and returns fn's result; a peer stored with credentials still
delivers them to fn. Deleting the new branch in withPeerCredentials now
fails the test.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(federation): build credentials_peer_test.go under Bazel; e2e row-less remote test (#5128 review)
Maintainer fixup on top of the contributor's two commits, from the
adopt-pr review of #5128 (iterations 1 and 2).
- internal/storage/dolt/BUILD.bazel: list credentials_peer_test.go in the
dolt_test srcs. The target lists its srcs explicitly, so the new file
was never compiled into the Bazel test binary, and the required "BUILD
files in sync" step (make bazel-sync, then git status) would red
BAZEL_TEST and the CI Gate. The step body now reports no drift.
- TestFederationVerbsWithoutPeerRow: the end-to-end case #4837 reported.
The remote is registered with AddRemote alone (no federation_peers row);
PushTo, Fetch and PullFrom must succeed against it, Fetch must move
remotes/peer/main to the peer's HEAD, the pull must merge the peer's
issue, and no peer row may appear. With the fix reverted it fails at
PushTo with "failed to get peer credentials: not found: federation peer
peer"; with Fetch made a no-op it fails at the tracking-ref check.
- withPeerCredentials doc comment: record the mistyped --peer trade-off
(the name reaches Dolt, which rejects it), and that a name check added
in front must consult PersistedRemoteInfos as well as ListRemotes so
the GH#2118 cold-start window is not rejected.
- CHANGELOG [Unreleased] Fixed entry for #4837. It names the bd
federation verbs only: bd dolt push/pull --remote go through
PushRemote/PullRemote, which never look up a peer row, so they were
not affected.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Vishnu Jayavel <vishnuj81093@gmail.com>
---------
Co-authored-by: Vishnu Jayavel <vishnuj81093@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* test(delete): pin that a stale id never deletes the issue it prefixes (be-ksd)
bd delete resolves each id through the abbreviation-tolerant resolver
(resolveAndGetIssueForMutation -> utils.ResolvePartialID). When the exact
id is absent, that resolver falls through to leading-prefix abbreviation,
so an id that was already deleted resolves to a different issue whose id
it happens to begin, and --force deletes that issue.
The shape is ordinary: hash length is adaptive (3 to 8 characters) so a
grown store holds short ids beside longer ones, --id makes any shape, and
a hierarchical child's id always extends its parent's. On a fixture, after
fx-t00003 was deleted, bd delete fx-t00003 resolved to fx-t000031; a
re-run of a finished --from-file list with --force --quiet deleted two
issues it never named, silently.
The test drives deleteCmd in-process against a stub DoltStorage (no cgo,
no Dolt server) and records every request handed to the Deleter role. It
covers the single-id --force path, the preview, a deleted parent's id with
an orphaned child, the --from-file batch path, and an abbreviation of one
and of two live issues; each refusal must say delete needs the full id
and name the ids the input matches. An over-refusal guard checks that
exact ids (full, bare hash, child, batch) still delete exactly what they
name. The six refusal cases fail at this commit; the guard passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman
* fix(delete): resolve ids exactly, never by prefix abbreviation (be-ksd)
bd delete's direct route resolved each id with the abbreviation-tolerant
resolver, so an id that no longer exists resolved to the surviving issue
whose id it begins, and --force deleted that issue. Both of its resolution
sites now use resolveAndGetIssueForMutationExact (#5393's exact sibling,
until now used only by bd comment): the inline single-id path and
deleteBatch, which --from-file, multiple ids and --cascade take.
The resolver cannot tell a stale full id from an abbreviation. Hash length
is adaptive with store size, so one store holds 3- to 8-character ids side
by side and "fx-t00003" is both a valid full id and a valid abbreviation
of "fx-t000031". The rule therefore has to be per command, the way #5393
made it for bd comment. Delete is exact on both preview and --force: the
preview prints the next command to run ("To proceed, run: bd delete
fx-t000031 --force"), so a tolerant preview hands the caller the wrong
deletion to confirm.
This matches the team-server route, which passes ids to issueops.Deleter
unresolved, and DeleteRequest.IDs' own contract ("IDs ARE EXACT"). The
partial-ID notice (#6302) did not protect this path: --quiet silences it,
and a --force --quiet re-run of a finished --from-file list deleted two
issues it never named.
The refusal says what to do: "bd delete needs the full issue id: no issue
has the id "t000", which is the start of fx-t000031". To name the matches,
ResolvePartialIDExact now returns *utils.AbbreviatedIDError, which carries
the input and the sorted matches, wraps ErrAbbreviatedIDNotAllowed and
keeps the old error text, so bd comment's errors.Is checks and messages
are unchanged.
Cost: bd delete <abbreviation> is refused, naming the full ids, so the
caller retypes one. Exact ids, bare full hashes, child, cross-prefix and
routed ids resolve as before. The other deleteBatch callers (cleanup, wisp
gc, mol burn) pass full ids read from the store, so nothing changes for
them except under a race, where they now refuse instead of reaching a
neighbor. Reads and other writes keep abbreviation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman
* docs(ids): say bd delete requires the full id, like bd comment (be-ksd)
The Working with IDs section named bd comment as the one command that
refuses abbreviations and said every other mutation keeps them. bd delete
now requires the exact id too, so the section covers both, says why a
delete reaches the wrong issue so easily (an already-deleted id is still
the start of its child's id, or of a longer hash), and adds the bd delete
lines to the example block. Best Practices #1 names both commands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman
* docs(changelog): link the bd delete exact-id entry to #7375 (be-ksd)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman
* fix(delete): report a gone parent's id as a lost race under --if-revision (be-ksd)
Review-loop iteration 1 for #7375: a maintainer fixup on top of the
contributor's branch.
Major (codex+claude): a guarded `bd delete --if-revision` whose target
was deleted, and whose id is still the start of a surviving id (a gone
parent with a live <parent>.1 child), exited 1 with the abbreviation
refusal. Any other gone target gets the documented lost race
(precondition_failed, exit 13), and gascity's conditional deletes
switch on that code, so a benign race read as a hard failure.
- reportIfRevisionTargetGone (the single-id path) also takes
utils.ErrAbbreviatedIDNotAllowed as a gone target: under delete's
exact resolution that id names no row either.
- The refusal is a typed error, deleteAbbreviationError, that unwraps
to storage.ErrNotFound beside the *utils.AbbreviatedIDError, so the
--cascade caller of deleteBatch classifies it through
reportIfRevisionFailure the same way. errors.New(msg) dropped every
sentinel.
Minor (claude), taken: the refusal leads with the not-found fact,
`issue "t000" not found: bd delete needs the full issue id, and "t000"
is only the start of fx-t000031`, so gascity's isBdNotFound reads an
already-gone full id that begins a survivor's id as the idempotent
not-found it reads for any other gone id. The CHANGELOG entry quotes
the new text and the --if-revision outcome.
Minor (gemini), declined: threading the source command into the
refusal's wording. deleteBatch's other callers (bd cleanup, wisp gc,
mol burn) pass store-minted full ids that no user retypes, and the text
now leads with "issue X not found", which holds for every caller.
Tests:
- TestDeleteIfRevisionGoneIDThatPrefixesAnotherIssue: single id,
--json, --cascade and --cascade --json each exit 13 with "precondition
failed: issue no longer exists" and the precondition_failed body,
never the refusal text, and the guarded write never runs. Two
no-survivor rows are the plain gone id they must match.
- TestReportIfRevisionTargetGone: abbreviation rows, guarded and not.
- TestDeleteRefusesStaleIDThatPrefixesAnotherIssue also asserts the
refusal says "not found".
- TestEmbeddedIfRevisionDeletePreflightGoneParentIsPreconditionFailed,
end to end on embedded Dolt: delete a parent, its child survives and
`bd show <parent>` resolves to it; a guarded delete of the parent
exits 13 on the single-id and --cascade paths and leaves the child.
The TestEmbedded name is what puts it in a CI lane; its line in
embedded-cmd-test-shards.txt is the generator's incremental --write.
Mutation checks, each reverted afterwards: dropping the
ErrAbbreviatedIDNotAllowed match fails the single-id cases and the
abbreviation_guarded row; dropping ErrNotFound from Unwrap fails the
--cascade cases; dropping "not found" from the text fails every
refusal case; reverting both fixes fails both embedded legs (exit 1,
the refusal text, no "precondition failed").
Validation: the focused delete and if-revision tests; the embedded pair
under BEADS_TEST_EMBEDDED_DOLT=1; the scripts shard-manifest policy
tests and the generator's --check; gofmt; git diff --check. The full
./cmd/bd and ./internal/utils packages (-short, BEADS_TEST_SKIP=dolt)
pass but for TestRunApplyAllOK, which fails only because this worktree
sets core.hooksPath=/dev/null ("mkdir /dev/null: not a directory") and
passes with core.hooksPath overridden.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(resolver): use last-segment prefix match to prevent wisp substring collision
When two beads share overlapping hash fragments (e.g. gcy-oqf and
gcy-wisp-goqfo), the previous strings.Contains check incorrectly matched
"goqfo" as containing "oqf" and silently returned the wrong bead.
The fix changes the fuzzy match from substring containment to a
last-dash-segment prefix comparison:
lastSegment("wisp-goqfo") = "goqfo" → HasPrefix("goqfo","oqf") = false
lastSegment("wisp-t3st") = "t3st" → HasPrefix("t3st","t3st") = true
This preserves the intended use case (resolving wisps by their trailing
segment, e.g. "t3st" → "bd-wisp-t3st") while eliminating false
substring hits.
Also adds BD_NO_FUZZY env var: when set, partial resolution is skipped
and only the exact-ID fast path runs. This lets callers opt out of all
fuzzy matching when they need strict lookups (e.g. to avoid cache-lag
ambiguity).
Fixes: gcy-g4o (fuzzy short-ID resolver silently redirects to wrong bead)
* test(resolver): pin prefix-only semantics for plain-hash partial match
* fix(resolver): restore leading-prefix ID matching, pin gcy-g4o cases
#4939 already made partial matching leading-prefix only (strings.HasPrefix
in place of strings.Contains at both call sites), which is what fixed the
gcy-g4o collision: gcy-oqf can no longer resolve to gcy-wisp-goqfo through
the substring "oqf".
The last-dash-segment matcher added on top of that compared only the text
after each id's last dash, so inputs naming no issue resolved to unrelated
beads: hr-8wnq to a local bd-8wnq2 (which also pre-empts its hr- prefix
route), gcy-wisp-g4o to gcy-g4oab, and a trailing dash to any hash. The
first loop also began claiming wisps as abbreviations, so an exact bare
wisp hash turned ambiguous beside a longer sibling. Restore main's matcher
and remove hashSegmentPrefixMatch and lastDashSegment.
Drop BD_NO_FUZZY and its test. The gate returned before prefix
normalization, so documented exact forms such as a bare hash failed, and
it skipped the ErrAbbreviatedIDNotAllowed sentinel that callers branch on.
Exact-only resolution already exists as ResolvePartialIDExact; a
user-facing strict mode is left as a follow-up.
Keep the gcy-g4o regression tests, reworked so they reach the partial
matcher:
- TestResolvePartialID_WispSubstringCollision stores only the wisp, so
gcy-oqf and oqf must miss instead of hitting the exact fast path.
- TestResolvePartialID_WispLastSegment adds a longer wisp sibling, so the
wisp fallback's exact branch is what resolves t3st.
Add Docker-free and routed coverage:
- TestResolvePartialID_FakeStore_QualifiedInputsNeverResolveToAnotherBead:
hr-8wnq, gcy-wisp-g4o, bd-wisp-t3, abc, bd-ol-, aap- and - stay
not-found on both resolvers, each beside a control abbreviation that
resolves.
- TestResolvePartialIDMatchesLeadingPrefixOnly,
TestResolvePartialIDSilentOnExactWispHash and
TestResolvePartialIDNotifiesOnWispHashAbbreviation replace the
helper-level tests.
- TestRoutedResolutionLooksPastLocalNearMiss: hr-8wnq reaches its hr-
route despite a local bd-8wnq2, on the read and mutation paths.
With the last-segment matcher swapped back in, the table test (7 of 8
cases), the routed test, TestResolvePartialIDSilentOnExactWispHash and
TestResolvePartialID_WispLastSegment fail. With strings.Contains, the
table test (4 cases), TestResolvePartialIDMatchesLeadingPrefixOnly,
TestResolvePartialIDSilentOnExactWispHash and
TestResolvePartialID_WispSubstringCollision fail.
Co-authored-by: Saren <saren@dumstruck.com>
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Saren <saren@dumstruck.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* perf(schema): probe per-open sentinel tables with SHOW TABLES, not INFORMATION_SCHEMA.TABLES
Every bd open runs cursorRealityFloor and the ignored-cursor gate, and both
asked INFORMATION_SCHEMA.TABLES whether a table exists: the sentinel tables
(wisps, wisp_dependencies) and the untrack scratch table. Dolt does not push
the TABLES predicate down any more than the COLUMNS one, so each probe walks
the catalog of every database on the server.
Measured 2026-10-08 on a shared dolt sql-server (dolt 2.1.10, 9 databases,
about 12 to 17 bd opens a second, on a v1.3.1 line that also carries three
floored sentinel tables): the server ran at 365 per cent CPU and these
existence probes were the largest single class of running statements. A
debug query log of one `bd list`, `bd ready` and `bd show` against a warm
proxied server shows 10 INFORMATION_SCHEMA statements per open before; with
this change and the sentinel-column change (#7297), 3. The statement count
per command is unchanged.
showTableExists reads SHOW TABLES LIKE with an exact name compare ('_' is a
LIKE wildcard). SHOW TABLES errors when no database is selected, so it is
used only where the session is already on the target database: the
sentinels run after the cursor probe has found the cursor table, and
readIgnoredCursorState runs after selectTargetDatabase or MigrateUp's
preparation. The cursor-existence probe in currentVersion keeps the
INFORMATION_SCHEMA form, because it must succeed on any session (be-bv7x).
Repair paths keep schemaTableExists; they run once per migration.
TestShowTableExistsMatchesInformationSchemaOnDolt checks the two forms agree
on a real Dolt for a present table, an absent one, a dolt_ignored
working-set table and a LIKE lookalike; the sqlmock helpers move to the SHOW
TABLES form. Stacked on #7297 (the sentinel-column change), which it depends on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebased onto #7592 (which carries #7297): main has since added the floored
sentinel tables (events, bd_events_journal, bd_events_seq) and #7592 the
leases carrier read, all through sentinelTableExists, so their ordered
sqlmock expectations move to expectShowTable too; lock_test.go conflicted
only on expectIgnoredSentinelProbes.
(cherry picked from commit ca0e921348)
* test(schema): pin the per-open table probes to INFORMATION_SCHEMA's answers
Red half of finishing the per-open INFORMATION_SCHEMA.TABLES removal on
top of #7409. Two gaps against the count the probes replace, both
measured on dolt 2.1.8 and 2.2.0:
- Case. INFORMATION_SCHEMA (like every table reference) matches table
names case-insensitively, but Dolt's SHOW TABLES LIKE filter does not:
a sentinel stored as BD_EVENTS_SEQ reads as absent, so the ignored
cursor clamps to 21 and the tail replays on every open (its creators
are INFORMATION_SCHEMA-guarded, so the replay never heals it).
- The cursor-existence probe in currentVersion is still an
INFORMATION_SCHEMA.TABLES read, issued six times per bd update (~25-30
ms each on a server hosting 28 databases). It must succeed on any
session (be-bv7x), and SHOW TABLES fails with no database selected
(1105) or on a session whose database was dropped (1049).
Tests:
- TestShowTableExistsAnswersLikeInformationSchema: the unfiltered listing,
names compared case-insensitively; a '_' lookalike is not the table.
- TestCurrentVersionWithoutAUsableDatabaseIssuesNoFailingStatement: the
schemata read answers 0 and nothing follows it.
- TestShowTableExistsMatchesInformationSchemaOnDolt (from #7409) now
covers every per-open probe name under bd's own dolt_ignore patterns,
a LIKE lookalike and a table stored in another case.
- Real sql-server: TestShowTablesProbes_SeeIgnoredTablesInAnyCase (a
migrated store's cursors are believed on a fresh session, also with
bd_events_seq stored as BD_EVENTS_SEQ) and
TestCursorProbe_NoDatabaseSessionStaysUsable.
- The cursor-probe sqlmock helpers (schema, uow, cmd/bd) expect the
schemata read and the SHOW TABLES listing.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(schema): drop the last per-open INFORMATION_SCHEMA.TABLES reads
Finishes what #7409 starts. After it, every bd write still made six
INFORMATION_SCHEMA.TABLES point reads, all of them the cursor-existence
probe in currentVersion (5x schema_migrations, 1x
ignored_schema_migrations). Dolt does not push that predicate down: each
costs 25-30 ms on a sql-server hosting 28 databases, against ~0.6 ms for
SHOW TABLES or the schemata read (dolt 2.1.8; same on the shared server).
- currentVersion probes the cursor through tableInCurrentDatabase: an
information_schema.schemata read for DATABASE(), then SHOW TABLES. The
probe must succeed on any session (be-bv7x), and SHOW TABLES fails with
no database selected (1105) or on a session whose database was dropped
(1049); the schemata read answers 0 in both cases, which reads the
cursor as absent exactly as the TABLES count with
TABLE_SCHEMA = DATABASE() did.
- showTableExists reads the unfiltered SHOW TABLES listing and compares
names case-insensitively. Dolt's LIKE filter on SHOW TABLES is
case-sensitive while the INFORMATION_SCHEMA count (and every table
reference) is not, so the LIKE form read a sentinel stored as
BD_EVENTS_SEQ as absent and replayed the ignored tail on every open.
Without a LIKE pattern the '_' wildcard concern goes away too; the
listing is one round trip either way (34 rows, ~0.6 ms).
Verified equal to the INFORMATION_SCHEMA count on dolt 2.1.8 and 2.2.0
for every per-open probe name under bd's dolt_ignore patterns, on a
fresh session, after DOLT_CHECKOUT, on a revision database, with the
DSN database name in another case, with no database selected and on a
dropped database. The unit test gains a name-containing-the-table case
(events vs bd_events_journal).
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(schema): state the probes' preconditions; pin the 1049 cursor case
Review fixups for the per-open SHOW TABLES probes.
- readIgnoredCursorState and its alreadyConverged call site still
described the scratch probe as an always-succeeding information_schema
read bounded to one row. It is now an unfiltered SHOW TABLES listing,
which fails with no database selected (1105) or on a dropped database
(1049), so the doc states the precondition both callers meet: the
session is already on the target database. The HEAD half's dolt_ignore
read is named too; it runs only when the cursor is tracked at HEAD.
- tableInCurrentDatabase documents that its guard is check-then-act: a
DROP DATABASE between the schemata read and SHOW TABLES still pins the
session, and on a *sql.DB the two reads can land on different pooled
connections, so every connection in the pool must be on one database.
- TestCursorProbe_DroppedDatabaseSessionStaysUsable is the 1049 half of
the no-database server test: USE a database, drop it from another
connection, then CurrentVersion must answer 0 without an error and the
session must still see a database and table created afterwards.
Probing the cursor with the bare SHOW TABLES prober fails it with
"Error 1049 (HY000): database not found" (dolt 2.1.8).
- expectRemoteBackedSharedProbe uses `for range 2`, like its twin in
migrate_consent_test.go.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Chris Sauer <csauer02@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(storage): carry closed_by_session through the domain/UOW writer
Rebased onto current main, which changed what this PR needs to be.
The original diff added closed_by_session to the shared select/scan/
insert column sets (sqlbuild.IssueSelectColumns, issueops.ScanIssueFrom,
insertIssueIntoTable, issueUpsertColumns). All of that landed upstream
independently in #5191, so those hunks are dropped rather than
mechanically re-resolved against the lease-overlay refactor (0055) and
the row_lock/RowVersion hydration that arrived with it.
What is still missing on main is the second writer: db.insertIssueRow,
the domain/UOW statement behind proxied create, batch create and import,
whose column list contains no closed_by_session — not in the INSERT, not
in the ON DUPLICATE KEY UPDATE. The schema defaults the column to '' and
the now-shared scanner faithfully reads back whatever was stored, so a
proxied create silently discards the closing session while the same
issue created through the classic path keeps it. That is the GH#4662
data loss, still live, just relocated.
Add the column to insertIssueRow's insert, values and upsert
assignments, and note at the chokepoint why the two writers' column
lists have to stay in step.
Tests:
- Three new cases in the domain/db suite (real Dolt): insert -> get
preserves closed_by_session on the issues table and on the wisps
table, and the upsert rewrites it rather than keeping a stale value.
All three fail against main and pass with the fix.
- The conformance case PromoteClosedWispPreservesSession from the
original commit is kept: it runs on every backend and is the
end-to-end GH#4662 regression (close a wisp with a session, promote,
assert the session survives).
The nit about test comments asserting closed_by_session is absent from
IssueSelectColumns no longer applies — those comments are gone from
main, and the scan-parity fixture already counts 52 columns including
closed_by_session.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(storage): name insertIssueRow's real callers and pin the upsert clear
Only Insert without CreateOnly reaches insertIssueRow: the CreateIssue
callers that leave CreateOnly unset, such as the quick, todo and gate
proxied servers and the create op of a proxied `bd batch` script.
Proxied create and the unit-of-work batch creator and applier set
CreateOnly, so they insert through the classic writer, and import and
promotion use the classic writer too. That writer and the shared scanner
have carried closed_by_session since #5191.
So the previous commit closes a latent gap in the second writer rather
than a loss on proxied create or import, and GH#4662's closed-wisp
promotion loss was already fixed by #5191. The conformance case is that
issue's regression test: it passes without the domain writer change,
which the domain/db Insert tests pin instead.
- Reword the insertIssueRow comment and the domain/db test docs to name
the callers that reach the statement and its upsert half.
- Say in the PromoteClosedWispPreservesSession header that it guards the
classic path only.
- Add UpsertClearsClosedBySession: rewriting a closed row with an open
one must clear the stored session, not leave an open row with a stale
closing session. It fails if the upsert keeps the stored value when
the incoming one is empty.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Harry Miller <harry_miller@trimble.com>
---------
Co-authored-by: Harry Miller <harry_miller@trimble.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(wisp gc): apply the --age test to cascade children
`bd mol wisp gc --age` promised, in its own help text, that a wisp counts as
abandoned when it "has not been updated within --age AND is not closed".
Parents were held to that contract; children reached through the cascade were
not. A child was deleted purely because something it transitively depended on
was old, so `--age` meant nothing for children at all.
Raising the threshold is not a workaround: with `--age 720h`, a step created a
moment ago is still destroyed when its parent is older than 720 hours.
Observed blast radius: a molecule slung seconds earlier went down with all nine
of its steps — 43 beads in a single run — and the agent's hook emptied
instantly. Two rigs of three were hit; the third survived only because a stop
order reached it first.
Steps already picked up have been covered by `isProtectedWisp` since #4430, but
a freshly created step is still `open`, and `open` maps to CategoryActive, which
that guard deliberately does not protect. This closes the remaining path.
Tests: cascade deletion of a stale parent no longer takes a fresh child, and
raising --age does not save one either.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(wisp gc): stop re-cascading at delete time; pin the age contract in the proxied test
The integration test update Steve asked for surfaced that the selection fix
alone was incomplete: findAbandonedWisps now respects --age for cascade
children, but both delete paths re-derived the cascade at delete time and
swept fresh children past that filter anyway:
- embedded path: deleteBatch was called with cascade=true
- proxied-server path: DeleteIssuesParams{Cascade: true} re-expanded via
FindAllDependents in the domain layer
Both now delete exactly the set findAbandonedWisps selected — the selection
is the single place the --age contract lives.
Test cascade_sweeps_dependent_step_wisps is reshaped per review into
cascade_respects_age_for_dependent_step_wisps: a second child backdated past
the threshold IS swept (cascade still collects genuinely abandoned children),
the fresh child is absent from deleted AND still present in the wisps table
(the table-level check is what caught the delete-time re-cascade).
Verified against the shared dolt container (BEADS_TEST_PROXIED_SERVER=1):
TestProxiedServerWispGC all four subtests pass; TestWispGC* unit tests pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(wisp gc): age cascade children with wispIsAbandoned
Adopting #5219 onto main, which landed two changes after this PR was
written:
- #7246 (fixes#7236) moved the parents' age check onto
wispIsAbandoned, so --age 0s still collects a wisp whose DATETIME(0)
updated_at rounded up to half a second into the future. The PR's child
check kept the raw now.Sub(updated_at) <= threshold skip, which
re-opens #7236 for cascade children: under --age 0s a step closed in
the same second as the gc was left behind, orphaned, while its
abandoned parent was deleted. Children now take the parents'
predicate, so "the same --age contract as parents" holds; positive
thresholds behave exactly as before.
TestWispGCCascadeChildAgesAtStoragePrecision pins it at storage
precision and fails on the raw comparison.
- #5735 had already turned the delete-time cascade off on both gc
routes (GH#4394), so the PR's second commit now carries only its
proxied-test reshape. Main's delete-site comments gain that commit's
reason alongside GH#4394: a cascade there would also sweep fresh
children past the --age filter.
Also lists the PR's new wisp_gc_cascade_age_test.go in cmd/bd/BUILD.bazel,
which gazelle requires.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: mayor <6847071@gmail.com>
Co-authored-by: AB <6847071@gmail.com>
* docs(wisp gc): document the cascade's age policy; test it with a closed child
Review fixes for #5219, apply-fixes iteration 1.
- The 'bd mol wisp gc' help and the CHANGELOG now say what happens to
the dependents of an abandoned wisp. They are deleted with it only if
they meet --age themselves and are not live work, closed ones included
even without --all. A dependent that is too young is spared, and both
delete routes drop its edge to the deleted wisp, so an open one is
collected once it ages out and a closed one is left for --all,
--closed or bd purge: without --all the parent scan skips closed
wisps.
- A comment by the child loop in findAbandonedWisps says dependents are
exempt from the parent scan's not-closed clause, so a change that
aligns the two loops does not quietly leave an abandoned molecule's
finished steps behind.
- TestWispGCCascadeRespectsAge and the proxied subtest
cascade_respects_age_for_dependent_step_wisps close their stale child.
An open one was collected by the parent scan, so both passed with the
cascade disabled. With the child closed, a mutant that skips every
cascade child fails both.
docs/CLI_REFERENCE.md and docs/cli-reference/ are not regenerated: they
are built from the v1.2.2 pin in docs/cli-docs.pin.
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: mayor <6847071@gmail.com>
Co-authored-by: AB <6847071@gmail.com>
---------
Co-authored-by: mayor <6847071@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(http): bd gate check over http through issueops.ListGates
gate check listed its open gates with a raw SearchIssues filter (gate type,
closed excluded, --limit), which the HTTP backend refuses, so the command
failed before reading a gate on a remote scope and gc's core gate-sweep order
(bd gate check --type=timer --escalate) failed every tick there.
The listing now goes through issueops.ListGates over openQuerier on the
direct and proxied routes, the same entry bd gate list took in S20 (#7549):
the same question, served as queryIssues by every deployed server. The close,
the bead-gate target read and sighting, the pure timer arm and the gh/gt execs
are unchanged. The gh:run discovery's await_id persist still refuses on the
wire and counts as that gate's error.
The served corpus gains mc-gate-check-timer, mc-gate-check-gh (gate-sweep's
argv) and gate-check-all. No seeded gate carries an await type, since no wire
create accepts await_*, so these prove the listing is served.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(gate): name both refused gate check writes; close gate's filter hole
Review fixes for #7578 (apply-fixes, iteration 1).
CHANGELOG, minor (taken): the entry said a bead gate's sighting was
already served over HTTP. It is not. evaluateBeadGate records the first
sighting (await_seen) through recordSeen, which calls the raw
store.UpdateIssue (cmd/bd/gate.go:675). The HTTP Store has no UpdateIssue
override, so its embedded unsupportedDoltStorage refuses the call in the
client before any request is sent (internal/httpclient/unsupported_gen.go),
exactly as it refuses the gh:run discovery's await_id persist. "Refuses on
the wire" was wrong for the same reason. The entry now names both writes
and keeps "counts as that gate's error" (applyGateCheckResults counts
r.err). The sighting is written only when the check finds the awaited
bead, not yet closed, in the gate's own store; inspectBeadGate sets
seenHere only there.
CHANGELOG, nit (taken): `bd gate check --limit -1` used to list every
open gate on the direct and proxied routes, because the raw search
emitted no LIMIT clause for a negative limit. The listing now goes
through issueops.ListGates, whose Querier rejects a negative limit as
ErrValidation, and the HTTP server rejects it too
(internal/httpapi/query.go). The entry says so.
.golangci.yml, minor (taken): at this head cmd/bd/gate.go and
gate_proxied_server.go name no filter type (one each at the base), so
their slot in the cmd/bd forbidigo family only kept a hole open. `gate`
leaves the alternation, with a "LEFT this list" note like the ones for
search, status and count. gate_discover keeps its own hole:
findPendingGates still builds the raw filter.
Declined:
- bd gate discover still refuses over HTTP in findPendingGates (minor):
the synthesis' first remedy is no change in this PR, and the file is
not in this PR's diff. Finalize files the follow-up to move it onto
ListGates.
- the proxied listing is not pinned on its own (nit): it calls the same
listOpenGatesForCheck as the direct route (gate_proxied_server.go:106),
and the synthesis calls accepting the gap defensible.
- listOpenGatesForCheck/listOpenGatesWith naming (nit): the remedy is
"leave as is".
Verified:
- git diff --check: clean.
- bazel build --config=nogo -- //cmd/bd:all on the edited config: 16
targets, exit 0.
- Probe, then reverted: a types.IssueFilter literal in gate.go and a
types.WorkFilter literal in gate_proxied_server.go each failed nogo
with forbidigo's "do not write a filter here", so the hole is shut.
- git merge-tree against the heads of all 102 other open PRs that touch
CHANGELOG.md or .golangci.yml (today's census): this commit changes
no conflict count in either file. 43 PR/file pairs already conflict
with or without it.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
daysAge only checked the upper bound (maxOlderThanDays) before
multiplying by 24h. A day count negative enough overflows the
int64-nanosecond multiplication into a small positive duration, so
positiveAge's own check never sees the sign flip: `bd purge
--older-than=-213503d --force` purged every closed row older than a
day instead of being refused. Reject non-positive counts before the
multiplication can run.
Fixesgastownhall/beads#7524.
Separately: `bd purge ... --limit N` (no --force) previews N
deletions, but the confirmation's suggested --force command dropped
--limit, so following it literally deleted every eligible row instead
of the N the preview showed. Threaded limit through to the hint
builder (now its own function, sweepConfirmHint, for a direct unit
test) so the suggested command always matches the selection it
previewed.
Fixesgastownhall/beads#7534.
Verified the overflow fix catches the regression directly: temporarily
reverted just daysAge and confirmed the new -213503d/-213503 test rows
fail without it, pass with it. go build/vet clean, golangci-lint's two
findings are pre-existing in main.go, untouched by this change.
Claude-Session: https://claude.ai/code/session_01VN2SgXAHW1eTB1izwWwmyr
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Claude Code merges a project's hook settings into every session started in that
checkout, including an orchestrator's agent sessions, which get their own
briefing. A higher-precedence settings file cannot remove a lower one's hook, so
such sessions run `bd prime` whether it helps them or not. The only per-session
channel their host controls is the environment.
prime.disabled (BD_PRIME_DISABLED) makes bd prime print nothing, the same as
outside a workspace (an empty envelope under --hook-json), whatever its other
flags. It returns before any workspace or store access. Like the prime memory
caps it is a yaml-only key, and it is validated with strconv.ParseBool, the set
that viper's GetBool reads.
Measured on a copy of a 751-memory store, bytes a hook injects:
- bd prime: 1,251,189 (the default is unchanged);
- BD_PRIME_DISABLED=true bd prime, --full, --memories-only: 0;
- BD_PRIME_DISABLED=true bd prime --hook-json: the empty envelope.
In the Gas City deployment that owns that store, 637 agent sessions in 48 hours
fired the inherited hook 1,271 times. Each firing injected a 2.3 KB preview after
host truncation. On top of that, the sessions read 1.81 MB of the persisted
output. That is about 4.8 MB of context these sessions do not use.
Tests:
- TestPrimeDisabledReadsTheConfigKey.
- TestPrimeDisabledPrintsNothingInAWorkspace. A staged workspace's briefing
prints when the key is off; the test fails if the early return is removed.
- TestValidateYamlConfigValue_PrimeDisabled.
- The embedded TestEmbeddedPrime/prime_disabled_env and
/prime_disabled_config subtests.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(schema): probe sentinel columns with SHOW COLUMNS, not INFORMATION_SCHEMA.COLUMNS
cursorRealityFloor runs on every store open. Its column sentinel used
INFORMATION_SCHEMA.COLUMNS, whose predicate Dolt does not push down: on a
sql-server hosting ~30 databases the probe scanned every database and took
5-6 s per open (measured 2026-09-17, dolt 2.3.x). A 15-store federated
gc ready spent ~80 s of its 90 s there. SHOW COLUMNS on the same server
answers in 0.15 s.
The existing content_hash prober is generalised into showColumnExists and
the open-path sentinel points at it; the repair paths keep
schemaColumnExists as is (they run once per migration, not per open). Mocks
pinned to the old form are moved to the SHOW COLUMNS form.
Rebased onto current main: lock_test.go conflicted only on context
(newer tests above expectIgnoredSentinelProbes); kept, helper comment
taken from this change.
(cherry picked from commit f02fff7bb5e1483cc8650afd20323d779db57334)
Claude-Session: https://claude.ai/code/session_01Ww5wAw2ybpByzduNHo5UYB
(cherry picked from commit e012f3a605)
* test(schema): pin the column sentinel probe to a never-failing carrier read
Red half of guarding #7297's SHOW COLUMNS sentinel probe (be-bv7x).
SHOW COLUMNS fails on a missing table, and on the store's multiStatements
DSN a failing statement pins the pooled Dolt session to its pre-statement
catalog: a table another connection creates afterwards stays "table not
found" on that session (reproduced on dolt 2.1.8 and on the 2.2.0 the
test harness pins). leases, the column sentinel's carrier table, is
exactly what every release-lineage store lacks.
- TestSentinelColumnProbeNeverAsksAMissingTable,
TestSentinelColumnProbeReadsAPresentTableExactly and
TestSentinelColumnCarrierProbeErrorIsNotTreatedAsContradicted pin the
probe through the sentinelTableExists seam.
- TestIgnoredCursorReadWithLeasesAbsentIssuesNoFailingStatement walks the
guarded cursor read with a strict ordered mock (currentVersion surfaces
an unexpected statement; atLatest would swallow it).
- TestSentinelColumnProbe_PoolSeesLaterTables reproduces the pin on a real
sql-server: a one-connection pool reads the ignored cursor with leases
dropped, leases is re-created on another connection, and the pool must
see it.
All of them fail against the unguarded probe. The ordered sentinel mocks
now expect the carrier read ahead of SHOW COLUMNS.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(schema): read the column sentinel's carrier table before SHOW COLUMNS
#7297 moves the per-open column sentinel (leases.granted_node) from
INFORMATION_SCHEMA.COLUMNS, which Dolt does not push down, to SHOW
COLUMNS: on a sql-server hosting 28 databases that is 372 ms against
0.9 ms per write-capable open. But SHOW COLUMNS fails on a missing table,
and the carrier table is exactly what a release-lineage store lacks (no
leases before ignored/0012). On the store's multiStatements DSN a failing
statement pins the pooled Dolt session to its pre-statement catalog, so
the leases table the ignored replay then creates on another connection
stays "table not found" on that session (be-bv7x; dolt 2.1.8 and 2.2.0).
sentinelColumnExists now reads the carrier's existence through
sentinelTableExists, whose read succeeds whether or not the table is
there, and only sends SHOW COLUMNS to a table that exists. A missing
table still reads as a missing column, so the floors, the short-circuit
order and the decision in cursorRealityFloor are unchanged; a failed
existence read surfaces instead of reading as a contradiction.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Eric Cestari <eric@escapevelocity.fr>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(http): answer a command's repeated reads from one response (port of bd-enterprise e626072b8)
Over an http workspace, bd show <id> --json made three identical
GET /v0/beads/issues/<id> requests: the id resolver's exact probe,
routed.go's GetIssue and show's detail read all build the same URL. Text
show made six. Over a gateway each one is a sequential round trip, so the
request count is the command's latency floor (mc-5dkzp).
This ports bd-enterprise e626072b8 (bts-xpw.3.14.6, #217) verbatim, except
cmd/bd/main.go, where OSS still opens the identity preview inline, and
bd-enterprise's httpgw dialer test, which has no OSS counterpart:
- httpclient.WithSharedConnections: the identity-gate preview and the real
open share one transport, so a write makes one handshake.
- httpclient.WithReadMemo and a wire.Client read memo, for one-shot
commands only (not bd serve, --watch or --follow): identical getIssue,
getSetting and listSettings reads are answered from the response already
received. An entry ages from the server's answer (5 s), any write clears
the memo, a read that overlapped a write is not stored, and expired
entries are swept.
- bd list's three vocabulary reads come from one memoized listSettings.
- bd update --status / --if-status skips the custom-status read for a
built-in status.
- The hook decorator skips its post-write re-reads when no executable hook
exists for the event.
- bd dep add reads its confirmation titles before the write, from the memo.
Against a loopback bd serve: show --json goes from 3 requests to 1, text
show 6 to 3, update 5 to 3, close 6 to 4. Dolt and the other registered
backends receive the same ctx and ignore it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(http): BD_HTTP_READ_MEMO=0 turns the per-command read memo off
An operator who suspects a stale read can rule the memo out without a
rebuild. Any other value, or none, leaves the default.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(http): pin bd show to one fetch per issue (mc-5dkzp)
TestE2E_PerCommandRequestBudget allowed show two requests, and a read
that drifts to a URL of its own (a mutant whose reader spells
brief_deps=false) fits that ceiling on both handshake shapes. These guards
pin the single fetch instead:
- TestE2E_ShowFetchesTheIssueOnce: the exact requests, path and query, of
show --json, show --json --id, show --short, show of two ids and text
show, against both handshake shapes, plus a BD_HTTP_READ_MEMO=0 step
that must read the row more than once.
- TestDefaultIssueReadsShareOneMemoKey: the resolver's exact probe,
GetIssue, GetDependenciesWithMetadata, GetLabels and IssueReader().Get
build one URL, checked without a server.
- TestE2E_CloseRereadsItsOwnWrite: against the MC handshake, closing a
lone molecule re-reads its own closed row from the server after the
write, and prints no false "completed molecule" note.
- Corpus shapes can pin `requests:`, counted on the served run alone (not
setup, verify or {rev:ID} reads). The seven gc and mc show shapes pin
1, 4, 1, 1, 3, 1 and 3.
Also: TestReadMemoOptInReadsTheRealPollingFlags holds the opt-in to the
real show/list --watch and -w, events tail --follow and bd serve; the
show budget drops from 2 to 1; requestCounter records each request's
query; and ledger row L-read-memo records the memo's bounded difference
from local reads.
Mutation runs against this tree: brief_deps=true on GetIssue and
brief_deps=false on the reader's Get each fail the e2e list and the unit
test; show opting out of the memo fails the e2e list; writes that leave
the memo standing fail the read-your-own-write e2e; a memo keyed by path
alone fails the e2e list; dropping the kill switch fails its unit test
and the e2e step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(config): list BD_HTTP_READ_MEMO
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(http): memoize a read's answer only once it has decoded
wire.Client.Do stored a memoable read's 2xx before it checked the body,
so an empty or undecodable 200 would have answered every identical read
in the command for the memo's whole TTL with the same failure, instead
of asking the server again. The answer is now stored only after it
decodes; a read that decodes nothing (out == nil) is not stored, and
every memoable read in this package decodes its answer.
TestReadMemoKeepsOnlyAnswersThatDecoded pins it (empty body, truncated
body, undecoded answer). Ledger row L-read-memo says so.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(http): pin the read memo's 5xx, write-method, per-client, in-flight-write and hook-gate behavior
Review follow-ups for the per-command read memo (mc-5dkzp):
- TestReadMemoNeverKeepsA5xx: a 503, 500 or 502 is not memoized and the
2xx after it is. TestDispatchRetryOfABusyMemoizedReadAsksTheServer
holds the same through dispatch's retry loop over a real wire.Client:
the retry reaches the server instead of replaying the 503.
- TestReadMemoIsDroppedByAnyWrite covers POST, PUT and DELETE, not just
PATCH.
- TestReadMemoIsPerClient: in either order, one client's read is never
answered from another's memo, and opting one client in opts in no
other. (A shared memo was otherwise caught only by test-order
pollution.)
- TestReadMemoDropsAnAnswerReadWhileAWriteWasInFlight pins the clear on
the write's way back: a read that starts and ends while the write is
on the wire is not answered again once the write has returned.
- TestHookFiringStoreReReadsOnlyForAnEventWithAHook pins hookConfigured's
probe: the decorator asks the runner about the event it fires, and
re-reads the row to build a payload only when a hook for that event
exists, through a probing double and through a real hooks.Runner.
Each was run against a mutant of the code it pins and fails there:
5xx stored before the status check; only PATCH clearing; one memo
shared by every client; no clear after the write returns;
hookConfigured answering true, false, or about the wrong event.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(changelog): note the per-command http read memo
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): dial a large batchApply under the server's extended budget
bd serve runs an issues:batchApply over largeApplyItemThreshold (100) items
under DefaultLargeApplyCeiling (5m) on a context detached from the client,
but the wire client capped every request at DefaultTimeout (60s). A large
apply on a slow or loaded server therefore failed client-side with
"Client.Timeout exceeded while awaiting headers" while the server went on
to commit it: an error for an apply that landed.
wire.Request.Timeout now raises (never lowers) a bounded client's
per-request ceiling for one request, through a shallow copy of the
*http.Client that shares its Transport and forced CheckRedirect. ApplyBatch
sets it to LargeApplyTimeout (6m) once the plan exceeds
LargeApplyItemThreshold. The stall-retry deadline uses the same per-request
ceiling.
Tests:
- wire: a slow fake server times out an at-threshold apply under a short
ceiling and completes an over-threshold one; httpClientFor only raises a
bounded client and keeps its Transport and CheckRedirect.
- httpapi: TestTheClientLargeApplyBudgetCoversTheServer pins the redeclared
threshold to the server's and holds LargeApplyTimeout above request read
+ large-slot wait + ceiling + drain grace (5m45s).
- httpclient (served tier): a 101-item apply against a BatchApplier delayed
DefaultTimeout+5s, dialed through DialWith + DialOptionsForTarget like
the product, commits and returns success (71s). With the raise disabled
it fails at 60.03s with Client.Timeout.
Ported from bd-enterprise (gascity/bd-enterprise#195).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(httpclient): pin the raised stall-retry deadline; document the 6m large-apply ceiling
Review fixups for #7582.
- wire: TestARaisedRequestTimeoutAlsoBoundsTheStallRetry pins the one
OSS-only hunk of the port, the stall-retry deadline read through
httpClientFor(r). Reverting that line to c.hc.Timeout left the whole wire
package green; the new case fails on it, because the retry then runs out
at the client's own ceiling instead of the request's raised one.
- backend/http: Options.HTTPClient said the client is used as given except
for redirect handling. A batch apply over 100 items now raises a Timeout
shorter than 6 minutes for that request, so the public doc says so.
- README and CHANGELOG: the HTTP backend's write bound is no longer 60s for
every request. A batch apply over 100 items gets 6 minutes, and a server
whose --large-apply-ceiling is raised past about 5m15s can still outlast
it.
- engdocs/SERVE_RUNBOOK.md: the same limit, next to the stop-grace sizing
an operator reads before raising --large-apply-ceiling.
- served_batch_apply_test: the race-build comment blamed the client's 60s
timeout for shrinking the 1000-item apply. A plan that size now gets
wire.LargeApplyTimeout; it stays shrunk because the embedded tier measured
it at 903-945s under -race.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(blocked): climb through a blocked parent with no reason row of its own
A blocked parent the explained-parent walk meets that neither read returned
was treated as a final unexplained ancestor. That is right for a parent with
a reason row of its own (the complete read decided it), but a parent with
none carries only an inherited bit, and the walk had nothing to decide it
from. In a malformed parent-child cycle (SkipCycleCheck, import, merge
replay) a stale is_blocked = 1 on such a parent held itself up: it dropped
the explained parent below it, which darkened it back, so full repair
converged on the stale state and the doctor check counted 0.
climbBlockedParentsInTx now sorts each unmet blocked parent: explained by its
own subtree (climb on), carrying a reason row and not explained (final), or
carrying no reason row (transparent: entered as explained and climbed
through, and dropBlockedFromAbove decides it from what is above it). The new
read, withoutReasonAmongInTx, uses blockingReasonSQL, the same predicate the
explained-parent reads aggregate.
Closes gastownhall/beads#7386.
Tests: TestParentChildCascade_CycleStaleBitSelfSustains (the issue's repro;
FAIL at 5a5b7cfd66 before the fix, PASS after) and
TestParentChildCascade_InheritedBitStillCascades (a no-reason parent under an
exogenously blocked one still cascades, before and after the fix). Ran the
dolt package's blocked/cascade set and internal/storage/issueops locally
against a dolt 2.2.0 server; golangci-lint 0 issues on both packages.
Agent-Signature: claude-code-claude-fable-5-1-unknown-reasoning on behalf of bee
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(blocked): pin the scoped climb through a no-reason parent
Review fixes for #7420 (fixes#7386). All are minors from the adopt-pr
review; no blocker or major was raised, and blocked-state behavior is
unchanged.
- Test evidence: the PR's tests drive only the complete read (recomputeAll
and the doctor count). The scoped half of the climb, which the per-write
recompute and merge replay reach through batchExogeneity, had no pin: a
mutant that skips withoutReasonAmongInTx on a scoped read
(if !complete { undecided = nil }) passed every blocked test. Add
TestParentChildCascade_CycleStaleBitScopedRecompute, the same malformed
cycle driven through RecomputeIsBlockedInTx. It fails at the base and
under that mutant, and passes here.
- Comment truth in blocked_consistency.go: the set bullet now names every
parent the walk enters as explained (the read's, those a scoped walk
finds explained, and the no-reason parents it climbs through) and says
only the read's are returned; COST counts an edge read per level the
walk climbs and the reason-row read by id on both paths; the explained
map's doc covers climbed-through parents; blockingReasonSQL names both
of its callers.
- Scope of the claim: the CHANGELOG entry and the cycle test's doc now
say what is fixed, a stale bit that holds itself up THROUGH a parent
that blocks on its own child, on both the full repair and the per-write
recompute. A no-reason cycle that holds itself up without running
through such a parent keeps its stale bits with a doctor count of 0,
as it did before this change: one above such a parent (Q<->D over P),
and one with no close gate at all, which an ordinary close can leave
behind. Those are left to a follow-up, not claimed here.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
#7478 deleted the frozen 15-shard proxied and 20-shard embedded manifest
blocks and refreshed most comments that described pr-risk.yml's retired
fork/push jobs as still running. Finish the #7382 adoption follow-ups on
what survived: the Close3/Close4 split is cited as #7173 (bd-ojckcg), and
the remaining present-tense references to the legacy jobs (bazel.yml's
embedded-lane rationale and cmd-dolt lane note, BUILD.bazel's socat note,
TESTING.md's socat paragraph) now say the jobs are retired (bd-g2w5rp).
bd-3lht (the hand-held 15-shard header round-trip) is moot: the block no
longer exists.
Comments and docs only; no shard assignment, workflow step or BUILD
setting changes.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(scripts): update-nix-vendorhash no longer reports a build failure as success
scripts/update-nix-vendorhash.sh treated the absence of a "got:" hash
line as proof the vendorHash was already correct, so a build failure
unrelated to a hash mismatch (e.g. a Go toolchain too old for a
dependency) was misreported as success and the workflow went green on
a broken build (#7496). Fixed by capturing the intentional-failure
build's real exit status instead of discarding it with `|| true`, and
using that exit status (not a "hash mismatch" string grep) to tell a
genuine no-op apart from an unrelated build break.
The step-5 verification build had the same shape of bug: piping
through `tee` without pipefail meant the if-condition tested tee's
exit status, not the build's, so a failing verification build still
printed "Build successful!". Scoped `set -o pipefail` to just that one
line rather than the whole script, since the earlier hash-extraction
step legitimately relies on `grep -o` returning non-zero on no match.
Fixesgastownhall/beads#7498.
Added an independent `nix build .#default` step to
update-vendor-hash.yml so the workflow no longer trusts the script's
exit status alone, even if a future bug in the script reintroduces a
false-success path.
Fixesgastownhall/beads#7499.
Added TestPinnedDoltCLIAtLeastRecommendedMin, asserting the pinned
Dolt CLI version (scripts/ci/install-dolt.sh) is at least
doltversion.RecommendedMin, so the two policies can't silently drift
apart — RecommendedMin's own doc comment already claims this alignment
but nothing enforced it.
Fixesgastownhall/beads#7500.
Verified by reproducing both update-nix-vendorhash.sh failure modes
with a stub `nix` binary (a non-hash build failure, and a step-5
verification build failure) and confirming the intended successful
hash-update path still works end to end. go build/vet clean,
golangci-lint 0 issues, go test ./scripts/... passes except a
pre-existing unrelated failure (TestControlQueryScriptPreservesReadyProbeFailure,
tracked separately as beads#7293 and untouched by this change).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VN2SgXAHW1eTB1izwWwmyr
* chore: empty commit to retrigger CI -- retrying after a 3-hour quota recovery window
* chore: empty commit to retrigger CI -- isolated single retry after real-bug fixes landed on sibling PRs
* fix(scripts): add missing BUILD.bazel dep, sharpen vendorhash diagnostics
scripts_test now imports internal/doltversion (for
TestPinnedDoltCLIAtLeastRecommendedMin) but scripts/BUILD.bazel had no
matching dep row, which would fail the target's compile under
rules_go once Bazel actually runs against this branch (the Bazel /
jobs failing so far died in bazel.fork-cert, unrelated to this).
Also, per review: scope set -o pipefail to just the step-5 verify
block (turn it back off after, rather than leaving it on for the rest
of the script with a comment claiming it's scoped when it isn't), and
keep the old "hash mismatch" string check as a sub-case in the
ACTUAL_HASH-empty branch, so a hash mismatch whose got: line fails to
parse (e.g. a future Nix output-format change) is diagnosed
differently from a build that failed for an unrelated reason.
Re-verified all four failure/success paths with a stub nix binary
(non-hash failure, hash-mismatch-with-unparseable-got-line,
step-5-verify failure, and the genuine happy path). go build/vet
clean, golangci-lint 0 issues.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VN2SgXAHW1eTB1izwWwmyr
* fix(scripts): update-nix-vendorhash preserves operator backups, restores on any handled failure
The script backed up default.nix to a fixed name in the repo root,
default.nix.backup, before editing it -- but that is also the
conventional name an operator gives their own manual backup. Running
the script unconditionally overwrote (then later deleted) any such
file. A failed step-5 verification build also left the candidate hash
in default.nix with no backup at all to restore from, since the
backup had already been deleted right after step 4 applied the real
hash.
Moved the backup into a private per-run scratch directory
(mktemp -d, cleaned on every exit via an EXIT trap) instead of a
fixed repo-root name, so it can never collide with an operator's own
default.nix.backup. Copy with cp -p so a restore brings back the
exact original bytes AND mode, not just content. Kept the backup
around through step 5 instead of deleting it right after step 4, and
added a restore on the step-5 verification-failure path, which
previously left the unverified candidate hash in place.
Also: the "no hash mismatch, already correct" exit-0 path previously
inferred correctness purely from the fake-hash probe build's
unexpected success, without ever building the real, restored file.
It now runs a second build against the restored file and only exits 0
if that succeeds too, surfacing a diagnostic log if it doesn't.
Fixesgastownhall/beads#7529.
Verified with a stub nix binary across five scenarios: a pre-existing
operator default.nix.backup (distinct content + mode 600) survives
untouched in every one; a non-hash build failure restores the
original (content + mode 640); the already-correct path now runs two
builds and only succeeds if both do; the core bug repro (hash
extracted, step-5 verify fails) now restores the original instead of
leaving the unverified candidate hash with no backup; the genuine
happy path still updates the hash correctly. No leftover scratch
directories in any case. go build unaffected (shell-only change).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VN2SgXAHW1eTB1izwWwmyr
* fix(scripts): update-nix-vendorhash restores the original on an interrupted run
A SIGINT/SIGTERM during the probe build (the long step) reaches this
script and its nix child as one process group; the child dies, this
script exits through the EXIT trap with the placeholder hash still in
default.nix. The plain `rm -rf "$SCRATCH_DIR"` trap deleted the only
backup at that point, leaving no way back except `git checkout
default.nix` -- which also discards any uncommitted operator edits.
Worse than every handled failure case this file already restores
from.
The placeholder is never a valid end state, so the EXIT trap now
checks for it and restores first, before dropping the scratch
directory. Every handled exit path has already restored or verified
default.nix by the time it runs, so this is a no-op there -- it only
fires on an interrupted run.
Found by review on PR #7504 (beads#7529's own follow-up): reproduced
and confirmed with a stub nix that signals its own parent process
group, matching a real Ctrl-C mid-build. Confirmed the bug first
(plain trap: placeholder left in place, backup gone, matching the
report exactly), then confirmed the fix (original hash and mode
restored, operator backup untouched, no leftover scratch dir). Also
re-ran the full existing scenario matrix (non-hash failure, hash
mismatch with step-5 verify failure, genuine happy path) to confirm no
regression.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VN2SgXAHW1eTB1izwWwmyr
* fix(scripts): restore default.nix if vendorhash verification is interrupted
The EXIT trap restored default.nix only while it still held the placeholder
hash. A SIGINT/SIGTERM during the step-5 verification build therefore left
the unverified candidate hash in place and deleted the only backup with the
scratch dir. Track VERIFIED instead: until a build has verified default.nix
as it stands, any exit restores the original. On handled paths this is a
no-op, since they have already restored or verified the file.
Write the build logs under ${TMPDIR:-/tmp} with per-run names. The
verification log had a fixed /tmp name shared by every run and every user.
Add the regression tests the #7498/#7499/#7529 fixes lacked:
- TestUpdateNixVendorHashReportsTheRealBuildResult runs the script with a
stub nix over a non-hash build failure, an unparseable mismatch, a failed
verification, a half-parsed got: hash, a real update, and a probe that
accepts the placeholder (restored file builds, or not). Every failure
exits 1 with default.nix restored byte for byte and mode for mode, the
operator's own default.nix.backup untouched and the named logs kept.
Against main's script it reproduces each false success.
- TestUpdateNixVendorHashInterruptRestoresOriginal signals the script's
process group during the probe build and during verification.
- TestUpdateVendorHashWorkflowBuildsIndependently pins the workflow's
unconditional `nix build .#default` between the script and the
match-report and push steps.
The scenario matrix, operator-backup and file-mode fixture, and workflow
ordering check are adapted from BlueboxC's correction of this PR in their
fork (62e7718e), as described on #7498 and #7529.
Refs #7504, #7496, #7498, #7499, #7500, #7529
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-authored-by: BlueboxC <david@blueboxcomputers.es>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: BlueboxC <david@blueboxcomputers.es>
* perf(externaldeps): annotate a page's blocking state in one pass, not one IsBlocked per id
The external-dependency BlockingAnnotator overlaid IsBlocked on the
backend's answer one item at a time. Each IsBlocked made several reads
(the stored flag, both edge tables, the blockers' statuses), read the
item's own edges again, and resolved its external refs on its own, so a
foreign project was opened once per item. Over a remote serve,
listBlockingAnnotations cost 9-20 ms per id, and a 1,400-id refresh took
about 12 s.
The annotator now reads the whole page once:
- the local half through a new optional storage.BlockersBatchStore,
IsBlockedWithBlockersBatch, backed by
issueops.IsBlockedWithBlockersBatchInTx (the stored flags, the blocked
ids' blocking edges from both tables, one status read). The dolt and
embedded dolt stores implement it, and a store without it still gets
one IsBlocked per id;
- the external half from ONE read of the page's own edges, whose refs
are resolved together, so each foreign project is opened at most once
per request.
The answer per id is IsBlocked's, unchanged: a blocked item's BlockedBy
is the local live blockers, then the unsatisfied refs. Both reads now
order a source's blocking edges by (depends_on_id, type). The single
read had no ORDER BY, so its order was the table's, which is a UUID key
on these tables.
Tests:
- TestBlockingAnnotatorReadsAPageOnce pins 1 own-edge read, 1 foreign
open, 1 batch read and 0 per-id reads for 40 ids. On the old body it
failed with 40, 30, 0 and 40.
- TestBlockingAnnotatorFallsBackPerIDWithoutTheBatchRead covers a store
without the batch read.
- TestPolicyBlockingAnnotatorBatchEqualsPerItem (embedded dolt) compares
the batched answer, and IsBlockedWithBlockersBatch, against the
per-item path by deep equality. It covers local blockers of every
blocking type, closed and pinned blockers, parent-chain blocking,
waits-for and conditional-blocks gates on both planes, satisfied,
unsatisfied and unconfigured external refs, a non-blocking external
edge, local plus external, a free row and a missing id.
- TestPolicyBlockingAnnotatorForeignOpensAreSublinear logs N=10 at 1.9 s
per-item vs 0.26 s batched, and N=40 at 7.5 s vs 0.29 s. Foreign opens
go from N to 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(dolt): pin server-mode IsBlockedWithBlockersBatch against IsBlocked
Review apply-fixes for #7556, iteration 1. Two minors are taken here, the
merge conflict is left to the pre-approval rebase, and two items are
declined. All changes are a test and a doc comment; no runtime code moves.
Taken: server-Dolt test for the batch arm (Test Evidence Quality)
- TestIsBlockedWithBlockersBatchMatchesPerRow runs the DoltStore arm that
bd serve and server-backed bd list take, which no test executed before.
It compares each id's entry with IsBlocked through reflect.DeepEqual.
The fixture reuses the embedded fixture's shapes as the raw store sees
them: blocks, a parent-child chain (the list is nil), waits-for,
conditional-blocks, a wisp source and a wisp blocker, closed and pinned
blockers, and external refs (blocks and related), which the raw store
drops. It also covers a free row, a missing id and repeated ids. Two more
cases reach code the embedded test does not:
- one id that exists in both issues and wisps, with an edge in each table;
- 210 blocked ids with 210 distinct blockers, more than queryBatchSize
(200).
- Mutants were applied to the PR's code with the test binaries rebuilt.
Five fail the new test and pass the existing embedded
TestPolicyBlockingAnnotator* tests:
- edge-chunk: read only the first edge chunk;
- status-chunk: read only the first status chunk;
- no-dedup: drop the repeated-id check;
- table-order: read wisp_dependencies first;
- server-wrapper: the DoltStore wrapper returns an empty map.
A sixth mutant, no-order (drop ORDER BY), fails both the new test and the
existing embedded batch-equals-per-item test.
Taken: BlockersBatchStore doc (Contract and Interface Fidelity)
- The doc now says the interface answers for the raw store alone, with no
external-dependency policy applied. It is meant to be called from inside
that policy's decorator, not probed through UnwrapStore by a caller that
holds the decorated store.
Deferred to the pre-approval rebase: conflict with #7552 (role_accessors.go)
- This change does not rebase. On a scratch merge with main 70887e708a,
this resolution was validated:
- keep this PR's
state := states[id]; if state.blocked { BlockedBy = state.blockers };
- nest #7552's IncludeIsBlocked flag (IsBlocked = boolPtr(true)) inside
that branch;
- keep boolPtr.
- Results on that merged tree:
- go vet: clean;
- go test ./internal/storage/externaldeps/: 66 pass, including
TestBlockingAnnotatorFlagsUnsatisfiedExternalRef;
- embedded BlockingAnnotator|IsBlocked tests: 22 pass;
- served httpclient Blocking|Blocked|ExternalDependency|Ready tests with
BEADS_HTTP_TEST_REQUIRED=1: 96 pass, plus 4 known-divergence skips that
predate this change.
Declined
- Duplication (route blockedStates' external half through
blockingStateFromRecords): this refactors contributor code, adds the
"external dependencies: resolve blockers:" error prefix, and is not
test-only. Recorded as a follow-up.
- Pattern Drift nit (move the guards next to their methods, rewrap the
AnnotateBlocking comment): optional churn next to the conflict region.
Recorded as a follow-up.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(http): advertise issues.update.claim and route claims by it (S24a/b)
updateIssue has served `claim` (upstream #6890), resolved on both planes so
a wisp is claimable, with no capability token: a client could only find it
by eating the skew 400, and gc's wire_compat preflight (which lists
issues.update.claim as an optional token) never saw it, so gc claimed every
wisp through claimIssue, whose Claimer role excludes the wisp plane.
Server: CapIssuesUpdateClaim ("issues.update.claim") joins
behaviorCapabilities. The spec names it on UpdateIssueRequest.claim and in
the context capabilities prose (apigen regenerated, descriptions only). No
request or response member changes; wire_revision stays 2.
Client: Lifecycle.Update reads the token from the cached handshake before
the dial. With it, every claim is one updateIssue call and its answer is
final (no fallback on any error). Without it, a claim alone goes straight to
claimIssue (no doomed 400 first; a wisp still refuses by name,
W-ClaimRequest.Wisp, whose Why now names the token), and a claim beside a
patch, a guard or a force override is refused before the dial with
ErrUnsupported{Capability: issues.update.claim}. serverPredatesUpdateClaim
(the error-sniffing fallback) is gone.
Tests: the four capability lists (routes.go, wire/handshake.go,
server_test, wire vocabulary_test) move together; unit tests for both
routes (pre-dial refusal dials nothing; with the token nothing falls back);
served tests claim a wisp through updateIssue with the token (zero claimIssue
dials, post-claim revision stitched), refuse it by name without it (zero
updateIssue claims, one claimIssue), and refuse a claim beside a patch
without the token while the same request claims and patches the wisp with
it. Live-mutated: ignoring the token fails the unit test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(http): count only ready --claim's requests in the claim-next check
TestE2E_AdvertisedExternalPolicyIsPassedThrough counted every request
since counter.reset(), so its "no by-id claim" check also saw the earlier
`update <other> --claim` step. The MC handshake mask does not advertise
issues.update.claim, so this PR routes that claim to claimIssue
(POST /v0/beads/issues/<id>:claim) by design, and the check failed in
Bazel / embedded Dolt tier (//backend/http:http_served_test shard 6 of
7), turning CI Gate / Required red.
Count from the snapshot length taken just before `ready --claim`, so the
check covers only the requests that command issues. The counter is not
reset: the close-policy check below scans the same history.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(http): refuse a token-less template claim on the client's pre-read
Against a server without issues.update.claim, Lifecycle.Update sends a
claim alone to claimIssue (claimWithoutUpdateClaim) and returns before
applyTemplateGuardForServer runs. claimIssue's role has no template check
(bd-jkp9v3), so `bd update <template> --claim` against every server
without the token claimed the template. The base refused it before any
write: on the client's pre-read against a server without
issues.update.allowTemplate, and in updateIssue's own guard against one
with it.
claimWithoutUpdateClaim now pre-reads the row and returns
AuthorizeTemplateUpdate's refusal before the claimIssue dial, whatever the
handshake says about allowTemplate: that token means updateIssue guards
templates, and this route never dials updateIssue. Any other row goes on
to claimIssue as before (a wisp to its refusal by name), and so does an id
the pre-read cannot find, so claimIssue's not-found stays the one reported.
TestUpdateClaimRefusesATemplateWithoutTheToken (stub wire) and
TestServedUpdateClaimRefusesATemplateWithoutTheToken (served tier) pin it
under an allowTemplate-only and a neither-token handshake. Both go red
without the pre-read; the allowTemplate-only legs also go red if the
existing guard is only moved above the claim branch.
TestUpdateClaimFailsClosedWhenThePreReadFails pins the pre-read's third
arm under the same two handshakes: a read that fails other than as
not-found returns that failure and never dials claimIssue, since the
row's template bit is unknown then. A best-effort pre-read (that failure
falling through to the claim) passed go test ./internal/httpclient/ and
its served Claim|Template tier before this test, and goes red on both
legs with it.
A claim beside AllowTemplate is refused before the dial with
ErrUnsupported naming the token, like a claim beside a patch, a guard or
a force override (isClaimOnlyUpdate already excluded it), but no prose
said so: claimWithoutUpdateClaim's doc, CapIssuesUpdateClaim's doc, the
test doc and the CHANGELOG entry now list it, and a
TestUpdateClaimAgainstAServerWithoutTheToken row pins it. Dropping
!req.AllowTemplate from isClaimOnlyUpdate passed the same unit and served
runs without that row and goes red with it.
The prose now follows the handshake rule too: the W-UpdateRequest.Claim
ledger row (and its re-rendered md) no longer calls claimIssue the
fallback for a server that 400s the member, Update's doc names
claimWithoutUpdateClaim instead of the nonexistent claimRouteForServer,
wire.UpdateFlags.Claim drops the "safe to read as skew" rationale no
caller relies on anymore, and the CHANGELOG entry says a template is still
refused on the token-less route.
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.5 <noreply@anthropic.com>
* feat(http): serve IsBlockedBatch through the BlockingAnnotator role behind dependencies.blocking.isBlocked
gc's native ready cache needs bd's stored, transitive is_blocked column for
the active set (beads.BlockedQuerier.IsBlockedBatch). Over http the client
answered it with the generated stub, so every reconcile logged
`operation "IsBlockedBatch" not supported by the http backend`, the
projection stayed disabled and native Ready took ~5 s on the MC shadow.
No read a deployed (1.3.0) server serves can answer the column exactly:
the /v0 reads hydrate issues without is_blocked, the blocking decoration is
direct and two edge types only, and the flag also propagates down
parent-child edges and reads waits-for / conditional-blocks gates. So this
is an additive server behaviour plus a token, not a client-side
composition.
- issueops: BlockingRequest.IncludeIsBlocked asks for, and
IssueBlocking.IsBlocked carries, each answered id's stored flag (nil =
no row, never "free"). issueops.BlockedFlags is the one library entry
for the batched read over the role, chunked at BlockedFlagsChunk (100,
held equal to the served issue_id bound by an httpapi test).
- Bodies: storage/issueops.ExecuteBlockingAnnotation reads the flag with
IsBlockedBatchInTx in the same read transaction (dolt, embeddeddolt and
every sqlkit-style store that calls it); the unit-of-work body asks the
new DependencyUseCase/Repository IsBlockedBatch (same shared SQL body).
externaldeps keeps IsBlockedBatch's external-blocker invariant on the
local and remote annotators, and its Store.IsBlockedBatch no longer makes
the raw edge read over a role-served store.
- Wire: GET /v0/beads/dependencies/blocking accepts `is_blocked` behind the
new behaviour token dependencies.blocking.isBlocked (spec, apigen,
wire-shape golden). wire_revision stays 2.
- Client: httpBlockingAnnotator forwards IncludeIsBlocked and refuses it
BEFORE dialing with *ErrUnsupported{Capability:
dependencies.blocking.isBlocked} against a server that does not
advertise it; Store.IsBlockedBatch is issueops.BlockedFlags over that
annotator, so gc's errors.As latch still sees the typed refusal on an
old server, now naming the token that lifts it.
Tests: conformance case RunBlockingAnnotatorReportsTheTransitiveBlockedFlag
(child of a blocked parent is blocked, free is false, a ghost has no flag,
unasked carries none, BlockedFlags agrees) on the dolt, embedded, uow and
served legs; httpapi handler and chunk-bound tests; client tests for
chunking, the wire shape and the zero-dial refusal; vocabulary/capability
gates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(externaldeps): keep the external blocker on the unit-of-work IsBlockedBatch
bd serve on a server or proxied-server workspace serves through the
unit-of-work arm (WrapUOWProvider) and advertises
policy.external_dependencies, so a client trusts the server's answers and
adds no external term of its own. That arm's dependency use case did not
override IsBlockedBatch, so the new dependencies.blocking.isBlocked flag
answered the stored is_blocked column, which has no external term. An issue
blocked only by an unsatisfied external: ref came back is_blocked=false,
with that ref listed in its own blocked_by, while GET /v0/beads/ready
excluded it.
dependencyUseCase.IsBlockedBatch now raises every id that has an
unsatisfied external blocker, deciding by the edges and resolver
GetReadyWork excludes by, read through the same unit of work. Unlike Ready
it resolves only the refs of the ids the column answered: a client asks in
chunks, and no chunk should reopen every foreign project the workspace
names. An id naming no row stays absent.
Also correct the store decorator's IsBlockedBatch doc (the served flag now
comes from the annotator role), add the CHANGELOG entry for the new
capability, and pin the flag against Ready on every arm: WrapUOWProvider,
directly and through its BlockingAnnotator (an absent id stays absent), the
local annotator, and the served test, which now asserts the flag and the
batched read. A counting opener pins that the unit-of-work read opens only
the foreign projects its asked rows name.
Checked against a real bd serve on a proxied-server workspace. At
97bcb57738 an issue blocked by external:remote:payments answered
is_blocked=false while /ready excluded it. With this change it answers
true, and once the capability ships /ready includes the issue and
is_blocked is false. Asked about a free issue alone, the server resolves
no external project; asked about the remote-blocked issue, it resolves
remote and leaves alone the unconfigured project another issue names.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(externaldeps): pin that a satisfied external blocker leaves the unit-of-work is_blocked false
Review of 192b73676 (bee-ghosttrack): the two new IsBlockedBatch tests only
had unsatisfied external refs, so a body that raised every answered id with
any external record (ignoring the resolver) stayed green.
TestWrapUOWProviderBlockedFlagResolvesOnlyTheAskedRefs's opener now
returns a foreign store whose labelled index carries a CLOSED provider of
provides:payments (the decorator_test.go shape). be-shipped blocks on
external:remote:payments (satisfied) and must read false; be-blocked moves
to external:remote:invoices (still unsatisfied) and reads true; both still
open /projects/remote once. With the reviewer's mutant applied
(`if _, ok := answered[id]; ok && len(state.refsByIssue) >= 0 {`) the test
fails on be-shipped in both new cases; restored, it passes
(bazel test //internal/storage/externaldeps:externaldeps_test).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(externaldeps): pin the store arm's satisfied external ref and the unasked is_blocked flag
The store arm decides an external blocker in two places: IsBlockedBatch's
local loop skips a ref the resolver reports satisfied, and the
BlockingAnnotator role folds IsBlocked's verdict, which applies the same
filter, into the served flag. Both annotators, store and remote, add that
flag only when the request asks for it. No test checked either store answer
for a ref whose project had shipped the capability, or that an unasked
annotation carries no flag, so dropping any of those checks left the
package green.
Pin them: IsBlockedBatch and the store annotator answer false for a row
whose only blocker is external:remote:payments once remote has closed its
provides:payments issue, and neither annotator flags a row unasked, even
one an external ref blocks. This is the store half of bd-yewju3; the
previous commit pinned the unit-of-work half.
Each mutant below survives the package at the previous commit and fails
exactly one test here (go test -tags=gms_pure_go
./internal/storage/externaldeps/; unmutated, bazel test
//internal/storage/externaldeps:externaldeps_test passes):
- decorator.go IsBlockedBatch: `&& !satisfied[dep.DependsOnID]` made
`&& len(satisfied) >= 0` fails TestIsBlockedBatchHonorsShippedExternalRef.
- decorator.go IsBlocked: `if !satisfied[ref.raw] {` made always true fails
TestBlockingAnnotatorLeavesShippedExternalRefUnblocked.
- role_accessors.go: `if req.IncludeIsBlocked {` made `if true {` fails
TestBlockingAnnotatorAddsNoFlagUnasked.
- remote_roles.go: dropping `req.IncludeIsBlocked &&` fails
TestRemoteBlockingAnnotatorMergesExternalBlockers.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(http): bd promote over http through issueops.Promote and issues.update.persistence (S21b)
`bd promote` refused over a connected HTTP workspace: it called the raw
PromoteFromEphemeral, which the http backend stubs, and updateIssue's patch
did not publish persistence. MC's PR-intake formula
(mol-normalized-issue-pr-v1) runs `gc bd promote <id> --reason ...`, so this
blocked the HTTP cutover.
- One library entry, issueops.Promote(ctx, PromoteRoles{Reader, Lifecycle,
Commenter}, PromoteRequest{Actor, IssueID, Reason, Provenance}): read the
row, refuse a non-wisp (*NotAWispError, the sentence bd promote always
printed), move it with ONE Lifecycle.Update whose patch is Persistence =
persistent (the role's atomic plane move: same id, labels, deps, events and
comments carried), then write the promotion comment (a comment failure is
reported, the promotion stands). A no-op move is a lost race and reports
NotAWispError without a second comment.
- cmd/bd: the direct route runs it over the store's own role accessors, so a
connected http workspace and a local one take the same entry. The history
label is "bd: promote <id>" where the store carries caller labels.
- bd serve: IssuePatchBody.persistence (persistent|ephemeral|no_history,
anything else a 400 naming patch.persistence) on PATCH
/v0/beads/issues/{id}, behind the new additive behavior token
issues.update.persistence. wire_revision unchanged. Spec, apigen and the
wire-shape golden regenerated; the handler only decodes and passes it to
the role.
- httpclient: Lifecycle.Update sends patch.persistence only to a server
advertising the token, and otherwise refuses BEFORE the dial with
*wire.CapabilityError naming it (unwraps to *storage.ErrUnsupported with
Capability set). The batchApply item still refuses it
(W-IssuePatch.Persistence now reads "ON issues:batchApply").
- Conformance: RunLifecycleUpdatePersistentPromotesAWisp on dolt, embedded,
uow and the served http leg; the served
PersistentPreservesUnversionedClass case is unparked.
- Served e2e TestE2E_PromoteOverHTTP: the mc-promote shape end to end
(label kept, comment written, one PATCH, re-promote refused), and under
the MC server mask a pre-dial refusal naming the token with no write.
- Corpus: mc-promote stays pending, relabelled SRV-1 with the reference
profile's exact refusal (the 1.3.0 server lacks issues.update.persistence).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(promote): run the proxied-server route through issueops.Promote (bd-4y73m9)
The adoption review found (major) that the proxied-server route still
promoted through the old engine, IssueUseCase.PromoteWisp in one
transaction with the comment, while the PR's docs said every route runs
issueops.Promote. Converge rather than reword: runPromoteProxiedServer
resolves the id, then runs issueops.Promote over the provider's own
notifying role accessors (proxiedIssueReader, proxiedIssueLifecycle,
proxiedCommenter), the entry the direct route runs. Both routes now share
promoteFailure (the error mapping) and reportPromotion (the comment
warning and the output), so neither contract can drift.
What a script sees change on the proxied-server route:
- the move is the persistence branch of Lifecycle.Update, so the child
counter moves with the row: a promoted parent's next
`bd create --parent` mints .3 after .1/.2 instead of failing with
"issue already exists";
- on_update fires twice, for the move and for the comment, as on the
direct route (it fired once, for the comment);
- a promotion is two Dolt commits, "bd: promote <id>" and
"bd: comment <id>" (it was one);
- a comment that cannot be written leaves the promotion standing behind
a warning, as on every other route, instead of rolling it back;
- a dual-plane id is refused rather than merged, the update role's
template guard applies, and a lost race reads "<id> is not a wisp
(already persistent)".
The PromoteWisp exemption in TestRecordingIssueUseCaseCoversItsSurface
stays, with its reason corrected: no route calls PromoteWisp now, and
its DoltStorage twin fires no hook either. The doc comments on the old
engine (PromoteFromEphemeral on DoltStore and the db layer, PromoteWisp)
no longer say bd promote uses it.
CHANGELOG: the promote entry now names what a script can see on the
direct and proxied-server routes: the hook firings, the comment row
`bd comments` lists, the child-counter carry, the two-commit shape, and
a comment failure that warns instead of rolling back.
Tests:
- TestEmbeddedPromoteMovesAWispParent promotes a wisp parent with .1/.2
children, a dependency and a comment under a counting on_update hook:
the hook fires twice, the dependency and the children's parent edge
survive, `bd comments` lists the old comment and the promotion reason,
and the next child is .3. At the pre-PR base it fails (the hook fired
0 times).
- The proxied journey pins the two commits, and new subtests pin the
child counter (the child_counters row, next child .3) and the two hook
firings. Against the contributor head each fails: one commit, no
counter row and a failing create, one firing.
Review iteration 2:
- TestEmbeddedPromoteMovesAWispParent gets its row in the embedded cmd
shard manifest (shard 64 of 100, from the generator's incremental
--write). Without it //scripts:go_test_sources_test fails both the
NotStale and the bare-write guard, and the generator's --check fails.
- notifying.go no longer lists the promotion comment as a divergence.
The direct route now writes that comment through st.Commenter(),
which HookFiringStore wraps, so an embedded promote fires on_update
for it (TestEmbeddedPromoteMovesAWispParent counts both firings). The
list counts four, and the empty-commit note becomes the fifth item.
- batchapplier.go no longer says persistence is absent from both patch
bodies: the update body publishes it behind issues.update.persistence,
and only batchApply refuses it (W-IssuePatch.Persistence).
- Three comments still tied promotion to the old engine: the
conformance fixture's PromoteWisp no longer claims to do what
`bd promote` does, the CLI differential's promote scenario names
issueops.Promote, and export_source's wisp-relations note names
issueops.MoveIssuePersistenceInTx.
- The Promote unit test compares the whole update patch with
reflect.DeepEqual. The helper it replaces checked 9 of the patch's 22
members, so a Promote that also set Description passed it.
Review iteration 3:
- A refused persistence move answered 500 `internal` over http and
emitted request_error, though the caller could fix the request. The
role now returns two refusals as ErrValidation, so bd serve answers
400 invalid_argument and the client maps that back to ErrValidation:
an unversioned row asked for ephemeral or no_history (the role wraps
types.ErrUnversionedWispMove, a new sentinel NormalizePersistenceMode
returns for that case alone, with its message unchanged), and a
demotion of a row with retained snapshots. A row that breaks its own
persistence invariants still answers 500.
- RunLifecycleUpdateWispModesRefuseAnUnversionedRow pins the refusal on
every leg (dolt, embedded dolt, the unit of work, served http): both
wisp modes match ErrValidation and leave the row durable, unversioned
and off the wisp plane. Without the wrap the dolt leg fails, and the
served leg fails on "answered 500 internal".
- TestMoveIssuePersistenceInTxRefusesDemotionWithRetainedSnapshots is
the first test of the snapshot refusal, and fails without its wrap.
The unversioned unit test now requires both sentinels. The types tests
pin the sentinel, its unchanged message, and that no row-invariant
error matches it: checking the unversioned class ahead of the
invariant checks fails them.
- CHANGELOG: the promote entry counts five script-visible changes, the
fifth being the lost-race refusal sentence, and says the two refusals
now answer 400 over bd serve and gain a `validation failed: ` prefix
locally.
- NotAWispError's doc comment records that a no-history wisp is refused
too: the gate reads the Ephemeral flag, as bd promote always has, and
`bd update --persistent` is the move for that row.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): bound response-header waits and retry stalled reads on a new connection
The maintainer-city shadow run saw 22 requests sit out the full 60s client
timeout, each on one silent HTTP/1.1 connection while other connections to
the same serve kept answering.
wire.Client now bounds an idempotent request's wait for response headers
(15s default; BEADS_HTTP_RESPONSE_HEADER_TIMEOUT or
DialOptions.ResponseHeaderTimeout; "off" disables), separately from the 60s
overall timeout, and stops the timer once headers arrive so a streaming body
is never cut. A read (GET/HEAD/OPTIONS, or a Request marked Idempotent: the
POST batch get) that stalls or has its connection reset is retried once: the
stalled attempt's cancellation closes its connection and idle connections are
dropped, so the retry dials fresh. Every retry is counted
(wire.StallRetryCount) and reported (OnStallRetry; the dialer's default logs
one stderr line with the count).
Writes are never retried and get no header timer, because bd serve answers
a write only after it commits (a large batch apply can legitimately take
tens of seconds). A write whose overall timeout fires before its headers
fails with a typed *wire.ResponseHeaderTimeoutError (inside *ConnectError)
naming the host and saying the outcome is unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): retry a stalled read within the overall timeout (bd-p1wzpi)
Adoption review of #7553 found three defects in the header timer and its
retry. This maintainer fixup sits on top of the contributor commit and
supersedes three of its claims: that the timer bounds a read's every
attempt, that idle connections are dropped before the retry, and that any
write whose overall timeout fires before its headers is typed.
A slow but healthy read is no longer cut short. The 15s timer cannot tell
a silent connection from a serve still working on the read (serve writes a
read's headers only after waiting up to 10s for a database slot and running
the query), and the retry ran under a fresh 15s timer, so a read slower
than 15s failed at about 30s after sending two requests where it used to
succeed within 60s. The timer now bounds only the first attempt. The retry
has no header timer and runs under a deadline of when the first attempt was
sent plus the client's overall Timeout, the moment that Timeout itself
counts from, so it finishes such a read and no read waits longer than the
60s it could before. The request is built and stamped once and each
attempt sends a copy of it, so the credential source is consulted once,
before any clock starts, and a cold token command costs the retry none of
its budget. What is left: a read whose headers take longer than the timer,
and whose retry then needs more than what remains of the 60s (about 45s)
for its headers and body together, now fails at 60s where it used to
succeed, and the server also gets the abandoned first request. A read whose
first attempt already spent the whole Timeout (the timer off) is not
retried at all and keeps its typed timeout.
A request is typed *ResponseHeaderTimeoutError only once it was written.
Any Timeout() error on a write used to be typed, including the baseline
transport's dial and TLS handshake timeouts where nothing reached the
server, and the message then said the write "may or may not have been
applied", gave the overall timeout as the wait, dropped the transport's
error, and Temporary() was true. The timer is now armed from httptrace's
WroteRequest (where http.Transport.ResponseHeaderTimeout starts its own
clock), which also records that the request went out. A timeout is typed
only for a written request whose caller's context is still alive; a dial
or TLS timeout stays a plain *ConnectError. After is the measured wait,
Err is printed, Temporary() reports Replayable (false for a write), and a
retried read says why its first attempt was abandoned (Reason). Arming at
the write also stops a slow credential source (BEADS_HTTP_TOKEN_COMMAND may
take 30s) from being reported, counted and retried as a server stall.
No idle-connection flush. CloseIdleConnections ran on a transport shared
by every no-CA dial in the process (baselineTransport), so one stalled read
dropped idle keep-alives to every host. Canceling the stalled attempt
already closes its connection (net/http never pools a canceled HTTP/1.1
connection), so the retry rides another one.
Also:
- wire.Request.Replayable (GET/HEAD/OPTIONS, or Idempotent) is now the one
predicate behind both the wire's stall retry and dispatch's bounded 503
retry, so the batch get, a read on POST, is retried on a 503 too.
dispatch's doc comment no longer says the wire never resends.
- The docs, the error and the stall line say the retry goes out on
"another connection", not a "new" one: the idle pool may hand it one
already open. dialStream's doc says the events:watch connect gets
neither the timer nor the retry.
- BEADS_HTTP_RESPONSE_HEADER_TIMEOUT takes bare seconds ("30") as
BEADS_GATE_WAIT_TIMEOUT does, and "off" in any case. "off" or 0 turns off
only the timer: a reset connection is still retried and a written request
that times out is still typed.
- README says "each read" and spells out the above, bounding the retry by
its headers and body together; it no longer says a streaming body is
never cut off (the header timer never does, the 60s bound still does).
The CHANGELOG entry moves from Added to Fixed and states the same bound.
- CredentialProvider's doc, in wire and on the public bdhttp alias, says
Authorize runs once per request, not once per attempt: the stall retry
resends the stamped headers up to the overall timeout later, so a
single-use or short-lived credential may draw a 401 there, which reaches
Refresh like any other.
Tests: a read queued behind a LimitListener backlog finishes once a slot
frees; a read slower than the timer on every connection finishes on its
retry; a slow credential source is not a stall, and one that takes the
whole Timeout to resolve still leaves the retry its budget (starting the
deadline before the stamp, or re-stamping the retry, fails it); a write
whose dial times out is a plain *ConnectError; a stall leaves another
server's idle connection on a shared transport alone; a retry after a
reset names the reset; the stall-twice case is bounded by the overall
timeout and pins After, Reason and the message; dispatch retries a read
on POST on a 503, and GetMany's batch get is sent as one (dropping its
Idempotent fails that); the env knob takes "30", " 1.5 " and "OFF" and
refuses "-3". A read whose first attempt spent the whole Timeout is not
retried and keeps its typed error (dropping the spent-budget check fails
it; no other test did). A stall retry that draws a 401 refreshes once and
authorizes only the re-issued request, so Authorize runs twice, not three
times (re-stamping the retry fails it).
Not covered, as before, and now said in README and the CHANGELOG: the
events:watch stream's connect (dialStream) has no header timer or retry.
Nor is a reset on Windows: stallReason matches syscall.ECONNRESET, which a
Windows reset (WSAECONNRESET) is not, so there a reset connection is
retried only when it surfaces as EOF.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* fix(http): bd export over http through issueops.ReadExport (S21)
bd export read through raw SearchIssues and the bulk label, dependency and
comment reads, which the HTTP backend refuses (B3 #16), so gc's JSONL export
order (gc bd export --all) failed on every remote scope.
issueops.ReadExport composes role reads every deployed server publishes: an
unlimited Reader.List for rows, labels and counts, EdgeReader.ReadEdges for
dependency records, and Reader.Get with comments for rows that have any. The
remote route feeds it into the same runExportFromSource the direct and
proxied routes use. A failed read fails the export. gc-export-all passes
against the reference profile; mc-promote stays pending (S21b) with its exact
reason: it needs a new server capability.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(export): read remote memories from the memory plane, pin unmarked no-history rows (bd-o4qlui)
Review fixes for #7551, attempts 1 to 3.
Attempt 3. No test reached roleExportSource.ExportMemories's error
path. A unit test now drives it with a fake store: a memory role that
cannot be reached, and a listMemories that fails, each end the export
with that error and no map. Rewriting either branch to degrade to an
empty map would bring back a remote `bd export --all` that exits 0 with
no memory in it.
Declined in attempt 3, for finalize to file: an unlimited HTTP listing
that stops on a has_more page with no next_cursor returns the rows it
has with HasMore false, so ReadExport's refusal cannot fire over HTTP.
Only a server that breaks the spec's has_more/next_cursor pairing gets
there; this repo's server always sends a cursor with a non-empty
has_more page. The walker (fetchIssuePages) is unchanged since #7247
and shared with bd list, so the fix needs its own PR that checks bd
list's callers first. The remote route also has no single snapshot: a
comment changed between List and Get can make the written count
disagree with the bodies kept. That belongs in one follow-up with the
bounded retry declined in attempt 1, as a count/body consistency check.
The --include-infra e2e leg stays declined. The wire does carry the
knob: the client sends include_infra and include_templates on
listIssues, and the server decodes both. The GetInfraTypes nil-store
guard stays declined, and auto-export's own GetAllConfig memory read
predates this PR.
Attempt 2. A remote export dropped every memory. Over HTTP, `bd export
--all` and `--include-memories` exited 0 without a memory record, where
the base refused with exit 1. The memory lines came from GetAllConfig,
which over HTTP is listSettings, and the server's settings enumeration
withholds every kv.* row, memories included. gc's JSONL export runs
`gc bd export --all`, so its archive lost them without a word.
The exportSource seam now asks each source for its memories
(ExportMemories), not for the whole config table. The local and proxied
sources still take them from their config table. The remote source reads
the served memory plane, store.Memories().List (listMemories), which the
deployed bd 1.3.0 server advertises as memories.list. httpMemories.List
refuses a page that reports has_more: ListResult has no cursor, so a
truncated plane would pass for the whole one. The memory error now says
"failed to read memories"; nothing in beads or gascity matches the old
text.
TestE2E_ExportOverHTTP seeds two memories with `bd remember` over HTTP.
It requires exactly those two in --all, in --include-memories and in the
local re-export of the imported file, and none in the default export. A
unit case pins the has_more refusal. The CHANGELOG entry says where
remote memories come from, so its "Nothing is dropped" holds. The
WispPlaneIDs doc no longer says the listing refuses an id set, which
stops being true once a server advertises issues.list.ids (#7550).
Attempt 1. The remote route's WispPlaneIDs doc and the CHANGELOG had the
effect of the missing wisp_plane marker backwards. They said import then
routes a no-history row by its flags. A current import does the
opposite: it pins an unmarked no-history row to the durable plane
(applyImportWispPlane). So a genuine no-history wisp in a remote export,
which gc's session, wait and order beads are by default, re-imports onto
the Dolt-versioned issues plane, and gc's JSONL archive keeps it.
The route still stamps nothing. No served read publishes plane
membership: listIssues rows carry no plane field, however the listing is
scoped. Inferring the marker from the flags would re-plane a durable row
that still carries the flag and drop its relations (bd-r9uce), and
refusing the export would re-break gc's remote JSONL export. The doc and
the CHANGELOG now state the real consequence, and serving the membership
is bd-1lbvas. TestE2E_ExportOverHTTP pins it. A no-history row is
exported without the marker by --all and by the default export. A fresh
local workspace imports it onto the durable plane, against a locally
created control row that the local route does mark.
Attempt 1 minors and nits: ReadExport refuses a listing page marked
HasMore, as the uow source does, and unit cases pin that and a failed
comment read. The exportSource interface doc names ExportIssues and its
contract. The export error now says "failed to read the export set"
rather than "failed to search issues"; nothing in beads or gascity
matches the old text. roleExportSource.GetInfraTypes says it is unused
on this route.
Declined, for finalize to file: a bounded retry of ReadExport when a row
vanishes between the reads (a design change; today's fatal behavior is
pinned), and e2e rows for pinned, gate, template and infra-typed issues,
including an --include-infra leg over HTTP. Also declined: a nil-store
guard on roleExportSource.GetInfraTypes. The method is dead on this
route, and the source's other store readers (ExportIssues, GetConfig,
ExportMemories) dereference the store unguarded too.
Validation, attempt 3: git diff --check, the go.mod-pinned gofmt, go
vet, gazelle (no change) and the go_srcs check. The new test passed with
no skips. Three mutants were killed. An empty map with no error on a
failed listing, and the same on an unreachable role, each fail their own
subtest. An empty map returned beside the listing error fails the no-map
assertion; export.go discards the map on error today, so that case pins
the interface's "fail rather than return a partial set" contract, not
visible output.
Validation, attempt 2: git diff --check, gofmt and go vet. The
httpclient memory tests passed, 23 of them: 4 units and 19 served. So
did TestE2E_ExportOverHTTP on embedded Dolt with
BEADS_HTTP_TEST_REQUIRED=1 and no skips. Two mutants were killed: a
remote source that reads the settings listing fails 3 e2e assertions,
and dropping the has_more refusal fails the unit case. Export parity
passed with no skips on the classic (memory determinism, byte
stability), embedded and proxied tiers, including the proxied-versus-
classic byte identity with memories. The PR is now behind main, which
added #7549 and #7550, and conflicts with it textually in CHANGELOG.md,
backend/http/BUILD.bazel and issueops/BUILD.bazel. With those resolved
by union, the merge with main e6a891b900 builds and vets. On that merge,
in CI's pinned-shard layout, the served http tier passed 49 of 49,
including #7550's list-scope e2e. The command corpus ran 128 shapes: 113
pass, 3 allowed, 12 pending and 0 fail. gc-export-all passes without its
pending mark, the one shape that moved. The issueops ReadExport and
ListGates tests passed, as did the embedded and proxied export tiers.
Validation, attempt 1: the issueops ReadExport tests, with two mutants
killed; TestE2E_ExportOverHTTP with a flag-stamping WispPlaneIDs mutant
killed on three assertions; the cmd/bd export tests in a scrubbed env.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(list): bd list --no-assignee, --title and --id over http behind per-parameter tokens (S15b)
Over http `bd list --no-assignee`, `--title` and `--id` refused: the list
encoder had no listIssues parameter for ListRequest.NoAssignee,
TitleSearch or IDFilter (B3 #11). All three are maintainer-city cutover
blockers: gc's default on_boot hook runs
`bd list --no-assignee --status=in_progress ...` on every agent boot, the
PR-intake formula lists by `--title "$SUBJECT"`, and the pr-review skill
by `--id <ids>`.
The library entry is unchanged: issueops.Reader.List, whose bodies
already apply all three through workapi.BuildListFilter, the same entry
the local route reads through.
- Server: GET /v0/beads/issues decodes `no_assignee`, `title` and `id`
into those ListRequest members (`id` handed over as written; the role
splits, trims and de-duplicates, as countIssues already does). Each is
behind its own new behavior token, issues.list.noAssignee,
issues.list.title and issues.list.id (additive, wire_revision stays 2):
each is a separate caller's dependency, and a refusal names exactly the
one it needed. The spec parameters cite their tokens; apigen and the
wire-shape golden are regenerated.
- Client: the encoder maps the three members to their parameters, and
httpReader.List refuses a request carrying one BEFORE dialing, with
ErrUnsupported{Capability: <token>}, unless the handshake advertises
that token (refuseUnservedSearch generalised to one table,
tokenedListFilters, with bd search's `q`). Never a round trip an older
server answers unknown_parameter, never a wider listing.
- ErrHTTPUnsupported's text names the capability when it has one, as the
portable sentinel does, so `bd list` says which token the server lacks.
- The three E-ListRequest ledger rows retire; the ledger is re-rendered.
The id scope unparks the served Reader contract: the sixteen cases parked
on E-ListRequest.IDFilter now run against the in-process server. Twelve
pass as written; four still park, each now on the member it actually
needs (Offset twice, PinnedFlag, ExcludeTypes). The served refusal sweep
asserts SpecPrefix where it asserted IDFilter.
Tests (failing first): handler test that each parameter reaches the
storage filter; client tests that each member rides its parameter behind
its token and refuses pre-dial, zero dials, naming its token, against a
server lacking it; round-trip and vocabulary gates; capability lists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http): the four maintainer-city list shapes end to end; corpus marks relabelled SRV-1 (S15b)
TestE2E_ListScopeFiltersOverHTTP runs the corpus shapes gc-list-on-boot,
gc-list-on-boot-workflow, mc-list-title and mc-list-id through the real
bd against the in-process server (which advertises the three new tokens)
and requires each to answer an embedded workspace's rows and exactly the
rows it names: --no-assignee leaves out an assigned in-progress row on
the same lane, --title is case-insensitive, --id lists a closed id under
--all. Against the MC production server's handshake shape each shape
exits non-zero naming its token and never dials listIssues.
The corpus suite masks the served side to reference_server.json, the
deployed bd 1.3.0 surface, which advertises none of the tokens, so the
four shapes now get the named pre-dial refusal there. Their marks move
from S6c+S15b to SRV-1 with that reason, like mc-search. With a scratch
profile that adds the three tokens and parameters (not committed) exactly
these four shapes report "now passes; remove the pending mark" and
nothing else changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(list): adopt bd-enterprise's listIssues `id` contract: repeatable, issues.list.ids (S15b)
bd-enterprise already publishes listIssues `id` (E9-S2): a REPEATABLE
parameter, one id per value, behind `issues.list.ids`, with its client
sending IDFilter split into one value per member. The first cut of S15b
took ONE comma-separated `id` behind `issues.list.id`, so the same
parameter name had two incompatible meanings: an OSS client's "a,b" is a
400 on an enterprise server, and the enterprise rebase onto main would
collide. OSS now publishes enterprise's contract unchanged:
- Server: listIDFilter (ported verbatim) decodes the repeated `id` into
ListRequest.IDFilter's comma set; more than 200 values, an empty value,
a comma, leading or trailing whitespace, a control character or an
over-long id is a 400 `invalid_argument` on `id`. The spec parameter is
enterprise's (array, maxItems 200); apigen and the wireshape golden are
regenerated.
- Token: CapListIDs = "issues.list.ids", the enterprise spelling and name
on both sides.
- Client: the encoder splits the set the way the role does (splitIDSet)
and sends one `id` per member; the pre-dial gate fires only when the set
names an id.
- Tests: list_ids_test.go is enterprise's id cases (the exact set reaches
storage, the 200 bound is served, every refusal beside its control, the
spec bound matches the constant); the handler, client, round-trip and
e2e cases move to the repeated shape and the new token.
`no_assignee` and `title` are unchanged. Served tier, http e2e (including
TestE2E_ListScopeFiltersOverHTTP) and corpus_served_test pass; with a
scratch reference profile advertising the three tokens exactly the four
S15b shapes report "now passes".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The workspace-wide gate listing built a raw SearchIssues filter, which the
HTTP backend refuses (B3 #15), so gc's renudge-stale-human-gates order
(gc bd gate list --limit 0 --json) failed on every remote scope.
issueops.ListGates asks the Querier role (queryIssues, served by every
deployed server) for type=gate, closed hidden unless --all: the rows the raw
filter selected, on both planes. The direct, proxied and remote routes all
call it through openQuerier. The corpus seed gains an open, a closed and an
ephemeral gate, and mc-gate-list (the order's argv) plus mc-gate-list-all
pass on the served side.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(bazel): pin the item-5 one-wave rule for dolt-race and dolt-int budgets
Closed PR #7542 found that a union with more test actions than its
effective --jobs can regress wall clock by up to +575s, because Bazel
does not schedule the longest action first and a second-wave test adds
its full duration to the critical path instead of overlapping it.
Compute the effective --jobs from .bazelrc (remote-exec's baseline,
overridden by a --jobs line on the union's own config, last one
winning, matching Bazel's BEP cmdLine semantics from #7542) instead of
reading remote-exec's line alone, and explain the second-wave tail in
the budget tests' failure messages.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): clarify why the union's --jobs wins (comment only)
Command-line config outranks rc-file config; the BEP cmdLine ordering
PR #7542 observed is a consequence of that rank, not "last one wins"
by position, so reordering .bazelrc's lines cannot change precedence.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): shard http_served_test and corpus_served_test (embedded lane critical path)
Both served targets ran as one shard each (235-597s) and were the embedded
lane's longest action in most executing runs; every other embedded shard
ends by ~90-155s.
- http_served_test runs through go_test_pinned_shard.sh like
httpclient_served_test: the 19 TestE2E_* cases >= 3s are pinned onto 6
shards (pin_shards.py from three lane runs' test.xml plus one local run,
<= ~88 measured seconds each), the ~28 fast tests round-robin in a 7th.
- corpus_served_test: TestServedCorpus becomes TestServedCorpusPart1..4.
Shapes are dealt round robin in corpus order; each part starts its own
server and seeds its own pair of workspaces. The shapes are independent:
every check is served-vs-embedded parity after the same commands, each
write owns its target ids, and order preservation keeps each part's reads
ahead of its writes. TestCorpusPartsDealEveryShapeOnce checks the deal
(every shape once, in order, no empty part); the manifest pins part k to
shard k, with a 5th round-robin shard for the engine-free tests, and
scripts TestCorpusPartsArePinnedOnePerShard ties corpusParts, the
manifest and shard_count together. BEADS_CORPUS_REPORT now accumulates
every part the process ran.
- pinnedShardTargets and the retired-lane args pins list both targets;
go_test_sources_test gets the two packages' manifests as data.
Embedded goes from 172 to 182 test actions; the dolt-race/dolt-int union
budgets do not include the embedded tag and are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(corpus): seed the served and embedded sides concurrently in each part
Each TestServedCorpusPartN paid the server start and both seeds serially
(about 100-150s of a 190-220s shard in #7537's CI). The embedded side now
runs bd init and the seed on a goroutine while the test goroutine starts
the server and proxy and seeds the served side.
- prepareSide attaches one side (connect or init), writes its assets and
runs the seed in order, returning failures as errors (execBD, runBD
without the testing.T) so it is safe off the test goroutine; a failing
side cancels the other, and a deferred cancel+Wait keeps the goroutine
from outliving the test or its TempDirs.
- The sides share no directory, env or bd process; shapes, their order and
every assertion are unchanged. Each part logs its setup time.
- bazel.yml's embedded lane uploads the served targets' test.xml on every
run (bazel-embedded-served-testxml), so their pinned shards can be sized
from a sharded run of the lane.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): corpus in 3 parts; re-pin http_served_test from a sharded CI run
Measured on this PR's first embedded-lane run (test.xml from the new
bazel-embedded-served-testxml artifact):
- corpus_served_test with concurrent seeding: parts 1-4 ran 135/140/144/114s,
of which setup (part time minus its shapes) was 76/76/76/62s and the 127
shapes 242s together. The setup floor is still ~70s+, so corpusParts goes
from 4 to 3 (round robin; the measured split is 85/81/76s of shapes) and
the manifest and shard_count follow (4 shards: 3 parts + round-robin).
- http_served_test: #7537's pins were sized from single-shard runs, and the
sharded shards ran 73-184s against ~88s estimated. served_pinned_shards.txt
is regenerated with pin_shards.py from that sharded run's per-test
durations: 119/118/120/128/132/123 measured seconds per pinned shard.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): pin http_served_test on the max over two sharded CI runs
The second run of the lane on this PR ran the same tests at 0.2-1x their
first-run times (executor load, not the tests), and its re-pinned shards
came out 36-118s against 118-132s estimated. pin_shards.py now takes each
test's maximum over both runs' test.xml, the same rule the other pinned
targets use: 123-135 measured seconds per pinned shard.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(corpus): guard part wiring; seed metadata on e2e-t-ifa (review of #7537)
- testServedCorpus fails (before the engine gate, so in every lane) unless
the test's name is TestServedCorpusPart<part>: a TestServedCorpusPart3
calling testServedCorpus(t, 2) would run part 2 twice and silently drop
part 3's shapes. TestCorpusPartNameMustMatchItsPart covers the check and
that servedCorpusParts lists Part1..N in order. Mutation (Part3 -> 2)
fails //backend/http/corpus:corpus_test with "TestServedCorpusPart3 runs
corpus part 2; only TestServedCorpusPart2 may".
- e2e-t-ifa is seeded with metadata seeded=keep. The parts seed separately,
so the two refused (exit 13) conditional updates no longer always follow
gc-update-if-assignment's k=v; their verify show again holds that a
refusal keeps existing metadata. Mutation (served verify output's
seeded=keep rewritten) fails both stale shapes at
$[0].metadata.seeded.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): back to 4 corpus parts (served long pole over test-seconds)
maintainer-city-c3's call on the measured trade-off. With concurrent
seeding, 4 parts ran 114-146s each (run A) and 3 parts ran 170-180s (run D).
3 parts save one ~75s setup, about 75 test-seconds per executing run, but
the longest part is the embedded lane's served long pole. That pole is on
the gate's critical path (forks' above all), and 4 parts cut it by ~34s.
corpusParts=4, TestServedCorpusPart4, manifest part 4 on shard 4,
shard_count=5. The part-name guard is unchanged and covers Part4.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): served-timings upload is telemetry; corpus part bounds and ctx
Review of #7538 (maintainer-city-c3):
- "Upload served test timings" gets continue-on-error: true and
timeout-minutes: 2, like the CI analytics upload. An artifact-service 5xx
or stall no longer fails the required embedded lane or holds it until the
job timeout. TestBazelWorkflowSecretsAndFailureSurface allows that
continue-on-error only on this exact step
(bazelServedTimingsContinueOnErrorPath, which also pins its name,
artifact, path and timeout; TestBazelEmbeddedServedTimingsUploadIsTelemetry).
- corpusPartNameErr also refuses a part outside 1..corpusParts, so a stray
TestServedCorpusPart5 fails instead of running no shapes. Two new cases.
- expand takes ctx: prepareSide's {rev:} lookups run under the seeding
context, so a cancel stops them as well.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): shard http_served_test and corpus_served_test (embedded lane critical path)
Both served targets ran as one shard each (235-597s) and were the embedded
lane's longest action in most executing runs; every other embedded shard
ends by ~90-155s.
- http_served_test runs through go_test_pinned_shard.sh like
httpclient_served_test: the 19 TestE2E_* cases >= 3s are pinned onto 6
shards (pin_shards.py from three lane runs' test.xml plus one local run,
<= ~88 measured seconds each), the ~28 fast tests round-robin in a 7th.
- corpus_served_test: TestServedCorpus becomes TestServedCorpusPart1..4.
Shapes are dealt round robin in corpus order; each part starts its own
server and seeds its own pair of workspaces. The shapes are independent:
every check is served-vs-embedded parity after the same commands, each
write owns its target ids, and order preservation keeps each part's reads
ahead of its writes. TestCorpusPartsDealEveryShapeOnce checks the deal
(every shape once, in order, no empty part); the manifest pins part k to
shard k, with a 5th round-robin shard for the engine-free tests, and
scripts TestCorpusPartsArePinnedOnePerShard ties corpusParts, the
manifest and shard_count together. BEADS_CORPUS_REPORT now accumulates
every part the process ran.
- pinnedShardTargets and the retired-lane args pins list both targets;
go_test_sources_test gets the two packages' manifests as data.
Embedded goes from 172 to 182 test actions; the dolt-race/dolt-int union
budgets do not include the embedded tag and are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(corpus): guard part wiring; seed metadata on e2e-t-ifa (review of #7537)
- testServedCorpus fails (before the engine gate, so in every lane) unless
the test's name is TestServedCorpusPart<part>: a TestServedCorpusPart3
calling testServedCorpus(t, 2) would run part 2 twice and silently drop
part 3's shapes. TestCorpusPartNameMustMatchItsPart covers the check and
that servedCorpusParts lists Part1..N in order. Mutation (Part3 -> 2)
fails //backend/http/corpus:corpus_test with "TestServedCorpusPart3 runs
corpus part 2; only TestServedCorpusPart2 may".
- e2e-t-ifa is seeded with metadata seeded=keep. The parts seed separately,
so the two refused (exit 13) conditional updates no longer always follow
gc-update-if-assignment's k=v; their verify show again holds that a
refusal keeps existing metadata. Mutation (served verify output's
seeded=keep rewritten) fails both stale shapes at
$[0].metadata.seeded.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
PR #7535 review nits (bee-ghosttrack, julianknutsen):
- The -test.timeout=19m arg and BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION env
var moved off --config=doltserver-cmd onto cmd/bd:bd_dolt_server_test and
tests/regression:regression_test directly. Nothing pinned either line
once it lived on the target instead of in .bazelrc, so TestBazelDoltIntCmdDoltTimeoutAndEnvPinned
now fails if either is dropped or altered on either target.
- classify_tier_results.py already fails closed on a BEP testResult whose
"status" field is omitted (proto3's NO_STATUS encoding), but no test
exercised that path through read_test_statuses()/classify() -- only
tier_result() with a pre-built status set. Add coverage for the real
shape (an event whose testResult body has no "status" key at all).
Verified against rv7535's mutate.py: E5, E6 and G4 now CAUGHT (previously
SURVIVED on main); the other 38 mutants are unaffected.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): dolt-int gates the server-storage and cmd-dolt tiers in mode remote (item 5 A2)
In mode remote, folds bazel-server-storage (--config=doltserver-integration)
and bazel-cmd-dolt (--config=doltserver-cmd) into one bazel-dolt-int job
(--config=dolt-int), following the dolt-race pattern from #7514. The
members have different gating categories (server-storage plain-gated,
cmd-dolt flag-gated/advisory), so the union carries continue-on-error: true
and a bespoke --label-scoped Shard balance step. All other modes keep the
two lanes running unchanged. Action keys are byte-identical between the
member configs and the union (17 + 46 = 63 TestRunner actions), so cached
results carry over either direction and a revert is a safe rollback.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): dolt-int per-tier results, integration gating, key-parity wording (review)
Coordinator review of #7535 found three must-fixes: integration:"off" was
ignored in remote mode (the union's members already honor it); job-level
continue-on-error made a server-storage-only failure read success on
push/nightly/dispatch, where main stays red; and the PR's key-parity claim
overstated byte-identical actionKeys when only the remote action digest
(not the local actionKey) is unaffected by moving --test_env/--test_arg
onto the targets' own env/args.
Fixes:
- bazel-dolt-int's if now adds `&& inputs.integration != 'off'`, matching
the members (#7491's review); bazelLaneRunModes and
TestBazelDoltIntArmsExactlyOnePerMode cover the "off" case.
- Job-level continue-on-error removed; only the `bazel test` step carries
it, and a new always() "Classify tier results" step
(tools/bazel/classify_tier_results.py, with its own unit tests and a Go
wrapper) computes server_storage_result/cmd_dolt_result from the BEP and
decides job.status per-tier. Confirmed with bazel-gate.sh/ci-gate.sh on
synthetic empty-output inputs that a dead job still fails the gate.
- Corrected the local-actionKey-vs-remote-digest wording in .bazelrc,
bazel.yml's job comment and CI_REQUIRED_CHECK_TOPOLOGY.md.
- Should-fix: test step 23->25 / job 58 minutes with reasoning; --label
coverage added to shard_budget_test.py; stale lane comment fixed in
tests/regression/BUILD.bazel:46; TestBazelDoltIntSoleRunIsInTheUnion's
docstring corrected (members bake sole-run's line in directly, never via
--config=sole-run).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): fail-closed classify, per-tier check_testcases, pinned argv (review)
Final review round for PR #7535 (maintainer-city-c3, bee-ghosttrack,
julianknutsen):
- classify_tier_results.py now fails every tier shut (exit 1) on a
non-PASSED label outside every --tier list, so a newly tagged target
added without updating the step's --tier args cannot silently read as
success (must-fix 1). Its --tier/--check label sets are policy-tied to
the BUILD files' own tag sets by a new
TestBazelDoltIntTierLabelsMatchTheTags.
- A missing or non-integer --rc (a timed-out or cancelled test step)
takes the same fail-everything-shut branch instead of crashing argparse
with no outputs written (bee-ghosttrack's should-fix 2).
- check_testcases.py gained a repeatable --label flag, and bazel.yml's
shared "Every target and shard ran tests" step is split into check-ss
and check-cd, each continue-on-error and folded into its own tier via
classify's new --check NAME=OUTCOME, so a zero-testcase cmd-dolt shard
no longer reddens the job on push/nightly (must-fix 2).
- classify's run: argv is now pinned by exact equality
(bazelDoltIntClassifyRun), and every flag except --tier/--check is
--StoreOnce; a repeated --tier/--check name or an unrecognized flag is
now a hard parser error (must-fix 3).
- "Upload test logs" now also fires on steps.test.outcome == 'failure',
not just failure() (must-fix 4).
- shard_budget.py --label now fails closed (::error, exit 1) on a label
with no executed shard in the BEP at all, instead of silently reporting
"no sharded test target executed two or more shards" (should-fix 3,
carried across both review rounds).
- Updated engdocs/TESTING.md, CI_REQUIRED_CHECK_TOPOLOGY.md, .bazelrc and
scripts/bazel_dolt_int_test.go/ci_workflow_test.go comments for the
nits: stale "Advisory (continue-on-error: true)" wording, the
bazelUnionHasFlagGatedMember comment's stale claim about bazel-dolt-int,
"byte-identical" without specifying remote action digest vs. local
actionKey, and "is unset" vs. ci-gate.sh's actual "was skipped" branch
for an empty union output.
Verified: python3 -I on all four tools/bazel/*_test.py (classify 29,
check_testcases 7, shard_budget 19) green; GOTOOLCHAIN=go1.26.7 go test
./scripts/... green; bazel --nohome_rc test //scripts:scripts_test
--config=ci green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): shard_budget --label fail-closed only on a truly unknown label
The previous commit's fail-closed --label check compared against
read_shard_durations, which only records executed (non-cached) shards, so
a target whose every shard was a cache hit this run had zero entries and
was wrongly treated the same as a --label typo. This was not caught by
the new tests (none exercised an all-cached target) and broke this PR's
own dolt-int CI run: bazel-dolt-int's Shard balance step went red on
//internal/storage/dolt:dolt_server_full_test with "no executed shard for
it", even though that target was correctly, fully cache-hit.
Fix: a new read_tested_labels() reads every label with any testResult
event (cached or executed), and --label's fail-closed check now tests
against that set instead of read_shard_durations. A fully-cached target
still legitimately reports "nothing to judge" through evaluate(); only a
label absent from the BEP altogether is now an error. Added the missing
test row (every shard cached) that would have caught this before push.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(bazel): pin bazel-dolt-int's Upload test logs if-condition
A full 42-mutation re-run for PR #7535's second review round found that
nothing pinned this job's own "Upload test logs" if-condition (must-fix 4):
the other lanes' upload-logs steps are each pinned, but bazel-dolt-int's
(unlike dolt-race, a brand-new job) had no equivalent assertion, so a future
accidental revert to the old failure()-only condition would go uncaught.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): dolt-race gates the dolt-server and proxied tiers in mode remote (item 5 A1b)
In mode remote, bazel-dolt-race (`bazel test //... --config=dolt-race`, the
union of --config=doltserver and --config=doltserver-proxied) runs both tiers
in place of bazel-doltserver and bazel-proxied, and is no longer advisory:
its job.status is both the bazel-doltserver and the bazel-proxied
workflow_call output (union result first, member's otherwise). In the fork
modes, cache and local, the two member jobs run exactly as before: there one
client does both tiers' work without in-flight deduplication, so a union
would cost the sum of the tiers rather than the max. Exactly one arm runs in
any mode, so gate ids, pr.yml, ci-gate.sh and bazel-gate.sh are unchanged.
- bazel.yml: dolt-race if: mode == 'remote' (every event that reaches it);
no continue-on-error; result output and always() recorder; test step
timeout 25 -> 20 (job 55 >= step sum 46 + 5, < 60). Members' if: their old
rule && mode != 'remote'.
- scripts/bazel_dolt_race_test.go (was bazel_dolt_race_shadow_test.go):
union-of-members config, sole-run lines in the union, gating shape, step
and job timeouts, exactly one arm per mode x event with the call outputs
evaluated as GitHub does, and the union's 62 test actions within
--config=remote-exec's --jobs=64.
- Gate simulations evaluate the workflow_call output expressions, and a
gated lane's reporter is the lane or its union lane.
- aquery: all 62 TestRunner actions under --config=dolt-race are
byte-identical (key, argv, env, outputs) to --config=doltserver (with and
without sole-run) and --config=doltserver-proxied on origin/main.
- Docs: CI_REQUIRED_CHECK_TOPOLOGY.md "dolt-race Union Lane", TESTING.md.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): dolt-race test step 23 min so Bazel logs a 1200 s TIMEOUT first
The proxied tier caps each test at 1200 s; a 20-minute step let GitHub
kill a hung shard before Bazel wrote its TIMEOUT test.log and goroutine
dump. Step 23, job 56 (step sum + 5, under the merge queue's 60).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): say the dolt-race job timeout bounds the job, not the run
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(show): --current through issueops.FindCurrentIssue over the Querier role; no swallowed refusal (S6e)
Over http `bd show --current` printed the WRONG issue, exit 0.
resolveCurrentIssueID asked the raw SearchIssues method for the actor's
in_progress and then hooked work; the http backend refuses that method, the
refusal was taken for "nothing found", and the command fell back to the
last-touched issue. The proxied route had its own copy of the lookup, read
inside its unit of work, with the same swallow.
One library entry now: issueops.FindCurrentIssue(ctx, Querier, actor). It
asks the Querier role (queryIssues over http, which every deployed server
publishes) for `status=<s> AND assignee="<actor>"`, limit 1 — exactly the
raw filter, answered in the store's default order, so the same row comes
first on every backend — in_progress, then hooked. A failed read is an
error; "" (two reads that answered and found nothing) is the only miss. The
actor is a quoted, escaped query value; the query language reads
`assignee=none`/`null` as "unassigned", so such an actor (or an empty one)
is not asked about.
Both CLI routes call it with their route's Querier (store.Querier() or the
proxied provider's) through one cmd/bd helper; what stays in the CLI is the
actor and the last-touched fallback (a workspace file). The proxied route
resolves --current before it opens its unit of work, and its duplicate
in-transaction lookup is deleted.
Tests: issueops unit tests (order, failure is an error on either read,
quoting, unaskable actors, each expression evaluates to exactly the raw
filter); cmd/bd fallback tests; served e2e TestE2E_ShowCurrentOverHTTP
(in-progress beats a later-touched issue, hooked when nothing is in
progress, last-touched only when neither). Against the old code the e2e
fails with exactly the reported bug.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(recompute-blocked): one library entry, storage.RecomputeBlocked; a no-op on a remote backend (S25)
`bd recompute-blocked` refused over http ("storage backend does not support
is_blocked recompute"), and gc's BdStore.RecomputeBlocked issues it.
is_blocked is server-derived. Every write a remote client makes is committed
by the server's own store, which keeps the flag under
issueops.BlockedStateInvariant's local-write clause (targeted, inside the
write's transaction; a Postgres-family server has no full recompute at all
and runs a no-op readiness strategy for the same reason). A client cannot
leave the flag stale and holds no copy of it. The invariant's merge clause
(a recompute skipped after a pull, bd-6dnrw.37; a migration that over-set
it, beads#7037) happens to the SERVER's database, and its repair is this
command in the server's workspace.
So the decision is in the library, not the CLI: storage.RecomputeBlocked
(internal/storage/blocked_recomputer.go) is the one entry every backend goes
through. A local store (storage.BlockedRecomputer) recomputes its column; a
store implementing storage.ServerMaintainedBlockedState — the http client,
whose BlockedStateMaintainedByServer answers true — recomputes nothing and
reports MaintainedBy "server". No wire operation: a whole-column rewrite any
bearer of a workspace credential could trigger, for state no client can have
caused, is not one to publish. The proxied route keeps its pinned-connection
plumbing around the same versioncontrolops body the stores run.
--json keeps rows_corrected (gc requires the member; wh-bridge-sync reads the
exit code) as 0 and adds maintained_by: "server"; the text says where the
repair runs.
Tests: storage unit tests (local repair runs, server-maintained wins even
over a local repair and runs none, neither refuses); served e2e
TestE2E_RecomputeBlockedOverHTTP (exit 0, JSON shape, text, ready set
unchanged). With the server-maintained branch disabled the e2e fails with
the old refusal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(search): every bd search route through Reader.List with issueops.SearchListRequest; listIssues `q` behind issues.list.search (S26)
`bd search` called the raw SearchIssues method with its text, which the http
backend refuses ("partial-id search is not available over HTTP"), and its
direct and proxied routes each mapped the flags onto a storage filter by
hand. No served operation could carry search's meaning (title OR id contains
the text, case-insensitively; an id-shaped text also matches exact id, id
prefix and external ref): TitleSearch is title-only and the query language
has no title-or-id predicate.
The library entry is issueops.Reader.List:
- issueops.ListRequest gains Query, SearchIssues' free-text argument as a
member. Both Reader bodies (workapi/storereader and the uow reader) pass it
to SearchIssuesWithCounts where they passed "". It narrows and lifts no
default exclusion; the ready arm refuses it (readyScopeFields).
- issueops.SearchListRequest(query) is search's scope as a request: Query,
every status (AllFlag), every kind of row (the four Include*), and the
store's default order (SortBy priority), so --limit keeps the rows a raw
read kept.
- CLI: ONE runSearch for the direct, proxied and remote routes. One builder
(searchListRequest) maps the flags onto SearchListRequest; the route only
picks the reader (store.IssueReader() or the proxied provider's).
--sort/--reverse reorder the page as before. search_proxied_server.go and
its hand-built filter are deleted, and search leaves the forbidigo
filter-writing exemption.
- Server: GET /v0/beads/issues decodes `q` into ListRequest.Query and calls
the same Reader role, behind the new issues.list.search behavior token
(spec parameter cites it; additive, no wire_revision bump; apigen and the
wire-shape digest regenerated).
- Client: the encoder maps Query to `q`; httpReader.List refuses a request
carrying Query BEFORE dialing, with ErrUnsupported{Capability:
issues.list.search}, unless the handshake advertises it — never a round
trip an old server would 400, never the unsearched listing passed off as
the search. CapListSearch mirrors the server token. Flags listIssues
publishes nothing for are put on the request so the encoder refuses them
rather than widening the search.
Tests: Reader contract case RunReaderListQueryMatchesTheTitleOrTheID (also
pins SearchListRequest's scope) on all four legs — dolt, embedded dolt, uow,
served http (label-scoped, so the served leg runs it as written); handler
test that `q` reaches the seam as the search text, not TitleSearch; client
tests for `q` and the pre-dial refusal (zero dials); round-trip and
vocabulary gates; TestSearchRoutesAgree runs the same twelve flag sets on
the direct, proxied and remote routes and requires identical answers
(remote is bd serve over the proxied database, so ids and order too); served
e2e TestE2E_SearchOverHTTP. The remote legs skip with the
SearchIssuesWithCounts refusal until S6c's externaldeps reader passthrough is
underneath (loud refusal, never an empty or wrong answer); with S6c
cherry-picked all three routes agree.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* build: resync BUILD srcs and the embedded storage shard manifest for S6e/S25/S26
gazelle picks up cmd/bd/show_current.go, cmd/bd/search_remote.go, the three
backend/http e2e files and internal/httpclient/list_search_test.go; the
embedded storage shard manifest gains
TestEmbeddedReaderListQueryMatchesTheTitleOrTheID
(scripts/ci/gen_embedded_storage_shard_manifest.py 15 --weights=duration
--write).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: gofmt list_show_filter_modes.go (trailing blank line)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http/corpus): drop the show --current and recompute-blocked marks S6e and S25 retire
With S26 folded in, `bd show --current` resolves through
issueops.FindCurrentIssue over the Querier role and `bd recompute-blocked`
goes through storage.RecomputeBlocked (a no-op on a remote backend), so
gc-show-current and gc-recompute-blocked lose their pending marks.
mc-search stays pending, relabelled S6c+SRV-1: bd search now asks listIssues
with q behind issues.list.search, which the reference server profile does
not advertise, so the client refuses before dialing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(cmd/bd): split the bd search route agreement into the embedded and proxied lanes
TestSearchRoutesAgree skipped unless BEADS_TEST_EMBEDDED_DOLT=1, then ran
its proxied and remote legs only under BEADS_TEST_PROXIED_SERVER=1, and
its name matched neither lane's discovery (TestEmbedded* in
*_embedded_test.go, TestProxiedServer*/TestServerMode*). No CI lane ran
it, which main's #7468 guard (TestProxiedGatedTestsRunInTheProxiedLane)
now fails on.
Split it:
- TestEmbeddedSearchRoutesAgree (search_routes_embedded_test.go): the
direct route, embedded lane.
- TestProxiedServerSearchRoutesAgree (search_routes_proxied_test.go): the
proxied route and the remote route (bd serve over the proxied
workspace), gated only on BEADS_TEST_PROXIED_SERVER. The remote route
must still answer the proxied one row for row, ids and order included,
and refuse the flag listIssues cannot carry.
Neither lane can run the other's workspace, so the shared helper
(search_routes_parity_test.go: the seed, the twelve flag sets, and
checkSearchRoute) holds every route to one expected answer per flag set;
agreeing with it is agreeing with each other. The remote leg's "needs
S6c" skip is gone: S6c is on main, so a refusal now fails.
Both manifests regenerated incrementally (embedded 100-shard block, shard
71; proxied 34-shard block, shard 23). Bazel: bd_embedded_part2_test
(--config=embedded) and bd_proxied_test (--config=doltserver-proxied)
pass and run the new tests; //scripts:go_test_sources_test passes.
Swapping the title-sort expectation fails both routes of the proxied
test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(search): keep an infra type's durable rows, expand --type aliases, fail the S26 e2e on refusal (bd-1ejjv6)
Review fixes for #7528, attempt 1: the three majors and three minors of
the synthesis.
`bd search --type <infra type>` dropped the type's durable rows (a
promoted wisp, an issue retyped after it was created), exit 0. The shared
listing (workapi.BuildListFilter) narrowed an infra --type to its
ephemeral rows unconditionally, so SearchListRequest's IncludeEphemeral
did not bring back what raw SearchIssues used to return. The narrowing
now applies only without IncludeEphemeral, in BuildListFilter and in the
count lockstep (applyCountIncludeInfra), and the http parent-walk
recognizer reads an infra type's Ephemeral back as the include_ephemeral
intent. This also fixes `bd list --type <infra type> --include-ephemeral`
and GET /v0/beads/issues, which shipped the narrowing in v1.3.1. Pinned by
workapi tests and by template, gate, wisp and promoted-message rows in the
Reader conformance Query case (new ReaderFixture.PromoteWisp) on the
dolt, embedded, uow and served backends; the issueops Reader/Counter docs
and the openapi descriptions say the same.
`bd search --type` handed the raw string to the Reader: an alias (feat,
mol, mr, ...) answered nothing and an unknown type an empty result. It is
now expanded with utils.NormalizeIssueType as `bd list` does, and an
unknown type exits 1. The help text and the CHANGELOG say so, and the
CHANGELOG also records the additive comments_omitted field in
`bd search --json` rows.
TestE2E_SearchOverHTTP skipped on the very SearchIssuesWithCounts refusal
it exists to catch; it now fails. The route agreement seeds "kinded"
template, gate, wisp and promoted-message rows and pins the alias, the
unknown-type refusal and the infra rows on the direct, proxied and remote
routes.
Minors: the CHANGELOG states the proxied `bd show --current` miss
fallback; the CommentsOmitted contract names `bd search --json`; the
storage.RecomputeBlocked and `bd recompute-blocked` comments name the
deliberate --proxied-server bypass.
Validation: go vet and gofmt on every changed package; make api-check;
workapi, issueops, httpclient/encode, types and storage unit tests; the
Reader conformance on dolt, embedded, uow and served; the embedded and
proxied route agreements (remote included), the embedded search tests,
TestProxiedServerSearch, TestProxiedServerRecomputeBlocked, the http e2e
search/show/recompute tests; docs flag, freshness and docsync checks; and
a hand-run bd search/list/count against a scratch workspace.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(create): let a remote backend mint the --parent child id
`bd create --parent` always called the raw GetNextChildID first, which the
http backend does not serve, so every child create on a remote workspace
refused before writing anything. The Lifecycle role already mints
<parent>.<n> for a create that carries a ParentID and no id of its own, on
every backend and inside the create's own transaction; conformance
RunIssueOperationsCreateUnderAParentMintsTheNextChildID pins it on every leg,
the served one included (and the bd-enterprise postgres leg the MC server
runs). So the create route needs no new capability token: on a registered
Remote backend the client skips the raw reservation and lets the server mint.
The local route keeps its reservation so its Dolt commit staging is
unchanged, and an explicit --id beside --parent is still refused up front.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(mol): molecule reads, auto-close and close --continue over issueops roles
Over the http backend three molecule paths failed, and two of them
silently:
- `bd mol current` / `bd mol progress` without an id answered "no molecules"
because the in_progress listing (a raw SearchIssues shape) and the parent
walk (raw GetDependencyRecordsForIssues) were refused and the refusal was
swallowed; with an id they refused on raw GetMoleculeProgress.
- The molecule auto-close after `bd close` never ran: findParentMolecules
swallowed the same refused edge read into "not part of a molecule".
- `bd close --continue` claimed the next step in a raw RunInTransaction.
The direct route now reads molecules through roleMolStore, which answers
through roles every backend serves: EdgeReader (batched at the wire's 100
anchors) for the parent walk, BatchGetter for the roots (Get per id where a
server does not publish issues.batchGet), Relations for the step rows (full
rows; the raw dependents read over http is getIssue's shallow projection,
which zeroed step assignees) and the progress counts, and Reader.List for the
in_progress/hooked listings. The auto-close closes the root through
Lifecycle.Close, and the --continue claim is one Lifecycle.Update guarded by
ExpectedStatus=open.
No refusal is swallowed any more: findParentMolecules, the molecule finders
and the hooked scan return their errors; `mol current/progress` report them;
the auto-close stays best effort but warns on stderr; AdvanceToNextStep only
moves on to the next ready step when the claim LOST a race (status mismatch,
not claimable, already claimed) and returns anything else. The one heuristic
still skipped is the id-pattern heal in loadDescendants, and only for an
ErrUnsupported backend that cannot express an id-prefix search; other
failures now surface. `mol current`/`mol progress` leave the
types.IssueFilter forbidigo hole, since they no longer build a filter.
gc does not depend on bd's molecule auto-close: it runs its own
(cmd/gc/molecule_autoclose.go, from the bd on_close hook and the
controller's bead-close events). Its worker prompts do run `bd mol current`.
Served e2e (TestE2E_MoleculesOverHTTP): create --parent mints <root>.1/.2,
mol current <id> is non-empty with the full in-progress step, mol progress
counts, close --continue auto-advances, closing the last step auto-closes
the root. `mol current` without an id now refuses out loud on this stack
(asserted: never an empty list); its non-empty assertion is skipped until
S6c (externaldeps reader passthrough) is underneath.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(mol): list molecule candidates with the four wire knobs, drop the S6c skip
On top of S6c the in_progress listing behind 'bd mol current' (no id)
reaches the v0 wire encoder, which refuses ListRequest.IncludeAllTypes.
Ask for templates, gates, infra and ephemeral rows explicitly, which the
wire publishes, and run the 'mol current without an id' served case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(issueops): one library entry each for molecule auto-close, advance and reads
The molecule rules lived only in cmd/bd, in copies that disagreed: two
auto-close implementations that closed the root through different
library entries outside the step close's transaction, a `close
--continue` claim that set no assignee and could take a step another
agent held on the direct and http routes, and three progress counts.
Every molecule rule now has one implementation in the public issueops
package, composed over three roles every backend serves (BatchGetter,
Relations, EdgeReader): MoleculeRoots, LoadMolecule, AnalyzeMolecule,
ViewMolecule, ReadMoleculeProgress, ActiveMoleculeIDs,
CompletedMolecule. Membership is the parent-child edge.
Auto-close: CloseRequest.AutoCloseMolecule and
CloseBatchRequest.AutoCloseMolecule (opt-in, so gc's own auto-close is
not doubled) close the molecule root a close completed IN THE SAME
TRANSACTION, unforced and guarded on the root revision read there:
storageissueops.CloseCompletedMoleculeInTx on the store backends (the
role bodies bound to the caller's tx, TxMoleculeReader) and
uow.CloseCompletedMoleculeInUOW on the unit of work. It replays on an
idempotent re-close, reports the root on CloseResult/CloseOutcome
.AutoClosedMolecule, and a root its own close policy refuses stays open
and is reported (MoleculeAutoCloseRefusal) without failing the step.
Advance: a new MoleculeStepper role (storage.DoltStorage accessor,
uow.MoleculeStepperSource) whose one implementation,
issueops.NewMoleculeStepper, claims the next ready step through the
Claimer (Lifecycle.Update's Claim for a wisp step): assignee set, a step
another actor holds skipped, never taken.
HTTP: closeIssue/batchCloseIssues carry auto_close_molecule behind the
issues.close.autoCloseMolecule behavior token, and POST
/v0/beads/issues/{id}:advanceMolecule (issues.advanceMolecule) serves
the stepper. Handlers only decode, call the role and encode. The client
sends the member and dials the operation only where advertised; against
an older server it DEGRADES rather than refuses — it runs the same
library rule over its own roles (issueops.CloseCompletedMolecule after
the close, NewMoleculeStepper for the advance), so the outcome is the
same in more round trips. The capability fallbacks that lived in
cmd/bd move into the client: BatchGetter answers one getIssue per id
without issues.batchGet, and EdgeReader splits past the operation's 100
anchors.
Conformance: RunMolecule* on dolt, embedded, uow and http (the http leg
twice: served, and against a server with the tokens struck out).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(cmd/bd): molecule commands and create --parent through the library entries
`bd close`, `bd close --continue`, `bd mol current`, `bd mol progress`,
`bd ready --mol` and `bd create --parent` now call the one library entry
for each rule on every route (direct, proxied server, remote):
- close (batch, --if-revision, proxied) sets CloseRequest/
CloseBatchRequest.AutoCloseMolecule and only reports what the library
closed in the step close's transaction. autoCloseCompletedMolecule,
autoCloseProxiedCompletedMolecule and closeCompletedMoleculeRoot are
gone, and so is the separate post-close write.
- --continue is the route's MoleculeStepper role: a real claim (the
assignee is set) that skips a step another actor holds. Before, the
direct and http routes flipped the status only and could take it.
AdvanceToNextStep, ClaimStepIfOpen and its two implementations are
gone.
- mol current / mol progress / ready --mol read through
issueops.ViewMolecule, ReadMoleculeProgress, ActiveMoleculeIDs and
LoadMolecule/AnalyzeMolecule over the route's roles. Over http this
fixes the missing step assignee on `ready --mol` (corpus mark
mc-ready-mol). The proxied route's SearchIssues fallback, the role
store, the third progress count and the cmd/bd copy of the readiness
analysis are deleted; only presentation stays here.
- create --parent asks the create role to mint the child id on every
route (the local CLI reservation is gone) and to inherit the parent's
labels (InheritLabelsFromParent) inside the create. The dry-run
preview still shows the labels, and a failed label read there is
reported, not swallowed.
TestProxiedServerMoleculeLifecycleAgreesOnEveryRoute runs one molecule
lifecycle through the real binary on the direct, proxied and remote
(`bd connect` to `bd serve`) routes and requires the same rows and the
same JSON on all three. The served e2e now also pins the held-step skip,
the claimed step's assignee and the full rows of `ready --mol`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): refuse molecule auto-close and advance before dialing an older server
The client used to DEGRADE against a server without
issues.close.autoCloseMolecule / issues.advanceMolecule: it closed the step
without the member and ran a second, client-side copy of the auto-close
(issueops.CloseCompletedMolecule) in its own transactions, and composed the
stepper over its own roles. That kept two executions of each rule alive.
Now the rule runs in ONE place, the server's library: a close or batch close
that sets AutoCloseMolecule, and an Advance, refuse before anything is dialed
with the typed capability error (storage.ErrUnsupported, Capability naming the
token). The composed single-item batch leg now carries the member too.
- issueops.CloseCompletedMolecule (the role-composed form) is gone.
MoleculeRootClose is the one root close request (unforced, the auto-close
reason, the session, guarded on the root revision read), and both
in-transaction bodies (storage issueops CloseCompletedMoleculeInTx, uow
CloseCompletedMoleculeInUOW) build from it.
- MoleculeView.Ready is `bd ready --mol`'s list (every analysis-ready node,
hydrated), so ready --mol and mol current derive from ViewMolecule alone.
Tests: unit pre-dial refusal and member pins (httpclient molecule_test.go),
TestServedMoleculeRefusesAgainstAnOlderServer (step stays open, nothing
claimed) replacing the degraded contract arm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cmd/bd): ask for the molecule auto-close only where the route serves it
The refuse-before-dialing client made every `bd close` over http fail
against a server that does not advertise issues.close.autoCloseMolecule
(an older bd serve, or the MC server shape, whose orchestrator owns the
molecule lifecycle): the CLI always set AutoCloseMolecule.
storage.ServesMoleculeAutoClose answers, through every decorator, whether a
store's closes may carry the flag (MoleculeAutoCloseProber, implemented by
httpclient.Store from its handshake; every local backend serves it). The
direct batch close and the --if-revision close set the flag from it; the
proxied route always serves it. Against a silent server the close goes out
without the member and the server's side owns the auto-close.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http): scope the advertised-policy check to reads before the close
The close policy check is the client-side policy's last chance: it runs
before the close request, so only the reads up to that request count. A
read after the close (the old-server molecule notice reads the closed
step's edges) is not the external-dependency policy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http/corpus): drop the six marks S16 and S19 retire
With the molecule library entries underneath, mol current (with and
without an id, json and text), mol progress and ready --mol read through
issueops.LoadMolecule over the roles, and create --parent lets the server
mint the child id. Those six shapes pass on the reference profile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cmd/bd): never silent against a server without the molecule tokens
Against a server that advertises neither issues.close.autoCloseMolecule
nor issues.advanceMolecule (an older bd serve, or one whose orchestrator
owns the molecule lifecycle):
- `bd close --continue` closed the step and only then found the advance
refused, leaving the step closed and the next step unclaimed. It now
asks storage.ServesMoleculeAdvance (a MoleculeAdvanceProber the http
store answers from its handshake; local backends always serve it)
BEFORE the close and refuses up front, saying nothing was closed.
- `bd close` went out without auto_close_molecule and said nothing. When
the closed step belongs to a molecule (issueops.MoleculeRoot), a notice
on stderr now names the molecule and the missing token: its auto-close
is the server's to run. The batch and --if-revision closes both say it.
The served e2e masks both tokens out of the handshake and checks the
up-front refusal (the step stays open) and the notice; the httpclient
unit test pins ServesMoleculeAdvance to the handshake.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(cmd/bd): mol show through issueops.LoadMolecule on every route
`bd mol show` still loaded the molecule through cmd/bd's
loadTemplateSubgraph (raw GetIssue, GetDependentsWithMetadata and
GetDependencyRecords, plus an id-pattern child probe), while mol current,
mol progress and ready --mol read through the library. It now loads
through issueops.LoadMolecule over the route's molecule roles (the direct
store's, or the proxied provider's), so membership is the parent-child
edge everywhere and the http route reads through roles the server serves.
The served e2e checks mol show's root and step count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: the molecule auto-close fails the step's close on a non-policy error; stale comments
CloseRequest.AutoCloseMolecule and CloseCompletedMoleculeInTx now say what
changed when the auto-close moved into the close's transaction: a root
close the close policy refuses still leaves the root open and is reported,
but any other failure (a storage error, a lost race on the root's revision)
fails the step's close with it, where the CLI used to close the root
afterwards and only warn.
Stale: the advanceMolecule vocabulary entry said the client composes the
stepper over its own roles when unserved (it refuses before dialing), and
the graph-create collision probe called itself best-effort by transport
(the http GetIssue miss is storage.ErrNotFound like every other store's).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): the molecule tokens and the S16/S19 behaviours
Entries for issues.close.autoCloseMolecule and issues.advanceMolecule, the
issueops molecule entries, the auto-close inside the step's close (and a
non-policy failure of it failing the close), the real claim behind
close --continue, the molecule reads on every route, the notice and the
up-front --continue refusal against a server without the tokens, and
create --parent / mol reads over http.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): regenerate unsupported_gen.go for MoleculeStepper
The PR adds MoleculeStepper() to storage.DoltStorage (200 -> 201
methods). httpclient implements it by hand, but the generated shell's
trailer still counted 200, so
//internal/storage/unsupportedgen:unsupportedgen_test
(TestGeneratedShellIsFresh) failed in Bazel / test and
Bazel / integration, turning CI Gate / Required red.
Regenerated with `go generate ./internal/httpclient`; the only change
is the trailer count (143 of 201 methods generated; 58 left).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(molecule): auto-close refusals, write skew, close --json, docs
Review fixes for #7513, numbered as in each iteration's review
synthesis.
Iteration 1:
F1: a close guard's refusal of the root (TemplateReadOnlyError,
PinnedError, CloseNotAssigneeError) is an auto-close refusal, like the
close policy's: the root stays open and is reported, and the step's
close stands. Pinned by the new conformance case
RunMoleculeGuardedRootKeepsTheStepClose on dolt, embedded, uow and the
served http client.
F2: two closes that finish a molecule's last two steps in concurrent
transactions each read the other's step as open, so neither closed the
root and both committed. Every auto-close now rewrites the root's
coordination cell before it decides the root (local_metadata
molecule-coordination/v1/<shard>, the dependency coordination idiom and
sharding with a FreshRowLock value), in both twins
(CloseCompletedMoleculesInTx and CloseCompletedMoleculesInUOW). Two
deciders of one root now conflict at commit (1213), and the retry reads
the winner's close and closes the root. This is the synthesis's option
(c), applied through a coordination cell instead of the root row; it
needs no post-commit second transaction and no engine lock. The
deterministic two-transaction regression fails without the touch and
passes with it on dolt and uow; the concurrent-close tests end with the
root closed in every round, reported by exactly one close.
F3: the auto-close checks the root's eligibility before walking any
step, MoleculeStepsClosed stops at the first open step, and a batch
decides each root once and reports it on the first item under it.
F4: ErrVersionMismatch on the root is not a refusal; it fails the
step's close with it. The classifier unit test pins this. A conformance
case cannot stage that race deterministically through the public roles.
F5: storage.ServesMoleculeAdvance answers (bool, error), and bd close
--continue refuses before closing anything when the handshake cannot be
read.
F6: the CHANGELOG and the stepper and batch-closer doc comments say
what the code does.
F7: the unserved-auto-close notice fires only when the close left an
auto-closing molecule with every step closed and its root open
(issueops.CompletedMolecule): again on a re-close, once per root in a
batch, never for a step under an ordinary epic or an unfinished
molecule. Proxied mol show, mol current and mol progress again report a
read unit of work that cannot be opened as itself, not as a molecule
that was not found.
F8: the write-ledger comment says the close is refused before dialing.
The dead FirstClosed/LastClosed guards in mol progress pre-exist on main
and are left as they are.
Iteration 2:
F1: on the proxied route, bd ready --mol reported a read unit
of work it could not open twice: once as itself, then as "molecule
'<id>' not found", which under --json is a second error document on
stdout. It now returns moleculeNotResolved, as mol show, mol current and
mol progress do. TestProxiedReadyMolReportsAnUnopenableReadOnce drives
runMoleculeReady with a provider whose NewUOW fails and wants one Error:
line, or one JSON document; both subtests fail with the old return.
F2: the coordination cell serializes every concurrent close of a step
under an open auto-closing root, not only the closes that finish the
molecule. That is the price of deciding the root in the step's
transaction, so it is documented (TouchMoleculeCoordinationInTx, the
UOW twin, CloseRequest.AutoCloseMolecule, the CHANGELOG) and pinned on
dolt and uow: two sibling closes with a third step still open conflict
(both commit when the touch is removed, on either twin), and a six-step
fan-out closes every step through the store's retry, with the root
closed and reported by exactly one close. The synthesis's alternative,
a post-commit recheck by any close that read a step open, is not taken:
it is a second, best-effort transaction after the step's commit, the
shape this PR exists to remove.
F3: MoleculeRootClose's doc no longer promises that a step reopened
between the completion read and the root close fails the step's close.
The guard is the root's RowVersion, which a step reopen never writes;
the doc now says what the guard covers and that this race goes
undetected (it is inherited from the CLI's old post-commit auto-close).
F4: the user docs describe the auto-close. docs/workflows/molecules.md
replaces "Closing the last child does not close the molecule root"
with which roots close and which stay open, the refusal warning, the
unserved-server note and the --json members, and documents the claiming
--continue and parent-child step membership;
docs/reference/json-schema.md gains a bd close --json section. These
are main-only behaviors on pages pinned to v1.2.2 (docs/cli-docs.pin):
a maintainer call against §1 of
engdocs/decisions/2026-07-17-docs-release-pin.md, as in #6508, #5855,
#5997 and #5092. The auto-close itself shipped in v1.2.2
(cmd/bd/close.go autoCloseCompletedMolecule), so the old sentence was
already wrong at the pin. docs/cli-reference/ is generated from the
pinned release and is not hand-edited; the bd close and bd mol show
help texts carry the same facts and reach it at the next pin bump.
F5: bd close --json reports the auto-close. The entry of a close that
completed a molecule gains auto_closed_molecule (the root it closed) or
molecule_auto_close_refusal (why the root stayed open), the HTTP API's
names, on the direct, proxied and --if-revision routes. The members sit
beside the issue's own rather than wrapping the output in an object the
way --suggest-next does: an object would change the output's shape
exactly when a close completes a molecule and break every consumer that
reads an array, while members leave each entry decoding as the closed
issue, compose with `closed` under the flag objects, and leave a plain
close's bytes unchanged. Pinned on the embedded and proxied tiers
(TestEmbeddedCloseJSONReportsMoleculeAutoClose, TestProxiedServerClose2B
json_reports_*, and both --if-revision replay tests), all red without
the change.
F6: cmd/bd's BeadsTemplateLabel is issueops.MoleculeTemplateLabel, so
the template commands and molecule membership cannot drift apart.
F7: the UOW twin's revision probe says that it writes nothing,
and the BatchCloseRequest.auto_close_molecule spec description has its
verb back (apigen regenerated, no drift).
Iteration 3:
F1: on the unit-of-work route (bd serve, the proxied CLI), a refused
root's molecule_auto_close_refusal and warning carried the use case's
and repository's wrapping ("close <id>: db:
IssueSQLRepository.CloseChecked <id>: ...") around the refusal, where
the tx twin and the docs give the refusal alone. Both twins now report
it through RefusedMoleculeAutoClose, which answers the refusing guard's
or policy's own sentence. RunMoleculeRefusedRootKeepsTheStepClose,
RunMoleculeGuardedRootKeepsTheStepClose and the embedded and proxied
close --json tests want that exact sentence; the uow conformance leg
and the proxied test fail without the unwrap.
F2: the docs no longer promise ErrVersionMismatch for a write to the
root that races its auto-close. The root's read and its revision check
share one transaction snapshot, so that write conflicts with the root
close at commit and the retry decides the root again; the close fails
only if it still conflicts when its retry budget runs out
(MoleculeRootClose, IsMoleculeAutoCloseRefusal,
CloseRequest.AutoCloseMolecule, the tx twin's comment, the CHANGELOG
and the OpenAPI description, apigen regenerated).
F3: TestEmbeddedCloseJSONReportsMoleculeAutoClose moves above
TestEmbeddedCloseConcurrent's doc comment, which documents its own test
again.
F4: bd mol progress counting direct steps while the auto-close counts
every descendant predates this PR; it is left for a follow-up.
F5: cmd/bd's molReader drops GetMoleculeProgress, which nothing called
once mol progress read through issueops.ReadMoleculeProgress.
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.5 <noreply@anthropic.com>
* fix(memory): preserve presence for empty values (#5963)
Recall and Forget now distinguish an existing empty memory row from an absent key across direct, embedded, and UOW storage paths.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of sjarmak
* fix(memory): make bd recall report presence from row existence
printRecallResult (and the recallCmd caller) derived "found" from
value != "", so a memory stored as the empty string still printed
"No memory with key" and exited 1 even though the role's
RecallResult.Found was true and bd forget would delete the row.
Thread result.Found through instead: an empty-valued memory now
recalls cleanly (exit 0, empty value; JSON reports found: true), and
only an absent key is a miss.
Addresses maintainer review on #5964 (fixes#5963).
* test(httpapi): pin GET /v0/beads/memories/{key} as 200 for an empty value
TestGetMemoryAnswersAMissWithA404 pinned a RecallResult{Value: ""}
case (Found defaulting to its zero value, false) as a 404, a shape no
backend can produce since Found now comes from row existence rather
than value truthiness. Move that case into its own
TestGetMemoryAnswersAnEmptyValueWith200, which recalls Found: true
and asserts a 200 with an empty value. Also updates the handler's
doc comment, which still described the retired 404-on-empty
behavior.
Addresses maintainer review on #5964 (fixes#5963).
* docs(httpapi): fix openapi spec to say memory presence is row existence
The published spec still said an empty-valued memory is a 404 on
GET /v0/beads/memories/{key} and DELETE /v0/beads/memories/{key},
contradicting the role's RecallResult.Found (row existence). Rewrite
the operation descriptions, both 404 response bodies, Memory.value
and RememberedMemory.replaced to say presence is row existence
everywhere: an empty-string memory is a 200 (or is removed by
forget) with an empty value, matching what GET /v0/beads/memories
already enumerated. Regenerate types.gen.go via `make api-gen` so
the generated doc comments match.
Addresses maintainer review on #5964 (fixes#5963).
* docs(changelog): note the empty-valued memory presence fix
Add an Unreleased/Fixed entry for #5964 (fixes#5963): bd recall,
bd forget and GET /v0/beads/memories/{key} now treat an empty-valued
memory as present everywhere, instead of only on GET
/v0/beads/memories.
* fix(memory): make bd remember <bare-key> recall an empty-valued memory
rememberBareKeyPath decided presence from existing != "", so a bare slug
naming a memory stored as the empty string was refused as "no memory
named" instead of recalled. It now takes the role's Found, matching
printRecallResult, bd forget and the HTTP door.
* test(memory): pin empty-value presence through the real commands
TestPrintRecallResult and TestRememberBareKeyPath call the helpers directly,
so a RunE that went back to deciding presence from value != "" would leave
them green. TestEmbeddedMemory/empty_valued_memory_is_present empties a
memory row beneath bd and runs bd recall, bd remember <bare-key> and
bd forget against it, checking first that bd no longer sees the placeholder.
Two comments in problem.go and one in memories_test.go still said an
empty-valued memory is a 404. The CHANGELOG line now says a key with no row
is a miss, since a forgotten key was once stored.
* build(bazel): add the memoryops dep to the bd_test go_test (make bazel-sync)
memory_embedded_test.go now imports internal/storage/memoryops directly
(storagememoryops.StorageKey, to overwrite a memory row out of band), so
gazelle emits //internal/storage/memoryops on bd_test. cmd/bd/BUILD.bazel
landed on main after this PR branched, so the PR could not carry the dep;
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>
* test(memory): maintainer fixup — adoption review nits
Maintainer fixup for the adopt-pr iteration-1 review of #5964. Both review
lanes approved and the quality scorecard approved at 981; these are its four
non-gating nits, each confined to lines this PR already adds.
- internal/httpapi: TestForgetMemoryOfAnEmptyValuedKeyIs200 pins the DELETE
door's empty-value 200 the way TestGetMemoryAnswersAnEmptyValueWith200
pins the read. Guarding the handler's 404 on Value == "" reddens exactly
this test and nothing else.
- CHANGELOG: the bullet names DELETE /v0/beads/memories/{key} beside GET,
whose answer changed the same way (404 with the row left standing -> 200
with the row removed).
- uow: the two new GetAllConfig presence probes in Recall and Forget say why
they read the whole table, by pointing at Remember's rationale.
- conformance: RunMemoriesEmptyRowIsPresentUntilForgotten runs its
no-history-on-retry leg last and SKIPs it with a reason when a fixture has
no CountHistory, as the MemoriesFixture doc promises, instead of passing
quietly. All three in-tree fixtures wire the hook, so every in-tree run
is unchanged (19/19 on dolt, embeddeddolt and uow, 0 SKIP).
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>
* fix(httpclient): report an empty-valued memory as present (base-refresh repair)
Maintainer repair from refreshing #5964 onto main b630f96f5b. Main's #7247
added the HTTP client store (internal/httpclient) after this PR branched,
and its memory role and served conformance leg still treated a memory
stored as the empty string as absent:
- Recall set Found from Value != "".
- The RecallMemory doc said an empty-valued row was a 404.
- TestServedMemoriesRecallConflatesStoredEmptyWithAbsent called
conformance.RunMemoriesRecallConflatesStoredEmptyWithAbsent, which this
PR deletes.
The rebase applied cleanly, but the merged tree did not compile.
- internal/httpclient/memories.go: Recall reports Found true on any 200.
With this PR the wire returns a 404 only for a key with no row; an
empty-valued row comes back as a 200 with an empty value. Setting Found
from Value would hide that row again on the HTTP backend. Forget already
reported Found true on a 200.
- internal/httpclient/wire/writes.go: the RecallMemory doc now says the
same.
- internal/httpclient/served_memories_deps_test.go: the hm10 served case
now runs RunMemoriesEmptyRowIsPresentUntilForgotten, the contract case
this PR adds in place of the one it deletes.
With BEADS_TEST_EMBEDDED_DOLT=1 the served memory tests pass with 0 SKIP.
Reverting the Recall line makes hm10 fail with
`Recall("hm10-stored-empty") = value "" found false, want value "" found
true`.
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: sjarmak <t@t.co>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): unlimited ready/query/list reads over http, client-capped
An unlimited read never puts limit=0 on the wire, which a non-loopback
bd serve refuses ("unlimited reads are loopback-only"):
- bd ready --limit 0 (the WorkFilter bridge) sent no limit at all, so the
server's 100-row ready default silently capped every routed-pool queue.
- Reader.Ready and Querier.Query with Limit 0 sent limit=0 and got a 400
from a non-loopback server.
listReadyWork and queryIssues publish no cursor, so an unlimited read is
one request bounded at the client cap plus one (one server read, so one
snapshot). listIssues keeps its cursor walk, now bounded by the same cap
(per-page reads; the snapshot semantics are documented in
unlimited_read.go). Past BEADS_HTTP_UNLIMITED_READ_CAP (default 10000) the
read is refused with *UnlimitedReadCapError, never truncated; a server that
reports has_more below the requested bound is refused the same way. A
dispatch tripwire refuses limit=0 on the three listing operations, so a new
path that forgets fails loudly instead of only off loopback.
Served tests run against a server in --allow-non-loopback mode with 150
rows: ready (role, bridge, bridge+total), query and list at limit 0 return
every row with a bounded limit on every request, and the cap refuses with
the typed error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http/corpus): drop the three marks S15 retires
With unlimited reads served (one request bounded at the cap plus one for
ready and query), gc-ready-unlimited, gc-ready-pool-demand-unlimited and
gc-query-wisps-unlimited return every row on the reference profile instead
of the server's default page or the loopback-only refusal. mc-list-id stays
pending on S15b (--id).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): unlimited reads over http and BEADS_HTTP_UNLIMITED_READ_CAP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): uncap the list walk and bound the ready-count fallback
Review fixes for #7497 (review loop iterations 1 and 2).
F1 (major): the client cap no longer applies to an unlimited list.
listIssues publishes a keyset cursor, so no response is larger than a
page; the walk is back to base, bounded only by --max-rows /
BEADS_MAX_ROWS as on every local backend. The cap stays on the
cursorless reads (ready, query), whose whole answer is one response the
server buffers. The CHANGELOG, unlimited_read.go and the env doc say so.
F2 (major): externaldeps.CountReadyWork's no-counter fallback, which an
http store reaches whenever its server does not apply the
external-dependency policy (every released server), asked for the whole
ready set to report one number: over http, up to the cap's full rows,
and a refusal past it that text `bd ready` swallows into a missing
footer. It now asks for a one-row Lite page; the bridge pairs it with
the server's countReadyWork, and refetchedReadyTotal still sizes the
externally blocked case.
F3: TestCheckUnlimitedPage pins a full cap+1 page that also reports
has_more as the cap's refusal, not a truncation, and the env test
accepts the inclusive 1000000 bound. Served: the cap test adds the
unlimitedRows-2 case (the server's 149 rows with has_more), the list is
pinned as uncapped with MaxRows its only bound, and the bridge's
MaxRows-vs-cap precedence is pinned with the limit on the wire.
F5: readyBridgePage sends MaxRows+1 rather than cap+1 when MaxRows is
the tighter bound (tightenUnlimitedPage). The MaxRows check still runs
first, so an answer past it keeps its *ErrTooManyRows attribution.
F6: the decorator and test comments describe the cap+1 bound; the
refusal reads "narrow the query or raise BEADS_HTTP_UNLIMITED_READ_CAP";
the Ready and Query Limit contracts name the http exception; mc-list-id's
pending reason drops the S15 --limit 0 clause and keeps the --id refusal.
F7: unlimited_read.go states that the tripwire guards Store.dispatch
only, so a direct wire.Client caller (readyClaimPage) must send a
positive limit itself.
Not taken: F4 (an unlimited walk that meets has_more with no cursor ends
as a success rather than a ServerTruncated refusal). After F1 the walk
is base code again, the shape needs a skewed or older peer, and the
change would land in fetchIssuePages (cyclomatic 21, cognitive 34),
turning an untouched base function into a changed one in the major
complexity band. Left as a follow-up.
Iteration 2, N1: F5 reached only the raw bridge. `bd ready` reads
through the external-dependency decorator, and against a server that
leaves that policy to the client, one externally blocked issue made
readyExclusion take MaxRows off the unlimited inner query. The bridge
then asked for cap+1 rows: past the cap it refused with the read cap's
error (exit 1, "raise BEADS_HTTP_UNLIMITED_READ_CAP") rather than
--max-rows' (exit 2), and under it fetched the whole ready set to refuse
on the rows kept. An unlimited inner query now keeps MaxRows plus one
row per blocked issue: past that many rows more than MaxRows are kept
whatever the drop takes, so the bridge sizes the request by it under the
cap, and innerCapError hands the refusal back as the caller's own cap.
The suggested inner Limit of MaxRows+blocked+1 was not taken: a bounded
request skips the cap and its server-truncation check, so with any
external blocker a --max-rows above the cap would fetch past it.
TestServedReadyBridgeMaxRowsSizesTheRequest pins the request and the
refusal through externaldeps.New with one blocker, the cap still in
force past MaxRows plus the blocked rows;
TestServedReadyMaxRowsCountsTheRowsKept adds an unlimited case whose
refusal names the caller's cap on all three decorator reads.
N4: QueryRequest.Limit's "NOTHING BACKSTOPS IT" names the http
exception in its lead, as ReadyRequest.Limit does.
Not taken in iteration 2, as non-gating follow-ups: N2
(refetchedReadyTotal's Limit = total+blocked read sits outside the cap;
pre-existing), N3 (the list walk's has_more-without-cursor end, the
deferred F4), N5 (prefixing the malformed-cap error with its operation;
it already names the variable and its value).
Validation: the served tier (BEADS_TEST_EMBEDDED_DOLT=1
BEADS_HTTP_TEST_REQUIRED=1) for internal/httpclient and the command
corpus; go test for externaldeps, issueops and workapi. Each new test
was mutation-checked red: the zero-limit count, the tightening removed,
the MaxRows check removed, the PR's list cap restored, and a cap+1
has_more page read as a truncation. Iteration 2: the served
internal/httpclient ready, unlimited-read and external-policy tests (34
PASS, 0 SKIP) and go test for externaldeps, issueops and workapi; the
new pins go red with MaxRows taken off again (the pre-fix code), with no
re-attribution, with no growth by the blocked rows, with the suggested
inner Limit, and with Found left unadjusted.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(wisp): --age 0s treats every wisp as abandoned, even one Dolt rounded into the future (#7236)
findAbandonedWisps compared now.Sub(issue.UpdatedAt) > ageThreshold
unconditionally. Dolt's DATETIME(0) column rounds fractional seconds
half-up on write rather than truncating: a wisp created in the second
half of a wall-clock second can read back with updated_at up to 0.5s
in the future, making the comparison negative and failing the check
for a wisp that is, by definition, not yet one second old.
--age 0s's own documented contract ("hasn't been updated in --age
duration") means every wisp qualifies trivially -- nothing has been
updated in the last zero seconds. Extracted the comparison into
wispIsAbandoned(now, updatedAt, ageThreshold), which short-circuits
true whenever ageThreshold <= 0, bypassing the clock comparison (and
its rounding exposure) entirely for that case.
New TestWispIsAbandoned is a pure, deterministic unit test -- the
original TestCLI_WispGCExcludeType needs a live Dolt test container
and the reporter's own 60 real runs against one could not reliably
reproduce the race, so a timing-dependent regression test would be
exactly as unreliable. Confirmed red against the old inline
comparison (the two age-0s cases failed) before extracting the fix,
green after. go build/vet/gofmt clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185qSpS74AbkmHoKRPf2yDD
* chore: empty commit to retrigger mergeability recompute
GitHub's mergeStateStatus has shown DIRTY/CONFLICTING since 2026-10-06,
but a real `git merge --no-commit --no-ff` against current upstream/main
auto-merges cleanly on all 3 touched files -- no actual conflict. This
commit forces GitHub to recompute.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(wisp): pin the gc call site and drop the 1ms age from the embedded test
Folds the tests from #7472 into the #7236 fix.
TestWispIsAbandoned pins the predicate. It cannot see whether
findAbandonedWisps still decides age through it. TestFindAbandonedWisps
AgesAtStoragePrecision drives findAbandonedWisps through a new wispGCNow
clock seam with a wisp stored rounded into the future (written 12:00:00.7,
stored 12:00:01):
- --age 0s at 12:00:00.9 reclaims it. This fails against the old inline
now.Sub(updated_at) > threshold.
- --age 1h leaves it alone at that instant and reclaims it two hours later.
- --age 1s at 12:00:01.5 leaves it alone: a positive threshold does not
credit idle time that has not passed.
TestWispGCProtectsActiveWisps ran gc with --age 1ms and relied on creation
order to keep the most recently touched reclaimable wisp out of the
rounding window. --age 0s states the intent ("every wisp is old enough")
and is immune to the half-second rounding, so the ordering caveat goes.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <bd-7x9c69@gascity.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Resolve Dependabot alerts #146 (apache/thrift < 0.24.0) and #151
(google.golang.org/grpc <= 1.83.1) on the root module with the minimal
bump: no other module moves, and both need only go 1.25, so the Nix
flake stays on its current nixpkgs. Recompute default.nix vendorHash
for the new go.sum.
This lands the security fix independently of the Dolt 2.4.1 upgrade
in #7441, which carries the same two bumps.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(backend/http/corpus): served command corpus against the reference server profile
Add the S23 suite: every distinct bd command shape gc and its packs and
formulas issue against a work store (124 shapes in testdata/corpus.yaml),
run by the real bd binary against an in-process bd serve and compared
with the same command on an embedded workspace.
The server is bound in non-loopback mode with bearer auth. A reference
proxy masks it to a deployed bd 1.3.0 server's wire surface
(testdata/reference_server.json): exactly that server's capabilities and
handshake members (no wire_revision), a 404 for operations it does not
publish, and a 400 unknown_parameter for query parameters and request
members it does not declare. Every bd run sets BEADS_ACTOR and
CLAUDE_SESSION_ID.
A shape passes when the served run exits like the embedded run, carries
no refusal, and matches its output (json/ids/count/text) and its verify
reads. Known gaps are marked `pending` with the slice that fixes them.
A pending shape still runs, and it fails once it passes, so removing the
mark is how a slice proves itself. Permanent refusals are listed in
testdata/allowlist.yaml with reasons.
A limited listing that cuts through a tie set (same priority, created_at in
one second) lands on different rows on two workspaces seeded seconds apart;
such a shape names its unlimited form in `prefix_of`, and each side's
limited rows must be an ordered prefix of that side's own unlimited listing.
//backend/http/corpus:corpus_test takes //cmd/bd:bd_for_tests (size large,
timeout long), so under bazel the suite runs instead of skipping on a
missing BEADS_TEST_BD_BINARY.
Stacked on S6b/c/d, whose marks this file no longer carries: besides the
S6b/S6c/S6d marks, seven list shapes once marked S6c+S15 (their --limit 0
list walks the keyset cursor without S15) and the S6c+S16 last-step close
(an ordinary epic root never auto-closes) already pass on it.
On S6b/c/d (bazel, BEADS_TEST_EMBEDDED_DOLT=1): 97 pass, 25 pending,
3 allowlisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http/corpus): hand the corpus server the LeaseReclaimer role
main gained the LeaseReclaimer role (issues.reclaim) after S23 was written,
and httpapi.Config needs it when built from roles rather than a Provider, so on the restacked
S6bcd TestServedCorpus could not bind its in-process server ("no database
source"). The harness now passes s.LeaseReclaimer() with the rest, as
backend/http's e2e harness does. The reference proxy still masks the
issues.reclaim token, so gc-reclaim stays pending.
On the restacked S6bcd (bazel, BEADS_TEST_EMBEDDED_DOLT=1): 97 pass,
25 pending, 3 allowed, unchanged from before the restack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http/corpus): run the corpus in CI, hold allowlisted shapes
Review fixes for #7483 (review attempt 1): both majors, and four of the
seven minors and nits.
No CI lane ran TestServedCorpus. corpus_test sets neither
BEADS_TEST_EMBEDDED_DOLT nor BEADS_HTTP_TEST_REQUIRED, so the suite
skipped everywhere. corpus_served_test, an embedded-tagged sh_test over
go_test_variant.sh like http_served_test, runs it with both set and with
Bazel's prebuilt bd, and pr_risk_bazel_coverage_test pins its args and
env. Every other file in the package builds only under cgo, so a new
cgo-free test fails a BEADS_HTTP_TEST_REQUIRED=1 run that would otherwise
pass having run nothing. README.md and engdocs/TESTING.md say which lane
runs the suite.
The allowlist branch returned before the embedded exit check, so an
allowlisted shape was never held to what it says on the embedded
backend. The embedded run is now checked against the shape's expect_exit
and expect_stderr before the allowlist branch, and an embedded mismatch
fails as a corpus bug whatever the shape's pending mark or allowlist
entry. TestCorpusFileIsWellFormed requires an allowlisted shape to state
expect_exit and to carry nothing the allowlist would skip (compare: exit,
no verify). The three allowlisted shapes now pin their embedded refusals,
and the bd sql reasons say the command needs a sql-server workspace
instead of calling it local-only.
Minors and nits taken:
- two stale-guard shapes (--if-assignee nobody, --if-status open) expect
exit 13 on both sides; each kills a client that drops that guard;
- defer_until and due_at are compared as given instead of scrubbed to
<ts>, which kills a client that shifts --defer;
- gc-reclaim's pending mark names SRV-1 alone: the reference profile
does not advertise issues.reclaim, so the client refuses at its
capability preflight;
- refusalMarkers matches "does not advertise capability" unquoted, which
also catches the JSON-escaped preflight error.
Declined:
- a failure on empty-vs-empty comparisons, which needs an allow_empty
opt-in. Review attempt 2 seeded rows for two of the three ready shapes
that compared two empty lists (below); gc-ready-graph-anchor still
does;
- the context route's query check in the reference proxy: the server
already answers an unknown query parameter there with a 400
unknown_parameter, which the proxy passes through, so the served run
still fails; only the proxy's own refusal note is missing;
- a shared server constructor for the two e2e harnesses, which the review
marks optional.
Review attempt 2: four of its six minors and nits.
- gc-ready-ephemeral-assignee-unlimited and gc-ready-assigned-tier
compared two empty lists, so a client that sent the wrong assignee or
dropped --include-ephemeral passed both. Two seed rows assigned to the
worker, an open task (P2) and an open wisp (P1), give them
[e2e-wisp-wr e2e-wr] and [e2e-wisp-wr]. The priorities differ, so
--limit=1 cuts no tie. A client that rewrites the assignee, or drops
include_ephemeral, now fails both shapes; without the rows it passed
them.
- templatePattern looped forever on a profile path with an unclosed "{",
growing its pattern without bound. It now returns an error, which
loadReferenceProfile reports with the operation and path, and
TestCorpusFileIsWellFormed loads the profile, so corpus_test catches a
bad edit without the embedded engine.
- TestCorpusFileIsWellFormed compiles every expect_stderr and every
allowlist refusal, and runShape compiles expect_stderr once and fails
the shape as a corpus bug instead of panicking on a bad pattern.
- README.md documents the stdin, setup, ordered and ignore_fields
fields.
Not in this commit:
- the PR description (shape counts, allowlist reasons, gc-reclaim's
SRV-1 mark, the Bazel run line) is brought up to date when this commit
is pushed;
- hoisting runBD, minimalBDEnv, buildBD and the skip gate into
internal/testutil, or cross-reference comments in their three copies,
which the review marks optional and which reaches outside this
package.
The full corpus gives 127 shapes: 99 pass, 25 pending, 3 allowed, with
no shape changing status from the attempt 1 fixup, on this tree and
merged with main at 0a163ca285.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to #7383: the three non-blocking items its adoption review
filed (bd-m9pl8x, bd-zi2dko, bd-5qz7fa). Tests and release notes only.
- bd-m9pl8x: stripShowTips dropped every tip line and normalized trailing
newlines on both routes, so a stray trailing blank line printed only
under --comments-tail passed every route test. stripTrailingShowTip
removes exactly one trailing "\n💡 Tip: …\n" block and nothing else;
assertCommentsTailOff strips it only on the direct route (tips=true) and
compares the proxied route byte for byte. Table test added.
- bd-zi2dko: the bd show --watch start / first-render / SIGINT /
bounded-exit sequence now lives once, as startShowWatch +
(*showWatch).interrupt; TestProxiedServerShowWatch and runShowWatchOnce
both use it. Assertions unchanged.
- bd-5qz7fa: drop the blank line that made the CHANGELOG "### Added" list
loose; direct_json_untouched goes through bdShowRaw.
Mutant check: a go build -overlay mutant printing one extra newline after
printComments only when --comments-tail > 0 passes the test on main (5/5)
and fails exactly direct_off_state_matches_absence here; the control
binary passes 5/5.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(build): use native Darwin linker (wy-6fric6)
Keep pinned LLVM Clang and Linux toolchain inputs; pair Darwin SDKs with the native Apple linker to support macOS 27 TAPI targets.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Steve Yegge
* fix(build): canonicalize LLVM attributes (wy-6fric6)
Apply bazel mod tidy ordering; linker/compiler settings are unchanged.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Steve Yegge
* test(dbproxy/server): disable dolt event flush so send-metrics cannot race TempDir cleanup
Every dolt sql-server this suite stops cleanly forks a detached
`dolt send-metrics` child on exit. It outlives the test, rewrites
<HOME>/.dolt/eventsData (HOME is a t.TempDir()), and races t.TempDir's
RemoveAll: "TempDir RemoveAll cleanup: ... 001/.dolt: directory not empty".
main.yml's Test (macOS) job (plain go test) failed on this in about half
of the pushes since 2026-10-09; Bazel never did because
tools/bazel/test_env.sh exports DOLT_DISABLE_EVENT_FLUSH=1. TestMain now
exports it too, guarded by TestSuiteDisablesDoltEventFlush.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(scripts): skip Linux-CI-only rrc and worker-env-sync script tests off Linux
TestRRCRunLanes runs .github/scripts/rrc-run-lanes.sh, which uses bash 4's
`mapfile` (exit 127 under macOS /bin/bash 3.2). TestWorkerEnvSyncCopyAgainstFixture
runs tools/rbe/worker-env-sync-copy, whose GNU `sed -i -E` becomes
"-i with backup suffix -E" plus a basic regex under BSD sed, so the pin is
never rewritten. Both scripts run only on Linux runners (bazel.yml
rrc-seed/rrc-verify, worker-env-autosync.yml); per their owner they stay
Linux-only and the tests skip elsewhere with the reason.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The host-tool-exec policy scanner (scripts/host_tool_exec_policy_test.go)
had two remaining soundness gaps flagged in gastownhall/beads#7491's
review:
- M19: a discarded PrebuiltBD()/findPrebuiltBDBinary() error (e.g.
`bd, _ := PrebuiltBD()`) kept the "never empty under Bazel" invariant
trusted for `bd`, even though a real lookup failure under Bazel also
returns "" there. prebuiltResultVars now only trusts the result when
the error is bound to a named variable that is itself checked with an
aborting `if err != nil`.
- M21: an abort-style gate (`if bazeltest.IsBazel() { return }`) counted
as gating an exec that ran before it, in source order, within the same
block. The abort-style check now requires the gate to dominate the
exec (ifStmt.End() <= pos); containment-style gating is unaffected
since nesting already guarantees order.
Flips the two tests that pinned these as documented limitations into
mutation fixtures that must fail, adds three new M19 fixtures (discarded
error, bound-but-unchecked error, and the fixed/checked shape), and
updates the package and gated() doc comments. TestNoUngatedHostToolExecs
UnderBazel confirms no real call site in the tree regresses.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci-policy): close review leftovers from #7485/#7486
Follow-ups from maintainer review on the host-tool exec/shell policy
tests and the bazel.yml integration gate:
- host_tool_shell_policy_test.go: recognize indented function headers
and `function name {` forms when finding a function's closing brace,
so scripts/test.sh's indented cleanup_shared_server() no longer
mis-attributes its trailing lines to the wrong function; classify
same-line `command -v gofmt && gofmt` (and `go`) as the guarded
presence-check idiom instead of flagging it.
- host_tool_exec_policy_test.go: make condPolarity reject mixed-polarity
&& / || compounds (one recognized side, one not) instead of guessing
at the recognized side's polarity, which was unsound in both
directions; add pinning tests documenting the exec-before-gate and
function-value-helper cases as known, safety-conservative limitations
rather than bugs. Fixing this exposed a real ungated fallback in
cmd/bd/scripttest_test.go (a `go build` that could still run under
Bazel on a prebuilt-binary basename mismatch); fixed by symlinking the
prebuilt binary under the expected name instead of rebuilding it.
- bazel.yml: bazel-server-storage now honors the `integration` input
like bazel-integration/bazel-cmd-dolt do, so an explicit "off" skips
it too (latent today: no caller passes "off"). Updated
ci_workflow_test.go's policy tests to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci-policy): close should-fix B (go command -v guard evasion) on #7491
shellCommandVGuard previously excused go the same as gofmt, but under an
exit-127 host-tool stub `command -v` finds the stub and the guarded exec
still runs, and on a worker genuinely lacking go the exec was silently
skipped -- the worker-dependent behavior this policy exists to ban. Drop
go from the guard entirely, require the guarded exec to sit directly after
the guard's own `&&` (no intervening `;`, `||`, `|`, or leading `!`), and
require an exact gofmt match so a same-prefixed sibling like `gofmt-foo`/
`go-junit-report` can't borrow the guard. Add every should-fix B shape as
a fixture that must still be flagged, plus the generalized gofmt-side
cases (leading `!`, exact-name, post-`;` exec).
Also: correct host_tool_exec_policy_test.go's doc claim that a
function-value helper call site is "not a soundness hole" -- mixed with
one gated direct call site, the invisible function-value call site's
ungated-ness is silently lost and the combined verdict flips to gated;
pinned as review M22. And recognize a function closed by `} >&2` as
ended, so abort-style safety computed inside it does not leak into the
rest of the file (no scoped script has this shape today, but a bare `}`
equality check would silently miss it the moment one does).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(schema,uow): route the proxied data-behind open to the #6575 stop with topology-correct guidance (port of #6695)
Port of the release/1.3.x commit bb03a310a9 (PR #6695) to main, where it
never landed: v1.3.1 is cut from a release branch that is not an ancestor
of main.
The proxied / `bd serve` open path never reached the #6575 data-behind
stop. doltSQLProvider.initSchemaAttempt passed a nil adopter to
CheckSharedStoreMigrateGate, so localDataBehind short-circuited and the
router could never emit smartDataBehind. A proxied store that was level
on schema and behind in data reported `shared-store` instead, whose body
is the designated-migrator recipe -- `bd migrate --force` then
`bd dolt push` -- which in that state is exactly the #6368 wedge the
stop exists to prevent. The refusal was always safe (the shared arm
suppresses the auto-migrate either way); the guidance was not.
- uow: wire a dataBehindAdopter with AheadBehind only
(versioncontrolops.LocalAheadBehind). IsStrictAncestor/WorkingSetClean
stay nil so the remote-ahead arm keeps its plain adopt directive, and
FastForward stays nil because it would promote the schema for every
co-resident client. Read-only proxied opens print the pull-first block
instead of the shared-consent template.
- uow.WithProxiedServerMode(), set only by openProxiedServerUOWProvider,
marks the refusal Proxied: the same provider serves `bd serve` on a
SERVER-mode workspace, where `bd dolt pull` works.
- schema: a Proxied refusal names the server host as where the pull runs
(`bd dolt pull` is refused at the proxied front door,
proxy.dolt_pull.unsupported), the option id becomes
pull-first-on-server-host, and the guidance says the forced
`bd migrate schema --force` consent step IS runnable from the proxied
workspace (the capability registry permits `migrate schema`), so it must
wait for the pull, and that BD_ALLOW_REMOTE_MIGRATE=1 is reachable too.
- cmd/bd: the --json `expected` field carries the same location
qualifier (dataBehindExpectedField).
Not ported, because main already has it: the release PR's F-B half (the
shared data-behind consent step naming `bd migrate schema --force` and
its --global twin, the printGlobalDatabaseConsentHint retarget, and the
shared_migrate_consent_test.go changes) landed on main as #6692.
Adapted to main: the release line's proxyMaintenanceRefusals table is
main's capability registry, so TestProxyMaintenanceAllowsTheSharedConsentVerb
drives validateProxyRegistryBeforeProvider for every proxied topology and
also pins that `bd dolt pull` and the bare `bd migrate` are refused; the
CHANGELOG paragraph is appended to main's existing #6575 entry.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(upgrading): where the proxied data-behind pull runs; pin its plumbing
Review fixes for the proxied data-behind stop: the one major of review
attempt 1, the cheap minors, and the nit, plus the wording minor of
attempt 2.
- Clone behind the remote, the docs section the gate's payload links
to, prescribed `bd dolt pull` with no topology qualifier: the remedy a
proxied-server workspace refuses at its front door. Its intro now says
so, and a proxied-server step pair puts the pull (and any conflict
resolution) on the server host, from a workspace with direct database
access, then `bd migrate schema --force` in the proxied workspace. It
also warns that nothing there enforces that order: `--force` and
BD_ALLOW_REMOTE_MIGRATE=1 are honored before the stop is reached, so
the stop never sees them. The warning ends on the payload's own
instruction, not to reach for either to get past the stop, rather than
a negation ("neither is a way past it") that read as the topology
blocking the wedge. The pending-migration exception above the section,
the proxied-server list under Shared servers (now three differences)
and the init-safety ordering rule say the same. The heading, and with
it the anchor the gate links, is unchanged.
- The option plumbing that carries the fix is pinned link by link.
TestApplyProviderOptions covers WithProxiedServerMode (it sets that
field and no open posture). The cmd/bd append moves into
proxiedProviderOptions, which TestProxiedProviderOptions holds to
exactly one added option on a fresh slice. And
TestNewDoltServerUOWProvider_CarriesProxiedServerMode opens two real
providers on one server, with and without the option, and reads the
field the gate copies; openAndInitSchema's provider literal and the
shared test open helpers are left as they were.
- TestProxyMaintenanceAllowsTheSharedConsentVerb also pins `bd dolt
push` and `bd conflicts resolve` as refused, the rest of the list the
proxied refusal body recites. `dolt push` is refused as unimplemented,
the kind of row that flips to allowed once a route lands.
- localDataBehind's doc comment is re-wrapped so the IsStrictAncestor
sentence no longer breaks across the inserted parenthetical.
- The CHANGELOG entry notes the docs change.
Each new pin is red with its link reverted: the option dropped from the
cmd/bd append, the append made in place, the field copy deleted from
the provider literal, the constructor dropping its options, the option
also setting preview, and the push and conflicts codes changed. Still
unpinned: which option the cmd/bd append adds (options are opaque
outside uow) and that `bd serve`'s server-mode open passes none; both
need a seam in cmd/bd.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test: ban ungated host go/gofmt execs under Bazel; pin compact_gc_fixture pure/norace
Follow-up to #7478. Adds two policy tests on //scripts:go_sources_test:
- host_tool_exec_policy_test.go: an AST scan of every *_test.go file and
internal/testutil's non-test .go files for exec.Command/CommandContext/
LookPath("go"/"gofmt") that isn't gated by bazeltest.IsBazel()/TEST_SRCDIR
in its enclosing function, with an explicit, justified allowlist for the
handful of sites gated by caller dataflow instead (bazeltest.PrebuiltBD()
checked before calling a separate helper). "dolt" is out of scope: the
hermetic copy resolves first on Bazel's PATH, unlike go/gofmt.
- host_tool_shell_policy_test.go: the same policy for the shell scripts
under scripts/ that Bazel sh_test/go_test targets actually execute
(fmt-check.sh, the repochecks guards, gofmt-bin.sh, the migration-test
harness), matching the gating pattern #7478 added to fmt-check.sh and
scripts/ci/lib/test-env.sh.
Both are mutation-verified (an added ungated exec.Command("go","version")/
`go build` is detected, then reverted cleanly).
Also sets pure = "on" and race = "off" on cmd/bd/BUILD.bazel's
compact_gc_fixture go_binary, matching :bd_for_tests/:cmd_norace: it is a
testonly, stdlib-only fixture, so neither cgo nor the race detector buys it
anything, under any --config. Verified TestRunCompactDoltTargetsOnlyAuthorizedActiveDatabase
still passes via `bazel --nohome_rc test` under both --config=prcore and
--config=doltserver-cmd.
Known pre-existing issue, out of scope here: gosec's GoVersion() call still
execs a host `go` from third-party code this policy doesn't reach.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(scripts): address review of host-tool exec/shell policy (#7485)
Fixes all 6 maintainer-city-c3 review items against the ban-ungated-go/
gofmt-exec policy, each with a mutation test proving the fix catches
the described regression:
1. Shell scan now gates per-branch/per-call-site (shellLineGating),
not by any TEST_SRCDIR mention anywhere in the whole file.
2. Shell scanner adds gofmt and `go tool` detection, fixes the
heredoc-start regex (no longer swallows the rest of the script on an
arithmetic `<<` shift or a `<<<` here-string), and replaces the
blanket printf/echo/git-grep line skip with a quoted-span/command-
substitution-aware check that still catches a real exec joined onto
a message line with `&&`.
3. shellPolicyScope gains pr-lint.sh, check-versions.sh,
upgrade-smoke-test.sh and the 4 .github/scripts shard fallbacks,
each cited against its real BUILD.bazel/.bzl wiring; corrects two
factually wrong "not executed" doc-comment claims (pr-lint.sh and
upgrade-smoke-test.sh ARE Bazel-executed); and adds
TestShellPolicyScopeCoversBazelShellData, a mechanical backstop that
fails on a Bazel-referenced .sh under scripts/ or .github/scripts/
missing from scope.
4. hostToolExecAllowlist no longer exempts goBuildBDCommand's 9 call
sites by helper name; helperIsGatedByAllCallers checks every real
call site is itself gated.
5. Both allowlists are keyed by file + enclosing function + exact
snippet, not line number.
6. gated()/shellLineGating understand condition polarity, so an
inverted `if !IsBazel() { t.Skip() }` (or its shell equivalent) is
correctly NOT counted as a gate.
Also extends the Go scanner's condPolarity to recognize
findPrebuiltBDBinary()/bazeltest.PrebuiltBD() result variables as a
TEST_SRCDIR-equivalent gate (proven safe by reading their
implementation), and the shell scanner's analogous shellBazelSetVars
for CANDIDATE_BIN/SOURCE_TAG_SQLITE_BIN/BEADS_TEST_*_BINARY, including
through a script's own default-value variable alias
(`VAR="${BAZEL_VAR:-default}"`).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(scripts): give go_sources_test runfiles access to the new shell scope
The shell-policy rewrite (host_tool_shell_policy_test.go) added
shellPolicyScope entries for scripts/ci/pr-lint.sh,
scripts/check-versions.sh, scripts/upgrade-smoke-test.sh, and the four
.github/scripts/*-test-shard.sh files, plus a scope-coverage guard
(TestShellPolicyScopeCoversBazelShellData) that walks every tracked
BUILD.bazel file. None of those were runfiles of
//scripts:go_sources_test, so bazel test passed locally under plain
`go test` but failed in CI's hermetic Bazel sandbox with "no such file
or directory" for the new scope entries and "found only 0 BUILD.bazel
files" for the guard's walk.
Add //:repo_other_files (every tracked non-Go, non-Markdown file,
including every BUILD/.bzl file) to go_sources_test's data, mirroring
the same pattern already used by //scripts:scripts_test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(scripts): rename AST-fixture function so it isn't counted as a real test
tools/bazel/equivalence.py compares `go test`'s discovered top-level
tests against what Bazel actually ran, using a raw-text regex
(`^func\s+(Test\w*)\s*\(\s*\w+\s+\*testing\.T\s*\)`) rather than
compiling the file. The "inverted IsBazel skip" fixture in
host_tool_exec_policy_test.go embeds a column-0
`func TestSomething(t *testing.T) {` inside a backtick string used to
build an AST for findHostToolExecCalls, which the regex scan counted
as a real top-level test that Bazel's go_sources_test then "failed to
run" (CI's Bazel / test leg: EQUIVALENCE: FAIL on "scripts
TestSomething"). Rename the fixture's inner function to
bazelOnlyFixture; the test's behavior is unchanged since the name was
never semantically significant to the scan being exercised.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(scripts): close host-go-policy gaps from PR #7485 re-review
Four fixes from the final review round:
1. test.sh/conformance.sh/release.sh ARE in scope (they run under Bazel
via scripts/** data globs); drop the false "not in scope" claims and
add justified fn-keyed allowlist entries for their 8 flagged execs.
2. Go AST: an exec inside the Bazel-true branch, before its own abort,
is no longer wrongly counted as gated (M17); a gate inside a sibling
closure no longer covers execs outside it.
3. Shell scanner: abort/skip gate state now resets at function-scope end
(a top-level `go build` after build_candidate in
upgrade-smoke-test.sh is correctly flagged), and `bash -c 'go build'`
is detected again.
4. Split host_tool_shell_policy_test.go into its own go_test
(shell_host_tool_policy_test) with narrow, curated data instead of
riding go_sources_test's //:repo_other_files; restored
go_sources_test's data to its pre-PR scope. Dropped
TestShellPolicyScopeCoversBazelShellData: its regex backstop could
not see Starlark labels/.bzl/globs and still missed real in-scope
scripts, so it wasn't earning its cache-rerun cost. The new target
carries no tags, so it still runs in the required "Bazel / test"
lane.
Each of 1-3 ships with a mutation-proof fixture that fails on the prior
code and passes on the fix.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(scripts): rename sibling-closure fixture to avoid false test-equivalence hit
tools/bazel/equivalence.py line-scans *_test.go files for a column-0
`func Test\w*(t *testing.T)` to build its "what go test runs" list; it
reads raw text, not compiled Go, so the fixture's embedded raw-string
Go source (used to feed findHostToolExecCalls a parseable AST) was
mistaken for a real top-level test the package defines, and the
equivalence check failed because no go_test target "ran" it. Rename
the fixture function from TestX to siblingClosureFixture, matching the
existing convention a few lines down (bazelOnlyFixture) that documents
the same pitfall.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* feat(storage): add events/bd_events_journal/bd_events_seq to cursorRealityFloor sentinel set (port of #6547)
Port of the release/1.3.x commit aa3c43b6bd (PR #6547) to main, where it
never landed: v1.3.1 is cut from a release branch that is not an ancestor
of main.
events (ignored/0019) and bd_events_journal/bd_events_seq (ignored/0022)
are dolt_ignored, so they are never part of committed history and a fresh
clone can arrive with the ignored-plane cursor at-latest but without them.
cursorRealityFloor only knew about wisps/wisp_dependencies (floor 0) and
leases.granted_node (floor 11), so such a clone believed its cursor and
never re-created the missing tables.
A new sentinelFlooredTables list clamps the believable cursor to each
table's own replayFloor (18 for events, 21 for the journal pair) instead
of 0, so the replay re-runs the creating migration without re-running
ignored/0007's unguarded `UPDATE wisps SET is_blocked = 0`. Floored
tables are probed after the floor-0 tables and together with the column
sentinels, taking the minimum across everything found absent.
Tests: TestCursorRealityFloor and TestCurrentVersionClampsToSentinelFloor
gain the three single-absence cases, a two-floored-table case pinning the
intra-loop minimum, and a table+column case pinning the cross-loop
minimum; TestSentinelFlooredTablesAreCreatedByTheSeries asserts each
floored table is created strictly above its floor and that the floor
excludes ignored/0007. The sqlmock probe sequences in lock_test.go and
cursor_reality_test.go expect the extra INFORMATION_SCHEMA.TABLES probes.
The commit applied to main without conflicts; main's ignored series still
creates the three tables at 0019 and 0022.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(schema): pin cursorRealityFloor's floored-table probe error
cursorRealityFloor returns a floored-table probe error instead of
reading the table as absent or skipping it, but no test reached that
return. TestCursorProbeErrorIsNotTreatedAsContradicted fails every
table probe, so it returns at the floor-0 wisps probe first. Turning
the return into `continue`, or into "absent", left the whole schema
package green.
TestFlooredTableProbeErrorIsNotTreatedAsContradicted fails exactly one
floored table per subtest (events, bd_events_journal, bd_events_seq),
with every other sentinel table present. It asserts that the error
propagates, that the cursor is not reported as contradicted, and that
no column sentinel is probed afterwards. stubSentinelTables applies one
error to every probe, so the test stubs sentinelTableExists inline
rather than widening a helper the other tests share.
Mutated under a go test -overlay, each of `continue`, "absent", and
returning limited=true alongside the error fails only this test's
three subtests. The unmutated package passes 474 of 474 tests and
subtests, none skipped.
The test is additive and sits between two existing tests. It adds no
conflict hunk to #7213, #7297, or #7409, and #7050's duplicate port
commit still replays as empty on top of this PR, so a rebase drops it.
For that reason the review's suggested rewording of the floored-table
rationale comments is left for after #7050 lands. The comments stay
identical to release commit aa3c43b6bd.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci: F5 S2 Variant A nogo ownership for the integration configuration group
No full Bazel lane validates the integration / doltserver-integration /
doltserver-cmd configurations anymore (all three now pass
--norun_validations). Instead bazel-integration gains a narrow "Nogo:
integration library files" step that keeps full nogo (vet + golangci-lint)
on the configuration's one non-test library package,
//internal/testutil/integration, via
`bazel build --config=integration --@rules_go//go/config:race --keep_going
--output_groups=nogo_fix -- //internal/testutil/integration:integration`.
This accepts a scoped coverage loss (f5-spec.md §3/§5 S2, Variant A): the 56
integration-tagged _test.go files (listed in
tools/nogo/unvalidated_integration_tests.txt, derived from source by the new
T4 test) no longer get a vet pass in any lane, since golangci-lint already
skips all _test.go files repo-wide (.golangci.yml's run.tests: false) and no
lane builds those test binaries with validations on. Verified directly with
real `bazel build` runs: a planted vet finding in the library package still
fails the new step; the same finding in an integration-tagged _test.go file
no longer fails anything; a planted finding in a plain race-configuration
library still fails bazel-test; and GoCompilePkg action keys for the
integration configuration are identical with and without
--norun_validations (it is a build-request option, not a configuration
flag, so no farm cache invalidation).
scripts/nogo_lint_policy_test.go: the nogoConfigurations table gains a
"integ" row with an ownerIsNogoOnlyStep flag and a dedicated
checkNogoOnlyStepRow, generalizing T1/T2/T5/T6 to cover an owner that is a
narrow build step rather than a full lane; adds T4
(TestNogoIntegrationStepCoversItsConfiguration), which derives the step's
expected target set from source via go/build's own tag matching instead of
a hardcoded list.
Also fixes four should-fix items from julianknutsen's review of #7482:
1. expandBazelrcConfig now follows `common:` lines and --config= tokens
anywhere on a line, not just a first-position `build:`/`test:` one.
2. TestNogoRaceOwnerBuildsEverything now expands every config the owner job
can reach (including shell-variable-gated ones like sole-run), not just
the statically-named "ci".
3. The package-gate check now compares full key-flag fingerprints instead
of substring-matching --@rules_go//go/config:race / --norun_validations.
4. tools/bazel/nogo_ownership.py now fails loudly (exit 2) when both the
owner's and non-owners' action-key sets are empty, instead of reporting
a vacuous pass.
Each fix has new mutation-test coverage in TestNogoPolicyRejectsMutations
(should-fixes 1-3) or nogo_ownership_test.py (should-fix 4).
engdocs/LINTING.md and engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md updated to
remove the stale "integration still validates in all three lanes" claim and
document the Variant A trade-off.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): make T4's source scan work under Bazel, not just plain go test
scripts:scripts_test only declares //:repo_other_files as data (every
tracked file but Go and Markdown source, by design: a Go-only change
should not re-run the CI/workflow policy tests). TestNogoIntegrationStep
CoversItsConfiguration's source scan needs every non-test .go file, so
under `bazel test //scripts:scripts_test` its runfiles tree had none and
the scan always came back empty.
Fixes:
- scripts/BUILD.bazel: add //:repo_go_srcs to scripts_test's data, with a
comment explaining why (this is the one test in the target that needs it).
- integrationOnlyLibraryPackages: use bazelPolicyRoot(t) + repoFiles(t, ...)
(the existing Bazel-safe, runfiles-aware file listing other policy tests
in this package already use) instead of sourceRepoRoot(t) +
filepath.WalkDir, which only sees what //scripts's own go_test target
declares.
Verified with real `bazel test --config=integration --@rules_go//go/config:race`
and `--config=ci --@rules_go//go/config:race` runs of //scripts:scripts_test
(both pass); CI caught the original gap (PR #7486's first push failed
Bazel / integration and Bazel / test with exactly this).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): address independent review + bee-ghosttrack findings on F5 S2 Variant A
Independent review of #7486, must-fixes 1-7: pipefail on the nogo-only
step's tee pipeline; exact source-scan equality check for
tools/nogo/unvalidated_integration_tests.txt; expandBazelrcConfig
follows common:-lines and non-first-position --config= tokens in both
the Go policy test and nogo_ownership.py; mirrored
nogo_ownership.py should-fix guarding against a non-owner action-key
query silently matching nothing.
Cost fix: split T4/T6's whole-repo .go source scan into its own
go_test target (//scripts:nogo_integration_scan_test) so a Go-only
change no longer re-runs all of scripts_test; extracted the shared
bazelInvocations and ciWorkflow helpers into helper-only files so
both targets can depend on them without violating the
one-target-per-test-file partition rule.
bee-ghosttrack review: checkNogoOnlyStepRow's own fingerprint now
excludes test:-sourced .bazelrc lines pulled in via --config=X
(buildOrCommonLines), since the nogo-only step is a `bazel build`
invocation that never reads a test: line; added mutation s2i
reproducing the gap this closes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(nogo): pin integration nogo-only step's target, fingerprint its lane, add behavioral test
Addresses the remaining should-fixes from the independent review of #7486:
1. TestNogoIntegrationStepScriptFailsWithoutMaskingBazelsExitCode
(scripts/nogo_integration_step_script_test.go) extracts the real
"Nogo: integration library files" step script from bazel.yml and runs it
under plain `bash -e` (GitHub's actual run: semantics, no pipefail added)
against a stub bazel, closing the gap a text-only pin can't: it catches
rc=0 before `exit "$rc"`, `|| :`/`|| true` on the tee pipeline, or a
missing/negated `set -o pipefail`, regardless of how the mutation is
spelled.
2. The nogo-only step's target set is now pinned by exact go_library
label, not just package: nogo_integration_scan_test.go derives the
label(s) from source + BUILD.bazel and nogo_lint_policy_test.go pins
them literally (its own go_test target has no //:repo_go_srcs). Both
reject a `-//` exclusion pattern outright.
3. checkNonOwnerCommandLineAddsNoKeyFlag is now also applied to the
integ row's owner's own full lane: under Variant A that lane validates
nothing, so it is effectively a non-owner for this check's purpose, and
must not override a key-affecting flag on its command line either.
4. Latent items: TestNoUnconditionalValidationOff now also scans
.github/actions/setup-bazel/write-bazelrc.sh for run_validations (every
line it emits lacks a :config suffix, so any occurrence would turn
validation off everywhere with no owner lane to catch it).
tools/bazel/nogo_ownership.py's docstring is corrected: it had said S2
was simply "out of scope," which is now stale since S2 has its own
validating lane (the nogo-only step, checked statically); the script's
dynamic aquery-based cross-check remains S1-only because S2's owner has
no non-owner test lane building the same configuration to compare
actions against.
Skipped (not cheap / not reachable):
- bazel-server-storage's `if:` not modeling an "integration" input: no such
input exists to model; the gate is RBE-enabled-only by design, and
resolving this requires understanding pr.yml's broader gating semantics,
not a textual fix.
- defaults.run.shell parsing: bazel.yml has no `defaults:` block today
(confirmed by grep), so there is nothing to parse; the gap is latent only
for a future change, not a live bug.
- race-off scan's future-wrong-fix edge case: the review itself
characterizes this as not reachable with today's file set.
New mutation cases s2j/s2k/s2l in TestNogoPolicyRejectsMutations cover
items 2 and 3. All mutation-verifications performed by hand-editing the
real files, confirming FAIL, and reverting via Edit (never git
stash/checkout).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* test(nogo): reject F5 S1 ownership mutations the policy tests missed
Follow-up to #7479's independent review.
- nogoKeyFlags parses whole tokens instead of a prefix regex, so
--@rules_go//go/config:race=false on a non-owner no longer fingerprints
as the owner's race build (1f).
- The owner's run_validations check expands every --config its bazel
commands select (including BAZEL_SOLE_RUN/BAZEL_FRESH) recursively, so
e.g. `test:sole-run --config=doltserver` is caught (1e).
- T3 scans every argument of the owner's `bazel test`, including
backslash-continued lines, for negative target patterns (1g).
- T1 pairs each non-owner job with the --config its own bazel command
selects instead of by list index (2).
- TestNogoPolicyRejectsMutations feeds T1/T3/T5/T6 each mutation 1a-1g
and 2 and requires a rejection.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): nogo_ownership.py compares nogo actions by action key
Owner and non-owner nogo coverage was compared by target label, which
treats one label compiled in two configurations as covered. Compare
RunNogo and ValidateNogo actions by Bazel action key instead. Non-owner
universes drop manual-tagged tests (bazel test //... never builds them)
and add //cmd/bd:bd_for_tests, the package gates' target. The
fingerprint mirrors nogoKeyFlags' whole-token parsing.
nogo_ownership_test.py covers this with a fake bazel.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): correct nogo lane-sharing and one-required-lane claims
- CI_REQUIRED_CHECK_TOPOLOGY.md: only the nogoConfigurations rows
(race, pure, js/wasm) validate in exactly one required lane; the
integration configuration still validates in its three required lanes
until F5 S2.
- .bazelrc: --norun_validations lanes share compile, link and nogo
actions with `test`, not test PASS results (each lane's test actions
have their own env and args). Comment only.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): remove host-go dep from compact GC test; drop frozen shard blocks
Replace the ungated `go build` in compact_gc_target_test.go's dolt-stand-in
fixture with a Bazel-built go_binary (cmd/bd:compact_gc_fixture) wired via
rlocationpath env + data, mirroring the existing preflight_go_fixture
pattern. Falls back to `go build` only when not running under Bazel
(bazeltest.IsBazel()). Also gate test_repo_beads_guard_test.go's `go env
GOCACHE`/`GOMODCACHE` probes on !bazeltest.IsBazel(), since they previously
ran unconditionally in every cmd/bd TestMain.
Separately, delete the legacy 20-shard embedded-cmd and 15-shard
proxied-cmd "frozen" manifest blocks in .github/scripts/*-test-shards.txt:
their only consumers were pr-risk.yml fork/push jobs that have since
migrated to bazel.yml. Update gen_embedded_cmd_shard_manifest.py and
gen_proxied_shard_manifest.py to drop the frozen-block rendering/guard
logic and default to the live Bazel-only shard counts (100 and 34),
and refresh stale comments/docs (cmd/bd/BUILD.bazel,
scripts/shard_manifest_test.go, engdocs/TESTING.md,
engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md) that still described the deleted
blocks. Verified no other BUILD/.github/scripts references read them.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/38069936930
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* fix(bazel): gate remaining host-go calls; fix shard-manifest --weights footgun
Address PR #7478 review findings (bee-ghosttrack):
- scripts/ci/lib/test-env.sh: skip the GOCACHE/GOMODCACHE `go env` probes
when TEST_SRCDIR is set, so scripts/test.sh's beads_test_env_enter never
shells out to a bare `go` when reached from a Bazel-run go_test (e.g.
//scripts:shell_scripts_test's TestTestScriptPrebuiltTestBinaryContract),
where a farm masks host go/dolt to exit 127. Nothing on that path needs a
cache directory.
- scripts/ci/fmt-check.sh: describe_gofmt() no longer calls a PATH `go`
under Bazel. It now resolves BEADS_TEST_GO (the hermetic SDK go already
wired into scripts/prlintmake:prlintmake_test's env) via TEST_SRCDIR, and
skips the version-reporting arm entirely when that isn't set (e.g.
scripts/repochecks:fmt_test), rather than ever touching a possibly-masked
PATH `go`.
- Verified with a PATH stub (go/dolt scripts that log and exit 127) via
`bazel --nohome_rc test --config=prcore //scripts/... //cmd/bd:bd_test
--test_env=PATH=<stubdir>:/usr/bin:/bin:/usr/local/bin`: 26/26 targets
pass, zero stub invocations logged.
- gen_proxied_shard_manifest.py / gen_embedded_cmd_shard_manifest.py:
default --weights to duration now that the manifests' only remaining
blocks are duration-packed (the legacy inits-packed blocks were deleted
alongside the PR Risk fork/push jobs that read them). Previously the bare
`--write` default (inits) silently clobbered the live block's duration
header and repacked with the wrong cost model; --check couldn't see it.
Added TestProxiedShardManifestBareWriteIsIdempotent and
TestEmbeddedCmdShardManifestBareWriteIsIdempotent to pin a bare --write
as a no-op against the committed files.
- cmd/bd/compact_gc_target_test.go: resolve the non-Bazel fallback fixture
path from this file's own directory (runtime.Caller) instead of the test
binary's working directory.
- Refresh stale comments in .github/workflows/bazel.yml,
scripts/shard_manifest_test.go, scripts/pr_risk_bazel_coverage_test.go,
and scripts/embedded_shard_count_test.go that still described the deleted
legacy 20/15-shard blocks and their retired fork/push jobs in the present
tense.
- Confirmed cmd/bd/BUILD.bazel's compact_gc_fixture go_binary (implicit
pure/race defaults) still passes TestRunCompactDoltTargetsOnlyAuthorizedActiveDatabase
under `bazel test //cmd/bd:bd_test`.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* feat(http): serve list/show counts/dep tree/ping, close+reopen under a session, one-lookup not-found (S6b/S6c/S6d)
S6c. The external-dependency decorator rebuilt its role views from the
legacy DoltStorage seam (storereader over itself, IsBlocked,
GetDependencyTree, ClaimReadyIssue), which a remote store only partly
serves: `bd list`/`bd children` refused on the SearchIssuesWithCounts stub,
`bd show --json` printed zero counts, the default `bd dep tree` refused,
`bd ready --claim` and `bd close` of an externally blocked issue reached
unsupported paths. For a storage.RemoteBackendStore each view now passes the
inner role through and lays the policy over it in role terms
(externaldeps/remote_roles.go): ready reads and the ready claim exclude the
workspace-wide blocked set over a widened window; per-issue checks (claim,
close, batch close, list annotations, tree leaves) read only the named
issues' edges through EdgeReader instead of every edge in the workspace. A
server advertising policy.external_dependencies (MC's does) gets a plain
passthrough. `bd ping` uses a new storage.Pinger, which the http store
answers with its authenticated context read.
S6d. A store reporting storage.CallerAttributionLimitedStore (http) cannot
carry a Provenance label or a patch's closed_by_session. The library still
refuses both; the CLI omits them where nothing is lost: `bd reopen`'s fixed
"bd: reopen <id>" label (the server labels the same entry), and the
closed_by_session of `bd update -s closed` (attribution only, usually the
ambient CLAUDE_SESSION_ID; an explicit --session prints a notice; `bd close`
still records it). See cmd/bd/remote_backend.go.
S6b. utils.ExactIDLookupStore: the resolver stops at exact lookups for a
store with no substring search, so a missing prefixed id is a not-found
(beadserrors.ErrNotFound, "no issue found matching") after one getIssue.
The general resolver no longer repeats an identical normalized probe. The
http SearchIssueIDs answers D11's partial-id refusal, which now unwraps to
ErrNotFound. Contributor auto-routing for a remote workspace reads local
config only, so the not-found fallback pays no settings round trip.
`bd update <absent> --claim` (gc's hook claim) answers a gc-classifiable
not-found in at most two requests.
Served e2e (backend/http/e2e_remote_roles_test.go): every gc list shape and
`bd children` against embedded, `show --json` count parity, default dep
tree parity, external blocking still enforced, close/reopen under
CLAUDE_SESSION_ID, missing-id request counts, absent-id claim against the
current server and the MC handshake mask, policy passthrough under the MC
mask, ping.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(externaldeps): role-level remote reader and claimer cases
bd ready and bd update --claim reach the policy through the legacy seam and
the lifecycle guard, so the remote Reader.Ready exclusion and the remote
Claimer guard (what bd serve and library callers reach) are pinned at the
role level with a fake remote store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(http): bd serve advertises policy.external_dependencies; clients pass through
bd serve composes every ready, claim, claim-next, close, blocking and tree
role through the external-dependency policy, but never said so. Every
client therefore ran the policy a second time, with the CLIENT machine's
external-project config, and claim-next became a non-atomic read-then-claim
loop on the client.
The server now advertises the token exactly when the roles it serves were
composed through the policy: httpapi.Config.ExternalDependencyPolicy, which
bd serve derives from its actual chain (externaldeps.Applied for the store
arm, externaldeps.AppliedToProvider for the provider arm). A server handed
raw roles still withholds it, so the token stays truthful.
Against a server that advertises it, every remote role view hands the
request to the server's own role untouched: no client validation, no edge
reads, claim-next is the server's one atomic call, and the ready count is
the server's countReadyWork (new remoteReadyCounter). The client-side
policy remains only for servers that do not advertise the token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(create): default created_by to the request's actor in the create role
created_by was stamped in two front doors and never in the library: the
CLI (creationActorStamp, with a remote-workspace special case) and the
three httpapi create handlers. A library caller of Lifecycle.Create or
BatchCreator with an empty CreatedBy stored "" locally and the actor over
http.
PreparePublicCreateRequest, which every create shape prepares through
(Lifecycle.Create, BatchCreator items, batch-apply create items), now
defaults an empty CreatedBy to request.Actor; an explicit value is kept.
The handlers no longer stamp, `bd create` and the state event create pass
only the actor, and creationActorStamp/isRemoteBackendWorkspace are gone.
The CLI sites that still create through the raw CreateIssue seam (swarm,
todo, gate, the create form) keep stamping currentActor(): that seam is
shared with import, where defaulting would re-attribute imported rows, and
the http store refuses it anyway, so the remote special case was never
reachable there.
Conformance: the lifecycle-create, batch-creator and batch-apply contracts
now pin created_by == actor for an item that names none, on every leg.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): GetIssue answers a miss with storage.ErrNotFound, like the local stores
The http store's raw GetIssue answered a missing id with (nil, nil), where
DoltStore and the embedded store return a wrapped storage.ErrNotFound. A
caller written against the backend contract read the http miss as a hit:
`bd create --graph` refused every explicit-id plan over http (patched in
cmd/bd on feat/http-mc-corpus; that workaround is reverted there).
GetIssue now returns the miss (and the empty id) as storage.ErrNotFound,
spelled as issueops.GetIssueInTx spells it. GetLabels, which reads through
GetIssue, keeps the local read's "no labels" answer for a missing id; the
`bd list --parent` walk reads the typed miss as "parent issue not found".
The served bridge test now holds the local reference store and the http
store to the same miss: ErrNotFound with the same text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(createbatchequiv): re-record the apply golden for the created_by default
c2866ea7fe made the create role default an empty CreatedBy to the
request's actor, so every create item of the apply scenario's batch
(actor "apply-writer") now stores created_by "apply-writer" instead of "".
TestCreateBatchFastPathsMatchPerRow_*/apply compared the stored rows to a
digest recorded before that change and failed on exactly the three tables
the column reaches: issues and wisps (the row) and events (the update
event's old-value snapshot). Fast and per-row bodies still agree; the
batch-apply conformance contract pins the same value.
Bisected with bazel: passes at be92efe40f's integ twin 696f7acc8e, fails
from the created_by commit on. Only apply.json's three digests move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: gofmt ledger.go and the externaldeps remote-roles test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cmd/bd): bd create reads routing settings local-only on a remote backend too
determineAutoRoutedRepoPath skipped a remote backend's settings document
(routing targets are local paths that one shared document cannot name for
every client), but getRoutingConfigValue, which `bd create` and
migrate-personal read routing.* and contributor.* through, still asked it.
The same workspace could route a create one way and a lookup another, and
every create paid a settings round trip per key.
Both now go through routingSettingsStore: nil for a remote backend, so
routing comes from config.yaml / the environment only there, and a local
store is still consulted. A unit test holds both reads to the rule with a
store that counts settings reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cmd/bd): say so when update -s closed drops an ambient CLAUDE_SESSION_ID
Over http `bd update -s closed` cannot carry closed_by_session, so the CLI
drops it rather than refusing the close. An explicit --session printed a
notice; the ambient CLAUDE_SESSION_ID every agent under Claude Code exports
was dropped without a word, a silent data difference from a local backend
(the served corpus's mc-update-meta-status-closed). The drop is now named
on stderr in both cases, once per command, pointing at `bd close`, whose
wire operation records the session. The served e2e asserts the notice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http): hold bd list --limit 2 to each side's own unlimited order
TestE2E_ListWithGCFiltersMatchesEmbedded compared the --limit 2 rows of
the served and embedded workspaces as sets. The seed has four P2 rows, so
the limit cuts a priority tie whose created_at order differs between two
workspaces seeded seconds apart: a test-only flake, the order itself being
total. Each side's two rows must now be, in order, the first two of that
same side's --limit 0 listing; the unlimited listings are still compared
across sides by the shape loop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: unit-tier pins for the created_by default, the policy token and the GetIssue miss
Three review mutations were caught only by a heavier tier (the uow
conformance legs, the served httpclient tier) or by one package's test
alone. Each now has a unit test where its rule lives:
- issueops: PreparePublicCreateRequest defaults an empty CreatedBy to the
actor and keeps an explicit one, without mutating the caller's request.
- externaldeps: the policy layer AppliedToProvider finds becomes the
handshake's policy.external_dependencies through httpapi.Listen, the
composition bd serve performs, and a raw provider's handshake lacks it.
- httpclient (no embedded engine): GetIssue over the real wire client
against a stub server answers a 404 not_found, and the empty id without
dialing, as storage.ErrNotFound spelled like the local stores.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): S6b/c/d entries match the code
The S6 entry still said `bd create` suppresses created_by on a remote
workspace and that the external-dependency policy runs client-side. Since
S6b/c/d, created_by defaults to the actor in the library on every backend,
and every bd serve composed through the policy advertises
policy.external_dependencies, so clients pass those operations through;
the client-side policy (now in role terms) runs only against a server that
does not advertise it.
New entries: the advertised policy token, bd ping over http, the created_by
library default, closed_by_session dropped by an http `bd update -s closed`
(with a notice, typed or ambient), reopen without a Provenance label over
http, local-only routing.* / contributor.* on a remote backend, GetIssue's
miss as storage.ErrNotFound, and list/children/show counts/dep tree over
http.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(externaldeps): keep S6's list --ready, --claim-next refusal and lost-race error on the S6c composition
The re-adopted S6 head (#7288) carries the review fixup's remote role
composition; S6c replaces it with its own (rolesAreRemote, the widened
ready window, the policy passthrough). Two behaviours S6 shipped and its
reviews pinned would otherwise go:
- bd close --claim-next against a server that does not apply the policy
is refused whole, before anything is read or closed, with "the served
batch close cannot carry a next claim, so nothing was closed; close
without --claim-next, then run `bd ready --claim`". S6c passed the batch
to the http closer, whose W-CloseBatchRequest.ClaimNext refusal drops the
remedy, so TestE2E_BDOverHTTP's two refuseClaimNext steps went red. A
request invalid on every backend is still ErrValidation first, and a
server that applies the policy still gets the request untouched.
- remoteReadyClaimer.ClaimNext reports a page on which every candidate was
lost to another actor as "claim ready: lost N races ...", not as the
empty answer that means there is no work.
- `bd list --ready` (List with ReadyFlag) is answered by the policy
store's own reader over the served ready reads, as S6 does. S6c passed
it to the served listing, which cannot carry ReadyFlag (httpclient
ledger row E-ListRequest.ReadyFlag), so it exited 1 over http with or
without external refs; TestE2E_BDOverHTTP and
TestServedRolesKeepTheExternalDependencyPolicy were red on it.
TestRemoteReaderAnswersAReadyListingWithoutTheWireFlag pins it, with the
fake's served List refusing ReadyFlag as the wire does.
S6's composition tests now run against S6c as remote_roles_composition_test.go.
Their fake serves Ready the way a server does (the S6 composition read
ready work through the legacy policy reader instead), and two call logs
gain that Ready. TestRemoteBatchCloserRefusesANextClaim,
TestRemoteBatchCloserValidatesANextClaimFirst and
TestRemoteReadyClaimerReportsLostRaces were red on S6c before this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(externaldeps): unassigned claim-next and fail-closed close reads
Review fixes for the S6c composition against a server that does not
advertise policy.external_dependencies: the two majors of review
attempt 1, plus the minors on the same code.
- ReadyClaimer: the composed claim-next reads only open, unassigned
ready rows (Unassigned=true, Assignee cleared), the candidates the
local ClaimReadyIssueInTx selects. A row another actor holds, or one
already assigned to the caller, is no longer taken or counted as a
lost race. Each pass reads 25 candidates past the blocked rows, as
httpclient's composed claim does, and a full window lost end to end
is read once more: claimed rows leave the unassigned set. Only a
claim that tried candidates and won none is an error.
- BatchCloser: an externally blocked item travels to the server only
when its status read finds it closed or not found (liveRefusal). Any
other read error is that item's outcome, so a transient or auth
failure no longer forwards a refused close to a server that will not
refuse it.
- TreeWalker: a failed capability probe renders the external leaves
over the walked tree instead of failing a walk the server already
answered. appendTreeExternalReferences skips an id the tree holds,
so an enforcing server's own leaves are not doubled.
- remoteEdges names each anchor once and skips an empty one, which the
http EdgeReader refuses with ErrValidation.
The composition fakes now honor Unassigned/Assignee as
workapi.BuildReadyFilter does, model a rival claim landing first and a
failing GetIssue, and refuse an empty edge anchor as httpclient does.
New: TestRemoteReadyClaimerTakesOnlyUnassignedWork,
TestRemoteReadyClaimerWalksAContendedFront,
TestRemoteBatchCloserAnswersAFailedReadWithIt,
TestRemoteEdgesNamesEachAnchorOnce, and the probe-failure cases of
TestRemoteTreeWalkerAddsExternalLeaves. Each is red with its fix
reverted.
From review attempt 2, three nearby cleanups:
- TestServedRolesKeepTheExternalDependencyPolicy seeds open rows held
by another actor and by the claimant ahead of the free work, then
claims with and without an assignee filter. The unassigned-only claim
is now pinned over a real served server, not only through the fakes:
red with the pre-fixup remote_roles.go, with filter.Unassigned
dropped, and (the filtered claim) with an explicit assignee honored.
- The capabilities description in openapi.v0.yaml (and the regenerated
types.gen.go comment) no longer calls the whole list build-level:
policy.external_dependencies depends on how the server composed its
roles, as the paragraph above it says.
- createbatchequiv's golden note names
issueops.PreparePublicCreateRequest instead of a commit id that is
not on this branch.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http): count a not_found read as reaching the remote in #7469's credential doors
main's #7469 added TestExplicitCredentialIgnoresTheEnvPlaintextGrant. Its
OpenWith and Open doors read bd-1 from plaintextRemote, which answers
every issue read not_found, and the granted leg needs that read to return
a nil error. That held while the http client answered a miss with
(nil, nil). This branch's "fix(httpclient): GetIssue answers a miss with
storage.ErrNotFound, like the local stores" makes the same read return
storage.ErrNotFound. So on main plus this branch both doors fail at
per_open_credential_test.go:392 ("with Target.AllowInsecureCredential:
not found: issue bd-1") under plain go test. The merge is textually
clean, so only a build of the merge shows it.
The two store doors now count storage.ErrNotFound as success, since that
answer came off the wire. The assertions are unchanged. The refused leg
still needs the "refusing to send a credential" error and no request on
the transport. The granted leg still needs exactly one request carrying
"Bearer explicit-token": a granted read that never reaches the wire still
fails at :408.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bazel): one nogo-validating lane per race configuration (F5 S1)
The race configuration (--@rules_go//go/config:race) is built by five
lanes that duplicate the same RunNogo/ValidateNogo work: bazel-test
(--config=ci), bazel-embedded, bazel-doltserver, bazel-proxied, and
the advisory bazel-dolt-race shadow, plus the package-mcp/package-npm
gates' explicit race build. --norun_validations is a build-request
option, not a configuration flag (proven here by aquery: GoCompilePkg/
GoLink/RunNogo/ValidateNogo action keys are byte-identical with and
without it), so passing it on every lane but bazel-test removes the
duplicate work without touching a single action key or dropping any
lint coverage: bazel-test's --config=ci already validates every file
any of the others compiles.
scripts/nogo_lint_policy_test.go replaces the old blanket
"--norun_validations never appears in .bazelrc" check with
TestNogoConfigurationsHaveOneValidatingLane (T1: one owner per
configuration fingerprint), TestNogoOwnersAreRequired (T2: the owner
is a required CI Gate check whose `if:` covers every non-owner's),
TestNogoRaceOwnerBuildsEverything (T3: the owner builds //... whole,
no exclusions) and TestNoUnconditionalValidationOff (T5: nothing else
may disable validation). tools/bazel/nogo_ownership.py (make
nogo-ownership) is a dynamic, advisory aquery cross-check of the same
property, run on demand rather than from inside a Bazel action.
Verified locally: aquery shows identical action keys for the affected
lanes with/without --norun_validations; a planted printf-format vet
finding in internal/idgen/hash.go failed the owner build and passed
the non-owner build (then reverted, never committed);
scripts/bazel_dolt_race_shadow_test.go and the full //scripts suite
stay green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): close S1 nogo-ownership review gaps (allowlist, owner pin, real aquery)
Addresses maintainer-city-c3's review of #7479:
1. T6 TestRunValidationsOnlyOnAllowlistedLines replaces the coverage gap
left when main's blanket run_validations ban was dropped: only the four
race-group non-owners' "test:<cfg> --norun_validations" lines in
.bazelrc, and the two package-gate bazel-build steps in bazel.yml, are
permitted. A later test:integration/doltserver-cmd --norun_validations
(out of T1's table, S2) now fails here instead of landing silently.
Verified by mutation: adding test:integration --norun_validations fails
the new test; reverting passes.
3. TestNogoRaceOwnerBuildsEverything (T3) now also pins that the race
owner's "bazel test //... --config=ci" step has no step-level if: or
continue-on-error, and that its job has none either. Verified by
mutation: adding if: ${{ always() }} to that step fails; reverting
passes.
2. tools/bazel/nogo_ownership.py's aquery comparison was querying the
identical mnemonic("RunNogo", //...) for the owner and every non-owner,
so `missing` could never be non-empty. It now derives each non-owner's
actual built target set the way --build_tests_only + --test_tag_filters
does: the deps closure of tests(//...) filtered to targets carrying one
of the lane's tags, read exactly from `query --output=xml` (not attr()'s
substring regex match, which would wrongly fold "dolt-server-proxied"
and "dolt-server-cmd" into a "dolt-server" filter). Confirmed against a
real (offline, --nohome_rc) bazel run: reports OK at head, and reports
100+ missing targets when the owner's query is artificially narrowed to
a subpackage -- it can now actually fail.
Also: refreshed a stale .bazelrc comment claiming nogo runs beside every
lane's compile, which S1 made untrue for race-group non-owners.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): mode cache reads the remote repo contents cache through rbe-cache
Mode cache (fork and Dependabot PRs while rbe-fork is closed, rbe=cache
dispatches) now reads Bazel's remote repo contents cache: the trees rrc-seed
writes on main pushes, served by rbe-cache's anonymous GetActionResult and
ByteStream.Read (Caddy :8443 -> nativelink-anon -> AC_OSS, read only).
setup-bazel's write-bazelrc.sh adds the trusted readers' two lines to its
fork-cache rc (passed with --bazelrc, so the startup line applies):
startup --experimental_remote_repo_contents_cache
common --loading_phase_threads=64
The committed .bazelrc stays untouched (design R2): the flag is a startup
option and cannot live in build:fork-cache, and developer and macOS
machines never read.
Gated on the new .github/actions/setup-bazel/cache-rrc-probe.sh (a copy of
gascity's tools/rbe/cache-rrc-probe.sh): one GetCapabilities to rbe-cache
(connect 3s, total 5s). Only an answer (gRPC 0, cache_capabilities present)
writes the lines; anything else writes none and logs a ::notice:: with the
reason, and the script never fails on it. Kill switch: fork_rrc_read=on in
that script; set it to off in a one-line PR to stop mode cache reading.
Measured (scratch origin/main, no credentials, 8 CPUs, cold output base,
`build --nobuild //...`): repository rules 665-672 -> 38-41 (the rest are
bd_releases/dolt_release and local or toolchain repos, not reproducible),
analysis 26.5-26.7s -> 12.1-14.8s, wall about 36s -> 25-32s.
Tests: TestSetupBazelRCWriter runs the writer against a stand-in rbe-cache
(answers, answers with zstd, PERMISSION_DENIED, refused): exactly the
reader's lines after --config=fork-cache and any zstd line only when it
answers, a notice otherwise; remote-exec and rbe-fork never get them nor
probe. TestBazelCacheModeReachesTheRC checks no simulated mode carries them
with the probe refused. TestCacheRRCProbe runs the real probe (errors,
malformed, timeout, refused, untrusted cert, kill switch off without a
request).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): mode cache rrc review fixes: reader opt-in, containment, AC probe
Scope. write-bazelrc.sh enabled the remote repo contents cache for every
mode cache job, bazel-release-cross included, whose configs
rrc-lane-commands.txt does not seed. setup-bazel now takes BAZEL_RRC_READ
("true" or empty, anything else fails): only with it does mode cache probe
rbe-cache and add the reader's lines. The 8 trusted reader jobs pass it,
and nothing else. TestBazelRRCOptInMirrorsTheTrustedReaders pins that set
to bazelRRCReadLanes; TestBazelRRCLaneCommandsCoverEveryReader now checks
every job that enables the flag either way (reader step or opt-in) is a
reading lane whose bazel configs are all seeded. TestSetupBazelRCWriter
covers a job without the opt-in (no probe, no lines) and bad values.
Runner. The 5 readers that run in mode cache (test, pure, integration,
doltserver, cmd-dolt) fall back to ubuntu-24.04 instead of ubuntu-latest:
one runs-on line each; mode remote stays Blacksmith, and the remote-only
readers and every other job are unchanged.
Visibility. write-bazelrc.sh writes one step-summary line in mode cache:
whether the job reads, and why (the probe's reason, with rbe-cache's
GetCapabilities TCP connect time, DNS excluded).
Probe. cache-rrc-probe.sh is re-copied from gascity: it also asks
GetActionResult for a fixed key no action has and a ByteStream Read of
that digest as a blob, and passes only if both answer NOT_FOUND (gRPC 5),
proving Caddy, nativelink-anon, the action cache and the CAS answer; it
reports the TCP connect time minus the DNS lookup. serveCapabilities
answers both; TestCacheRRCProbe adds their failure answers.
Containment and limits. The rrc-verify issue body and
CI_REQUIRED_CHECK_TOPOLOGY.md no longer say to set RBE_REPO_CONTENTS_CACHE
off (mode cache never sees it, and off also stops rrc-verify): commit
fork_rrc_read=off in both probe scripts (beads has no fresh-merge, so an
open fork PR keeps its old switch until it is pushed again); for immediate
server-side containment, rbe-cache-gate close on core; and, because the
mode remote readers read the same oss action cache entries, set the
variable to seed on a mismatch (no lane reads, rrc-seed and
rrc-verify keep running), off only to stop seeding too, and leave it as
it is when the run only could not check. The doc also says a
closed or down cache only falls back at probe time (after loading, files
are fetched lazily and losing rbe-cache fails the command, bazel#30218),
and notes the 512 MiB anonymous CAS limit under gascity's R4.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): bazel-dolt-race opts in to the rrc read like the other trusted readers
#7464 added bazel-dolt-race as a trusted reader after this branch was cut, so
TestBazelRRCOptInMirrorsTheTrustedReaders now covers it: pass BAZEL_RRC_READ
(it runs only in mode remote, so this changes nothing today). It never runs in
mode cache, so it keeps the lanes' ubuntu-latest fallback: the cache-reader
runner rule (ubuntu-24.04) excludes it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cmd/bd): guarded close/update/assign that lose to a delete at pre-flight report precondition_failed
A --if-revision close, update or assign racing a `bd delete` can observe
the winning delete at two points: inside its guarded write (classified
precondition_failed / exit 13 via classifyIfRevisionFailure's
storage.ErrNotFound branch) or at its pre-flight resolution
(resolveAndGetIssueForMutation on the direct route, the advisory pre-read
on the proxied update/assign routes), which returned an unclassified
"no issue found matching" exit 1. Which one a loser hits depends only on
whether the delete commits before or after it resolves the id, so
TestSharedServerDeleteIfRevisionSingleWinner/delete_vs_close and
delete_vs_update flaked under load. mc-zndi7.81 (#7256) closed the same
gap for delete's own pre-flight only.
reportIfRevisionTargetGone now maps a pre-flight not-found under an active
--if-revision guard to the guard envelope on every verb and route (delete
refactored onto it); unguarded commands keep their not-found exit 1.
Fixes ga-vnycm2.10.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): name the proxied target-gone test into the proxied lane's TestProxiedServer* prefix
TestProxiedIfRevisionTargetGoneIsPreconditionFailed skips unless
BEADS_TEST_PROXIED_SERVER=1, which only the proxied lane sets, and that
lane selects TestProxiedServer*/TestServerMode* by name: as named it ran in
no CI lane (ga-vnycm2.43). Renamed and placed in the 34-shard manifest block.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cmd/bd): classify pre-flight-gone reopen and cascade-delete targets
Review fixes for #7465, review-loop iteration 1.
The PR makes a guarded write whose pre-flight resolution finds the row
already deleted report precondition_failed (exit 13) on close, update and
assign, and documents that rule for every guarded verb. Two guarded paths
still turned the lost delete race into an unclassified exit 1:
- `bd reopen --if-revision`, on both routes. The direct loop's
resolveAndGetIssueForMutation failure and the proxied
reopenProxiedResolve pre-read now go through reportIfRevisionTargetGone,
as the other verbs do. The proxied caller returns the already-reported
exit error unchanged (isReportedExit), so the outcome prints once.
- `bd delete --cascade --if-revision` on the direct route. deleteBatch
built its missing-id error with fmt.Errorf("issues not found: ..."),
which carries no sentinel, so the caller's reportIfRevisionFailure could
not classify it. It now returns issueops.NotFoundError, the error the
delete role's own existence probe returns (delete_role.go). The text is
identical, and the error unwraps to storage.ErrNotFound. This reuses the
existing typed error instead of adding a guarded-only wrap.
ifRevisionFlagHelp's comment and reportIfRevisionTargetGone's doc now name
all five guarded verbs and the cascade path.
Tests:
- Rename TestIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb to
TestEmbeddedIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb. The
embedded lane only discovers `func TestEmbedded*`
(.github/scripts/embedded-test-shard.sh), so under the old name it
skipped in every CI lane. It is added to embedded-cmd-test-shards.txt
(100 65), and the manifest generator's --check passes at 100.
- The embedded table and its proxied twin,
TestProxiedServerIfRevisionTargetGoneIsPreconditionFailed, gain reopen,
delete and delete_cascade rows. The embedded table also gains an
unguarded cascade-delete row that pins the unchanged "issues not found:
<id>" text at exit 1. The deterministic cascade case lives in this
CI-run table rather than in TestIfRevisionCascadeDelete, which the
embedded lane does not discover; that test's doc points here.
- The proxied table now asserts that no raw "not found" text leaks past
the guard envelope. A new unguarded_assign_still_not_found subtest pins
the proxied assign pre-read's unguarded wording and exit 1.
Each code fix was mutation-checked. Reverting reopen.go,
reopen_proxied_server.go or delete.go to the PR head fails exactly one
row of its table (embedded reopen, proxied reopen and embedded
delete_cascade respectively), and every other row still passes. The fixed
build passes both full tables locally, the proxied one against a local
dolt 2.2.0 sql-server. A manual --json smoke of the direct reopen and
cascade-delete paths exits 13 with the standard precondition_failed body,
expected_revision included.
PR body corrections for finalize (description only, no code):
- The rule now covers five verbs (delete, close, update, assign, reopen)
plus delete --cascade, not four.
- The embedded test is now
TestEmbeddedIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb.
- The proxied test is
TestProxiedServerIfRevisionTargetGoneIsPreconditionFailed (renamed in
009b9b629b), and it runs in //cmd/bd:bd_proxied_test shard 7 of 34. The
coverage-gap note's "(the new test included)" no longer applies to it.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#7374 re-vendored gascity's signed-duration fix for exec-log spawns, but
build_tests() still kept the sign of BEP testResult timings. rbe-west
scheduler/worker clock skew makes a remotely executed test report
queueTime -1 ms (-24 ms at worst), and the collector rejected the whole
artifact on tests[].results[].queue_ms: about 19% of beads artifacts,
holding 52% of beads' CI worker time.
Byte copy of gascity 2ddde0d94be15d95086cc2bcb169303ea1243456: clamp
duration_ms and every timingBreakdown child with _clamp_duration_ms.
Updates the two sha256 pins; testdata/ci_analytics is unchanged.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(backend/http): per-open credential is the only credential (S6f)
One process may open several beads HTTP projects, on one server or many,
each with its own credential (gc G7: per-city/per-rig credentials). The
ambient ladder is keyed by host[:port] and read from process-global env,
so two projects behind one host would share a token.
- bdhttp.Options gains Credential (CredentialProvider). Open, Handshake
and Connect with it set go through the new httpclient.DialWithCredential
/ HandshakeWithCredential: no bearer ladder (BEADS_HTTP_TOKEN,
BEADS_HTTP_TOKEN_COMMAND, credentials file), CA pinned to Target.CAFile
(never BEADS_HTTP_CA_FILE), and the plaintext grant only from
Target/DialOptions (never BEADS_HTTP_ALLOW_INSECURE).
- httpclient.OpenWith takes the same explicit path for a
ProvidedCredential in backends.OpenOptions.
- Register panics on a non-nil Options.Credential: its dialer is
process-wide.
- All package env reads go through one getenv seam so a test can prove
the explicit door reads none. No process-wide credential cache exists;
the provider lives on the store's own wire client.
- Package doc gains a "Credentials: one per open, never one per host"
section.
Tests: two stores on one host (direct door and registry OpenWith) each
send their own token; explicit credential overrides poisoned ambient
token/command/credentials file; explicit open and handshake survive a
broken ambient env; Handshake with a Credential; getenv spy sees no reads
on the explicit door; Register refuses a credential.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): S6f review fixups for the explicit door's plaintext refusal
Apply the two minor findings and two nits from the review of #7469:
- The explicit-credential door (DialWithCredential: OpenWith with a
ProvidedCredential, and backend/http's Open and Handshake with
Options.Credential) never reads BEADS_HTTP_ALLOW_INSECURE, but its
plaintext refusal still said to set it. That refusal now names
Target.AllowInsecureCredential (what `bd connect --allow-plaintext`
records) and says an explicit credential takes no plaintext grant from
the environment. The ambient ladder's refusal is unchanged.
- Pin that property at each production door. Every explicit-door test
dialed loopback, where the guard returns before it reads the variable,
so a door reverted to the env-consulting DialWith left them all green.
TestExplicitCredentialIgnoresTheEnvPlaintextGrant drives OpenWith, Open
and Handshake against a plain-http, non-loopback stand-in with
BEADS_HTTP_ALLOW_INSECURE=1: each refuses before the wire and names the
grant it honors, each sends its token once with
Target.AllowInsecureCredential, and an ambient control shows the same
environment does grant the built-in ladder. Reverting any one door to
DialWith now fails that door's subtest, and the guard unit test checks
the refusal text.
- Narrow the "reads no environment" docs to what holds: getenv is the
reader for the variables that choose or grant a credential, and the
explicit door reads none of them. The proxy variables, and on !unix with
a CA file BEADS_ALLOW_INSECURE_CA_FILE_PERMISSIONS, are still read on
every door; neither chooses a credential or grants plaintext.
- TestExplicitCredentialReadsNoEnvironment checked GetMetadata's error,
which is nil on a failed handshake; it now checks the project id.
Behaviour change against main: OpenWith with a ProvidedCredential to a
plain-http, non-loopback server is refused even with
BEADS_HTTP_ALLOW_INSECURE=1, which main honored there. Grant it per
target with Target.AllowInsecureCredential (`bd connect --allow-plaintext`
records it in the workspace sidecar).
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci(bazel): run every BEADS_TEST_PROXIED_SERVER-gated cmd/bd test in the proxied lane
proxied-test-shard.sh selects the proxied lane's tests by name prefix
(TestProxiedServer*/TestServerMode*), and BEADS_TEST_PROXIED_SERVER=1 is set
only by //cmd/bd:bd_proxied_test. Seven cmd/bd tests skip without that
variable but are named outside the prefix, so they ran in no CI lane:
TestProxiedDeleteIfRevisionSingleWinner
TestProxiedIfRevision{CloseMismatchRefuses,CloseReplaysMoleculeAutoClose,
CloseWarnsOnForcedOpenChildren,DeleteMatchAndMismatch,
OutranksReassignFence}
TestHistoryRemoteSupportedDirectAndProxiedParity
Rename them into the TestProxiedServer* prefix (the repo's existing
convention, see if_revision_proxied_integration_test.go) and place them
incrementally in the 34-shard manifest block. The prefix stays the
selection rather than widening to TestProxied*, which would pull ~33
ungated unit tests into the lane as duplicates.
Running them exposed real rot: the history parity test had been broken
since #7436 scoped shared-server projects to a per-database user, because
its `bd dolt remote remove` needs DOLT_REMOTE. It now uses
newSharedProxiedRootProject, like the other remote-removing tests #7436
moved.
Guard: TestProxiedGatedTestsRunInTheProxiedLane (//scripts:
go_test_sources_test) walks cmd/bd's test call graph for any top-level test
that reaches an `os.Getenv("BEADS_TEST_PROXIED_SERVER") != "1"` gate and
fails unless proxied-test-shard.sh lists it in some shard;
TestProxiedGatedTestsDetector pins the walk against a fixture.
Fixes ga-vnycm2.43.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(scripts): indent the gated-test detector's fixture so equivalence.py does not count it
tools/bazel/equivalence.py finds a package's tests with a line-anchored
^func TestX(t *testing.T) scan, so the fixture's TestDirect..TestUngated
read as scripts tests Bazel never ran (EQUIVALENCE: FAIL on Bazel / test).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The example modules replace github.com/steveyegge/beads with ../.. but
their go.mod files had drifted behind the root module, pinning
vulnerable grpc v1.83.0 and thrift v0.23.0. Bump both past their
advisories and re-tidy, which also aligns the remaining indirect
requirements with the versions the root module already selects.
Resolves Dependabot alerts #144, #145, #147, #148, #152, #153, #154, #155.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): add advisory dolt-race shadow lane (item 5 phase 1)
Add --config=dolt-race, the union of --config=doltserver and
--config=doltserver-proxied with one tag filter for both tiers, and an
advisory bazel-dolt-race job that runs it beside bazel-doltserver and
bazel-proxied. The shadow measures one client per group of lanes against
the two lanes it would replace before any cutover (item 5 slice A1a).
The job runs in mode remote on pull_request and merge_group events only.
It has job-level continue-on-error, no job or workflow_call output, and no
gate names it, so it cannot change CI Gate or PR Risk Gate. Its
ci-analytics step is copied verbatim with LANE=dolt-race, and rrc seeds
the new config.
Policy tests pin the config as the exact union of its members' lines (tag
filter aside), the job's run modes and events, its advisory shape, the
analytics lane map and the rrc command list. aquery shows every member
target's TestRunner action (actionKey, argv, env, inputs, outputs) is
unchanged under the union config.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): give the dolt-race shadow timeout headroom; fix gate-wait wording
Review follow-up on the advisory bazel-dolt-race job (maintainer-city-c3,
findings 1, 2 and 5):
- Raise the job's timeout-minutes from 30 to 35. continue-on-error covers
a failed or timed-out step, but not a job GitHub cancels at its own
timeout, which could make the bazel call non-success and turn CI Gate
red. TestBazelDoltRaceShadowIsAdvisory now reads both timeouts from the
workflow and requires job >= test step + 10 (and a step timeout at all).
- Correct the docs and comments: the shadow cannot fail the gate, but
CI Gate still waits for it, because its needs on the bazel call
completes only when every job in it has finished.
- Correct the checks comment: check_testcases covers every target in the
union, including the dolt-server tier its own lane never checked.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): bound every dolt-race shadow step; job timeout covers their sum
Review follow-up (S1): a hang in any bazel-dolt-race step without a
timeout would run into the job's own timeout, and a job GitHub cancels
there is not covered by continue-on-error. Every step now has a
timeout-minutes, and the job's timeout covers their sum:
- checkout 5, rrc read 1, setup-bazel 10, flaky query 5, checks 3 each,
test-log upload 3. The test step (25) and the analytics steps (3, 2)
keep bazel-proxied's values; bazel-proxied sets no timeout on the
others, so these bound them.
- The step timeouts sum to 60 minutes, so the job timeout goes from 35 to
65.
- TestBazelDoltRaceShadowIsAdvisory now requires a timeout on every step
and job >= sum(step timeouts) + 5, read from the workflow, alongside the
existing job >= test step + 10.
Also cite the farm maintainer's confirmation of NativeLink 1.7.1's
in-flight Execute dedupe in the job comment.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): keep dolt-race shadow timeout under the merge queue's
Tighten the shadow's non-test step budgets so the job timeout (step sum
+ 5) is 55 minutes, and pin that it stays below the 60-minute merge
queue check timeout: CI Gate waits for the shadow, so a hung shadow
must not drop a group from the queue.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(backend/http): add the public HTTP backend door, cmd/bd registration, and bd connect
internal/httpclient (S1-S5) had no production caller for the per-open
backends.OpenOptions.Credential seam and no way for a workspace to actually
select it. This slice (S6) closes both gaps in OSS's own idiom, without
carrying over anything from bd-enterprise's gateway/box-login/storage-profile
machinery:
- backend/http (bdhttp) is the public, out-of-tree extension door: Register
adds "http" to the backend registry and installs its transport, Open/
Handshake dial a server directly with no workspace on disk, and the
registered OpenWith hook threads a per-call credential through
beads.OpenBestAvailableWith for a multi-tenant embedder.
- internal/httpclient/open_with.go is the backends.Backend.OpenWith hook
itself: a fresh dial per open (opts.Credential/HTTPClient/UserAgent),
distinct from the process-wide registered dialer Open/OpenReadOnly use.
- cmd/bd/http_backend.go registers the backend for the OSS binary, so a
workspace whose metadata.json names "http" opens through the ordinary
OpenBestAvailable path; any other unregistered backend name still refuses.
- cmd/bd/connect.go adds the minimal `bd connect <url>` command: a handshake
that must succeed before anything is written, a per-user activation
sidecar (.beads/http_target.json, never git-tracked), a plaintext-to-
non-loopback refusal without --allow-plaintext, and a backend-switch
refusal without --force. No credential is ever accepted on the command
line or written to disk.
- cmd/bd/doctor/gitignore.go requires the new http_target.json /
http_local_metadata.json sidecars be git-ignored, the same way the
proxied-server client info already is.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(storage): keep external-dependency blocking over http unless the server enforces it
bd ready / bd close / claim hard-failed against the new http backend with
"GetAllDependencyRecords not supported by the http backend": cmd/bd's
storage chain wraps every opened store in the externaldeps policy
decorator, which needs either the narrow ExternalDependencyQueryStore
interface or the broad GetAllDependencyRecords fallback to resolve
blocking state, and the http client implemented neither.
The decorator now stays on for a remote store. It is skipped only when the
server's handshake advertises policy.external_dependencies (the server
enforces the policy before answering). Without that capability the client
resolves blocking itself from the listing and chunked dependency reads, so
an issue with an unresolvable external: dependency stays out of bd ready
exactly as it does on a local backend; it is never silently skipped
(DESIGN 3.6). Server-side enforcement is slice S10.
storage.RemoteBackendStore marks a DoltStorage that is a pure network
client of a remote bd serve; the http backend's Store satisfies it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cmd/bd): suppress the CreatedBy stamp on create against a remote backend
bd create failed against the http backend with "Issue.CreatedBy: ... is not
expressible on the v0 wire": the http client's create role deliberately
refuses any POPULATED CreatedBy/CreatedAt (the creation stamp belongs to the
server's own journal entry, not a value the caller supplies), but
cmd/bd/create.go unconditionally stamped getActorWithGit() onto every
created issue regardless of backend. The refusal only fires on a non-zero
field, so suppressing the stamp for a registered remote backend is wire-
compatible by construction, not a workaround.
Add isRemoteBackendWorkspace()/creationActorStamp() to backend_support.go,
reusing the existing resolveCommandBeadsDir(dbPath) +
backendNameForErrorFraming(beadsDir) + backends.IsRemote(name) pattern
already used elsewhere in that file, and use creationActorStamp() at both
create.go call sites (the dry-run preview and the real create).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(backend/http): add an embedder linkage test over public packages only
Prove the one promise S6 makes to an out-of-tree embedder (gc is the
motivating case): importing nothing but github.com/steveyegge/beads,
.../backend, and .../backend/http is enough to register the http backend,
open a workspace through it with a per-call credential
(beads.OpenBestAvailableWith), and read through the role-accessor surface
(IssueReader().Ready) against a stand-in server — with no internal/...
import in the test file, which is itself the thing under test.
Written fresh for OSS beads S6; no bd-enterprise source copied.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs: document the HTTP backend, bd connect, and the public backend/http door
Add a README section with bd connect usage, the credential ladder, and the
plaintext/force refusals, plus a CHANGELOG entry for the new cmd/bd
registration, bd connect command, and the public backend/http package.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): address bee-ghosttrack review on #7288 (connect --clear restore, persisted --allow-plaintext)
Closes the CHANGES_REQUESTED items on the HTTP backend door PR:
- Must-fix: `bd connect --force` over a workspace with its own local
(dolt) identity now has writes succeed instead of tripping "workspace
identity mismatch detected" — validateWorkspaceIdentity (cmd/bd/main.go)
and the sidecar (internal/httpclient/metadata.go) now compare against
the http backend's own pinned project id. New e2e regression test
TestE2E_ForceConnectWritesSucceedDespiteDifferingLocalProjectID
(backend/http/e2e_cli_test.go), confirmed to fail without the fix.
- Should-fix 1: `bd connect --clear` now restores metadata.json's
backend selection to whatever it was before this workspace connected,
instead of leaving it pinned to "http" with no sidecar to dial.
Target.PreviousBackend (internal/httpclient/target.go) is recorded by
Attach (backend/http/attach.go) and round-tripped through the sidecar;
connect.go reads it back on --clear. New tests in
backend/http/attach_test.go and internal/httpclient/target_test.go.
- Should-fix 2: `bd connect --allow-plaintext` is now remembered in the
sidecar (Target.AllowInsecureCredential), scoped to the target it was
granted for, so every later ordinary command's dial honors the grant
without also needing BEADS_HTTP_ALLOW_INSECURE=1 set
(internal/httpclient/dial.go). Fixed BearerProvider.warnInsecure's
wording (internal/httpclient/credential.go), which used to assert a
token was being sent immediately above a refusal saying the opposite.
New test TestDialWithWiresTargetAllowInsecureCredentialThroughToTheGuard.
- Should-fix 3: README no longer claims HTTP mode works "exactly as
with a local database" — it lists what round-trips and points at the
divergence ledger (engdocs/design/http-divergence-ledger.md) for what
differs.
- Verified, no code change needed: Attach already handles an existing
metadata.json project_id coherently (only cfg.Backend is touched); bd
show's isNotFoundErr already matches a http 404 (issueops.ErrNotFound
is storage.ErrNotFound, the same sentinel a local miss uses), so it
reads as "not found" rather than an unsupported-operation error.
- Doc fix: guardInsecureCredential's doc comment and refusal message
were stale against should-fix 2's own change — they named only
DialOptions.AllowInsecureCredential and the env var as ways to get
past the guard, not the newly-persisted target.AllowInsecureCredential
or `bd connect --allow-plaintext` itself.
Gates run clean on this branch: go build/vet, go test over
internal/httpclient, backend/http (including the full e2e suite under
BEADS_TEST_EMBEDDED_DOLT=1) and cmd/bd, make api-check, make
ci-pr-lint, make bazel-sync-check, bazel run //:gazelle -- -mode=diff,
and internal/storage's TestEveryLegWiresEveryRoleContract.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(backend/http): give the e2e server the BatchGetter role #7248 added to the required set
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix: exact http ready totals, connect capability row, doc corrections
Ready totals over http (review major). externaldeps drops externally
blocked rows client-side for a store that cannot express ExcludeIDs
(today httpclient.Store). dropBlockedIssuesWithCounts compacted the
fetched rows in place (`kept := rows[:0]`), and
readyWorkWithCountsAndTotal then re-scanned `rows` to count the blocked
rows it had dropped. By then the compaction had overwritten them, so
whenever a blocked row came back ahead of a kept one the re-scan
undercounted the drops: `bd ready --json`'s total and text-mode `bd
ready`'s count (CountReadyWork) overstated ready work against any server
that does not advertise policy.external_dependencies. Both drop helpers
now copy into a fresh slice, and dropBlockedIssuesWithCounts reports how
many rows it dropped, so nothing re-scans `rows`.
fakeStore gains an excludeIDsUnsupported switch that, like
httpclient.Store, refuses any ExcludeIDs. The new
TestReadyTotalsWhenStoreCannotExpressExcludeIDs puts the blocked issue
first and checks the page and total for an unlimited filter, a Limit
whose bumped window holds the whole set, and one the set outgrows, then
CountReadyWork. TestServedReadyExcludesUnsatisfiedExternalDependencyWithoutServerCapability
now also checks the total and count against a real in-process bd serve.
Against the previous decorator the unit test's unlimited case reports
total and count 3 beside a 2-row page, and the served test 2 beside a
1-row page.
Review minors, all wording:
- `bd connect --clear` pointed at `bd config set backend dolt`, which
writes the database's config table rather than metadata.json and, in
the state that prints the advice (metadata.json says http, sidecar
gone), fails the pre-open identity check. It now says to reconnect, or
to set "backend" in metadata.json.
- CHANGELOG described the superseded skip-at-wrap design; it now
describes the always-wrap decorator with its capability probe and
client-side drop.
- RemoteBackendStore's docs no longer name a consumer; nothing in-tree
checks it.
- creationActorStamp's comment pointed at backend/http/lifecycle.go; the
refusal lives in internal/httpclient/lifecycle.go.
Capability row. TestProxyCapabilityRegistryCoversCommandTree fails at
60b7128204: the command tree walk finds `connect`, which this PR adds,
with no row in cmd/bd/capability_registry.go ("1 command(s) have no
proxied-server capability row: connect"). The test predates the PR
(#6582 is an ancestor of its base) and passes at the base dabf20ef07.
connect opts out of store init (skipStoreAnnotation) and never reaches
the store factory, so it belongs in proxyPermittedPaths beside init and
setup. The row is runtime-neutral: validateProxyRegistryBeforeProvider
returns nil both for a permitted row and for a path with no row, so
this only records the policy decision the coverage test asks for.
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(httpclient): regenerate the divergence ledger doc after the S5 rebase
The rebase onto feat/http-client-batch-apply's rebased head (S3/S4 merged to
main) left the ledger doc's summary line at a conflict-resolution placeholder
count. Regenerate it from internal/httpclient/encode.Ledger() so
TestDivergenceLedgerDocMatchesLedger passes against the merged ledger.go.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(backend/http): host-scope S6's test BEADS_HTTP_TOKEN values
Rebasing onto feat/http-client-batch-apply's rebased head pulled in main's
#7247 review-fix round, which made BEADS_HTTP_TOKEN/BEADS_HTTP_TOKEN_COMMAND
host-scoped (host[:port]=value, scopedEnvValue/parseScopedEnv in
internal/httpclient/credential.go) after S6's own tests were written against
the unscoped form. Five S6 tests across backend/http/open_test.go,
backend/http/register_test.go and
internal/httpclient/insecure_credential_guard_test.go set a bare token and
now hit the new ladder's "an unscoped token would be used for whatever
server..." refusal. Scope each to the test server's actual host
(127.0.0.1 for the httptest.Server-backed recording servers,
nonLoopbackTestHost for the insecure-credential-guard integration tests)
so they exercise the same ladder rung as before.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): resync go_srcs/repo_files for the new backend/http and test/embedder packages
make bazel-sync-check failed after the rebase: tools/bazel/go_srcs.py's
managed repo_files filegroups for backend/http and test/embedder (new in
this slice) hadn't been generated, and the root BUILD.bazel / tools/bazel's
release_cross_build target list hadn't picked up the new package either.
Regenerate with `python3 tools/bazel/go_srcs.py`; `bazel run //:gazelle --
-mode=diff` reports no further drift.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cmd/bd): route swarm's create paths through creationActorStamp after main's currentActor change
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix: police http's served roles, refuse close --claim-next, exact totals
External-dependency policy over http (review blocker). cmd/bd wraps
every store, http included, in the externaldeps decorator, and its role
accessors rebuilt each role over legacy methods httpclient.Store refuses
(SearchIssuesWithCounts, GetDependencyTree, ClaimReadyIssue, IsBlocked,
GetDependencyRecordsForIssues, BatchCloserWithPolicy). Over http `bd
list`, `bd dep tree`, `bd ready --claim` and a policed `bd close`
therefore exited 1, even in a workspace with no external dependency.
Over a store that reports storage.RemoteBackendStore, each accessor now
starts from the inner store's served role and layers the policy around
it (remote_roles.go):
- IssueReader serves List and Get from the served reader; Ready and a
ready-flagged List go through the policy reader.
- IssueClaimer refuses an externally blocked claim before the served
one.
- ReadyClaimer uses the served claim-next while no issue, closed ones
included, holds an unsatisfied external ref. Otherwise it claims down
the policy's filtered ready page through the served Claimer, because
claimNext cannot exclude ids.
- BlockingAnnotator and TreeWalker merge external blockers into, or add
external leaves to, the served answer. They read only the named
issues' edges through the served EdgeReader, 100 anchors per call.
- BatchCloser refuses externally blocked open items and sends the rest
to the served closer as one request. --force keeps the base path, and
a next claim is refused whole (below).
RemoteBackendStore now only chooses this composition. Whether the policy
runs is still ServerEnforcesExternalDependencyPolicy's answer (design
3.6), and the storage and httpclient docs say so. remote_roles_test.go
drives each role over a store that refuses the legacy methods.
TestServedRolesKeepTheExternalDependencyPolicy runs every role over a
real http server. TestE2E_BDOverHTTP adds `bd list` (JSON, text and
--deps), `bd dep tree`, `bd ready`, `bd list --ready`, `bd ready
--claim`, a refused `bd close --claim-next`, and a refused then forced
close of an externally blocked issue. At the fixup before the
composition, the role tests then written (bar one pin of the next-claim
refusal, since replaced) and the e2e's list, dep tree, claim and close
steps of that round were red.
Close with a next claim over http (review major). batchCloseIssues has
no member for a next claim, so httpclient refuses any ClaimNext before
the dial (ledger W-CloseBatchRequest.ClaimNext). Over http `bd close
--claim-next` therefore always exited 1 and closed nothing. With an
external ref anywhere in the workspace (a closed holder or --force
included) the decorator's base path failed first, with an opaque
`BatchCloserWithPolicy` unsupported. remoteBatchCloser now refuses a
next claim whole, before it reads or closes anything, and the error
says nothing closed: close without --claim-next, then run `bd ready
--claim`. A request that is invalid on every backend is still
ErrValidation first, and a server that enforces the policy itself gets
the request unchanged.
Composing close-then-claim was not taken. The role closes and claims in
one transaction and answers with an error or with outcomes, never both,
so a claim that failed after the closes committed could not report
them; httpclient refuses the same request for that reason. A CLI-level
close then claim that can report a partial result is the follow-up.
The review also suggested leaving closed holders out of the blocking
state. They stay in, as on every backend: a closed issue is never a
claim candidate, so they change no claim, and leaving them out would
cost a status read per holder because the wire has no batch read.
TestRemoteBatchCloserRefusesANextClaim covers an open holder, a closed
one, none, --force, and a server that enforces the policy; with the
previous remote_roles.go the first four are red.
TestRemoteBatchCloserValidatesANextClaimFirst keeps ErrValidation ahead
of the refusal. Dropping the filter check, or loading the blocking
state before refusing, is each caught. TestE2E_BDOverHTTP runs `bd
close --claim-next` while the holder is open and again after it is
closed; with the previous remote_roles.go both steps are red and print
`operation "BatchCloserWithPolicy" not supported`. Ledger F-close no
longer says --claim-next is served, and no longer names a
renderEscapedHTTPRefusal that does not exist. L14 says the decorator's
claim leg applies while any issue, closed or not, holds an unsatisfied
ref. The README and CHANGELOG mention the refusal, and the decorator's
IsBlocked, IsBlockedBatch and CloseIssueChecked say they refuse over a
store that serves its roles.
Ready totals with external blockers (review majors, both rounds).
CountReadyWork asks for Limit=0, and readyWorkWithCountsAndTotal took
any Limit<=0 to mean "the window held the whole ready set". Over http a
zero limit never reaches the wire: the server answers with its default
page (workapi.DefaultReadyLimit, 100 rows) while the bridge reports the
full total, so past 100 ready issues text-mode `bd ready` kept counting
externally blocked issues beyond the first page. Exactness is now judged
from the rows that came back (total <= len(rows)). A window that holds
only part of the set no longer subtracts every externally blocked id in
the workspace either: that set includes closed issues and ones the
filter excludes, none of them in the total, so the count came out low.
It refetches the filtered ready set, ids only, and subtracts the blocked
rows in it; the old bound is left as the fallback for a refetch that
comes back truncated too.
fakeStore gains the bridge's shape: a defaultPage for a zero Limit,
with GetReadyWorkWithCountsAndTotal still totalling the whole set.
TestReadyTotalsWhenAnUnlimitedFetchComesBackAsOnePage (a blocked issue
past the first page) and
TestReadyTotalsIgnoreExternallyBlockedIssuesOutsideTheReadySet (a
blocked issue outside the ready set) have served counterparts,
TestServedReadyCountExcludesAnExternallyBlockedIssuePastTheDefaultPage
and TestServedReadyTotalIgnoresAnExternallyBlockedIssueOutsideTheFilter
(an assignee filter). The first pair is red on the Limit<=0
condition, the second on the subtract-every-blocked-id branch.
Docs: ledger L8 now says which decorator paths take the chunked
GetAllDependencyRecords scan and which read only named edges, and L14
records the decorator's composed claim leg; http-divergence-ledger.md
is regenerated. The README names the verified commands, and the README
and CHANGELOG say how cross-repo dependencies behave over http.
Minors from the reviews:
- Drop creationActorStamp/isRemoteBackendWorkspace and restore the base
stamps at all 11 sites. The arm guarded a refusal the http create
role does not make: since #7247 (actorStampedCreateMember) it accepts
a CreatedBy naming the actor. Because the arm keyed on the CWD
workspace, a create routed from an http workspace into a local one
(--repo) stored an empty created_by. TestE2E_BDOverHTTP checks
created_by for a direct and a routed create; the routed check is red
with the arm restored. The CHANGELOG sentence describing the arm goes
with it.
- bdhttp.Attach decides a reconnect from the raw metadata.json backend.
GetBackend() reads an unregistered "http" as the dolt default, so in
an embedder that never called Register a reconnect recorded dolt as
the backend --clear restores. The reconnect test now seeds postgres
(TestAttachOnAReconnectKeepsTheEarlierPreviousBackend) and is red
with the old check.
- README, CHANGELOG and `bd connect --help` document the host-scoped
BEADS_HTTP_TOKEN=host[:port]=<token> form (and _COMMAND), and say why
a bare value is refused.
- bdhttp.Attach also gitignores http_local_metadata.json, the per-user
file the store writes on first use, so an embedder activating through
Attach alone gets the coverage `bd connect` already had.
TestAttachGitignoresBothPerUserFiles pins it.
- ServerSnapshot.WireRevision's doc names the handshake's actual check
instead of a comparison `bd connect` never makes.
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>
* test(backend/http): give the e2e server the LeaseReclaimer role #7412 added to the required set
main's #7412 made LeaseReclaimer part of httpapi's required role set and
updated main's own binders, but backend/http's e2eServeConfig predates it,
so every TestE2E_* that binds the in-process server failed with
"httpapi: no database source". Same shape as e63f7da36a for BatchGetter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(externaldeps): lead the --claim-next refusal with the wire fact; pin the L14 leg and connect --clear
Review i4 minors/nits on the stranded fixup, carried as a separate commit:
- remoteBatchCloser's --claim-next refusal now says the served batch close
cannot carry a next claim (the real cause), rather than blaming
externally blocked work a workspace may not have. The test asserts the
reason, that nothing closed, and the remedy.
- GetDependencyTree's doc says a served store refuses its reads and that
bd dep tree goes through remoteTreeWalker.
- README no longer gives `bd ready --claim` local semantics everywhere; it
names when ledger row L14's two-step claim applies.
- TestE2E_BDOverHTTP claims once more after the external-ref holder is
closed, pinning L14's composed leg (a mutant whose composed leg claims
nothing turns only that step red).
- New TestE2E_ConnectClearRestoresThePreviousBackend: --clear restores
the prior dolt backend with its identity intact, removes the sidecar,
and a second --clear changes nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http): run the served e2e under bazel
//backend/http:http_test declared no bd binary, so under bazel the e2e
files (bazeltest.PrebuiltBD) failed on BEADS_TEST_BD_BINARY with
BEADS_HTTP_TEST_REQUIRED=1 and only "passed" by skipping otherwise. It now
takes //cmd/bd:bd_for_tests (visibility added), size large / timeout long:
the served cases run 4-5 minutes on the farm under BEADS_TEST_EMBEDDED_DOLT=1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(backend/http): run the e2e tier in the embedded lane as http_served_test
The previous commit gives //backend/http:http_test the bd binary, but no
lane sets BEADS_TEST_EMBEDDED_DOLT for it, so its TestE2E_* cases still
skipped in CI. http_served_test runs the same test binary through
//tools/bazel:go_test_variant.sh with BEADS_TEST_EMBEDDED_DOLT=1 and
BEADS_HTTP_TEST_REQUIRED=1 (a skip fails it). It is tagged embedded, so
the --config=embedded lane runs it and prcore/ci keep their current
shape, the same split as //internal/httpclient:httpclient_served_test.
Under plain --config=embedded all 8 TestE2E_* cases run, none skipped.
TestBazelRetiredLanesCannotBeNarrowed pins every embedded-lane target's
args and env; the new target is added to that pin list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(externaldeps): cap the ready rows kept, not the bumped http window
An http store cannot carry ExcludeIDs on listReadyWork, so readyExclusion
fetches the unfiltered ready set, widened by len(blocked) under a limit,
and drops the externally blocked rows client-side. The http ready bridge
enforced MaxRows on the rows it fetched rather than the rows kept. So
`bd ready --limit N --max-rows N` exited 2 whenever more than N issues
were ready and any workspace issue held an unsatisfied external blocker
(a closed one counts), even with no blocked row in the window, and a
blocked row in the page counted against the cap although the caller
never sees it. Locally neither can happen: issueops enforces the cap on
the filtered page it delivers, after the Limit trim
(finishReadyWorkWithCounts).
The client-side path now takes MaxRows off the inner query and enforces
the caller's cap on the rows it keeps, after the trim, in all three
listings. The inner query keeps the cap whenever nothing is dropped
client-side. MaxRows never rode the wire, so the fetch is the size it
was; refetchedReadyTotal already clears the cap on its own over-fetch.
TestServedReadyMaxRowsCountsTheRowsKept runs the decorator over a served
http store holding three free issues and one externally blocked one: a
cap equal to the limit, a cap under a wider limit, an unlimited listing,
and a kept page wider than the cap, which must still return
ErrTooManyRows with the caller's cap and source. Each case runs through
GetReadyWork, GetReadyWorkWithCounts and GetReadyWorkWithCountsAndTotal.
Leaving the cap on the inner query fails the first three cases in all
three methods, dropping the re-applied cap fails the fourth, and
enforcing it before the Limit trim fails the first.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
rbe-west's pool workers advertise gastownhall/gascity main's worker-env
pin; when gascity re-pins (a Go/dolt/OS bump, e.g. #7387) beads' copy
falls out of step and every remote-execution run stops in bazel.yml's
preflight until a human notices and copies the fix by hand (#7419 took
~100 minutes). This adds a scheduled workflow (every 15 minutes, plus
workflow_dispatch) that runs tools/rbe/worker-env-sync against gascity
main, and on a real mismatch (exit 1) copies the manifest and pin with
the new tools/rbe/worker-env-sync-copy, opens/updates a PR on a fixed
branch with status/needs-review-auto, and arms auto-merge.
GitHub never runs checks on a PR a plain GITHUB_TOKEN opens, so this
needs a GitHub App token -- but gastownhall-autofix (contents:write on
this repo) cannot open or label a PR. Two Apps split the two write
roles instead: gastownhall-autofix mints push-token (contents:write
only) and does the git push of bot/worker-env-sync via plain git;
gascity-autofix (pull-requests:write only) mints pr-token and does
everything PR-shaped -- create/update, the label, and arming
auto-merge -- via gh. peter-evans/create-pull-request takes one token
for the whole flow, so it can't honor this split; plain git and gh
replace it. Every ${{ }} is resolved into a step's env: first, never
written inside a run: script.
Both Apps' id/private-key secrets live in the same autofix environment,
gated by its deployment-branch policy to main; schedule and
workflow_dispatch are never fork events, so neither key is ever
readable by a fork.
Needs admin setup: the gascity-autofix App (id 5259233) installed on
gastownhall/beads (and gascity) with pull-requests:write and metadata
read, and its GASCITY_AUTOFIX_APP_ID / GASCITY_AUTOFIX_APP_PRIVATE_KEY
secrets added to the autofix environment alongside the existing
AUTOFIX_APP_ID / AUTOFIX_APP_PRIVATE_KEY.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* docs(proxied): name the Close3/Close4 legacy pins and fix the Close3 doc comment (#7173 follow-up)
Two non-blocking findings from the #7173 adoption review (bd-vrdrew,
bd-dars9p), both in bee's code, neither addressed in that PR:
- The doc comment on TestProxiedServerClose3 still called it "the second
half of TestProxiedServerClose"; after the second split it is the middle
of the three parents (Close, Close3, Close4). Say so, and name Close4
as its own second half.
- In the frozen 15-shard block of .github/scripts/proxied-cmd-test-shards.txt
the lines `15 13 TestProxiedServerClose3` and `15 2 TestProxiedServerClose4`
sat inside the shard-1 and shard-7 groups (#7173's last commit moved the
pins from 1 and 7 to 13 and 2 without moving the lines), and the header's
"Deliberate exception (Oct 2026)" paragraph did not name them. The two
lines now sit alphabetically inside their own shard groups, the header
names them with the reason and the measured times, and the generator's
hand-pin paragraph (scripts/ci/gen_proxied_shard_manifest.py) names them
too so the two texts stay in step. The lines were inert either way:
proxied-test-shard.sh matches each line by field.
No test moves shard: the 15-shard block's line set is unchanged apart from
order (sorted diff empty) and the 30-shard block is byte-identical.
Verified: gofmt -l (clean); go vet ./cmd/bd/ (exit 0);
gen_proxied_shard_manifest.py 30 --weights=duration --check (exit 0,
heaviest 435.1s est, unchanged); 15 --check reports the same 30 hashed
names missing as main (the frozen block is expected to fail it);
proxied-test-shard.sh list-only: Close3 on 13/15, Close4 on 2/15, neither
on 1/15 or 7/15; go test ./scripts/ -run 'Shard|Manifest|Coverage' ok 38.6s.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(proxied): count CloseB in the Close3 comment; say why shard 5 got no pin
Maintainer fixup from the adoption review of #7382 (bd-g6pyb0), on top
of bee's commit, which stays as written. Comment and manifest-header
text only: no test body, shard assignment or routing changes.
- TestProxiedServerClose3's doc comment called it "the middle of the
three parents TestProxiedServerClose was split into (Close, Close3,
Close4)". That held at the PR's original base, but #7418, on main
since, moved five of Close's eleven cases into a new
TestProxiedServerCloseB, so the 23 bd-init subtests of the pre-#7173
TestProxiedServerClose now sit in four parents: Close 6, CloseB 5,
Close3 6, Close4 6 (their union is exactly the pre-#7173 set, no
duplicates). The comment now says Close3 was split off Close, names
all four parents, and keeps "Its own second half is
TestProxiedServerClose4."
- The frozen 15-shard block's header said #7173 pinned Close3 and
Close4 onto "the two lightest shards of that PR's own run (6m51s and
7m57s)". On that run (37206446441, at 765248af5) shard 5 was lighter
still, at 5m50s; #7173 passed over it on purpose, because it was
light only because those 12 subtests had just left it and putting
Close3 back would recreate most of the set that timed out. The header
now says "other than shard 5 itself" and gives that reason.
This commit also supersedes the parts of the parent commit's message
that the rebase onto c21880105f outdated:
- "after the second split it is the middle of the three parents (Close,
Close3, Close4)": four parents now, as above.
- "the 30-shard block is byte-identical": the Bazel-only block is 34
shards now (#7418 made it 44, #7436 34), and that block is
byte-identical to the base's.
- "gen_proxied_shard_manifest.py 30 --weights=duration --check (exit 0,
heaviest 435.1s est, unchanged)": with no 30-shard block left, that
command now exits 1 ("has no block for total_shards=30"). Its current
form, 34 --weights=duration --check, exits 0 with the heaviest shard
at 196.1 s est., the same before and after this commit.
- "15 --check reports the same 30 hashed names missing as main": it now
reports 53, the same set as against the base's manifest.
Verified: git diff --check clean; gofmt -l clean (the Go change is
comment-only); with '#' lines stripped as proxied-test-shard.sh strips
them, the manifest is identical before and after;
gen_proxied_shard_manifest.py 15 --check and 34 --weights=duration
--check print the same output before and after (exit 1 with 53
missing; exit 0, heaviest 196.1 s); BEADS_TEST_SHARD_LIST_ONLY=1
proxied-test-shard.sh lists for 1, 2, 7 and 13 of 15 are unchanged
(Close3 on 13, Close4 on 2, neither on 1 or 7); go test ./scripts/ -run
'Shard|Manifest|Coverage' ok (21 top-level tests, none skipped).
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Follow-ups from the #6618 adoption review, neither addressed there:
- bd-6gl9h7 (Test Evidence Quality): no committed test ran `bd show` with
--comments-tail set. show_comments_tail_test.go calls printComments and
renderWatchComments directly, so passing 0 at any of the three call
sites (show.go direct, show_display.go --watch,
show_proxied_server.go / show_proxied_watch.go proxied) still passed the
suite. TestEmbeddedShowCommentsTail (direct, direct --watch) and
TestProxiedServerShowCommentsTail (proxied, proxied --watch) now run the
built binary through each route over the same three comments with
--comments-tail 1, and check the elision line, the surviving newest
comment, the absence of both hidden ones, the off state (0 and a cap
above the count) byte-identical to the flag's absence, the negative
usage error, and --json --include-comments untouched.
Mutating each call site to pass 0 fails the matching route tests
(direct: direct_tail_1 + watch_tail_1; proxied: proxied_tail_1 +
proxied_watch_tail_1) and nothing else.
The off-state comparison strips the "💡 Tip:" line maybeShowTip may
append after a direct text render (a per-run probability roll behind a
per-tip frequency gate, independent of the flag); without that, the
first render of a fresh store can carry the tip and the comparison
fails on it.
The embedded half lives in a *_embedded_test.go file because
gen_embedded_cmd_shard_manifest.py discovers TestEmbedded* only there;
both tests are registered in their shard manifests (--write, then
--check rc 0 at 50 and 30) and in cmd/bd's go_test srcs.
- bd-l6f1r7 (Release Safety): the CHANGELOG bullet for the flag sat under
"### Fixed" in [Unreleased]; it is now the first bullet under the
section's "### Added".
Ran (GOTOOLCHAIN=go1.26.7): go vet ./cmd/bd/; gofmt -l; go test ./scripts/
-run 'Shard|Manifest|Coverage'; embedded leg
(BEADS_TEST_EMBEDDED_DOLT=1) -run TestEmbeddedShowCommentsTail -count=3:
15/15 subtests PASS; proxied leg (BEADS_TEST_PROXIED_SERVER=1,
BEADS_TEST_DOLT_SERVER=local, dolt 2.2.0, -tags gms_pure_go) -run
TestProxiedServerShowCommentsTail: 5/5 PASS, 0 SKIP.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Port gascity's remote repo contents cache wiring (gascity #7467, #7478) to
bazel.yml, gated on the repository variable RBE_REPO_CONTENTS_CACHE
(unset/off: nothing; seed: rrc-seed on push to main; canary: + bazel-test
reads; on: + every test lane reads). Mode remote only.
- rbe job: an rrc step turns the variable into the rrc output.
- Readers: the eight test lanes append startup
--experimental_remote_repo_contents_cache and common
--loading_phase_threads=64 to .bazelrc.local before Set up Bazel.
- rrc-seed (push to main, id-token: write): a 30-minute
rbe-rrc-writer-beads certificate from rbe-west's mint
(.github/scripts/rrc-writer-credential.sh), then every lane's command
(.github/scripts/rrc-lane-commands.txt) with --nobuild, --remote_cache
only and --remote_upload_local_results (.github/scripts/rrc-run-lanes.sh).
- rrc-verify (schedule/dispatch, issues: write): cold fetch of every lane
and tools/bazel/rrc_verify.py against the cache; a mismatch opens an
rrc-verify issue.
- pr.yml, nightly.yml and bazel-farm.yml grant id-token: write and
issues: write on their bazel.yml call (startup_failure otherwise);
TestBazelWorkflowCallersGrantEveryRequestedPermission guards it.
rrc-writer-credential.sh, rrc_verify.py and rrc_verify_test.py are byte
copies of gascity's, pinned by sha256.
Refs ga-vnycm2.29.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(testutil): sweep Dolt test containers whose owner process exited (wy-4hknjt)
Every Dolt container the test harness starts now carries two labels naming
its owner: the test binary's pid and the host it runs on. Before a process
starts its first container, the harness lists the containers labelled for
this host and removes the ones whose owner pid no longer exists.
In-process cleanup (t.Cleanup, TerminateDoltContainer after m.Run) never
runs when a test binary is killed or panics on `go test -timeout`, and a box
running with TESTCONTAINERS_RYUK_DISABLED=true has no reaper either. Each
such run stranded one idle dolt-sql-server holding 100-470 MiB; 23 were
standing on one loaded box after a single evening of killed runs. The sweep
bounds the pile at "runs since the last run".
Safety under concurrent test processes on one host: a container is removed
only when kill(pid, 0) reports ESRCH. A live owner, a pid reused by another
live process, or a pid this user may not signal (EPERM) all keep the
container. Containers without the owner labels (older harnesses, other
tools) are never touched, and the host label keeps a remote DOCKER_HOST's
containers, whose pids mean nothing here, out of the sweep. The local
(BEADS_TEST_DOLT_SERVER=local) backend is unaffected.
Tests: the decision table (dead owners only; missing, non-numeric and
non-positive pids skipped without probing), pidAlive on self and on an
impossible pid, the label option stamping this process, and a Docker test
that starts a dead-owned and a live-owned container, sweeps, and checks
only the dead-owned one is gone.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* build(bazel): sync BUILD files for testutil dolt sweep test
wy-4hknjt: apply the gazelle bazel-sync patch from run 36720164405
so internal/testutil/BUILD.bazel carries the testcontainers deps.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(testutil): key the Dolt container sweep on the owner's PID namespace
Maintainer fixup for #7028, review iterations 1 and 2 and pre-approval
CI.
A pid names a process only inside its PID namespace. The sweep removed a
labelled container whenever kill(owner-pid, 0) returned ESRCH, so a
sweeper in another namespace that shares the hostname and the Docker
daemon reads every live owner as dead. That is the default shape of the
maintainers' agent fleet: each session runs under bwrap --unshare-pid
without --unshare-uts. Every session therefore reports one hostname, sees
only its own handful of pids, and talks to one /var/run/docker.sock, with
the Docker backend as the test default. On one such box on 2026-10-06,
three live dolt-sql-server test containers from three test runs shared the
daemon. With the original sweep merged, the first container start of a
test binary in any other session would have removed them mid-test.
Reproduced and fixed by running the sweep from a container (its own pid
namespace, same hostname, same daemon) against a container labelled with a
pid that was alive in the labelling session:
- at 5978cedaa2: "removed stale Dolt test container ... (owner process
exited)" while the owner was alive;
- with this change: the row is listed and kept.
Changes:
- Stamp a third owner label, owner-pidns: the /proc/self/ns/pid link on
Linux and "" elsewhere. staleContainers considers only rows from the
sweeper's own namespace. On Linux the sweep is skipped when that link
cannot be read. A start-time label alone would not fix this: across
namespaces it would turn a pid collision into "dead" as well. An owner
whose hostname or namespace cannot be read is stamped "", which no
sweep on the host matches, so its container leaks instead.
- docker rm -f -v: the image declares VOLUME /var/lib/dolt, and plain
rm -f left that anonymous volume behind for every swept container, unlike
testcontainers' own RemoveVolumes teardown.
- Bound the sweep with a 30s context, plus WaitDelay on each docker
command. Without WaitDelay, killing the docker process on timeout does not
unblock Output() while a child it started still holds the pipe. With a
forking docker shim on PATH, the call returns after 3s with this change
and is still blocked after 15s without either part.
- Extract parseOwnedRows and table-test it: empty fields, CRLF, trailing
newline.
- TestSweepStaleDoltContainers: the dead-owned container's owner is a
child process that lives until both containers are up and the volumes
are read, and is then killed and reaped (a zombie still reads as
alive). A sibling test binary's sweep (go test ./... runs them in
parallel) removes a container as soon as its owner reads as dead, and a
never-live owner pid exposed the container for its whole start. The
test checks only the end state for that container and its volume,
polled for up to sweepTimeout, because the sibling may get there first
or still be removing it when our rm fails.
Reproduced with a second test process in the same PID namespace running
the real sweep every 100ms alongside TestSweepStaleDoltContainers:
- with a never-live owner pid: "starting Dolt container: ... No such
container", the container removed inside dolt.Run;
- with the child owner but no poll: 1 of 4 runs failed with "dead-owned
container ... still exists after the sweep", after the sibling's
rm -f -v won and ours exited 1;
- with both: 6 of 6 runs pass, 2 of them through that same path.
Without the reap, or without -v, the test fails.
A container leaked from another namespace is now left to a sweep from that
namespace, or to Ryuk. That is the conservative side of the trade.
Pre-approval CI: main's //internal/testutil:testutil_dolt_test (#7328)
runs this package with BEADS_TEST_DOLT_SERVER=local and
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 in the required dolt-server lane,
whose remote workers have no docker. Under the local backend checkDolt
reports ready once the pinned dolt CLI resolves, so
TestSweepStaleDoltContainers went on to dolt.Run and failed ("failed to
create Docker provider"). It now gates like TestDoltServerFingerprint's
container subtest: under the local backend it runs only when docker and
the image are available, and skips otherwise. On the merge with main
b1fe68e63a, with docker unreachable, that package run (race,
-parallel 4) failed only this test; with this change it passes with the
test skipped, and with docker available the test still runs and passes
under either backend.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
The pinned-shard wrapper kept a `declare -A shard_of` map whose only use was
the "pinned twice" check. Apple's /bin/bash is 3.2, which has no associative
arrays, so on the main workflow's macOS Test job scripts/pinned_shards_test.go
(which runs the wrapper through the host `bash`) failed every sharded case
with `declare: -A: invalid option` (exit 2). The job has been red on every
main push since #7413 landed (runs 37890739870, 37900573128, 37902968742);
the Bazel lanes run the wrapper on Linux bash 5 and never saw it.
The check is now a membership test on the "|"-joined `all` string, which the
manifest's name pattern (^Test[A-Za-z0-9_]*$) keeps free of "|". Nothing
else changes: the pinned-twice refusal still fires
(TestPinnedShardWrapperRejectsBadManifests/test_pinned_twice).
Verified: go test -run TestPinnedShard ./scripts with PATH limited to
/usr/bin:/bin (bash 3.2.57): 5 PASS; the whole ./scripts package under
bash 5.3: ok; shellcheck -s bash and `/bin/bash -n` clean.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(issueops): one create priority default; HTTP absent priority is P2
The CLI defaulted `bd create` to P2, but issues:create, issues:batchCreate
and batch:apply create items left Issue.Priority at 0 when `priority` was
absent, so a gc/curl create stored P0 (critical) against the spec's "absent
means the default".
The default now lives in one place, the shared create preparation
(PreparePublicCreateRequest), behind a presence flag because Issue.Priority's
zero value is P0:
- issueops.CreateRequest.DefaultPriority, BatchCreateItem.DefaultPriority and
CreateItem.DefaultPriority ask for issueops.DefaultCreatePriority (2);
setting it with a non-zero priority is ErrValidation
(ValidateCreatePriority, shared with the HTTP client);
- every Lifecycle.Create, BatchCreator and BatchApplier leg (dolt, embedded,
uow) reaches it; CloneCreateBatchRequest now keeps scalar item members;
- the three handlers set the flag for an absent member and never make up 0;
the HTTP client omits `priority` for it (wirePriority) only when the
server advertises the new additive issues.create.defaultPriority token,
read from the cached handshake before the dial; an older server reads an
absent priority as P0, so the client sends DefaultCreatePriority (2)
explicitly to it (pinCreateDefaultPriority). An explicit 0 is still sent;
- `bd create` without --priority, `bd create --graph` nodes without priority
and `bd create --file` templates without ### Priority rely on the flag; the
flag's displayed default and the dry-run previews read the library
constant. CLI output is byte-identical (checked against origin/main).
Spec: the three priority descriptions now say the create default is P2 on
a server advertising issues.create.defaultPriority (apigen regenerated); the
wireshape golden already had priority optional, so no wire-shape change.
Conformance: RunLifecycleCreateAppliesTheDefaultPriority,
RunBatchCreatorAppliesTheDefaultPriority and
RunBatchApplyAppliesTheDefaultPriority on dolt, embedded, uow and http, plus
handler and client encoding tests, and
TestCreateSendsTheDefaultPriorityToAServerThatPredatesIt (new client,
handshake without the token: all three create roles send 2).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(issueops): apply review fixups for the default create priority (bd-kb61wg)
Apply the minor and nit findings from the review of #7426:
- CHANGELOG: tell out-of-tree storage backends they must honor
DefaultPriority (store issueops.DefaultCreatePriority, refuse it with a
non-zero priority as ErrValidation) and which conformance cases check
it; scope "CLI output is unchanged" to the in-tree backends.
- bd create --file: pin the default-priority path. The e2e test asserts
the printed priorities, and a buildMarkdownBatchRequest unit test pins
the flag and priority for an absent, a 0 and a 1 `### Priority`.
Deleting `DefaultPriority: !template.PrioritySet` now fails both.
- bd create --file: warn on stderr about a `### Priority` that does not
parse, as the `### Type` case already does, instead of dropping it
silently.
- httpclient: document pinCreateDefaultPriority's same-build assumption
(the handshake is cached per Store, so a stale one is silent here), and
test its no-context and failed-handshake branches on all three roles.
- Formula steps, `bd q` and `bd todo add` spell
issueops.DefaultCreatePriority instead of the literal 2.
- Conformance: the batch-creator and batch-apply default-priority cases
also pin DefaultPriority with a non-zero priority as ErrValidation with
nothing written.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(issueops): mark the out-of-tree DefaultPriority change BREAKING (bd-0tcn1o)
Apply the minor findings from the relaunch review of #7426:
- CHANGELOG: move the obligation on out-of-tree storage backends out of
the `### Fixed` entry into its own `### Changed` entry, led by
"BREAKING (out-of-tree storage backends)" as the close-guard change
and the earlier out-of-tree contract changes are; RELEASING.md asks
breaking changes to carry their migration. The entry says what such a
backend used to receive from `bd create`, `--graph` and `--file`
(priority 2), what it receives now (priority 0 with DefaultPriority
set), the migration, and the conformance cases that check it. The
`### Fixed` entry keeps the HTTP P2 fix, points at the new entry, and
names the stale-handshake residual that only a code comment named: a
create that lands on an older build behind the same URL still stores
P0.
- bd cook: the proto root, the gate issue and the cooked formula root
spell issueops.DefaultCreatePriority instead of the literal 2, as the
formula steps in the same file already do. No behavior change.
Not taken:
- The literal 2s in create_form.go, gate.go and linear.go, and the
"default 2" in todo.go's --priority help: explicit P2s outside the
migrated paths (the help string also feeds the generated CLI
reference). Left for a follow-up sweep.
- Reusing in.priorityDefault in the direct bd create route: that route
builds no createInput (gatherCreateInput runs only on the proxied and
--file routes, and each returns), so there is nothing to reuse.
- A member-level range check in the single-create HTTP decode, as the
batch shapes have: the asymmetry predates this PR, and the role still
refuses an out-of-range priority on all three shapes.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
//internal/storage/embeddeddolt:embeddeddolt_conformance_core_test ran
conformance.RunAll minus Audit as one unsharded action, 108-150s on
rbe-west, the embedded lane's longest after #7443. Every RunAll group builds
its own store from the factory, so the groups share no state and can run in
separate processes; about half the time was two groups,
ReadyCountsPageChunking (~33s) and Portable (~20s).
The new embeddeddolt_conformance_core_slow_test runs exactly those two
groups (-test.run=^TestConformance$/^(ReadyCountsPageChunking|Portable)$),
and the core target skips them along with Audit. The core target skips
only named groups, so any group added to or renamed in RunAll still runs
there: between them the two targets run every core group exactly once
(rbe-west: 57 + 2 groups, no overlap, the same 59 as before). No test
changed. The frozen-partition check now derives both targets' selectors
from the retired job's core selector plus conformanceCoreSlowGroups; the
retired-lane arg pins, bazel.yml's --whole list and the BUILD rules carry
the new target.
rbe-west, `bazel test //... --config=embedded --nocache_test_results`:
conformance core 148s -> 55s + 57s.
Bead: ga-vnycm2.31
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(issueops): enforce the dotted-child dependency rule on every leg
The refusal of an explicit edge from a dotted-id child to its own ancestor
(bd-abc.1 -> bd-abc; only the parent-child edge to the immediate dotted
parent is allowed) lived only in cmd/bd (isDisallowedHierarchicalDependency).
HTTP dependencies:add, batch:apply dep_add items and `bd create --graph`'s own
edges skipped it.
It is now one library rule, issueops.CheckDottedChildDependency, returning
*issueops.DottedChildDependencyError (unwraps to ErrValidation, same message
the CLI printed):
- ValidateAddDependenciesRequest applies it, so DependencyEditor refuses on
dolt, embedded, uow and the server behind httpapi (400 invalid_argument);
- both BatchApplier bodies (issueops and uow) apply it to each dep_add item on
the resolved ids, so a key bound to a minted dotted child is refused too;
- the HTTP client checks it before the dial, as it does self-dependency, so
the typed error survives the wire.
cmd/bd keeps no copy: single-edge dep add / dep --blocks rely on the role;
bd link (still on the store verb) and the --file bulk reporter call the
library rule. CLI output is byte-identical (checked against origin/main).
Conformance: RunDependencyEditorRefusesADottedChildGatedOnItsOwnParent and
RunBatchApplyRefusesADottedChildGatedOnItsOwnParent wired on dolt, embedded,
uow and http, plus a raw-wire served test past the client check and handler
mapping cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(batch): refuse a dotted child gated on its own ancestor in bd batch
Review fixup for PR #7424 (iterations 1 and 2).
Major: a bd batch script line `dep add bd-abc.1 bd-abc` still wrote the
edge this PR refuses everywhere else, on both backends. Neither batch
dispatch writes through the DependencyEditor role that enforces the
dotted-child rule: the classic arm calls storage.Transaction.AddDependency
and the proxied arm the unit of work's AddDependencies verb. Both arms now
build the edge with one helper, batchDepAddEdge, which keeps the default
type and the arity and type errors, and asks
publicops.CheckDottedChildDependency the way bd link does. A refused line
rolls the whole batch back.
Tests: TestBatchDepAddEdge (default and explicit types, arity and type
errors, three refusals typed *DottedChildDependencyError matching
ErrValidation, and the immediate parent-child edge allowed), and
TestProxiedServerBatchDepAddRefusesADottedChildGatedOnItsParent (classic
and proxied: the refusal names line 2, rolls back an earlier update line
and writes no edge, and `dep add C P parent-child` still lands exactly
one), registered in the proxied shard manifest. A mutant that drops the
rule from the shared helper fails both; one that bypasses the helper in
the proxied arm alone fails the proxied leg.
Minors:
- For a child whose parent-child edge is already stored (a
`bd create --parent` child) the rule answers ahead of the hierarchy and
type conflicts, so an HTTP caller now gets 400 invalid_argument where it
got 409 dependency_cycle (blocking types) or dependency_exists (any
other type). Documented in the DependencyEditor role doc, the CHANGELOG
entry and the httpapi batch-apply test comment, and pinned by a
stored-hierarchy phase in the DependencyEditor and BatchApplier
dotted-child conformance contracts on every leg; a mutant that drops the
rule gets the hierarchy conflict instead (409 dependency_cycle on the
wire).
- The bd create --graph dry-run note now says the live create may also
refuse an edge that gates a dotted-id child on its own ancestor.
- The DottedChildDependencyError comment says the message is kept verbatim
and says "deadlock" whatever the type.
Not changed: bd relate (relates-to does not schedule) and the edges a
create writes with its issue (bd create --deps/--waits-for, and over
HTTP an explicit dotted id with a non-immediate ParentID) still write
through paths that skip the rule. The scheduling shapes need an explicit
dotted id or a grandparent target. Follow-up bd-25s1wh tracks moving the
rule down to the domain/store add verbs, with a structural bypass for
reparent and template edges.
Iteration 2 (minor): the CheckDottedChildDependency doc no longer implies
bd link and bd batch are the only writers outside the roles. It names
bd relate and the create edges as not applying the rule yet and cites
bd-25s1wh.
Complexity (cyclomatic/cognitive): runBatchOp 23/35 -> 21/31,
runBatchOpUOW 28/48 -> 26/44, batchDepAddEdge 5/4. Touching them brings
both pre-existing dispatch switches into the measured set; splitting them
is out of scope here.
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(issueops,httpapi): document the dotted-child 400 and widen its gap list
Review fixup for PR #7424 (relaunch, iteration 1, minors).
- The OpenAPI spec now describes the wire change this PR makes. The
dependencies:add and issues:batchApply 400 vocabularies name an edge
from a dotted-id child to its own ancestor (anything but the
parent-child edge to its immediate parent; param `edges` and `items`).
dependencies:add says why that is request-intrinsic, and both 409s say
it is never dependency_cycle or dependency_exists, even for a child
whose parent-child edge is stored. Response descriptions only: the
generated types and the wireshape digest are unchanged (make api-check).
- The CheckDottedChildDependency doc no longer reads as a complete list of
the writers that skip the rule. Besides bd relate and the create edges
it names bd duplicate, bd supersede, bd duplicates --auto-merge (its
related link and its reparenting) and the tracker engine's
createDependencies, and says the molecule, template and swarm writers
are unaudited. bd-25s1wh's notes carry the widened scope, including
`bd duplicate bd-a.1 --of bd-a`.
Declined (nit): unifying the root issueops import alias across the PR's
cmd/bd files. batch.go is the one file that imports both issueops
packages, so one of them needs an alias there; it uses publicops, the
repo's usual alias for the root package, and aliasing the other side
instead would rewrite base-owned lines.
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.5 <noreply@anthropic.com>
After #7440 //internal/httpclient:httpclient_served_test set the embedded
lane (149-167s slowest shard in recent CI runs, 63-167s across PRs since
#7416). Not a regression: its top-level tests are all serial and rules_go's
round-robin put the long ones wherever its index split dropped them, so
shard times swung with load and with which tests a PR added (whole-lane
rbe-west run on main: 40-119s over 16 shards).
The target now runs through tools/bazel/go_test_pinned_shard.sh, as
bd_dolt_server_test and regression_test do: every top-level test measured
at >= 3s (max over three whole-lane runs) is pinned onto 17 shards
(served_pinned_shards.txt, tools/bazel/pin_shards.py), and the binary's own
round-robin deals the other ~620 over the remaining 9. Every test still runs
in exactly one shard (TestPinnedShardWrapperSplit), the manifest may name
only real tests, and the lane's check_testcases.py fails an empty shard.
No test changed; the heaviest single test (~52s, no subtests) stays whole.
The pinned-wrapper policy listed only dolt-server-cmd targets, since the
wrapper selects and skips; pinnedShardTargets now carries each reviewed
target's lane tag, and httpclient_served_test is reviewed in as the
embedded lane's (its args stay pinned in
TestBazelRetiredLanesCannotBeNarrowed).
rbe-west, `bazel test //... --config=embedded --nocache_test_results`:
served shards max 119s -> 77s, median 73s -> 54s; lane critical path
138-153s -> 116s.
Bead: ga-vnycm2.30
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
//internal/storage/embeddeddolt:embeddeddolt_embedded_test became the
embedded lane's floor once the cmd tier was split (CI on #7438: 20 shards,
220s max, 162s median). Its tests are serial, so a shard's wall time is the
sum of its tests; measured on rbe-west with the whole lane running (as CI
runs it), its 20 shards took 110-161s.
- TestCreateBatchFastPathsMatchPerRow_Embedded (111s) runs
createbatchequiv's scenarios as two top-level tests (small+depadd,
apply+waitsfor) through a new createbatchequiv.RunNamed; the same
scenarios and checks. TestCreateBatchEquivalencePartsCoverEveryScenario
fails unless the parts name every createbatchequiv.Run scenario exactly
once.
- TestWithPeerAuth_WarnsWhenStoredPeerSuppressesAmbientPassword (81s, eight
cases each opening its own store) runs its table as two top-level tests,
cases 1-4 and 5-8; cases and assertions unchanged.
- Durations re-measured on rbe-west under the whole lane's load; the
Bazel-only block is now 40 shards (LPT heaviest = the heaviest single
test, TestLifecycleCloseReopenContract ~71s). One target: 40 is under
Bazel's 50-shard cap, so no offset split.
rbe-west, `bazel test //... --config=embedded --nocache_test_results`:
storage shards max 161s -> 89s, median ~118s -> 63s.
Bead: ga-vnycm2.28
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
.bazelversion 9.2.0 -> 9.3.0. setup-bazel pins the 9.3.0 release
sha256s (bazel-9.3.0-linux-{x86_64,arm64}.sha256) next to 9.2.0's,
so the composite stays a valid byte copy for gascity until it bumps
too. MODULE.bazel.lock refreshed: 9.3.0's bundled module graph
resolves apple_support 2.5.2 and rules_cc 0.2.15 and changes four
extension bzlTransitiveDigests.
9.3.0 fixes bazel#30905 (the remote repo contents cache overlay
serialized getInputStream), the hard prerequisite for ga-vnycm2.25.
Refs ga-vnycm2.23
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
//cmd/bd:bd_embedded_test was the embedded lane's floor: at Bazel's 50-shard
cap per rule, each shard's wall time was its slowest top-level test, and
~40 tests ran 65-130s on rbe-west.
- 34 slow TestEmbedded* functions are split into 89 smaller top-level
functions. Subtests and table cases are moved verbatim: no assertion,
flag or data changes, the same t.Run set per file, the same skip guard and
t.Parallel. Subtests that read state earlier ones left stay together, in
order; each new function repeats the shared setup it needs.
- The manifest's cmd/bd block is now 100 shards, run by two targets:
bd_embedded_test (shards 1-50) and the new bd_embedded_part2_test
(51-100), through go_test_manifest_shard.sh --shard-offset/--shard-total.
check_shard_coverage.py takes SHARDS@OFFSET/TOTAL and fails unless the
targets' ranges tile the block exactly once, so every test runs in exactly
one shard of one target; the policy tests read both rules' ranges from
cmd/bd/BUILD.bazel.
- Durations re-measured on rbe-west with the split tests and repacked. The
frozen legacy 20-shard block drops the renamed names (no workflow reads
it; new names hash-distribute as before).
Not split: the *Concurrent stress tests (their bd subprocesses queue on the
workspace's single writer lock: TestEmbeddedUpdateConcurrent is ~100
serialized bd commands), TestEmbeddedPurgeWispsPlaneRetention (one stateful
sequence), and the MaxRowsList* tests (setup is 21 sequential creates every
subtest reads).
rbe-west, both targets, --nocache_test_results: slowest shard 138-163s ->
109s (TestEmbeddedUpdateConcurrent alone; every other shard <=86s), median
80-84s -> 40s, shard-seconds 4.1-4.4k -> 4.2k, critical path 213-306s ->
113s.
Bead: ga-vnycm2.17
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
//cmd/bd:bd_embedded_test sits at Bazel's 50-shard cap and was the embedded
lane's floor (shards 62-250s). Measured on rbe-west, every shard's wall time
was its single slowest top-level test, and most of a test's time was `bd
init` (~20s under -race: one Dolt commit per schema migration) plus a fixed
1s per bd subprocess exit (the race runtime's atexit_sleep_ms).
- bdInit seeds .beads/embeddeddolt/<db> from a per-process schema template
(an empty database with every migration applied, made once per shard by a
non-race build of internal/storage/embeddeddolt/cmd) before running the
real `bd init`, which then skips the migration chain and does everything
else itself (identity, prefix, config, hooks, agent files, git commit).
Only for argument lists it understands (--prefix/--database plus
--quiet/--skip-hooks/--skip-agents/--non-interactive), and it checks the
result is the seeded embedded database. BEADS_TEST_FRESH_INIT=1 turns it
off. The TestEmbeddedInit* tests run their own init and are unaffected.
- GORACE=atexit_sleep_ms=0 on the target: the bd subprocesses no longer
sleep 1s before exiting. A race they hit while running still fails the
command as before.
- TestEmbeddedInitSelectedExcludeRouting (serial, t.Setenv, 7 full inits,
~113s) is split into ...Stealth and ...Fork top-level functions; same
cases, same assertions.
- The generator packs with a model of the shard process (pack_concurrent):
tests without a top-level t.Parallel run one after another, the rest
share -test.parallel=4. The durations are re-measured on rbe-west.
rbe-west, `bazel test //cmd/bd:bd_embedded_test --config=embedded
--nocache_test_results`: test-seconds 20.2k -> ~10.3k, shard-seconds
8.0k -> ~4.2k, slowest shard 243s -> 138s / 163s (two runs, before the
repack).
Bead: ga-vnycm2.17
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(issueops): enforce the close guards on every close leg
The template read-only guard, the pin guard and the assignee authority
fence (be-035) lived only in cmd/bd (validateIssueClosable), so a close
through bd serve, issues:batchClose, a batch:apply close item or a library
caller of Lifecycle.Close / BatchCloser / BatchApplier closed what bd close
refused.
They now run inside the close's own transaction in CloseIssueCheckedInTx
(enforceCloseGuardsInTx), the body every checked close shares (dolt,
embedded, uow, and the server behind httpapi), for a target that is not
already closed:
- a template refuses with *issueops.TemplateReadOnlyError (no bypass);
- unless Force (CloseRequest, CloseBatchRequest, CloseItem) is set, a pinned
issue refuses with *issueops.PinnedError and another actor's bead with
*issueops.CloseNotAssigneeError (matches ErrNotOwner).
Wire: 409 template_read_only, issue_pinned and not_assignee (holder in
`assignee`, also on a batch-close outcome); the client rebuilds the typed
errors. The decision is one exported pure rule over the pre-image,
issueops.CheckClosable (internal/storage/issueops), which the in-tx guard
calls; bd close's direct and proxied preflights call it too, ahead of gate
satisfaction under the same already-closed skip, so bd close output, refusal
order and exit codes are unchanged (validateIssueClosable is gone). bd close
--if-revision now applies the guards too.
Conformance: RunLifecycleCloseEnforcesTheCloseGuards,
RunBatchCloserItemsAnswerToTheCloseGuards and
RunBatchApplyCloseItemsAnswerToTheCloseGuards on dolt, embedded, uow and
http, plus handler mapping tests, a CheckClosable table test, and a cmd/bd
test pinning that the guards outrank gate satisfaction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpclient): send force on the raw close; scope the close guards
Review fixes for #7425 (adopt-pr bd-0h0ao4, iterations 1 and 2).
The raw close keeps parity over http. httpclient.Store.CloseIssue maps the
off-role raw close onto the role's closeIssue op and sent force=false.
With the guards in the role, a pinned or claimed target then refused (409
issue_pinned / not_assignee) on http only: dolt, embedded and proxied run
the raw close as issueops.CloseIssueInTx, which applies neither the guards
nor close policy. The molecule auto-close, `bd gate resolve`,
`bd todo done` and `bd human dismiss` all make that call, and its
signature carries no force a caller could pass. It now sends force. Over
http that also stops applying close policy to the raw close, which it did
at base and no other backend does; parity is the point, so that goes too.
The template guard has no bypass on the wire, so a template still refuses
the raw close over http where the other backends close it; no raw caller
is known to close one. TestServedRawCloseKeepsParityWithTheOtherBackends
closes both pin spellings, a held bead and a parent with an open child
through Store.CloseIssue and requires the template refusal; with force
back to false it fails on 409 issue_pinned.
The close guards stay on the close verbs. A status update that crosses
into the done category (`bd update -s closed`, PATCH, a batchApply update
item) still answers to close policy only, so it closes a pinned issue or
another actor's bead on every backend, as it did before this PR. Guarding
it changes what the update legs admit and needs its own refusal mapping on
PATCH and batchApply, so it is left for a follow-up; the update.go and
domain/db comments now say the exclusion is deliberate.
CHANGELOG: the entry moves from Fixed to Changed as BREAKING, is scoped to
the close operations, names the two paths the guards do not cover, and
adds a Migration line (send force or reclaim; templates are never
closable). Docs: the OpBatchCloseIssues item codes, the CloseIssueChecked
and CloseIssueOptions.Force docs (storage, dolt, embeddeddolt), the
oracle-a scenario strings that named the retired validateIssueClosable,
and the TestCloseCheckOne_CloseGuardsOutrankGateSatisfaction doc, which
claimed a proxied route it does not drive.
Iteration 2: the wire contract says what force waives. The OpenAPI
`force` members of CloseIssueRequest, BatchCloseRequest and ApplyCloseItem
said force bypasses close policy "and nothing else"; it also waives the
pin and the assignee guard, and never the template guard. The batchClose
"only two answers" paragraph now says the same, and types.gen.go is
regenerated (`make api-gen`). "Close guards" names the close operations
instead of "every route to a close" and adds that a status update into
the done category is not one, and the PATCH done-crossing paragraph says
a patch is never refused `issue_pinned` or `not_assignee`. The conformance
comments that quoted the old Force sentence (batch_apply_contract.go,
batch_closer_contract.go, lifecycle_close_reopen_contract.go) quote the
current docs, and the batch_apply failure message no longer says Force
does nothing else. CHANGELOG: a `close` line of `bd batch` is named among
the raw closes, and "a template is never closable" becomes "the close
operations never close a template, forced or not". The storage interface
CloseIssue gains a doc that states its HTTP exception.
TestCloseGuardRefusalsPrintTheGuardSentenceOnEveryRoute pins the sentence
`bd close` prints for each guard (template, pin, assignee) through each
printer (closeDirectRefusal, closeDirectTypedRefusal, closeProxiedRefusal,
closeProxiedTypedRefusal), with the refusal bare, wrapped by the use case
and the SQL repository, or inside a served problem envelope. One pinned
refusal also goes through closeProxiedOutcomes and closeProxiedFailures,
where the stderr line and the `--json` error field must both be the
sentence. Six overlay mutants fail it: closeGuardRefusal recognizing no
guard, or not the pin, and each of the four printers skipping its call to
closeGuardRefusal.
Not done here: a CLI test that `--if-revision` exits 1 on a guard refusal,
not ExitGuardMismatch. External PR #7372 carries per-id fence tests for
that route (6 of 7 pass at this head); they are better absorbed with
credit than rewritten.
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.5 <noreply@anthropic.com>
* ci(bazel): scope the proxied lane's shared-server projects to their own database (44 -> 28 shards)
//cmd/bd:bd_proxied_test spends nearly all its time in `bd init
--proxied-server` against the shard's shared dolt sql-server. Measured
where that goes (dolt query log): of ~2,031 statements per init, the ~220
INFORMATION_SCHEMA queries (migration guards and pre-repair probes) are
~80% of server time at a handful of databases, the 81 DOLT_COMMITs only
~0.5s. Dolt evaluates INFORMATION_SCHEMA by walking every database the
session can see, so as root each init cost the server ~1.2 CPU-seconds
more per database already on it (locally 6.7 CPU-s with 1 database, 21
with 11): a shard's k-th init paid for the k-1 projects before it.
- proxied_shared_harness_test.go: newSharedProxiedProject now provisions
the database server-side (root creates it plus a passwordless user of
the same name with ALL on it and nothing else) and inits with
--proxied-server-external-user, so each project's sessions see one
database. newSharedProxiedRootProject keeps the old root/bd-creates-it
shape for the four tests that need a server-wide privilege (DOLT_REMOTE
remove, CREATE DATABASE, one compact statement); a run with the server
log in test outputs showed no other denied statement.
- Dropping finished databases instead was tried and rejected: a DROP
DATABASE fails other sessions' in-flight INFORMATION_SCHEMA queries
("no root value found in session"), ~35 init failures per run.
- No assertion changed. The bd-creates-the-database path stays covered
by the root variant, the managed-local and non-shared init tests.
- proxied_test_durations.json re-measured (two rbe-west runs): 19,618 ->
6,345 cost-seconds. 44 -> 28 shards, LPT-packed to ~227 per shard.
rbe-west, --nocache_test_results (BEP attempt durations): before 44
shards, sum 6,063s, max 186s; scoped users at 44 shards, sum 2,337s, max
68s; at 20 shards, sum 1,950s, max 136s.
Bead: ga-vnycm2.16
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): proxied lane 28 -> 34 shards for a <=100s slowest shard
PR CI at 28 shards (~227 packed cost each): 2,285 shard-seconds, median
78s, but max 113s; equally packed shards spread up to 1.45x the median.
34 shards (~187 each) targets a slowest shard under 100s.
Bead: ga-vnycm2.16
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): fetch pinned Ubuntu debs in parallel from a gascity mirror first
cc_sysroot_noble_amd64 downloaded its 7 pinned .debs one at a time from
snapshot.ubuntu.com, with only archive.ubuntu.com behind it. On
2026-10-09 the snapshot returned 503, and Bazel's retries against it
cost ~95 s per cold fetch before falling back (and archive.ubuntu.com
drops superseded versions, which would fail the fetch outright).
Same change as gastownhall/gascity (ga-vnycm2.11): deb_sysroot takes URL
templates ({path}, {file}, {sha256}) and starts every package download at
once (rctx.download block = False). NOBLE_DEB_URLS tries gascity's
content-addressed release mirror (toolchain-noble-debs-20261001, which
holds these exact pins; beads already takes its LLVM slice from a gascity
release), the snapshot, Launchpad's librarian, then archive.ubuntu.com.
The sha256 pins are unchanged and decide what is accepted; the unpacked
sysroot is byte-identical. The hermetic-cc guard now checks every
deb_sysroot: placeholders, the snapshot kept, two or more hosts, no
moving mirror first, no ICU.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37966817176
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* fix(issueops): enforce the template read-only update guard on every leg
The refusal of an update to a template (validateIssueUpdatable) lived only
in cmd/bd as a pre-read, so PATCH /v0/beads/issues/{id}, batch:apply update
items and library callers of Lifecycle.Update / BatchApplier edited
templates that `bd update` refused.
It is now one role rule, storage issueops.AuthorizeTemplateUpdate, returning
*issueops.TemplateReadOnlyError (matches ErrTemplateReadOnly; the message is
the sentence bd always printed). It runs in the update's own transaction,
after the compare-and-set preconditions (a stale guard still reports the
mismatch), and no force flag waives it:
- ExecuteUpdate (dolt, embedded) and the uow Update and batch update legs;
- the batch apply metadata splice that finishes a create item stays
unguarded on both bodies (a template the request creates is not modified);
- httpapi maps it to 409 template_read_only on updateIssue and applyBatch
(spec x-bd-codes and descriptions updated, apigen regenerated) and the
client rebuilds the typed error.
UpdateRequest.AllowTemplate stands the guard down for one request: the
caller edits a template deliberately. bd label (add, remove, remove-prefix)
and bd set-state set it, so they keep editing templates on every route, as
on origin/main. Over HTTP it is the optional `allow_template` member of the
PATCH body, advertised by the issues.update.allowTemplate behavior token,
which also says the server enforces the guard. httpclient Lifecycle.Update
decides from the cached handshake before the dial: against a server without
the token (no guard, no member) it runs the same rule
(AuthorizeTemplateUpdate) on a pre-read and never sends allow_template, so a
new bd against an older bd serve still refuses template updates.
cmd/bd: bd update, bd assign and the proxied assign/tag drop their pre-read
and print the role's refusal with the same line and exit code.
Conformance: RunLifecycleUpdateRefusesATemplate,
RunLifecycleUpdateAllowTemplateEditsATemplate,
RunBatchApplyUpdateItemsRefuseATemplate and
RunBatchApplySplicesTheMetadataOfATemplateItCreates on dolt, embedded, uow
and http (the http splice case is parked: the v0 create item has no
is_template member), plus handler and CLI rendering tests, and
TestUpdateTemplateGuardAgainstAServerThatPredatesIt (new client, handshake
without the token: refused before the dial, allow_template not sent).
Skew note (CHANGELOG): an older bd label / bd set-state against a new server
cannot send allow_template and now gets 409 template_read_only on a template.
bd comment, note, priority and tag keep their CLI-only pre-read guard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(issueops): scope template read-only docs to updates, test label stand-down
Review fixups for PR 7427 (adopt-pr review loop, iteration 1):
- Contract: the role guard covers updates, not every mutation. The
CHANGELOG headline, ErrTemplateReadOnly and CodeTemplateReadOnly now
say so, and "Not yet moved" names claim, reopen, :casMetadata and the
served addComment, which have no template check yet (a PATCH with
claim: true refuses a template that POST :claim still claims). Close
is #7425's. Follow-up: bd-jkp9v3.
- Skew: the CapIssuesUpdateAllowTemplate client fallback covers
updateIssue only. A batch update item gets no client-side check, so
through an older bd serve it still edits a template; the CHANGELOG
and both capability docs say so.
- Tests: a template row now goes through the CLI on both tiers
(TestEmbeddedLabelEditReports, TestProxiedServerLabelC). bd label add,
bd label remove --prefix and bd set-state edit it (AllowTemplate);
bd update --title and bd assign exit 1 with the template sentence and
leave it unchanged. Mutants: dropping AllowTemplate from label.go and
state.go reds the three edits on both tiers; disabling
AuthorizeTemplateUpdate reds update and assign on both tiers.
- Stale comments: runTagProxiedServer, applyUpdateProxiedOne,
proxiedUpdateTarget, UpdateFlags (five booleans, not four) and the
ItemUpdate notes in applyLabelEdit and bd label propagate's proxied
route (UpdateItem has no AllowTemplate).
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(roles): LeaseReclaimer role and POST issues:reclaim (S9)
Adds issueops.LeaseReclaimer.Reclaim(ReclaimRequest{Actor, OlderThan,
Filter}) -> ReclaimResult{Reclaimed []ReclaimedLease{ID, PreviousOwner,
Revision}}, the stale-lease sweep behind `bd reclaim`, on every leg:
- dolt, embedded dolt and the unit-of-work provider all run one body,
internal/storage/issueops.ExecuteReclaimInTx over
ReclaimExpiredLeasesInTx, and record one version commit per sweep that
reverted anything through the issue-operation funnel (so a deferred
version commit on the context is honored);
- each reverted row's fresh row_lock is published as its revision, so a
former holder's guarded write fails with ErrVersionMismatch;
- an id that is not a stale lease (absent, live, unheld) is left out of
Reclaimed, never an error; the id scope is capped at 1000
(*TooManyReclaimIDsError, counted as sent);
- the hook decorator fires on_update once per reverted row (and the
proxied notifying provider records one update per row); telemetry
wraps it like every role.
bd serve publishes it as POST /v0/beads/issues:reclaim behind the new
issues.reclaim capability (httpapi.Config.LeaseReclaimer, required like
every role). Spec, apigen and the wire-shape golden are regenerated;
the change is additive and wire_revision is unchanged. The HTTP client
leg dials it (wire vocabulary, capability preflight, local validation
in the role's order).
Conformance: RunLeaseReclaimer* (12 cases: revert post-state, the
revision race, live lease, grace window, id scope with absent/live ids,
empty answer, assignee/label scopes re-homed from reclaim_scope.go,
recovery event attribution, on_update once per row, refusals, the cap
boundary, no request mutation) wired on dolt, embeddeddolt, uow and the
served http leg, and so held by the leg lock. Handler tests cover the
member mapping, the projection, every handler refusal by name and the
role's refusals reaching the wire.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(bd): bd reclaim runs the LeaseReclaimer role on both routes (S9)
`bd reclaim` takes issueops.LeaseReclaimer off the decorated store on the
direct route (so a connected HTTP workspace dials issues:reclaim instead
of refusing) and off the proxied provider's own accessor on the proxied
route, replacing the raw ReclaimExpiredLeases calls and
runReclaimProxiedServer. Visible changes: --json entries carry the
reverted row's new `revision`, the workspace's on_update hook fires once
per reverted row, and the version commit is the role's own
("bd: reclaim N expired lease(s)", honoring dolt.auto-commit through the
context the way bd prune does).
Tests: an embedded direct-route CLI test (scoped sweep with a live and an
absent id, revision, one version commit, on_update once) and the proxied
reclaim integration test now asserts the revision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(roles): S9 review LOWs: one validator, field attribution, overflow bound
- The library's ValidateReclaimRequest is the one definition of a valid
reclaim: it now also refuses a blank assignee/label/label-any/exclude
entry, and every refusal but the id cap is a *issueops.ReclaimFieldError
naming its field. The httpapi handler no longer checks blank entries
itself; failReclaimErr names the member the role's error is about
(`ids` for the cap) instead of blaming `ids` for every validation. The
HTTP client's restatement matches, pinned field by field.
- older_than_seconds is refused at >= MaxInt64/1e9: that float rounds to
2^63 ns, which wrapped negative under the old > check.
- New contract case RunLeaseReclaimerRefusesABlankScopeEntry on all four
legs; handler tests for field attribution and the overflow boundary.
- CHANGELOG names the 1000-id cap on bd reclaim --id and is rewrapped; the
client's grace-window precision comment no longer claims exactness.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(roles): S9 review: regenerate the unsupported shell, cgo-tag the embedded contract, one actor spelling
- go generate ./internal/httpclient: the new accessor moves the partial-shell
trailer to 145 of 200.
- lease_reclaimer_contract_test.go gets //go:build cgo like its siblings, so
the pure-Go lane compiles.
- The library trims the actor before attributing, matching the handler, so
" alice " is attributed the same on every route.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(roles): S9 review minors: bound the reclaim actor on every leg, pin any_replica, validate before the uow
Review minors on #7412, each in code this PR adds.
- The reclaim actor lands on every reverted row's recovery event, in a
VARCHAR(255) column, but ValidateReclaimRequest never bounded it: a
256-character actor passed validation on the dolt, embedded-dolt and
unit-of-work legs and failed the sweep with the backend's own
"Error 1105: string '...' is too large for column 'actor'" on the first
row it would have reverted (all three legs answer exactly that with the
bound below removed). The shared validator now holds the trimmed actor to
types.MaxFieldLen, as claimIssueInTx does, so it is a *ReclaimFieldError
for `actor` on every leg. The HTTP client restates the rule, and the parity
test covers both sides of it. bd serve already refused it through the
claim's name rules. The role's Actor and REFUSALS docs name the bound, and
the conformance case runs it on all four legs.
- ValidateReclaimRequest's doc no longer says bd serve's handler leaves every
rule to it: it names the three wire rules the handler adds of its own.
- TestReclaimSendsAnyReplicaOnlyWhenAsked pins the one filter member that
widens a sweep: the client sends any_replica only when the caller set it.
- The unit-of-work leg validates before opening its unit of work, as the dolt
and embedded-dolt legs do; TestLeaseReclaimerRefusesBeforeOpeningAUOW pins
it.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
//cmd/bd:bd_proxied_test's 30-shard block was packed from a local capture
of each test's <testsuite time>, which for a t.Parallel test spans the time
it sat paused behind its shard's other tests. Cheap tests that waited
looked as heavy as the shard, so the "balanced" block ran 38-286s per shard
in CI (356s on rbe-west).
- scripts/ci/proxied_test_durations.json: re-measured on rbe-west (two
--nocache_test_results runs), each test's cost the sum of its leaf
tests' <testcase time>, averaged over both runs.
- Measured where a test's time goes: nearly all of it is
`bd init --proxied-server` against the shard's dolt sql-server (~2,000
statements, 81 DOLT_COMMITs, ~6-12 server CPU-seconds per init), one per
subtest. Top-level tests with ~20 such subtests ran up to ~350s alone,
above any shard budget, so the fifteen heaviest are split into two or
three top-level functions (TestProxiedServerUpdate/-UpdateB/-UpdateC,
...). Each subtest is moved verbatim; the split functions repeat the
original's preamble.
- 30 -> 44 shards, LPT-packed to <=430 cost-seconds per shard.
rbe-west, --nocache_test_results: before 30 shards, max 356s, 5,671
shard-seconds; after 44 shards, max 159s (median 138s), 5,883
shard-seconds.
Bead: ga-vnycm2.3
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Client-side loading and analysis is CPU-bound and gates every action in a
remote lane. Analysis-only measurements on Blacksmith (ga-vnycm2.8, seeded
runner cache, gazelle tools from the repository cache): bazel-test 25.6 s on
4 vCPU vs 16.3 s on 8; the other lanes 17-38 s on 2 vCPU vs 12-22 s on 4.
rbe-prewarm runs no Bazel client and stays on 2 vCPU (owner decision,
ga-vnycm2.12).
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): cut embedded/test lane long shards (served template, bulk seed, rebalance)
Embedded lane (bazel-embedded):
- RunBatchGetterAcceptsExactlyTheCap seeds its 1000 issues through a new
optional BatchGetterFixture.CreateIssues hook (one write) instead of 1000
single-row commits. Wired for the embedded, served and dolt-server legs;
the UOW leg keeps the per-row fallback. Same rows, same GetMany
assertions. TestBatchGetterContract 199s -> ~7s and
TestServedBatchGetterContract 204s -> ~7s on rbe-west.
- The served-surface harness (newServedEnv) copies one per-process,
freshly initialized reference workspace instead of initializing an
embedded Dolt schema per case, the same pristine-template pattern
internal/storage/embeddeddolt's tests already use (bd-7q32v).
//internal/httpclient:httpclient_served_test: 3,713 -> ~1,200
shard-seconds; 24 -> 16 shards; heaviest shard 390s -> ~108s.
- //internal/storage/embeddeddolt:embeddeddolt_embedded_test: re-measured
every test on rbe-west (scripts/ci/embedded_storage_test_durations.json)
and repacked 15 -> 20 shards (packed heaviest ~110s; was 352s in CI).
Test lane (bazel-test):
- //internal/httpclient:httpclient_test: unsharded (137-228s) -> 2 shards
(76s / 97s measured).
Bead: ga-vnycm2.3
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(dolt): seed the BatchGetter cap case without prefix validation
The dolt-server leg's shared test store is configured with prefix "test",
so the batch CreateIssues path's prefix validation refused the fixture's
bge-* ids (the per-row CreateIssue the other seeds use does not validate).
Bead: ga-vnycm2.3
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): shard //internal/storage/embeddeddolt:embeddeddolt_test 9 ways
At 8 round-robin shards one shard drew the package's three heaviest tests
(153s on rbe-west in this PR's test lane); 9 spreads them.
Bead: ga-vnycm2.3
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): serve gazelle's go_repository tools from the repository cache
Every bazel.yml lane starts from a fresh output base, and before any go_deps
repository can be fetched gazelle compiles fetch_repo and gazelle with
`go build` in @bazel_gazelle_go_repository_tools: 18-24 s of every 2 vCPU
lane's loading phase (the top ci-analytics repo_fetch entry in the
embedded, proxied, cmd-dolt and test lanes).
tools/bazel/go_repository_tools.bzl replaces that repository (override_repo
on gazelle's non_module_deps extension). The build is reproducible, so the
three binaries are pinned by sha256 per gazelle release, Go SDK and host.
The rule asks the repository cache for the pinned digests first (Bazel
re-hashes every hit, so a restored runner cache can only yield the pinned
bytes); on a miss it builds exactly as gazelle does, inside env -i, and
stores a matching build in the repository cache. An unpinned or stale
combination still builds from source and prints the digests to pin.
scripts/bazel_go_repository_tools_test.go keeps the pins in step with
MODULE.bazel's gazelle and go_sdk versions. The runner cache key already
includes MODULE.bazel, so the first push to main after this saves them.
Analysis-only (--nobuild) per lane on Blacksmith 2 vCPU, main vs this change
with a seeded runner cache (ga-vnycm2.8): test 54.0 -> 38.3 s, embedded
53.6 -> 31.1 s, integration 49.6 -> 35.2 s, doltserver 48.5 -> 33.0 s,
proxied 46.6 -> 31.6 s, server-storage 33.5 -> 17.3 s, cmd-dolt 50.3 -> 33.0 s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): pin gazelle's go_repository tools for Go 1.26.9 too
Ready for the next go_sdk bump (gascity#7387 moves to 1.26.9 for the
2026-10-08 advisories): the same binaries keep coming from the repository
cache instead of failing the pin test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gascity #7387 (Go 1.26.9 / x/net v0.60.0 advisories) re-pinned worker-env to
sha256:0c6c05c2...; rbe-west's pool workers advertise that, so every beads
remote-execution run since ~06:00Z stopped in the worker-env preflight.
Copied tools/rbe/worker-env.txt and the platforms/BUILD.bazel pin from
gascity main; tools/rbe/worker-env-sync main now reports in step.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gastownhall/gascity bumps Go to 1.26.9 for the 2026-10-08 stdlib
advisories (GO-2026-6599..6617). The shared rbe-west pool workers install
the Go named in gascity main's go.mod, so once that merges they advertise
a new worker-env. This is the byte-for-byte copy of gascity's
tools/rbe/worker-env.txt and its pin (tools/rbe/worker-env-sync); merge it
together with the gascity change or beads' remote actions stop scheduling.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): pin the slowest cmd/bd Dolt-server tests to their own shards
The cmd-dolt lane's wall time when its tests re-run is the bd_test race
compile plus its slowest shard. rules_go shards round-robin by test index,
so whichever shard drew TestSharedServerConcurrent and the TestInit*
family ran 117-170s while the median shard ran ~55s.
tools/bazel/go_test_pinned_shard.sh runs a go_test binary with the tests a
committed manifest pins (measured >= 5s, bin-packed longest-first by
tools/bazel/pin_shards.py) in shards of their own, and every other test in
the binary's own round-robin shards with the pinned set skipped, so each
test still runs exactly once and new tests need no manifest edit.
bd_dolt_server_test goes from 16 to 32 shards (16 pinned + 16 round-robin),
regression_test from 8 to 16 (10 + 6; its go_test becomes the manual
regression_suite binary behind an sh_test of the old name).
Pinning exposed a pre-existing order dependence: TestCLI_Import failed
whenever it was the binary's first test, because runBDInProcess reused the
workspace discovery an earlier in-process execution cached and `bd init` in
a fresh directory resolved the previous one's .beads. The in-process
runners now reset beads/git discovery caches per execution.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): pin cmd/bd Dolt-server shards from two measured runs; regression in 14 shards
The bd manifest now takes each test's slowest of the 16- and 32-shard runs
(pin_shards.py over both), and regression_test drops to 10 pinned + 4
round-robin shards: its unpinned tests total ~128s, so 6 round-robin
shards were mostly fixed cost.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(scripts): place the pinned-shard tests by what they read (#7414 split)
The manifest-name scan reads every cmd/bd and tests/regression _test.go
file, so it moves to go_test_sources_test (with tests/regression's
manifest); the wrapper, generator and wiring checks stay in scripts_test.
Shared helpers live in a helpers-only file both targets compile, and
repoFiles takes #7414's minimum-file count.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): split //scripts:scripts_test by what it reads; partition //:repo_files
//scripts:scripts_test declared //:repo_files (the whole checkout), so every
PR re-ran it, and it took ~181s on rbe-west. Most of that (60-79s) was
TestBazelGatedLanesNeverRetryFlakyTests line-regexping the --run_under
wrapper's pinned dolt binary (tools/bazel/hermetic_bin/dolt, in every
test's runfiles); it now skips binary files, as git grep -I does.
tools/bazel/go_srcs.py's per-package repo_files block now partitions each
package's files into repo_go_srcs, repo_go_test_srcs, repo_doc_files and
repo_other_files, aggregated at the root; //:repo_files is their union
(same 4679 files). The //scripts tests are split into go_test targets by
what they read (traced per test with strace over a runfiles-shaped tree):
scripts_test CI/Bazel policy: //:repo_other_files (+1 Go file)
shell_scripts_test script fixtures: //scripts files, a few root files
go_test_sources_test _test.go scans: //:repo_go_test_srcs + shard files
go_sources_test check-testing-short.sh: every .go file
tracked_files_test every tracked file: //:repo_files
Shared helpers move to helpers-only files; TestScriptsTestTargetsPartition-
TheTests fails on a test file in no target or in two. //test/docsync and
the //scripts/repochecks slices declare partitions or single files instead
of //:repo_files where they can.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): skip only the non-checkout hermetic_bin dir in the flaky-retry walk
Skipping every binary file also stopped scanning tracked binaries (images,
.binpb fixtures). Skip just tools/bazel/hermetic_bin, the --run_under
wrapper's runfiles directory, which is not in the checkout, so the walk's
coverage of tracked files is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpclient): carry DepAddItem.HasSpawner/ThreadID over the wire
The http leg's batchApply wire shape dropped a dep_add item's HasSpawner
and ThreadID fields -- an edit the caller believed landed. Extend the
wire body (ApplyDepAddItem.has_spawner/thread_id), gate sending either
field on a new additive behavior capability
(issues.batchApply.depAddLineage / CapBatchApplyDepAddLineage) so a
client refuses locally before dialing an older server instead of
silently dropping graph lineage, and wire the storage-layer spawner-id
stamping (StampWaitsForSpawnerID) through both the dolt and uow legs
that already had the fields but never stamped them. wire_revision and
min_client are unchanged; the golden digest and openapi spec are
regenerated.
Also fixes three generic bijection/vocabulary gates this change was
missing: write_ledger_test.go's applyBatch/item/dep_add carriage table,
and the literal behaviorCapabilities lists in
internal/httpapi/server_test.go and
internal/httpclient/wire/vocabulary_test.go.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient/wire): pin the item-count gate at 356 items
Add TestApplyBatchAt356ItemsWithoutTheCapabilityRefusesBeforeDialing,
exercising internal/storage/batchfixtures.Shape356's exact item count
-- the design's primary measured large-batch-apply shape -- rather than
only the floor+1/ceiling+1 boundaries the existing cases pin. The gate
is content-agnostic (it never looks past len(body.Items)), so a
synthetic plan here is behaviorally identical to a real Shape356 plan
for this one check; realistic-content coverage follows in the next
commit.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient): prove a 356-item Shape356 plan commits atomically or leaves zero rows
Add two tests against the real served stack using
batchfixtures.Shape356's realistic, heterogeneous content (102 creates,
136 blocks edges, 102 tracks-to-root edges, 16 assign updates):
- TestServedBatchApplyShape356CommitsAtomically applies the full plan
once and verifies every create landed with a bound key, matching the
issues table row-for-row.
- TestServedBatchApplyShape356PlusAStaleGuardLeavesZeroRows appends a
357th item guarding the pre-existing root issue with a deliberately
stale ExpectedVersion. Because the root is untouched by the other 356
items, this exercises the real server-side precondition_failed round
trip (rather than the static same-request-row ErrValidation rule),
asserting errors.Is(err, issueops.ErrVersionMismatch) and that none of
the 356 creates landed -- the "never chunk" ceiling: an all-or-nothing
request that fails on its last item must leave nothing behind.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient): close S5 review HIGH findings (lineage gate, thread_id, gc mappings)
2026-10 Opus review on the S5 batch-apply slice found the wire change
correct but coverage missing:
- HIGH-1: refuseUnservedDepAddLineage (batchapplier.go) had no coverage
at all -- deleting it passed every existing test. Add a test pinning
that HasSpawner or ThreadID on a server without
issues.batchApply.depAddLineage refuses *storage.ErrUnsupported
before dialing, and that a plan touching neither field still dials.
- HIGH-2: thread_id was never asserted end to end. Add
RunBatchApplyCarriesThreadIDOntoTheStoredEdge to the shared
conformance package, wire it onto the dolt, embeddeddolt and uow
legs, and add the http leg's own case
(TestServedBatchApplyCarriesThreadIDOntoTheStoredEdge), which is the
one case that proves the field survives both the client's encode and
the server's decode at once.
- HIGH-3: DESIGN Sec 3.8 ("Guarded writes: no new roles") documents two
gc mappings onto BatchApplier that had no coverage: an update carrying
a metadata patch plus ExpectedVersion followed by a close in one
request (CloseWithMetadataIfMatch, atomic -- a stale version leaves
zero changes), and a keyed create/MetadataRefs/dep_add
(parent-child included)/trailing-update plan (ApplyGraphPlan). Document
both compositions on the BatchApplier interface and add http-leg tests
for each.
Mutation-verified: removing the lineage gate call, dropping thread_id on
the client's encode, and dropping it on the server's decode each now
fail a test that previously passed unconditionally.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): nil-guard snapshot consumers, fix spec wording, sync Bazel
2026-10 Opus review MED/LOW findings on the S5 batch-apply slice:
- LOW-6: Store.snapshot returns (nil, nil) when a Store has neither a
wire nor a cached handshake. Store.Counter() does not call roleWire
first (unlike Sweeper/BatchApplier), so this is reachable through the
ordinary public accessor and a scoped count would panic on
snap.Capabilities. Nil-guard every snapshot() consumer
(batchapplier.go, counter.go, sweeper.go) so a nil snapshot is treated
as "nothing advertised" and falls through to the capability refusal.
Add TestCounterRefusesScopeGracefullyWithNoTransportAndNoSnapshot,
mutation-verified to panic without the guard.
- LOW-7: the ApplyDepAddItem spec comment said an old server would
"silently ignore" has_spawner/thread_id; it answers its own 400 for
an unknown member. Fix the wording and regenerate apigen/types.gen.go.
- MED-4: internal/httpclient/BUILD.bazel was missing
served_batch_apply_large_test.go, expected_revision_contract_test.go,
served_dualwrite_history_test.go and the
//internal/storage/batchfixtures dep. Sync with gazelle (confirmed
idempotent) and go_srcs.py --check.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(storage): carry thread_id on a same-type dep re-add; bound batch thread_id
A same-type re-add of an existing dependency compared and rewrote only
metadata, so on both write legs (issueops.addDependencyInTx and the uow
dependency repository) a re-add naming a new ThreadID was read as
change-free and the thread was dropped, and a metadata-plus-thread re-add
stored the metadata without the thread. Both arms now read the stored
thread_id through one shared rule, issueops.ReAddedDependencyThread: a
named thread the row does not carry is a change (UPDATE, replacement-edge
journal entry, exactly one version, #5898 leg 2), and a re-add naming no
thread keeps the stored one, so callers that never carry a thread cannot
erase it. The journal's EventDep has no thread member, so a thread-only
re-add journals the same payload as the original add; the source's version
snapshot is what records the new thread, and the comments on both arms now
say so instead of promising a complete replacement edge.
planApplyBatchDepAdd bounds DepAddItem.ThreadID with CheckFieldLen, so an
over-long thread id is ErrValidation before any database work on every
leg, as the http leg's decode already refuses it, instead of an opaque
mid-transaction "string too long" on the local legs. Only the length bound
is shared: the http leg's control-character refusal stays http-only.
The HasSpawner/ThreadID docs now name the producer that actually sets
HasSpawner (an embedder lowering a graph plan, e.g. gc's ApplyGraphPlan
mapping) instead of bd create --graph, and drop the CHANGELOG reference
that had no entry behind it.
New conformance cases, wired on dolt, embeddeddolt, uow and served:
RunBatchApplyCarriesThreadIDOntoAnExistingEdge,
RunBatchApplyRefusesAThreadIDLongerThanItsColumn and
RunDependencyEditorSameTypeReAddWithChangedThreadMintsOneVersion.
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>
* ci(shards): add the re-add thread test to the embedded storage shard manifest
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci: trigger the first PR CI run now that the base is main
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): gate has_spawner to waits-for edges; refuse empty thread_id
Review iteration 1 fix-up for #7265 (synthesis F1, F2, F4, F5, F6, F7).
F2: the client's CapBatchApplyDepAddLineage gate refused HasSpawner on
every edge type, but the role reads the flag on a waits-for edge only
(StampWaitsForSpawnerID is a no-op off one). An embedder plan setting it
on, say, a blocks edge works against every existing server, yet this
client refused it during a mixed-version rollout. depAddNamesSpawner now
holds the role's own rule: the flag is gated and encoded on a waits-for
edge only, and dropped elsewhere, which loses nothing the role would
store. ThreadID stays gated on every edge type, since a thread is stored
on all of them. The "spawner flag on any other edge type" subtest is
restored to an unadvertising server and now also asserts the flag is
dropped from the body, and
TestApplyBatchRefusesUnservedDepAddLineageBeforeDialing gains a
ThreadID-on-blocks case. The W-DepAddItem.HasSpawner ledger row and the
regenerated engdocs/design/http-divergence-ledger.md say the same.
F5: the document gives thread_id minLength: 1, but the decoder read an
empty string as no thread. applyDepAddItem now refuses a present, empty
thread_id with 400 invalid_value naming items[i].dep_add.thread_id, as
it does an empty type; an absent one still names no thread. New
TestApplyBatchRefusesAnEmptyThreadID; the documented-body test now
forwards has_spawner and thread_id as well.
F1: bd create --graph does set HasSpawner (buildGraphApplyBatchRequest,
on the embedded and proxied legs, since #7209), so the DepAddItem doc
names both producers again and the conformance doc's CHANGELOG pointer
is restored; the [Unreleased] entry behind it is on the base.
F4: the CapBatchApplyDepAddLineage comment said an older server would
silently drop the members; it answers either one with
400 invalid_argument/unknown_parameter.
F6: the create-edge ledger comment said no operation publishes a thread
member; batch apply's dep_add item now does.
F7: TestServedBatchApplyGcApplyGraphPlan adds a waits-for item carrying
HasSpawner and ThreadID and reads the stored row back, pinning
metadata.spawner_id to the resolved spawner and the thread on the
served leg.
F3 (the journal's EventDep carries no thread member) is not addressed
here.
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 Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* perf(git): locate the repository in-process instead of running git rev-parse
Every bd invocation resolved the process-wide git context (beads directory
discovery reads it) with `git rev-parse --git-dir --git-common-dir
--show-toplevel`: one git subprocess per bd call before any work. Tools that
call bd hundreds of times (gascity's doctor issues ~250 bd calls per run)
paid it on every call.
On Linux, initGitContext now first runs discoverGitInProcess, which mirrors
Git's discovery walk (physical cwd, .git as directory or gitfile, bare-dir
check, filesystem-boundary stop) and produces byte-for-byte what rev-parse
prints for ordinary repositories (top and subdirectories), linked worktrees
(absolute or relative gitfile, symlinked targets), submodules (core.worktree
pointing back at the gitfile's directory), nested repositories and no
repository. Both answers feed one shared normalization
(gitContextFromRevParse), so downstream values are unchanged.
It declines, and git runs exactly as before, whenever it cannot prove the
answer: GIT_DIR / GIT_WORK_TREE / GIT_COMMON_DIR / GIT_CEILING_DIRECTORIES /
GIT_DISCOVERY_ACROSS_FILESYSTEM / GIT_OBJECT_DIRECTORY / GIT_CONFIG_PARAMETERS
/ GIT_CONFIG_COUNT in the environment; a symlinked .git, an invalid gitfile
or git directory, a cwd inside a git directory; repository config with
core.worktree (other than the submodule shape), core.bare, extensions,
include directives, a format version above 1 or unmodeled syntax; any path
not owned by the effective uid (safe.directory is git's to evaluate), or
root under sudo. darwin and windows keep the subprocess (case folding and
ownership semantics).
Tests compare discoverGitFrom with real `git rev-parse` output across those
layouts, pin every decline case, and check the resulting cached context
equals the subprocess-derived one.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(cli): resolve the git user.name actor fallback only when needed
PersistentPreRunE assigned `actor = getActorWithGit()` for every command,
which, with no --actor / BEADS_ACTOR / BD_ACTOR / config actor, runs
`git config user.name`: the second git subprocess of every bd call, paid
by read-only commands that never consult the actor.
The pre-run now calls deferActorGitFallback, which marks an empty actor as
pending; currentActor (and getActorWithGit, getActor) resolve it on first
use with the unchanged priority order and store it in the global and the
CommandContext copy, as the eager assignment did. Command code reads the
actor through currentActor() instead of the raw global (a mechanical
rewrite of every read site the compiler reported; writes, the flag binding
and the pre-run config binding keep the raw variable). setActor cancels a
pending fallback. The telemetry span's bd.actor attribute is still set, but
only for a recording span, so a noop span does not force the lookup.
With the in-process repository discovery from the previous commit, a
read-only `bd list` / `bd show` now starts no git process at startup, in
the main checkout and in a linked worktree; a write asks git for user.name
once (bd create previously asked once, now still once) and records the same
value. Measured on 50 sequential `bd list` calls: 100 -> 0 git execs
(embedded and proxied-server workspaces, main checkout and worktree).
TestEmbeddedReadOnlyCommandsSpawnNoGit counts git execs through a PATH shim;
TestDeferredActorGitFallback pins the deferral semantics.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(git): decline in-process discovery on any config line git might read differently
Review follow-ups to the in-process repository discovery.
- The repository config scanner was looser than git: a config starting with
a UTF-8 BOM followed by `[core] worktree = /other` made git report /other
while discovery returned the cwd repository, and `[ core ]` or `!!! = x`
(which git refuses) were accepted. scanGitConfig (gitconfig_linux.go) now
skips a leading BOM exactly as git does and accepts only a narrow grammar:
blank/comment lines, `[section]` / `[section "sub"]` headers at column 0,
and `key` / `key = value` lines inside a section, with values free of
backslashes and unbalanced quotes. Any other line declines to git.
- Walk from getcwd(2) (syscall.Getwd), as git does, instead of os.Getwd,
which trusts $PWD when it names the same inode (bind-mount aliases).
- Resolve relative gitfile and commondir targets without filepath.Join's
lexical Clean, so "link/.." resolves physically like git's realpath.
- A mount-boundary stop reports its own reason in the not-a-repository
error.
- Tests: every decline case (BOM + core.worktree, malformed headers and
keys, keys before a section, escapes, continuations, bare repositories,
a commondir inside .git, ...) now also checks that what startup derives
equals git's answer; BOM and CRLF/comment configs are equivalence cases;
the no-repository case must be answered in-process instead of skipping;
a $PWD alias test pins the getcwd walk.
- The exec-count test drops every GIT_* variable except the config-file
selectors, so a runner exporting GIT_CONFIG_PARAMETERS & co. cannot make
it fail spuriously.
- Comment the two places that touch the raw actor before the deferral.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(backup): decide embedded auto-backup's git-remote probe without git
In an embedded workspace whose backup.enabled is unset, maybeAutoBackup
asks isBackupAutoEnabled -> primeHasGitRemote after every command, reads
included. That built a RepoContext (`git -C .beads rev-parse
--git-common-dir`) and ran `git remote`: two git processes per read even
after the startup calls were gone. The throttle cannot short-circuit it:
without a remote no backup ever runs, so there is no backup state to
throttle on.
Both probes are now answered in-process when provable, and the subprocess
remains the fallback, so the decision and every warning/notice downstream
of it are unchanged:
- internal/beads getGitCommonDirForPath uses git.CommonDirInProcess (the
discovery walk from the given directory, git's spelling).
- primeHasGitRemote uses git.HasRemoteInProcess in the same directory
primeGitCmd would run git in (primeGitDir, factored out). It answers only
when every config file `git remote` reads -- system (GIT_CONFIG_SYSTEM, or
/etc/gitconfig and <prefix>/etc/gitconfig of the git on PATH), global
(GIT_CONFIG_GLOBAL, or XDG and ~/.gitconfig) and the repository's own --
is absent or within scanGitConfig's grammar and include-free, no
GIT_CONFIG_PARAMETERS/COUNT/GIT_CONFIG or discovery override is set, and
no legacy .git/remotes or .git/branches entries exist. A remote seen only
in a system-config candidate declines. Remote names outside
[A-Za-z0-9._-] decline.
Tests compare HasRemoteInProcess with `git remote` (no remote, local,
worktree, submodule, remote.pushDefault only, global remote, no repo) and
pin the declines (global include, malformed global, command-line config);
CommonDirInProcess is compared with `git -C dir rev-parse
--git-common-dir`. TestEmbeddedReadOnlyCommandsSpawnNoGit now runs with
backup.enabled at its default, with and without a git remote, and still
expects zero git processes for list/show.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(gate): resolve a bead gate whose awaited bead no longer exists (wy-dgfuiu)
A gate with await_type=bead whose awaited bead has been purged could never
resolve: GetIssue returns storage.ErrNotFound (or a wrapped sql.ErrNoRows)
against real storage, checkBeadGate returned (false, "bead gate %q: %v"), the
bead arm of evaluateGates never sets r.err, and applyGateCheckResults fell to
the "pending" arm with exit 0. The gate stayed pending forever.
Treat a missing bead as resolution, reusing the existing gateProxiedNotFound
predicate so a genuine backend or transport failure still stays pending.
close.go shares checkBeadGate and inherits the fix.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MjQHZQoR8qZTaNj2QTZokr
* fix(gate): resolve a deleted bead gate target only after a local sighting
Review fixes for #6395 (adopt-pr iterations 1 to 5).
The PR resolves a bead gate when its awaited bead no longer exists, but
the lookups it relies on turned a routing failure into not-found: the
direct getter (getIssueWithRouting) and the proxied getter both returned
the local miss when a prefix-routed rig could not be read, so an OPEN
bead in an unreachable rig resolved its gate and unblocked the step. An
await_id that never named a real bead (a typo, a short ID) also resolved
on the first check.
- A miss outside this rig's own store is errBeadGateTargetUnconfirmed: a
matched routes.jsonl route whose rig fails or does not return the bead,
an unreadable routes.jsonl, or the contributor auto-routed store. The
gate stays pending and the reason names the cause. inspectBeadGate
tests it before not-found, because the wrapped routing error can itself
be a not-found. Only this rig's own absence counts as gone.
- bd gate check resolves a gone target only if an earlier check saw it in
this rig. The first local sighting stamps await_seen=<await_id> in the
gate's metadata (an OpSetMetadata merge, so other keys survive, and
retargeting the gate invalidates it). A target that is gone and was
never seen stays pending with "no earlier gate check saw it; check the
await_id, or close the gate with bd gate resolve". A bead read through
a route is never stamped, so a misdirected route cannot arm a later
local miss. A failed stamp write is an error row, like a failed gh:run
await_id persist.
- The proxied getter reads the target with workapi.GetIssueOrWisp (the
issue use case alone never returns a wisp), stamps inside the apply
transaction, and never auto-routes.
- bd close applies the same rule (evaluateBeadGate, recording no
sighting): a gone bead satisfies the gate only if an earlier check saw
it, so closing a gate on a typo'd await_id still needs --force.
- bd close reads the awaited bead from the store that owns the gate
(RoutedResult.Store), as bd gate check in that rig would. Read from the
launcher's store, a routed gate whose awaited bead only its own rig can
reach (no route for it from the launcher) saw that open bead as missing
and, its sighting recorded, closed without --force. The proxied-server
route keeps the fresh-read getter (#5861).
- bd rename and bd rename-prefix (both the rename loop and --repair) point
a bead gate at its bead's new ID, keeping a <rig>: prefix and carrying
the sighting. UpdateIssueID rewrites text references but never
await_id, so a seen bead's rename read as a deletion and resolved the
gate on its next check.
- UpdateIssueID also commits on its own, so a retarget written after it
left a window, or after a failure a lasting state, where the gate held
a sighting of an ID that no longer existed and resolved while its bead
was open under the new ID. All three paths now rename through
renameIssueKeepingBeadGates, which orders the writes so no state in
between resolves a gate: it moves await_id to the new ID while the
sighting still names the old one (dropping, in the same write, a
sighting that already names the new ID), renames the bead, and then
records the sighting under the new ID. A check in between finds a
never-seen ID and stays pending. If moving a gate or renaming the bead
fails, the gates are pointed back at the old ID without a sighting,
since a failed write may still have landed, and the rename fails:
bd rename exits non-zero instead of warning from its text-reference
loop. Losing only the final sighting write is a warning; the next
check records the sighting again.
- A check lists the gate before it looks the bead up, so a rename landing
in between left it holding a copy that still waited on the old ID with
its sighting: the old ID was gone, and the check closed the gate while
the bead was open under its new ID. Once the bead is found gone,
evaluateBeadGate reads the gate back from its own store
(rereadBeadGate) and resolves only if the stored gate still waits on
the same await_id and still records the sighting. The rename moves the
gate before the bead takes the new ID, so a read made after the miss
sees the move. This covers bd gate check, its proxied route and
bd close; a gate that cannot be read back, or is found only through a
route, stays pending.
- checkBeadGate, the target lookup without the sighting rule, had no
production caller left and read like the bead-gate rule, which is how
bd close came to skip the sighting. It moves into the tests;
inspectBeadGate carries the lookup contract and points callers at
evaluateBeadGate.
- The gate check help, docs/workflows/gates.md and the CHANGELOG describe
the rule, including that a rename does not read as a deletion to a
check or bd close that read the gate before it, and that a rename that
fails partway leaves the gate pending without a sighting; the #6404
entry no longer says a routed read failure reads as not-found. The
CHANGELOG also warns that a rename by an older bd does not move the
gate, so once a check has seen the bead, the next check or bd close
after that rename closes the gate while the bead is still open:
upgrade the clients that rename beads together with the ones that
check gates. docs/cli-reference is pinned to v1.2.2, so it is
unchanged (generate-cli-docs.sh --check passes).
Tests: TestCheckBeadGate_UnconfirmedMissStaysPending,
TestEvaluateGates_BeadGateSightingRule, TestEvaluateBeadGate_*,
TestBeadGateSeenUpdate_KeepsOtherMetadata, TestBeadGateTargetSeen,
TestProxiedFreshReadGetter_LocalMissFollowsRoutes,
TestRoutedBeadGateGetter_ReportsWhereTheAnswerCameFrom,
TestCheckGateSatisfaction_BeadGateNeedsASighting,
TestCloseDirectPreflight_BeadGateReadsTheGatesOwnStore,
TestCloseBeadGateGetter_RouteSelection, TestBeadGateRetargetUpdate,
TestPlanBeadGateMoves, TestRenameIssueKeepingBeadGates and
TestRenameIssueKeepingBeadGates_FailedWritesResolveNoGate, which fails
each write of a rename in turn, landed or not, and evaluates every gate
after each write, both as stored and as a concurrent check listed it
before the rename (unit); the unreadable-rig step of
TestCheckBeadGateCrossRigPrefixRoute,
TestRepairPrefixesRetargetsBeadGates (gates renamed before and after
their bead) and TestRenameFailureLeavesBeadGatesPending (bd rename,
--repair and rename-prefix with a failing UpdateIssueID, landed or not)
(cgo);
TestEmbeddedGateCreate/check_bead_gate_resolves_only_a_missing_target_it_saw
and /rename_keeps_a_bead_gate_on_its_target (embedded);
TestProxiedServerGateCheck/bead_gate_resolves_when_seen_target_is_deleted
and /bead_gate_never_seen_target_stays_pending (proxied). Reordering the
unconfirmed case after not-found, dropping the sighting condition,
swallowing the routed error, stamping routed sightings, or matching any
stamp regardless of await_id each fails these tests, as do closing with
the sighting-blind lookup, reading the launcher's store on close,
dropping the carried sighting or the rig prefix on a retarget, dropping
the retarget from bd rename, the rename-prefix loop or --repair,
renaming the bead before moving its gates, keeping the sighting when
moving a gate back, keeping a stale sighting of the new ID, skipping
the final sighting write, resolving a gone bead without reading the gate
back or from a gate read back that moved, lost its sighting or was found
only through a route, or reporting an unconfirmed read-back as an error
or an unreadable gate as pending.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* feat(httpclient): wire the S4 Sweeper extension (wisps-plane, live-dependent protection, limit)
Publish SweepRequest.ProtectLiveDependents and .Limit (plus a
wisps-plane tier and SweepResult.Remaining/.LiveDependent) on the v0
wire behind three new behavior-capability tokens
(issues.sweep.wispsPlane, issues.sweep.liveDependents,
issues.sweep.limit), and wire the client to send them once the
handshake advertises the tokens (refuseUnservedSweep otherwise).
Retire the two W-SweepRequest ledger rows that previously refused
these fields for lack of a wire member.
CurrentWireRevision stays at 2. A new wisps-plane SweepRequest.Tier
value is a request-only enum widening: it cannot cause an older
client to misdecode a response, and it is already gated by its own
capability token, so it is additive rather than a wire break. Teach
wireshape's drift gate that distinction directly: a Digest.Sides side
channel records whether each schema member is request-only,
response-only or both, and widensAdditively now treats a request-only
enum's new value as additive while still treating any response-side
widening as breaking, with tests pinning both directions and a
regenerated golden.json. min_client_wire_revision stays 0.
internal/httpapi/apigen/types.gen.go and openapi.v0.yaml's comments are
regenerated/updated to match (make api-gen).
Six served Sweeper contracts that were parked now run for real against
the in-process HTTP server; TestSweepSendsTheS4MembersOnceTheServerAdvertisesThem
pins the capability-gated encode.
Re-review fix: walk()'s side classification short-circuited on a
name-only visited set, so a node already walked from one side never
had its CHILDREN walked again when a later path promoted the parent
to "both" — children stayed classified under whichever side reached
them first, order-dependent on Go's map iteration. Side recursion is
now guarded per (schema, side) pair (sideWalked, keyed on
name+"\x00"+side) instead of per schema name alone, so a child
reachable from both sides is always walked, and therefore recorded,
from both. Added TestSidePropagatesToNestedChildren (a named grandchild
and an inline nested child both reachable from a request body and,
via a wrapper, a response, assert "both" on every level and that
widening either enum breaks instead of being classed additive),
TestEnumWideningOnSharedNestedChildIsNotAdditive, and
TestComputeFromSideAssignmentIsDeterministic (200 runs, asserts
identical Sides/Entries every time). golden.json is confirmed
unchanged by the fix (regenerated and diffed byte-for-byte). Also
removes a bd-enterprise mention introduced in this slice's own
write_ledger_test.go comment (not a provenance header) in favor of
neutral wording.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(storage): ratchet the http leg's role-contract ceiling to zero
Classify all 42 previously-ceilinged http-leg entrypoints and clear
the ceiling:
- ExpectedRevision + Refusal (10): wire a Phase-0 all-nil fixture,
matching every other backend's current (unbuilt-CAS-feature) state.
Said honestly: these ten entrypoints are counted here, the hook is
unbuilt on every leg (not just this one), and every case runs zero
assertions until a CompareAndSetVersion wire operation exists for
this client to bind.
- Lifecycle ExpectedVersion concurrency (4): wire the two races that
land on Priority/Notes and on Close for real over the served HTTP
harness (precondition_failed decodes to storage.ErrVersionMismatch
via errors.Is, same as the local legs). The other two, which race
IssuePatch.SpecID/.AwaitID/.Owner edits against updateIssue, stay
waived, but PENDING rather than permanent: IssuePatchBody refuses
those three fields outright (W-IssuePatch.SpecID/.AwaitID/.Owner,
D8 refuse-not-drop) rather than ever sending them, so the race never
reaches the wire today. Closing the gap means publishing those
fields on the wire, tracked as a follow-up slice, S4b: publish
owner/spec_id/await_id on the wire.
- DualWrite (6): wired for real instead of waived. Mutate and
MutateAsNoOp drive the client's Lifecycle role (Create/Update)
against an in-process served harness with its own reference store,
so VersionedHistoryConfigurer can be toggled per fixture;
CurrentRevision, VersionRowCount and LatestVersionAttribution read
the reference store's raw columns the same way every other served
fixture's postcondition hooks do. All six FR-1/FR-2/FR-3/FR-5/FR-7
cases (one version row per accepted mutation, no-op skip, atomic
attribution, current_revision parity, and flag-off producing no
rows) now run and pass.
- VersionReconciler + InitVerifier (13), and the raw
IssueOperationsUpdate seam (3): waived — unservable over a typed
HTTP role boundary, not a wiring gap.
adoptionCeiling: 42 -> 0 for the http leg; the "adopting" field is
removed (a zero ceiling with a reason is a registry error) since every
remaining gap is now a named waiver, PENDING or permanent as stated
above, instead of a budgeted unnamed one. Also deletes the scratch
zzz_dump_missing_test.go used to enumerate the ceiling during triage.
Re-review fix: the shared conformance attribution case only asserts
change_actor is non-empty (it runs across every leg, each with a
different literal Mutate actor). The http fixture's own Mutate always
sends Actor: "writer", so this leg's AttributionIsRecordedWithTheMutation
subtest now also mutates a second, independent issue and asserts the
recorded actor equals exactly "writer", in addition to the shared
non-empty check.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(types): make ParseRevisionToken the exact inverse of FormatInt
ParseRevisionToken's doc comment already promised it accepts exactly
what RevisionToken emits, but strconv.ParseInt alone is looser than
that: besides a leading "+" that FormatInt never produces, it also
accepts a leading zero on a digit string longer than one character
("007") and the literal "-0" — none of which FormatInt ever emits
(FormatInt(0, 10) is always "0", never "-0", and it never pads a
digit run). A caller is only ever supposed to echo a token a response
carried, so any of these is a client that invented a value rather
than a server this client should follow; reject them explicitly
instead of accepting them silently.
Pins the string<->int64 boundary with
TestParseRevisionTokenRejectsMalformedTokens, covering empty strings,
fractional/exponent spellings, leading "+", surrounding whitespace,
non-decimal bases, one-past-int64-boundary values, non-ASCII digits,
and now "007", "-007" and "-0".
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fixup(wireshape): guard widensAdditively against "no enum before"
bee-ghosttrack / CHANGES_REQUESTED on #7251: widensAdditively required
len(new.Enum) > len(old.Enum), which holds vacuously when the old side
has no enum at all (a free `type: string`). That let a request-only
member go from unconstrained to a fixed enum at the same wire_revision
-- the opposite of widening, since the server now 400s a value an old
client could send yesterday.
Add the guard `len(old.Enum) == 0 || len(new.Enum) <= len(old.Enum) ->
false` so the no-enum-before case falls through to the ordinary
non-additive Changed path, same as a strict narrowing. Add a pinning
case to TestEnumWideningAdditivity and extend the doc comment.
Also reword the ExpectedRevision contract file comment from "runs ZERO
assertions" to "SKIPS", per the reviewer's note that the Run* helpers
t.Skip when CompareAndSetVersion is nil -- it's a skip, not an
assertion-free run.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(httpclient): regenerate the divergence ledger after rebasing onto #7247's review fixes
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(httpclient): Sweep Limit now refuses on the missing issues.sweep.limit capability
#7247's review round pinned Sweep{Limit} as an encoder refusal. With S4 the
wire carries limit behind issues.sweep.limit, so against a server without
the token the refusal is a pre-dial capability refusal: still
*storage.ErrUnsupported for this backend, now naming the capability.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpapi,httpclient): name the invalid_value refusal; add tests to Bazel
Maintainer fixup for the review of #7251 (iteration 1). There are no blocker or
major findings. This applies the three optional findings that both reviewers
reported.
- Eight comment and description sites added by this PR say that an older
server refuses an unpublished `tier` (or S4) member with `unknown_value`.
No such reason exists. The server refuses with ReasonInvalidValue =
"invalid_value" (internal/httpapi/problem.go), and sweep.go uses it for a
bad tier. The sites are in openapi.v0.yaml, apigen/types.gen.go (regenerated
by `make api-gen`), routes.go, sweeper.go and wire/handshake.go. The base has
none of them, so this only corrects the PR's own text. A client author now
matches the token the server actually sends.
- wire/handshake.go said the tier member carries no ledger row because it
"narrows" an existing enum. Adding a value widens the accepted set, so the
word is now "widens".
- internal/httpclient/BUILD.bazel: add expected_revision_contract_test.go and
served_dualwrite_history_test.go to the httpclient_test srcs. Both files are
new in this PR. Without the entries, `go test` runs them but no Bazel lane
compiles them. The srcs list now matches the package's files, and the
existing deps already cover their imports.
Provenance: this is the residue of the stranded fixup cad1cf02a2 from the
previous adoption of this PR, replayed onto the current head. Its patch-id
(b62e7d6d5562) is identical to that reviewed residue. That fixup's
widensAdditively guard and SKIP-message nit are not repeated here. The author
already landed both in b3f1516e55 (d41f317e0a after the rebase).
Validation: git diff --check; make api-gen (no-op) and make api-check;
go build, go vet and gofmt on internal/httpapi/... and internal/httpclient/...;
go test for internal/httpclient/wire, internal/httpclient/encode and
test/docsync; the httpclient Sweep* and TestExpectedRevisionContract tests; the
served dual-write tests with BEADS_TEST_EMBEDDED_DOLT=1; and
tools/bazel/go_srcs.py --check.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(httpclient): regenerate the divergence ledger on main after #7247 merged
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): give encode_test the httpclient tests its pin check reads
Maintainer fixup for the pre-review CI of #7251. Bazel / test and
Bazel / integration (PR run 37781419956) each fail one target,
//internal/httpclient/encode:encode_test, which also fails CI Gate / Required.
TestLedgerRowsAreWellFormed reports that rows W-SweepRequest.ProtectLiveDependents
and W-SweepRequest.Limit are pinned by
TestSweepSendsTheS4MembersOnceTheServerAdvertisesThem, which is "neither a test
in this package nor a TODO(<bead>)".
The pin is right. The test lives in internal/httpclient/bulk_roles_test.go.
testFunctionsInThisPackage collects test names from ".", ".." and
../../../cmd/bd, but the data of encode_test declares only its own sources,
//cmd/bd:go_srcs, the ledger doc and the OpenAPI spec. Under Bazel, ".."
exists in the runfiles but holds no _test.go files, so the walk silently finds
nothing there. go test reads the real directory and passes. This PR changes
neither the walk nor the BUILD file. Every pin on main resolves from this
package or cmd/bd, which is why main is green. These two rows are the only ones
pinned to a test that exists only in internal/httpclient. The red stayed hidden
until now because the PR sat on a stacked base. PR CI, including the Bazel
lanes, runs only for PRs against main, release/** and hotfix/**.
Declare //internal/httpclient:go_srcs as data, so Bazel sees the files that
go test reads. The filegroup already exists with //:__subpackages__ visibility.
The pins stay on the test that actually covers the S4 members.
Validation: bazel test //internal/httpclient/encode:encode_test --config=ci
--nocache_test_results, run two ways. In the local processwrapper sandbox
(--remote_executor= --strategy=TestRunner=processwrapper-sandbox) the same
command fails both rows without this change and passes with it. It also passes
on the remote executor. Plus tools/bazel/go_srcs.py --check, gazelle
-mode=diff on the package (no change), git diff --check, and
go test ./internal/httpclient/encode/.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(httpapi): pin the S4 sweep members at the wire edge, gate golden sides
The `sides` map this change adds to golden.json predates schemas main gained
since (#7248's BatchGetIssue*, BatchGetIssuesRequest* and
BatchGetIssuesResult*, plus IssueDetails.gated_by[]), so the rebase left it 9
schemas short of what gendigest writes, and goldenDrift never compared Sides,
so nothing noticed. Regenerated (+9 sides lines, no entry changes), and
goldenDrift now fails with the regenerate instruction when the golden's sides
disagree with a fresh digest; TestGoldenDrift drives that arm three ways.
The SweepSkips description still called the first two buckets protections
and the last four defenses, which filed the new live_dependent protection
under the defenses. It now names pinned, referenced and live_dependent as the
protections (apigen regenerated: the two comment copies only), and
handleSweep's comment counts eight members.
internal/httpapi's sweep pins stopped at the original six members: nothing
there sent protect_live_dependents or limit, refused a mistyped one, or read
live_dependent or remaining back. The forward, refuse and publish tests now
cover all four, and TestSweepResponseCarriesEveryRoleField, named by
sweepResponse's comment but never written, counts both projection levels and
requires every wire field populated from a fully set role result.
The httpclient Sweep defer comment described ProtectLiveDependents/Limit
refusal paths this change replaced with capability gates; it now says why
the pass-through defer stays.
Validation: go test ./internal/httpapi/... ./internal/httpclient/... (CGO,
gms_pure_go), the served sweeper tier with BEADS_TEST_EMBEDDED_DOLT=1 (19/19
pass, none skipped), make api-check, go vet, git diff --check, and bazel test
--config=ci on httpapi_test, wireshape/..., httpclient_test, encode_test and
types_gen_drift_test. Mutants, each restored: disabling the sides arm reds
three TestGoldenDrift arms; the pre-fix golden reds TestWireShapeDigest
naming the 9 schemas; dropping the live_dependent or remaining projection,
the protect_live_dependents decode, or the limit assignment each reds its
new pin.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* feat(httpclient): lift the HTTP client store and roles from bd-enterprise (MIT contribution)
Contributed by gascity from bd-enterprise (github.com/gascity/bd-enterprise,
internal/enterprise/httpstore @ 49d1df2f6) to OSS beads under the MIT
license, with the owner's explicit approval. Every lifted file carries a
provenance header naming its source path.
Lifted into internal/httpclient: the Store (DoltStorage over the wire), the
dial/register glue, the read roles (reader, querier, counters, edges,
relations, graph, tree, cycles, stats, config, memories, journal), the write
roles (lifecycle, claimer, releaser, deleter, dependency editor, metadata
CAS, commenter, batch closer/creator/applier, ready claimer, sweeper), and
their tests. The store transport seam (WireClient/WireDialer) and the
store-dependent tests deferred from the S2 lift are restored here.
Not lifted: the hosted gateway (httpgw/gwauth), box-login, storage profiles
and gasworks. dial.go only mentions the gateway in comments.
This commit is the mechanical lift and does NOT build yet. It references
enterprise-only APIs absent from OSS: issueops.ReadyLister,
journalops.Watcher, storage.ServerEnforcedPolicy, the
NonCommitGraphBackend/RemoteWorkspaceBackend markers, DoltStorage
differences, and BatchCloseRequest.claim_next. The following commits
reconcile it with OSS (S3/S4/S5).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): reconcile the bd-enterprise lift's compile-time API surface against OSS
The mechanical lift (02a9dad17) carried several bd-enterprise-only shapes
that do not exist in OSS beads:
- ReadyLister, journalops.Watcher/StreamWire, and ServerEnforcedPolicy have
no OSS wire counterpart; drop the role, its served/journal-watch tests,
and the policy enforcement path entirely rather than leave dead code that
cannot compile against OSS's apigen types.
- claim_hook_gate_test.go exercised a hook surface OSS does not publish.
- recordingWire/fakeWire no longer embed a StreamWire double now that no
read role can reach a watch stream; testTarget's two conflicting
package-scope declarations (store_test.go and helpers_test.go) are split
apart as pinnedProjectTarget vs. the generic helper.
- unsupported_gen.go is regenerated from scratch against OSS's actual
storage.DoltStorage via a new, from-scratch reflection-based generator
(internal/storage/unsupportedgen) rather than hand-copied from
bd-enterprise's generated output; completeness_test.go's
legitimatelyUnsupported map grows the handful of OSS-only or
previously-missed methods (AddRemoteWithRef, RenameLabel, etc.) this
regeneration surfaces.
- write_ledger_test.go and the divergence ledger doc gain the
force_notes_overwrite and claim pending rows OSS's apigen.UpdateRequest
and SweepRequest actually carry, and drop the Remaining/LiveDependent
assertions SweepResult/SweepSkips have no wire member to ever populate.
go build ./... and go vet ./... are clean after this change. No behavior
beyond the removed surfaces changes here; read-role and write-role
reconciliation land in follow-up commits.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): stop sending listIssues a reverse/sort vocabulary OSS does not publish
The bd-enterprise lift's sortedPage pushdown assumed GET /v0/beads/issues
(listIssues) shared the same sort vocabulary and a reverse parameter with
GET /v0/beads/issues:query (handleQueryIssues) -- a different operation.
OSS's openapi.v0.yaml publishes listIssues a CLOSED two-value `sort` enum
(created, priority; deliberately smaller than the nine values :query
takes) and no `reverse` parameter at all. Sending either would earn an
unknown-parameter or invalid_value refusal from the real server, not a
silently-wrong answer -- which is why this only surfaces against a served
backend, not a Go-side unit test of the request builder.
Add listSortPushdownEligible to gate the pushdown fast path to the two
keyset orders listIssues can actually page, unconditionally refusing any
reversed request (listIssues has no parameter that names a reversed
direction, so a reversed request of any order walks and sorts
client-side). Drop the unconditional `reverse` send from sortedPage.
served_list_test.go's three affected cases encoded the wrong,
enterprise-only wire shape (expecting reverse=false on the fallback path,
expecting a reversed order to push down with sort+reverse, and expecting a
Go-side/SQL-side mix in listIssues' sort enum); corrected to match OSS's
actual, provable wire contract rather than left red. list_sort_test.go's
publishedParamEnum helper now reads the OpenAPI document via the
go:embed'd spec.OpenAPIV0() accessor instead of a relative os.ReadFile, so
it no longer depends on the test's working directory (this also fixes the
same test failing under Bazel's sandbox, which does not expose arbitrary
relative-path files).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): reconcile write-role tests against OSS's BatchClose/Update shapes
OSS's apigen.BatchCloseRequest and BatchCloseResponse publish no
claim_next/claimed_next member at all (ledger row
W-CloseBatchRequest.ClaimNext) -- bd-enterprise's claim-folded-into-close
shape has no OSS wire counterpart. Replace the three tests that exercised
decoding a served claim (TestBatchCloseRefusesAServedClaimCarryingNoIssue,
TestBatchCloseRefusesAServedClaimTheRequestNeverEarned,
TestBatchCloseKeepsTheClaimItEarned) with
TestBatchCloseRefusesClaimNextUnconditionally, which pins the actual OSS
behavior: a CloseBatchRequest naming ClaimNext refuses before any dial, on
both the unserved and served legs, regardless of what a server would
otherwise answer. Drop the now-dead "claim-next" case and helper claim
variable from TestBatchCloseServesTheSingleItemShapeAndRefusesTheRest.
Also:
- Add the ForceNotesOverwrite case to
TestUpdateRefusesEveryMemberTheWireExcludes's hand-maintained member
map -- a ledgered-pending UpdateRequest member (see
W-UpdateRequest.ForceNotesOverwrite) the lift's test left uncovered.
- Remove write_roles_test.go's duplicate `ptr[T]` generic helper, which
redeclared the one already in helpers_test.go and never compiled.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(conformance): pin post-write RowVersion propagation across Update/Close/Reopen
types.Issue.RowVersion is json:"-", so an implementation that forgot to
populate it on the way back from storage would still compile and still
pass every existing content assertion in lifecycle_close_reopen_contract.go
-- none of them read RowVersion. Add
RunLifecycleResultsCarryThePostWriteRowVersion, which chains each write's
result token into the next write's ExpectedVersion (Update -> Close ->
Reopen) with no intervening read, so a dropped or stale token fails closed
on the next write's optimistic-concurrency guard rather than passing
silently.
Register it in role_bundle_cases.go's roleContractCases dispatch table at
its declaration-order position -- TestRoleContractCasesCoverEveryContractCase
was failing because the function existed with no dispatcher entry.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): sync BUILD files via gazelle for the S3 reconciliation
bazel run //:gazelle after the compile/read-role/write-role reconciliation
commits:
- internal/httpclient/BUILD.bazel: regenerate srcs/deps for the files
added, removed and newly imported above (drops the deleted
policy/journal-watch/readylister files, adds the spec dep for
list_sort_test.go's embedded OpenAPI read). Manually add
`data = glob(["*.go"])` to the go_test rule, matching the idiom already
used by //internal/httpclient/encode: completeness_test.go and
divergence_citation_gate_test.go read their own package's .go sources at
runtime (a regex scan of unsupported_gen.go and an AST walk of the
package directory), and Bazel's go_test sandbox only copies in files a
rule declares as `data` -- `srcs` are compiled away, not left readable.
A `# keep` directive protects the attribute across future gazelle runs
(confirmed gazelle does not manage `data` on this rule).
- internal/storage/BUILD.bazel,
internal/storage/unsupportedgen/BUILD.bazel: pick up the new
from-scratch unsupportedgen generator package.
bazel test //internal/httpclient/... //backend/conformance/... now passes
all 4 targets (previously 4 of the package's tests failed only under
Bazel's sandbox: TestInterfaceCompleteness,
TestTheCountGroupVocabularyMatchesTheSharedOne,
TestFlaglessListSortIsTheSameOrderNamed,
TestDivergenceParkCitationsResolveToLiveLedgerRows).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(conformance): close two pre-existing leg-wiring gaps found while registering http
- RunLifecycleResultsCarryThePostWriteRowVersion (added in 536561124) was
never wired into dolt/embeddeddolt/uow's own lifecycle_close_reopen test
tables, only into the http leg's. TestEveryLegWiresEveryRoleContract
catches this once a fourth leg forces the test to actually run again;
wire the missing t.Run into all three.
- The three StatsReporter "suppressed rows" cases (GateIssues/TemplateIssues
breakdown) were never added to served_graph_aux_test.go even though the
wire already carries both fields end-to-end (types.Statistics is shared
verbatim by apigen.StatsResponse and the client's decode). Wire them; all
three pass over HTTP with no server or client change needed.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(conformance): register the http leg in the role-contract lock
Registers "http" (wiringRoot internal/httpclient) in contractLegRegistry.
The served-surface harness (served_harness_test.go + 16 served_*_test.go
files) already wired 495 of 576 role-contract entrypoints from the
bd-enterprise lift; this change:
- Waives the 3 RunCycleDetectorIncludeTracks* cases: issueops.
DetectCyclesRequest.IncludeTracks has no plumbing on either side of the
wire today (cycles.go always calls DetectCycles with a zero-value
request; the client's DetectCycles ignores its request parameter). No
slice through S13 adds one, so the waiver says a new slice is needed
rather than pointing at an existing one.
- Sets adoptionCeiling: 75 for the remaining, not-yet-wired write-role and
internal-plumbing entrypoints (lifecycle writes, DependencyEditor,
MetadataCAS, Lease, Sweeper, VersionReconciler, Bootstrapper/
InitVerifier, cross-record invariants) that S4 and later write slices
pick up and ratchet down.
- Adds //internal/httpclient:go_srcs to storage_test's data: the leg's
wiring root lives outside internal/storage, and the Bazel sandbox has no
other reason to materialize those sources for a test that reads them at
runtime.
TestEveryLegWiresEveryRoleContract, TestEveryRoleMethodHasAContractCase,
and RunUnsupportedContract (already wired pre-lift in
internal/httpclient/completeness_test.go) all pass for the http leg.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): close review's HIGH 2-5 gaps and reconcile their test doubles
HIGH 2 (BatchCloser), HIGH 3 (created_by stamping, absent-parent 404/400,
force_notes_overwrite carriage) and HIGH 4 (CapabilityError now unwraps to a
typed *storage.ErrUnsupported with Capability) were implemented in prior
commits on this branch; this change finishes HIGH 5 and the verification the
review asked for:
- role_reader.go's Reader.Get and bridge.go's raw GetIssue both now stitch
Revision back onto Issue.RowVersion via parseRevision, so a guarded write
built off either read carries the row's real token instead of a decoded
zero. Both are pinned by round-trip served tests that guard a write with
the read's token and require a stale-token replay to refuse.
- Fixed create_test.go's stale assertion that created_by must stay empty
(contradicted the HIGH 3 stamping fix it predated).
- Fixed recordingWire's canned IssueDetails{} response (roles_test.go): it
omitted Revision, which is a required field on every getIssue response
per the OpenAPI spec, and the HIGH 5 stitch now reads it unconditionally.
- Synced internal/httpclient/wire/BUILD.bazel via gazelle: handshake_test.go's
new internal/storage import had no corresponding dep.
- gofmt'd write_roles_test.go's stubWire struct tags.
Verified: served HTTP conformance tier (BEADS_TEST_EMBEDDED_DOLT=1
BEADS_HTTP_TEST_REQUIRED=1 go test ./internal/httpclient/, -timeout=40m)
600 PASS / 0 FAIL / 72 SKIP (all ledgered known-divergence waivers). One
TLS-handshake-timing test failed in that run and passed 3/3 in isolation
(unrelated file, pre-existing flake under machine load, not reproducible).
Also green: default go test (minus the pre-existing, unrelated
TestEngdocsAndRootMarkdownLinks doc-link drift and the environmental
internal/storage/uow dolt-server-spawn hang), bazel build/test for the
touched packages, make api-check, and gofmt/vet.
Live-mutated and reverted 3 guards to confirm their tests are load-bearing:
role_reader.go's RowVersion stitch, bridge.go's RowVersion stitch, and
lifecycle.go's force_notes_overwrite wiring.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(ci): add served HTTP conformance as Tier 3 of the conformance gate
The served tier (internal/httpclient's served_*_test.go corpus) never ran
in CI, so HIGH 2-5's regressions (and any future ones) would merge
undetected. Add it as Tier 3 of scripts/conformance.sh, the existing
required entrypoint conformance.yml already runs on every PR/push/merge_group
(not a new workflow, not wired through ci-gate.sh's aggregation -- this
repo's convention for this gate is a single standalone job):
CGO_ENABLED=1 BEADS_TEST_EMBEDDED_DOLT=1 BEADS_HTTP_TEST_REQUIRED=1 \
go test -timeout=40m ./internal/httpclient/
Left unsharded: Tier 1 and Tier 2 are themselves single unsharded
invocations, and Tier 3 is one Go package, not a multi-package corpus the
repo's existing package-sharding scripts apply to. No Bazel-lane addition:
bazel-coverage's embedded/dolt_server outputs only ever substitute for
main.yml/pr-risk.yml jobs, never for conformance.yml's own job, so there is
no existing Bazel-lane relationship for this gate to extend.
Bumped the job's timeout-minutes 45 -> 100 (30m + 10m + 40m budgeted
sub-timeouts plus checkout/setup-go overhead) and updated the three policy
tests that pin this script/workflow byte-for-byte
(TestConformanceScriptUsesExplicitTimeoutBudgets,
TestConformanceScriptPropagatesGoTestFailures,
TestConformanceWorkflowHasOuterTimeoutBudget), re-included
internal/httpclient/** in both path filters (push and pull_request, kept
identical) since served_*_test.go files are the suite itself and would
otherwise be excluded by the shared !**_test.go negation, and documented the
new filter entry in ci_f7c_advisory_test.go's own-entries map.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): root-cause and fix the Happy-Eyeballs TLS flake in store_dependent_test.go
TestTransportForSucceedsWithEnvCAFile (and 3 Handshake-based siblings that
assert on a successful dial through a configured CA: SidecarCAFile,
CAFileEnvAgreeingWithSidecarSucceeds, DialWithNilTransportHTTPClientGetsCAInjectedOnACopy)
flaked once with "tls: first record does not look like a TLS handshake".
Root cause: our code, same class S2 already fixed for TransportFor's direct
callers (forceIPv4Loopback in ca_test.go/ca_wrong_ca_test.go). Every server
these tests dial is addressed by hostname "localhost" (ca.startServer
rewrites it there deliberately, so SNI is actually sent), which Go's
default dialer races a tcp6 dial to ::1:<port> against the real tcp4 dial to
127.0.0.1:<port> for (RFC 6555). An unrelated local process already bound to
a colliding ephemeral port on ::1 can occasionally win that race before the
real dial completes, and the client speaks TLS to that unrelated process
instead -- the misleading handshake error, not a real hang or a product bug.
These four tests go through Handshake with DialOptions{} (HTTPClient left
nil deliberately, since that is itself the nil-HTTPClient branch of DialWith
under test), so they never get a *http.Transport back to mutate the way
forceIPv4Loopback's existing callers do. Fixed via warmIPv4OnlyCATransport:
pre-build the target's CA-scoped transport through the same public
TransportFor the product code itself calls (so it lands in the exact
(path, content)-keyed cache transportForFile's cache hit returns), force
tcp4-only on that cached pointer, and let Handshake's own DialWith run
unchanged -- same branch under test, same cached transport, no sleeps, no
retries. Verified with -race -count=50 on all four: 200/200 pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): refuse DetectCycles(IncludeTracks=true) instead of silently ignoring it
roles_graph.go's httpCycleDetector.DetectCycles took its request as `_`,
forwarding nothing: a caller asking for the widened (tracks-following) walk
silently got the narrower default walk back with no error. listDependencyCycles
has no include_tracks wire parameter at all, so there is no way to honor the
field — only to refuse it loudly or drop it silently. Switch to the typed,
ledger-cited refusal (encode.RefusedError via refuse(), citing new row
"L-cycles-tracks") that CountEdges' own wire bound already uses, add the
ledger row and its Op, regenerate the auto-generated ledger doc, and pin the
behavior with a unit test (no served-tier case needed: the refusal is
pre-dial by design, same reasoning as the existing edge-count bound pin).
Also fix leg_contract_wiring_test.go's cycleTracksWireGapWaiverReason, which
had gone stale: it described the http leg as silently forwarding nothing for
this field, which was true before this change and is not after. The waiver
itself (the three RunCycleDetectorIncludeTracks* contract cases stay unwired
for the http leg) is unaffected — they were never wired, and still are not —
only the reason text needed updating to describe a typed refusal instead of a
silent ignore.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(storage): name the http leg's permanent contract gaps instead of budgeting them
The http leg's role-contract adoption ceiling (internal/storage/contract_leg_registry_test.go)
sat at a flat 75, with a prose "adopting" note that bundled every skip into
one vague bucket — including MetadataCAS, which is in fact fully wired (0
missing cases), a false claim left over from an earlier wiring pass.
Twenty-six of the 75 skips are not S4-and-later work at all: they are
PERMANENT gaps that no future slice closes, because the contract itself has
no publicops role for an HTTP client to route through:
- Importer (4 cases): uow is Importer's one accessor, same precedent the
dolt and embeddeddolt legs already carry (importerOneAccessorWaiverReason).
- RetentionFixture/EpochFixture (15 cases) and CrossRecordInvariantFixture
(7 cases): both fixtures carry raw storage hooks (Resolve, Erase, Mint,
CurrentEpoch, GuardedWrite, EnforceCrossRecordInvariant, ...) with no
publicops field at all. dolt, embeddeddolt and uow wire these because
they ARE the storage engine this address/epoch/retention and
cross-record transaction bookkeeping belongs to; the http leg is a
remote client with none of its own to report. There is no wire surface
for this to ever route through short of a new role being designed from
scratch — a new slice, not a missing test line.
These 26 are now named, reasoned waivers in unwiredContractEntrypoints
(two new reason constants: retentionEpochNoRoleWaiverReason and
crossRecordInvariantNoRoleWaiverReason), and the ceiling drops from 75 to 49
to match. The "adopting" note is rewritten to correctly name every remaining
category under budget (lifecycle writes, DependencyEditor, DualWrite,
Sweeper, VersionReconciler, Bootstrapper/InitVerifier, ExpectedRevision/
Refusal) and to drop the false MetadataCAS claim.
Also documents, at conformanceEntrypointsWiredBy, why a leg wiring a
conformance.RunX reference with every hook left nil would read as "adopted"
by this lock's static source grep while actually running as a skip —
matching the loophole internal/httpclient's divergence_citation_gate_test.go
already closes for skipKnownDivergence call sites. No leg currently does
this (verified by inspection); the note sets the review expectation for
future wiring rather than papering over the gap with no record of the policy.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(licensing): scrub internal program/org naming and a leaked private ID from OSS-visible text
MEDIUM 8 of the S3 ship review: remove licensing-hygiene leaks found by a
read-only repo-wide survey, while leaving every legitimate "Contributed by
gascity from bd-enterprise ... to OSS beads under the MIT license." provenance
header and every genuine public gascity/gastownhall self-reference (the real
OSS org, beads.gascity.com docs domain, RBE infra) untouched:
- Delete release-gates/ga-7psli2-3-1-baseline-cmd-bd-fix-gate.md: the only
file in release-gates/ keyed by a private `ga-` tracker ID instead of the
directory's established public `be-` convention (30 other files), and the
only one leaking internal filesystem paths (/home/jaword/...,
gc-management/.gc/artifacts) and internal routing terms (mayor/mpr,
"deployer session"). Not referenced from anywhere else in the tree.
- .golangci.yml: drop two private `ga-2ltro.12`/`ga-26w10` history citations
used as nolint-comment justifications; reworded to the same explanatory
content without naming a private tracker ID.
- Reword 19 "gc native-program" occurrences (14 files, comments and one
design doc) to drop the internal program name while keeping the "S3
reconciliation (2026-10)" dating they were attached to.
- cmd/bd/if_revision.go, if_revision_test.go, update.go,
update_proxied_server.go: drop literal citations of gascity's private
bdstore_conditional.go classifier (including a test function name,
TestIfRevisionEnvelopeGascityContract -> ...DownstreamContract) while
keeping the substantive explanation of why this envelope's shape is
load-bearing for a downstream consumer.
- internal/httpclient/lifecycle.go: drop a citation of gascity's private
internal/beads/bdstore.go.
- internal/httpclient/dial.go: drop the internal/enterprise/httpgw package
path, keeping "a gateway dialer outside this repo".
- internal/httpclient/register.go: reword away from naming "the enterprise
distribution" while keeping the build-tag-opt-in behavior it documents.
Verified: go build ./..., go vet ./internal/httpclient/... ./cmd/bd/...,
go test ./internal/httpclient/... and ./cmd/bd/... -run TestIfRevision all
pass; TestDivergenceLedgerDocMatchesLedger still passes (ledger.go and its
doc were edited in lockstep). gofmt -l reports no diffs on any touched file.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient/wire): correct the CapExternalDependencies doc's implied false claim
MEDIUM 9 of the S3 ship review. The old comment on CapExternalDependencies
said this client "has no external-dependency policy layer to gate" and that
"OSS publishes no storage.ExternalDependencyQueryStore-backed client policy
... to compose" immediately after naming bd-enterprise's removed policy.go --
easily misread as "OSS has no external-dependency decorator at all." It does:
internal/storage/externaldeps's decorator is unconditional (no build tag) and
is wired into every local storage chain by cmd/bd/storage_chain.go.
Reworded to say precisely what is and is not true: the decorator exists and
runs for local backends; what this http client lacks is a client-side
composition of that decorator around a remote store, which is moot anyway
because a server advertising this capability already applies the policy
itself before answering. (Rolled in the same "gc native-program" wording
removal from the MEDIUM 8 commit, since both edits touch this comment block.)
A second claim from the same review item -- that OSS is said somewhere not to
serve events:watch -- could not be located despite an exhaustive repo-wide
search (this file, engdocs/, docs/reference/events-journal.md,
SERVE_RUNBOOK.md, the divergence ledger, CHANGELOG.md, and a dedicated
read-only research pass). internal/httpapi/events_watch.go,
routes.go's events.watch route entry, and internal/httpclient/wire/stream.go
all confirm OSS serves it unconditionally (gated only per-workspace by the
events journal setting, not by build/distribution). No corresponding false
claim exists in this worktree to fix; noting this rather than editing
something that already reads correctly.
Verified: go build ./internal/httpclient/..., go vet, go test
./internal/httpclient/wire/... pass. gofmt -l clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(unsupportedgen): add a freshness check for the generated shell
LOW item from the S3 ship review: internal/storage/unsupportedgen had no
tests of its own, so the generator could drift from the checked-in
internal/httpclient/unsupported_gen.go (a storage.DoltStorage interface
change, or a hand-written method added/removed on Store) with nothing to
catch it short of a human noticing the diff. TestInterfaceCompleteness
(completeness_test.go) already pins which methods belong in the shell by
name, but not whether the checked-in bytes match what the generator would
produce today.
TestGeneratedShellIsFresh runs the same scan-then-generate pipeline main()
runs for the registered DoltStorage/httpclient/Store consumer and diffs the
result against the checked-in file -- mirrors the existing
TestDivergenceLedgerDocMatchesLedger pattern in
internal/httpclient/encode/ledger_render_test.go. Added
TestScanHandWrittenMethodsExcludesOwnOutput alongside it to pin the
correctness property the freshness check depends on (scanning must not see
the generator's own prior output as hand-written).
BUILD.bazel: added the go_test rule by hand (gazelle cannot infer the
cross-package `data` dependency a relative-path os.ReadFile needs under the
Bazel sandbox) with data = ["//internal/httpclient:go_srcs"], following the
existing cross-package data pattern in
internal/httpclient/encode/BUILD.bazel. Placed go_test before the
go_srcs.py-managed filegroup block, which `make bazel-sync-check` requires.
Verified: `bazel run //:gazelle` leaves the rule untouched, `bazel test
//internal/storage/unsupportedgen:unsupportedgen_test` passes, `make
bazel-sync-check` is clean, go build/vet/test ./... all pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient/encode): scrub a private tracker-ID cluster from the shipped divergence-ledger doc
Follow-up to the MEDIUM 8 licensing scrub: internal/httpclient/encode's
ledger_render.go header and ledger.go's comments/pinnedElsewhere constant/two
Why strings cited "ga-b8ddd.12/.19/.23/.30" by name. These feed directly into
engdocs/design/http-divergence-ledger.md -- a shipped, generated OSS design
doc, the most visible surface this private ID cluster reached (Fork A's
MEDIUM 8 survey found ~40 occurrences of "ga-b8ddd" across the httpclient
package; this commit addresses the subset inside package encode that is
checked-in prose/doc text, not test-fixture or assertion values). Reworded to
keep the same substantive explanation (what closed, what's still deferred,
which dual run resolved L17) without naming the private ID.
The remaining ~30 occurrences of "ga-b8ddd" outside package encode
(offrole.go, metadata.go, store.go, roles_test.go, wire/*_test.go,
served_*_test.go) are left for a follow-up pass: scrubbing them individually
needs the same per-file verification this commit did, and is a larger,
separate blast radius than was practical in this pass.
Regenerated engdocs/design/http-divergence-ledger.md via
`go test ./internal/httpclient/encode -run TestDivergenceLedgerDocMatchesLedger
-update-ledger-doc`; diff confirmed only the ga-b8ddd text changed. go build
./..., go vet ./internal/httpclient/..., and go test ./internal/httpclient/...
all pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(httpclient): drop a private host reference from a test comment
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* revert(licensing): keep the scrub to the contributed client code
The previous scrub also edited upstream files this PR doesn't otherwise
touch (.golangci.yml, cmd/bd --if-revision files from #7203) and deleted an
upstream release-gate record. Restore them; the provenance scrub applies only
to the code contributed from bd-enterprise.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpclient): wire S8 count-scope fields on the client
Encode ParentID/NoParent/ExcludeTypes/ExcludeStatus onto countIssues
(table.go + encode.go), add issues.count.scope to the client capability
table (wire/handshake.go, wire/vocabulary_test.go), and refuse locally
before dialing when the server hasn't advertised the token and any scope
field is set (counter.go's refuseUnservedScope), returning a typed
*storage.ErrUnsupported{Capability:"issues.count.scope"} rather than
dropping fields or taking a guaranteed-400 round trip.
Adds encoding-parity coverage (counts_test.go), a masked-token skew test
proving the pre-dial refusal and zero dials (counts_test.go), roundtrip
and skew-table fixes for the newly-encoded fields (encode/roundtrip_test.go,
encode/skew.go), and wires S8's nine shared Counter conformance cases into
the served http leg (served_counter_test.go), including AddDependency so
the wisp/compose cases run instead of skipping. List stays nil on this
fixture since listTable() has pre-existing, unrelated permanent refusals
for ListRequest.NoParent/ExcludeTypes, so the three *MatchesListCardinality
cases skip here by design.
internal/storage's TestEveryLegWiresEveryRoleContract/http ceiling check
remains red (53 skipped vs ceiling 49) after this change, but strictly
improved: before this change the inherited baseline was 62 skipped (13
over ceiling), all nine of S8's new entrypoints unwired. This change wires
all nine, closing exactly that gap; the remaining 4-over are named
RunBootstrapper*/RunDependencyEditor* cases unrelated to count-scope,
pre-existing debt from other already-merged slices whose ceiling was
never bumped for them. Left the ceiling constant alone rather than
raising it to paper over debt this change doesn't own.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(storage): close the http leg's role-contract ceiling regression
TestEveryLegWiresEveryRoleContract/http went red after the rebase (62
skipped, 13 past its ceiling of 49) before any work in this session; the
prior commit closed 9 of those (S8's Counter cases). The remaining 4-over
were RunBootstrapper* (9 entries) and RunDependencyEditor* (2 entries),
both newly-merged contracts this leg had never classified.
RunBootstrapper*: internal/httpclient/accessors.go already names
Bootstrapper PERMANENTLY UNSERVABLE over http (bd init resolves its
substrate identity entirely client-side, before any server exists to
dial) — add a new named waiver, bootstrapperPermanentlyUnservableWaiverReason,
covering all nine entrypoints. VersionReconciler and InitVerifier are
named permanently unservable by the same accessors.go comment but are
left under the ceiling for their own reviewed change, out of scope here.
RunDependencyEditor*: the OSS server already serves add/remove and the
http leg already wires nearly all of DependencyEditor's contract. The two
missing cases (SameTypeReAddWithChangedMetadataMintsOneVersion,
SameTypeReAddWithIdenticalMetadataIsANoOp) only needed
SetVersionedHistoryEnabled wired onto the fixture, the same way
SetJournalEnabled already is — wired it for real; both pass served.
With Bootstrapper waived and DependencyEditor fully wired, the leg's
unwaived-missing count drops from 53 to 42, so adoptionCeiling moves
from 49 to 42 to keep the ratchet exact, with the adopting prose updated
to match.
TestEveryLegWiresEveryRoleContract is green. Served tier (real, CGO +
embedded dolt): 611 PASS, 0 FAIL, 72 SKIP (up from 609). bazel build/test
and make api-check pass for the touched targets.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37307836753
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* fix(conformance): pass -tags gms_pure_go to Tier 3's served httpclient run
scripts/conformance.sh:61 ran a bare `go test -timeout=40m ./internal/httpclient/`
for Tier 3 (served HTTP client/role conformance), which `make ci-pr-policy`'s
build-tag policy check refuses ("bare go test without -tags=gms_pure_go").
Pass the same -tags Tier 1 already does, and update
TestConformanceScriptUsesExplicitTimeoutBudgets' pinned argv to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): give //internal/httpclient:httpclient_test room to run
The package takes ~350s under --config=ci (BEADS_TEST_SKIP=dolt, no
BEADS_TEST_EMBEDDED_DOLT) — mostly wall-clock wait on the CA tests'
dialer/keep-alive timeouts, not CPU — but the go_test had no size/timeout
override, so it inherited the medium default's 300s and timed out
intermittently under Bazel (and took "Go test equivalence" down with it).
Set size = "large", timeout = "long", matching
//internal/storage/embeddeddolt's go_test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): fix data race in caContextHandler test helper
TestTransportForRaisesMaxIdleConnsPerHostForBursts drives caContextHandler
with 8 concurrent requests; handler() wrote requestSeen/host/sni from every
server goroutine with no synchronization, and the other nine callers (all
single-request) never exercised the race. go test -race reproduced it as
3x DATA RACE across repeated runs.
Guard the fields with a mutex and expose them only through accessor methods
(sawRequest/seenHost/seenSNI), updating every call site in
store_dependent_test.go accordingly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(unsupportedgen): canonicalize reflect-visible stdlib aliases
TestGeneratedShellIsFresh fails on Go >= 1.27: encoding/json.RawMessage
became an alias of encoding/json/jsontext.Value, and reflect only ever sees
an alias's underlying type, so formatType rendered
storage.DoltStorage.MergeMetadata's signature with the new, non-portable
name even though the signature itself did not change. A contributor on
1.27 following the freshness test's own advice ("go generate
./internal/httpclient") would commit a shell that does not compile on the
1.26.7 SDK this repo pins.
Add reflectAliasCanonical, a table mapping a reflect-visible alias target
back to the name a human wrote in source, consulted by namedType. Add an
entry here for any future stdlib alias this generator's output needs to
stay stable across.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): claimOnlyUpdate propagates the claim's RowVersion
bridge.go's GetIssue already stitches details.Revision onto
hydrated.RowVersion when claimOnlyUpdate rehydrates labels/CreatedBy onto
the claim response, but the claim response itself (issueops.Claimer's
bare-row contract) carries no revision at all, and the copy-back only
touched Labels and CreatedBy. So Lifecycle.Update({Actor, IssueID, Claim:
true}) — `bd update X --claim` — handed back Issue.RowVersion == 0 over
http where the local leg returns the real token, and feeding that into the
next write's ExpectedVersion got a spurious mismatch instead of none.
Copy RowVersion back too. Extend
RunLifecycleResultsCarryThePostWriteRowVersion (shared lifecycle/close/reopen
conformance contract) with a claim-shaped first link in the chain: claim,
then guard the next write with the claim result's own token, proving the
claim-only path populates the real version rather than a nonzero constant.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): stitch RowVersion on SearchIssues' exact-id fast path
resolve.go's getIssuesByExactID decodes the same IssueDetails shape
bridge.go's GetIssue does, but never parsed details.Revision the way
GetIssue's own stitch does, so SearchIssues(ctx, "<exact id>") answered
RowVersion 0 — a one-line gap: Issue.RowVersion is json:"-", so the decode
left it at zero, and only the explicit parseRevision stitch recovers it from
the response's own Revision string member.
Add TestSearchIssuesExactIDPopulatesRowVersionForAGuardedWrite, pinning the
same guarded-write round trip TestBridgeGetIssuePopulatesRowVersionForAGuardedWrite
already pins for the plain GetIssue path.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): route every write role's refusals through inexpressible
Review finding 7: write-side refusals were not uniformly *ErrUnsupported.
Read roles already wrap encoder refusals through Store.inexpressible, which
reaches both encode.RefusedError and encode.CapabilityError; the write side's
refuse() returned a bare *encode.RefusedError instead, so a caller doing
errors.As(err, &unsupported) caught the count-scope refusal but missed
Sweeper.Sweep(Limit), DetectCycles(IncludeTracks), ReadyClaimer.ClaimNext,
BatchApplier.ApplyBatch, BatchCloser.CloseBatch, Deleter.Delete,
DependencyEditor.AddDependencies, and BatchCreator.CreateBatch.
Give InexpressibleError a detail field that preserves the original error's
composite text (an "items[%d]..." or "Issue.%s:" prefix a deeper encoder
helper already adds) instead of collapsing the message to the bare ledger
row text, and wrap every remaining write role's exported method in a single
named-return defer calling store.inexpressible, matching the pattern
lifecycle.go's Create/Update/Reopen already use.
Add TestWriteRoleRefusalsMatchTheReadShape, pinning three write-side
refusals (Sweeper.Sweep Limit, CycleDetector.DetectCycles IncludeTracks,
ReadyClaimer.ClaimNext) now classify via errors.As(*storage.ErrUnsupported)
the same way a read-side refusal does.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cmd/bd): stop spelling out Status: StatusOpen on a markdown batch create
Review nit 8: batchcreator.go's refuseUnwirableIssue refuses a populated
Status (apigen.BatchCreateItem has no wire slot for it), and
buildMarkdownBatchRequest always set Status: types.StatusOpen explicitly, so
`bd create --file` refused on every call against an http-backed store.
PreparePublicCreateRequest already defaults an empty Status to StatusOpen on
every backend, including the http client store's own server, so the explicit
assignment here was never a different outcome - only a populated member the
wire can't carry. Leave it unset; the created issue is identical on every
backend, and the http leg's role-level accounting for why Status and
CreatedBy are excluded from its allowlists is documented on
batchCreateCarriedIssueMembers (internal/httpclient/batchcreator.go).
CreatedBy is left as-is: that member genuinely has no wire slot AND the
server does not yet stamp it from Actor (a gap already tracked in this PR's
Follow-ups), so its refusal is correct, not a bug to route around.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(httpapi): correct create.go's CreatedBy comment to caller-asserted
Review nit 8: the comment claimed CreatedBy is stamped from the
"authenticated actor," but actor is parsed straight from the request body
(s.bodyActor) and never authenticated - exactly as this file's own doc
comment states a few lines above. Reword to "caller-asserted actor" and
cross-reference that doc comment so the two stay consistent. No behavior
change: the stamp itself and its test coverage were already correct.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): raise MaxIdleConnsPerHost for a supplied client's nil Transport
Review nit 8: DialWith's doc comment promises the raised MaxIdleConnsPerHost
ceiling on every dial, "whether or not a CA is configured," but the
opts.HTTPClient.Transport == nil arm only injected a transport when the
target's CA was configured (resolved.configured()). A caller-supplied
*http.Client with a nil Transport and no CA fell through untouched, so it
defaulted to http.DefaultTransport's own ceiling of 2 at request time instead
- silently exempting this one shape from the doc's promise and forcing a
fresh TLS handshake on most of a concurrent burst even once the pool is warm.
Route this arm through the same dialTransport helper the opts.HTTPClient ==
nil arm above already uses (the CA-scoped transport when a CA is configured,
the shared baseline otherwise), injected onto a copy so the caller's own
*http.Client fields (Timeout, CheckRedirect, Jar) stay untouched.
Add TestDialWithSuppliedClientNilTransportNoCARaisesMaxIdleConnsPerHost: an
end-to-end burst through wire.Client.Do, traced with httptrace, asserting the
connection pool settles into reuse at a burst size the default ceiling of 2
cannot sustain.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(httpclient): stop citing nonexistent design docs from new source files
Review nit 8: several comments added by this lift cited
engdocs/design/http-client-backend.md, "D8 row N", and beads-design/slices.json
- none of which exist in this repository (the design lived in the
bd-enterprise-internal source this code was lifted from).
Point each citation at what actually ships in-repo instead:
engdocs/design/http-divergence-ledger.md (the generated, human-readable
rendering of the divergence ledger in encode/ledger.go) for the D7/D8/D9
discipline citations in encode.go, ledger.go, bijection_test.go,
write_ledger_test.go, wire/credential.go and store.go's package doc; and a
direct description of the wire-gap it records, rather than a slices.json
scope reference, in leg_contract_wiring_test.go's cycle-tracks waiver
rationale. Regenerate http-divergence-ledger.md from ledger_render.go (which
had the same stale citation) via
`go test ./internal/httpclient/encode -run TestDivergenceLedgerDocMatchesLedger -update-ledger-doc`
so the shipped doc and its generator agree.
No behavior change; comment and generated-doc text only.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(httpclient): implement issueops.BatchGetter for the HTTP client leg
The rebase onto origin/main (item 9 of PR #7247's review) brought in
upstream #7248's new issueops.BatchGetter role on storage.DoltStorage,
breaking the HTTP client leg's interface satisfaction. This wires it up
as a read role (no actor, no version guard, writes nothing — dialed as
a POST only because MaxGetManyIDs ids cannot ride a GET query string),
mirroring Counter/Querier rather than the WriteWire-wrapped roles.
- wire/paths.go: add PathIssuesBatchGet ("/v0/beads/issues:batchGet").
- batchgetter.go: httpBatchGetter.GetMany dials the server and stitches
each resolved issue's RowVersion from apigen.BatchGetIssue.Revision
(the role's only wire spelling of the row token, since RowVersion is
json:"-"). checkGetManyIDs pre-validates the cap and blank-id rules,
in the same order internal/storage/issueops.ValidateGetManyRequest
applies them, because batch_get.go's failBatchGetErr collapses every
validation failure into one generic, code-less InvalidArgument the
client could never decode back into *issueops.TooManyIDsError.
- accessors.go: add the BatchGetter() accessor (26th wire-backed role).
- unsupported_gen.go: regenerated, dropping the now-implemented stub.
- completeness_test.go: move BatchGetter into wireBackedAccessors and
bump the asserted accessor-matrix total from 28 to 29.
- served_test.go / served_harness_test.go: both package-local "by hand"
httpapi.Config builders (serveRoles, serveConfig) now wire
cfg.BatchGetter, fixing ~56 served-tier tests that broke once
BatchGetter joined httpapi.Listen's required role set.
- served_batch_getter_test.go: wire the HTTP leg into all 14
backend/conformance.RunBatchGetterXxx cases, following
served_graph_counter_test.go's pattern. This surfaced a real bug:
GetMany built Missing via append([]string(nil), body.Missing...),
which stays nil when the server reports no misses, violating the
role's "Missing is never nil on success" contract — fixed to build
via make([]string, len(body.Missing)) + copy.
Verified: go build/vet clean; internal/httpclient suite green
(including the embedded-dolt served tier); TestEveryLegWiresEveryRoleContract
holds the http leg's adoption ceiling at exactly 42 with no change needed;
TestInterfaceCompleteness and TestAccessorMatrixMatchesDesign pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37450731721
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* test(httpclient): lock contextServer.seen against concurrent handler goroutines
TestDialWithSuppliedClientNilTransportNoCARaisesMaxIdleConnsPerHost drives
the stub with bursts of 8 concurrent requests; the handler appended to
seen without a lock. Readers only look at seen after their requests return.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): sync go_srcs managed blocks for unsupportedgen after the main merge
The PR adds internal/storage/unsupportedgen on a base that predates #7320,
which gave every Bazel package a managed repo_files filegroup. On the merge,
`python3 tools/bazel/go_srcs.py --check` (TestBazelGoSrcsBlocksCurrent) found
3 stale blocks: the package's own repo_files block, its entry in the root
BUILD.bazel repo_files list, and its entry in tools/bazel/BUILD.bazel.
`make bazel-sync` regenerated exactly those; gazelle changed nothing else.
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>
* fix(httpclient): refuse DepAddItem.HasSpawner and ThreadID on applyBatch after the main merge
Main's #7209 gave issueops.DepAddItem two members, HasSpawner and
ThreadID, and a conformance case, RunBatchApplyStampsSpawnerIDOnlyWhenNamed.
ApplyDepAddItem on the v0 wire publishes source, target, type and
metadata only, so on the merge the http leg dropped both silently and
two of the PR's gates went red:
- TestEveryWireExcludedWriteMemberCarriesALedgerRow: the reflective
census found two wire-excluded DepAddItem members with no ledger row.
- TestEveryLegWiresEveryRoleContract/http: the new case left the leg
at 43 unwired cases against its exact ceiling of 42.
applyDepAddItemBody now refuses each member where the role would store
something the wire cannot say, under two new KindRefuse rows,
W-DepAddItem.HasSpawner and W-DepAddItem.ThreadID. The spawner flag
refuses only on a waits-for edge, because the role ignores it on every
other type and stores the same row either way. The ledger doc is
regenerated (264 rows).
The served tier wires the new case as a park on W-DepAddItem.HasSpawner,
owned by the family's existing bead, which brings the http leg back to
its ceiling. With the skip removed the case fails on the client's
refusal; with the refusal also removed it fails on the drop the row
names: spawner_id "" where the role stamps the resolved target.
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>
* fix(httpclient): address #7247 relaunch review iteration 1
Review iteration 1 of the relaunched adoption raised six majors. This
commit fixes all six. Five are the majors the first adoption's
iteration 1 raised. Its fixup, 696803f250 (tag
adopt-pr/bd-f5illd/stranded-fixup-696803f250), fixed them but never
reached the branch. That fix is ported here onto the contributor's
current head, with its reasoning unchanged; the sixth is new.
Creates refused what the CLI sends. Every `bd create` carries
CreatedBy, a workspace whose config.yaml names a prefix also carries
IDPrefix, and the client refused both.
- The server stamps created_by from the actor on all three create
shapes: batch_create.go and batch_apply.go now match create.go.
- The client sends a CreatedBy that names the actor and refuses any
other value, which the server's stamp would silently replace.
createIssue and the apply create item share
refuseUnwirableIssueMembers.
- IDPrefix refuses only where the role would act on it: an explicit,
unforced id.
- `bd create --file` stays refused over http. Dropping its Status was
safe but not enough: the batch create still refuses its Provenance
and Owner. The markdown.go and batchcreator.go comments that called
it servable now say so.
keysetFilter ignored AfterPriority. It now compares priority first,
mirroring sqlbuild's KeysetPriorityCreatedAtIDPredicate, and a new
served case resumes a priority keyset position. AfterID or AfterPriority
without AfterCreatedAt no longer reads as a zero-instant position that
discarded every row (the AfterID minor).
Claim with a patch was refused on a false ledger claim. `claim`,
`force_assignee_transfer` and `force_close_policy` now ride updateBody
like `force_notes_overwrite`, so a claim with a patch or a version guard
is one updateIssue call. A claim ALONE sent to a server that predates
the member (#6890) falls back to claimIssue. The three ledger rows are
retired, and the served cases parked on them now run.
OpenReadOnly returns a writable store. It stays writable, as a
documented exception: backends.Backend.OpenReadOnly also serves the
root pre-run's classified reads, and `bd ready --claim` writes through
that store. The exception is named in the backends.Backend contract,
the store_factory invariant and the store doc, and
TestReadOnlyOpenServesTheClaimBdReadyMakes pins it. An OpenNonMutating
backend hook is the follow-up.
Security surface.
- http_target.json is in the doctor gitignore template and its required
patterns.
- BEADS_HTTP_TOKEN and BEADS_HTTP_TOKEN_COMMAND are host-scoped with
BEADS_HTTP_CA_FILE's "host[:port]=value" syntax. A value scoped to
another server falls through to the next rung, and a command scoped
elsewhere never runs.
- LoadTarget and SaveTarget refuse a url that carries userinfo, and
Target.String drops userinfo.
The served Tier 3 had no CI home. The new target
//internal/httpclient:httpclient_served_test is an `embedded`-tagged
sh_test. It reruns httpclient_test's binary through
tools/bazel/go_test_variant.sh with the script's
BEADS_TEST_EMBEDDED_DOLT=1 and BEADS_HTTP_TEST_REQUIRED=1, in 24 shards
on the embedded lane's race build. bazel.yml's bazel-embedded job
already runs `bazel test //... --config=embedded`, so no workflow
changes.
- -test.timeout=19m, not the script's 40m: Go's own timeout then fires,
and dumps every goroutine, before the action's 1200s limit.
- TestBazelRetiredLanesCannotBeNarrowed pins its args and env. The new
TestConformanceServedTierRunsUnderBazel ties the script's Tier 3
switches to the rule.
- The new untagged TestServedTierIsLinkedWhenRequired fails a required
run built without cgo, which drops every served file (the sentinel
minor).
- A first 12-shard run found two test defects; both are fixed.
TestServedBatchApplyBoundsTheItemCount's 1000-item apply outlasts the
client's 60s per-request timeout under -race, so a
race_detector_{on,off}_test.go pair scales its "at bound" half to 150
there, as embeddeddolt's TestBatchApplyContract does. And
TestTheCompositionCatchesAWrongParameter's dropped-filter case leaned
on rows earlier tests had seeded: run alone, or first in its shard,
it failed. It now seeds its own row outside the scope.
- conformance.sh, its script test and
engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md name the target.
Deviations from the review's suggested fixes:
- A bare BEADS_HTTP_TOKEN(_COMMAND) fails closed rather than falling
back, and the error does not echo the value: a bare token split at an
"=" would put token text into the pattern half. Dropping the bare
syntax is safe today: the backend has no Register call site and no
docs/ page names the variables.
- Target.String drops userinfo instead of using url.URL.Redacted, which
masks only the password, so a token used as the username would print.
- The pre-#6890 claimIssue fallback leaves RowVersion unset instead of
borrowing the follow-up read's token. That read is a second snapshot,
so its token could postdate a write this claim never saw and arm a
guard that should miss; a guard built from the unset token fails
closed. Against a current server the claim rides updateIssue, whose
`revision` is stitched as for any update.
Also fixed: the nit about the completeness failure message, which now
says to regenerate the shell, and the offrole.go tombstone comment that
named a skip list which no longer exists. Left for follow-up (all
latent, since httpclient.Register has no production caller): vocabOnce
latching a failed fetch, snapshot holding s.mu across the handshake
dial, unchunked graph anchors, private tracker IDs in park owners, and
the bounded journal limit above 10000.
Validation:
- git diff --check; gofmt -l; go vet over internal/httpclient/... and
scripts
- go test -tags gms_pure_go over internal/httpapi/...,
internal/httpclient/..., internal/storage/backends/... and
backend/conformance/...; the doctor gitignore tests; the cmd/bd
events-journal construction guard; ./scripts
- bazel test --config=embedded
//internal/httpclient:httpclient_served_test on the lane's remote
executors: 24 shards, 702 top-level tests, 632 pass, 70 skip (69
ledgered KNOWN DIVERGENCE, plus
TestCAFileHygieneRefusesGroupWritableFile, which finds no
supplementary group on the executor), 0 fail, 0 data races; slowest
shard 283s. tools/bazel/check_testcases.py --bep passes.
- each of the 702 tests run alone (go test -run '^Name$', without
-race): 0 fail
- the whole tier under go test without -race, with the script's
switches and -timeout=40m, before the two test fixes: 633 pass, 69
skip, 0 fail
- removing BEADS_HTTP_TEST_REQUIRED from the rule fails both policy
tests
- bazel test --config=ci over //internal/httpclient/...,
//internal/httpapi/..., //scripts/..., //test/docsync/...,
//internal/storage/backends/..., //backend/conformance/... and
//cmd/bd/doctor/...: 32 tests pass
- make ci-pr-lint: nogo native plus windows/darwin, passes
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.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Static analysis (Snyk Code) reports the migration executor's
ExecContext / execMigrationBody calls as tainted SQL: migration file
content flows into ExecContext verbatim.
That flow is the migration contract, not a defect: sqlText is a
compile-time embedded migration body (go:embed migrations/*.up.sql,
frozen once merged and enforced by scripts/check-migration-hygiene.sh).
There is no runtime or user-controlled path into it — migrations ship
inside the bd binary, so the file-derived input Snyk models cannot be
influenced at runtime. This is hardening-by-documentation: the
invariant is spelled out on execMigrationBody, the single choke point
every migration body passes through, so auditors and future SAST runs
have the rationale in code instead of re-deriving it from the embed
directives. No behavior change.
* wy-j2upyy: render the derived GATED decoration on bd show and bd list
A bead an open gate blocks is excluded from `bd ready` but rendered
`[P2 · OPEN]` by `bd show` and with a plain ○ by `bd list`, so the human
surfaces disagreed with the readiness query.
The decoration is DERIVED, never stored: no status write, no --status
filter change, no existing JSON field reshaped.
- internal/types/gated.go: IsActiveGate, the ONE predicate — a gate-typed
dependency reached over a blocking edge (blocks / conditional-blocks /
waits-for) whose status is neither closed nor pinned. That is the
is_blocked recompute's blocking leg restricted to gates, so a rendered
GATED and a `bd ready` exclusion cannot disagree. GateDescription /
GateReason own the reason's round trip with `bd gate create`.
- bd show: `[P2 · OPEN · GATED]` plus one `Gated by: <id> (<type>[:
<reason>][, awaiting <await-id>])` line per gate, beside Deferred:. The
dependency read the DEPENDS ON section already made is hoisted, so the
decoration costs no extra query.
- bd list: ⊘ in the glyph column (circle family, distinct from ○ and ❄),
and a legend entry when the page carries one. Batched by id set —
at most two extra queries per listing, one in the tree view where the
edge map is already loaded.
- --json: additive `gated_by: [{id,type,reason}]` on the detail view,
omitted when empty; documented in the OpenAPI IssueDetails schema.
Tests (red first): cmd/bd/gated_render_embedded_test.go drives real
bd show/list/--json over an embedded rig — gated, resolved, deferred+gated,
JSON additivity — plus pure unit tests for the predicate and formatters.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: document the additive gated_by field in the JSON schema reference
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: cover the flat list route's own batched gate read
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: make GATED the readiness rule's gate clause, both halves
The adversarial review found the "one predicate shared with bd ready" claim
false on two axes, and both were reproducible by hand:
BLOCKER 1 — waits-for is not the status rule. The is_blocked recompute applies
"target not closed and not pinned" only to its blocks / conditional-blocks
legs; the waits-for leg goes through waitsForGateBlockedSQL, a fanout over the
target's open parent-child children (or an also_blocks spawner). A plain
`bd dep add X G -t waits-for` onto an open childless gate therefore leaves X
in `bd ready` while every new surface called it GATED. Mirroring that leg in
Go would be a second implementation of a rule the database owns, so the edge
clause now names the two legs it really mirrors (types.IsGateEdge) and the
test that pinned the wrong direction is flipped.
BLOCKER 2 — the subject half was missing and spelled three different ways.
unmarkAllBlockedSQL forces is_blocked=0 for a closed or pinned subject
whatever its edges say, so `bd ready` never withholds one on a gate's account;
show and workapi filtered nothing, cmd/bd/gated.go filtered closed only, and
list_format.go filtered closed at two more sites. A force-closed bead rendered
[CLOSED · GATED] with gated_by on show while list showed a plain row — show
and list disagreeing about one bead, which is the drift this was meant to
prevent. The clause is now types.SubjectCanBeGated, asked once in
types.GatesHolding (which replaces ActiveGates and takes the subject) and once
in the listing helper that has no hydrated deps; the formatters re-ask the SAME
exported predicate rather than inventing a fourth spelling.
SHOULD 3 — agent mode computed the gate reads and threw them away, in every
CLAUDE_CODE seat, i.e. the population that filed the bug. Decorating it is the
real fix, so gatesByIssueID now returns the gate IDS and formatAgentIssue
carries "gated by: <id>" in the parenthetical it already prints. A gate is
also a blocker, so its id appears under both "blocked by" and "gated by": the
first says what to wait on, the second says which of those nobody can clear by
doing more work. --long and --format render no gate and no longer pay for the
reads.
NOTE 5 — a pinned+gated row kept ⊘ instead of 📌; with the subject clause a
pinned bead is not gated at all, so the pin survives by construction.
NOTE 6 — the cost comments claimed "two queries" / "exactly ONE"; the id-set
readers are a few round trips each. The bound that is real (per page, never
per row) is what the comments now say.
Tests, red-first: the flipped waits-for case; TestGatesHoldingSubjectStatus and
TestSubjectCanBeGated (open/in_progress/deferred yes, closed/pinned/nil no);
TestFormatIssueCompactGated and TestFormatAgentIssueGated; and four embedded
arms — a waits-for edge that bd ready lists and no surface decorates, a
force-closed subject and a pinned subject that render nothing and publish no
gated_by, and the agent line naming its gate. Each was watched to fail against
the pre-fix predicate before it passed.
Ran: go test ./internal/types/ -run 'TestGateIsHolding|TestGatesHolding|
TestSubjectCanBeGated|TestGateDescriptionRoundTrip|TestGateRefsProjection';
go test ./cmd/bd/ -run 'TestFormat*Gated|TestFormatIssueCompact*|
TestFormatDependencyInfoWithParent|TestListRoles*|TestDisplayPrettyList*';
BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd/ -run TestEmbeddedGatedRendering
(11/11 subtests); gofmt -l (empty), go vet and golangci-lint on cmd/bd,
internal/types, internal/ui, internal/workapi; scripts/ci/pr-policy.sh.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: render GATED on the proxied `bd show` text route
SHOULD 4 of the review, and required for this rig: the constellation runs
proxied-server, where `bd show --json` already carried gated_by (uow
issue_reader -> workapi.BuildIssueDetails) while the TEXT renderer called the
plain formatters. The same bead read two ways from the same server disagreed.
proxiedRenderIssue now hoists the outgoing-edge read it already did for the
DEPENDS ON section above the header — the gates are the gate-typed subset of
that very set, so the decoration costs no extra query — and passes them to
formatIssueHeaderWithGates / formatIssueMetadataWithGates. The proxied LIST
routes were wired in the previous commit.
TestProxiedServerGatedRendering covers all five text surfaces plus the JSON
one beside them (header + Gated by line, pretty glyph, compact glyph + "gated
by", agent line, and a closed subject that renders nothing). Watched red first
with the proxied decoration stubbed out: four of six subtests failed, and the
--json arm passed, which is exactly the asymmetry the review reported.
Ran: BEADS_TEST_PROXIED_SERVER=1 go test ./cmd/bd/
-run TestProxiedServerGatedRendering -count=1 (6/6, 37.8s).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: put cmd/bd/state.go on the shared "Reason:" marker
NOTE 7 of the review: types' gateReasonMarker was not gate-private —
cmd/bd/state.go wrote the same "\n\nReason: " into state-change EVENT
descriptions from its own literal. No live collision (events are not
gate-typed), but the constant's doc claimed GateReason returns "" for every
gate not made by `bd gate create`, and that is false for any description
carrying the marker.
The previous commit exported the constant as types.ReasonMarker, reworded
GateReason to say what the pair really guarantees (a round trip, not a
provenance check) and pinned the honest behavior in
TestGateDescriptionRoundTrip. This commit is the second writer: state.go now
builds its event description from the same constant, so the two cannot drift
apart by accident.
Ran: go build ./...; go test ./internal/types/ -run TestGateDescriptionRoundTrip
-count=1; gofmt -l cmd/bd/state.go (empty); go vet ./cmd/bd/.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: alias types.GateRef in package backend
gated_by on IssueDetails makes GateRef reachable from the public backend
contract; TestPublicSurfaceComplete requires every such type to carry an
alias here.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* wy-j2upyy: build(bazel): register gated.go and its tests in cmd/bd and internal/types
The rebase onto e766da5ed carried the new source files but not their
BUILD.bazel entries, so every Bazel lane failed to compile internal/types
(undefined: GateRef). This is CI's own bazel-sync patch for 9ad7eb96c3,
applied unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* wy-j2upyy: compute gated_by AFTER the dependencies read in BuildIssueDetails
The be-lpi merge (#6352) moved src.Dependencies() below the cardinality
counts so the unresolvable-edge delta reads count-first. That hunk merged
cleanly, which left details.GatedBy computed on the still-nil slice, and
both CI shards' show_json…carries_gated_by subtests went red (PR Risk
Embedded Dolt Cmd 20/20, Proxied Dolt Cmd 4/15 at d21237f3dc).
Move the GatedBy line to directly after details.Dependencies = deps, still
before the BriefDeps trim that rewrites the slice, and pin the ordering with
a workapi unit test over both DetailSource seams and BriefDeps on/off (red
on the pre-fix code, green after).
Ran: go test ./internal/workapi; go vet ./internal/workapi;
BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd -run TestEmbeddedGatedRendering;
BEADS_TEST_PROXIED_SERVER=1 go test ./cmd/bd -run TestProxiedServerGatedRendering.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci: register #6606's gated-rendering tests and gated_by wire shape with main's generated gates
Maintainer fixup for adopt-pr #6606. The adopted head merges the PR head
(c43eb567d2) into main (800d43eb8d). The PR's merge-base (02f05340f6)
predates three generated artifacts on main that every PR adding a cmd/bd
tier test or a wire member has to keep current, so the merged tree is red
on them even though the PR's own CI cannot see them:
- .github/scripts/embedded-cmd-test-shards.txt: the Bazel-only 50-shard
block must name every TestEmbedded* test exactly once, or
TestCmdEmbeddedShardManifestGeneratorNotStale fails `go test ./scripts/`.
`gen_embedded_cmd_shard_manifest.py 50 --weights=duration --write`
(incremental) placed TestEmbeddedGatedRendering on shard 16 and moved
no existing assignment; the frozen 20-shard block is untouched.
- .github/scripts/proxied-cmd-test-shards.txt: likewise for the 30-shard
block and TestProxiedServerGatedRendering (shard 2), via
`gen_proxied_shard_manifest.py 30 --weights=duration --write`, so
TestProxiedShardManifestGeneratorNotStale passes.
- internal/httpapi/wireshape/testdata/golden.json: TestWireShapeDigest
(#7182) pins every response member. `go run
./internal/httpapi/wireshape/cmd/gendigest` recorded the PR's new
IssueDetails.gated_by array and its id/type/reason members as four pure
additions (+25/-0), so no wire_revision bump is owed.
The PR's own files are unchanged.
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(gated): state gated_by one way, mark --watch as undecorated, fix stale refs
Review follow-ups for #6606. Comment and doc text only; no behavior change.
- gated_by is now documented in one direction. internal/types/types.go,
internal/types/gated.go and docs/reference/json-schema.md said the list
is nonempty EXACTLY when `bd ready` withholds the issue on a gate's
account. Only one direction holds: the is_blocked recompute also blocks
a child whose parent is blocked (its parent-child legs), so a child of a
gated parent leaves `bd ready` with an empty gated_by. All three now say
"nonempty means withheld", as the OpenAPI text already did, and name the
parent-child case.
- bd list --watch passes a nil gated map on both routes
(runListProxiedWatch, displayWatchedIssueList), so a bead the one-shot
listing marks with the gated glyph keeps its plain status glyph while
watched. Watch is out of this PR's scope; the three call sites now say
so instead of reading as a forgotten argument.
- show_format.go named types.ActiveGates, which does not exist; the
predicate is types.GatesHolding.
- gated.go's best-effort note compared the gate read with `bd list`'s
blocking annotation, which only the direct route swallows. It now scopes
that comparison to the direct route and names the proxied route's
failing read (A-blk-1).
- proxiedGatedIssueIDsOwnUOW now notes that its unit of work is a second
snapshot, so one render can name a just-resolved gate under "blocked by:"
but not "gated by:".
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>
* fix(list): hydrate proxied gate candidates from both planes (bd-p8k7dm)
The proxied list resolved gate candidates through the use case's
GetIssuesByIDs, which reads the issues table only, while the edges it
resolved came from GetForIssueIDs, which reads both dependency tables.
A wisp gate (`bd mol wisp` clones a formula's gates as wisps, held to a
wisp step by a blocks edge) therefore hydrated to nothing. Its step
listed undecorated in pretty, --flat and agent output while `bd show`,
`--json` and `bd ready` called it gated.
Read the wisps beside the issues, the two-plane idiom
ready_proxied_server.go and uowMolReader already use. A failed wisps
read keeps the durable candidates. Correct the cost-bound comment that
claimed the id-set readers partition the planes on both routes.
Tests: a wisp-step + wisp-gate case in TestProxiedServerGatedRendering
and TestEmbeddedGatedRendering asserts the pretty, --flat and
CLAUDE_CODE=1 rows of `bd list --include-ephemeral`, and
TestProxiedGatedIssueIDsHydratesBothPlanes pins both planes plus the
failed-wisps-read fallback.
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.com>
* fix(exec): match Windows environment key identity (#5618)
Centralize os/exec-compatible environment-key comparison and use it for credential, metrics, Git-hook, trace, and repro subprocess filters. Preserve exact Unix semantics and Unicode near-collisions.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(worktree): scrub inherited Git routing state
Establish CWD as the worktree repository boundary before discovery can consume inherited Git routing. Fence the startup config probe, clear routing in-process before root pre-run discovery, and retain command-owned subprocess scrubbing as defense in depth without changing PID or signal semantics.
Fixes#5531
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* refactor(worktree): explain owned filtering and remove an unused shim
Document why filtering the fresh routing slice in place is safe and call
the shared routing-key classifier directly from tests. Retain the two
forwarders used by production worktree subprocess/removal paths.
Review: https://github.com/gastownhall/beads/pull/5623#pullrequestreview-5098421671
Bead: saa-cgh.23
Agent-Signature: unknown-model/unknown-reasoning
* fix(config): isolate identity and tracked-file Git probes from routing
Reuse the worktree routing owner for GetIdentity and isGitTracked so
explicit cwd/path selection is not displaced by inherited repository,
index or injected config state. Preserve identity precedence and the
tracked-secret refusal contract, with real target/decoy regressions.
Follow-up: https://github.com/gastownhall/beads/issues/6222
Dependency: https://github.com/gastownhall/beads/pull/5623
Reported-by: bee-ghosttrack
Bead: saa-cgh.93
Agent-Signature: unknown-model/unknown-reasoning
* test(execenv): exercise every environment operation under both host rules
Thread the host choice through narrow private helpers behind the existing
exported functions. Keep one normalization owner and retain native wrapper
tests; the additional table covers both host branches for equality, prefix
matching, last-wins lookup, filtering and input preservation.
Review: https://github.com/gastownhall/beads/pull/5672#pullrequestreview-5096948965
Bead: saa-cgh.78
Agent-Signature: unknown-model/unknown-reasoning
* docs(worktree): explain startup Git environment scope (saa-cgh.23)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(execenv): exercise exported host policy wiring (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): share subprocess key identity for Git routing (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* 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
* fix(doctor): isolate role lookups from inherited Git routing (saa-cgh.109.2)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(doctor): isolate legacy role fixtures from user home config (saa-cgh.109.2)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* review: reduce to the base-relative _NonexistentPath message assertion
Iteration-2 maintainer review fix for #6401, amending the iteration-1 fixup
rather than stacking a second one.
Iteration 2 filed a blocker plus two majors: #6247 (`ced3dfe220`) landed this
PR's entire remaining residual on main - helper name included - so the previous
reduction had become unmergeable, and both obvious resolutions damage main.
Installing the head's `role_test.go` compiles and leaves a green package while
silently deleting `TestCheckBeadsRoleIgnoresInheritedRouting`, the 7-subtest
table from #6461, with no CI tripwire. Keeping main's table while carrying this
PR's `isolateGlobalGitConfig` fails to compile: the two branches added the same
helper name in the same package with divergent signatures (ours void, main's
`string`, consumed as `home := ...`), so main's is the incumbent.
The reduction is therefore expressed against the adoption base `f66375459`,
adding nothing main already has: `cmd/bd/doctor/role_test.go` is byte-identical
to base except for the `check.Message != "N/A (not a git repository)"` assertion
and the three-line comment explaining why status alone is not discriminating
("Configured as maintainer" is `StatusOK` too). This head neither defines nor
calls `isolateGlobalGitConfig` - 0 occurrences - so main's helper and its two
fixture call sites are left untouched.
Net: +6/-1 against base, down from +25/-1, and the whole PR is now this one
test file.
Note for the next review pass: a prescribed remedy that writes upstream's
content into the head is the failure mode here, not the fix. Doing that makes
ours a superset of theirs in the same region, which git UNIONS rather than
conflicts, duplicating main's table test - and `merge-tree` still reports rc 0,
so a clean merge-tree is not a compile certificate. The two gates that catch it
are vetting the EXTRACTED MERGED TREE and censusing `^func` names inside the
MERGED file; both are run below and both are clean for this arm.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* feat(show): --comments-tail N renders only the last N comments in text mode
Real-world beads accumulate 600+ comments and bd show renders ~800 KB of
text for them. --comments-tail N caps the text-mode COMMENTS section to
the last N comments, preceded by one elision line naming how many older
ones were hidden (singular/plural handled). This is render-only: no data
is fetched differently, and the comment count in any header still
reflects the total.
The flag absent or set to 0 is byte-identical to today's output (pinned
by a test comparing against an independent reproduction of the pre-flag
render). A negative value is a usage error, matching how --max-rows
already rejects negative values. --json is untouched; --include-comments
still streams every comment there, documented in the flag's help text.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(show): --comments-tail reaches --watch; drop two vacuous tests
Plumb --comments-tail through watchIssue / displayShowIssue /
displayShowIssueReturn to a new renderWatchComments (its own function so
tests can exercise the exact call without a real database), replacing the
third inline COMMENTS copy that ignored the flag. watchCommentFormatTime
preserves the hardcoded UTC formatting byte for byte; --local-time still
isn't threaded to --watch, unchanged by this commit.
Also drop TestPrintComments_AbsentMatchesZero and
TestPrintComments_CommentCountHeaderUnaffected (vacuous — the first called
printComments(x, 0) against itself, the second asserted len() on a
by-value slice and bd show text mode prints no comment count); folded the
absent-flag case into the legacy-comparison test instead.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci: list show_comments_tail_test.go in cmd/bd BUILD.bazel
Bazel equivalence requires every test file in the go_test srcs; this is the
line CI's bazel-sync patch printed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci: rerun after #7338 re-pinned the RBE worker-env (no code change)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* fix(storage): parent-child cascade propagates only exogenous blockedness (wy-3eb07b, #6506)
A parent-child edge used to cascade the parent's is_blocked bit to its
children WHATEVER set it. So the "close gate on the epic" idiom — P carries
blocks edges onto its own children C1 and C2 so P cannot close before them —
darkened the very children P was waiting for. Neither child could reach
bd ready, so neither could be worked, so neither could close: a permanent
lock, and the one direction cmd/bd/dep.go does not refuse.
The contract (#6506): a parent-child edge propagates only EXOGENOUS
blockedness. P counts as blocked FOR CHILD C iff P has a blocking reason —
an open blocks/conditional-blocks target, or a live waits-for gate — whose
target is NOT one of P's own parent-child children, or P's own parent is
(recursively) exogenously blocked. P's OWN is_blocked is unchanged: it really
does depend on open children. Only the propagation narrows.
DESIGN: a second-pass predicate on the parent row, not WITH RECURSIVE.
Both parent-child legs of shouldBeBlockedIDsUnionScopedSQL keep their
p.is_blocked = 1 conjunct and gain parentCascadesBlockedSQL, which says "p's
blockedness is not solely explained by p's own children":
EXISTS (blocking reason of p whose target is not p's child)
OR NOT EXISTS (blocking reason of p whose target IS p's child)
The second disjunct carries the contract's recursive clause through the
EXISTING fixpoint instead of through SQL recursion: a parent that is blocked
with no child-targeted reason of its own is dark either exogenously or
because ITS parent is, and either way its children inherit — one level per
pass, exactly as the cascade always converged.
A recursive CTE was the other candidate and is rejected on cost, not on
engine support. Its seed set is the direct-exogenous set, which includes the
waits-for gate, and the seed cannot be confined by the batch scope (%[3]s)
because a batch's ancestors are by definition outside the batch. That would
put an UNSCOPED whole-table gate evaluation into every batched mark/unmark —
the statement shape #6288 removed, now on every write instead of only on the
full repair. The predicate here is correlated to a parent that is already
known blocked, so it probes idx_dependencies_issue for a handful of rows.
The scope splice, the DISTINCT waits-for barrier and the doctor-count
lockstep are all untouched.
One gap this form does not express: a parent that is BOTH blocked by its own
open child AND darkened by an exogenously blocked ancestor is not
distinguishable from one blocked only by its children, so its children stay
bright. That is an under-propagation in a corner the contract would darken;
it needs a second stored bit (or the CTE above) to see, and it cannot
recreate the lock this commit removes.
Also: AffectedByDepChange{,ForWisp}InTx now seeds the parent's other children
on a parent-child edge change (appendSiblingsUnderParentInTx). Writing that
edge reclassifies the parent's blocking reason on the new child from
exogenous to child-derived, which flips the answer for the SIBLINGS — the
close-gate epic is built one child at a time, and the second edge is what
un-darkens the first. Without it the incremental write path and the full
repair disagree, which the new tests catch as a nonzero doctor count.
Tests (internal/storage/dolt/blocked_consistency_test.go), all four seeded
through the real write path and each verified RED against the pre-fix SQL
except the control:
- ParentBlockedOnlyByItsOwnChildren: the repro, plus a GetReadyWork
assertion that the children are workable again.
- ExogenousParentStillCascades: the control — the fix narrows the cascade,
it does not remove it. Green before and after.
- ThreeLevelChainBothWays: GP exogenous darkens P and C; GP blocked only by
its child P darkens neither. Repaired from an inverted plane too, since
the chain is the case that needs more than one pass.
- WaitsForGateOverOwnChildren: a gate whose spawner is the parent's own
child does not darken; one on an outside spawner does.
TestRecomputeAllIsBlocked_CascadesThroughParentChild is unchanged and green,
including its single-pass lower-bound count — which is why the legs keep the
p.is_blocked = 1 conjunct rather than deriving the cascade from the graph
alone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat(dep): warn when a parent blocks on its own child (wy-3eb07b, #6506)
`bd dep add P C` where C is already P's parent-child child is the "close gate
on the epic" idiom: P carries a blocks edge onto its own child so P cannot
close before it. dep.go refuses the OTHER direction (a child blocking on its
dotted-ID parent, "would create a deadlock") and says nothing about this one,
which is the direction that used to deadlock for real — the cascade darkened
the child, so it could never reach bd ready, be worked, or close.
Since the cascade fix the edge is harmless, so this is an advisory, not a
refusal: it names what the edge now means (the parent stays blocked; the
child and its siblings are NOT hidden from bd ready) so an operator does not
have to rediscover the contract from a query.
It fires only for blocks/conditional-blocks, only after the edge has actually
landed and committed, and stays silent on any read error — an advisory must
not turn a successful write into an error, and must not precede a refusal for
an edge that was never written (the hierarchy and cycle guards reject this
pair whenever both edges already exist, in either order, which is why the
shape usually arrives one edge at a time or through import).
Unlike the D1 implicit-blocks warning it is NOT gated on an interactive
stderr: that one fires on the documented-default majority path, where
training callers to ignore stderr is the risk; this one fires on a rare
deliberate shape, and an agent wiring a close gate is exactly the caller who
should read what it does.
Wired into both direct paths (`bd dep add` and `bd dep --blocks`); the
proxied-server paths return earlier and are untouched.
Tests beside the existing dep-add warning tests: the predicate table
(including the two controls — right id with a blocks edge is not a child, and
the parent's other children do not match), the message content, and the type
gate proving it returns before touching the store.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat(doctor): report parent-blocks-on-own-child edges (wy-3eb07b, #6506)
A new "Parent Close Gates" check lists every blocking edge from a parent onto
one of its own parent-child children — the close-gate idiom, where P blocks
on C1 and C2 so P cannot close before them.
INFORMATIONAL, with no --fix and no effect on the overall result. Before the
cascade fix these edges were a trap: the parent's blocked bit propagated to
its children whatever set it, so the gate hid the very children it was
waiting for and nothing under it could become ready. The cascade now
propagates only exogenous blockedness, so the edges are legal and usually
deliberate. What an operator wants from doctor is therefore the inventory —
which beads in this store use the idiom, and where a pre-6506 store's
mysteriously invisible children came from — not a repair, and certainly not a
warning that would train people to remove a working gate.
It is the mirror of the existing "Child-Parent Dependencies" check, which
finds a CHILD blocking on its PARENT (still a deadlock, still fixable). The
two differ in how they match: that one reads dotted-ID ancestry, this one
matches real parent-child edges, because the close gate is wired between
unrelated ids.
Tests beside the child-parent ones: the empty inventory (with an ordinary
hierarchy present, which must not be mistaken for a gate), and the reported
case with two controls in the same fixture — an exogenous blocker on the
parent and an ordinary blocker on the child, neither of which may appear.
Gate note: these live in package cmd/bd/doctor, which the brief's cmd/bd
selector does not reach; `go test ./cmd/bd/doctor/` was run in full.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* revert(dep): drop the unreachable parent-blocks-own-child warning (wy-3eb07b, #6506)
This reverts 34b7f5b42. The warning it added could never print.
Its precondition is "a blocks edge from P onto C succeeded AND C is already
P's parent-child child", and the store refuses exactly that edge.
CheckBlockingHierarchyInTx (internal/storage/issueops/dependencies.go) rejects
a blocker that is the source's own descendant, and it sits OUTSIDE the
SkipCycleCheck gate, so no caller opts out of it; batch_apply.go:533 applies it
again on the DependencyEditor path `bd dep add` actually uses. Written in the
other order, the parent-child edge that closes the pair is refused as a cycle.
So the reverted code paid a GetDependentsWithMetadata read on EVERY
blocks/conditional-blocks `bd dep add` to emit something no operator could
ever see, and its 102-line test pinned a predicate instead of a behaviour.
What an operator DOES hit is the refusal — and the cascade fix left its stated
reason false. It read "blocked status cascades to descendants, so <blocker>
would inherit the block and never close". Since #6506 a parent-child edge
propagates only the parent's exogenous blockedness, so the descendant does not
inherit and nothing deadlocks. The refusal still stands, because a blocks edge
is not how the hierarchy says "I close after my children" — so the reason now
names the form that is: a waits-for gate over the children, `bd gate`.
The same false sentence was the OpenAPI description of
Problem.blocker_is_ancestor, so it is corrected there too, with types.gen.go
regenerated by `go generate ./internal/httpapi/apigen/` to keep `make
api-check` green.
The doctor "Parent Close Gates" check from 4c5f2f77b is KEPT. A warning on a
write path that refuses the write is noise; an inventory of the edges a store
already carries — from import, from merge, from the pre-refusal past — is what
an operator can act on.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(storage): the parent-child exogeneity test is over the whole SUBTREE (wy-3eb07b, #6506)
B1 of the adversarial review: 648ab0af6 tested "is this blocking reason's
target one of my own children" as a DIRECT parent-child child, but #6506's
contract is about blockedness originating outside the parent's own SUBTREE.
At depth 1 the fix worked; at depth 2 it left the permanent lock alive.
P --blocks--> G, pc C -> P, pc C2 -> P, pc G -> C
G is not P's child, so P read exogenous, so P darkened C, so C darkened G —
and G is the only row whose close can free P. Exactly the shape-1 mutual lock
the issue says no contract intends, one level down. Pinned as
TestParentChildCascade_ParentBlocksItsOwnGrandchild, verified RED at
4c5f2f77b: p/c/c2/g all blocked, all three children missing from ready work,
and the full repair changing nothing.
The test is now a real ancestor walk (subtreeWalkDepth levels of indexed
LEFT JOINs up from the reason's target), so a reason anywhere under the
blocker counts as its own.
Also B2 — the cost regression, which is the same edit, because the shape that
makes the test correct and the shape that makes it affordable are one
decision. The union's parent-child legs no longer carry a per-row correlated
EXISTS. They subtract an uncorrelated set instead:
AND p.id NOT IN (parents explained by their own subtree)
and the UNBATCHED statements (full repair, doctor count) do not even spell
that set as a subquery: it is read ONCE per fixpoint pass and bound as ids.
A repair pass is four statements and each would otherwise derive the same set
twice; reading it once is the whole difference. The batched mark/unmark keep
the spliced subquery, where it is confined to the batch's own parents by the
existing scope splice and costs a few rows.
MEASURED, gastownhall/beads#6506 bar: full repair and doctor count <= 1.5x
origin/main, write path <= 1.2x. Committed benchmark
(internal/storage/dolt/blocked_scale_bench_test.go, -short-skipped), 1000
issues / 2870 deps / 333 blocked rows, embedded dolt 2.2.0, run INTERLEAVED
main/head to cancel machine drift, four pairs, medians:
origin/main 71c4cd08b this branch ratio
full repair 48 71 43 46 -> 47 ms 66 56 54 55 -> 55 ms 1.18x
doctor count 55 62 44 53 -> 54 ms 67 61 57 57 -> 57 ms 1.06x
write path, per CloseIssue 37 30 21 22 -> 26 ms 30 23 16 24 -> 23 ms 0.91x
All three inside the bar; the worst single PAIR is 1.38x on the repair and
1.30x on the count. The two sides disagree on blocked rows by construction
(604 on main, 333 here) — that IS the fix.
NOT inside a bar, and disclosed rather than hidden: the benchmark's fourth
timing, a 200-id RecomputeIsBlockedForIDsInTx (the bulk/import batched path,
which no metric in the review covered), is 53-63 ms on main against 400-556 ms
here — 6.9x at the medians. The cause is structural and measured: a batched
pass runs many small statements, each deriving the set twice, and the set
costs a few ms however it is written. The per-pass read that fixes the
unbatched statements makes the SMALL-batch case worse, not better (one
whole-store read costs more than the subqueries a two-id batch pays), so the
fix is a per-batch-scoped read threaded through expandBatchTemplate's
placeholder plumbing — a separate change, and the reason this timing is
committed rather than left in a scratch file.
Three shapes were built and measured before this one, all at the same scale:
- the review's own: per-row correlated EXISTS with two more inside,
3.3-3.7x full repair, 5.2x doctor count;
- the set as a DISTINCT derived table LEFT JOINed on p.id, which is what B2
recommended: ~30x. dolt plans a join operand as the inner side of a nested
loop and rebuilds it per outer row — the correlated shape in a derived
table's clothes. This is the one finding that contradicts the review, and
it is why the set is subtracted with NOT IN instead;
- WITH RECURSIVE for the ancestor walk: blew the driver read timeout on the
full repair. A recursive CTE pays a query's overhead per ITERATION; the
seeded walk cost 45 ms per evaluation against 6 ms for four levels of
joins, which is why the walk has a horizon (subtreeWalkDepth = 4, epic ->
sub-epic -> leg -> task). Past it a reason reads as exogenous, which
propagates MORE and hides nothing the old code showed.
Seeding: AffectedByDepChange{,ForWisp}InTx now walks UP from a parent-child
edge's target, not just to it. Hanging G under C changes nothing about C and
everything about any ANCESTOR of C that blocks on G, so each such ancestor's
sibling set is reseeded — otherwise the incremental write path and the full
repair disagree, which the new test catches as a nonzero doctor count. The
walk is filtered to ancestors that carry a blocking reason at all: without
that filter a 70-deep chain reseeds every ancestor's subtree on every edge
written into it, which timed out TestGetReadyWork_ParentFilterReturnsDeepDescendants.
CHANGELOG now names the limitation the review ruled acceptable but undocumented
(a sub-epic blocked both by its own children and by an exogenously blocked
ancestor keeps its children visible), marked tracked upstream; bee files the
follow-up issue at PR time.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(doctor): rune-safe Detail truncation, Category on the N/A returns (wy-3eb07b, #6506)
The "Parent Close Gates" check joins its inventory with U+2192, three bytes
wide, and then cut the joined string at byte 200. Two of every three offsets
land mid-rune, so `bd doctor --json` could carry invalid UTF-8 in Detail — a
display nuisance in the terminal, but a value a JSON consumer has to decode.
truncateDetail walks back to a rune boundary first; the test drives every
entry count from 1 to 120 so the cut lands at all three offsets within the
arrow and asserts utf8.ValidString on each.
The same byte cut appears twice more in this file (:101, :561) on ASCII-only
details. Left alone here: they are not this bead's, and changing them would
put a behaviour change in two checks a reviewer of #6506 has no reason to be
reading.
The check's two "N/A" early returns also omitted Category, unlike its three
real returns, which drops them out of the categorised report. Both now carry
CategoryMetadata.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* perf(storage): read the batched exogeneity set once per batch, not per statement (wy-3eb07b, #6506)
D1, the PR blocker from the round-1 review. The batched mark/unmark templates
spliced parentsExplainedBySubtreeSQL — the "which blocked parents are explained
only by their own subtree" query — into both of their parent-child legs,
batch-scoped. The scope made it look cheap. It was not: dolt pays for a
`p.id NOT IN (subquery)` once per leg per STATEMENT, and a batched pass is a
mark and an unmark, so one 200-id RecomputeIsBlockedForIDsInTx derived the set
four times and measured 6.9x origin/main (53-63 ms -> 400-556 ms). That is the
bulk/import path and the cost shape #6288 removed.
The set is now READ once per batch and BOUND into both statements as ids —
the same trade the unbatched full repair already makes per pass — which is why
markBlockedTemplate/unmarkBlockedTemplate are built per batch now: the number
of bound ids is a property of the batch. In front of the read sits a cheap
indexed guard, batchParentKindsInTx: a parent KIND with no parent-child row in
the batch has an empty candidate set, hence an empty exogeneity set, so its
read is pure overhead, and the read is a ten-join walk under two CTEs that
dolt spends ~8 ms planning whether it returns rows or not. Most batches name
no wisp parent at all; a batch of roots names neither. Without the guard the
2-id case measured 1.9x, with it 0.94x.
expandBatchTemplate now WALKS the template instead of counting "%s": the batch
scope and the bound exogeneity ids alternate inside the union (leg 3's scope,
leg 3's NOT IN, leg 4's scope, leg 4's NOT IN), so only text order says where
each group goes. It returns an error on a ?/bound mismatch rather than handing
the engine an opaque argument-count failure. The %s budget is back to 6 from
8, re-pinned, with two new pins beside it: the ? group is exactly the bound
exogeneity ids (none for an empty set), and the mismatch is refused.
KEPT, on round-1's measurements: the NOT IN subtraction (the derived-table
JOIN measured ~30x in dolt) and the 4-level LEFT JOIN ancestor walk (WITH
RECURSIVE blew the driver read timeout).
MEASURED. n=1000 issues / 2870 deps / 333-604 blocked, embedded dolt 2.2.0,
TestBlockedStateScaleTiming, SIX interleaved origin/main(71c4cd08b)/head pairs,
medians, worst single pair in brackets. The bench now times three batch sizes
instead of one, because the per-statement and per-id costs pull opposite ways:
metric main head ratio bar
full repair 49 ms 57 ms 1.16x [1.32x] <= 1.5x MET
doctor count (consistent) 48 ms 57 ms 1.18x [1.32x] <= 1.5x MET
write path, per CloseIssue 25 ms 26 ms 1.03x [2.59x] <= 1.2x MET
batched recompute, 200 id 54 ms 69 ms 1.28x [1.57x] <= 1.5x MET
batched recompute, 20 id 17 ms 22 ms 1.29x [1.50x] (measured)
batched recompute, 2 id 22 ms 21 ms 0.94x [1.03x] (measured)
All four stated bars are met on medians. The worst-pair column is at or inside
this box's own noise: over the same six runs origin/main's OWN spread is 2.07x
on the full repair, 2.33x on the write path, 1.92x on the 2-id batch and 1.19x
on the 200-id batch, so a single pair's ratio is not evidence at this
resolution and the medians are what the bars are read off.
DISCLOSED, not a stated bar and not fixed here: the bench FIXTURE BUILD —
2870 AddDependency calls plus 240 CloseIssue through the store — is 75 s ->
102 s, 1.36x [1.61x]. That is the dependency-ADD write path, and the cost is
round 1's incremental seeding (AffectedByDepChangeInTx now walks up to every
reason-carrying ancestor and reseeds its whole sibling set), which is what
buys the incremental/full-repair agreement pinned by the lockstep test in the
next commit. Per-edge it is sub-millisecond; it shows up here because the
fixture writes the hierarchy of a 1000-issue store edge by edge.
GATE: go build ./... ; go vet ./internal/storage/issueops/ ; go test
./internal/storage/issueops/ (ok, includes the rewritten template and sqlmock
pins) ; BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/dolt/ -run
'ParentChildCascade|RecomputeAllIsBlocked' (ok) ; gofmt -l clean. The full
enumerated gate is on the bead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(storage): pin both sides of the subtree-walk horizon, and the incremental/full-repair lockstep (wy-3eb07b, #6506)
D2 and D3 from the round-1 supervisor ruling.
D2 — THE HORIZON IS NOW PINNED, not commented. "Inside my own subtree" is
decided by a fixed 4-level ancestor walk (subtreeWalkDepth), because a
recursive walk cost 7.5x per evaluation and blew the driver read timeout. Two
tests that differ by ONE EDGE straddle it:
_ReasonAtTheWalkHorizon P blocks a descendant exactly 4 pc levels down.
The walk reaches P, so the reason is
subtree-derived and the chain comes bright.
RED on origin/main (4 rows dark that the fix
brightens) — so it is not vacuous.
_ReasonPastTheWalkHorizon one level further. The reason reads as EXOGENOUS,
so the whole chain stays dark, which is
origin/main's own answer — and that test PASSES
UNCHANGED ON origin/main (verified in a temp
worktree at 71c4cd08b, since removed). It also
asserts no row of the shape appears in
GetReadyWork: no new dark rows AND no new visible
rows past the horizon, checkable rather than
argued. Raising the constant makes it fail and
name the row that changed.
Both also repair from a fully inverted plane, which is the leg that needs the
fixpoint rather than the write path's seeding. The CHANGELOG now names the
4-level horizon beside the existing limitation sentence, and the constant's own
doc names the two pins.
CAN THE HORIZON BE RAISED? Measured, and the answer is "not on this evidence".
Same bench, same box, full repair / doctor count / 20-id batch / 200-id batch:
depth 4 57 ms / 58 ms / 21 ms / 69 ms (shipping)
depth 6 126 ms / 118 ms / 52 ms / 101 ms 2.2x, TWICE reproduced
depth 8 59 ms / 74 ms / 24 ms / 68 ms ~= depth 4, TWICE reproduced
The curve is NON-MONOTONIC: 6 falls off a cliff and 8 comes back. That is a
dolt planner artifact, not a cost model, and raising a semantics-bearing
constant on the strength of a number nobody can explain is the wrong trade —
depth 8 also makes every past-horizon shape newly bright, which is a behavior
change and not this round's business. Left at 4, with the numbers recorded for
whoever picks the knob up.
D3 — THE LOCKSTEP. _IncrementalMatchesFullRepairAcrossEdits walks one graph
through the mutations that reclassify a blocking reason WITHOUT touching the
row that carries it, and after every one asserts both the exact flags and
assertConvergedAndStable: detection counts 0 AND a full repair changes 0 rows.
An under-seeded incremental path (the AffectedByDepChange{,ForWisp}InTx
ancestor walk round 1 added) fails here as a nonzero repair over a graph the
write path just finished maintaining. The mutations: re-parent the reason's
target INTO the blocker's subtree (which is how the shape arrives — the store
refuses a blocks edge straight onto an existing own descendant, and that
refusal's reason text is what 3a5203979 corrected), close the descendant,
reopen it, re-parent it back OUT, remove the blocks edge. The
into/out-of-subtree steps are the ones that flip rows the edge does not name
(the parent's other children), which is exactly what
appendSiblingsUnderAncestorsInTx exists to seed. RED on origin/main for the
semantic values; origin/main's own incremental/full-repair agreement holds
there, so what this pins is the agreement, not the numbers.
GATE: BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/dolt/ -run
'ParentChildCascade' -count=1 — 8/8 ok; gofmt -l clean; go vet clean.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(doctor): the close-gate inventory walks the same four parent-child levels as the cascade (wy-3eb07b, #6506)
The "Parent Close Gates" check listed only DIRECT parent->child gates, so the
fix's own headline shape (a parent that blocks on its grandchild) never
appeared in the inventory. The check now joins a descendant-pairs set built
to the same four parent-child levels the cascade uses for "inside my own
subtree" (issueops subtreeWalkDepth), as plain joins over the dependency
union rather than a correlated subquery, which dolt declined to plan once
rows were present. Messages say "own-descendant"; the tests add a grandchild
gate (2 listed, the exogenous edge still not) and assert Category.
CHANGELOG cites the nested-gap follow-up, gastownhall/beads#6601.
Tests run: go build ./... 0; go vet ./cmd/bd/doctor/ 0; gofmt -l clean;
env -u BEADS_ACTOR go test ./cmd/bd/doctor/ -run 'ParentBlocksOwnChild|TruncateDetail' -count=1 PASS (3/3).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci: allowlist TestBlockedStateScaleTiming's -short skip (wy-3eb07b, #6506)
scripts/check-testing-short.sh reserves testing.Short() for runtime, stress
and large-fixture skips and keys them by file::func. The scale-timing test
added in this PR builds a 1000-issue / ~2000-edge dolt fixture and times the
blocked-state paths over it: a large-fixture skip, and PR Core runs with
-short, so it needs the entry. One line, the same shape as the
TestUOW_ConcurrentMergeOps_NoLostUpdate row from #4732.
Local: ./scripts/ci/pr-policy.sh rc 0 (check testing.Short boundaries
succeeded; the other nine legs unchanged).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* wy-3eb07b: build(bazel): register blocked_scale_bench_test.go in internal/storage/dolt
The rebase carried the bench test but not its BUILD.bazel entry, so the
Bazel test lane's gazelle sync and Go test equivalence steps failed while
every Go lane was green. This is CI's own bazel-sync patch for 043f9c47b9,
applied unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(blocked): resolve explained parents through their ancestry; walk ancestors on hinted per-table members
Maintainer fixup for #6602 (adopt-pr review iteration 1, quality scorecard
760/1000, request_changes; amended at iteration 2, 906/1000, approve). It
fixes the review's two major findings, the doctor check's message and its
swallowed query failure, the stale core-builder doc, and the stale
test-comment names. At iteration 2 it also takes both nits and corrects a
CHANGELOG sentence this fixup had made false.
- Mixed-arm leak (major). The explained-parent read decides from a
parent's own reason rows, and the fixpoint carries the recursive clause
only for a parent with no reason row of its own. With Q blocked on an
outside X, P a child of Q, and P blocking on its own child C, P read as
explained and C came bright under an epic still gated by X, on the
write path and in full repair alike. pruneExplainedByAncestryInTx now
shrinks every read to the greatest set whose members' blocked parents
are all members. A full-repair read is complete, so a blocked parent it
did not return is unexplained. A batch-scoped read climbs instead,
reading the blocked parents above the batch by id (explainedAmongInTx).
The suggested one-level NOT EXISTS is not enough: put a second close
gate between them (R blocked on X, pc Q -> R, Q blocks on P, pc P -> Q,
P blocks on C) and P's blocked parent Q is in the set, so R's gate
never reaches C.
- ancestorChainInTx (major) walked the derived UNION of both dependency
tables that #7224 removed from isAncestorInTx, on every parent-child
write and merge replay. It now walks reachabilityMembers, the hinted
per-table recursive members split out of reachabilityQuery, with the
reason filter kept in the outer SELECT. TestGraphWalkPlansHonorJoinHints
(embedded) gains an ancestor-chain subtest that pins the lookup plan;
the old walk fails it.
- New dolt tests: TestParentChildCascade_OwnGateUnderExogenousParent
(write path, full repair, and X closed and reopened),
_NestedGatesBothWays (the two-gate chain both ways, then a close of the
children's own blocker, which re-evaluates them through a batch whose
read covers nothing above their parents), and
_WispGateUnderExogenousParent (a wisp gate under an issue epic, an
issue gate under a wisp epic, then an explained wisp gate the walk must
read by id above such a batch). Five mutants of the prune were each
killed: no prune (the PR head), a one-level check, an over-prune, a
scoped read treated as complete, and a scoped read that trusts every
parent above it. The eight existing cascade tests pass under all five.
Iteration 2 killed two more, each by its own section of the wisp test
alone: dropping the lookup of a wisp parent from blockedParentEdgesInTx,
and dropping explainedAmongInTx's wisp leg, which had survived all
eleven cascade tests.
- The doctor check no longer says the children "stay in bd ready", and
a failed or timed-out inventory query is now a warning carrying the
error, as in validation.go's other checks, instead of an OK that reads
as "no gates". TestCheckParentBlocksOwnChildDB_QueryFailureWarns pins
it with a closed handle, and it fails with the old status. A warning
does not touch doctor's overall result, and it can be suppressed.
- The core builder's doc no longer describes the spliced design, and
three test comments name builders that exist.
- explainedAmongInTx says why it does not tolerate a missing table, as
the file's wisp reads do: the prune runs only on a non-empty read,
which came from the same core query over all four tables.
- The CHANGELOG entry no longer calls #6601's shape (a sub-epic gated on
its own children under an exogenously blocked epic) a known limitation
that keeps the children visible. The prune darkens them, as
TestParentChildCascade_OwnGateUnderExogenousParent pins.
Left as-is, all non-gating: the refusal hint's "(bd gate)", an API string
pinned by the golden corpus; a parent-child add/remove timing in the
scale bench, whose 1000 issues cannot show the 50k shape (the plan pin
guards it); and hints for the explained-parent subtree walk and the
doctor query. The measured complexity major is runDiagnostics (50/66),
the same at base; the PR adds two lines to it.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(storage): re-pin the classic batch-apply statement count for the parent-child cascade
The B0 statement-count pins predate this PR's parent-child cascade. The
first full run of the storage tiers on the adopted head measured the
40 (classic) shape at 835 statements on both backends, against the
pinned 786 +/- 2.
All 49 extra statements are reads, seven for each of the shape's seven
distinct parent-child dep adds (its eighth repeats a pair and is a
no-op):
- appendSiblingsUnderAncestorsInTx reseeds the parent's other children:
one ancestorChainInTx walk and four child probes, +5.
- The batched mark/unmark reads its exogeneity set first
(batchExogeneity): the parent-kind probe and the issue-parent read, +2.
Measured by logging every statement of the classic apply on the CI base
233d151b37 (786) and on b2b93515bf (835), then diffing the two logs by
statement shape. Those seven shapes are the whole difference, each
exactly +7, and no write changed. The 356 and 712 shapes are unchanged
on both backends.
This is the deliberate re-measure and re-pin the pins' doc comment asks
for. The per-change breakdown is in pinnedEmbeddedStatementCounts.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
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.com>
* feat(schema): never migrate an existing database without explicit consent (bd-qhn8y)
Beads 1.2 release remediation. 1.2.0/1.2.1 auto-applied migrations 54-65 at
store open on ANY command, including reads; older binaries then refuse the
migrated database. MigrateUp now refuses pending main-sequence migrations on
an existing database before any write (dolt_ignore seeding included) unless
the operator consented: bd migrate / bd migrate schema (preview flags
withhold), bd migrate --force, or BD_ALLOW_MIGRATE=1
(BD_ALLOW_REMOTE_MIGRATE honored as an alias). Fresh init and at-latest
databases are unaffected; the #4259 remote gate keeps all its protections.
Also: freeze shipped migrations (hash-pin test, main 0001-0065 + ignored
0001-0024), retract v1.2.0/v1.2.1 in go.mod, agent-executable un-migrate
runbook (docs/recovery/unmigrate-schema-v65.md), and the upgrade smoke +
historical migration harnesses now model the consent contract and assert
the refusal carries guidance.
No version bump here by design: cutting the release stays with the release
owner.
Rebased onto main 800d43eb8d: the go.mod retract hunk is dropped -
main already retracts v1.2.0/v1.2.1 (and v1.1.1) since #5782. The
uow consent grant moves into the TestMain main added in #6441 (a
second TestMain no longer compiles), and the new files are listed
in the BUILD.bazel targets main now carries (gazelle).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(schema): cloned-workspace bootstrap carries creation-consent (bd-qhn8y)
The consent gate treated a workspace `bd init --remote` / `bd bootstrap`
just cloned into existence like a pre-existing database, refusing the
smart gate's provably-safe first-mover migration and stranding init in
the generic open-error path (bypassing the bd-4mpy7 finalize+guidance
ergonomics). Cloning IS creating: those paths now record consent
explicitly, and the #4259 remote-migrate gate still applies to them
unchanged (consent is not its designated-migrator override). Fixes CI
TestEmbeddedInit/remote_behind_schema_gate.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(migration): consent first in main's wisp lanes too (bd-qhn8y)
The rebase onto 800d43eb8d brought in #6049's wisp-plane lanes, which
postdate this PR's harness changes. Each one makes an ordinary candidate
command the first touch on an old-schema database, and the consent gate
refuses it:
- historical-dolt-upgrade-test.sh run_wisp_plane_upgrade opens with
`bd list` before any migrate: "candidate could not open the seeded
wisp workspace" for v1.0.1, v1.1.0, v1.1.2 and v1.2.2 (the
Migration Test Harness dolt-runtime shard).
- run_dirty_tracked_wisp_scenario (v1.1.2): the consent refusal stops
the open before MigrateUp reaches the #5816 dirty tables, so the lane
fails "without naming them".
- upgrade-smoke-test.sh "Wisp plane survives upgrade" upgrades with a
bare cand_init, so list/ready/blocked/update all hit the refusal
(4 failures each for v1.3.0 and v1.3.1, both in the PR smoke set).
Use the PR's own pattern: the explicit `bd migrate schema` is the first
candidate touch (cand_upgrade in the smoke script). Base 800d43eb8d
passes these lanes unchanged; with this fixup the full 14-version
historical corpus and all five PR smoke versions pass.
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>
* fix(schema): close consent-gate review findings (bd-qhn8y)
Review fixes for the migration-consent gate (adopt-pr review, attempts
1 and 2).
Majors:
- #4566 deadlock rebuilt one check earlier: on a database that is both
behind and dirty, the consent refusal fired before the dirty-table
guard, whose remedy (`bd dolt commit`) opens without consent. The
working-set-reconcile opens now tolerate MigrateConsentError: embedded
(toleratesConsentRefusal, WSR intent only) and server mode
(LenientOpen's warnLenientOpenRefusal) print WorkingSetWarning and
commit at the current schema; strict, read-only and RemoteSync opens
still refuse. Covered by an embedded test (a refused open writes
nothing: dolt_status, dolt_ignore and schema_migrations unchanged) and
a server-mode integration subtest.
- Bare `bd migrate` consented: isMigrateConsentCommand now matches only
the schema verb, so `bd migrate` (metadata reconcile, including
--update-repo-id, --inspect and --dry-run) no longer consents to a
one-way migration; `bd migrate schema` and --force do.
TestLocalMigrateConsentScope pins the scope through the root pre-run.
The dirty-table warnings name `bd migrate schema` accordingly.
- Runnable JSON hint: the JSON refusal follows the #4259 AgentDirective
convention, a non-runnable hint plus a migrate_consent object
(versions, pending, severity, human_decision_required, options) whose
commands are retargeted with --global for the shared global database.
The text refusal prints the same --global hint under `bd --global`.
- Freeze floor: the hash-pinned freeze now covers what v1.3.x shipped,
main 0001-0066 and ignored 0001-0026; the CHANGELOG puts new
migrations in 0070+ / 0028+.
- Fresh-bootstrap heal: MigrateUpWithLock with heal authority takes the
consent-free migrate path, so a retried bd init whose first pass left
a non-zero cursor converges; other lock callers keep the gate.
Minors: the uow team-server guards are repinned on `bd migrate schema`;
the un-migrate runbook is linked from the recovery index and
cross-linked with the 1.2.1 repair-forward doc; the CHANGELOG BREAKING
entry matches the shipped contract; harness comment grammar.
Docs: the user docs and README named bare `bd migrate` as the step that
applies schema migrations; they now say `bd migrate schema`, which also
exists in the pinned docs release (v1.2.2) and in v1.3.x. The
`bd migrate schema` help no longer claims migrations run automatically
on store open. The Go remedy that sends a remote-gate stop to bare
`bd migrate` for its migrate-or-adopt options is unchanged (pinned by
TestNoticeSharedMigrateRefusalPerDecision).
Upgrade smoke (attempt 2): the consent-gate assertion is graded only when
the old binary left a database. Releases before v1.0 have no
`init --non-interactive`, so prev_init creates nothing there and the
candidate's `bd list` fails with "no beads database found", which has no
consent guidance. Main's Bazel smoke lane (#7331) runs the newest 30
releases, 20 of them pre-1.0, under the required ci-gate; all 20 went red
on the merge. The 10 v1.x releases still take the refusal branch.
Shard manifest (pre-approval CI): the new embedded test
TestEmbeddedMigrateConsent_BehindAndDirtyWorkingSetReconcileRecovers is
listed in the Bazel 15-shard block of embedded-storage-test-shards.txt
(incremental --write; shard 15). Main's ci lane runs
TestStorageEmbeddedShardManifestGeneratorNotStale in //scripts:scripts_test,
which fails on any unlisted top-level embeddeddolt test.
Not addressed (optional): env-only consent docs for embedders, the
unparseable BD_ALLOW_REMOTE_MIGRATE alias hint, and the harness
`|| true` on `cand migrate schema`.
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 Fable 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
The page still described the rules-file-only Cursor setup from before #4649
and the old --remove scope. Rewrite it against what bd installs today:
- project setup: .cursor/rules/beads.mdc, the shared .agents/skills/beads/
skill, and .cursor/hooks.json with sessionStart/preCompact/postToolUse
hooks running `bd cursor-hook <event>` (user entries left alone)
- `bd init` runs the project setup unless --skip-agents/--stealth or bare
- --global: ~/.cursor/hooks.json + ~/.agents/skills/beads/, no rules file
- hook lifecycle: sessionStart injects bd prime; preCompact arms a refresh
marker; postToolUse re-injects once and clears it; markers live in the user
cache dir keyed by conversation_id + workspace root
- --check scope per mode and the exit/hint on a missing piece
- --remove keeps user hooks, deletes hooks.json once only `version` remains,
keeps the skill while the Codex integration still uses it
- a manual hooks.json fallback in the shape bd writes
README.md: `bd init` also installs the Cursor integration, not only
Claude Code and Codex (the default init route in cmd/bd/init.go).
Follow-up to #7268 (bd-gy483w, the README line from bd-erf5vx).
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* feat(gate): bd gate create --repo names the repository a gh:run/gh:pr gate is checked in
A gh:pr gate for a PR in another repository could only be pointed there
through the blocked issue's metadata.repo; with none, `bd gate check`
resolved the bare number against the current repository and escalated
"pull request not found" on every check, with nothing in the text saying
which repository it had looked in. Five gates armed that way on 2026-10-03
never released after their PRs merged.
- `--repo OWNER/REPO` (or HOST/OWNER/REPO) on `bd gate create`: an
explicit value wins over the inherited one; it goes through the same
validator as metadata.repo (now `validateGitHubRepo`, split out of
`githubRepoFromIssue`); it is refused on human/timer/bead gates, where
nothing would read it. Both create routes call one helper,
`gateMetadataForCreate`, so the flag cannot drift between them.
- The gh:pr not-found escalation reason names the repository the number
was resolved against ("pull request not found: #42 in owner/repo" or
"... in the current repository").
- Help text, docs/workflows/gates.md and the plugin's ASYNC_GATES.md say
when the flag is needed. docs/cli-reference is pinned to the release
and regenerates on its own.
Tests: TestGateMetadataForCreateExplicitRepo, TestCheckGHPRNotFoundNamesTheRepository
(unit); TestEmbeddedGateCreate/create_gate_with_repo + /repo_flag_on_human_gate_is_refused
(embedded); TestProxiedServerGateCreateInheritsRepoMetadata/explicit_repo_flag_wins_over_inherited
(proxied).
Refs ghosttrack/wyvern wy-2jh4v5.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(gate): keep the create --repo workspace bypass off bd gate create
The root pre-run bypass for `bd create --repo` (GH#3686) matched the leaf
name "create", so `bd gate create --repo` outside a workspace took it: an
OWNER/REPO slug opened a stray ./OWNER/REPO/.beads workspace under the cwd
and failed with "issue not found", and an https:// URL skipped store wiring
and panicked on the nil store. Key the bypass on the command path, as
proxy_capability.go already does; gate create now fails with "no beads
database found" outside a workspace like every other command, and top-level
create --repo (local path and remote URL) still takes the bypass.
Also name the repository in the gh:run not-found escalation, as the gh:pr
one already does. Only stderr with a lowercase "not found" reaches that
arm: real gh reports a missing run as "HTTP 404: Not Found (<api url>)",
which takes the existing error path, and that URL already names the
repository. The match stays case-sensitive because a token without access
to the repository gets the same 404.
Tests: TestEmbeddedCreateRepoFromNonBeadsCwd/gate_create_repo_flag_is_not_a_workspace
(slug and URL forms, built binary run from an empty cwd) and the
cross_repo/current_repo subtests of TestCheckGHRunNotFoundNamesTheRepository
fail with the fixes reverted. Its real_gh_404_names_the_repository subtest
feeds gh's real 404 stderr and fails if the match is widened.
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 Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Fixes#7349. The same race #7314 closed in internal/beads and
internal/config, in the fixtures it did not cover: a fixture's plain
`git commit` spawns the detached `git maintenance run --auto` child, whose
worktree-prune races the fixture's next `git worktree add` and deletes
.git/worktrees/<name>/locked under it (seen on PR #7312 run 37585997441,
cmd/bd Dolt-server tier shard 4/16, TestBootstrap_WorktreeFallbackDir).
One noAutoMaintenance + gitCommand(args...) helper per test package, each
in an existing untagged shared test file (cmd/bd/helpers_test.go,
doctor/git_test_helpers_test.go, doctor/fix/common_test.go,
formula/parser_test.go, git/gitdir_test.go, storage/domain/git/git_test.go;
cmd/bd/test_helpers_test.go is //go:build cgo so unusable for the pure
lane), and every inline exec.Command("git", ...) in those six packages
swapped for it. The flags ride the command line, never env config: the
routing-key scrub drops env config. No new files, so no BUILD.bazel rows.
Proof: GIT_TRACE on `go test ./cmd/bd -run TestBootstrap_WorktreeFallbackDir`
counts 3 `maintenance run --auto` spawns at d8d8bf587b and 0 with this
change.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Since #7348 the pre-push hook ran scripts/pre-push-suite.sh only for stdin
lines whose local ref matched refs/heads/*. For `git push origin HEAD` and
`HEAD:refs/heads/x` git passes the literal local ref HEAD, so the suite never
ran for those pushes: a Go change pushed that way landed with an empty bazel
log, while the same change pushed as `git push origin br1` was refused.
The hook now skips a line when the remote ref is refs/tags/* or the local sha
is the zero sha (a deletion); everything else is a branch push, HEAD included.
TestPrePushHookSuiteKeysOnRemoteRef feeds the real hook HEAD-sourced ref lines
from a scratch repository with a stub suite that records whether it ran: both
HEAD forms run it on a Go change; a docs-only push, a tag pushed by HEAD or by
name, and a deletion do not. On main's hook the two HEAD cases fail.
TestPrePushHookRunsSuiteOnlyForGoChanges indexed "pre-push-suite.sh", which
the hook's header comment on line 3 also contains, so the ordering assertion
held wherever the call block sat. It now indexes the call line; moving the
suite block after the managed beads section fails it.
Fixes#7351
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
TestBazelRetiredLanesCannotBeNarrowed skipped every ModeSymlink entry in
its two BUILD/.bzl walks. Under `bazel test` on a local executor (the
processwrapper-sandbox an unauthorized fork's PR gets for
//scripts:scripts_test, RBE_INSTANCE being empty) the runfiles tree is a
symlink forest, so the walk read no BUILD file and the pin failed with
`got map[]` on every such run (#7350). Both walks now go through
walkBazelFiles, which decides "file" with the package's isFileOrFileLink:
a regular file or a symlink to one; a symlinked directory is never
followed, a dangling link is skipped. TestBazelFileWalkFollowsFileSymlinks
mirrors the checkout's Bazel files as a symlink forest (plus a directory
link and a dangling link) and requires the same file set as the checkout.
Fixes#7350.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* test(proxied): split TestProxiedServerClose into Close + Close3 so legacy shard 5 clears the 15m timeout (#7151)
Shard 5 of the legacy 15-shard proxied-server block walled at 927-941s
(go test's 15m timeout) on every measured fork-PR and main run while the
other 14 shards took 337-765s. #7172 pinned the two hash-placed tests
that pushed it over; the parent that dominates the shard remains:
TestProxiedServerClose carries 23 parallel bd-init subtests at 100-130s
apiece under 4-way contention, ~2060 of the shard's ~2712 slot-seconds.
Split it the way TestProxiedServerClose2 was split before: subtests from
close_blocked_refuses_without_force onward (12 of 23) become
TestProxiedServerClose3 with the same header; no subtest body changes.
Manifest: an explicit `15 6 TestProxiedServerClose3` line in the frozen
block (shard 6 is the lightest shard by CI job time that took no #7172
pin; without the line cksum fallback could hash it back onto 5), and
`30 17 TestProxiedServerClose3` beside Close in the Bazel 30-shard block,
which keeps every 30-shard load where it was (heaviest still 372.2s
est.). proxied_test_durations.json apportions the single 174.6s Close
capture by bd-init count (83.5 / 91.1) and says so in its header; the
next sweep replaces both.
Verified: gen_proxied_shard_manifest.py 30 --weights=duration --check
(exit 0); go test ./scripts/ -run 'Shard|Manifest|Coverage'; go vet
./cmd/bd/; BEADS_TEST_PROXIED_SERVER=1 BEADS_TEST_REQUIRE_DOLT_CONTAINER=1
go test ./cmd/bd/ -run '^TestProxiedServerClose3?$' -v: both PASS
(32.24s / 30.53s, 23 subtests).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci(proxied): pin TestProxiedServerClose3 onto legacy shard 1, not 6 (#7151)
Shard 6 timed out at 15m on this PR's own run (job 111387202139) with
Close3 added: Close3 passed in 5s but TestProxiedServerClose2's
subtests, sharing the 4 parallel slots and the one proxied server with
Close3's 12 bd-init subtests, were still running at 1m18s-2m31s each
when the alarm fired. On main at b1a0690249 shard 6 runs 9m and shard 1
6m, the lightest of the 15 (15: 8m), so shard 1 has the headroom for
the ~6 min of 4-slot wall the 12 subtests cost.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(proxied): split TestProxiedServerClose3 again into Close3 + Close4 (#7151)
Shard 1 timed out at 15m on this PR's own run (job 111392255572) with
Close3 pinned there: Close3's 12 bd-init subtests finished at 3m33s, but
they held the 4 parallel slots long enough that TestProxiedServerDep2's
subtests only began at 5m35s and were still running when the alarm
fired. Shard 6 did the same before it. Meanwhile shard 5, the shard this
PR exists to relieve, ran 5m with the first 11 subtests.
So 12 inits in one parent is too much for any host shard. Close3 keeps
its first six subtests on shard 1; the last six become
TestProxiedServerClose4, pinned to shard 7 (7m on that run). The
durations file apportions the one 174.6s capture 11/6/6.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci(proxied): move the Close3 and Close4 pins off legacy shards 1 and 7 onto 13 and 2 (#7151)
The run at 765248af5 put every Proxied Dolt Cmd shard green, with shard 5
down from the 15m alarm to 5m50s. But shard 1, chosen for Close3 as "the
lightest of the 15 on main", ran 14m48s there, the heaviest of the
fifteen: TestProxiedServerDep2's 29 parallel bd-init subtests alone take
about 10.5 minutes of 4-slot wall on this lane, and Close3's six init
subtests landed on top of them. Shard 7, where Close4 went, ran 13m50s
behind TestProxiedServerReady and TestProxiedServerState.
Pin Close3 onto shard 13 (6m51s on that run) and Close4 onto shard 2
(7m57s). Not shard 5: it is light only because Close left it, and
putting Close3 back would recreate most of the set that timed out. The
30-shard Bazel block is unchanged.
Verified: BEADS_TEST_SHARD_LIST_ONLY=1 .github/scripts/proxied-test-shard.sh
13 15 lists Close3 and 2 15 lists Close4, neither on 1 or 7;
gen_proxied_shard_manifest.py 30 --weights=duration --check exit 0;
go test ./scripts/ -run 'Shard|Manifest|Coverage' ok.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(close): verify bead gates on the proxied-server route (wy-j48b3y)
The close pre-check built its bead-gate lookup on the local store, which
the proxied-server route never opens (the root pre-run short-circuits to
uowProvider). So `bd close <gate>` on a bead gate refused with
"no local store available" there even after the awaited bead had closed,
while `bd gate check` resolved the same gate through its fresh-read
getter. Item 1 of #5861.
The pre-check now picks the getter by route: proxied-server reads through
the same proxiedFreshReadGetter gate check uses (local read, then prefix
routes); direct and embedded keep the store-backed routed getter.
Tests: a proxied integration test covers the open-target refusal (which
now names the target's status), the closed-target close, and --force;
against the old code it fails with the exact upstream refusal. A unit
test pins the route selection. Docs and CHANGELOG drop the limitation.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci(shards): list TestProxiedServerCloseBeadGate in the proxied 30-shard manifest
#7129 turned the Bazel 30-shard block of
.github/scripts/proxied-cmd-test-shards.txt into an exact-once coverage
gate (TestProxiedShardManifestGeneratorNotStale in scripts/). This PR's
merge-base predates that gate, so after the rebase onto current main the
gate fails with "missing (1): TestProxiedServerCloseBeadGate", the
proxied integration test this PR adds.
Generated with the gate's own fix command,
`python3 scripts/ci/gen_proxied_shard_manifest.py 30 --weights=duration --write`.
The write is incremental: it puts the one name on the lightest shard (2)
and moves no existing assignment. The frozen 15-shard block is untouched.
Agent-Signature: claude-code-unknown-model-max on behalf of Eddie the Engineer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* ci: bigger runners for the slowest CI legs (MCP gate, Bazel test, Windows preflight)
Runner-size A/B against merge group 37721729916 (3m49s):
- package-mcp: 4 -> 8 vCPU with pytest -n 16 (BEADS_MCP_PYTEST_WORKERS,
mode remote only; forks/ubuntu-latest keep package-mcp.sh's default 8).
pytest was 70s, dominated by CPU-bound per-test `bd init` setup. Local,
pinned with taskset: -n 8 on 4 CPUs 112s; -n 16 on 8 CPUs 60/57/58s,
228 passed / 5 skipped in all three runs.
- bazel-test: 2 -> 4 vCPU. `bazel test //... --config=ci` spent ~63 of
81s in client-side loading/analysis (critical path 7.65s, every action
a remote cache hit).
- pr-preflight-platforms Windows leg: 4 -> 8 vCPU. main.yml's test-windows
saver stays on 4 vCPU: the cache keys name runner.os/runner.arch, never
the label, and actions/cache's version covers only paths + compression,
so the entries are not size-specific; the other Windows consumers keep
their exact label. TestWindowsPreflightLegReachesSaverAcrossSizes pins it.
Runner labels live in the shared constants in
scripts/ci_blacksmith_runner_test.go; TestBlacksmithBazelRunnerSizes checks
every bazel.yml lane's runs-on and the MCP worker count per rbe mode with
evalGHExpr. Revert any bump that does not save at least 15s.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(pr): keep the Windows preflight leg on 4 vCPU (A/B: 8 vCPU queued 63s)
#7381's PR run put pr-preflight-platforms' Windows leg on
blacksmith-8vcpu-windows-2025. The cache restore from main.yml's 4 vCPU
test-windows saver hit, but the job waited 63s for an 8 vCPU Windows runner
and finished at 144s against the 129s baseline on 4 vCPU, so the leg goes
back to blacksmith-4vcpu-windows-2025. With saver and consumer on one label
again, TestWindowsPreflightLegReachesSaverAcrossSizes and the separate
preflight runner map have nothing left to pin and are dropped; the result
is recorded next to platformsMatrixRunners, in pr.yml and in
CI_REQUIRED_CHECK_TOPOLOGY.md.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Two fresh-connection paths ran CALL DOLT_CHECKOUT unconditionally:
beginTxOnConn (the fallback path for the ignored-tables tx) and
pinStoreBranch (used by the long-timeout versioned reads and the
blocked recompute). A fresh session is normally already on the requested
branch, so the checkout is a no-op. A least-privilege Dolt user may be
granted EXECUTE on dolt_add/dolt_commit alone, and it is denied even a
no-op checkout. For such a user:
bd create --graph / bd mol wisp
-> failed to checkout ignored tx branch main: Error 1105 (HY000):
command denied to user ...
bd history, bd recompute-blocked
-> checkout active branch "main": ... command denied
Both sites now share checkoutBranchIfNeeded, which reads active_branch()
and checks out only when the session is on a different branch, matching
what beginBorrowedTx already does. A real switch still happens when one
is needed. pinStoreBranch now documents that conn must be a single
session.
Tests: mock-driver tests cover the skip, a real switch, and a failed
branch read. Two real-server tests run as a least-privilege user (SELECT
on the database, DML on the data tables, EXECUTE on dolt_add/dolt_commit
only, pool pinned to one connection). They cover a wisp write through the
fallback, RecomputeAllBlocked and History; each fails with the denial
before the fix.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): fetch the LLVM toolchain as a 149 MB slice; re-key the runner cache
Port of gascity #7279. @llvm_dist_linux_x86_64 downloaded the 1.94 GB
LLVM-22.1.8-Linux-X64.tar.xz and ran a single-threaded `tar -xJf` over
11 GiB to keep a 688 MB slice. That took 94-147 s in every Bazel lane,
and every cgo, race and stdlib action waits on it.
- llvm_dist.bzl gains `sliced`: download_and_extract of a members-only
.tar.zst, plus a missing-member check. The xz path stays.
- MODULE.bazel pins the toolchain-llvm-22.1.8-slice-1 asset by sha256
(de614777...6bec5). The URL is gascity's release asset for now; the
list form leaves room for a beads mirror of the same bytes.
- tools/cc_toolchain/repack_llvm.sh and llvm_members.txt rebuild the slice
from the pinned upstream release.
- Runner cache v4, keyed on MODULE.bazel too. MODULE.bazel.lock does not
record llvm_dist, so the v3 key never changed and kept restoring the
2.9 GB entry that holds the xz archive.
- bazel_hermetic_cc_test: a sliced llvm_dist may only download from a
gastownhall/beads or gastownhall/gascity release, and its members must
equal llvm_members.txt.
Verified locally:
- Every file in the extracted slice (2009 entries: types, modes,
symlink targets, sha256) is identical to the xz extraction.
- aquery action keys are identical, base vs head, at the same workspace
path: 7565/7565 over deps(//cmd/bd:bd_for_tests) and 7146/7146 over
the race deps(//internal/storage/embeddeddolt:embeddeddolt_test).
- Extraction time: 178 s (xz) vs 1.9 s (zstd).
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the release cross-compile as its own lane
After the LLVM slice, bazel-pure is the longest cached Bazel lane (about
170 s). Its "Cross-compile every release target" step takes 54-58 s of
that (78.9k configured targets, 25k cache-hit lookups) and shares no
analysis with the pure invocations, because release_cross is a split
transition.
The step moves, unchanged, into a new job, bazel-release-cross ("release
cross-compile"). The job uses bazel-pure's runner, `needs: rbe` and skip
rule, so it runs in every mode except skip. It reports job.status like
every lane: the workflow_call output is bazel-release-cross, and pr.yml's
CI Gate requires it as BAZEL_RELEASE_CROSS. bazel-gate.sh skips it only in
mode skip, as it does BAZEL_PURE. Merge groups use the same pr.yml gate.
Push and dispatch runs gate nothing. Existing gate ids are unchanged.
The policy test now pins the step to bazel-release-cross, requires the new
gate id, and rejects any other job that runs the script (no double runs).
The new job is listed as having no CI analytics step. It captured no BEP as
a bazel-pure step either, and the analytics steps are unchanged. Docs:
LINTING.md, TESTING.md, CI_REQUIRED_CHECK_TOPOLOGY.md.
Expected: bazel-pure about 110 s on cached runs; the new lane about 85 s,
in parallel. Cost: one more 2-vCPU Blacksmith runner per run.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): stop building protoc for protoc-gen-validate
github.com/envoyproxy/protoc-gen-validate ships validate/validate.pb.go,
but its own validate/BUILD makes the Go library a go_proto_library. So
every lane built protoc from source just to regenerate that file. The
module reaches the graph only through grpc xds and the cloud SDKs.
A gazelle_override now regenerates the module's BUILD files with
`gazelle:proto disable`. It sets build_file_generation = "on" and adds
`gazelle:build_file_name BUILD.bazel`, so gazelle writes BUILD.bazel
(which Bazel prefers) instead of keeping the upstream BUILD. The proto
directive alone changes nothing, because the upstream BUILD files win.
validate is now a plain go_library over validate.pb.go.
Measured locally with aquery:
- //... minus the manual release_cross target: base has 2096 CppCompile,
612 CppArchive, 314 CppLink and 1 GoProtocGen action; head has 0.
- cquery somepath(//..., @protobuf//:protoc): base goes through
grpc xds -> envoy core/v3 -> validate_go_proto -> protoc; head is
empty.
- deps(//cmd/bd:bd_for_tests): 7565 actions become 3077. The race
deps(//internal/storage/embeddeddolt:embeddeddolt_test): 7146 become
2658.
MODULE.bazel.lock does not change. The v4 runner cache key includes
MODULE.bazel, so it still moves. Expect one cold compile of the Go
packages above validate on the first run after merge.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): bazel mod tidy formatting
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
PR preflight process (windows-latest) is a CI Gate input and, after the
Bazel fixed-cost work, the merge-group critical path (ends at +247..+303s).
Step timings from merge group 37710264475 and seven same-repo PR runs:
45-115s setup (setup-go, then module and build cache tar extraction),
33-71s "Exercise the real Bash process boundary", 27-58s ./cmd/bd test
compile+link, 5-9s each for three more go test relinks.
- scripts/pr_preflight_test.go: the ~29 pr-preflight.sh runs (about 1.5s
each under Git Bash on Windows, 42.8s total in the merge group) now run
as parallel subtests. Each run already had its own temp dir, call log
and env; the one test that t.Setenv's stays serial. Linux: 4.8s -> 0.8s.
- pr.yml: the hook-timeout step and the bd build fallback step become one
go test of ./cmd/bd, saving a package re-hash and test-binary relink
(5-9s on Windows for a sub-second test). Policy tests and the allowlist
and topology docs follow the step name.
- warm-non-race-cache.sh: on Windows also compile the three CGO_ENABLED=0
credential-fixture test packages the Windows-only fixture step runs, so
main.yml's test-windows seeder covers them.
No step, test or gate input is dropped; the job id, name, matrix and
runner are unchanged.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cli): emit claim failures as structured JSON under --json (wy-kxgf4)
Protocol v0 §E5 requires that with --json, errors are emitted as a JSON
object carrying at least "error" and schema_version: 1. bd honored that on
the not-found path but not on the claim paths: `bd update <id> --claim
--json` printed
Error claiming t04...-qqr: issue already claimed by alice
as plain text on stderr, so an agent driving bd with --json got an
unparseable line for the single most common contended-write failure it has
to branch on. The §E4 message contract held (the class and the holder/state
are named); the §E5 structured contract did not.
Route both claim paths (the direct-store loop in update.go and the
SQL-server proxied path) through a new reportClaimFailure helper: under
--json it emits {error, schema_version:1} via jsonStderrError, otherwise the
plain-text wording is unchanged, byte for byte, since §E4 tests pin it. The
JSON object goes to stderr so a mixed batch's stdout stays the clean array
of the issues that did update; the stream split itself is proposal OQ-5 and
is not pinned.
Un-skips TestProtocol_ErrorClass_ClaimFailures_StructuredJSON, which was
written against the clause and skipped pending this fix; it now passes and
becomes the guardrail. Full cmd/bd/protocol package green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test(protocol): pin claim refusals on the single --json batch report (wy-kxgf4)
Adopt-PR review fixup for #4756, iteration 1. It takes option (a) from
the review synthesis, which is also maphew's CHANGES_REQUESTED fix: drop
the eager per-claim JSON object and pin §E4/§E5 on main's centralized
batch report instead.
Major 1 (claude+codex, maphew's blocker). Under --json, a refused claim
printed two JSON documents on stderr: the indented reportClaimFailure
object, then reportUpdateFailures' compact {error, failed,
schema_version} summary. A consumer reading the whole stream, or main's
documented "last stderr line", did not get one document. Main has
already moved on (wy-ghg0d). That summary reports every per-id refusal,
and the refused id's failed[] entry already names the class and the
holder or state:
{"error":"1 of 1 issues failed to update","failed":[{"id":"…",
"error":"updating issue: issue already claimed by alice"}],
"schema_version":1}
So cmd/bd/errors.go, update.go and update_proxied_server.go go back to
base byte for byte. reportClaimFailure and its two call sites are gone,
and text output, stdout and exit codes are main's. That supersedes the
helper the contributor commit describes. The PR now changes only tests,
so its title and squash message should say so at finalize. This also
covers the commit-message nit.
Major 2 (the proxied claim arm was not gated on `claim`, so a proxied
--assignee fence refusal read "failed to claim") is moot: the object it
mislabelled no longer exists. Both routes report through the same
summary. The message-drift minor is moot too. So is the synthesis's
follow-up about the direct route's non-claim fence refusals under
--json: they already land in the same failed[] list. The remaining
"updating issue:" vs "claiming issue:" entry prefixes are pre-existing on
main.
TestProtocol_ErrorClass_ClaimFailures_StructuredJSON stays un-skipped
and is re-pinned. It now requires:
- exactly one top-level JSON error document (the new jsonErrorDocs steps
over each decoded object, so failed[] entries are not counted);
- §E5's error and schema_version on that document;
- a failed[] entry for the refused id that names "already claimed" and
"alice", or "not claimable" and "closed".
TestProxiedServerUpdate gains
claim_conflict_json_reports_holder_in_failed_entry, the proxied
guardrail the review found missing. Two test-gap asks are dropped
because they targeted the claim-only branch, which is gone: the
--assignee --json negative case, and --format json (which reaches the
same jsonOutput-keyed reporter).
Validation (local Dolt 2.2.0 server, scrubbed env):
- cmd/bd/protocol, whole package, with BEADS_PROTOCOL_REQUIRE_DOLT=1:
109 pass, 1 pre-existing PTY skip.
- Mutant (this PR's original errors.go, update.go and
update_proxied_server.go restored): the protocol test and the new
proxied subtest both fail on "2 JSON error documents"; both pass at
this head.
- TestProxiedServerUpdate (proxied-lane env): all subtests pass.
- TestParityUpdate* (including TestParityUpdateJSONFailureReport) and
TestMultiIDUpdate*: pass.
- make ci-pr-lint: 0 issues (native, windows, darwin).
Follow-up, not in this PR: typed claim-conflict fields in failed[]
(issueops.ClaimConflictError's holder and status), so consumers need
not match on message text.
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 4.8 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
gascity commit 9865cc045aee1391dbcc7eac99339c26e3a5ce71 fixed a
production bug: negative protobuf durations in the compact exec log
were decoded as unsigned, so the collector rejected roughly 22% of
artifacts on remote_queue_ms. Re-vendor the extractor and its unit
test byte-identical from that commit and update the sha256 pins in
ci_analytics_extract_test.go accordingly. testdata/ci_analytics/ is
untouched by the fix; its tree-hash pin is re-verified unchanged
against gascity's tree.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
rbe-west's pool workers run gascity main's tools/rbe/worker-env and
advertise its pin; the schedulers match //platforms:rbe_worker's pin
exactly. When gascity re-pins and beads' copy falls behind, every remote
action queues until the lanes time out, and the only check ran nightly
with no notification (review finding S1).
- bazel.yml's rbe job: after decide, only when the lanes execute remotely
(enabled: modes remote, fork-ro, fork-rw; merge groups are remote), a
sparse checkout of tools/rbe and platforms and tools/rbe/worker-env-sync
main. Out of step fails the job, so every lane skips and pr.yml's gate is
red within a minute, with the diff and the pin to commit in the summary.
No fallback to mode cache: pr.yml's ci-gate requires a remote run
(BAZEL_REMOTE), so it would be just as red, only slower. gascity
unreachable warns and proceeds. The steps set no output; the job's
outputs stay decide's.
- worker-env-sync: exit 1 only for out of step, exit 2 (warning) when it
cannot compare (ERR trap; curl timeouts), WORKER_ENV_SYNC_REPORT copies
the markdown report.
- nightly.yml: top-level permissions contents: read; rbe-worker-env-sync
gets issues: write and, on exit 1, tools/rbe/worker-env-sync-issue opens
a ci/infra issue with the report or updates the open one (body + comment
linking the run). GITHUB_TOKEN is in that one step.
- Policy tests: TestBazelRBEWorkerEnvPreflight (shape + the step's script
run in step / out of step / unreachable), TestNightlyWorkerEnvSyncOpensIssue
(permissions, token scope, rc output, issue create/update via a stub gh),
TestRBEWorkerEnvSync (exit codes, report); rbe job step and checkout
counts updated.
Agent-Signature: claude-code-claude-opus-5-5-medium on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
checks.nix's hook-timeout-backends (the tracked git hook shims against
real GNU/uutils/busybox/toybox timeout implementations, with and without
perl, under dash, bash and busybox ash: 240 cases) was the one test PR
Risk's test-nix ran on a GitHub runner, through `nix flake check`. It is
now //tests/hook_timeout_backends:hook_timeout_backends_test, an sh_test
(pr-core-only) that the bazel-test lane runs remotely on every PR: the
static uutils 0.12.0, busybox 1.35.0 and toybox 0.8.15 binaries come in
sha256-pinned through MODULE.bazel; dash, bash, perl and GNU coreutils
from the executor, failing (not skipping) when one is missing.
checks.nix goes and flake.nix declares no checks, so test-nix's
`nix run .#default` + `nix flake check` is a packaging check (build the
package Nix users install, evaluate every flake output), not a test.
TestHookTimeoutBackendsRunUnderBazel pins the target and that no flake
check comes back.
ga-96smfk.22
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- pr.yml's Windows jobs and the macOS/Windows legs of pr-preflight-platforms
and check-doc-freshness-platforms run on Blacksmith for every PR and merge
group, forks and Dependabot included: no windows-latest/macos-latest
fallback (Blacksmith serves this org's fork PRs). Matrix legs name their
label (runs-on: ${{ matrix.runner }}); the same-repo "matrix marker"
ternary and its policy plumbing are gone.
- pr-preflight-platforms drops its Linux leg: its tests run under Bazel on
rbe-west (//scripts:scripts_test, //cmd/bd:bd_test,
//internal/config:config_test).
- The Linux-cross-compiled Windows path is retired: windows-test-binaries,
its two -prebuilt twins, main.yml's windows-test-binaries-cache, the
WINDOWS_PREBUILT_REQUIRED flag and the build script/manifest. The native
pair (test-windows-liveness, worktree-remove-windows) is the required run.
- main.yml's test-windows and blacksmith-macos-go-build-cache drop their
GitHub-hosted venue legs (no GitHub-hosted consumer left).
Gate names unchanged. ga-96smfk.22
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Push to main and the nightly schedule no longer run go test or repo checks
on GitHub runners (ga-96smfk.22, ga-96smfk.58):
- main.yml keeps only the macOS -race -short suite, the Windows smoke build
and the push-to-main savers of the GOCACHEs pr.yml's Windows/macOS jobs
restore. Its Linux jobs (migration hygiene, build artifacts, build tags,
versions, duplicate migrations, doc flags, package gates, PR policy
wrapper, gofmt, the Linux and setup-go cache seeders, the Nix flake
check) are gated on the merge queue's pr.yml/pr-risk.yml run of the
same commit and re-run as Bazel targets by bazel.yml's push run.
- nightly.yml is the fresh bazel.yml call plus the worker-env check; its
Full Test Suite, PR Core go-test-json side and measure dispatch are gone,
as are ci-measurements.yml and bazel.yml's go-test-json-artifact input.
- The non-race embedded batch-apply step becomes
//internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test
(go_test_race_off, BEADS_TEST_EMBEDDED_DOLT=1) in the embedded tier.
- make ci-pr-policy and scripts/ci/pr-policy.sh go: every check it ran is
a Bazel test (TestPRPolicyChecksRunAsBazelTargets).
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bd_managed_local_test (#7326) fails on every fork PR's proxied lane:
the rbe-west fork tier forbids nested namespaces, so unshare exits with
ENOSPC, but that tier already runs every action loopback only. When
unshare is unavailable, run the binary directly after the same outbound
probe proves the network is absent; a host with network and no
namespaces still fails.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Every pull_request and merge group already took the Bazel lanes for the
retired tiers (BAZEL_RETIRES_LEGACY_* and BAZEL_COVERS_FORKS all "true",
and pr.yml/pr-risk.yml run on no other event), so the legacy jobs those
flags stood down could never run again. Remove them with their decision:
- pr-risk.yml: build-embedded, test-embedded-{storage,conformance,cmd},
test-proxied-cmd, test-server-storage{,-full}, detect-ci-tier (and its
ci-embedded-tier.sh / ci-capability-selector.sh scripts) and
bazel-coverage. PR Risk keeps the Nix packaging check (test-nix) and its
gate, PR Risk Gate / Required.
- pr.yml: build-artifacts, check-cmd-bd-puregeo-tests, pr-core-wrapper and
bazel-coverage; the BAZEL_RETIRES_LEGACY_* and BAZEL_COVERS_FORKS flags.
The three BAZEL_*_RETIRED gate ids become one, BAZEL_REMOTE: the Bazel
call must have run remotely (remote, fork-ro or fork-rw) on every PR and
merge group, each lane's own id still required. Gate names unchanged.
Policy tests: the D2 decision matrix becomes
TestPRGateRequiresRemoteBazelLanes (bazel.yml's actual rbe step and
pr.yml's actual gate over every event/variable/secret/fork/actor/mint
fact); the parity tests that read the legacy jobs now pin the Bazel lanes
against those jobs' frozen commands.
ga-96smfk.22
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
tools/bazel/ci_analytics_extract.py turns a lane's BEP file, compact
execution log and JSON profile into a redacted ci-analytics-summary
(timing, per-mnemonic cache classes, cold actions, test results,
repo-fetch time): only validated labels, mnemonics, enums and numbers
leave the runner, never an endpoint, cert/key path, env value, token
or hostname. Every lane's "CI analytics summary" step runs the
extractor and uploads its output as ci-analytics-<lane>-<run_attempt>
(7-day retention); CHECK_RUN_ID uses the real job.check_run_id
context (requires actionlint >= 1.7.8), and both the summary and
upload steps are continue-on-error, the summary capped at
timeout-minutes: 3, and both gated on !cancelled() (not always(),
which also runs after a workflow cancellation).
The extractor, its 62-case unittest file, and testdata/ci_analytics/
(the real/* Bazel 9.2.0 fixtures, poisoned-bep.json, mismatch.bep.jsonl
and regen.sh) are vendored byte-identical from gascity's
ci/analytics-extractor slice (final squashed commit
00161373bc7bbfcef8d6a05ac5ce70409fc7f2ac), which is canonical for this
pair the same way tools/rbe/cache-zstd-probe.sh is a byte copy.
Fixtures are regenerated under env -i with every BEP field stripped
unless it's on an explicit allowlist, and the compact exec log is
committed decompressed (*.binpb) rather than as a zstd frame, so
nothing opaque reaches version control.
scripts/ci_analytics_extract_test.go is the thin Go wrapper:
TestCIAnalyticsExtractorIsPinnedToGascity pins both vendored files'
sha256 so local drift is caught, and TestCIAnalyticsExtractUnitTests
runs gascity's unittest file in place. scripts/ci_analytics_workflow_test.go's
TestCIAnalyticsStepsAreSafeAndBounded mirrors gascity's pin test,
adapted to beads' 8 separately-named lane jobs: continue-on-error,
timeout-minutes bounds, no raw ${{ }} expression in run:, !cancelled()
required in if:, correct per-lane upload artifact name/path, and
CHECK_RUN_ID == ${{ job.check_run_id }}, for every lane.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* feat(cli): bd create --graph via BatchApplier (spawner_id, thread_id)
Reapplies S11's graph-batch-apply half onto origin/main's post-#7203
state: `bd create --graph` now builds its plan through
issueops.BatchApplier instead of the removed buildDomainGraphPlan path
(create_proxied_server.go shrinks accordingly), spawner_id is stamped
only when a node names a spawner (RunBatchApplyStampsSpawnerIDOnlyWhenNamed
conformance case), and thread_id survives translation into
issueops.DepAddItem alongside the rest of GraphApplyEdge/GraphApplyNodeDep.
Entirely independent of #7203's --if-revision work: no file in this
commit overlaps #7203's or #7205's changed files.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(cli): extend #7203's --if-revision guard to bd reopen
#7203 (37acca96d) added --if-revision to update/close/assign/delete but
not reopen, even though issueops.ReopenRequest.ExpectedVersion already
existed upstream. Wire reopen.go and reopen_proxied_server.go through
the same parseIfRevisionFlag / requireSingleIfRevisionID /
reportIfRevisionFailure / ifRevisionFlagHelp helpers #7203 introduced,
so reopen gets identical one-id-only, exit-13-on-mismatch, gascity-
compatible-body behavior as the other four verbs, with no new helper
surface of its own.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(cli): gc-matcher decode pin and proxied-server --if-revision coverage
#7203 never ran its mismatch body through gc's actual decode logic (only
through bd's own JSON assertions), and it only exercises --if-revision
through the embedded/direct route -- the proxied-server path
(*_proxied_server.go's uow-backed preflight/apply) had no coverage at
all on either side.
- if_revision_gc_matcher_test.go: a faithful port of gc's
bdstore_conditional.go decode logic, run against a real built bd for
all five guarded verbs (including reopen). Confirms against #7203's
actual numeric-only body that no decimal-string twins are needed:
encoding/json decodes a JSON number straight into an int64 struct
field with no float64 intermediate, so there is no precision loss for
gc's matcher to lose above 2^53 the way there would be decoding into
an untyped interface{}.
- if_revision_proxied_integration_test.go: proxied-server-leg coverage
for all five verbs (update/close/reopen/delete/assign), using a
numeric-only proxiedPreconditionBody matching #7203's shape exactly
(no _str fields, since the matcher test above shows none are needed).
reopen's case is its only --if-revision coverage on the proxied route
at all, since #7203 did not add the flag to reopen.
Both verified for real: TestGCConditionalMatcherDecode via
BEADS_TEST_EMBEDDED_DOLT=1, the five TestIfRevisionGuardProxied* tests
via BEADS_TEST_PROXIED_SERVER=1 BEADS_TEST_DOLT_SERVER=local against the
pinned dolt 2.2.0 binary (no Docker needed).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(changelog): document graph-batch-apply and if-revision-reopen deltas
Neither #7203 (--if-revision) nor #7205 (batch create/import perf)
touched CHANGELOG.md, so document this branch's two deltas on top of
them directly: bd create --graph via BatchApplier (spawner_id/thread_id,
field-survival test, real-store hierarchy/cycle scenarios), and
--if-revision's extension to bd reopen plus its gc-matcher decode pin
and new proxied-server coverage.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cli): adapt reopen's reportIfRevisionFailure call to #7216's signature
#7216 (merged to main, landed in this rebase) added a fourth ifRevision
*int64 parameter to reportIfRevisionFailure for reassign-fence
disambiguation. Pass bd reopen's own declared --if-revision value at both
call sites (direct and proxied-server paths) to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37290168028
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* fix(cli): evaluate reopen's --if-revision guard before the already-open short-circuit
bd reopen's direct route checked issue.Status == StatusOpen before ever
calling ops.Reopen, so a stale --if-revision guard against an
already-open issue silently returned the "already open" no-op (exit 0)
instead of the precondition_failed refusal (exit 13) every other guarded
verb gives for a stale token. ops.Reopen itself already evaluates
ExpectedVersion first (ExecuteReopen -> CheckVersionInTx) on both the
dolt and embeddeddolt backends, and the proxied-server route already
called through unconditionally -- only the direct route's pre-check
bypassed it.
Fix: skip the already-open pre-check when --if-revision is set, letting
ops.Reopen evaluate the revision guard first. Without --if-revision,
today's behavior for already-open issues is unchanged.
Tests:
- if_revision_reopen_embedded_test.go (new): direct route, all four
combinations (already-open/closed x stale/matching revision). Verified
live that already_open_mismatch_refuses fails against the pre-fix
ordering and passes against the fix.
- if_revision_proxied_integration_test.go: added the same already-open
coverage to TestIfRevisionGuardProxiedReopen to confirm the
proxied-server route already behaved correctly and keeps doing so.
Also documents in CHANGELOG.md that a `bd create --graph` plan over
issueops.MaxApplyBatchItems (1000) is refused outright with
GraphApplyTooLargeError (non-blocking review item).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cli): put guard tests in CI lanes; fence unguarded reopen errors
Maintainer fixup for #7209, review loop iteration 1. It replays the prior
adoption's stranded fixup (f71ac4f66) on top of the contributor's own fix
for the direct-route reopen guard (266cacfca1). The contributor's fence
and tests are kept, and the fixup's overlapping reopen fence and
open-issue pins are dropped.
CI lanes: seven env-gated tests matched no lane's discovery pattern, so
no CI job ran them, including the reopen fix's own pin. The proxied tests
are now TestProxiedServerIfRevisionGuard{Update,Close,Reopen,Delete,
Assign}. The gc matcher test moves to
if_revision_gc_matcher_embedded_test.go as
TestEmbeddedGCConditionalMatcherDecode, and the direct reopen test is
TestEmbeddedIfRevisionReopenGuardDirect. BUILD.bazel and both shard
manifests are regenerated, and each renamed test is selected by exactly
one shard of every lane.
bd reopen:
- reportIfRevisionFailure now runs only when --if-revision is set, on
both routes, as update, assign and delete already do. Since #7256 the
classifier maps storage.ErrNotFound to precondition_failed, so an
unguarded reopen that lost a race with a delete reported a guard
refusal (exit 13) for a command that carried no guard.
- The gc matcher test gains a reopen_open row: a stale guard on an open
issue gets the same refusal body. The matching-guard no-op subtest now
also checks the "already open" line and that the revision did not move.
bd create --graph:
- A node naming both a plan-local parent and a parent_id is parented under
the plan key again, as both legs did before the BatchApplier translation
and as the dry-run preview and the local cycle check assume
(TestBuildGraphApplyBatchRequestParentKeyWinsOverParentID).
- Removed dead code: graphApplyParentDepPairs, graphApplyDepPairKey and
GraphApplyUnsupportedFieldError, with the helper-only test.
- A path from a node's parent to the node through a waits-for hop is now
stored, as bd dep add and bd batch apply already store it, because the
shared end gate walks the scheduling edges only. That shape can stall
ready work once the spawner has an open child. The acceptance is
documented in the CHANGELOG and the buildGraphApplyBatchRequest comment
and pinned by TestExecuteGraphApplyAcceptsParentToChildPathThroughWaitsFor.
Refusing the shape belongs in the shared role (types.IsSchedulingEdge),
for every front door at once; that is a follow-up.
- The deleted fake-store rejection scenarios are ported to real-store
tests: reverse parent-to-child blocking edges, a reverse parent-child
edge cycle, and the end gate alone with SkipPerEdgeCycleCheck set.
- The graphApplyEdgeBatchMetadata comment names the real
issueops.StampWaitsForSpawnerID.
CHANGELOG: the spawner stamp is described as a waits-for edge's
metadata.spawner_id, and the reopen entry says a guarded reopen of an
open issue is judged against the guard on both routes.
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>
* test(cli): name #7292 in the waits-for acceptance marker
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Bazel is beads' build and test system: bazel.yml's lanes gate every PR,
and nogo (lint + vet), gofmt and the repository guards exist only as
Bazel targets. The docs, the Makefile and the hooks now say so.
Makefile: `make test` runs bazel.yml's test lane (`bazel test //...
--config=ci`), `make check` adds the testing.Short policy and the
`make ci-pr-lint` nogo gate, and `make check-docs` runs the docsync and
doc-freshness Bazel targets before the pinned-release CLI flag check.
BAZEL_FLAGS passes --config=fork-cache or --config=remote-exec through.
The plain-Go recipes stay as explicit twins: test-go, check-go,
check-docs-go. No workflow called the primary names, and
TestWorkflowsNameTheirTestEngine keeps it that way.
Hooks: pre-push runs scripts/pre-push-suite.sh for branch pushes whose
commits change Go or Bazel inputs: the test lane with
--config=remote-exec when some rc names an executor, else
--config=fork-cache. Without bazel, or with BD_PREPUSH_SUITE=go, it runs
make test-go under a banner saying that is not what CI gates on.
Docs: AGENTS.md, CONTRIBUTING.md, engdocs/TESTING.md (a per-lane command
table and the fork-cache/remote-exec setup), README, RELEASING, the PR
template and the .bazelrc header. Bazelisk is a required prerequisite;
go test is an inner-loop convenience CI does not enforce.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gascity now builds the worker-env manifest from the worker's toolchain,
not the image's patch revisions. The manifest records the arch, the OS
release, Go and dolt, and the upstream releases of the libraries and
tools actions reach (major.minor; git and yq at their major). The Debian
epochs and Ubuntu revisions are gone, so the Blacksmith image's routine
security updates no longer move the hash. That is what stranded every
remote action on 2026-10-07: coreutils 9.4-3ubuntu6.1 -> 6.2 and libc6
2.39-0ubuntu8.6 -> 8.8 forced re-pins (gascity #7266, beads #7338).
- tools/rbe/worker-env.txt: byte-identical copy of gascity's new
manifest. platforms/BUILD.bazel pins its sha256,
sha256:6be1381cf08e7fd66684cfce6f26aca57de2561e722c505d1f2f578e9fdeafa7.
The manifest now also measures python3, curl, openssl, unzip and yq,
which //scripts:scripts_test runs from the executor.
- scripts/rbe_worker_env_test.go: the manifest must be a rendering of
gascity's tools/rbe/worker-env (sorted; one arch, dolt, go, os and yq
line; packages at most major.minor, installed). A copy of an older
gascity manifest with dpkg revisions, a hand edit or a truncated copy
fails here.
- tools/rbe/worker-env-sync, run by nightly.yml: compares the manifest
and the pin with gascity's main byte for byte. If they differ, it
prints the diff and the pin to commit, and fails.
Merge this together with the gascity change. Pool workers run gascity
main's provisioning, so they serve the new hash only once that change
lands, and beads' actions on any other pin queue. This supersedes #7338
(the old-format re-pin). The new key misses the cache once.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Blacksmith's runner image picked up Ubuntu security updates around
2026-10-07 02:28Z (coreutils 9.4-3ubuntu6.2, git 2.55.0, libc6 2.39-0ubuntu8.8,
sed, tar, util-linux). Pool workers now measure
worker-env=sha256:b2c8be1f53ba4c2f1603b1d65f31e0d4c7ddd498110b9928eda37f193c7eb674
while actions requested sha256:f4d6d0460877…, and rbe-west's oss and oss-fork
schedulers match worker-env exactly, so no action could run (pools idle,
queues growing, every pool run failing the env check). Re-pin to the
measured manifest, copied verbatim from the pool worker's report; gascity
and beads carry byte-identical copies.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): nogo replaces go vet and golangci-lint (ga-96smfk.18)
Lint and vet now run as nogo inside the Bazel build, so they gate wherever
the Bazel lanes execute (rbe-west), and the golangci-lint and go vet jobs
leave pr.yml and main.yml.
- //tools/nogo (own go.mod, joined to beads' for go_deps only through
gazelle.go.work): go test's vet checks (cmd/go's defaultVetFlags, the set
scripts/ci/go-test-vet.sh ran) plus the eight linters .golangci.yml
enables, each a wrapper over the library version golangci-lint v2.10.1
uses (depguard, errcheck, forbidigo, gosec, misspell, sloglint, unconvert,
unparam).
- .golangci.yml stays the single lint policy: Bazel embeds it and
tools/nogo/internal/golangci applies it as golangci-lint does (enabled
set, settings, run.tests: false as library-unit-only analysis, lax
generated-file detection, path/path-except/text exclusion rules), with
strict decoding so an unimplemented key fails the build.
- gascity's rules_go //nolint-range patch and x/tools ctrlflow patch,
byte-identical.
- Windows/darwin: cross-configured, not a golangci leg. The pure lane's
release cross-compile (//tools/bazel:release_cross, every library and
binary for all eight release platforms, cgo off) runs nogo on every
compile, a superset of golangci-lint's windows and darwin legs.
scripts/pr-lint (make ci-pr-lint, bd preflight) runs `bazel build
--config=nogo //...` plus release_cross for windows_amd64,darwin_arm64.
release_cross skips tools/nogo, a separate Go module `go build ./...`
never compiled.
- pr.yml: scripts-go-checks (vet) and pr-lint-wrapper (x3) are gone, with
their ci-gate entries; main.yml: pr-lint-wrapper (x6) and go-vet-cache.
scripts/ci/go-test-vet.sh and install-golangci-lint.sh are deleted.
- pre-commit hook and .pre-commit-config.yaml run `make lint-changed
LINT_CHANGED_SCOPE=staged` (nogo over the staged packages); Makefile adds
lint, vet and lint-changed. pr-lint.sh no longer runs gofmt
(//scripts/repochecks:fmt_test owns it; ga-96smfk.41).
- internal/testutil/integration: five gosec findings in integration-tagged
library files golangci-lint never built, now linted by the integration
lanes, carry reasoned //nolint directives.
Parity: with the exclusion rules removed, golangci-lint and nogo report the
same 3,916 findings natively and 3,859 each for windows and darwin (file,
line, linter, text); with .golangci.yml as committed both report none.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): equivalence.py leaves nested Go modules' tests out of go test's set
tools/nogo is its own Go module, so `go test ./...` in the root never runs
its tests; Bazel's unit lane does. Its packages are neither expected nor
extra.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The dolt-server lane (--config=doltserver) has been the only pre-merge run
of the Dolt-backed domain, uow, tracker, doctor/fix and protocol suites
since BAZEL_COVERS_FORKS went "true": bazel-coverage reports pr_lanes=true
for every pull_request and merge_group, so pr.yml's test-domain-uow and
contract-corpus never run. An A/B run of every requires-docker target
against its dolt-server twin on the same commit shows identical test sets
and statuses (2683 testcases) except TestDoltServerFingerprint/container,
the container half of the fingerprint, which needs docker by design.
Delete the six requires-docker sh_tests, test:docker in .bazelrc, the
requires-docker tag from the taxonomy and lane filters, bazel.yml's
dolt-lane dispatch input and image pull, and pr.yml's test-domain-uow and
contract-corpus jobs with their ci-gate wiring. The testcontainers backend
in internal/testutil stays: it is plain go test's default. pull-dolt-image.sh
stays for pr-risk.yml's legacy tiers. No required check changes: the
rulesets require only CI Gate / Required and PR Risk Gate / Required.
Refs ga-96smfk.21
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
rbe-ci-cost-latency-study.md recommendation 4: this tier's last shard
has trailed the rest by 4.3-4.5 min in 2 of 8 runs. tools/bazel/shard_budget.py
reads the job's BEP file and prints ::warning when a sharded target's
slowest shard exceeds max(150s, 2x median); --fail-on-imbalance (not
wired in yet) switches that to ::error and a nonzero exit once the
budget has run clean for a while.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
pr.yml's check-release-target-cross-compilation ran `CGO_ENABLED=0
GOOS/GOARCH go build -tags gms_pure_go ./...` for the eight release targets
on two GitHub/Blacksmith runners. It is now a step of bazel.yml's pure-Go
lane (BAZEL_PURE, already required by ci-gate):
scripts/ci/bazel-release-cross-compile.sh builds //tools/bazel:release_cross
once, remotely, with --//tools/bazel:release_platforms set from
scripts/ci/release-targets.txt (still the single source of truth, pinned to
.goreleaser.yml). release_cross's split transition configures every
go_library/go_binary for each rules_go platform with cgo off, so all eight
platforms build in parallel in one invocation.
- tools/bazel/release_cross.bzl: the split-transition rule and the
string-list flag.
- tools/bazel/go_srcs.py (make bazel-sync, checked by bazel-sync-check and
TestBazelGoSrcsBlocksCurrent) keeps the release_cross target list; the
script checks with bazel query that every Bazel package holding Go
targets is reached before it builds.
- //tools/bazel:pure_bd_has_no_cgo_only_deps: Bazel compiles gozstd's pure
stubs where `go build` rejects them, so the pure bd of every platform
must not link gozstd.
- //internal/storage/embeddeddolt/cmd:cmd (cgo-only main, skipped by
`go build ./...` under CGO_ENABLED=0) is tagged cgo-only and incompatible
with pure builds.
- A failed build is re-run per platform (cache hits) to name each failing
GOOS/GOARCH.
Same cgo-off coverage boundary as the retired job. Refs ga-96smfk.20.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cross-version-smoke.yml resolved the newest 5 GitHub releases (30 on a tag
push) with `gh release list`, then built the candidate and downloaded each
release on a GitHub runner for scripts/upgrade-smoke-test.sh.
//tests/upgrade_smoke has one target per release in the newest 30 the
release catalog pins a linux/amd64 asset for (@bd_releases//:versions.bzl):
upgrade_smoke_<release>_test runs the script against the non-race
bd_for_tests with that release pinned as PREV_BIN (sha256-verified when
Bazel fetches it; the script checks it reports the release and downloads
nothing). A release added to the catalog joins the window. Tagged
pr-core-only, so bazel-test (not the integration lane) runs them remotely
on every PR, merge group and
push, cached until the candidate, the script or the release changes.
The tested set is now reviewed rather than resolved at run time: stable
releases from the catalog, where the workflow took GitHub releases
including prereleases. cross-version-smoke.yml and the F7c checks of its
chunk fold, path filter, runners and binary cache are removed (the
path-filter and binary-cache checks had no other workflow left).
Refs: ga-96smfk.19
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(migration-test): extend the release catalog through v1.3.1
The catalog stopped at v1.1.2 (the v1.2 upgrade census). The migration
corpus already upgrades from v1.2.2, and the Bazel targets that replace
migration-test.yml and cross-version-smoke.yml take their pinned release
binaries from the catalog (@bd_releases), so it has to cover the releases
since. Regenerated with `catalog generate` after raising maximumVersion to
v1.3.1: five new stable versions (v1.2.0, v1.2.1, v1.2.2, v1.3.0, v1.3.1;
three with a linux/amd64 asset) and five new proxy prereleases; no existing
entry, drift record or repository-only exclusion changed. The count
constants and the identity digest are updated to match, and the README now
says how to add a release.
Refs: ga-96smfk.19
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the historical-upgrade corpus under Bazel; retire migration-test.yml
migration-test.yml ran scripts/migration-test/run.sh --version <release> for
14 reviewed releases in 3 shards on GitHub runners: it downloaded each
release archive, built v0.9.1 from source with Go 1.25 through the module
proxy, installed libicu74 and the dolt 2.1.8 runtime, all over the network.
//tests/migration now has one target per corpus release
(historical_upgrade_<release>_test) plus legacy_bridge_test, all hermetic:
- Published releases come from @bd_releases (the release catalog's
sha256-verified assets) through a per-target directory
(HISTORICAL_RELEASE_DIR); lib/binary.sh uses it instead of downloading and
still checks each binary's self-reported version.
- v0.9.1 is //tests/migration:bd_source_tag, the same `go mod download` +
`go build -trimpath` with CGO and Go 1.25.0, run offline as a build
action: the module files come from tests/migration/source_tag_modules.json
through a file:// GOPROXY tree (tools/bazel/go_module_proxy.bzl), the
release's own zip is the catalog's source_zip, and go checks every
dependency against the release's go.sum (SOURCE_TAG_SQLITE_BIN).
- The external Dolt runtime is @dolt_test_runtime_linux_amd64 (dolt.bzl's
dolt_release gains a version attribute; 2.1.8 is pinned to versions.sh's
digest), passed as DOLT_BIN to the server-Dolt and wisp-plane releases.
- The workers already provide jq, python3, sqlite3 and libicu74.
The targets are untagged, so bazel-test runs them remotely on every PR,
merge group and push; result caching replaces the path filter. Every
release also passed inside a loopback-only network namespace.
scripts/migration_corpus_bazel_test.go keeps the BUILD lists equal to
versions.sh's corpus, the catalog digests equal to STRICT_RELEASE_SHA256,
the source-tag lock equal to the catalog's source_zip, and the Dolt runtime
pin equal to versions.sh's. migration-test.yml and the policy tests that
pinned its shards, caches, apt step and runner are removed.
Refs: ga-96smfk.19
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the historical-upgrade targets in the PR-core lane only
The integration lane runs every untagged target too, and its
check_testcases.py requires Go testcases, which a shell test's test.xml does
not list. A new pr-core-only tag keeps //tests/migration out of
--config=integration (bazelIntegrationExcludedTags adds it), so the corpus
runs once, in bazel-test, against the release-shaped bd_for_tests (no
integration tag). build_source_tag.sh carries the build-tags opt-out: it
builds a historical release with that release's own go.mod, which predates
gms_pure_go.
Refs: ga-96smfk.19
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The real-GNU-timeout and real-Perl-alarm expiry subtests stand in a bd that
never returns with a bare `while :; do :; done`. On a normal run the helper
reaps it at 1s. When the go test process is killed mid-subtest, though, the
helper has already setpgid()d itself and the stub out of the harness's group,
the tree-kill reaches the helper by pid before its child, and the orphan is
reparented to 1 and spins at 100% CPU forever: one such stub was found 2.5h
old on a shared build box after a session teardown.
The stub now paces itself with sleep and exits 97 on its own after 60 ticks,
so a killed run leaks at most a minute of idle sleep. The generated hook runs
under a controlled PATH that carries only the fixtures and the helper under
test, so the test resolves sleep once (findHookProcessSleep, the same shape as
the Perl probe) and hands it to the stub as HOOK_TEST_SLEEP by absolute path.
The sleep's stdio is detached because Perl's alarm signals only the exec'd
stub, not a group, and the orphaned sleep must not hold the test's output pipe
open past exec.Cmd.WaitDelay.
Exit 97 is outside every status the hook normalizes, so a stub that outlives
the helper still fails the expiry assertions loudly.
Tests: go test ./cmd/bd -run TestGeneratedHookTimeoutProcessBoundary -count=1
(twice, darwin/arm64, bash 5 + coreutils gtimeout + perl); go vet ./cmd/bd.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
regression.yml ran `go test -tags=regression ./tests/regression/...` on a
GitHub runner: it built the candidate with `go build`, downloaded the v0.49.6
baseline release over the network, and pulled the dolt-sql-server image.
None of that works on rbe-west workers (no network for fork lanes, no docker).
- tools/bazel/bd_releases.bzl: a module extension that reads
scripts/migration-test/release-catalog.json and declares one repository per
catalog release with a linux_amd64 asset digest (bd_release_<version>,
verified against the catalog's sha256), behind the @bd_releases hub
(@bd_releases//:<version>, plus versions.bzl). Adding a release is a
catalog change only; nothing downloads until a test declares one.
- //tests/regression:regression_test: the suite's files build under
`regression || integration`, so gazelle generates the target. It runs the
injected non-race bd_for_tests (BEADS_TEST_BD_BINARY) against
@bd_releases//:v0.49.6 (BD_REGRESSION_BASELINE_BIN), both over a hermetic
dolt sql-server (BEADS_TEST_DOLT_SERVER=local, required), in 8 shards.
TestMain checks the baseline reports BASELINE_VERSION, so the label and the
file cannot drift. Tagged dolt-server-cmd: bazel.yml's bazel-cmd-dolt lane,
which pr.yml's gate requires, runs it remotely; test result caching stands
in for the old path detector.
- A plain `go test -tags=integration ./...` (nightly) compiles the files but
skips the suite; only -tags=regression (make test-regression) or Bazel
runs it.
- regression.yml, main.yml's warm-up compile for it and the policy tests that
pinned its jobs are removed.
Refs: ga-96smfk.19
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
fast-checks, PR Policy, and the Linux leg of check-doc-freshness-platforms
ran repository guards on GitHub runners. They now run as Bazel tests in
bazel.yml's `test` lane (remote, cached), each over only the files it reads:
- tools/bazel/repo_subset.bzl picks a narrow, path-selected slice of
//:repo_files at analysis time. scripts/repochecks/run_check.sh copies that
slice into a throwaway git checkout and runs the unchanged guard there.
- //scripts/repochecks: build_tags, workflow_tags, go_install_guidance,
winget_portable_alias, migration_hygiene (checks A and B),
fmt (registered SDK gofmt), doc_freshness, workapi_frontend_boundary,
types_gen_drift (`make api-check` drift, oapi-codegen from go.mod).
- //scripts:doc_freshness_required_test (integration lane, -required-suite)
and //scripts/gitattributespolicy:gitattributespolicy_required_host_test
cover the Linux doc-freshness leg.
- check-versions stays covered by //internal/versioncheck:versioncheck_test.
check-testing-short stays covered by //scripts:scripts_test.
pr-policy-wrapper is deleted. fast-checks keeps only the two checks that
need the PR base: migration hygiene's delta half (MIGRATION_HYGIENE_SCOPE=
delta) and the .beads diff. check-doc-flags stays, because it builds bd from
the pinned release tag. The example Go modules leave .bazelignore so gofmt
and the grep guards see them. check_testcases.py now accepts --not-go
//pkg:all.
Refs: ga-96smfk.20
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
pr.yml's every-PR "Test (Dolt server fingerprint)" job installed dolt, pulled
the dolt-sql-server docker image and ran TestDoltServerFingerprint against
both backends. The rbe-west workers have no docker, and the container backend
is now used only by the container-backed legacy jobs, which run only where
bazel-coverage does not cover pr_lanes.
- //internal/testutil:testutil_dolt_test runs testutil_test with the local
backend selected and required (BEADS_TEST_DOLT_SERVER=local,
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1) on the dolt-server lane, which
pr.yml's gate requires: the fingerprint's local half against the pinned
dolt, plus the TestLocalDoltServer_* tests every other configuration
skips under BEADS_TEST_SKIP=dolt.
- The container half moves back to test-domain-uow's first test step (where
it was before D2 step 3), so it runs exactly where containers are used.
//internal/testutil:testutil_docker_test is its docker-lane A/B control.
TestPinnedDoltCLIMatchesContainerImage still pins the image tag to the
dolt release.
- test-dolt-server-fingerprint, its ci-gate need/result and its policy
tests are removed; TestDoltServerFingerprintRunsWhereEachBackendRuns
pins the new placement.
Refs: ga-96smfk.19
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
proxied-local-smoke.yml built bd and the cmd/bd test binary on a GitHub
runner, installed the pinned dolt, and ran `-test.run ^TestManagedLocalProxied`
under `sudo unshare --net` with only loopback up, to prove the managed-local
lifecycle (bd -> loopback proxy -> dolt sql-server) needs no outbound network.
//cmd/bd:bd_managed_local_test runs the same tests (BEADS_TEST_PROXIED_LOCAL=1,
BEADS_TEST_SKIP=dolt, the non-race bd_for_tests as the bd under test, the
pinned dolt from the test wrapper's PATH) through tools/bazel/go_test_offline.sh,
which enters an unprivileged user + network namespace with only loopback up
and fails if outbound network is reachable: the job's netns, without sudo,
on the rbe-west workers. Tagged dolt-server-proxied, so bazel.yml's
bazel-proxied lane (remote-only, required by pr.yml's gate) runs it; test
result caching replaces the workflow's path filter. The job's "tests are
compiled in" assertion becomes scripts/managed_local_lane_test.go, which
evaluates cmd/bd's build constraints for a linux cgo build and requires each
of the 17 pinned tests.
The target joins the pinned retired-lane targets in
TestBazelRetiredLanesCannotBeNarrowed. proxied-local-smoke.yml and the policy
tests that pinned its job and its dolt version are removed (the Bazel dolt
pin is already enforced against install-dolt.sh).
Refs: ga-96smfk.19
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
beads' MODULE.bazel registered no C toolchain, so -race and cgo builds used
the autodetected local_config_cc of the machine that ran analysis. From a
client with lld installed (cherry) every remote cgo/-race link failed with
"collect2: fatal error: cannot find 'ld'" (the workers have no lld), and the
host gcc path, lld availability and gcc-version inputs keyed every Go action
to the client machine.
Port gastownhall/gascity's design:
- toolchains_llvm 1.11.0 with a pinned LLVM 22.1.8 slice
(third_party/cc_toolchain/llvm_dist.bzl) and a sysroot of sha256-pinned
Ubuntu 24.04 debs (deb_sysroot.bzl), without ICU (ICU policy);
stock toolchains_llvm LLVM on other hosts.
- .bazelrc: BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 so nothing falls back to the
host compiler.
- //platforms:rbe_worker, selected unconditionally, whose worker-env exec
property is the sha256 of tools/rbe/worker-env.txt (a copy of the shared
rbe-west OSS pool's manifest, owned by gascity), so the worker host is in
every action key.
- scripts/bazel_hermetic_cc_test.go and scripts/rbe_worker_env_test.go guard
both.
Refs: ga-96smfk.20
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#7147 gave migration-test, conformance and cross-version-smoke a shared
paths filter: non-test Go files plus build inputs. The schema migrations
are .up.sql files embedded into the binary (go:embed in
internal/storage/schema), so they match no entry. A PR that adds a
migration with only a _test.go beside it skipped all three workflows,
where before #7147 it ran all three. d26230d0d and 63a471a1e have that
shape.
Add internal/storage/schema/migrations/** to the shared base in each
paths block and in advisoryPathFilterBase, which pins the base across
the three files.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
bd show --json returns comment_count and comments_omitted=true and no
comments key. The --include-comments help only said it streams full bodies,
which reads as "the default is truncated". A scan that reads .comments over
plain --json sees nothing for every issue and reports each one clean, with
no error: one audit over 38 issues reported 0 adverse verdicts where the
same scan with --include-comments found 4.
Say it in the flag help, as bd list --include-comments already does. Help
text only; the JSON contract pinned in cmd/bd/protocol is unchanged, and the
generated CLI docs stay on the v1.2.2 pin.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
#7223 made a linked, documented issue mandatory for every PR. That is
the right default for user-visible bugs and changes worth discussing,
but it adds ceremony to small, self-explanatory fixes without adding
context.
AGENTS.md, CONTRIBUTING.md, ROADMAP.md, the PR template and the feature
form now advise filing an issue when it adds context and let small fixes
go straight to a PR whose description explains the why. End-to-end
evidence is still required, and Closes #N is used when an issue exists.
No CI check or ruleset enforced the requirement; scripts/pr-preflight.sh
already only warns when a PR has no closing issue.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On macOS listenerOwnership always answered known=false, so once a foreign
process greeted on the port chosen for a new dolt sql-server, Start adopted
that listener as its own (the default log level emits no ready line to
disprove it). TestStart_RecoversWhenEphemeralPortIsTaken has failed on the
Main workflow's macOS job on every push since #7201 (14/14 completed runs);
PR CI has no macOS test job, so no PR saw it.
Darwin has no /proc, so the listener's processes come from lsof and the
process tree from ps, the two tools this package already uses to find a
port's holder and a server's working directory. Each pid lsof lists on the
port is walked up its parent chain; reaching the child proves the listener
is the child's (or a descendant's, for a wrapper that does not exec). Both
reads run only once a greeting has arrived, never on the bare poll.
known is false when either tool fails or lists no listener at all, and
Start then falls back to the greeting as before. A child that no longer
exists is known not to own anything, as on Linux.
The tests that were Linux-only because ownership was only provable there now
run on darwin too, and the darwin file gets its own fake-read table, parser
tests, and a real-tool test with an in-process listener and a listener in a
grandchild process. On this machine the formerly red test passes 10/10
(it failed 40/40 on main).
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* test(protocol): pin §E3 exit 11 with a PTY harness (wy-vh5y8)
Exit 11 (ExitLocalExistsRefused) is returned only from the interactive
typed-confirmation abort in `bd init --reinit-local` (cmd/bd/init.go, behind
term.IsTerminal on stdin); the non-interactive branch of the same guard returns
12, so no piped-stdin subprocess could produce 11. WP4 (wy-ge2h8) therefore
left TestProtocol_ExitCode11_LocalExistsRefused skipped.
Un-skip it with a PTY-backed run: allocate a pty (creack/pty, a test-only dep
already in go.sum), drive `bd init --reinit-local` against a workspace seeded
with one issue, answer the "Type 'destroy N issues' to confirm:" prompt with
the WRONG text, and assert exit 11 — distinct from the 12 a bad --destroy-token
yields. Also asserts the abort is a no-op (the seeded issue survives). Windows
skips (no unix PTY).
creack/pty is imported only from _test.go, so it is a test-only dependency; no
new non-test dependency enters go.mod.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(build): register github.com/creack/pty with Bazel and Nix
The exit-11 PTY test imports github.com/creack/pty, a new direct
require in go.mod. The base's generated build manifests predate it:
- Bazel (`make bazel-sync`): //cmd/bd/protocol:protocol_test failed
"missing strict dependencies" on the import, and go_deps reported
com_github_creack_pty missing from use_repo. The sync adds it to
MODULE.bazel's use_repo and adds @com_github_creack_pty//:pty to
protocol_test's deps. protocol_race_off, protocol_docker_test and
protocol_dolt_test all wrap protocol_test, so that one deps line
covers them. Running the same sync on the base changes nothing.
- Nix: default.nix sets proxyVendor = true, so vendorHash covers the
module download set of go.mod's requires, and the new require
changes it. Regenerated via the nixos/nix container: the go-modules
fixed-output derivation now builds with no hash mismatch, and the
unwrapped package compiles cmd/bd.
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>
* test(protocol): fix exit-code header, name a skipped reinit prompt
Review fixups, adopt-pr review loop iteration 1 (synthesis approve,
scorecard 981/1000, no blocker or major findings).
Taken:
- Header (Finding 2): it said all three refusal codes (10/11/12) refuse
before bd opens any store. That stopped being true once exit 11 ran:
its typed confirmation fires only after --reinit-local counts the
issues in a seeded workspace, so that test pays for a full store, as
130 does. The header now says 10 and 12 are store-free and 11 and 130
are not.
- Prompt-skip diagnostic (Finding 3): runInitReinitPreflight skips the
confirmation, with no warning, when countExistingIssues errors (it
has its own 5s timeout) or counts zero. The review expected that skip
to exit 0 in the early-exit arm. A mutation run with the seed issue
dropped shows it does not: the reinit goes on and blocks at init's
next TTY prompt, "Change role? [y/N]:", so the test fails at the
prompt deadline. The deadline arm now names the skip when the output
lacks the "Re-initializing will destroy" warning. Failure path only.
Declined:
- Shared prompt harness (Finding 1): extracting it rewrites the
base-owned 130 test (pipes, SIGINT, t.Parallel) into a new helper
after review. The synthesis allows accepting the duplication in the
reply to the reviewer instead.
- Redundant "!= 12" check (Finding 4): it mirrors the 12 test's own
"codes must stay distinct" check, so the tests keep one idiom.
Validation: gofmt and go vet are clean. TestProtocol_ExitCode10/11/12/130
pass against the dolthub/dolt-sql-server:2.2.0 test container with
BEADS_PROTOCOL_REQUIRE_DOLT=1, so exit 11 ran rather than skipped. The
seed-dropped mutant fails with the new message.
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 4.8 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* fix(gate): report an unreadable store as an error, not a pending bead gate (wy-2hz4ol)
evaluateGates assigned r.err for the gh:run, gh:pr and timer arms but never
for the bead arm, so a backend or transport failure on the awaited bead's
read fell through applyGateCheckResults' pending branch: no error row, no
error count, exit 0 — indistinguishable from a healthy gate still waiting.
checkBeadGate now returns (satisfied, reason, err). A read that fails for
any reason other than not-found (storage.ErrNotFound, sql.ErrNoRows, the
partial-id resolver's text) is an error; a missing bead stays pending with
the not-found reason as before. printGateCheckSummary returns an error when
any gate could not be checked so the command exits non-zero on both the
classic and proxied routes. bd close keeps refusing on such a gate (fail
closed, --force to override) instead of treating "could not read" as
satisfied.
Tests: TestCheckBeadGate_LocalBeadLookupError now asserts the wrapped error;
TestCheckBeadGate_LocalBeadNotFoundErrorStaysPending pins the four not-found
shapes; TestEvaluateGates_BeadStoreErrorCountsAsError and
TestPrintGateCheckSummary_ErrorsFailTheCommand pin the error row/count and
the non-zero exit. Each of the three fails against its reverted line.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PNYoASfCXUd5AeeCNiXn51
* ci: re-run the gate after a module-proxy GOAWAY on 'Check doc flags freshness' (no code change)
* fix(gate): name close failures in the exit error; test the close refusal
Maintainer fixup for #6404 (adopt-pr review iteration 1; quality scorecard
956/1000, approve). It fixes the review's three minor findings, all in code
or text this PR introduced.
- printGateCheckSummary: the exit error said "N gate(s) could not be
checked", but errorCount also counts resolved gates whose close failed
(the "error closing" rows) on the classic and proxied routes. It now says
"could not be checked or closed", naming both row kinds, and the summary
test asserts the new text.
- close_gate_test.go: add
TestCheckGateSatisfaction_BeadGateUnreadableStoreRefuses. A store stub
whose GetIssue fails with a non-not-found error must make
checkGateSatisfaction refuse with "could not check bead gate", the read
error, and --force. Checked against three mutants: the refusal
falling through to the fail-open warning, the pre-PR reason-only refusal,
and checkBeadGate folding the read error into the reason. The existing
BeadGateInvalidFormat and ErrorMessageFormat tests catch only the first,
and only through the typed-nil routedBeadGateGetter left by a nil package
store.
- CHANGELOG: narrow the error-row claim to reads of the workspace's own
store. A bead in a prefix-routed rig whose store cannot be read still
reads as not found (pending): the routing fallback returns the local
not-found and drops the routed error. That is pre-existing and left as a
non-gating follow-up. Also say the non-zero exit covers gh, timer, and
bead gates and close failures.
Left as-is: the nit that a typed-nil routedBeadGateGetter{localStore: nil}
gets past checkBeadGate's st == nil guard (unreachable on the classic route,
where store is set before RunE). The optional `gate check` Long-help note
was skipped so the generated CLI reference does not need regenerating.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* feat(remember): opt-in memories.budget-chars — refuse a write that crosses the corpus budget (wy-2pox7y)
The wheelhouse-side tripwire only REPORTS the memory-corpus size, so the corpus
re-trips red every few days and nothing has ever stopped the write that crossed
the line. This is the stop.
New config key `memories.budget-chars` (integer, default 0 = OFF), wired exactly
like `prime.max-memory-chars`: recognized in cmd/bd/config.go, routed to yaml in
internal/config YamlOnlyKeys (it is read through viper, so a DB-backed write
would be accepted and then never read), validated non-negative at set time, and
documented in docs/reference/configuration.md.
With the budget ON, `bd remember` measures the corpus as the sum over every
memory of len(key)+len(content) — BYTES, the same unit `bd prime`'s
--max-memory-chars counts in — projected to AFTER the write would apply. An
overwrite replaces that key's old content in the sum rather than adding to it,
so a memory near the ceiling can still be edited.
- over budget -> refused, nothing written, exit 1, one line on stderr
- over budget + --force -> written, and the crossing is still announced
- >= 80% and within -> written, then warned
- below 80%, or budget 0 -> silent; with the budget off the corpus is not even
read, so behavior is byte-identical to before
Every line goes to STDERR, so --json output is never corrupted; a --json refusal
additionally gets the normal machine-readable error object on stdout.
The whole decision is one pure function (rememberBudgetVerdict), which is what
lets the branches be pinned without a database.
Tests run (targeted, never ./...):
go build ./... rc 0
go vet ./cmd/bd/ ./internal/config/ rc 0
go test ./cmd/bd/ -run 'Memor|Remember|Prime|Budget' -count=1 rc 0
go test ./internal/config/ -count=1 rc 0
BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd/ \
-run TestEmbeddedMemoryCorpusBudget -count=1 -v rc 0 (6/6 subtests)
golangci-lint run --config=.golangci.yml --build-tags=gms_pure_go \
./cmd/bd/... ./internal/config/... 0 issues in touched
files (one
pre-existing gosec
G304 in
internal/config/permissions_open_nonlinux.go)
New tests: cmd/bd/memory_budget_pure_test.go (byte unit incl. multibyte,
overwrite delta, budget-off silence, config read + negative clamp, the
at-budget/one-over boundary, --force, the 80% warn band and its edges,
unclamped percentage, single-line contract);
cmd/bd/memory_embedded_test.go TestEmbeddedMemoryCorpusBudget (the same five
spec points end to end against a real embedded-Dolt store, through
`bd config set`, asserting the exact stderr lines, the nonzero exit, and that a
refused write leaves the old content intact);
internal/config/yaml_config_test.go validation + yaml-only routing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013XmKxqKuXTaKivDiCoBwBV
* fix(remember): one --json refusal line, ceil on the over-budget percentage (wy-2pox7y)
Review fixes on ca9f14d65d. Three items; one review item turned out to be a
false alarm and is recorded here rather than acted on.
- BLOCKER 1 (CLI docs regeneration) — NO CHANGE NEEDED, and that is the
finding. docs/cli-reference/ and docs/CLI_REFERENCE.md are not generated
from this checkout: docs/cli-docs.pin pins them to release tag v1.2.2, and
scripts/generate-cli-docs.sh, check-cli-docs-drift.sh and check-doc-flags.sh
all resolve that pin (resolve-docs-bd.sh) and build bd from the TAG, because
the published docs site describes the latest release, not main's source. No
CI path sets BD_DOCS_IGNORE_PIN. So changing `bd remember`'s help surface on
main cannot move the generated docs, and it did not:
./scripts/generate-cli-docs.sh ran to completion ("Generated CLI docs from:
bd version 1.2.2 (dev)") and left the tree clean — zero diff. The gate is
green at this commit and was green at ca9f14d65d. The --force flag and the
Corpus budget paragraph reach the docs when the pin is bumped at release.
- NIT 1: the --json refusal said the same sentence twice, prose on stderr AND
the envelope on stdout. It now says it ONCE, the way
HandleErrorWithHintRespectJSON does it: --json gets only the stdout
envelope, every other route gets the bare sentence on stderr. New subtest
TestEmbeddedMemoryCorpusBudget/json_refusal_is_said_once asserts a nonzero
exit, EXACTLY one JSON document on stdout (a second Decode must be io.EOF),
the refusal sentence inside the envelope, a stderr with no "memory corpus"
in it, and that the refused write left the old content intact.
- NIT 2: floor arithmetic made the refusal at 201 of 200 read "(100%)" — the
exactly-at-budget value this code deliberately ALLOWS, so the refusal wore
the number of the case it is not. The percentage now CEILINGS over the
budget (101%) and still FLOORS within it. The split is on the VALUE, not on
--force, so one projection cannot report two different percentages
depending on a flag; that is why the forced over-budget line moved too.
TestRememberBudgetVerdictBoundary, TestRememberBudgetVerdictForceWrites and
TestMemoryBudgetLinePercentIsUnclamped updated; the warn band gains a
999-of-1000 case pinning the floor inside the budget, so "100%" can only
ever mean at-budget.
- NIT 5: one comment at the List/Remember seam saying the budget is ADVISORY
and not atomic — the two are separate transactions, so concurrent writers
can both measure inside the budget and both land. No locking.
Nits 3 (primeConfigInt duplication) and 4 were left alone by instruction.
Gates run from the worktree:
go build ./... rc 0
go vet ./cmd/bd/ ./internal/config/ rc 0
go test ./cmd/bd/ -run 'Memor|Remember|Prime|Budget' -count=1 rc 0
go test ./internal/config/ -count=1 rc 0
BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd/ \
-run TestEmbeddedMemoryCorpusBudget -count=1 -v rc 0 (7/7)
gofmt -l cmd/bd internal/config no output
golangci-lint run ./cmd/bd/ ./internal/config/ 1 issue, all
pre-existing: gosec G304 in internal/config/permissions_open_nonlinux.go
(last touched f4d496fed, not by this branch)
./scripts/check-cli-docs-drift.sh rc 0
./scripts/check-doc-flags.sh rc 0
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFSKdUYCTyuhBM97tHyoye
* ci: list the PR's tests in the embedded shard manifest and cmd/bd BUILD.bazel
#7156 made the embedded-Dolt shard manifests exact-once, and Bazel equivalence
requires every test file in the go_test srcs. Adds TestEmbeddedMemoryCorpusBudget
(generator output, incremental) and memory_budget_pure_test.go (the line CI's
bazel-sync patch printed).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(remember): budget the key ResolveKey writes; hint on stderr too
Review fixes for #6508 (apply-fixes iteration 1; all minor or nit):
- The budget credits an overwrite under memoryapi.ResolveKey's key, the
one rule every Remember implementation writes under, instead of a
parallel flag-else-derived copy of it. A write ResolveKey refuses
skips the budget, so a whitespace-only --key gets the role's "memory
key must not be empty" instead of an over-budget refusal that points
at --force.
- The stderr refusal now carries the same hint as the --json envelope
(raise the budget, forget a memory, or --force), printed the way
HandleErrorWithHintRespectJSON prints one.
- The memoryCorpusChars comment and `bd remember --help` no longer
imply that a budget equal to prime.max-memory-chars keeps prime from
eliding memories: the unit (bytes) is the same, but prime counts each
memory as rendered, markup included, so the budget has to sit below
that cap for that.
- New embedded pins: a write without --key that crosses the budget is
refused with exit 1 and writes nothing; a blank --key gets the
validation error; the Hint line is on stderr and not under --json.
Each pin was checked red against a mutant of the code it guards.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
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.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
The Last reviewed marker (2026-07-10) passes the 90-day limit in
scripts/check-doc-freshness.sh at 2026-10-09 00:00 UTC, when the required
"Check doc flags freshness" job would fail on every PR and merge-group
run, as it did for ERROR_HANDLING.md (#7266).
Re-reviewed against cmd/bd/setup.go, cmd/bd/setup/ and internal/recipes/
at e72cd8b31 and corrected what had drifted:
- bd setup cursor installs the agent skill and .cursor/hooks.json
(sessionStart, preCompact, postToolUse) besides the rules file, and
takes --global (hooks and skill only).
- bd setup claude writes its managed section to AGENTS.md when
CLAUDE.md is an @AGENTS.md import stub.
- bd setup codex takes --global.
- bd init runs the Claude Code, Codex and Cursor project setup, not
Codex alone.
The marker is 2026-10-05, not the UTC date, because the script rejects a
future date and a Pacific shell still reads 10-05.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(ready): --explain sorts a ready issue's blocking edges by status instead of calling a pinned dependency resolved (wy-0h6t03)
The ready query skips a pinned target exactly as it skips a closed one, so a
blocks edge onto a pinned bead never fences its dependent. The explanation
never read the target's status: every blocking edge of a ready issue was
appended to ResolvedBlockers, so a bead wired behind a long-lived pinned
bring-up reported "1 blocker(s) resolved" while its precondition was unmet.
Two trials sat on a takeable front for days that way.
BuildReadyExplanation now sorts each blocks / conditional-blocks / waits-for
edge by the target's status in blockerMap: closed stays under
ResolvedBlockers, pinned goes to PinnedDependencies (never block), any other
status to OpenDependencies (not blocking; the #6066 shape, now visible). A
target without a status in the map keeps the old treatment. Reason keeps its
"N blocker(s) resolved" lead and appends the other two counts as clauses.
Both explain routes previously fetched only the blockers of blocked issues,
so no ready target ever had a status; explainBlockerIDs now adds the ready
issues' blocking-dependency targets to that one batch fetch, once each, and
printReadyItemDependencies prints the three lines for both routes.
Pinned-never-blocks itself is unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* build(bazel): list ready_explain_ids_test.go in the cmd/bd go_test srcs (wy-0h6t03)
The equivalence gate named TestExplainBlockerIDs and
TestExplainBlockerIDs_Empty as tests go test runs that Bazel did not: the
new test file was never added to BUILD.bazel.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* wy-raudbw: pin that a gate on a parent hides existing and later-born children from bd ready
Embedded-dolt test: epic + two children all ready; gate on the epic hides
all three; a child created after the gate is born hidden; resolving the
gate frees all four. Pins the read-time cascade (blocked-consistency
parent-child leg) that operator tooling downstream relies on.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci: register TestEmbeddedGateInheritsDownParentChain with Bazel and the embedded shards
Maintainer fixup for adopt-pr #6604. The PR adds a new embedded test file,
cmd/bd/gate_inherit_embedded_test.go. Its merge-base (71c4cd08b9) predates
two checks on main that every new cmd/bd embedded test has to satisfy:
- cmd/bd/BUILD.bazel: bd_test's srcs list every untagged cmd/bd test file.
Without the row, Bazel never compiles or runs the test, and bazel.yml's
"BUILD files in sync" step in the required test job fails. The row was
added by `bazel run //:gazelle`, which changed no other file.
- .github/scripts/embedded-cmd-test-shards.txt: the Bazel-only 50-shard
block must name every TestEmbedded* test exactly once, or
TestCmdEmbeddedShardManifestGeneratorNotStale fails `go test ./scripts/`.
The entry was added by `gen_embedded_cmd_shard_manifest.py 50
--weights=duration --write`, which is incremental: it placed the test on
shard 16 and moved no existing assignment.
The PR's own file is unchanged.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: match bd ready rows by exact ID in the gate-inherit pin
Maintainer fixup for adopt-pr #6604, review iteration 1.
TestEmbeddedGateInheritsDownParentChain decided whether an issue was in
`bd ready` by looking for its title anywhere in the pretty output. The
epic's two "should be ready" checks (before gate, after resolve) were
vacuous: every ready child of an epic carries a "← <epic title>"
annotation, and buildParentEpicMap fetches that parent on its own, so the
children's rows satisfied "Inherit epic" with no epic row in the list.
The review suggested matching epic.ID instead. That is vacuous too: child
IDs are hierarchical (<epic>.N, from GetNextChildIDTx), so the epic's ID is
a substring of every child row. wantReady now takes the created issue and
requires its ID as a whole whitespace-separated token of the output. The
test keeps reading the pretty route (GetReadyWork) it was written against;
--json would read through GetReadyWorkWithCountsAndTotal instead.
Evidence: `BEADS_TEST_EMBEDDED_DOLT=1 go test -tags gms_pure_go ./cmd/bd/
-run '^TestEmbeddedGateInheritsDownParentChain$'` in git-archive copies,
with BD_*/BEADS_*/GC_* unset so the bd binary is built from the copy.
- Unmutated: PASS.
- Mutant A, "epic" added to sqlbuild.ReadyWorkExcludeTypes. Ready printed
"○ gi-83o.1 P2 Inherit child one ← Inherit epic" and no gi-83o row. The
title check PASSED, the epic.ID substring check PASSED, and the ID-token
check FAILED at the before-gate and after-resolve epic lines.
- Mutant B, the issues parent-child leg of
shouldBeBlockedIDsUnionScopedSQL disabled, so a gated parent no longer
hides its children. The ID-token check fails at exactly the three child
lines. The title check also failed the epic's "hidden" check, although
the epic row was absent, because the children's annotation carried its
title.
Unchanged: the gate ID is still taken from the first "gi-" token of
`bd gate create`. renderGateCreated documents its first line, "Created
gate <id>", as parsed by downstream scripts.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
conformance.yml ran two tiers on a GitHub runner. Tier 1 (the embedded-Dolt
TestConformance) already runs as the embedded lane's
embeddeddolt_conformance_{core,audit}_test. Tier 2, the real-binary CLI
corpus (`go test -tags 'gms_pure_go e2e' ./test/conformance`), had only a
go_library under Bazel. Its two test files now build under `e2e ||
integration`, so gazelle generates //test/conformance:conformance_test
(integration-only, against the injected non-race bd_for_tests) and
--config=integration runs it remotely in bazel-integration, which pr.yml's
gate requires. PR Core's go test builds neither tag, so the --config=ci
equivalence check is unchanged; scripts/conformance.sh keeps working with
-tags e2e as the local go test entrypoint. With both tiers covered,
conformance.yml and main.yml's warm-up compiles for it are removed.
docs-mintlify.yml drops its docsync job (`go test ./test/docsync`, run by
bazel-test as //test/docsync:docsync_test on every PR) and keeps only
Mintlify's broken-link check, which needs the network (npx mint) and the
base branch's history; its path filter narrows to what that check reads.
Refs: ga-96smfk.17
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Actions runs the dispatch step as bash -e, so a failing gh run list ended the
step at the assignment and the could-not-read warning never printed. The
assignment now tolerates the failure. A RBE_PREWARM_WORKERS too long for the
shell's integer compare slipped past the max-4 clamp and the loop dispatched
without bound; two or more digits is now decided in the case (all zeros stays
the kill switch). The behaviour test runs the script with bash -e, as Actions
does, under a 30s deadline, and pins the clamp.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
//scripts:scripts_test and //scripts/check-versions:check-versions_test
drop their host-tools/no-remote-exec/no-remote-cache tags and run on the
rbe-west workers like every other target (the worker image ships bash, git,
python3, jq, yq, curl, openssl, unzip and coreutils; a missing tool fails the
test under Bazel rather than skipping it). Go comes in hermetically as the
registered SDK; check-versions.sh's `go build` is stood in for by the
Bazel-built checker.
The tests that walked the source checkout now get it as data:
tools/bazel/go_srcs.py keeps a managed `repo_files` filegroup in every
package and aggregates them into //:repo_files (exactly the tracked files
Bazel can see; make bazel-sync-check fails on a package without one).
scripts_test and docsync_test take it instead of hand-listed filegroups,
and every TEST_SRCDIR/IsBazel skip and go-test-only block in them is gone.
The release formula under .bazelignore'd .beads/ comes in through a
@beads_formulas local repository; npm-package/ and .claude/ are visible to
Bazel again (only their node_modules/worktrees stay ignored), so the npm
manifest release check and the AGENTS.md skill links run under Bazel too.
TestZZStdioNotLeaked falls back to TestMain's pre-run streams instead of
skipping in a shard without its baseline.
tools/bazel/equivalence_allowlist.txt shrinks from 20 skip entries to the
two cmd/bd tests of plain go test's own bd build fallback, which Bazel never
takes; pr-preflight-platforms now runs them on Linux, macOS and Windows. The
scripts-go-checks scripts-test and allowlisted legs, their scripts
(scripts-go-test.sh, allowlisted-go-tests.sh, run_allowlisted_go_tests.py)
and main.yml's --compile-only warm for them are removed. The vet leg stays
(ga-96smfk.18).
Refs: ga-96smfk.16
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A fixture's "git commit" starts "git maintenance run --auto --detach"
(builtin/commit.c run_auto_maintenance). Unscheduled maintenance runs the
worktree-prune task, and should_prune_worktree removes an entry that has
neither "locked" nor "gitdir" with no expiry check. "git worktree add"
mkdirs .git/worktrees/<name>, then writes "locked", then "gitdir", so a
detached maintenance run reading .git/worktrees inside that window prunes
the entry and the add dies with
fatal: could not open '.git/worktrees/worktree/locked' for writing: No such file or directory
Seen twice on Main's Test (ubuntu-latest), both on a fresh init + one commit
+ "git worktree add <dir> HEAD" inside the test's own t.TempDir:
- 33507469201 attempt 1 (2026-09-01): internal/config
TestInitialize_IgnoresWorktreeFallbackConfigWhenRequested
- 37513420893 attempt 1 (2026-10-06, git 2.55.0, ubuntu-24.04 20260927.320.1):
internal/beads TestResolveBeadsDirForRepoIgnoresInheritedRouting
The second test unsets every git routing key and resets HOME before any git
call, so no environment-level setting (GIT_CONFIG_COUNT, a global config)
can reach its fixture: the setting has to ride on the fixture's own
command line. Every fixture git command in internal/beads now goes through
gitCommand, which prepends -c maintenance.auto=false -c gc.auto=0 (the
gc.auto half covers git before 2.29, where commit ran gc --auto instead),
and the internal/config fixture's closure does the same.
Proof (git 2.55.0): GIT_TRACE over the two tests above at main shows 3
"maintenance run --auto --quiet --detach" spawns for 3 worktree adds; at
this commit 0 spawns, the same 3 adds. An empty .git/worktrees/x is removed
by "git maintenance run --auto"; with -c maintenance.auto=false a commit
starts no maintenance.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
bazel.yml already runs on every push to main and executes the PR Core,
pure-Go, dolt-server, embedded, proxied, server-storage, integration and
cmd/bd Dolt-server tiers on rbe-west in about five minutes. main.yml re-ran
the same tiers as legacy go test jobs (62 jobs, about 380 runner-minutes a
push), and its runs were all failing or cancelled. Remove the duplicated
Linux jobs: the ubuntu -race -short leg with its Codecov upload, PR Core,
the pure-Go compile check, domain+uow, the 6+8 integration shards, the 15
proxied shards, and the embedded build plus its storage, conformance and
cmd shards.
The macOS -race -short suite (rbe-west has no macOS workers) moves to
Blacksmith macOS and restores the macOS saver's caches. The cache savers
that fed the fork path from the removed jobs move to venue matrices: the
macOS saver gains a GitHub-hosted leg, and the Linux saver gains a
GitHub-hosted race leg (the embedded build used to seed it).
Refs ga-96smfk.14
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Fork and Dependabot PRs ran both stacks: the legacy embedded, proxied,
server-storage and PR-lane tiers plus the Bazel lanes, which rbe-fork has
executed remotely (fork-ro/fork-rw) since the canary ended. Flip the
committed flag in pr.yml and pr-risk.yml so bazel-coverage retires those
tiers for forks too. A covered run the mint does not serve (mode cache)
already turns CI Gate / Required red with a re-run message; it never falls
back silently.
Refs ga-96smfk.15
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Last reviewed marker (2026-07-07) passed the 90-day limit in
scripts/check-doc-freshness.sh at 2026-10-06 00:00 UTC, so the required
"Check doc flags freshness" job fails on every PR and merge-group run
(#7266).
Re-reviewed against cmd/bd at e72cd8b31 and corrected what had drifted:
- createConfigYaml takes three arguments.
- cmd/bd/sync.go has no warning or ignored-error sites any more; its
citations are gone. Line-number citations into init.go and create.go
no longer matched and are replaced by search strings.
- internal/syncbranch was removed with the sync-branch pipeline; the
syncbranch.Set example and the sync.branch bullet are gone.
- No code writes last_import_hash; the tracking-metadata examples now
show the bd_version write (SetLocalMetadata) and verifyMetadata as
init.go has them.
- CheckReadonly also exits ExitMigrationFrozen under a migration freeze.
- HandleProxyCapabilityError is added to the helper list.
Fixes#7266
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
#7301 scoped the pre-migration read failure on a shared server to schemas
that "predate 1.2.0". That misses 1.2.2, the recovery re-release of the
1.1 line: its migrations stop at 0053 with no lease migrations, so a 1.2.2
server sits at v53 like 1.1.x. Upgrading such a server's clients to 1.3.1
without `bd migrate schema` makes `bd list`, `bd show` and `bd ready` fail
with `table not found: leases`.
Key the caveat to schema v53 or older, naming 1.1.x and 1.2.2, which
matches the section's own "A 1.2.2 or 1.1.x database sits at schema v53".
Refs #6929, #7284, #7301
* docs(upgrading): scope the shared-server read failure to pre-1.2.0 schemas
#7284 said most reads fail between upgrading a shared server's clients
and running `bd migrate schema`. That only holds for a schema older than
1.2.0: the leases table ships with main migration 0055 and ignored 0012
and 0016, all in v1.2.0. From 1.2.x, reads keep working and only writes
are refused (probed against a 1.2.1 server with 1.3.1 and main builds).
Restore the original wording and add the pre-1.2.0 caveat, naming only
the observed `bd list` failure from #6929.
Refs #6929
* docs: add beads-viewer (Paseo plugin) to community tools
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit ad28cf00ba)
* Add LazyBeads (lb) to community tools
- List lesliesrussell/lazybeads under Terminal UIs
- Note that it is unrelated to the earlier lazybeads under Historical
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1aa2b645e2)
* docs(community-tools): update the beads-web entry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit aa177110b3)
* docs(community-tools): mention the beads-web tree view
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QebAVaD36wUemAsdBx8wwJ
(cherry picked from commit e0eb482a11)
* Updated community tools documentation with Beads Tracker
Applied changes from BB to 1 file
Files modified:
- docs/community-tools.md
Updated community tools documentation
Applied changes from BB to 1 file
Files modified:
- docs/community-tools.md
Updated community tools documentation
Applied changes from BB to 1 file
Files modified:
- docs/community-tools.md
(cherry picked from commit 75d0f8de0c)
* docs: add b9s to community tools (TUI and web UI)
(cherry picked from commit 8bb6ab6913)
* docs: add btui to community tools (btui-bb2)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Andreas Dellrud
(cherry picked from commit 81da372c63)
* docs: mention released btui Beads 1.3 support (btui-0fm)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Andreas Dellrud
(cherry picked from commit 8f27445bee)
* docs: add beadside to community tools
(cherry picked from commit 2c2cb1fd5c)
* docs: add Beads for Obsidian to community tools
(cherry picked from commit cb82d067d8)
---------
Co-authored-by: cuongntr <cuongntr@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Leslie Russell <leslierussell@gmail.com>
Co-authored-by: weselow <598746@gmail.com>
Co-authored-by: Beyond Better <git@beyondbetter.app>
Co-authored-by: vanderheijden86 <vanderheijden86@gmail.com>
Co-authored-by: Andreas Dellrud <andreas.dellrud@gmail.com>
Co-authored-by: michal.psencik <misa.psencik@gmail.com>
Co-authored-by: Rome-1 <romethorstenson@gmail.com>
The shared-server upgrade steps said an upgraded client keeps reading the
old schema and only has writes refused. In practice most reads fail as
well: bd list, bd show and bd ready stop with "table not found: leases"
because 1.3 reads expect tables the old schema lacks. Say so, and tell
operators to run the migration as soon as the clients are upgraded
rather than treating the window as merely degraded.
Refs #6929, #7038
The upgrade docs told every non-migrating clone to adopt the migrated
database with `bd bootstrap`, claiming it replaces the local database.
On a clone that already has one, bootstrap prints "Nothing to do." and
exits 0, leaving the clone on the old schema (#6687).
Document the flow that works: every clone backs up with the old binary,
other clones `bd dolt pull` on the old binary after the migrator pushes
and then upgrade; a clone that already upgraded moves its local database
aside, re-clones with `bd bootstrap`, and re-imports the backup. Align
the gate description, shared-server note, and init-safety summary.
Also add a post-migration step to run `bd recompute-blocked` once per
database, since migration 0059 can over-set is_blocked and silently hide
ready work (#7037).
Refs #6687, #7037
* ci: make the required gates merge-queue ready
The default-branch ruleset requires "CI Gate / Required" and "PR Risk
Gate / Required". Prepare both for a GitHub merge queue (ALLGREEN,
squash), so enabling the ruleset's merge_queue rule is the only step left.
- pr.yml, pr-risk.yml: merge_group pinned to types [checks_requested].
- D2: bazel-coverage covers every merge_group run (same repository, CI
secrets, actor github-merge-queue[bot], bazel.yml mode remote), so the
retired legacy tiers stay retired in the queue and ci-gate requires
their Bazel lanes to have run remotely and passed; a missing secret or
the farm switch off is red, as on a same-repo PR.
- Diff bases on merge_group: the package gates diff
merge_group.base_sha..head_sha (not HEAD^, which misses all but the
last commit of a rebase-method entry), the .beads/issues.jsonl guard
now runs on merge_group against base_sha (ci-gate no longer excuses
its skip), and check-doc-flags passes BD_DOCS_DIFF_BASE so CLI-docs
drift already on main cannot eject every queued PR.
- Test result reuse: on a merge_group run and on attempt 2+ of a PR run,
the six always-execute Bazel lanes append --config=reuse-test-results
(--cache_test_results=auto), so tests whose action key is unchanged
reuse the farm's recorded PASS and only what the merge changed runs.
Failures are never reused, eviction retries stay 0, and each PR's first
attempt, push to main and nightly still execute every test.
- scripts/ci_merge_queue_test.go simulates merge_group through the shared
evalGHExpr evaluator (now with true/false/null literals, hyphenated
identifiers and case-insensitive ==) and the workflows' own scripts:
triggers and gate names, concurrency groups, every pull_request field
read, the coverage and rbe decisions, result reuse, the package-gate,
.beads and doc-drift diff bases.
- engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md: new "Merge Queue" section (how
to queue, settings, what runs, result reuse rationale, ejection and
flakes, rollback).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci: cache Bazel test results except nightly; queue trust and sizing
Review follow-ups to the merge-queue readiness change.
- Test results (S1): --nocache_test_results also stops Bazel writing
results, so a PR's first run never fed the cache and the merge-queue
reuse config could only hit on later reuse runs. Drop it from
test:embedded, test:doltserver-proxied, test:doltserver-integration and
test:sole-run (which keeps --experimental_remote_cache_eviction_retries=0),
and drop test:reuse-test-results and BAZEL_REUSE_RESULTS. Results are now
cached (read and write) on PRs, merge groups and pushes to main.
nightly.yml passes the new fresh-test-results input, so every `bazel
test` appends --config=fresh (--nocache_test_results) and the suite
re-executes nightly. The docker lane keeps --nocache_test_results.
Measured locally with a disk cache: a default run writes and the next
reads ("(cached) PASSED"); a fresh run neither reads nor writes.
- Security headers (S2): bazel.yml now states that a merge_group run
executes the queued commit's workflows, so a queued fork or Dependabot
PR's CI edits run with every CI secret, the pre-warm app key included
(merging-level trust), and records the maintainer rule: review fork
changes to .github/, .bazelrc, tools/bazel, MODULE.bazel, BUILD files
and CI scripts before queueing. Same note in the topology doc.
- Queue sizing (S3): recommend max_entries_to_build 3 and
check_response_timeout_minutes 60 (max_entries_to_merge 5, ALLGREEN,
SQUASH unchanged).
- Nits: the .beads guard fails closed on a missing diff base, and its
test runs under GitHub's default `bash -e`; evalGHExpr follows GitHub's
loose equality (true == 'true' is false, false == '' is true, missing
context keys are null) with a typed-context variant; the
detect-package-gates comment notes the SQUASH/HEAD^ equivalence and
path-filter scope; the doc covers re-run reuse, flake re-sampling via
dispatch, stale queue runs and how to confirm reuse on the farm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
pr-preflight-platforms and check-doc-freshness-platforms now resolve their
same-repo-macos marker like the Linux/Windows legs: blacksmith-6vcpu-macos-26
for same-repo PRs and merge_group, GitHub-hosted macos-latest for forks,
Dependabot and every other event. The label is pinned to macos-26 because
GitHub's macos-latest is macos-26-arm64 today, so both paths run the same
OS/arch; 6 vCPU is already 2x macos-latest's 3 vCPU.
Blacksmith cannot see GitHub-saved caches, so main.yml gains
blacksmith-macos-go-build-cache: a push-to-main-only saver on the same label
(same job guard as the other Blacksmith savers) that builds ./cmd/bd and runs
the shared warm-non-race-cache.sh, saving the module cache and a non-race
GOCACHE keyed by go.sum + UTC day. The PR legs stay restore-only. main.yml's
GitHub-hosted macOS full-suite leg is unchanged and keeps seeding the fork
path.
Policy tests: the macOS marker arm is evaluated for same-repo/merge_group/
fork/deleted-head/dependabot/push/schedule and must match the flat macOS
const; the saver joins the PR-guard and per-day-key sweeps and the cache
ownership inventory; TestBlacksmithMacOSSaverMatchesPRLegs pins the
label/path/key/warm-up contract between saver and PR legs.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A farm run of TestAcquireAllExhaustedBudgetFinalAttemptIgnoresIntent
(#7225) failed with "held by a bd maintenance operation queued for
exclusive access" for a gate that was free: a real product race that broke
the guarantee that queued maintenance can delay a shared acquirer but never
fail it.
Acquire decided whether an attempt was final from the clock at the top of
the iteration, then probed the intent lock (open + flock + reading the
sidecar). On a starved machine the probe can take longer than the budget
that was left, so the iteration deferred as "not final", found the budget
spent, and returned ErrBusy without ever trying the gate. Now a deferral
can never end the acquisition: if the budget ran out while deferring, the
loop makes one more attempt at the gate that ignores the queue, and only a
gate that is really held can fail it.
Tests:
- TestSharedFinalAttemptSurvivesStallDuringIntentProbe stalls the
acquirer past its deadline right after the deferral decision (a
test-only hook), so the race is reproduced deterministically for both
Acquire and AcquireAll; it fails with the farm's exact message without
the fix.
- TestAcquireAllExhaustedBudgetFinalAttemptIgnoresIntent no longer
releases gate a from a timer racing the budget (a second load-dependent
failure mode seen in the repro); a is released synchronously after the
call.
Under load (Bazel server pinned to 2 CPUs with taskset, 32 concurrent test
jobs, race detector): the original test failed 71/200 runs (-test.count=20);
with the fix both tests pass 200/200 (-test.count=10), and the whole
workspacegate_test passes 200/200.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(roles): BatchGetter role and issues:batchGet route (S7)
Adds BatchGetter.GetMany(ids) -> {Issues, Missing}, a one-snapshot,
order-preserving, deduped, 1000-id-capped batch read, wired through all
three library legs (dolt, embedded dolt, uow) behind the existing
hook/telemetry decorator chain, plus the POST /v0/beads/issues:batchGet
HTTP route (spec, apigen, wire-shape golden, issues.batchGet capability
token). Conformance contract (RunBatchGetter*, 12 cases) passes on all
three legs against real backends. No HTTP client leg yet (waits on the
generator / PR #7247); left as a documented seam on BatchGetter's doc
comment.
CLI GetIssuesByIDs call sites are left unmigrated this slice and marked
with TODO(batchgetter) comments: every call site reads an unbounded id
list today, and GetMany's 1000-id cap has no chunking/fallback in any
caller yet, so swapping them in now would add a new, unhandled failure
mode to already-shipped CLI paths (export, import, molecule port,
ready-explain, wisp sweep).
Verified via three live-mutate guards against
internal/storage/issueops/batchget.go (disabling the cap check, dropping
the Missing append, and replacing ordered iteration with map iteration):
each turns the embedded-dolt contract red, confirming the cap, Missing
reporting, and order-preservation assertions actually catch a break.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(roles): close S7 review gaps — revision on wire, BUILD sync, handler tests
Addresses the S7 Opus review's FIX-FIRST items on BatchGetter/issues:batchGet:
HIGH
- batchGetResponse now projects apigen.BatchGetIssue (types.BatchGetIssue +
NewBatchGetIssue), carrying `revision` per issue the way IssueDetails does;
spec, apigen and the wire-shape golden regenerated (additive, no
wire_revision bump).
- make bazel-sync: the 12 files missing from BUILD.bazel srcs are back in
sync across 9 BUILD.bazel files.
- New internal/httpapi/batch_get_test.go: success incl. revision, missing
ids, empty arrays not null, unknown member refused, missing/null ids
refused, query parameter refused, 1001 ids refused with the full request
reaching the role, 1000 ids accepted.
MED
- RunBatchGetterAcceptsExactlyTheCap pins the cap boundary (> vs >=).
- RunBatchGetterHydratesLabels pins Labels survive projection.
- RunBatchGetterReadsOneSnapshot renamed to
RunBatchGetterSharesOneReadStructurally with a doc that no longer
overclaims atomicity; a real interleaving test needs a hook on the frozen
roleFixtureKit, out of scope here.
- Doc comments across ExecuteGetMany, GetManyResult.Issues and the
BatchGetter interface now say hydration is labels only.
LOW
- failBatchGetErr's doc no longer claims blank entries are "already caught".
- PR #7247 references kept.
Re-ran build/vet/gofmt/lint, make api-check, make bazel-sync(-check), the
full internal/httpapi suite, and all three conformance legs (dolt via the
pinned local server, embeddeddolt, uow) plus targeted cmd/bd serve tests —
all green. Live-mutate-guard reverified: cap >=, dropping Missing from the
response, and clearing Labels each now fail the relevant test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(roles): sync client vocabulary and repo gates with issues:batchGet
The S7 route landed on the server without the sibling tables that hold
the rest of the tree set-equal with the server's surface, so five
tests and two manifest gates went red on the PR head:
- httpclient/wire: mirror batchGetIssues into the client vocabulary,
CLASSIFIED, not wired, the way the wire wave and #7250's
issues.count.scope landed: OpBatchGetIssues, its issues.batchGet
token on opCapability, its identity row, and the first-slice skew
dimension 35 -> 36 (TestCapabilityTableMatchesTheServerRouteTable).
- httpclient/wire: BatchGetIssue is the first golden.json schema with
a `revision` member that needs no legacy-integer tolerance — the
route postdates #6053 and types.BatchGetIssue declares Revision a
string, and a pre-#6053 server never advertises issues.batchGet, so
Preflight refuses before any body is decoded. Exempt it with that
reason in a new revisionSchemaExempt table rather than adding an
issues[] rewrite no legacy server can reach; the gate refuses an
entry that is both covered and exempt, a stale exemption, and an
empty reason.
- httpclient/encode: give the oracle's role set a BatchGetter stub —
httpapi.Listen requires the whole set, so all three oracle tests
failed to bind.
- storage/uow: exempt IssueUseCase.GetMany from the notifying-parity
partition as a read, the reason hook_batch_getter.go gives.
- shard manifest: place TestBatchGetterContract in the 15-shard
embedded storage block (generator --write, incremental).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(roles): pin the BatchGetter pure tier and the spec ids caps
Review fixes, iteration 1. The review approved with no blocker or major
finding and three minors, and this commit takes all three. It changes
tests and one comment only, and every new assertion was mutation-probed
with go test -overlay.
- storage/issueops: add batchget_test.go, the database-free tier that
FinishGetMany's doc already claimed ("pinned without a database") but
that no test supplied. It pins:
- the cap is checked before the blank scan (an over-cap request with
a blank at position 0 answers *TooManyIDsError);
- the bound is inclusive;
- dedupe keeps the first mention, does not trim, and never writes
through the caller's slice;
- Issues and Missing both follow request order;
- both slices are never nil;
- ExecuteGetMany refuses one id repeated past the cap before any
query (a sqlmock with no expectations).
Ten mutants were each killed by exactly their intended test, with the
rest of the package green: last-mention, sort, trim, in-place dedupe,
blank-before-cap, >=, nil Missing, nil Issues, dedupe-before-validate
and validate-after-query.
- httpapi: TestSpecDefaultsMatchSharedConstants now checks ids.maxItems
against the enforced bound on the two request bodies that carry an
`ids` list: batchGetIssues against issueops.MaxGetManyIDs, and
deleteIssues against maxDeleteIDs. Each body is reached through its
operation's own requestBody $ref. Setting either constant to 999 turns
only this test red. The spec's other list caps (batch
create/close/apply items, dependency edge lists) stay ungated, as
before.
- cmd/bd/serve.go: the batchGetter field comment said its accessor
"does NOT recurse through the hook decorator". HookFiringStore.
BatchGetter does recurse to the inner getter; it just doesn't wrap
the result. The comment now says that.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
bd delete's single-id path resolves the row with
resolveAndGetIssueForMutation BEFORE calling deleter.Delete() and the
per-id lock fence #7244 added. On a real Dolt sql-server, a same-token
--if-revision racer that loses that fence can find the row already
gone at that pre-flight check, which returned an unclassified exit 1
("issue %s not found") instead of routing through
classifyIfRevisionFailure/reportIfRevisionFailure like every other
--if-revision loser. This is why TestSharedServerDeleteIfRevisionSingleWinner/same_token
is flaky.
classifyIfRevisionFailure already had a storage.ErrNotFound branch
anticipating exactly this gap (mc-zndi7.73); delete.go's pre-flight
check just needed to call it when --if-revision is set, reporting
precondition_failed / ExitGuardMismatch (13) instead of a bare
"not found".
Checked the proxied delete path (delete_proxied_server.go): it has no
separate pre-flight check and already routes deleter.Delete()'s error
through reportIfRevisionFailure, so no gap there.
Adds:
- TestClassifyIfRevisionFailureNotFoundSentinel: unit test pinning
classifyIfRevisionFailure/reportIfRevisionFailure's handling of the
bare storage.ErrNotFound sentinel.
- TestIfRevisionDeletePreflightGoneIsPreconditionFailed: embedded CLI
test that deterministically reproduces the same pre-flight code path
a losing racer hits (delete the row out from under a stale
--if-revision token), without depending on actual concurrency.
Fixes mc-zndi7.81.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(dolt): serialize guarded deletes against each other (mc-zndi7.73)
On a Dolt sql-server, two concurrent `bd delete --if-revision R --force`
requests for the same row were both landing: Dolt's commit-time merge
treats two concurrent transactions that each delete the same row as
identical diffs and lands both with no conflict, so every same-token
racer exited 0 instead of exactly one. A delete racing an update/close
already produced a real write conflict (the racing write's row_lock
bump is a genuine edit Dolt's merge must reconcile against the delete),
but deleter.go used withWriteTx (no retry), so the loser surfaced a raw
Dolt Error 1213 instead of being retried and reclassified as a version
mismatch.
Fix: a per-id delete fence (GET_LOCK/RELEASE_LOCK, Dolt/MySQL built-in
session primitives) serializes guarded deletes on a real Dolt
sql-server, so a same-token loser's existence probe now runs only after
the winner's delete has already committed and finds the row gone,
failing through the ordinary NotFoundError path. The fence pins ONE
*sql.Conn for GET_LOCK, the retried write, and RELEASE_LOCK, because
setupTestStore's tests (and any store configured with a pool of one)
run with MaxOpenConns=1, and a two-connection design would deadlock
under it. withRetryTx/commitWriteTx are generalized (withRetryTxOn/
commitWriteTxOn) to run their shared retry-and-commit body against
either the pool or this one pinned connection. deleter.go also now
uses withRetryTx instead of the non-retrying withWriteTx, so a delete
racing an update/close is retried like every other guarded write.
classifyIfRevisionFailure (cmd/bd/if_revision.go) gains a
storage.ErrNotFound case, mapping the row-vanished-from-under-the-guard
outcome to precondition_failed/ExitGuardMismatch on both the proxied
routes (which have no pre-write existence check) and this same-token
delete race.
No schema or migration change: GET_LOCK/RELEASE_LOCK are built-in
Dolt/MySQL session primitives, the same idiom
schema.MigrateUpWithLock already uses for migrations, reimplemented
standalone in internal/storage/dolt/delete_fence.go to avoid borrowing
the schema package's migration-flavored timeout and error sentinels.
Adds real concurrency race tests in the style of #7233's
shared_server_if_revision_concurrency_test.go: same-token deletes,
delete vs close, delete vs update, on both the shared-server and
proxied routes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(uow): serialize guarded deletes against each other on the proxied route (mc-zndi7.73)
internal/storage/dolt's new per-id delete fence only covers the
shared-server/direct-CLI route. The proxied-server (and bd serve)
route goes through internal/storage/uow instead, a completely
separate deleter implementation that shares no code with the dolt
package, so it had the exact same bug: two concurrent guarded deletes
of the same row both landed, because Dolt's commit-time merge treats
two identical "row absent" diffs as non-conflicting.
Fix: a twin fence (internal/storage/uow/delete_fence.go) applied
around the write whenever req.ExpectedVersion is set. Unlike the
dolt-package fence, this one uses two independent connections (one for
GET_LOCK/RELEASE_LOCK, one drawn normally by the retried write) rather
than pinning a single connection: no cmd/bd call site ever constrains
this package's pool to one connection, so a dedicated lock connection
cannot starve the write. The fence unwraps d.provider via the existing
uow.UnwrapProvider helper first, because the real proxied chain always
wraps the bare *doltSQLProvider in a notifyingProvider and then an
externaldeps uowProvider before handing it to NewDeleter.
No code changes were needed in cmd/bd/if_revision.go: a losing
racer's existence probe already returns the same NotFoundError/
storage.ErrNotFound classifyIfRevisionFailure already maps to
precondition_failed for the shared-server race.
Also fixes internal/storage/dolt/version_scope_completeness_test.go's
TestTxMintingWrappersScopeVersionedHistory, broken by the prior
mc-zndi7.73 commit's withRetryTxOn/commitWriteTxOn split: the BeginTx
call (and the versioned-history scope call beside it) moved from
commitWriteTx's own body down into commitWriteTxOn, so the guard's
hardcoded txMintingWrappers list needed to name the new function that
actually mints the transaction.
No schema or migration change: GET_LOCK/RELEASE_LOCK are the same
built-in Dolt/MySQL session primitives the dolt-package fence uses.
Agent-Signature: claude-code-claude-sonnet-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): sync BUILD files for mc-zndi7.73's new delete-fence sources
make bazel-sync, picking up internal/storage/dolt/delete_fence.go and
the two cmd/bd race-test files added by the prior commit (missed
there) plus this commit's new internal/storage/uow/delete_fence.go.
Agent-Signature: claude-code-claude-sonnet-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Shutdown advances the stop epoch, then waits while a live starter's
proxy.spawn marker covers the release-lock-before-exec window. That wait
shared shutdownConfirmDeadline (5s) with the kill/confirm phases, but the
starter legitimately holds the marker longer: it waits up to openDeadline
for the child to take proxy.lock (which clears the marker) and then up to
shutdownConfirmDeadline each to kill the child and clear the marker. On a
loaded host (CI -race runners) a slow fork/exec pushed the start past 5s
and `bd dolt stop` reported "proxy.Shutdown partial: backend stopped;
proxy left running: timeout (5s) waiting for spawn marker" for a start that
was still progressing and about to abort on the advanced epoch. This is the
TestShutdownWaitsForStartDelayedBeforeExec flake.
The marker is only treated as active while its owner's verified identity
is alive (a dead owner's marker is removed on sight), so bound the wait by
the starter's own budgets (shutdownSpawnWaitDeadline = openDeadline +
2*shutdownConfirmDeadline) and give the post-start stop phases a fresh
shutdownConfirmDeadline once the marker resolves.
Tests: TestShutdownWaitsForLiveStarterPastConfirmDeadline holds the start
before exec past shutdownConfirmDeadline; it fails deterministically with
the CI signature before this change. Both spawn/stop tests share a helper
and use generous hang-detector timeouts.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
TestProxiedServerOutageReconnectAcceptanceMatrix/external-tcp flaked in the
Bazel proxied-server tier with "Condition never satisfied: bd reconnect after
upstream restart" (5 CI failures, every one external-tcp, never the unix
case).
The restore step SIGKILLed the old socat front and immediately started a
replacement on the same TCP port. Kill only queues the signal: on a loaded
host the old socat can still hold the listener when the replacement calls
bind, so the replacement exits with EADDRINUSE. Its stderr went nowhere and
the "remained alive" check passed on the unreaped pid, so the endpoint
refused every connection and each bd attempt correctly failed with the
proxy's upstream-unreachable report until the 10s window ran out. The unix
case removes and rebinds a fresh socket path, so it cannot hit this.
The bridge is now a small type that tracks socat's exit: stop() kills and
waits for exit (the listener is released by then), and startOutageBridge
waits for socat's own "listening on" notice (-d -d), retrying a socat that
exits before listening. The reconnect loop reports the last bd error and the
bridge log on failure instead of a bare "condition never satisfied".
Product behaviour is unchanged: the proxy reports a refused upstream and
reconnects as soon as the endpoint is back.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#7210 (OSS HTTP client wire/encode layers) and #7199 (Counter scope —
ParentID, NoParent, ExcludeTypes, ExcludeStatus behind issues.count.scope)
merged back to back without a rebase, leaving main red on the client's
parity gates: the count encoder table left the four new CountRequest
members unclassified, the published parent/no_parent/exclude_type/
exclude_status parameters had no driving field, and the client's
capability vocabulary lacked the server's new behavior token.
- encode: countTable maps the four scope members as params, spelled as
the server's countFilters decodes them; countFilters emits them.
- encode/skew: --no-parent / --exclude-status flag mapping for the
unknown_parameter refusal.
- wire: CapCountScope mirrors httpapi.CapIssuesCountScope and joins
behaviorCapabilities; the vocabulary test pins it by name and order.
- roundtrip: scope members round-trip through the server decoder
(ParentID and NoParent in separate cases, as the role refuses both).
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpapi): wire-shape signal — wire_revision, floor header, golden digest, param tokens
S0 of the HTTP role-parity program: give a client a single place to learn
whether this build's wire shape has moved under it, and give CI a gate that
catches an undocumented move.
- GET /v0/beads/context reports wire_revision (bumps only on a non-additive
response-shape change) and min_client_wire_revision. An optional
Bd-Wire-Revision request header lets a client declare the revision it was
built for; checkWireRevision refuses a declared revision below the floor
with 400 invalid_argument/reason=wire_revision_unsupported and a
min_wire_revision field, on every route but /healthz (wireRevisionExempt) —
including the identity handshake, where catching the mismatch is cheapest.
Absent header is today's behavior; malformed value is invalid_value, never
wire_revision_unsupported. The floor lives in Server.minClientWireRevision
(defaulting to the MinClientWireRevision constant) so a test can raise it.
- internal/httpapi/wireshape: a golden digest over every response's every
content-type schema (including application/problem+json) across the whole
spec, keyed by schema+member. TestWireShapeDigest fails closed when a
member's JSON name or type changes without wire_revision bumping to match;
regenerate with `go run ./internal/httpapi/wireshape/cmd/gendigest`.
- GET /v0/beads/issues' `sort` parameter now carries the issues.listSort
capability token, the same convention `capabilities` entries use.
TestNewParameterOnExistingOperationHasABehaviorToken requires every new
parameter on an existing operation to carry one, checked against a
write-once grandfather baseline (testdata/pretoken_parameters.json) of
parameters that predate the rule; TestUntokenedParameterRuleFires proves
the checker itself against a synthetic fixture.
- Docs: engdocs/design/bd-serve-v0.md gets a "The wire-shape signal" section;
CHANGELOG.md gets an Added entry.
Live-mutated and reverted three RED demonstrations during development:
retyping api_version in the spec failed TestWireShapeDigest; short-circuiting
checkWireRevision's floor comparison failed
TestWireRevisionBelowFloorRefusesEveryEnforcedRoute; adding an untokened
query parameter to listIssues failed
TestNewParameterOnExistingOperationHasABehaviorToken. All three now pass
against the unmutated tree.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): rename issues.listSort to issues.list.sort, harden token rule
Opus review of 12c5144ca (HIGH-1, MEDIUM-5):
- Rename the capability token issues.listSort -> issues.list.sort to match
bd-enterprise's client (httpstore/wire/handshake.go:121, DESIGN.txt S4e),
and widen capabilityToken to accept an optional third segment.
- untokenedParameters() now requires the extracted token to be one
Capabilities() actually serves, not just backtick-shaped text. This
catches real false positives that existed in the spec already
(workapi.DefaultReadyLimit, status.custom) which only shape-matched the
old regex; they're added to the pretoken baseline as genuinely
pre-existing untokened parameters.
- Extend the rule to request body members (new
testdata/pretoken_request_body_members.json baseline) and exempt
brand-new operations via a frozen testdata/pretoken_operations.json
snapshot.
- Add TestPretokenBaselinesNeverGrow pinning all three baseline sizes so
a future change can't hand-add an exemption instead of a token.
- Update spec prose for the widened rule scope.
go test ./internal/httpapi/... and the reviewer's pmut.py all pass as
expected: plain/bogus modes go RED, reuse (real-but-unrelated token) stays
green, matching the review's literal ask ("a token must be one advertised
by Capabilities()").
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(wireshape): close four digest-coverage gaps, add gendigest write guard
Opus review of 12c5144ca (HIGH-2, MEDIUM-4). The digest only tracked
Type/Format/Enum/Required on direct properties, missing:
- nullable: true (never read at all)
- array item shape (Issue.labels items string->integer was invisible;
only object-shaped items got recursed into)
- additionalProperties value shape (IssueCount.groups)
- request bodies entirely (Compute() only walked responses, so
DeleteIssuesRequest.expected_version string->integer, the other half
of #6053, was invisible)
Also added defensive oneOf flattening alongside the existing allOf merge
(dormant today -- grep confirms this spec uses oneOf nowhere -- but no
longer silently invisible if that changes).
Extracted the golden-vs-computed comparison into wireshape.Compare(),
shared by TestWireShapeDigest and the new wireshape.SafeToWrite(), which
gendigest now calls before writing: it refuses to overwrite golden.json
with changed/removed entries unless the candidate's wire_revision is
strictly greater than the existing golden's. Pure additions always write.
TestSafeToWrite exercises both guard directions.
golden.json is regenerated. This single regen is a one-time exception to
the new guard, done by writing the digest directly rather than through
gendigest: confirmed via a throwaway diff (not checked in) that every one
of the 57 "changed" entries differs only in the NEW fields the wider walk
now populates (ItemType/ItemFormat/Nullable/AdditionalProps*) -- every
pre-existing Type/Format/Required/Enum value is byte-identical. Nothing on
the wire changed; the measurement got more precise. Bumping
CurrentWireRevision for this would have written a false "the protocol
changed here" entry into the revision history table. Going forward, any
REAL change the guard now reports uses the normal bump-then-regenerate
path, same as before.
Verified against the reviewer's mut.py: nested_type, nullable,
nullable_issue, array_items, addlprops, request_body and format all go RED
on TestWireShapeDigest, each reverted after confirming.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): make bd_version wire_revision inference advisory
Opus review of 12c5144ca (HIGH-3). The spec told a client inferring
wire_revision from bd_version to use the release cutoff >= 1.3.0, and said
nothing about what happens when that inference is wrong -- which it
demonstrably is for real builds already in the field:
- main builds up to commit b3ef65c85 report bd_version 1.2.2 (below any
1.3.0 cutoff) while already sending the string-typed revision/
expected_version shape (#6053).
- 1.3.0-rc.N pre-release builds sort BELOW the release cutoff 1.3.0 under
plain string comparison despite already carrying the string shape.
- The bd-enterprise compatibility line at d3ab32773462 reports bd_version
1.1.0 while also sending strings.
Moved the cutoff to >= 1.3.0-rc.1 (compared as semver-with-prerelease,
which at least captures the rc builds), documented both named exceptions
inline, and made the whole inference explicitly ADVISORY: a client must
accept revision/expected_version as either a string or a number whenever
wire_revision is absent (or probe directly) rather than let the inferred
value choose a decoder, and must never refuse solely because the inferred
revision is 0. Mirrored into engdocs/design/bd-serve-v0.md.
This is spec/doc prose only -- there is no server-side inference code to
change, since this server always sends wire_revision directly; the
inference is guidance for clients reading a pre-signal server's response
(this server, past builds, or an unrelated implementation).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): LOW-7/8/9/10 review follow-ups for wire-revision signal
LOW-7: WireRevisionUnsupported now also sets Problem.wire_revision (this
server's CurrentWireRevision) and Problem.bd_version on the
wire_revision_unsupported refusal, alongside the existing
min_wire_revision, so a client logging the refusal has this server's
full self-description without a second /v0/beads/context call.
LOW-8: gazelle + make bazel-sync add the BUILD.bazel entries the prior
commits were missing: wire_revision.go/wire_revision_test.go in
internal/httpapi's srcs, new BUILD.bazel files for wireshape and
wireshape/cmd/gendigest, and a testdata glob on httpapi's go_test so
the pretoken_*.json baselines are visible under `bazel test`. Verified
with `bazel build //internal/httpapi/...` and
`bazel test //internal/httpapi/... --test_env=BEADS_TEST_SKIP=dolt`
(both green) and `python3 tools/bazel/go_srcs.py --check` (clean).
LOW-9: narrowed CHANGELOG.md and engdocs/design/bd-serve-v0.md to
describe the digest's actual final coverage (format/enum/required/
nullable, array items, additionalProperties, request bodies, $ref/
allOf/oneOf recursion, the SafeToWrite revision-bump guard) and the
token rule's actual final shape (three pinned baselines, request-body
members, Capabilities()-membership validation, new-operation
exemption) instead of the original, narrower claims.
LOW-10: Bd-Wire-Revision now parses via a strict decimal-only
parseStrictNonNegativeInt (no leading '+', no leading zero except a
bare "0") instead of strconv.Atoi alone, so two different header
bytes can no longer name the same revision. New malformed-header test
cases: "+1", "01", "007".
Regenerated apigen/types.gen.go (make api-gen) for the new Problem
fields and wireshape/testdata/golden.json (go run
.../wireshape/cmd/gendigest) for the two new additive Problem members;
the latter wrote cleanly through SafeToWrite itself, since both are
pure additions.
go test ./... and bazel test //internal/httpapi/... both green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): re-review LOW follow-ups — retirement test, gendigest -init, docs
1. TestRetiredRevisionsStayBelowTheFloor pins the PRESENCE guarantee the
wire_revision property doc relies on: CurrentWireRevision >= 2 (so 0
and 1 stay permanently retired) and MinClientWireRevision <=
CurrentWireRevision (so this build's own floor never refuses every
request against itself).
2. gendigest now refuses to create a golden.json that does not exist yet
unless run with -init. Previously a missing file (moved testdata,
wrong path, accidental delete) was indistinguishable from a real first
run and silently wrote a fresh golden with no revision history checked
against anything. writeGolden() is extracted out of main() so this is
covered directly: TestWriteGoldenRequiresInitWhenMissing,
TestWriteGoldenInitCreatesWhenMissing,
TestWriteGoldenIgnoresInitWhenGoldenExists (the existing-golden path is
still governed only by SafeToWrite, -init or not).
3. Narrowed the two remaining stale claims that still described the
digest's original, narrower coverage: the wire_revision property's
prose in openapi.v0.yaml (regenerated into apigen/types.gen.go via
make api-gen) and wireshape/doc.go now both list nullable, array item
shape, additionalProperties value shape, request bodies, and
$ref/allOf/oneOf recursion, plus the new -init guard.
go test ./internal/httpapi/... and make api-check both green;
bazel test //internal/httpapi/... (httpapi, wireshape, and the new
gendigest test target) green; python3 tools/bazel/go_srcs.py --check
clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(wireshape): cover operation parameters in the wire-shape digest
The digest previously walked only response and request-body schemas, so a
type, enum, required, or removal change on one of the spec's 138 operation
parameters (123 query, 14 path, 1 header) passed the gate silently — the
open item from PR review on #7182.
Each parameter is now recorded as its own Entry, keyed by
"param:"+operationId / location+":"+name (operation-scoped, not
schema-scoped, since two operations' same-named parameter are independent
wire contracts), capturing type, array item shape, enum, required, style,
explode and default. Adding a parameter stays additive; removing,
retyping, narrowing its enum, or changing required/style/explode/default
now trips SafeToWrite exactly like a response or request-body change.
Verified against the live spec: retyping listIssues' `limit` query
parameter from integer to string now fails TestWireShapeDigest (confirmed
red, then reverted — not part of this commit). golden.json regenerated via
gendigest; the new parameter entries are a pure addition, no wire_revision
bump needed. Added TestParameterMutationsAreCaught (remove/retype/narrow-
enum against real golden entries) and updated wireshape's doc.go, the
`wire_revision` spec prose, and the CHANGELOG to describe the new
coverage.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(wireshape): review fixes — stale-golden and lowered-revision arms, effective param serialization, digest boundary
Maintainer fixup from the adopt-pr review loop (iterations 1 and 2), on
top of e17ba924f.
- goldenDrift (A, I): TestWireShapeDigest's comparison moves into a
goldenDrift helper. An addition alongside a moved wire_revision no
longer passes with a stale golden: it asks for a regenerate, as a
changed or removed entry after a bump already did. Every message now
names response/request-body members AND parameters, and TestGoldenDrift
pins each arm. This takes only the test half of the stranded fixup
(adopt-pr/bd-47kdge/stranded-fixup-528cd6095); its doc half, which says
parameters are outside the digest, is false since e17ba924f and is not
replayed (J).
- Lowered wire_revision (D): a CurrentWireRevision LOWER than the
golden's is a wrong constant, not a stale golden, so goldenDrift says to
restore it instead of regenerating, and SafeToWrite (so gendigest)
refuses any write at a lower revision, whatever the entries.
- Effective style/explode (B): walkParam records style and explode with
OpenAPI 3.0's defaults filled in (form for query/cookie, simple for
path/header; explode defaults to style == form). Adding `explode: false`
to a query array that relied on form's implicit explode is now a
changed entry, while spelling out a default changes nothing.
testdata/golden.json is regenerated with -init: 111 parameter entries
change only in style/explode (96 to form/true, 15 to simple), 828
entries before and after, wire_revision stays 2. The golden is new in
this PR and unreleased, so this needs no bump.
- TestWalkParam (H): a package-internal table test
(wireshape_internal_test.go) pins every field walkParam extracts,
through a computeFrom(document, revision) seam that Compute now wraps:
per-location defaults, $ref'd parameters and items, format, nullable and
default, content parameters, and the nil returns.
TestEffectiveSerializationIsCompared pins B end to end through Compare
and SafeToWrite. BUILD.bazel embeds the library in the go_test, which is
gazelle's own output.
- Required inputs and the digest boundary (C, E, F; docs only): all five
prose surfaces (openapi.v0.yaml's wire_revision description and the
regenerated apigen/types.gen.go, wireshape/doc.go, CHANGELOG.md,
engdocs/design/bd-serve-v0.md) now say that a new REQUIRED request
input is recorded as an ordinary addition and needs its own review,
that value constraints and member-level composition are outside the
digest, and that object and content parameters are recorded only as
their container. bd-serve-v0.md also gains the parameter coverage it
was missing.
- G: a brand-new operation is permanently exempt from the
capability-token rule; its own review decides its capability story.
- Iteration 2 (nit): walkParam's comment now says that the location
default it records as a `content` parameter's style and explode is a
placeholder, since OpenAPI 3.0 applies style and explode only to a
parameter described by `schema`. All 138 operation parameters in the
spec use `schema`, so the golden does not change.
Validated: go test ./internal/httpapi/... (gms_pure_go), make api-check,
go vet for linux/windows/darwin, gofmt, git diff --check, gazelle on the
package (no drift), make bazel-sync-check, and bazel test
//internal/httpapi/wireshape/... in the local processwrapper sandbox
(2 of 2 pass). Overlay mutation probes: dropping the added-after-bump
arm, the lowered-revision arm, SafeToWrite's lowered check, or the
effective-default fill each turns the new tests red.
Iteration 2 changes only that comment; go test
./internal/httpapi/wireshape/... (gms_pure_go), go vet, gofmt and git
diff --check pass again.
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>
* feat(httpclient): lift the HTTP client wire/encode layers from bd-enterprise (MIT contribution)
Contributed by gascity from bd-enterprise (github.com/gascity/bd-enterprise,
internal/enterprise/httpstore @ 49d1df2f6) to OSS beads under the MIT
license, with the owner's explicit approval. Every lifted file carries a
provenance header naming its source path.
Lifted into internal/httpclient:
- wire/ the HTTP transport, lazy handshake, project-identity stamping,
problem-code decoding, retry behaviour and the capability vocabulary
- encode/ request/response encoders for the role operations
- credential*.go, ca*.go, target*.go the bearer credential ladder,
host-scoped CA trust and the http_target.json sidecar
Not lifted (stays enterprise-only): the hosted gateway (httpgw/gwauth),
box-login, storage profiles and gasworks.
Deferred to later slices (kept aside, not in this tree): the store transport
seam (WireClient/WireDialer/process-wide dialer, which goes to S3 with
dial.go), the enterprise-only BatchCloseRequest.claim_next encoder
(ClaimNextBody; the OSS server has no claim_next on batch close), and the
tests that need the store/dial layer.
This commit is the mechanical lift: import paths rewritten, package renamed,
two compile gaps removed. The production code builds. Known follow-up in the
next commit: reconcile the client's vocabularies and encoder tables with the
OSS spec (e.g. the OSS problem code notes_overwrite_refused, policy/sort
differences), restore the test helpers the lifted tests need, and wire in the
S0 wire_revision handling and S1 OpenOptions credentials.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(httpclient): compile the lifted client and reconcile with the OSS wire
The lift in ab11cb1f8 carried relative test paths and vocabulary tables
from bd-enterprise's internal/enterprise/httpstore (4 directories below
repo root) into internal/httpclient (3 below), and several tables
described enterprise-only server behavior OSS does not serve. Reconcile:
- Add testTarget test helper (written fresh) so internal/httpclient
compiles and its tests pass.
- Fix four relative paths off by one "../" from the package relocation
(skew_test.go, ledger_render_test.go, bijection_test.go x2).
- skew_test.go: importsHTTPClient now matches internal/httpclient instead
of the retired internal/enterprise/httpstore path; the cmd/bd sweep no
longer hard-fails when it legitimately finds zero matching files (cmd/bd
does not import this client yet - that's S3's wiring).
- encode/table.go, encode/ledger_fields.go: removed a Reserved "reverse"
entry and a refused ExcludeIDs field claimed for listIssues/ReadyRequest;
OSS's listIssues never accepts "reverse" (confirmed against
internal/httpapi/reads.go and routes.go's CapIssuesListSort, which gates
`sort` only) and issueops.ReadyRequest carries no ExcludeIDs member in
OSS. Each removal is documented in place.
- encode/table.go, encode/encode.go, encode/roundtrip_test.go: countIssues
publishes has_metadata_key and include_ephemeral that CountRequest
carries and the table/encoder/round-trip corpus all silently dropped;
mapped and wired through.
- encode/ledger.go: ~70 ledger rows cited enterprise store-conformance and
cmd/bd subprocess-parity tests (dual-run reader, claim races, flag-mode
refusals) that don't exist in this package and belong to S3's store/dial
seam and cmd/bd wiring. Re-pinned to a documented TODO(S3) sentinel
(pinnedByS3Conformance) rather than deleted, per the ledger's own
well-formedness discipline.
- wire/handshake.go, wire/vocabulary_test.go: added CapBatchApplyLarge
(issues.batchApplyLarge) alongside the server's behaviorCapabilities.
- wire/problem.go: mapped the notes_overwrite_refused problem code to
issueops.ErrNotesOverwrite.
internal/httpclient/... is fully green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(httpclient): wire-revision handshake gate and batch cap from capability
S0 integration (task #2): Client.Handshake now reads ContextResponse's
wire_revision/min_client_wire_revision and refuses with a typed
*WireRevisionSkewError before any post-handshake call when the server's wire
shape falls outside [ClientMinWireRevision, ClientWireRevision] -- mirroring
DESIGN.txt sec 4's "Client rule". A decoded 0 is treated as "the server
omitted the member" per the permanently-retired-values rule, never as a value
needing refusal. The client now also stamps Bd-Wire-Revision on every request
(client.go's stampRequest), and problem.go gained the per-request mirror:
*WireRevisionUnsupportedError, decoded from the reason:"wire_revision_unsupported"
extension members, for the case where the SERVER refuses this client's
declared revision as too old. Both error types are deliberately distinct --
one is this client declining after reading a 200, the other is the server
refusing a request outright -- and neither branches on bd_version (only
assigns it into error text), so TestNoFeatureBranchesOnBdVersionOrSchemaVersion
stays green.
Also added legacyRevisionFields/decodeRevisionToken to problem.go: a
precondition_failed refusal's expected_version/actual_version, typed *string
on the generated Problem, now tolerates a pre-#6053 server sending either as a
bare JSON integer rather than the decimal string every server since has used,
recovering the field the primary decode silently drops rather than losing it.
Batch cap (task #3): ApplyBatch reads the handshake snapshot on every call and
enforces 100 items unless the server advertises issues.batchApplyLarge, in
which case the ceiling is issueops.MaxApplyBatchItems (1000) -- never a bare
compiled constant. A plan over the applicable cap refuses before the dial: via
the existing *CapabilityError machinery when advertising the capability would
help (D7 case 2), or via a new *BatchTooLargeError (unwraps to
issueops.ErrValidation) when it would not. BatchTooLargeError lives in
handshake.go rather than beside ApplyBatch because every exported method in
writes.go is swept by TestEveryOperationMethodRoutesThroughTheSharedDispatch as
an operation-dispatch method.
All three internal/httpclient/... packages build and `go test` passes with
TMPDIR=/data/projects/.scratch/s2t BEADS_TEST_SKIP=dolt.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(httpclient): REQUIRE-mode credential resolution bridge to backends.Credential
Task #4: adds the knob internal/storage/backends/backends.go's OpenOptions.Credential
doc explicitly deferred ("S1 does not add a RequireCredential knob to enforce
the multi-tenant rule mechanically -- that is deferred to S2").
ProvidedCredential wraps an embedder-supplied wire.CredentialProvider (via its
httpclient alias) as a backends.Credential, so a multi-tenant embedder (for
example gc, Gas City: one process serving many workspaces) can carry a
per-workspace credential through backends.OpenOptions without the backends
package needing to know this package's CredentialProvider shape.
ResolveCredential(opts, base, require) is the bridge itself:
- nil Credential, require=false: NewBearerProvider(base), the existing
single-tenant ambient bearer ladder (unchanged).
- nil Credential, require=true: ErrCredentialRequired -- the multi-tenant
fail-closed case backends.go's doc names: a missing per-workspace
credential must be a loud refusal, not a silent fall-through to
process-global ambient env that cannot tell one tenant's workspace from
another's.
- a ProvidedCredential with a non-nil Provider: returned directly,
regardless of require.
- a ProvidedCredential with a nil Provider, or any other
backends.Credential this package does not recognise: refused -- the
former as ErrCredentialRequired (a present-but-empty wrapper must not
look like "a credential was supplied"), the latter wrapping
backends.ErrUnsupportedCredential per the OpenWith contract
internal/storage/backends/open_with_test.go already pins
(TestBackendOpenWithRefusesUnsupportedCredentialType).
No bd-enterprise source was copied for this file; it is new code written
against the OSS backends.go contract and the existing BearerProvider/
CredentialProvider types already lifted into this package. Live-mutated all
three guards (the require branch, the ProvidedCredential type assertion, and
the nil-Provider check) and confirmed each produces a RED test before
reverting.
go build/vet/gofmt clean; `go test ./internal/httpclient/...` passes with
TMPDIR=/data/projects/.scratch/s2t BEADS_TEST_SKIP=dolt.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient): S2 task #6 wire-revision/legacy-decode coverage, fix legacyRevisionFields bug
Add httptest coverage for the two wire-revision mechanisms task #2 added
(commit 7ff68b29d8):
- handshake_wire_revision_test.go: the client-initiated skew gate
(checkWireRevision/WireRevisionSkewError) and the per-request
Bd-Wire-Revision header stamp. Live-mutated both switch arms in
checkWireRevision and the stamped header value; confirmed RED, reverted.
- problem_wire_revision_test.go: the server-initiated
wire_revision_unsupported refusal (reason-before-code dispatch priority)
and the legacy-integer revision-token fallback.
Writing the legacy-decode tests surfaced a real bug in legacyRevisionFields:
its presence guard treated any non-nil *string field as "already decoded,"
but encoding/json's indirect() pre-allocates a pointer to "" for a *string
field before discovering a type mismatch (e.g. a bare JSON integer). A
type-mismatched expected_version/actual_version therefore arrived as a
non-nil pointer to the empty string, not nil -- exactly the one case the
fallback exists to recover, and exactly the case the old guard skipped.
Fixed by adding revisionNeedsFallback(p) (nil-or-empty), used in place of
the bare nil checks. No legitimate server response uses a literal
empty-string revision token, so this changes no other behavior.
Live-mutated the fixed guard back to the old nil-only checks; confirmed RED
on both recovery tests, reverted.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient): S2 task #6 ApplyBatch item-cap coverage
Add writes_batch_cap_test.go: httptest coverage for ApplyBatch's
capability-gated item ceiling (task #3), separate from the generic
two-speed "is issues.batchApply routed at all" gate writes_twospeed_test.go
already covers.
Cases: at-or-under the 100-item floor succeeds without the capability;
over the floor without issues.batchApplyLarge refuses with a
*CapabilityError before any dial past the handshake; the capability raises
the ceiling to issueops.MaxApplyBatchItems (1000), both at the new ceiling
and strictly between the old floor and it; over the absolute ceiling
refuses with *BatchTooLargeError regardless of the capability, also
without dialing the batch-apply endpoint.
Live-mutated all three guards in ApplyBatch (the limit computation, the
n > limit check, and the capability-vs-absolute-ceiling branch); confirmed
each produces a distinct RED, reverted.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient): S2 task #6 live TLS coverage for wrong-CA refusal
Add ca_wrong_ca_test.go: an end-to-end httptest TLS dial proving
TransportFor's configured CA pool is actually enforced at the wire, not
just recorded on the transport struct. ca_test.go already proves the
latter (TestTransportForReplacesRootPoolNotExtends, via
x509.CertPool.Equal) and proves the RIGHT CA dials successfully
(TestTransportForFileRotationClosesSupersededIdleConnections's live GETs);
neither exercises a server whose leaf a DIFFERENT CA signed.
TestTransportForWrongCARefusesTheTLSHandshake dials a server through a
transport built from an unrelated CA file and asserts the handshake fails
with x509.UnknownAuthorityError. TestTransportForRightCASucceedsOverTLS is
the positive control, using the same (newly-exercised) ca.startServer
helper that was defined but had no caller before this test -- without it,
a mutation that drops RootCAs entirely (falling back to the system pool)
would still pass the wrong-CA test for the wrong reason; the positive
control catches that case. Live-mutated transportForFile to drop RootCAs;
confirmed the positive control goes RED, reverted.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): gazelle BUILD files for the lifted httpclient package tree
Task #7: bazel run //:gazelle, now that internal/httpclient and its
encode/wire subpackages exist in the OSS tree (ab11cb1f8) and have gained
this S2 slice's new files. No existing BUILD.bazel files changed; these
three packages previously had none.
Note for S3: bazel test //internal/httpclient/... fails on tests that read
sibling source trees by relative path at runtime
(TestLedgerRowsAreWellFormed, TestEveryEncoderTableParameterIsPublished,
TestDivergenceLedgerDocMatchesLedger in encode, and
TestNoFeatureBranchesOnBdVersionOrSchemaVersion,
TestEveryOperationMethodRoutesThroughTheSharedDispatch,
TestEveryOperationMethodIsCoveredByTheTwoSpeedTable in wire) -- paths like
../../../cmd/bd and ../../httpapi/spec/openapi.v0.yaml resolve under `go
test`'s working directory but not Bazel's sandbox, which gazelle cannot
infer `data` attributes for. Pre-existing in code from task #1/#2, not
introduced by this commit; `go test ./internal/httpclient/...`,
`go vet ./...`, `gofmt -l .`, `golangci-lint run ./internal/httpclient/...`,
and `make api-check` are all clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient/wire): tolerate bare-integer revision on success-path responses
Review HIGH #2: against a fake pre-#6053 server (one whose ContextResponse
omits wire_revision), CloseIssue and its revision-bearing siblings
(ApplyBatch, ReleaseIssue, ReopenIssue, UpdateIssue) failed with an untyped
`json: cannot unmarshal number ... revision of type string`. S0's
string-or-number tolerance (problem.go's legacyRevisionFields) only covered
the problem+json error path, never the success path.
Adds revision_tolerance.go: a pre-unmarshal rewrite that walks a response
body and turns a bare JSON number at a "revision" key into its exact decimal
string, scoped to the five apigen response types that carry the member and
gated on the handshake having seen no wire_revision at all. Left
apigen/types.gen.go and the OpenAPI spec untouched (both are
regenerate-and-diff gated by `make api-check`), rather than introducing a
custom Revision JSON type through codegen, to keep the fix's blast radius to
the wire package's own reader.
Updates ClientMinWireRevision's doc comment (handshake.go) to describe
tolerance on both halves of the wire instead of overclaiming the error-path
fix alone covered it. Adds revision_tolerance_test.go: a read (ListReadyWork)
and a guarded write (CloseIssue with ExpectedVersion) against a fake
pre-#6053 server, plus a modern-server control proving the rewrite never
fires when wire_revision is present. Mutation-tested: disabling the rewrite
reproduces the exact untyped UnmarshalTypeError the review reported.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): sandbox internal/httpclient's source-reading tests (Bazel gate green)
Review HIGH #1: the Bazel lane was red because three tests under
internal/httpclient read sibling/cross-package files by relative OS path at
runtime, which bazel test's sandbox does not materialize without an explicit
`data` dependency.
- internal/httpclient/encode/BUILD.bazel: encode_test gets
data = ["//cmd/bd:go_srcs", "//internal/httpapi/spec:openapi.v0.yaml",
"//:engdocs/design/http-divergence-ledger.md"] + glob(["*.go"]), covering
bijection_test.go's cmd/bd scan and ledger_render_test.go's golden-doc read.
- internal/httpclient/wire/BUILD.bazel: wire_test gets
data = ["//cmd/bd:go_srcs", "//internal/httpclient:go_srcs"] + glob(["*.go"]),
covering skew_test.go's AST sweep of both trees.
- internal/httpclient/BUILD.bazel gains a go_srcs filegroup via `make
bazel-sync` (tools/bazel/go_srcs.py): added "internal/httpclient" to the
script's managed PACKAGES list rather than hand-writing the block.
- internal/httpapi/spec/BUILD.bazel and the root BUILD.bazel gain
exports_files for openapi.v0.yaml and engdocs/design/http-divergence-ledger.md,
scoped to //internal/httpclient/encode:__pkg__.
- bijection_test.go's loadPublishedParameters now reads the wire contract
through spec.OpenAPIV0() (the package's existing go:embed) instead of a
relative os.ReadFile path, per review suggestion -- the embed makes the
parameter set reachable without a `data` dependency on the YAML at all; the
openapi.v0.yaml data entry above stays as defense in depth for any other
reader the package gains.
Ran via `bazel run //:gazelle` then `python3 tools/bazel/go_srcs.py`
(bazel-sync-check passes). `bazel test //internal/httpclient/...` is fully
green: 3/3 test targets pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(httpclient): scrub private/enterprise infra references from code and docs
Review MEDIUM #3. Provenance headers ("Contributed by gascity from
bd-enterprise...") stay by design -- this removes references to private
infrastructure and unported internals from comment bodies and generated docs:
- wire/doc.go: dropped the internal/enterprise/hostedbeads and
internal/enterprise/storageprofile build-tag comparison (neither exists in
this OSS tree) and the dangling citation of the never-written
engdocs/design/http-client-backend.md, replacing both with an accurate
description of this package's own build-tag-free status and a pointer to
the divergence ledger that does exist.
- credential.go: CredentialProvider's doc no longer names gwauth/DPoP/gateway
auto-detection by their private spelling; describes the interface generically.
- ca.go: dropped "cherry-to-AWS RTT" (generalized to "a typical cross-region
RTT") and the cmd/bd/enterprise_connect.go file reference (generalized to
"a `bd connect --ca-file X`-style command").
- ca_permissions_unix.go / ca_permissions_unix_test.go: ~/.config/gascity and
/etc/gascity example paths replaced with ~/.config/bd and /etc/bd.
- encode/skew_test.go: beads.corp replaced with bd.example.invalid.
- encode/ledger_render.go + ledger_render_test.go: the generated-doc preamble
and regenerate-hint strings now name internal/httpclient/encode (this
package) instead of internal/enterprise/httpstore/encode; regenerated
engdocs/design/http-divergence-ledger.md via `go test
./internal/httpclient/encode -run TestDivergenceLedgerDocMatchesLedger
-update-ledger-doc` rather than hand-editing it.
Final grep for enterprise/cherry/gascity/corp/gwauth under internal/httpclient
and engdocs turns up only: provenance headers (kept deliberately), this
session's own "no bd-enterprise source copied" disclaimers, and a handful of
generic "enterprise-tagged"/"enterprise server" references describing a
build-tag or commercial-tier server concept in the abstract -- none name a
private host, path, or credential.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(httpclient): review LOW items -- S3 TODO, env-driven CA test, lockstep doc
Review LOW #4-#6:
- wire/skew_test.go: TODO(S3) on the branch where the cmd/bd AST sweep is
vacuous (no store/dial wiring yet), naming the slice that closes it.
- ca_wrong_ca_test.go: TestTransportForWrongCAViaEnvRefusesTheTLSHandshake,
the BEADS_HTTP_CA_FILE env-driven sibling of the existing direct-CAFile
wrong-CA test -- same live-TLS refusal, resolved through resolveCAFile's
host-scoped env syntax instead of Target.CAFile.
- vocabulary_test.go: expanded the ClientWireRevision/CurrentWireRevision
comment to explain why this repo holds them in strict lockstep (client and
server ship from the same commit) rather than merely <=, distinguishing it
from the real cross-version compatibility ClientMinWireRevision exists for.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient/wire): re-review HIGH-a/b -- cover IssueDetails, stop recursing into metadata
HIGH-a: the legacy-revision set was missing apigen.IssueDetails (GET
/v0/beads/issues/{id}'s body, an alias for types.IssueDetails that a grep for
"type ... struct" never sees). getIssue is a baseline op that can dispatch
with no cached handshake at all, so serverPredatesRevisionStrings now treats
"no snapshot" the same as "WireRevision == 0" instead of only the latter.
revisionBearingResponse's set is now pinned exhaustively against
internal/httpapi/wireshape/testdata/golden.json -- the same committed digest
TestWireShapeDigest guards -- by a new test
(TestRevisionBearingResponseCoversEveryWireShapeSchemaWithARevisionMember), so
a future schema gaining a `revision` member can't silently miss coverage
again. New coverage: both "with" and "without" a prior handshake for getIssue,
and an explicit items[].revision test for ApplyBatchResponse.
HIGH-b: the previous fix recursed into every nested object looking for a
bare-number "revision" key, which reached caller-owned blobs like
CloseIssueResponse.issue.metadata -- real user data shaped like
{"revision":3} came back silently coerced to a string, on every server the
broadened gate above now also covers. tolerateLegacyRevisionNumbers no longer
recurses at all: it rewrites only the body's own top-level "revision", and,
for *apigen.ApplyBatchResponse specifically, each item's top-level
"revision" in the top-level "items" array. New
TestCloseIssueLegacyRewriteNeverTouchesIssueMetadata proves a metadata
document with "revision" keys at three nesting depths round-trips
byte-for-byte unchanged.
Mutation-tested both guards by hand (not committed): dropping the
IssueDetails case turns TestRevisionBearingResponseCoversEveryWireShapeSchemaWithARevisionMember
and both getIssue tests red with the exact missing-coverage/decode-failure
messages; reinstating a fully recursive rewrite turns
TestCloseIssueLegacyRewriteNeverTouchesIssueMetadata red, showing the
metadata's revision keys silently rewritten at all three depths. Both
reverted clean before this commit.
internal/httpapi/wireshape/BUILD.bazel and internal/httpclient/wire/BUILD.bazel
export/declare testdata/golden.json as data for wire_test's new exhaustiveness
test.
Verified: go test ./internal/httpclient/... (ok, one pre-existing unrelated
flake in ca_wrong_ca_test.go confirmed not reproducible across 8 reruns),
golangci-lint run ./internal/httpclient/... (0 issues), make api-check (no
apigen drift), bazel test //internal/httpclient/... //internal/httpapi/wireshape/...
(5/5 PASSED).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): stop the wrong-CA TLS tests racing Happy Eyeballs
Root cause: startServer rewrites its httptest TLS server's URL to the
hostname "localhost" so SNI is actually sent, but the server itself only
binds 127.0.0.1. net/http's default dialer does RFC 6555 Happy Eyeballs
for a hostname with more than one address family, racing a tcp6 dial to
::1:<port> against the real tcp4 dial. On this host, many unrelated
processes (JVM tooling) are bound to high ::1 ports, so the tcp6 race
occasionally "won" against a listener that had nothing to do with the
test, and the client spoke TLS to it instead -- surfacing as "tls: first
record does not look like a TLS handshake" rather than the expected
x509.UnknownAuthorityError. Confirmed via ss -tlnp captured at the moment
of failure (a java process holding the exact port raced) and via an
immediate manual redial to 127.0.0.1 on that port succeeding against the
real, still-live test server.
Fix: forceIPv4Loopback (new shared helper in ca_test.go) rewrites the
returned *http.Transport's DialContext to dial tcp4 only. SNI and the
request Host are unaffected, since crypto/tls and net/http derive both
from the URL, never from which address family carried the bytes. Wired
into every TLS fixture test in the package (ca_wrong_ca_test.go's three
tests, and ca_test.go's rotation test) -- grepped the rest of the repo
for the same "rewrite to localhost for SNI" pattern and found no other
occurrences.
Also fixed a latent bug this surfaced: TestTransportForWrongCAViaEnvRefusesTheTLSHandshake
called TransportFor(Target{}) with a nil BaseURL, so caHostMatches always
returned false and the CAFileEnv path was never actually exercised --
the nil RoundTripper was silently masked by http.Client's fallback to
http.DefaultTransport, which also failed to verify (via system roots)
for an unrelated reason. Now passes Target{BaseURL: u} so the test
exercises the host-scoped env-resolution path it documents.
go test -race -count=50 -run WrongCA: 8/8 clean. Whole package
go test -race -count=20: clean, twice. bazel test, golangci-lint,
make api-check: all green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpclient): repair CI-red tests and apply review fixes (adopt-pr #7210)
Three defects on the contributor head, none of them present on the base:
- test/docsync's TestEngdocsAndRootMarkdownLinks fails: the generated
divergence-ledger doc links http-client-backend.md, an architecture
spec this repository does not carry. Name it in a code span instead,
in ledgerDocPreamble, and regenerate the doc (-update-ledger-doc).
- TestCAFileHygieneRefusesGroupWritableFile fails under umask 022:
os.WriteFile's 0o660 passes through the umask, so the file lands 0640,
is never group-writable, and TransportForFile accepts it. Chmod it
explicitly. Its acceptance twin had the same gap on its file (only the
explicitly chmodded directory reached the user-private-group
exception), so chmod that file too: a mutant that drops the exception
for files alone passed the old test under umask 022 and fails the new
one.
- That acceptance twin calls the unix-only isUserPrivateGroup from
ca_test.go, which carries no build constraint, so the package's tests
do not compile for GOOS=windows. Move it, otherwise verbatim, into
ca_permissions_unix_test.go beside the other isUserPrivateGroup tests.
Review fixes (iteration 1):
- Encode dispatched through nine case arms of op/shape conjunctions
(cyclomatic 24). Switch on an (op, shape) struct key instead, and move
the getIssue and search-bridge arms into encodeGetIssue and
encodeSearch. The arms are disjoint, so dispatch and every error string
are unchanged. Cyclomatic 24 -> 10.
- EventStream.Next kept four accumulators and the per-field switch in
one loop (cognitive 27). Gather the accumulators into sseEvent and
fold each field line, per-event cap included, in applyField. Next
cognitive 27 -> 12; applyField is 11/11.
- The CA hygiene walk joined a relative symlink target onto the textual
containing directory, so with a/link -> ../b/c and b/c/x -> ../y it
resolved a/y where the kernel opens b/y: a valid CA was refused, or a
hygienic file at a/y was checked and read instead. readLinkTarget joins
onto the directory's EvalSymlinks path, taken after that directory's
own ancestors passed the hop-by-hop check. The regression test plants
a decoy at a/y; a lexical-join mutant reads it and fails.
- SaveTarget wrote a relative CAFile that every later LoadTarget
refuses. Both now go through checkCAFileAbsolute, so SaveTarget refuses
first, with LoadTarget's own message, and writes nothing.
- Document the cached transport TransportFor and TransportForFile return
as shared and read-only.
Review fixes (iteration 2):
- The walk still dropped a ".." inside a symlink target textually:
filepath.Join cleans a relative target, and an absolute target's
ancestors come from filepath.Dir, while the kernel takes that ".."
from wherever the component before it really leads. Both reviews
rated the relative leaf as a wrong-file read, and it is one: with
x/d -> ../e/s, x/L -> d/../y read a decoy at x/y where the kernel
opens e/y. The other three shapes are hygiene bypasses: an absolute
leaf target x/d/../y, and an ancestor link to d/../dir or x/d/../dir
with the CA at x/L/y, each read a file in a world-writable e that the
walk never checked. readLinkTarget now refuses a target with a ".."
after any other component, relative or absolute; a leading run of
".." is still taken from the directory's physical path. The test pins
all four shapes behind a control that refuses e/y named directly, and
a table pins hasInteriorDotDot's boundary. Mutants that drop the
refusal, limit it to relative targets, refuse every "..", or count
"." as a component each fail.
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 Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* feat(httpapi): wire-shape signal — wire_revision, floor header, golden digest, param tokens
S0 of the HTTP role-parity program: give a client a single place to learn
whether this build's wire shape has moved under it, and give CI a gate that
catches an undocumented move.
- GET /v0/beads/context reports wire_revision (bumps only on a non-additive
response-shape change) and min_client_wire_revision. An optional
Bd-Wire-Revision request header lets a client declare the revision it was
built for; checkWireRevision refuses a declared revision below the floor
with 400 invalid_argument/reason=wire_revision_unsupported and a
min_wire_revision field, on every route but /healthz (wireRevisionExempt) —
including the identity handshake, where catching the mismatch is cheapest.
Absent header is today's behavior; malformed value is invalid_value, never
wire_revision_unsupported. The floor lives in Server.minClientWireRevision
(defaulting to the MinClientWireRevision constant) so a test can raise it.
- internal/httpapi/wireshape: a golden digest over every response's every
content-type schema (including application/problem+json) across the whole
spec, keyed by schema+member. TestWireShapeDigest fails closed when a
member's JSON name or type changes without wire_revision bumping to match;
regenerate with `go run ./internal/httpapi/wireshape/cmd/gendigest`.
- GET /v0/beads/issues' `sort` parameter now carries the issues.listSort
capability token, the same convention `capabilities` entries use.
TestNewParameterOnExistingOperationHasABehaviorToken requires every new
parameter on an existing operation to carry one, checked against a
write-once grandfather baseline (testdata/pretoken_parameters.json) of
parameters that predate the rule; TestUntokenedParameterRuleFires proves
the checker itself against a synthetic fixture.
- Docs: engdocs/design/bd-serve-v0.md gets a "The wire-shape signal" section;
CHANGELOG.md gets an Added entry.
Live-mutated and reverted three RED demonstrations during development:
retyping api_version in the spec failed TestWireShapeDigest; short-circuiting
checkWireRevision's floor comparison failed
TestWireRevisionBelowFloorRefusesEveryEnforcedRoute; adding an untokened
query parameter to listIssues failed
TestNewParameterOnExistingOperationHasABehaviorToken. All three now pass
against the unmutated tree.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): rename issues.listSort to issues.list.sort, harden token rule
Opus review of 12c5144ca (HIGH-1, MEDIUM-5):
- Rename the capability token issues.listSort -> issues.list.sort to match
bd-enterprise's client (httpstore/wire/handshake.go:121, DESIGN.txt S4e),
and widen capabilityToken to accept an optional third segment.
- untokenedParameters() now requires the extracted token to be one
Capabilities() actually serves, not just backtick-shaped text. This
catches real false positives that existed in the spec already
(workapi.DefaultReadyLimit, status.custom) which only shape-matched the
old regex; they're added to the pretoken baseline as genuinely
pre-existing untokened parameters.
- Extend the rule to request body members (new
testdata/pretoken_request_body_members.json baseline) and exempt
brand-new operations via a frozen testdata/pretoken_operations.json
snapshot.
- Add TestPretokenBaselinesNeverGrow pinning all three baseline sizes so
a future change can't hand-add an exemption instead of a token.
- Update spec prose for the widened rule scope.
go test ./internal/httpapi/... and the reviewer's pmut.py all pass as
expected: plain/bogus modes go RED, reuse (real-but-unrelated token) stays
green, matching the review's literal ask ("a token must be one advertised
by Capabilities()").
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(wireshape): close four digest-coverage gaps, add gendigest write guard
Opus review of 12c5144ca (HIGH-2, MEDIUM-4). The digest only tracked
Type/Format/Enum/Required on direct properties, missing:
- nullable: true (never read at all)
- array item shape (Issue.labels items string->integer was invisible;
only object-shaped items got recursed into)
- additionalProperties value shape (IssueCount.groups)
- request bodies entirely (Compute() only walked responses, so
DeleteIssuesRequest.expected_version string->integer, the other half
of #6053, was invisible)
Also added defensive oneOf flattening alongside the existing allOf merge
(dormant today -- grep confirms this spec uses oneOf nowhere -- but no
longer silently invisible if that changes).
Extracted the golden-vs-computed comparison into wireshape.Compare(),
shared by TestWireShapeDigest and the new wireshape.SafeToWrite(), which
gendigest now calls before writing: it refuses to overwrite golden.json
with changed/removed entries unless the candidate's wire_revision is
strictly greater than the existing golden's. Pure additions always write.
TestSafeToWrite exercises both guard directions.
golden.json is regenerated. This single regen is a one-time exception to
the new guard, done by writing the digest directly rather than through
gendigest: confirmed via a throwaway diff (not checked in) that every one
of the 57 "changed" entries differs only in the NEW fields the wider walk
now populates (ItemType/ItemFormat/Nullable/AdditionalProps*) -- every
pre-existing Type/Format/Required/Enum value is byte-identical. Nothing on
the wire changed; the measurement got more precise. Bumping
CurrentWireRevision for this would have written a false "the protocol
changed here" entry into the revision history table. Going forward, any
REAL change the guard now reports uses the normal bump-then-regenerate
path, same as before.
Verified against the reviewer's mut.py: nested_type, nullable,
nullable_issue, array_items, addlprops, request_body and format all go RED
on TestWireShapeDigest, each reverted after confirming.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): make bd_version wire_revision inference advisory
Opus review of 12c5144ca (HIGH-3). The spec told a client inferring
wire_revision from bd_version to use the release cutoff >= 1.3.0, and said
nothing about what happens when that inference is wrong -- which it
demonstrably is for real builds already in the field:
- main builds up to commit b3ef65c85 report bd_version 1.2.2 (below any
1.3.0 cutoff) while already sending the string-typed revision/
expected_version shape (#6053).
- 1.3.0-rc.N pre-release builds sort BELOW the release cutoff 1.3.0 under
plain string comparison despite already carrying the string shape.
- The bd-enterprise compatibility line at d3ab32773462 reports bd_version
1.1.0 while also sending strings.
Moved the cutoff to >= 1.3.0-rc.1 (compared as semver-with-prerelease,
which at least captures the rc builds), documented both named exceptions
inline, and made the whole inference explicitly ADVISORY: a client must
accept revision/expected_version as either a string or a number whenever
wire_revision is absent (or probe directly) rather than let the inferred
value choose a decoder, and must never refuse solely because the inferred
revision is 0. Mirrored into engdocs/design/bd-serve-v0.md.
This is spec/doc prose only -- there is no server-side inference code to
change, since this server always sends wire_revision directly; the
inference is guidance for clients reading a pre-signal server's response
(this server, past builds, or an unrelated implementation).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): LOW-7/8/9/10 review follow-ups for wire-revision signal
LOW-7: WireRevisionUnsupported now also sets Problem.wire_revision (this
server's CurrentWireRevision) and Problem.bd_version on the
wire_revision_unsupported refusal, alongside the existing
min_wire_revision, so a client logging the refusal has this server's
full self-description without a second /v0/beads/context call.
LOW-8: gazelle + make bazel-sync add the BUILD.bazel entries the prior
commits were missing: wire_revision.go/wire_revision_test.go in
internal/httpapi's srcs, new BUILD.bazel files for wireshape and
wireshape/cmd/gendigest, and a testdata glob on httpapi's go_test so
the pretoken_*.json baselines are visible under `bazel test`. Verified
with `bazel build //internal/httpapi/...` and
`bazel test //internal/httpapi/... --test_env=BEADS_TEST_SKIP=dolt`
(both green) and `python3 tools/bazel/go_srcs.py --check` (clean).
LOW-9: narrowed CHANGELOG.md and engdocs/design/bd-serve-v0.md to
describe the digest's actual final coverage (format/enum/required/
nullable, array items, additionalProperties, request bodies, $ref/
allOf/oneOf recursion, the SafeToWrite revision-bump guard) and the
token rule's actual final shape (three pinned baselines, request-body
members, Capabilities()-membership validation, new-operation
exemption) instead of the original, narrower claims.
LOW-10: Bd-Wire-Revision now parses via a strict decimal-only
parseStrictNonNegativeInt (no leading '+', no leading zero except a
bare "0") instead of strconv.Atoi alone, so two different header
bytes can no longer name the same revision. New malformed-header test
cases: "+1", "01", "007".
Regenerated apigen/types.gen.go (make api-gen) for the new Problem
fields and wireshape/testdata/golden.json (go run
.../wireshape/cmd/gendigest) for the two new additive Problem members;
the latter wrote cleanly through SafeToWrite itself, since both are
pure additions.
go test ./... and bazel test //internal/httpapi/... both green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): re-review LOW follow-ups — retirement test, gendigest -init, docs
1. TestRetiredRevisionsStayBelowTheFloor pins the PRESENCE guarantee the
wire_revision property doc relies on: CurrentWireRevision >= 2 (so 0
and 1 stay permanently retired) and MinClientWireRevision <=
CurrentWireRevision (so this build's own floor never refuses every
request against itself).
2. gendigest now refuses to create a golden.json that does not exist yet
unless run with -init. Previously a missing file (moved testdata,
wrong path, accidental delete) was indistinguishable from a real first
run and silently wrote a fresh golden with no revision history checked
against anything. writeGolden() is extracted out of main() so this is
covered directly: TestWriteGoldenRequiresInitWhenMissing,
TestWriteGoldenInitCreatesWhenMissing,
TestWriteGoldenIgnoresInitWhenGoldenExists (the existing-golden path is
still governed only by SafeToWrite, -init or not).
3. Narrowed the two remaining stale claims that still described the
digest's original, narrower coverage: the wire_revision property's
prose in openapi.v0.yaml (regenerated into apigen/types.gen.go via
make api-gen) and wireshape/doc.go now both list nullable, array item
shape, additionalProperties value shape, request bodies, and
$ref/allOf/oneOf recursion, plus the new -init guard.
go test ./internal/httpapi/... and make api-check both green;
bazel test //internal/httpapi/... (httpapi, wireshape, and the new
gendigest test target) green; python3 tools/bazel/go_srcs.py --check
clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(wireshape): cover operation parameters in the wire-shape digest
The digest previously walked only response and request-body schemas, so a
type, enum, required, or removal change on one of the spec's 138 operation
parameters (123 query, 14 path, 1 header) passed the gate silently — the
open item from PR review on #7182.
Each parameter is now recorded as its own Entry, keyed by
"param:"+operationId / location+":"+name (operation-scoped, not
schema-scoped, since two operations' same-named parameter are independent
wire contracts), capturing type, array item shape, enum, required, style,
explode and default. Adding a parameter stays additive; removing,
retyping, narrowing its enum, or changing required/style/explode/default
now trips SafeToWrite exactly like a response or request-body change.
Verified against the live spec: retyping listIssues' `limit` query
parameter from integer to string now fails TestWireShapeDigest (confirmed
red, then reverted — not part of this commit). golden.json regenerated via
gendigest; the new parameter entries are a pure addition, no wire_revision
bump needed. Added TestParameterMutationsAreCaught (remove/retype/narrow-
enum against real golden entries) and updated wireshape's doc.go, the
`wire_revision` spec prose, and the CHANGELOG to describe the new
coverage.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(wireshape): review fixes — stale-golden and lowered-revision arms, effective param serialization, digest boundary
Maintainer fixup from the adopt-pr review loop (iterations 1 and 2), on
top of e17ba924f.
- goldenDrift (A, I): TestWireShapeDigest's comparison moves into a
goldenDrift helper. An addition alongside a moved wire_revision no
longer passes with a stale golden: it asks for a regenerate, as a
changed or removed entry after a bump already did. Every message now
names response/request-body members AND parameters, and TestGoldenDrift
pins each arm. This takes only the test half of the stranded fixup
(adopt-pr/bd-47kdge/stranded-fixup-528cd6095); its doc half, which says
parameters are outside the digest, is false since e17ba924f and is not
replayed (J).
- Lowered wire_revision (D): a CurrentWireRevision LOWER than the
golden's is a wrong constant, not a stale golden, so goldenDrift says to
restore it instead of regenerating, and SafeToWrite (so gendigest)
refuses any write at a lower revision, whatever the entries.
- Effective style/explode (B): walkParam records style and explode with
OpenAPI 3.0's defaults filled in (form for query/cookie, simple for
path/header; explode defaults to style == form). Adding `explode: false`
to a query array that relied on form's implicit explode is now a
changed entry, while spelling out a default changes nothing.
testdata/golden.json is regenerated with -init: 111 parameter entries
change only in style/explode (96 to form/true, 15 to simple), 828
entries before and after, wire_revision stays 2. The golden is new in
this PR and unreleased, so this needs no bump.
- TestWalkParam (H): a package-internal table test
(wireshape_internal_test.go) pins every field walkParam extracts,
through a computeFrom(document, revision) seam that Compute now wraps:
per-location defaults, $ref'd parameters and items, format, nullable and
default, content parameters, and the nil returns.
TestEffectiveSerializationIsCompared pins B end to end through Compare
and SafeToWrite. BUILD.bazel embeds the library in the go_test, which is
gazelle's own output.
- Required inputs and the digest boundary (C, E, F; docs only): all five
prose surfaces (openapi.v0.yaml's wire_revision description and the
regenerated apigen/types.gen.go, wireshape/doc.go, CHANGELOG.md,
engdocs/design/bd-serve-v0.md) now say that a new REQUIRED request
input is recorded as an ordinary addition and needs its own review,
that value constraints and member-level composition are outside the
digest, and that object and content parameters are recorded only as
their container. bd-serve-v0.md also gains the parameter coverage it
was missing.
- G: a brand-new operation is permanently exempt from the
capability-token rule; its own review decides its capability story.
- Iteration 2 (nit): walkParam's comment now says that the location
default it records as a `content` parameter's style and explode is a
placeholder, since OpenAPI 3.0 applies style and explode only to a
parameter described by `schema`. All 138 operation parameters in the
spec use `schema`, so the golden does not change.
Validated: go test ./internal/httpapi/... (gms_pure_go), make api-check,
go vet for linux/windows/darwin, gofmt, git diff --check, gazelle on the
package (no drift), make bazel-sync-check, and bazel test
//internal/httpapi/wireshape/... in the local processwrapper sandbox
(2 of 2 pass). Overlay mutation probes: dropping the added-after-bump
arm, the lowered-revision arm, SafeToWrite's lowered check, or the
effective-default fill each turns the new tests red.
Iteration 2 changes only that comment; go test
./internal/httpapi/wireshape/... (gms_pure_go), go vet, gofmt and git
diff --check pass again.
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>
* feat(count): add Counter scope fields (S8) — ParentID, NoParent, ExcludeTypes, ExcludeStatus
Extends issueops.CountRequest with ParentID, NoParent, ExcludeTypes and
ExcludeStatus, closing the gap where bd count could not express the
filters bd list already has, forcing downstream consumers like gc to
fall back to listing everything just to get a count.
- issueops.Counter: four new CountRequest fields, documented against the
List equivalents they mirror (ParentID/ExcludeTypes) or newly define
(NoParent, ExcludeStatus has no List counterpart). Status "all" is
pinned as equivalent to unset, matching BuildListFilter's own "all" and
preserving count/list cardinality parity (the role's reason to exist).
- internal/workapi.BuildCountFilter: maps the four fields onto the one
types.IssueFilter builder all three storage legs (dolt, embeddeddolt,
uow) already share via internal/storage/issueops and sqlbuild, so no
per-leg storage code was needed.
- cmd/bd: --parent, --no-parent, --exclude-type, --exclude-status flags.
- HTTP: adds parent/no_parent/exclude_type/exclude_status to GET
/v0/beads/issues:count, behind the new issues.count.scope behavior
token (routes.go), wired in reads.go's countFilters, documented in
openapi.v0.yaml with per-parameter tokens and an extended capabilities
description. gendigest confirms a byte-identical golden.json: query
parameters are outside the wire-shape digest's scope, so this is a
zero-diff, no-revision-bump change as expected.
- backend/conformance: four new Counter contract cases (ParentID scoping,
NoParent's edge-only semantics vs ParentID's edge-or-dotted-id match,
ExcludeTypes composing with include_infra's own exclusions, and
ExcludeStatus), run identically against all three storage legs via a
new CounterFixture.AddDependency hook shared with ReaderFixture.
Verified: go build ./...; go test ./internal/httpapi/... ./internal/workapi/...
./issueops/... and the Counter contract on all three legs (dolt via
testcontainers, embeddeddolt, uow via local dolt binary); make api-gen
(additive-only apigen diff) and make api-check; go vet and golangci-lint
clean; gofmt clean; gazelle diff empty (no new files/imports). Mutation
testing: dropping issues.count.scope from behaviorCapabilities turns
TestCapabilitiesAdvertiseEveryImplementedOperation,
TestSpecCapabilityVocabularyMatchesTheRouteTable and
TestNewParameterOnExistingOperationHasABehaviorToken red; no-op'ing
ExcludeStatus in BuildCountFilter turns
TestBuildCountFilterExcludeStatusTakesNamesAsWritten and the
embeddeddolt ExcludeStatusNarrowsThePredicate conformance case red. Both
reverted and reconfirmed green.
Deviation: DESIGN.txt's literal text would make count --status all an
ErrValidation; shipped behind a test and a doc comment instead, since
"all" already means "every status" on both count and list and rejecting
it would break the count/list parity this role exists to guarantee.
S3/S4 note: no OSS HTTP client exists yet to enforce capability-token
skew. A doc comment on CapIssuesCountScope in routes.go specifies the
required behavior once one lands: check issues.count.scope against the
cached handshake capabilities and refuse locally with a typed
ErrUnsupported{Capability} before sending any of the four new params to
an older server.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(count): S8 review follow-ups — refusal parity, exclude-status validation, doc fixes, parity tests
Addresses the Opus review's six required changes for S8 (bd count scope
fields):
1. BuildCountFilter now refuses ParentID+NoParent together as ErrValidation,
matching bd list's CLI refusal wording; wired through the role, the CLI,
and invalid_argument classification in internal/httpapi/reads.go.
2. Status:"all" is documented in DESIGN.txt as every status, matching List's
no-filter reading (count/list cardinality parity) — a coordinator decision
recorded in beads-design/DESIGN.txt, outside this worktree.
3. ExcludeStatus names are now validated against the workspace vocabulary
(built-in statuses plus workspace-custom ones); an unknown name is
ErrValidation instead of a silent no-op, since a typo here would overcount.
4. Fixed openapi.v0.yaml and issueops/reader.go doc claims about bd list
--parent's default tree-walk vs. the one-level role answer that bd count
--parent agrees with (confirmed by tracing list_show_filter_modes.go); fixed
an Oxford-comma nit in routes.go and the spec.
5. Added storage-level count == len(List) parity tests for ParentID, NoParent
and ExcludeTypes (List has no ExcludeStatus counterpart), plus wisp-child
and closed-child contract cases, across all three backends (dolt,
embeddeddolt, uow). CounterFixture gained a List hook for this.
6. Extended the routes.go skew note: gc's ErrCountUnsupported fallback to List
is now named explicitly, with a note that S3/S4 must add a skew test that
masks the token and asserts the fallback fires.
Also fixed RunCounterExcludeStatusNarrowsThePredicate's now-stale "unrecognized
status excludes nothing" assertion to expect ErrValidation instead.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(count): PR #7199 review follow-ups — exclude-status config load, ParentID doc swap
Addresses bee's REQUEST-CHANGES on gastownhall/beads#7199 (S8):
1. BLOCKER: storecounter.filter and uow.countFilter only loaded the
workspace list config when IncludeInfra was set, so BuildCountFilter's
ExcludeStatus validation refused a workspace's own custom status unless
the caller also passed the unrelated IncludeInfra flag. Both legs now
load the config when IncludeInfra OR len(ExcludeStatus) > 0, with
comments corrected to say so. Added leg-level regression tests (the
conformance fixture cannot drive a workspace-configured custom status)
on embeddeddolt and uow, reproducing the reviewer's CLI repro directly,
plus an HTTP-level probe in cmd/bd's real-Dolt proxied count test.
2. issueops.ReadyRequest.ParentID's comment had been overwritten with the
one-level direct-children wording that belongs to ListRequest.ParentID;
Ready actually walks all descendants via GetDescendantIDsInTx (GH#3396).
Restored the descendants comment on ReadyRequest.ParentID and moved the
one-level explanation to ListRequest.ParentID, which had none.
Verified: make api-check; dolt-server, embeddeddolt and uow Counter
contract legs (BEADS_TEST_DOLT_SERVER=local with a pinned dolt binary for
uow; Docker for the dolt-server leg); the new proxied HTTP exclude_status
probe (BEADS_TEST_PROXIED_SERVER=1).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(wireshape): add the countIssues scope parameters to the wire-shape golden
#7182 now digests operation parameters. The four new issues:count parameters
(parent, no_parent, exclude_type, exclude_status) are additive entries, so no
wire_revision bump is needed; regenerated with gendigest.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(conformance): register the S8 count-scope cases with RunRoleContracts (adopt-pr #7199)
The PR adds nine RunCounter* contract cases to counter_contract.go and wires
them into the three in-tree TestCounterContract legs, but not into the
Counter row of roleContractCases. TestRoleContractCasesCoverEveryContractCase
derives the expected set from source, so it fails on the PR head, and an
external backend running RunRoleContracts would never see the new cases.
Register them in source-declaration order (after
RunCounterAnUnknownStatusMatchesNothing), which the same guard enforces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(count): correct the S8 scope docs the review found wrong (adopt-pr #7199)
Comment and spec-description fixes only; no behavior change. Review-loop
iterations 1 and 2 of the #7199 relaunch.
- ListRequest.ParentID (issueops/reader.go) said "DIRECT children only
... the same one-level clause". The sqlbuild clause has two arms and
neither walks: the parent-child edge arm stops at one level, but the
dotted-prefix arm (`id LIKE CONCAT(?, '.%')` for rows with no
parent-child edge) reaches every edge-less dotted id at any depth, which
RunReaderListParentReachesEveryDescendantAndOnlyItsOwn pins with an
edge-less X.1.1. State both arms, and say the CLI tree view re-runs the
clause against the store once per level (findAllDescendants calls
SearchIssues, not the role). Document ListRequest.NoParent, which had no
doc. The contributor's ReadyRequest.ParentID text is kept; only its
cross-reference to this field changes from "one-level" to "non-walking".
- CountRequest.NoParent (issueops/counter.go) and the count flag comment
(cmd/bd/count.go) said NoParent counts rows with "neither" an edge nor a
dotted prefix. Its SQL checks only the edge table, so an edge-less X.1
is counted by both --parent X and --no-parent, as bd list lists it.
- RunCounterExcludeStatusNarrowsThePredicate's header said an
unrecognized name "excludes nothing rather than failing" while its body
asserts ErrValidation. The header now matches the body.
- The OpCountIssues entry in problem.go's operationCodes said the role has
"exactly one reachable refusal". It has three: an invalid metadata key,
an unrecognized exclude_status name, and parent with no_parent (named
no_parent), all classified by invalidFilterParam. The code set is
unchanged.
- BuildCountFilter's header said cfg is "only read under IncludeInfra".
It is also read to validate ExcludeStatus against the workspace's
custom statuses, which is why both callers load it when ExcludeStatus is
non-empty.
- The countIssues `parent` description in openapi.v0.yaml carried the
same one-level claim as ListRequest.ParentID; it now states both arms.
types.gen.go is regenerated (make api-gen); make api-check passes.
Review fixes (iteration 2), still comment and spec text only:
- The iteration-1 problem.go rewrite called all three count refusals
ErrValidation. Only the exclude_status and parent-with-no_parent
refusals wrap issueops.ErrValidation (internal/workapi/count.go). The
metadata-key refusal is ValidateMetadataFilters' plain fmt.Errorf
chain, so errors.Is(err, ErrValidation) is false for it; it reaches the
wire as a 400 only because invalidFilterParam matches message prefixes.
The comment now says that, so a later move to typed errors cannot trust
it and demote the metadata-key refusal to a 500. The sentinel itself is
not added here: ValidateMetadataFilters is shared with the list and
ready builders.
- invalidFilterParam's comment on the count rows pointed at the
metadata-key rows as "above"; they come after it in the switch.
- The countIssues `parent` description said the CLI tree mode walks
"every edge-linked descendant". findAllDescendants re-runs the full
two-arm predicate per level, so it also descends through edge-less
dotted ids; it now says "every descendant reachable through either
arm". types.gen.go is regenerated; make api-check passes.
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>
* chore(wireshape): re-record the count scope params under the base's param digest (adopt-pr #7199)
The base branch (feat/wire-revision-signal, #7182be1f0bad72) now digests
the effective style/explode of scalar query parameters. This PR's golden
entries for countIssues query:parent and query:no_parent were written by
the old algorithm, so after the base refresh TestWireShapeDigest reported
them as "changed without a wire_revision bump".
No bump is owed: all four count-scope entries (parent, no_parent,
exclude_type, exclude_status) are additions this PR introduces and are
absent from the base golden. golden.json was reset to the base copy and
regenerated with `go run ./internal/httpapi/wireshape/cmd/gendigest`. The
result is four pure additions against the base (+35/-0); parent and
no_parent gain "style": "form" and "explode": true, and wire_revision
stays 2.
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>
* ci: place the PR's new embedded counter test in the shard manifest
TestCounterExcludeStatusAcceptsAWorkspaceCustomStatusWithoutIncludeInfra,
added to internal/storage/embeddeddolt in f23bf5ddbf, is a new top-level
embedded storage test. The 15-shard block of
.github/scripts/embedded-storage-test-shards.txt must list every
discovered test exactly once. Without the entry,
TestStorageEmbeddedShardManifestGeneratorNotStale (scripts/) fails, both
on the reviewed head 89a387de6c and on the merge. CI never ran the check
on this PR: pr.yml runs only for PRs based on main, release/** or
hotfix/**, and this PR was based on feat/wire-revision-signal until the
retarget.
Generated with
`python3 scripts/ci/gen_embedded_storage_shard_manifest.py 15 --weights=duration --write`.
The incremental write adds this one line, in shard 4, and moves no other
test.
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 Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
TestSchemaMigrationDoesNotCommitPreExistingStagedData flaked in the
server-Dolt storage tier (shard 4/16) with:
initSchemaOnDB: schema migration: schema: acquire migration lock:
schema migration lock unavailable: timeout
Every setupTestStore caller shares testSharedDB, and MigrateUpWithLock's
GET_LOCK name is database-scoped, so a test that re-runs schema init
contends with every parallel test's setup-time init for the same lock.
setupTestStore already uses initSchemaOnDBWithRetry for exactly this
reason, but schema_migration_dirty_test.go (4 sites) and
schema_version_test.go (2 sites) called the bare initSchemaOnDB, which
gives up after a single 5s wait. On a loaded runner a neighbour holds the
lock longer than that and the test fails. Production code retries this
case (isRetryableError covers schema.IsMigrationLockError), so this is
test-side only.
Route those calls through a rerunSchemaInitOnTestStore helper that uses
initSchemaOnDBWithRetry. It retries only a contended lock or a transient
connection error, never a migration result, so the asserted outcomes
(including the expected "pre-existing dirty tables changed" error) are
unchanged.
Seen on four unrelated PR branches in three days. Bazel repro (shard-4
test set, server pinned to 6 CPUs, --local_test_jobs=6): before 1/16
runs failed with the CI signature; after 32/32 passed.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cli): close mc-zndi7.76's --if-revision single-winner test gaps
T4.4 exercised the Update guard against the library only; embedded CLI
tests never catch a CLI wiring bypass because bd's local exclusive
flock serializes every mutation regardless of whether --if-revision is
actually threaded through. This closes the remaining mc-zndi7.76 gaps:
- gap 1 (mutant MA): new Lifecycle contract cases
(RunLifecycleUpdateExpectedVersionSingleWinnerWithDisjointColumnsUnderConcurrency,
RunLifecycleCloseExpectedVersionSingleWinnerUnderConcurrency,
RunLifecycleUpdateExpectedVersionSingleWinnerAcrossUpdateAndCloseUnderConcurrency),
wired into all three backends (dolt, embeddeddolt, uow).
- gap 2 (mutant MC): a new dolt-server-tier CLI concurrency test,
TestSharedServerIfRevisionSingleWinner, spawning N real bd
subprocesses that race update/close/assign --if-revision against one
shared, unlocked Dolt server. Delete is deliberately excluded --
its production guard is independently known-broken under real
concurrency and is tracked as its own schema-touching fix,
mc-zndi7.73.
- gap 4 (mutants ML/MO/MD1/MD2): close's --if-revision bypass now has
CLI-level coverage for --continue/--suggest-next/--claim-next
rejection, cascade-delete fencing, and a proxied-route stale-guard
refusal.
TDD: hand-applying mutant MC (dropping update.go's ExpectedVersion
wiring) reproduces the bug report's symptom exactly -- 10/10
concurrent racers exit 0 instead of 1 winner + 9 guard refusals.
Restoring the real code returns to exactly 1 winner, confirmed across
4 repeated real-container runs plus -race.
Gates: gofmt, go vet, go build (both tags), golangci-lint (native,
0 issues), bazel go_srcs.py --check, and targeted go test runs
(embeddeddolt/dolt/uow lifecycle contract suites and the full set of
cmd/bd if-revision tests) all green, with and without -race, against a
real dolthub/dolt-sql-server:2.2.0 container.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): sync cmd/bd BUILD.bazel srcs for the new if-revision test files
make bazel-sync-check only validates the go_srcs.py-managed filegroups,
not gazelle's own go_test srcs list, so the two new test files from the
previous commit were invisible to Bazel. CI's BUILD-sync and go-test
equivalence gates caught it; this is gazelle's own generated diff,
applied via the CI job's uploaded bazel-sync-patch artifact.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Makes the repo's agent and contributor surface describe developing beads, not using bd, and requires every PR to link a documented issue.
- Contributor-only root AGENTS.md with a routing table; cmd/bd/AGENTS.md and engdocs/AGENTS.md seam files; CLAUDE.md symlinks so Claude Code loads nested files.
- Bug and feature issue forms, a PR template that requires Closes #, CONTRIBUTING sections for the triage and pipeline labels, and the opt-in fork-cache during dev setup.
- ROADMAP.md for 1.4: versioned beads (#6132), Graph Preview 2 (#7170), contributor onboarding (#7228).
- docsync guards: root AGENTS.md at or under 20 KB; every AGENTS.md symlinked, routed, and with resolving links, paths, and guard-test names.
Agent-Signature: claude-code-claude-opus-5-5-high on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bazel-integration (--config=integration) and bazel-cmd-dolt
(--config=doltserver-cmd, //cmd/bd:bd_dolt_server_test) both run the
integration-build cmd/bd bd_test; the second without BEADS_TEST_SKIP=dolt,
so it is a superset. Once pr.yml requires bazel-cmd-dolt, the integration
lane's bd_test run is a duplicate.
bazel.yml gains a boolean workflow_call input, cmd-dolt-required (default
false). When true, bazel-integration tests //... -//cmd/bd:bd_test. pr.yml
passes it, and a policy test pins it to pr.yml's BAZEL_CMD_DOLT_REQUIRED
(a `with:` cannot read env), so the drop only happens where ci-gate
requires BAZEL_CMD_DOLT. bazel-farm.yml, nightly.yml, push and dispatch
leave it unset and keep bd_test. While the flag is "false" (current main)
nothing changes; with #7226's flip the input flips with it.
Coverage: both lanes share the same `if:` (modes remote, fork-ro, fork-rw,
cache; Dependabot included) and bazel-gate.sh accepts their skips in the
same modes (skip, local). TestBazelIntegrationExcludesBdTestOnlyWhereCmdDoltCovers
pins that, the exact exclusion, the flag/input equality, the gate's
conditional requirement, and that no other caller passes the input.
Rollback: commit BAZEL_CMD_DOLT_REQUIRED "false" and cmd-dolt-required:
false together in pr.yml.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Advisory since #7185. On the farm it passed on every PR run based on
current main; its only failures (3) were branches predating #7219 and
reproduced a real test bug that #7219 fixed. Flip the committed flag so
CI Gate / Required enforces BAZEL_CMD_DOLT. Rollback: set it back to
"false".
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
pr-preflight-platforms' "Exercise native init gateway credential shell"
step had no GOCACHE env, so it fell back to the runner's empty default
cache and cold-compiled all of ./cmd/bd's test binary on every PR, right
after the hook-timeout step had compiled the identical binary (same tags,
same platform-default CGO) into the restored non-race cache. Job logs:
213s of a ~350s macos-latest leg, ~117s on Windows; on Linux the rerun
with a shared cache is a relink only (~8s).
- pr.yml: point that step, and the three Windows-only Go steps, at the
restored non-race GOCACHE.
- main.yml: the macOS test leg (the only macOS non-race seeder) now runs
warm-non-race-cache.sh, so the PR macOS legs restore the test packages
and test-only deps they compile, not just the non-test ./cmd/bd graph.
- Policy tests: every run step in pr-preflight-platforms and
check-doc-freshness-platforms must use the restored GOCACHE, and the
macOS seeder must warm before it saves.
No test selection, matrix, or gate wiring changes.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(gate): ordinary commands wait out maintenance, with writer fairness
Ordinary bd commands take the workspace (and physical-root) gate SHARED and
never waited for it, so while another process held it EXCLUSIVELY — bd init
(~8s), backup restore, migrate, bootstrap — they failed at once with "a
maintenance operation is running". In shared-server mode every project
shares one physical-root gate, so another project's bd init broke every bd
command on the machine for its duration.
Ordinary commands now wait:
- up to 15s by default; BEADS_GATE_WAIT_TIMEOUT (Go duration or bare
seconds, same convention as BEADS_INIT_GATE_TIMEOUT) overrides it, and 0
restores fail-fast;
- one "waiting for another bd process ..." notice after 2s (shared with bd
init's notice);
- Ctrl-C aborts the wait. A canceled wait used to fall through to the
shared fail-open path ("continuing ungated"); it is now a hard error;
- past the bound, the same error naming the holder, the wait, and the knob.
Git hooks stay fail-fast: `bd hooks run` and the bd export/import children
the hooks spawn run with BD_GIT_HOOK=1, treat failure as a warning, and must
not stall a commit or checkout for 15s.
Writer fairness (internal/workspacegate). flock/LockFileEx give no queueing,
and acquisition is non-blocking polling, so a steady stream of overlapping
shared holders could keep a waiting exclusive acquirer (bd init) out past
its bound. A per-gate intent lock (<gate>.intent) fixes that: a waiting
exclusive acquirer whose first try is busy takes the intent lock
exclusively while it polls, and waiting shared acquirers probe it before
every attempt and wait while it is held. The exclusive waiter then waits
only for in-flight holders to drain. The intent is an OS lock, so a crashed
waiter's intent dies with it; its advisory sidecar is ignored when the lock
is free, and intent-lock errors other than "busy" degrade to the old
behavior. Fail-fast acquisitions (Wait <= 0) ignore the queue entirely, so
hooks and BEADS_GATE_WAIT_TIMEOUT=0 behave exactly as before. The intent
lock is taken only while acquiring its gate, directly before it in
AcquireAll's sorted order, so it adds no lock-order cycles.
Nested bd (bd orphans running bd close, hooks fired by git that bd runs)
would deadlock against the queue: the child queues behind an exclusive
waiter that is waiting for the child's parent. A bd process holding its
gates shared exports BEADS_GATE_SHARED_HOLDER_PID; a child whose recorded
ancestor is alive skips the queue (it cannot help the waiter anyway).
Tests: workspacegate fairness (a continuous shared stream no longer starves
an exclusive waiter; verified to fail without the queue), intent lifecycle,
stale intent from a SIGKILLed process, cancellation while queued,
InheritedSharedHold. cmd/bd: holder released after ~3s lets a command
through with one notice; past-bound error text; fail-fast modes (0, hooks);
Ctrl-C is not fail-open; a new command queues behind a waiting bd init
while a child of a shared holder does not; env parsing.
TestSharedServerConcurrent runs a late bd init of a new project during the
client workloads, so both directions are exercised against a real server.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(gate): a queued exclusive waiter may delay shared commands, never fail them
Review follow-up (B1). A doomed exclusive waiter — bd init or restore
blocked behind a long-lived shared holder such as `bd list --watch`,
`bd events tail --follow`, an open `bd edit` editor, or a beads.OpenGated
embedder — held the writer-fairness intent lock for its whole budget, so
every NEW ordinary command deferred to it and failed with "queued for
exclusive access" even though nothing held the gate exclusively. Before
the fairness change those commands ran normally.
Two bounds fix it while keeping the fairness win:
- An exclusive waiter drops the intent lock after maxIntentHold (10s)
without getting the gate and keeps polling unqueued. In-flight ordinary
commands drain far faster than that.
- The final attempt of a waiting shared acquisition tries the gate even
while intent is held, so a shared acquisition fails only when the gate
itself is held exclusively.
With the final attempt ignoring intent, AcquireAll's 1ns floor for an
exhausted budget is dead code (a Wait-0 attempt behaves the same), so it is
back to 0. queuedDetail drops an intent sidecar left by a dead process (on
Windows its removal can fail while another process is reading it).
Tests: the doomed-waiter scenario (both bounds; each fails with its bound
removed), intent lock order across a two-gate set in both directions, an
exhausted AcquireAll budget, two exclusive waiters handing off the intent,
and BEADS_GATE_SHARED_HOLDER_PID inherited through a real subprocess.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(gate): 30s shared wait, 60s init wait, accurate errors, hook pinning
Review follow-ups for the shared gate wait (S1-S5 and nits), on top of the
workspacegate fix that keeps a queued exclusive waiter from failing
ordinary commands.
- Ordinary commands wait up to 30s by default (was 15s). Queued
maintenance operations run one after another (two inits fanned out
across shared-server projects hold the gate back to back, 10-15s each
under load) and a waiting command waits for all of them. Documented in
configuration.md and CHANGELOG, including BEADS_GATE_WAIT_TIMEOUT=0 for
scripts that relied on fail-fast.
- bd init waits up to 60s by default (was 30s). Safe only now that a
waiting init stops queueing others after 10s.
- Error text: a shared acquisition now fails only when the gate is held
exclusively, so "running" is accurate; in shared-server mode it says
"the shared server (possibly from another project)", and the detail
still names the holder when known.
- hooks.go: the hookSubprocessEnv / bd import comments listed BD_GIT_HOOK's
consumers without the gate wait, which now reads it to stay fail-fast.
TestHookSubprocessEnvKeepsGateFailFast pins that hook subprocesses carry
it and therefore never wait on the gate.
- bd edit's $EDITOR (which can outlive bd by hours) no longer inherits
BEADS_GATE_SHARED_HOLDER_PID.
- Test hygiene: the cmd/bd test binary never advertises the marker
(in-process command tests run beside tests that spawn bd) and clears any
inherited one in TestMain; the notice-delay test runs in 1s, not 3s.
- TestSharedServerConcurrent's late init keeps a 30s bound so the 60s
default cannot mask a fairness regression.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(issueops): index each step of the per-edge cycle and hierarchy walks
The single-edge cycle and hierarchy probes (AddDependencyInTx, i.e. bd dep
add and apply-batch dep_add items, the domain stack's HasCycle /
ValidateBlockingHierarchy, and apply-batch's end-gate hierarchy check) joined
the recursive frontier against a UNION of dependencies and wisp_dependencies.
Dolt cannot index that derived table, so every recursion step rescanned every
matching edge: on a 50k-issue / 100k-edge database one dep add took minutes
(an apply-batch of 1 create + 2 dep adds ~10 min).
Give each dependency table its own recursive member joined directly on
d.issue_id, so each step is an index lookup, and pin the lookup plan with
JOIN_ORDER/LOOKUP_JOIN hints: without them the Dolt sql-server planner picks
a type-index scan join while table statistics are not yet available (right
after a commit), back to minutes. Same reachable set (UNION distinct merges
the members per step), same edge types, same error paths, and still one
statement per probe.
Adds a "depadd" createbatchequiv scenario with a golden digest recorded from
the pre-change code: every cycle/hierarchy probe over 17 nodes x 3 table
sets (mixed tables, every target column, external and missing ids), then 20
AddDependencyInTx calls covering cycles through both tables, hierarchy
conflicts in both directions, self, missing endpoints, type conflict,
external and non-scheduling edges.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(issueops): pin lookup joins in the batched blocked-state recompute
The batched mark/unmark UPDATEs decide membership through the scoped
should-be-blocked union. On the Dolt sql-server its planner intermittently
(depending on when the background statistics refresh lands) turned the
union's issues legs around: it drove them from an index scan of every open
issue through (is_blocked, status) and probed dependencies per row. Over an
import's few thousand uncommitted issues that is ~3 s per leg and 6-10 s per
mark/unmark statement for each 200-id chunk, where the lookup plan takes
~0.1 s; an import of 5000 issues with edges took ~28 min and came close to
the 10 s read timeout. EXPLAIN on the server engine showed the two plans;
two of three identical 2000-issue imports hit the slow one (4-5 min vs 14 s).
Pin each joined leg of the scoped union to drive from the batch's own
dependency rows and look the target/parent up by primary key
(JOIN_ORDER/LOOKUP_JOIN hints, ignored by MySQL). The SQL is otherwise
unchanged, so results are identical (createbatchequiv golden digests,
including is_blocked, pass on both engines) and the statement count is the
same. The unscoped union used by full repair and the doctor count walks
whole tables and keeps the planner's choice.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): pin the hinted graph-walk and blocked-state plans with EXPLAIN
The JOIN_ORDER/LOOKUP_JOIN hints on the per-edge reachability walks and the
batched blocked-state recompute were only pinned textually: the suite passed
with them deleted or naming a wrong alias. TestGraphWalkPlansHonorJoinHints
(embedded) records the statements the production entry points send
(WouldCreateSchedulingCycleInTx, CheckBlockingHierarchyInTx,
RecomputeIsBlockedInTx) through a DBTX wrapper, EXPLAINs exactly those, and
asserts each recursive member is a lookup join keyed by the frontier node and
each joined union leg a primary-key lookup, never an is_blocked/status scan.
Deleting a hint or misspelling its alias fails it.
The test found a remaining planner trap in the ancestor walk: with
"d.type = 'parent-child'" in the join condition, the embedded planner
satisfied the wisp_dependencies member through the type index keyed by the
constant, a lookup returning every parent-child row of the table per
frontier node. The type filter now sits in each member's projection (a row
of another type yields a NULL node, which joins nothing and never equals the
goal), so issue_id is the join's only predicate. The depadd golden, recorded
from the pre-change code, still matches.
Also corrects the hint comments: MySQL honors JOIN_ORDER (the order it forces
is the wanted one) and ignores the unknown LOOKUP_JOIN with a warning.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(createbatchequiv): check run scenarios against the golden only; probe a stored parent cycle
A run scenario (depadd) drives code the create fast paths do not gate, so
its fast-vs-per-row comparison compared a body with itself. Apply it once,
check it against its golden digest (the pre-change code's answers), and fail
if the run recorded nothing.
depadd now plants a parent-child 2-cycle straight into dependencies, as
legacy or merged data can hold even though every write path refuses it, and
probes across it plus three adds touching it, so termination of the walks on
stored cycles is covered. Golden re-recorded from a93498c81 (pre-change
walks); the current code matches it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(issueops): index the waits-for gate's child lookups; waits-for bench fixture
The large-graph benchmark gains a formula-shaped fan-out
(batchfixtures.WaitsForInserts: one spawner, 1000 parent-child children,
20 waiters over every waits-for gate shape) and two shapes over it:
create+waits-for and closing a spawner child (which recomputes every waiter
through the waits-for gate).
It was not a statistics-dependent plan flip but a consistently bad plan:
each "spawner has an open/closed child" EXISTS matched both spawner columns
with one OR, which no index serves, so every correlated evaluation scanned
the edge table. On 50k issues / 100k edges, closing one child took ~39 s
per close on embedded, and on the server create+waits-for hit the 30-minute
read timeout. The gate now splits each EXISTS per spawner column (one per
dependency table and column, each served by its target-column index) and
pins the child lookup by primary key (JOIN_ORDER/LOOKUP_JOIN).
EXISTS(a OR b) is EXISTS(a) OR EXISTS(b), so the result is unchanged. The
template is shared with the unscoped full repair, where a per-row correlated
lookup is the right plan too.
Close spawner child per close: emb 39.5 s -> 3.3 s; create+waits-for emb
2.1 s -> 0.46 s, srv >30 min (read timeout) -> 0.29 s; srv close spawner
child 3.2 s (not reached before).
Adds a "waitsfor" createbatchequiv scenario, golden recorded from
a93498c81 (pre-change gate): issue and wisp spawners with issue and wisp
children, waiters in all five gate shapes, then closes, reopens, a scoped
recompute and the full repair, snapshotting every is_blocked. A mutation
dropping the wisp-spawner legs fails it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(createbatchequiv): compare dependency metadata canonicalized across engines
The embedded engine and the Dolt sql-server serialize a JSON metadata value
differently (key order, spacing), so the waitsfor golden recorded on embedded
failed on the server for its gate metadata alone. Re-serialize each
dependency row's metadata through encoding/json before comparing. Rows with
'{}' metadata are unchanged, so the other goldens keep their digests;
waitsfor is re-recorded from a93498c81 and now passes on both engines.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37272437653
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* fix(cli): guarded close replays molecule auto-close and open-children warning
mc-zndi7.75: runCloseDirectIfRevision/runCloseProxiedIfRevision bypass bd
close's batch architecture entirely (BatchCloseItem carries no per-item
ExpectedVersion), so they also bypassed two state-derived post-close
contracts that the batch route performs for every close:
1. Molecule auto-close (autoCloseCompletedMolecule / its proxied twin
autoCloseProxiedCompletedMolecule). Without replaying it here, a guarded
close of a molecule's last step left the molecule root stranded open
forever.
2. The "warning: closing X with N open child issue(s) still active" line
printed when --force waives the engine's open-children refusal.
Both routes now replay this work after a successful guarded close, exactly
as close.go's batch path and closeProxiedRunPostClose do, on both a real
close and an idempotent re-close (the proxied post-close work runs in its
own unit of work, mirroring autoCloseProxiedCompletedMolecule's existing
batch-route contract).
The third item in mc-zndi7.75 — gating on_close hook firing on Changed — is
deliberately NOT implemented here: hookIssueOperations.Close (embedded) and
recordingIssueUC.CloseIssueChecked (proxied) both fire on_close
unconditionally on success, including an idempotent re-close, by explicit,
independently pinned design in internal/storage/hook_issue_operations_test.go
("close no-op still fires close" — "Do not 'unify' this either") and
internal/storage/uow/notifying_test.go ("a re-close still reports the close"
— "THE BATCH COMPOSITIONS DISAGREE WITH THIS ONE, deliberately"). Only the
batch closers gate on Changed, to stop a replayed teardown batch from
re-running on_close once per item on every pass (ga-2yaqp.1) — a hazard this
single-id guarded close doesn't share. Reusing that gating here would
contradict both pinned invariants rather than fix a bug, so it's documented
in place and left for human review instead of changed unilaterally.
Adds CLI integration tests for both routes: guarded re-close healing a
stranded-open molecule root, and guarded --force close warning on open
children.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): sync cmd/bd BUILD.bazel for the new --if-revision close tests
make bazel-sync (bazel run //:gazelle) after adding
close_if_revision_embedded_test.go and close_if_revision_proxied_test.go.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* feat(httpapi): wire-shape signal — wire_revision, floor header, golden digest, param tokens
S0 of the HTTP role-parity program: give a client a single place to learn
whether this build's wire shape has moved under it, and give CI a gate that
catches an undocumented move.
- GET /v0/beads/context reports wire_revision (bumps only on a non-additive
response-shape change) and min_client_wire_revision. An optional
Bd-Wire-Revision request header lets a client declare the revision it was
built for; checkWireRevision refuses a declared revision below the floor
with 400 invalid_argument/reason=wire_revision_unsupported and a
min_wire_revision field, on every route but /healthz (wireRevisionExempt) —
including the identity handshake, where catching the mismatch is cheapest.
Absent header is today's behavior; malformed value is invalid_value, never
wire_revision_unsupported. The floor lives in Server.minClientWireRevision
(defaulting to the MinClientWireRevision constant) so a test can raise it.
- internal/httpapi/wireshape: a golden digest over every response's every
content-type schema (including application/problem+json) across the whole
spec, keyed by schema+member. TestWireShapeDigest fails closed when a
member's JSON name or type changes without wire_revision bumping to match;
regenerate with `go run ./internal/httpapi/wireshape/cmd/gendigest`.
- GET /v0/beads/issues' `sort` parameter now carries the issues.listSort
capability token, the same convention `capabilities` entries use.
TestNewParameterOnExistingOperationHasABehaviorToken requires every new
parameter on an existing operation to carry one, checked against a
write-once grandfather baseline (testdata/pretoken_parameters.json) of
parameters that predate the rule; TestUntokenedParameterRuleFires proves
the checker itself against a synthetic fixture.
- Docs: engdocs/design/bd-serve-v0.md gets a "The wire-shape signal" section;
CHANGELOG.md gets an Added entry.
Live-mutated and reverted three RED demonstrations during development:
retyping api_version in the spec failed TestWireShapeDigest; short-circuiting
checkWireRevision's floor comparison failed
TestWireRevisionBelowFloorRefusesEveryEnforcedRoute; adding an untokened
query parameter to listIssues failed
TestNewParameterOnExistingOperationHasABehaviorToken. All three now pass
against the unmutated tree.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): rename issues.listSort to issues.list.sort, harden token rule
Opus review of 12c5144ca (HIGH-1, MEDIUM-5):
- Rename the capability token issues.listSort -> issues.list.sort to match
bd-enterprise's client (httpstore/wire/handshake.go:121, DESIGN.txt S4e),
and widen capabilityToken to accept an optional third segment.
- untokenedParameters() now requires the extracted token to be one
Capabilities() actually serves, not just backtick-shaped text. This
catches real false positives that existed in the spec already
(workapi.DefaultReadyLimit, status.custom) which only shape-matched the
old regex; they're added to the pretoken baseline as genuinely
pre-existing untokened parameters.
- Extend the rule to request body members (new
testdata/pretoken_request_body_members.json baseline) and exempt
brand-new operations via a frozen testdata/pretoken_operations.json
snapshot.
- Add TestPretokenBaselinesNeverGrow pinning all three baseline sizes so
a future change can't hand-add an exemption instead of a token.
- Update spec prose for the widened rule scope.
go test ./internal/httpapi/... and the reviewer's pmut.py all pass as
expected: plain/bogus modes go RED, reuse (real-but-unrelated token) stays
green, matching the review's literal ask ("a token must be one advertised
by Capabilities()").
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(wireshape): close four digest-coverage gaps, add gendigest write guard
Opus review of 12c5144ca (HIGH-2, MEDIUM-4). The digest only tracked
Type/Format/Enum/Required on direct properties, missing:
- nullable: true (never read at all)
- array item shape (Issue.labels items string->integer was invisible;
only object-shaped items got recursed into)
- additionalProperties value shape (IssueCount.groups)
- request bodies entirely (Compute() only walked responses, so
DeleteIssuesRequest.expected_version string->integer, the other half
of #6053, was invisible)
Also added defensive oneOf flattening alongside the existing allOf merge
(dormant today -- grep confirms this spec uses oneOf nowhere -- but no
longer silently invisible if that changes).
Extracted the golden-vs-computed comparison into wireshape.Compare(),
shared by TestWireShapeDigest and the new wireshape.SafeToWrite(), which
gendigest now calls before writing: it refuses to overwrite golden.json
with changed/removed entries unless the candidate's wire_revision is
strictly greater than the existing golden's. Pure additions always write.
TestSafeToWrite exercises both guard directions.
golden.json is regenerated. This single regen is a one-time exception to
the new guard, done by writing the digest directly rather than through
gendigest: confirmed via a throwaway diff (not checked in) that every one
of the 57 "changed" entries differs only in the NEW fields the wider walk
now populates (ItemType/ItemFormat/Nullable/AdditionalProps*) -- every
pre-existing Type/Format/Required/Enum value is byte-identical. Nothing on
the wire changed; the measurement got more precise. Bumping
CurrentWireRevision for this would have written a false "the protocol
changed here" entry into the revision history table. Going forward, any
REAL change the guard now reports uses the normal bump-then-regenerate
path, same as before.
Verified against the reviewer's mut.py: nested_type, nullable,
nullable_issue, array_items, addlprops, request_body and format all go RED
on TestWireShapeDigest, each reverted after confirming.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): make bd_version wire_revision inference advisory
Opus review of 12c5144ca (HIGH-3). The spec told a client inferring
wire_revision from bd_version to use the release cutoff >= 1.3.0, and said
nothing about what happens when that inference is wrong -- which it
demonstrably is for real builds already in the field:
- main builds up to commit b3ef65c85 report bd_version 1.2.2 (below any
1.3.0 cutoff) while already sending the string-typed revision/
expected_version shape (#6053).
- 1.3.0-rc.N pre-release builds sort BELOW the release cutoff 1.3.0 under
plain string comparison despite already carrying the string shape.
- The bd-enterprise compatibility line at d3ab32773462 reports bd_version
1.1.0 while also sending strings.
Moved the cutoff to >= 1.3.0-rc.1 (compared as semver-with-prerelease,
which at least captures the rc builds), documented both named exceptions
inline, and made the whole inference explicitly ADVISORY: a client must
accept revision/expected_version as either a string or a number whenever
wire_revision is absent (or probe directly) rather than let the inferred
value choose a decoder, and must never refuse solely because the inferred
revision is 0. Mirrored into engdocs/design/bd-serve-v0.md.
This is spec/doc prose only -- there is no server-side inference code to
change, since this server always sends wire_revision directly; the
inference is guidance for clients reading a pre-signal server's response
(this server, past builds, or an unrelated implementation).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): LOW-7/8/9/10 review follow-ups for wire-revision signal
LOW-7: WireRevisionUnsupported now also sets Problem.wire_revision (this
server's CurrentWireRevision) and Problem.bd_version on the
wire_revision_unsupported refusal, alongside the existing
min_wire_revision, so a client logging the refusal has this server's
full self-description without a second /v0/beads/context call.
LOW-8: gazelle + make bazel-sync add the BUILD.bazel entries the prior
commits were missing: wire_revision.go/wire_revision_test.go in
internal/httpapi's srcs, new BUILD.bazel files for wireshape and
wireshape/cmd/gendigest, and a testdata glob on httpapi's go_test so
the pretoken_*.json baselines are visible under `bazel test`. Verified
with `bazel build //internal/httpapi/...` and
`bazel test //internal/httpapi/... --test_env=BEADS_TEST_SKIP=dolt`
(both green) and `python3 tools/bazel/go_srcs.py --check` (clean).
LOW-9: narrowed CHANGELOG.md and engdocs/design/bd-serve-v0.md to
describe the digest's actual final coverage (format/enum/required/
nullable, array items, additionalProperties, request bodies, $ref/
allOf/oneOf recursion, the SafeToWrite revision-bump guard) and the
token rule's actual final shape (three pinned baselines, request-body
members, Capabilities()-membership validation, new-operation
exemption) instead of the original, narrower claims.
LOW-10: Bd-Wire-Revision now parses via a strict decimal-only
parseStrictNonNegativeInt (no leading '+', no leading zero except a
bare "0") instead of strconv.Atoi alone, so two different header
bytes can no longer name the same revision. New malformed-header test
cases: "+1", "01", "007".
Regenerated apigen/types.gen.go (make api-gen) for the new Problem
fields and wireshape/testdata/golden.json (go run
.../wireshape/cmd/gendigest) for the two new additive Problem members;
the latter wrote cleanly through SafeToWrite itself, since both are
pure additions.
go test ./... and bazel test //internal/httpapi/... both green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi): re-review LOW follow-ups — retirement test, gendigest -init, docs
1. TestRetiredRevisionsStayBelowTheFloor pins the PRESENCE guarantee the
wire_revision property doc relies on: CurrentWireRevision >= 2 (so 0
and 1 stay permanently retired) and MinClientWireRevision <=
CurrentWireRevision (so this build's own floor never refuses every
request against itself).
2. gendigest now refuses to create a golden.json that does not exist yet
unless run with -init. Previously a missing file (moved testdata,
wrong path, accidental delete) was indistinguishable from a real first
run and silently wrote a fresh golden with no revision history checked
against anything. writeGolden() is extracted out of main() so this is
covered directly: TestWriteGoldenRequiresInitWhenMissing,
TestWriteGoldenInitCreatesWhenMissing,
TestWriteGoldenIgnoresInitWhenGoldenExists (the existing-golden path is
still governed only by SafeToWrite, -init or not).
3. Narrowed the two remaining stale claims that still described the
digest's original, narrower coverage: the wire_revision property's
prose in openapi.v0.yaml (regenerated into apigen/types.gen.go via
make api-gen) and wireshape/doc.go now both list nullable, array item
shape, additionalProperties value shape, request bodies, and
$ref/allOf/oneOf recursion, plus the new -init guard.
go test ./internal/httpapi/... and make api-check both green;
bazel test //internal/httpapi/... (httpapi, wireshape, and the new
gendigest test target) green; python3 tools/bazel/go_srcs.py --check
clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(wireshape): cover operation parameters in the wire-shape digest
The digest previously walked only response and request-body schemas, so a
type, enum, required, or removal change on one of the spec's 138 operation
parameters (123 query, 14 path, 1 header) passed the gate silently — the
open item from PR review on #7182.
Each parameter is now recorded as its own Entry, keyed by
"param:"+operationId / location+":"+name (operation-scoped, not
schema-scoped, since two operations' same-named parameter are independent
wire contracts), capturing type, array item shape, enum, required, style,
explode and default. Adding a parameter stays additive; removing,
retyping, narrowing its enum, or changing required/style/explode/default
now trips SafeToWrite exactly like a response or request-body change.
Verified against the live spec: retyping listIssues' `limit` query
parameter from integer to string now fails TestWireShapeDigest (confirmed
red, then reverted — not part of this commit). golden.json regenerated via
gendigest; the new parameter entries are a pure addition, no wire_revision
bump needed. Added TestParameterMutationsAreCaught (remove/retype/narrow-
enum against real golden entries) and updated wireshape's doc.go, the
`wire_revision` spec prose, and the CHANGELOG to describe the new
coverage.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(wireshape): review fixes — stale-golden and lowered-revision arms, effective param serialization, digest boundary
Maintainer fixup from the adopt-pr review loop (iterations 1 and 2), on
top of e17ba924f.
- goldenDrift (A, I): TestWireShapeDigest's comparison moves into a
goldenDrift helper. An addition alongside a moved wire_revision no
longer passes with a stale golden: it asks for a regenerate, as a
changed or removed entry after a bump already did. Every message now
names response/request-body members AND parameters, and TestGoldenDrift
pins each arm. This takes only the test half of the stranded fixup
(adopt-pr/bd-47kdge/stranded-fixup-528cd6095); its doc half, which says
parameters are outside the digest, is false since e17ba924f and is not
replayed (J).
- Lowered wire_revision (D): a CurrentWireRevision LOWER than the
golden's is a wrong constant, not a stale golden, so goldenDrift says to
restore it instead of regenerating, and SafeToWrite (so gendigest)
refuses any write at a lower revision, whatever the entries.
- Effective style/explode (B): walkParam records style and explode with
OpenAPI 3.0's defaults filled in (form for query/cookie, simple for
path/header; explode defaults to style == form). Adding `explode: false`
to a query array that relied on form's implicit explode is now a
changed entry, while spelling out a default changes nothing.
testdata/golden.json is regenerated with -init: 111 parameter entries
change only in style/explode (96 to form/true, 15 to simple), 828
entries before and after, wire_revision stays 2. The golden is new in
this PR and unreleased, so this needs no bump.
- TestWalkParam (H): a package-internal table test
(wireshape_internal_test.go) pins every field walkParam extracts,
through a computeFrom(document, revision) seam that Compute now wraps:
per-location defaults, $ref'd parameters and items, format, nullable and
default, content parameters, and the nil returns.
TestEffectiveSerializationIsCompared pins B end to end through Compare
and SafeToWrite. BUILD.bazel embeds the library in the go_test, which is
gazelle's own output.
- Required inputs and the digest boundary (C, E, F; docs only): all five
prose surfaces (openapi.v0.yaml's wire_revision description and the
regenerated apigen/types.gen.go, wireshape/doc.go, CHANGELOG.md,
engdocs/design/bd-serve-v0.md) now say that a new REQUIRED request
input is recorded as an ordinary addition and needs its own review,
that value constraints and member-level composition are outside the
digest, and that object and content parameters are recorded only as
their container. bd-serve-v0.md also gains the parameter coverage it
was missing.
- G: a brand-new operation is permanently exempt from the
capability-token rule; its own review decides its capability story.
- Iteration 2 (nit): walkParam's comment now says that the location
default it records as a `content` parameter's style and explode is a
placeholder, since OpenAPI 3.0 applies style and explode only to a
parameter described by `schema`. All 138 operation parameters in the
spec use `schema`, so the golden does not change.
Validated: go test ./internal/httpapi/... (gms_pure_go), make api-check,
go vet for linux/windows/darwin, gofmt, git diff --check, gazelle on the
package (no drift), make bazel-sync-check, and bazel test
//internal/httpapi/wireshape/... in the local processwrapper sandbox
(2 of 2 pass). Overlay mutation probes: dropping the added-after-bump
arm, the lowered-revision arm, SafeToWrite's lowered check, or the
effective-default fill each turns the new tests red.
Iteration 2 changes only that comment; go test
./internal/httpapi/wireshape/... (gms_pure_go), go vet, gofmt and git
diff --check pass again.
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 Sonnet 5 <noreply@anthropic.com>
* ci(autofix): push bot fixes with a scoped GitHub App token
github-actions[bot] pushes left PR checks action_required instead of
retriggering, and the DOCS_AUTOFIX_TOKEN fallback secret was never
configured. bazel-autofix.yml and docs-autofix.yml now mint a short-lived,
repo-scoped (contents:write) installation token for the gastownhall-autofix
App via the `autofix` environment on same-repo PRs, falling back to the
default workflow token (and its manual re-run note) when the App token
isn't available; fork PRs are unaffected and still only get the apply-recipe
comment.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ci): job environment parses as a name or a mapping; gofmt
ciWorkflowJob.Environment was a string, so every test that loads all
workflows failed on deploy-pages-redirect.yml's mapping form
(environment: {name, url}).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cli): --if-revision outranks the reassign fence; recognize bare ErrVersionMismatch
Fixes two post-merge review findings on #7203 (max review 37acca96db):
mc-zndi7.74: a lost --if-revision race on an assignee edit reported the
bd-98s5c live-claim reassign fence's policy refusal (exit 1, no machine
code) instead of precondition_failed (exit 13), because update.go,
update_proxied_server.go, assign.go and mutate_proxied_server.go each ran
an advisory pre-read fence check against their own earlier issue snapshot
before the properly-ordered guarded write underneath (which already checks
ExpectedVersion before the fence) got a chance to run. Added
ifRevisionAlreadyStale to skip the advisory check when the caller's own
pre-read is already stale against --if-revision, letting the guarded write
report the correct outcome.
mc-zndi7.78: classifyIfRevisionFailure recognized a revision mismatch only
via the typed *issueops.VersionMismatchError (errors.As). bd-enterprise's
HTTP client maps a 409 precondition_failed to the bare
issueops.ErrVersionMismatch sentinel instead, which bypassed the classifier
and surfaced as a generic error. Added an errors.Is fallback that reports
precondition_failed with expected_revision from the --if-revision flag
value and current_revision omitted (gascity tolerates the omission).
New regression tests (embedded + proxied routes) reproduce the .74 race
deterministically: claim an issue as a foreign holder to advance its
revision past a caller's stale --if-revision, then assert the guarded
write reports precondition_failed rather than falling through to the
live-claim refusal naming the holder. Both fail on an unpatched
git-archive copy of origin/main and pass on this branch.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37258672420
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
TestMaybeAutoBackup_WalkErrorArmsIntervalThrottle pinned the walk-error
re-arm in maybeAutoBackup by forcing runBackupExport's old post-sync
GetCurrentCommit call to fail. #7044 (874e2866f) collapsed that into a
single pre-sync CurrentCommit read, so the forced failure point no
longer exists and the test failed deterministically on every run.
Swap the failure point for one that still exists after #7044: the sync
itself succeeds (still proving fail-open — BackupDatabase gets called),
but the destination goes read-only immediately afterward, so
runBackupExport's post-sync saveBackupState (the call that would record
the new watermark) fails and never reaches disk. The only persisted
watermark write left standing is maybeAutoBackup's own walk-error
re-arm, so the test is still mutation-sensitive to removing it
(verified locally: deleting the re-arm reproduces the old failure).
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
pr.yml and pr-risk.yml (and the three advisory workflows that already
list release/** beside it -- conformance.yml, cross-version-smoke.yml,
regression.yml) trigger pull_request only on main and release/**. A PR
based on hotfix/1.3.1 (or any sibling hotfix/** line) matched neither
pattern, so it ran almost no CI: #7146, a backport to hotfix/1.3.1,
showed 17 checks -- 15 cross-version historical smokes and triage/label
jobs, 2 skipped -- no Lint, no unit shards, no embedded tier, no CI
Gate / Required, no PR Risk Gate / Required.
pr.yml's own comment states exactly why release/** is there:
release-prep and release-fix PRs are based on the release branch, not
main, and without it they run almost no CI before the tag build. A
hotfix line is in the identical position. Added hotfix/** alongside
release/** in all five files.
New TestPullRequestWorkflowsTriggerOnHotfixBranches pins hotfix/**
presence in each file's pull_request.branches list -- red before this
change (observed [main release/**] in all five), green after. The
existing TestPRRiskBazelCoverageJob equality check (pr.yml and
pr-risk.yml's pull_request triggers must match) still passes, since
both were updated identically. go vet/gofmt clean.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Record the commit read before BackupToDir as the newest revision guaranteed
to be in the snapshot. A commit landing during sync then remains pending for
the next backup instead of being hidden by an advanced watermark.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Rongjun GENG
Propagate sweep protection through closed candidates so an open descendant
keeps every candidate ancestor in its protecting dependency chain. Cover the
shared helper, dry-run, real sweep, and all storage contract wirings.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Rongjun GENG
TestResetCommandFlagsRestoresEveryFlag read its expected values from the
live flag variables. The root pre-run fills some of those from config
without marking the flag Changed (doltAutoCommit, main.go:1224), so when
an in-process command ran earlier in the binary the baseline for
--dolt-auto-commit was "on", and the reset under test correctly put it
back to "". PR Core (wrapper timing) has failed on that assertion on
every fork PR since #7185.
The test now calls resetCommandFlags before taking its baseline.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Follow-up to #6380 (bd kv list --prefix). Both capability-discovery hops
fall back silently, and both modes re-filter in-process with
kvPairsWithPrefix, so a lost SQL-side fast path printed the same rows and
failed no existing test.
- Extract wireProxiedUOWProvider, the unit-of-work twin of
wireStorageDecorators, so the proxied provider chain that main.go builds
is unit-testable; main.go now calls it. No behavior change.
- TestKVListProxiedPrefixReadSurvivesProviderChain drives
runKVListProxiedServer through that chain (hook runner on and off) over a
prefix-capable stub use case and fails on any GetAllConfig scan;
TestKVListProxiedPrefixAbsentCapabilityFallsBack keeps it honest.
- TestEmbeddedKV/kv_list_prefix_json and
TestProxiedServerKV/list_prefix_json run the real command with sibling
keys (mail.dog.* vs mail.doggerel.*) and an unmatched prefix.
- bdKVListJSON now fails on output with no JSON object instead of returning
an empty map, so a "no pairs" check cannot pass vacuously.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* perf(storage): cut batch-create round trips (import, bulk create, apply-batch)
A multi-issue create (import, bulk create, CreateIssuesWithFullOptions) ran
~20 SQL statements per issue, and its dependency pass ran a recursive cycle
CTE per edge over the union of both dependency tables, which Dolt cannot
index — every recursion step rescanned the edge tables, so an import whose
edges form chains went superlinear (400 issues: 73 s of 82 s in that CTE).
issueops batch create, same transaction and same stored outcome:
- createBatchCache: one IN-list read of every explicit id's presence in both
planes (replacing two COUNT probes per issue), one read of the batch's
stored labels (each issue's new labels then land in one multi-row INSERT),
created/label_added events buffered and written in one pass under the ids
InsertDerivedEvent would mint (same digest, same lowest free ordinal), and
runs of brand-new rows written with multi-row INSERTs (same ODKU clause)
then finished in order.
- Dependency pass: wisp routing and target presence from batch reads; the
cycle and hierarchy checks walk an in-memory copy of the edge tables,
loaded once and kept in step with every edge the pass writes (a pair it
already holds is re-read, since a clientFoundRows connection reports a
matched duplicate as written).
- createBlockedRecomputeIDs seeds all created edges and expands once.
Shared paths:
- Blocked-state recompute splits ids once per call by whether they own a
dependency row; edgeless ids (every freshly created issue) skip the two
union UPDATEs for one plain unmark, run after the chunk's union statements
on the first pass so the unions see what they saw before.
- appendChildrenInTx reads children per IN-list chunk, not per parent.
- ExecuteCreate hands its BatchContext to the batch body instead of having
it re-read the same config (-6 statements per apply-batch create item).
Not changed: one version-history row per created issue (the version
contract, version_history.go), journal order and content, and the per-row
bodies, which stay the path for singular creates.
Equivalence: internal/storage/createbatchequiv runs an import scenario
(upserts, duplicate ids, wisps, generated ids, cycles, hierarchy conflicts,
dangling/external targets, stale is_blocked, comments, journal and
versioned history on) through the fast and per-row bodies on the embedded
and server engines and compares every written table and the skip reports.
Re-pinned TestLargeBatchApplyStatementCounts*: embedded 7009/14014/846 ->
6396/12790/793, server 7008/14014/846 -> 6396/12791/793 (breakdown in
pinnedEmbeddedStatementCounts).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(storage): batch-create review fixes — lazy edge graph, opt-in recompute probe, insert budget
Review of the batch-create round-trip change (S1-S3 and nits):
- The dependency pass's in-memory graph no longer loads both edge tables.
It reads a node's outgoing edges through the issue_id index the first
time a walk reaches it: the batch's own endpoints up front, then one
IN-list read per BFS level. Memory and reads scale with the subgraph
the batch's walks touch, not the edge tables, so a two-edge create on a
large database no longer materialises every edge. A written edge whose
source was never loaded loads that source (row included).
- The blocked-state no-edge probe runs only when a create asks for it or
when a chunk holds at least 32 ids. Single-issue recomputes on close,
reopen, update and dependency edits issue exactly the statements they
did on main (the reopen sqlmock expectation is back to main's).
- Multi-row issue INSERTs are bounded by an estimated 16 MiB of bound
text as well as 100 rows. When a multi-row statement fails, its rows are
replayed one at a time, and the batch continues if every row lands
instead of returning the original error.
- Nits: document the binary-collation assumption behind Go string
equality; DisableCreateFastPathsForTest documents that it is
process-global and non-parallel, and panics on an overlapping caller;
drop the unreachable skip branch; explain why wisp targets need no
presence read.
Re-pinned TestLargeBatchApplyStatementCounts* classic 40: 793 -> 786
(the +7 probes on dep-add recomputes are gone; net vs main is -60, all of
it ExecuteCreate's config reuse). 356/712 unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(storage): search the batch dependency graph from both ends
The lazy per-node load (previous commit) still walked forward from the
check's start, so on a large stored graph a single create's cycle check
read every node reachable from its target — about 800 statements per
create on a 2000-issue fixture. The cycle and hierarchy questions a batch
asks almost always end at a row the batch just created, whose only
incoming edges are the batch's own.
depGraph now answers each reachability question with a bidirectional
search: forward from the start along outgoing edges (issue_id index),
backward from the goal along incoming edges (the three target-column
indexes, read as one UNION ALL per table), always expanding the smaller
frontier and loading a level's nodes in that direction once. The batch's
endpoints are loaded in both directions up front, so a create's checks
usually finish with no further read (a chain import, too: each new
edge's goal has no incoming edge yet). Rows are keyed by (table, source,
target), so a row read from both ends counts once. An incoming read
ignores a row whose matching column is not its first set target column,
as the CTE's COALESCE does. A written pair that neither loaded end can
vouch for is re-read instead of assumed new.
On a 50k-issue / 100k-edge database, a create with two blocks edges
now runs 27 statements, against the full-scan or per-node walks before
(numbers in the review-fix summary).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): hold batch create to golden digests from the pre-change code
The batch-create equivalence test compared the fast paths with the same
code's per-row bodies, so changes the fast-path switch does not gate —
the recompute seed merge, the IN-list children read, ExecuteCreate's
context reuse, the prepare/finish split — were checked only by older
contract tests. Its batch was also too small to cross a chunk boundary
and never set RejectStaleUpserts.
createbatchequiv now runs four scenarios, each through the fast and
per-row bodies, and checks both against a per-table row count and
SHA-256 recorded from ebe3b6bcb (before the fast paths existed;
CREATEBATCHEQUIV_GOLDEN_DIR re-records them):
- small: the original scenario;
- import458 and import458-reject-stale: the review's 458-issue batch
(every chunk boundary, wisps and cross-plane edges, cycles, hierarchy
conflicts, duplicate ids across deferred runs, generated and
hierarchical ids, stale upserts rejected and accepted), plus new edges
whose blocked-state fallout reaches stored rows outside the batch (a
spawner's waiter, an upserted parent's existing child);
- apply: an apply-batch through ExecuteCreate, dep adds and an update.
The recorded digests match on the embedded and server engines (the
server test now sets the fixture's prefix, so generated ids agree).
Dropping the spawner-waiter seeding is invisible to the fast-vs-per-row
comparison and caught by the golden check.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): large-graph create benchmark
batchbench measures creates against a database already holding a large
dependency graph (batchfixtures.LargeGraphInserts: N issues, ~2N
acyclic edges with wide reachable sets and a deep parent-child forest,
committed as a Dolt version): ExecuteCreate under an existing parent with
an existing blocker, a store create with two blocks edges, and an
apply-batch of creates each with a parent-child and a blocks dep_add.
It logs wall time, statements and Go allocation per shape on the
embedded and server engines. Opt in with BEADS_BENCH_LARGE_GRAPH=<issues>
(and BEADS_BENCH_LARGE_GRAPH_CREATES); it asserts nothing.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(storage): read incoming dependency edges one target column at a time
The bidirectional graph search read a node's incoming edges with one
UNION ALL over the three target columns per table. Dolt plans that as a
scan: 0.7 s per read on a 100k-edge table, where each leg alone is a 1 ms
lookup on its own index (EXPLAIN shows IndexedTableAccess per leg). Issue
the three legs as separate reads into one row set; a row matched through
two columns still counts once.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(storage): run the 458-issue equivalence scenarios outside the race lane
The 458-issue golden scenarios took the embedded tier's shard over its
20-minute limit under -race (the in-process engine's own instrumentation;
about 35 s each without it). They move to
TestCreateBatchFastPathsMatchPerRowLarge_Embedded, skipped under -race and
added to nightly.yml's non-race embedded step, following the precedent of
the 712-item statement-count and 1000-item wall-clock cases. The light
scenarios (small, apply) stay in TestCreateBatchFastPathsMatchPerRow_Embedded
on every lane. The server backend (built without -race in its full
suite) runs both: TestCreateBatchFastPathsMatchPerRow_Dolt and, as its own
top-level test so the shard manifest's hash places it on another shard
(about four minutes there), TestCreateBatchFastPathsMatchPerRowLarge_Dolt.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(cli): add --if-revision compare-and-swap guard to update/close/assign/delete
Adds --if-revision <int64> to `bd update`, `bd close`, `bd assign` and
`bd delete`, reusing the existing opaque row_lock token published as
IssueDetails.Revision and the library's own ExpectedVersion compare-and-swap
support. A mismatch writes nothing and exits 13 (ExitGuardMismatch); with
--json the stderr envelope carries integer expected_revision/current_revision
fields deployed callers decode directly, never a quoted string. An
unsupported backend reports conditional_write_unsupported and exits 1
instead of silently dropping the guard. The guard composes with
--if-assignee/--if-status (every guard must hold) and is refused alongside
label or parent edits and alongside more than one id, matching the existing
--if-assignee rules. `bd assign` is newly routed through the checked
Lifecycle path to gain CAS support it previously had none of at all.
Implements Item 4 (compare-and-swap through the CLI, gastownhall/beads#4682)
from the BEADS-JOURNAL-PLAN.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): regenerate cmd/bd BUILD.bazel for if_revision/close_if_revision
gazelle hadn't picked up if_revision.go, close_if_revision.go,
if_revision_test.go, and if_revision_embedded_test.go, so Bazel's bd_lib
and bd_test targets failed to build with "undefined: parseIfRevisionFlag"
and friends while plain `go build`/`go test` worked fine. Ran `make
bazel-sync` (bazel run //:gazelle; go_srcs.py; bazel mod tidy) to pick up
the new files; only cmd/bd/BUILD.bazel's srcs lists changed.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(cli): update update-guard parity strings for --if-revision
TestParityUpdateGuardsRequireFieldUpdate and TestParityUpdateGuardsRejectClaim
pinned the exact stderr text of update.go's pre-write guard short-circuits.
Adding --if-revision to those guard messages (update.go/update_input.go)
changed "--if-assignee/--if-status" to "--if-assignee/--if-status/--if-revision"
in both, which this PR's own change to the guard text had not updated here —
caught by CI's dolt-server tier, not by the targeted if_revision* test runs.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): zstd cache transfers for the anonymous fork cache only, behind RBE_CACHE_ZSTD (E4)
E4 of the rbe-west egress reduction (design A.5), reworked for the
read-only zstd server shape. rbe-west's trusted MAIN and OSS schedulers
(:443 to :50052) and rbe-fork (:8444) advertise no compressor, and Bazel
refuses a remote that does not advertise zstd. So only the anonymous fork
cache (rbe-cache :8443, nativelink-anon, which keeps zstd) may ask for it.
- **`write-bazelrc.sh`:** no `--remote_cache_compression` on the trusted
remote-exec or rbe-fork paths. In mode cache, with `RBE_CACHE_ZSTD=1`, it
adds `build:fork-cache --remote_cache_compression`. Empty or 0 adds
nothing; another value warns and stays off, rather than failing every
cache lane.
- **`bazel.yml`:** every setup-bazel caller passes
`RBE_CACHE_ZSTD: ${{ needs.rbe.outputs.mode == 'cache' &&
vars.RBE_CACHE_ZSTD || '' }}`, so only cache runs see the variable.
Merging changes nothing, and rollback is the variable, with no revert.
- **`.bazelrc`:** fork-cache no longer sets the flag; a comment points at
the gate.
Tests:
- `TestBazelCacheModeReachesTheRC` evaluates `vars.` right-hand sides and
simulates `RBE_CACHE_ZSTD=1`. Mode cache's rc carries exactly the
fork-cache zstd line; the remote, fork-ro, fork-rw and local modes carry
no compression at all.
- `TestSetupBazelRCWriter` runs `RBE_CACHE_ZSTD` = 1, 0, empty and a bad
value in mode cache, and remote-exec with 1 (never compressed).
`TestSetupBazelRCWriterForkMode` pins rbe-fork's exact lines with
`RBE_CACHE_ZSTD=1`.
- The bazel.yml setup-env pin includes `RBE_CACHE_ZSTD`.
- `checkBazelrcForkCache` rejects the flag in any `.bazelrc` config, with
fork-cache and remote-exec fixtures.
- New `TestBazelRemoteCacheCompressionOnlyForkCache` scans `.bazelrc`, the
workflows and the local action files. The flag must appear once: the
writer's fork-cache echo.
**Merge order:** after rbe-west's anonymous process advertises zstd. Even
then the flag stays off until `RBE_CACHE_ZSTD=1` is set. If rbe-cache stops
advertising zstd, fork-cache's fallback flags make lanes build locally.
**Action keys:** unchanged; the flag only changes ByteStream resource
names (`compressed-blobs/zstd/`).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): zstd for the fork cache by a GetCapabilities probe, not a repository variable (E4)
Review finding 3: GitHub gives fork pull_request runs no repository
variables (bazel.yml: forks "see no secrets and no vars"), so
vars.RBE_CACHE_ZSTD was always empty exactly where the switch matters. Fork
run 37220594372 logs RBE_VAR_ON: false. The variable could never turn zstd
on for fork-cache clients, and once on it could not follow rbe-cache
rolling zstd back.
- New setup-bazel/cache-zstd-probe.sh, a byte copy of gascity's
tools/rbe/cache-zstd-probe.sh: one unary REAPI GetCapabilities call
(instance oss) to rbe-cache :8443 over curl's HTTP/2, decoded with
python3's standard library. It exits 0 only when
cache_capabilities.supported_compressors lists ZSTD, the field Bazel
checks. Any other result exits nonzero: not listed, an HTTP or gRPC
error, a refused connection, a timeout (connect 3s, total 5s), an
unparsable answer, or no curl or python3. It writes nothing to stdout
and one verdict line to stderr. No new action and no new dependency.
- write-bazelrc.sh: in mode cache, `if bash .../cache-zstd-probe.sh` adds
build:fork-cache --remote_cache_compression. The probe never fails the
script. RBE_CACHE_ZSTD and its bad-value warning are gone.
- bazel.yml: the ten RBE_CACHE_ZSTD env lines are gone (back to the
pre-E4 setup env).
Tests:
- New TestCacheZstdProbe runs the real script against a TLS HTTP/2
stand-in for rbe-cache, which checks the exact request. Passes: zstd
advertised (packed, and unpacked among others). Fails: rbe-cache's real
2026-10-04 answer (no compressors), deflate only, zstd for batch updates
only, zstd outside cache_capabilities, a gRPC error trailer, no
grpc-status, trailers-only UNIMPLEMENTED, HTTP 502, a compressed or
truncated message, a truncated field, not gRPC, a timeout, a refused
connection, an untrusted certificate. It also pins the probe's endpoint
and instance to .bazelrc's fork-cache.
- TestSetupBazelRCWriter: the fork cache gets exactly the zstd line after
--config=fork-cache against a zstd stand-in, and none against the live
answer or a refused port. Remote-exec and rbe-fork, with a zstd
stand-in, never probe and never carry compression.
- TestBazelCacheModeReachesTheRC again rejects any vars. in setup-bazel's
env, and no mode's rc carries compression (the probe is refused there).
- The writer harnesses default RBE_CACHE_PROBE_URL to a refused loopback
port, so no test reaches rbe-cache.
Live check, 2026-10-04: rbe-cache answers without supported_compressors,
so the writer's mode cache rc has no flag until the E1 cutover.
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>
* wy-1rrwt8: add 'bd kv list --prefix' — SQL-side key-prefix filter for scoped kv reads
Downstream mail transports read the whole kv store (3.4MB, ~1988 mail.*
envelopes on the wyvern fleet) for every inbox render. This adds a --prefix
flag to 'bd kv list' that pushes the filter into SQL on stores that support
it, via an optional domain.ConfigPrefixReader interface discovered by type
assertion — no existing storage interface or test double changes shape, and
every path falls back to GetAllConfig plus in-process filtering.
- issueops: ConfigPrefixLikeQuery + ConfigPrefixPattern (LIKE with explicit
ESCAPE '!' — the engine does not honor backslash as a default escape) and
GetConfigByPrefixInTx.
- domain: ConfigPrefixReader optional interface; use-case impl delegates to
the repo fast path or filters GetAllConfig.
- domain/db, dolt, embeddeddolt: SQL-side GetConfigByPrefix.
- telemetry: instrumented passthrough preserving the capability.
- cmd/bd: --prefix on kv list, both classic and proxied-server paths;
kvPairsWithPrefix re-checks on every path so output is identical whichever
path served the read.
* build(bazel): list the PR's new test files in go_test srcs (make bazel-sync)
kv_prefix_test.go (cmd/bd) and config_prefix_test.go
(internal/storage/issueops) are new, untagged test files. Both packages'
BUILD.bazel files were generated on main after the PR's commit was written,
and the rebase onto main did not re-run gazelle, so neither go_test listed
them: bd_test and issueops_test reported PASSED with "no tests to run" for
TestKVPairsWithPrefix and TestConfigPrefixPattern, and bazel.yml's "BUILD
files in sync" step fails on that drift in the required bazel-test lane.
Generated by `make bazel-sync`, which rewrote only these two rows. Both files
import only the standard library, so no deps change.
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>
* fix(kv): engage the --prefix SQL fast path through the decorator chain
Maintainer review fixup for PR #6380.
The SQL push-down this PR exists to deliver was unreachable on bd's default
direct/embedded path. `bd kv list --prefix` asserted `store.(configPrefixReader)`
on the outermost decorator, but wireStorageDecorators unconditionally interposes
externaldeps.Store and (hooks on, the default) HookFiringStore, both of which
embed the storage.DoltStorage *interface* — and GetConfigByPrefix is
deliberately not declared there. The assertion could never succeed, so every
direct-mode prefix read silently took the GetAllConfig full-table fallback.
Output was identical, so nothing errored, logged, or failed a test, while the
flag help and command Long text asserted the opposite.
This carries the prior review lineage's fixup 9ca3caeb9, stranded when the PR
was relaunched, plus what this review iteration found missing from it:
- cmd/bd: discover the capability through storage.UnwrapStore, the repo's
documented idiom for optional-interface assertions (~50 existing call
sites), in configPrefixReaderFor. The direct-mode read itself is extracted
as readKVListConfig so the regression test drives the command's own read:
with only the helper under test, reverting the call site to the bare
`store.(configPrefixReader)` assertion still left the whole suite green.
- cmd/bd: chain-level regression test over wireStorageDecorators covering all
four telemetry/hooks configurations, plus the negative case proving a store
without the capability is still reported incapable. The stub counts full
reads, so a fallback fails the test even though it returns the same rows.
Verified non-vacuous: a bare assertion in the helper or in
readKVListConfig, a disabled fast path, a dropped kv. prefix, or a method
added only to the mirror interface each fail all four configurations; a
peel that stops at InstrumentedStorage fails the telemetry-on negative case.
- dolt, embeddeddolt, telemetry: compile-time pins against
domain.ConfigPrefixReader, so method-set drift on any implementation is a
build error instead of a silent reversion to full scans. The cmd/bd
mirror's own pin checks one direction only (a method added just to the
mirror still compiles); its comment now says so and names the test that
covers the other direction.
- domain/db: delegate GetConfigByPrefix to issueops.GetConfigByPrefixInTx like
the sibling stores, instead of a second scan loop over the shared query
constant.
- telemetry: record the deliberate trade — peel-to-raw keeps the standard
idiom and leaves the instrumented forwarder off the cmd/bd path.
- bazel: add //internal/storage/domain to the telemetry_test deps (make
bazel-sync); without it the telemetry pin's import fails strict deps.
Co-authored-by: dog <dog@ghosttrack.com>
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: dog <dog@ghosttrack.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(backends): registry Remote + optional OpenWith(ctx, dir, OpenOptions)
Slice S1: backends.Backend gains Remote bool and an optional
OpenWith(ctx, beadsDir, OpenOptions{Credential, HTTPClient, UserAgent}) so a
registered extension backend can honor a per-open credential instead of
dialing with a process-global client — the motivating case is one embedder
process serving many workspaces with distinct credentials. Open keeps
working unmodified for every existing backend: Backend.OpenWithOptions calls
OpenWith when present, otherwise falls back to Open and ignores
HTTPClient/UserAgent, but refuses (ErrCredentialWithoutOpenWith) rather than
silently dropping a non-nil Credential.
Public beads.OpenBestAvailableWith(ctx, beadsDir, opts) carries this through
the SDK surface (mirrored in beads_nocgo.go and aliased in backend/backend.go
and beads.go); OpenBestAvailable is now that call with a zero OpenOptions,
identical to its prior behavior for Dolt, embedded Dolt, and every registered
backend. The plain-Dolt path (no registered backend) applies the same
Credential refusal, since Dolt has no per-open credential seam either.
doltserver.ResolvePhysicalRoots now checks backends.IsRemote(cfg.GetBackend())
before every Dolt-mode branch, including the shared-server check (which reads
only env/config.yaml and never consults cfg) — without this ordering, a global
BEADS_DOLT_SHARED_SERVER=1 would hijack a remote-backend workspace into
reporting a bogus local Dolt root it will never open.
Tests: backends_test new file open_with_test.go covers OpenWithOptions
dispatch/back-compat/Credential refusal and Remote/IsRemote; root package
open_backend_selection_test.go adds a fake OpenWith registrant proving
dispatch and option pass-through through OpenBestAvailableWith, zero-options
back-compat for every path (registered w/ and w/o OpenWith, plain Dolt), and
the Credential-without-OpenWith refusal on both paths; doltserver
physical_root_test.go adds the registered-remote-backend case including the
shared-server-override ordering regression test. Verified under both cgo and
nocgo builds. Live-mutated each new guard (the Credential refusal, the
OpenWith dispatch, the ResolvePhysicalRoots remote-backend case, and the
plain-Dolt Credential refusal) one at a time and confirmed RED before
reverting to GREEN.
No HTTP client code added; that is a later slice.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fixup(backends): address Opus review findings on OpenWith (M1-M3, L1-L2)
- M1: frame cmd/bd store-open errors for remote backends as unreachable
server failures instead of Dolt-shaped "failed to open database"
advice (openStoreErrorMessage, backendNameForErrorFraming), with tests.
- M2: rewrite the OpenBestAvailable/OpenBestAvailableWith back-compat
subtest to assert fixed expected outcomes (error identity/message,
returned store behavior) now that the two functions are identical,
instead of comparing them to each other.
- M3: document and enforce the OpenWith contract: an implementation that
receives a non-nil Credential it cannot type-assert to its expected
type must refuse with the new ErrUnsupportedCredential sentinel,
verified with a fake registrant.
- L1: document that a nil OpenOptions.Credential means the backend's
default/ambient auth, and that multi-tenant embedders must pass a
non-nil Credential (RequireCredential deferred to S2).
- L2: fail closed on HTTPClient/UserAgent passed to a backend without
OpenWith, mirroring the existing Credential refusal, via new
ErrHTTPClientWithoutOpenWith/ErrUserAgentWithoutOpenWith sentinels.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37195230844
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
* fix(backends): keep the store-open error chain through the remote framing
Maintainer review fixes for the adopted PR (iteration 1).
openStoreErrorMessage returned a string, so ensureStoreActiveWithContext
rebuilt its error from text (%s) where base wrapped the open error with %w,
and the chain ended at the CLI's framing. Prime tells a store-open timeout
apart from a generic "storage unavailable" only through
errors.Is(err, context.DeadlineExceeded) on what ensureStoreActiveWithContext
returns (cmd/bd/prime.go), so the flattening silently downgraded that
diagnostic for every backend, Dolt included, not just the new Remote ones.
Replace the helper with openStoreError, which returns an error wrapping err
with %w on both arms. The message text is unchanged: "failed to open
database: <err>" for Dolt and any registered backend that is not Remote,
"failed to reach remote backend %q: <err>" for a Remote one. direct_mode.go
wraps the result with %w ahead of its Hint line; main.go keeps printing it
through HandleError("%v", ...), which only formats.
Tests:
- TestOpenStoreErrorFramesRemoteBackends (renamed from
TestOpenStoreErrorMessageFramesRemoteBackends) now also asserts errors.Is
on every arm, and the exact original text for the non-Remote arms.
- TestEnsureStoreActiveKeepsOpenErrorChain drives the real
ensureStoreActiveWithContext against a registered backend whose open
outlives its context, for a local and a Remote backend, and requires
errors.Is(err, context.DeadlineExceeded) plus the framing prefix and the
Hint line.
- TestFormatMemoriesForPrimeTimesOutOpeningRegisteredBackend is the
unstubbed twin of TestFormatMemoriesForPrimeTimesOutOpeningStore and
requires the timeout banner, not the "storage unavailable" one.
Measured at this head: turning direct_mode.go's outer %w into %v reddens
both chain-test rows and the prime test; turning the helper's %w into %v
reddens the framing test as well.
Non-gating cleanup in the same area:
- beads_cgo.go, beads_nocgo.go: OpenBestAvailableWith's doc and dispatch
comments said only a non-nil Credential is refused. The code also refuses
a non-nil HTTPClient and a non-empty UserAgent, each with its own
ErrXWithoutOpenWith sentinel.
- internal/doltserver/physical_root.go: the Mode doc lists "remote-backend",
and the RemoteBackend doc covers a registered Remote backend as well as a
Dolt server on a non-local host.
- open_backend_selection_test.go: the plain-Dolt refusal test is a table
over Credential, HTTPClient and UserAgent (renamed
TestOpenBestAvailableWithRefusesPerOpenOptionsOnPlainDolt). Disabling the
nocgo HTTPClient arm or the cgo UserAgent arm reddens only that row. The
zero-options test's comment had the delegation backwards and pointed at
beads.go; OpenBestAvailable delegates to OpenBestAvailableWith in
beads_cgo.go and beads_nocgo.go.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* refactor(doltserver): share dolt's startup-output watcher with the plain server launcher
Move the ready-line / port-in-use watcher that the proxied DoltServer uses
(startupWatch, doltReadyLine, doltPortInUseTexts, logLevelEmitsReadyLine,
ErrPortInUse) into internal/doltserver as StartupWatch and friends, so the
plain server-mode Start can read the same signals. dbproxy/server already
imports internal/doltserver, so it now uses them from there; its
ErrPortInUse is the same error value. No behavior change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(doltserver): prove the auto-started dolt owns its port; move a taken ephemeral port
The plain server-mode Start (bd init --server, auto-start, bd dolt start)
had the same blind readiness check the managed-local proxied backend had
before #7184, plus a blind exit check:
- It picked an ephemeral port, closed the probe listener and launched dolt,
then slept 200ms and asked whether the child was still alive. dolt only
reaches its port check after its own startup, which under load takes
longer than that, so a lost port was never caught there. Worse, the child
had been Release()d unreaped, and a zombie still answers kill(pid, 0), so
an exit was invisible for the rest of the bd process.
- It then waited for any MySQL greeting on the port. If another process
took the port in between, either it was mute (a plain listener) and Start
ran out its ready timeout -- the direct-local-server auto-start timeout seen
under port churn -- or it was another dolt, and Start reported success
against a server it did not start.
Now each attempt launches the child with a goroutine that waits on (and
reaps) it, and awaitOwnedListener accepts a greeting only once the
listener is shown to be the child's: dolt's ready line in the child's
output when its log level emits it (debug), or else the listening socket
belonging to the child's process tree (Linux, via /proc/net/tcp and
/proc/<pid>/fd). The child's output is read from the server log past the
offset it started at, through the StartupWatch shared with dbproxy, so
"Port N already in use." (printed at log_level warning too) ends the
attempt at once as ErrPortInUse, and a child exit ends it as a failure.
Port policy follows #7184's contract: only a port bd chose itself moves.
An ephemeral port that is lost is retried on a fresh one (up to the
existing 10 attempts); an explicitly configured port (env, config.yaml,
metadata, dolt config) stays pinned and fails with ErrPortInUse and a
remedy. Nothing operator-owned is rewritten: the generated
dolt-server-config.yaml is bd's own state file and was already rendered
per attempt. Where ownership cannot be proven (non-Linux, quiet log
level) the greeting decides as before, but the child's exit and
port-in-use report still end the wait.
Tests: a fake dolt (this test binary, behind a PATH shim) that spends
700ms starting up and then binds like dolt does. A foreign greeter on the
port is not accepted (ErrPortInUse); the child's own listener is; a child
exit is reported promptly; and the real Start, handed a taken first
ephemeral port, comes up on a fresh one (fails before this change: Start
adopted the foreign port).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(doltserver): isolate user config in the DefaultConfig tests
Four DefaultConfig tests failed under -tags integration on a host whose
user config sets dolt.shared-server: true. The integration TestMain, unlike
the plain one, does not redirect HOME, so:
- TestDefaultConfigPrecedenceChain and TestDefaultConfigPortSource call
config.Initialize, which merged ~/.beads/config.yaml.
- TestDefaultConfigReturnsZeroForStandalone and
TestDefaultConfigPortFileTakesPrecedence read whatever config an earlier
test had loaded from the real HOME.
Shared mode then sent DefaultConfig to the shared server's state dir and
its port file ("port=3308 source=port_file, want 5002/config_yaml").
isolateUserConfig points HOME, USERPROFILE and XDG_CONFIG_HOME at an empty
dir, the way TestDefaultConfig_NonzeroPortAlwaysHasSource already does.
It also resets the loaded config before the test and again after it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(doltserver): auto-start review fixes: record the server at launch, sharper ownership, port policy by source
Follow-up to 0acb1041b, addressing review.
B1: write the PID and port files again right after each launch, as before
that commit, and remove them on every failure path (port conflict,
not-ready, remotesapi). Previously a bd interrupted during the readiness
wait left a dolt holding the database lock that nothing could find. The
next start, bd dolt stop and killall all saw nothing. Both files carry the
real port, so IsRunning never stops a starting server as "port unknown".
S1: a child gone from /proc is known not to own the port; it is no longer
"unknown", which would let a foreign greeting through. The child's log is
re-read on every check, not only after its exit has been observed, because
the reaper goroutine can lag the death.
S2: if no listener on the port is listed although one just answered, /proc
is incomplete (WSL1, some sandboxes, forwarding). That is now "unknown"
(fallback to the greeting), not "foreign". Also "unknown": a /proc that is
not this PID namespace's.
S3:
- bd's port-file port moves like an ephemeral one outside shared-server
mode, since bd chose it (GH#4052).
- Operator-configured ports and the shared-server port stay pinned.
- The pinned error now says where the port came from (env, config.yaml,
dolt config, metadata, --server-port, shared default, shared port file)
instead of always "configured explicitly".
S4: a killed child is waited for (up to 5s) before the next attempt or the
return, so it has released the database lock. Its process group is killed
too (unix), which reaches a dolt behind a non-exec wrapper.
S5: when /proc proves the listener belongs to another process, the wait
returns ErrPortInUse at once. It no longer sits out a slow child, which
could outlast the timeout and turn a movable port into a hard failure.
NITs:
- Debug-mode timeout names the missing ready line and the way out.
- The log tail restarts if the log is truncated under it.
- waitForReady is removed; its probe tests now drive awaitOwnedListener.
- Stale daemonization comment fixed in cmd/bd.
- CONFIG_PROC_CHILDREN caveat documented.
Tests:
- fake-/proc ownership cases: owned, foreign, child gone, no listener row,
unreadable fd table;
- /proc/net/tcp parsing;
- proven-foreign ends the wait at once;
- port-in-use in the log counts before the exit is seen;
- ready-line proof, with and without the line;
- Start records PID+port while waiting;
- Start removes them after a failed start;
- pinned env port: one launch, ErrPortInUse, source in the message;
- port-file port moves;
- remedy wording per source.
The Start tests now isolate the user config instead of skipping.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(doltserver): de-flake two startup tests under load
- TestStart_RecoversWhenEphemeralPortIsTaken: on Linux, /proc proves the
taken port foreign as soon as the greeting arrives, so the first child
can be killed before the fake records its launch. Assert two port
allocations and the final launch instead of the first launch.
- TestAwaitOwnedListener_ReadyLine: give the "no ready line" case 8s, so
the fake has time to start and greet on a loaded host.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
In shared-server mode every project's physical root is the one shared dolt
data dir, and bd init holds that dir's gate EXCLUSIVELY for its whole run
(~8s). It waited only exclusiveGateWait (5s) for it, so two concurrent
`bd init --shared-server` runs in different projects, or an init during
another project's long command, failed with "bd init refuses to run over
live bd activity".
acquireInitMutationGate now uses its own acquisition options:
- Wait: 30s by default, overridable with BEADS_INIT_GATE_TIMEOUT (Go
duration or bare seconds, same convention as BEADS_PRIME_TIMEOUT and
BEADS_FSCK_TIMEOUT); ctx cancellation still aborts the wait.
- One stderr notice ("waiting for another bd process on the shared
server (...)...") once the wait passes 2s, instead of immediately.
- Past the bound, the same refusal, now naming the budget and the knob.
Exclusivity is unchanged. The 5s exclusiveGateWait is also used by
backup restore, bootstrap, migrate and the backup lock; those keep it, so
the change is scoped to init via acquireExclusiveWorkspaceGatesWithOptions.
TestSharedServerConcurrent goes back to fully concurrent inits (manual runs
with many dirs raise BEADS_INIT_GATE_TIMEOUT to match). New unit tests: a
holder released after 6s lets init through with one notice; a holder past
the bound gives the clear ErrBusy error; cancellation; env parsing.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(notion): make the query page bound configurable and honour Retry-After
QueryDataSource paginates up to maxQueryPages (50) x maxPageSize (100), so a
data source larger than 5000 rows cannot be synced at all: the call returns an
error rather than partial results, and because every CLI narrowing flag is
applied after it returns, no flag works around it. Sync dies in both directions
at once. Refs #6004.
Two changes, and the second is what makes the first safe:
- Client.MaxQueryPages / WithMaxQueryPages lets a caller raise the bound for a
large data source. Default behaviour is unchanged when unset. The error at the
bound now names the ceiling in rows as well as pages, since rows is the number
a caller can compare against their own data source.
- doRequest now retries 429 and 529 honouring Retry-After, with exponential
fallback clamped at 30s. Notion enforces ~3 requests/second per connection, so
raising the page bound without this would trade a clear failure for an
intermittent one. Other 5xx retry only for GET/DELETE — replaying a POST that
may already have been applied server-side is how duplicates get made.
The request body is now marshalled once and the reader rebuilt per attempt; a
retry cannot reuse a drained body.
Tests cover the configured bound, the unchanged default, Retry-After being
obeyed exactly, GET retrying on 5xx, and POST not retrying. Verified they bite:
forcing maxRequestAttempts to 1 fails exactly the two retry tests, and ignoring
the configured bound fails exactly the bound test.
make build and make fmt-check pass; internal/notion and internal/tracker pass
with -tags gms_pure_go. golangci-lint was not run locally (not installed on this
machine); CI will cover it.
* fix(notion): use US spelling so misspell passes
The repo pins misspell to locale: US, and CI flagged "honouring" in
internal/notion/client.go. Corrected there, and in the two occurrences in
client_test.go - those are not linted today (run: tests: false) but leaving
British spellings in place only plants a failure for whenever that changes.
Verified with misspell v0.8.0 -locale US: the pre-fix content reports both
occurrences, the fixed content reports none. internal/notion tests pass with
-tags gms_pure_go, including the renamed test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4YFBBWN33GZZ2BDxWRvjT
* fix(notion): address review — 529 verb gate, ctx-aware retry wait, CLI wiring
MAJOR 1. retryableStatus returned early on 429 *or* 529 before the verb gate, so
529 was retryable for every verb — including CreatePage and CreateDatabase. A
529 can come back after Notion's edge already handed the write to the origin, so
a replay creates a second row for one bd issue, and ensureRemoteIndex is
last-write-wins on the bd ID, so nothing surfaces it. 429 stays verb-agnostic
(Notion rejects rate-limited requests before processing them); 529 now sits
under the GET/DELETE gate with the other 5xx. Three tests pin the boundary: a
creating POST makes one attempt on 529, a GET retries on 529, and a creating
POST still retries on 429.
MAJOR 2. The retry wait polled ctx.Done() with a default: and then slept, so
cancellation was ignored for up to maxRetryDelay per attempt — and
QueryDataSource pays that per page, scaling with the very bound this change
lets callers raise. Replaced with wait(ctx, d): a blocking select over
ctx.Done() and a channel from a c.after hook, time.After by default.
MAJOR 3. The bound is now reachable from the CLI. Tracker.Init reads
notion.max_query_pages / NOTION_MAX_QUERY_PAGES and threads it into the client;
unset keeps the client's own default, and a value that is set but unusable is an
error rather than a silent fallback — the operator sets that key precisely
because sync is already failing on the bound. The pagination error names those
levers instead of a Go method a CLI user cannot call.
Also: assert every attempt carries a non-empty body (a drained reader would send
an empty second one, and nothing noticed); drop the unreachable lastErr branch
by breaking out of the loop; pin retry exhaustion at exactly maxRequestAttempts
with the last attempt's error; table-test parseRetryAfter across the nine
interesting inputs; name the 529 literal; hardcode 50 in the default-bound test
so lowering the default fails it; atomic counters in tests.
Every new test verified to bite by reverting each fix in turn: each mutation
fails exactly the tests naming it, against a clean baseline.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(notion): refuse a Retry-After longer than the client will wait
Separate commit because this one is a judgement call, not a defect fix — drop it
on its own if you would rather keep clamp-and-retry.
With Retry-After: 3600 the old path clamped to 30s and retried four times, so a
server asking for an hour got four more requests inside two minutes — the window
it told us to stay out of, and the way that window gets extended. Now the call
returns immediately, naming the delay the server asked for, and the caller
decides.
A Retry-After equal to maxRetryDelay is still honoured and waited out; only a
longer one is refused. The underlying API error is wrapped, so nothing is lost
to a caller inspecting it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(notion): key retry on side-effect safety, jitter own backoff, honour both Retry-After forms
Maintainer review fixes for PR #6006 (review iterations 1 and 2). All changes are
inside internal/notion; no new files.
F1 (major) — the 5xx/529 retry arm could never fire on POST
/data_sources/{id}/query, the paginating endpoint this PR exists to protect,
while the MethodDelete half of the allowlist had no call site at all (a census of
the client's verbs returns 3 GET / 3 POST / 2 PATCH, zero DELETE). Replaced the
verb gate with a retrySafety value each call site declares, so the property being
tested is side-effect safety rather than a proxy for it, and dropped the dead
MethodDelete arm. Only the read-only query POST changes behaviour: the creating
POSTs and both PATCHes stay non-replayable on every status except 429, exactly as
before. TestClientDoesNotRetryServerErrorOnPost exercised the query endpoint
while its "may already have been applied server-side" rationale could not be true
there, so it is retargeted at CreatePage and renamed
...OnCreatingPost, pairing with the existing 529 twin;
TestClientRetriesServerErrorOnQueryPost pins the new behaviour.
F2 (minor) — the exponential fallback had no jitter, unlike both sibling tracker
clients, so N processes tripping the same ~3 req/s limit retried in lockstep.
Jitter is applied to the self-chosen ladder only, never to a server-mandated
Retry-After, mirroring the split in internal/jira/client.go:419-424.
F3 (minor) — parseRetryAfter collapsed absent, HTTP-date and a legal
"Retry-After: 0" into one sentinel, so a date-form wait routed around the
maxRetryDelay refusal its delta-seconds twin is subject to. It now parses both
RFC 9110 forms and returns a presence flag; the doc comment's old justification
went with the behaviour it described.
F4 (nit) — maxRequestAttempts' comment claimed coverage of "transiently failing"
requests, which the transport arm does not have.
F5 (nit) — the invalid-value error names NOTION_MAX_QUERY_PAGES as well as the
config key, an abandoned wait now carries the API failure that caused it
alongside ctx's error, and the long-Retry-After refusal is evaluated before the
exhaustion break so the operator still gets it on the final attempt. That last
pin is a sibling test rather than a case inside
TestClientExhaustsRetriesAndReturnsTheLastError as the review suggested, to keep
that test a single-purpose pin on the loop's exit arithmetic.
Iteration 2 (non-gating, both in parseRetryAfter, which F3 already reworks) —
a delta-seconds value too large for a Duration now saturates instead of letting
the multiply wrap: "9223372037" wrapped to -2562047h47m16.7s, which is under
maxRetryDelay, so the refusal let it through to immediate retries. The date
form already saturated via time.Until. The unchecked multiply predates this
fixup (it is at the contributor's head) and is shared by linear/jira/gitlab,
which are left to a follow-up. TestClientRefusesLongRetryAfterInHTTPDateForm
drives a date-form header through the client, so the date form reaching the
refusal is pinned by the loop rather than only by TestParseRetryAfterHTTPDate's
arithmetic.
Validation: internal/notion 85 PASS / 0 FAIL / 0 SKIP; go build ./... and go vet
./cmd/bd (the sole importer) clean; CGO_ENABLED=0 builds; gofmt clean;
golangci-lint 0 issues both unscoped and --new-from-rev at the upstream base, and
the added //nolint:gosec is load-bearing (removing it reproduces exactly the G404
it names). Each fix is mutation-proved: reverting it reds its own pin while the
neighbouring pins stay green, including the two creating-POST controls under F1,
both directions of F2's jitter split, and both sides of the saturation bound.
Keying the refusal to delta-seconds only reds the new date-form test alone,
while TestParseRetryAfterHTTPDate stays green.
Moving the new delay logic into retryDelay rather than nesting it in the loop
took doRequest — the run's worst_changed function — from cyclomatic 21 /
cognitive 32 to 19 / 28 (gocyclo, gocognit), out of the major cyclomatic band
instead of further into it. No BUILD.bazel change is owed: no file was added and
both added imports (math, math/rand/v2) are stdlib.
Co-Authored-By: Claude Opus 5.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>
* fix(routing): bind role detection to the -C target repo (re-port of #4242)
Role detection previously called routing.DetectUserRole(".") directly,
which resolves against the caller's CWD rather than the repo selected
via `bd -C <target>` (BEADS_DIR-driven). This meant auto-routing and
role-based behavior could silently apply the wrong repo's role when
invoked with -C.
Introduce activeRepoPathForRouting(), which prefers
beads.GetRepoContext().RepoRoot (the BEADS_DIR-bound target) and falls
back to the parent of beads.FindBeadsDir(), then to ".". Route role
detection in cmd/bd/create.go and cmd/bd/routing_read.go through the
new detectUserRoleForActiveRepo() helper instead of calling
routing.DetectUserRole(".") directly.
Faithful re-port of gastownhall/beads#4242 (osamu2001) onto current
main: determineAutoRoutedRepoPath's signature changed to
(string, routing.RoutingRule) since the PR was opened (89a4d6ed8 /
#4866), so the one-line call-site change re-applies inside the new
function body, and the new routing_read_test.go coverage destructures
both return values. All other ported content (routing_role.go,
context_binding_test.go, the create.go call site) is unchanged from
the original PR.
Co-authored-by: Osamu Okano <okano.osamu@gmail.com>
Agent-Signature: claude-fable-5-high on behalf of maphew
* test(routing): fix the sole CI failure in the re-ported #4242 test
TestActiveRepoPathForRoutingFallsBackToBeadsDirParent created its fake
project under this repo's tree, so beads.GetRepoContext() resolved a
real repo root from the caller's CWD and the FindBeadsDir fallback the
test claimed to cover was never exercised — an unreachable assertion
that CI reproduced as the PR's only failing test.
Rewrite it to target a directory that is genuinely outside any git
repo: targetDir now comes from t.TempDir() (its .beads/config.yaml
still written via writeTestConfigYAML), and the caller CWD is also
moved to a fresh t.TempDir() via t.Chdir() so GetRepoContext() can't
resolve through the CWD either. Both resolve under os.TempDir(), which
internal/beads/context.go's isPathInSafeBoundary explicitly admits, so
this stays safe under the existing boundary check.
This makes safeTempDirForContextTest (the manual git-repo-relative
temp dir helper the original test used to dodge the same problem)
dead code; delete it.
Co-authored-by: Osamu Okano <okano.osamu@gmail.com>
Agent-Signature: claude-fable-5-high on behalf of maphew
* fix(routing): a .beads/redirect must not move role detection to the storage root
Cross-vendor review of e8600e732 caught a regression the re-port would have
introduced for redirect users: with a .beads/redirect pointing at storage
outside any git repo, RepoContext.RepoRoot is the redirect target's parent,
so beads.role would be read from the storage location instead of the
workspace repo — silently bypassing contributor routing.
The two external-BeadsDir shapes now get their opposite answers explicitly:
an explicit BEADS_DIR selection (what bd -C plumbs) binds role detection to
the selected project (the GH#4242 fix), while a followed redirect keeps it
on the CWD workspace repo (pre-existing semantics — a redirect relocates
storage, not the project). Mutation-tested: with the guard removed, the new
test fails by resolving to the storage root.
Co-authored-by: Osamu Okano <okano.osamu@gmail.com>
Agent-Signature: claude-fable-5-high on behalf of maphew
* fix(routing): read BEADS_DIR selection provenance at startup, not the live env var
The self-review on this PR found a startup-path gap: rootCmd's
PersistentPreRunE calls prepareSelectedCommandContext for every command,
which sets BEADS_DIR to the resolved target — redirects included. By the
time role detection ran, activeRepoPathForRouting's os.Getenv("BEADS_DIR")
check was therefore always true, classifying a plain .beads/redirect as
explicit selection and binding beads.role to the storage root instead of
the workspace repo.
Capture whether BEADS_DIR was present in the environment at process start,
and treat selection as explicit only for that case or a -C flag. The new
TestActiveRepoPathForRoutingSurvivesStartupRebindAcrossRedirect goes
through the real startup rebind with a real redirect and fails on the
previous logic; the two tests that simulate a caller-exported BEADS_DIR
now pin their provenance explicitly.
Agent-Signature: claude-fable-5-high on behalf of maphew
* fix(routing): .env-provided BEADS_DIR is user selection, mark its provenance
Cross-vendor review of the previous commit caught a regression it would
have introduced: loadBeadsSelectionEnvFile intentionally lets a project's
.beads/.env route commands via BEADS_DIR, and that selection happens after
the process-start snapshot. Flip the provenance flag when the selector
loader sets BEADS_DIR, so .env routing keeps binding role detection to the
selected project. TestActiveRepoPathForRoutingHonorsEnvFileSelection pins
it end to end through loadSelectionEnvironment.
Agent-Signature: claude-fable-5-high on behalf of maphew
* test(routing): make the BeadsDir-parent fallback test order-robust on macOS
The macOS CI leg failed on /private/var vs /var: the test asserted a raw
string path while resolution can hand back the canonicalized spelling of
the same directory depending on which branch wins under test ordering.
Compare through EvalSymlinks like the sibling redirect tests, and pin
selection provenance in the two tests that had not declared theirs.
Agent-Signature: claude-fable-5-high on behalf of maphew
* ci: retrigger - dolt-install/download infra outage (curl 56/503) killed 4 jobs
Agent-Signature: claude-fable-5-high on behalf of maphew
* build(bazel): enumerate cmd/bd/routing_role.go in bd_lib srcs
The PR adds cmd/bd/routing_role.go, whose detectUserRoleForActiveRepo is
called from create.go and routing_read.go. cmd/bd/BUILD.bazel lists
go_library srcs explicitly, so the unenumerated new file broke the Bazel
library compile:
cmd/bd/create.go:303:21: undefined: detectUserRoleForActiveRepo
cmd/bd/routing_read.go:52:19: undefined: detectUserRoleForActiveRepo
Generated by `bazel run //:gazelle` (one srcs row, idempotent; no deps row
owed because the library already carries internal/beads and
internal/routing). Base parity at 89348699b0 was 336/336 non-test .go files
enumerated in cmd/bd, so the gap was PR-introduced, not pre-existing.
* fix(routing): bind role to the selected workspace across a .beads/redirect
Maintainer review fixup for the adopted PR (review iterations 1 to 3).
Iteration 1 addressed the one gating major plus both minors and both nits
from its review synthesis. Iteration 2 addressed the major, the minor and the
nit that the next synthesis raised against that fixup, and iteration 3
addresses the minor and the nit raised against iteration 2; see "Review
iteration 2" and "Review iteration 3" below.
The major: routing_role.go ordered its guard `explicitBeadsSelection() ||
!rc.IsRedirected`, but every beads-dir resolver follows a .beads/redirect before
that guard can run (ExplicitBeadsDir via FollowRedirect, FindBeadsDir, and -C's
own resolution). So an explicit selection of a REDIRECTED workspace arrived
already rewritten to the storage root, short-circuited the redirect doctrine the
PR had just written, and bound beads.role to wherever the DATA lives — the same
misroute GH#4242 reported, one resolution step further in. Worse, it was silent:
`git config --get beads.role` succeeds outside a repo by reading GLOBAL config,
and routing.DetectUserRole returns on that first success, so its own "beads.role
not configured" notice never fired and a contributor workspace could be routed
with the user's global role with no diagnostic on any stream.
The remedy has to be anchored per shape, because the two selection shapes carry
the pre-redirect directory in different places:
- `bd -C <dir>`: applyChangeDirSelection has already rewritten BEADS_DIR to the
resolved target, so only the -C argument still names the chosen project.
CWD-anchored GetRedirectInfo() cannot see this case at all — under -C the CWD
is some unrelated directory — so this arm asks GetRedirectInfoFrom(dir),
which is documented for exactly this case (GH#5509) and deliberately does not
consult BEADS_DIR.
- exported BEADS_DIR: here the CWD *is* the selected workspace, so the
CWD-anchored probe is the correct one. The selection is vacuous when it
merely names that workspace's own redirect, under both spellings of it:
BEADS_DIR=<workspace>/.beads and BEADS_DIR=<storage>/.beads both arrive as
the storage dir (the bd-wayc3 tooling shape), so both fall through to
rc.CWDRepoRoot.
An explicit selection of a genuinely different, non-redirected project still
wins — that is the GH#4242 fix itself, and a control test pins it.
Also in this commit:
- A role path that is not a git repository now warns instead of quietly
inheriting global beads.role (new beads.RepoRootFor answers both "what is
the repo root for this dir" and "is this a repo at all").
- A .env-provided BEADS_DIR records selection provenance on the broad loader
too, not only via loadBeadsSelectionEnvFile. That loader early-returns
whenever BEADS_DB or BD_DB is already exported, and loadBeadsEnvFile then
imports the same .env line, so one .env line meant target-role or CWD-role
depending on the caller's unrelated BEADS_DB export. Internal rebinds are
unaffected: the marking is conditional on BEADS_DIR having been unset, which
is what separates user selection from prepareSelectedCommandContext's
per-command rebind.
- The four-way role-path choice is logged via debug.Logf, since the downstream
"failed to detect user role" warning fires on none of those branches.
- The PR's new routing test neutralizes BEADS_ROUTING_MODE / BD_ROUTING_MODE,
which viper binds onto the routing.mode key and which reds the test on any
host that exports them.
- routing_role.go now cross-references RepoContext.Role(), the second,
known-divergent role oracle in internal/beads. No behavior change there.
Tests: the explicit x redirect cell was the one combination the PR's new tests
left empty. Both probe shapes land as tests, plus the `bd -C <redirected-ws>`
shape, a non-redirected -C control, the non-repo warning, and both provenance
polarities. Each new pin was verified to FAIL against the pre-fix code.
Review iteration 2:
- Major: the non-repo warning above ran inside detectUserRoleForActiveRepo,
which create.go and determineAutoRoutedRepoPath called before resolving the
routing config. Routing is off by default and only auto mode reads the
role, so in any non-git beads project every bd create/list/ready printed a
4-line warning about a role nothing used. The leak also broke six
TestParity* characterization tests at the iteration-1 head:
CreateHumanOutput, CreateOnOccupiedIDRefuses, CreateParentNotFoundExits1,
CreateMissingDepTargetIsFatal, CreateJSONErrorShape and
ReopenErrorExits1Silently. Detection now runs only when the fully resolved
config can use its answer: new RoutingConfig.UsesUserRole (auto mode, no
explicit override, a role-specific repo configured) gates the new
detectUserRoleForRouting, which both call sites invoke after building the
config, so the legacy contributor.auto_route=true fallback to auto counts
where a raw routing.mode check would miss it. Side effect: routing's own
GH#2950 "beads.role not configured" notice is also skipped when routing
cannot use the role, as docs/multi-agent/routing.md already promises when
it calls `routing.mode explicit` "disabling role detection entirely".
- Minor: for an exported BEADS_DIR, selectedWorkspaceRepoRoot called the
selection vacuous when the CWD-anchored GetRedirectInfo reported a redirect
to it. With no redirect in the CWD repo, GetRedirectInfo falls back to the
raw BEADS_DIR, so a FOREIGN redirected workspace vouched for its own
redirect and the CWD repo's role was bound. The check now also requires the
redirect to sit in the CWD repo's own .beads (RedirectInfo.LocalDir). A
foreign redirected selection falls through to its storage root, which is
the answer a live command already reaches after the pre-RunE rebind, so
unit and command behavior agree. Binding the foreign workspace itself would
need the raw startup BEADS_DIR, which nothing keeps; the routing_role.go
comment records that limit.
- Nit: the non-repo warning prints at most once per process. An ID lookup
falls back to auto-routing once per missing ID, and each fallback re-ran
detection.
- Test isolation: the PR makes role detection read the process-wide
beads.GetRepoContext() cache, a sync.Once. Three existing tests chdir
between temp repos without resetting it and so read beads.role from an
earlier test's deleted repo: TestResolveCloseTargets/
contributor_mixed_local_and_routed,
TestDetermineAutoRoutedRepoPath_ContributorToPlanning and
TestOpenRoutedReadStore_ContributorRouting fail in a broad cmd/bd run at
86b8abff3f and 8dbfc6c721 and pass at base 89348699b0. The failure is
order-dependent, and the tests skip without a Dolt test server. Each now
rebuilds the cache after its chdir, as does the MaintainerToPlanning
sibling, which has the same exposure.
Iteration-2 tests: a property test pins UsesUserRole to
DetermineTargetRepoWithRule (true exactly when the answer varies by role,
across unset/auto/explicit modes and every override and repo combination). A
table test covers routing unset, explicit mode, auto without a role repo,
auto, and legacy auto_route. Two more cover the foreign redirected BEADS_DIR
cell and repeated detection (the once-guard). Each pin was mutation-checked:
dropping the gate, gating on the raw mode, or dropping the LocalDir guard,
the once-guard, the role-repo clause or the override clause turns a test red.
Validated (iteration 1): gofmt, go build ./..., go vet ./cmd/bd/
./internal/beads/, focused go test over cmd/bd role/routing/envfile/context
tests and ./internal/beads/ ./internal/routing/, gazelle (0 srcs rows owed),
and bazel build //cmd/bd:bd_lib //internal/beads:beads.
Validated (iteration 2): gofmt, git diff --check, go build ./..., go vet
./cmd/bd/ ./internal/routing/ ./internal/beads/ with and without cgo,
golangci-lint v2.10.1 --new-from-rev=HEAD on cmd/bd and internal/routing (0
issues), go test ./internal/routing/ ./internal/beads/, and a broad cmd/bd
routing/role/redirect/context/Parity run. The only reds on this host,
TestInitRedirect/RedirectCreatesDBInTarget,
TestBareParentWorktreeCoreCommandsWithoutRedirect and
TestServeIssueRolesComeFromBeneathTheHookDecorator, fail the same way at base
89348699b0. No files were added and the only new import is stdlib, so no
BUILD.bazel change is owed.
Review iteration 3:
- Minor: the iteration-2 guard counted a redirect as the CWD workspace's
own only when it sat in the CWD git root's .beads (Dir(LocalDir) ==
rc.CWDRepoRoot), which equates the workspace with the git root. From a
workspace nested below its repo root (<repo>/sub/.beads/redirect), or
from a git worktree that inherits its main checkout's redirect,
exporting that workspace's own .beads therefore moved role detection
from the CWD repo to the storage root: the env-dependent inconsistency
the iteration-1 vacuous rule exists to remove. Dropping the guard would
not have fixed it. When the repo root's .beads holds no redirect,
GetRedirectInfo checks BEADS_DIR itself, and prepareSelectedCommandContext
has rebound BEADS_DIR to the storage .beads before RunE. After that
rebind GetRedirectInfo finds no redirect in either shape, so the
iteration-1 rule bound the storage root there too. New
beads.GetDiscoveredRedirectInfo is GetRedirectInfo without the
BEADS_DIR override: the redirect discovery finds from the CWD (the repo
root's .beads, then the worktree-local redirect, the main checkout's
.beads for a worktree, and the walk-up from the CWD), via
findDiscoveredLocalBeadsDir, the BEADS_DIR-free half of
findLocalBeadsDir. The exported-BEADS_DIR arm now calls a selection
vacuous exactly when that discovered redirect exists and targets the
selected storage. A foreign redirected selection still falls through to
its storage root, because discovery from the CWD finds no redirect or
one with a different target.
- Nit: the foreign-selection test's comment now says only the exported
arm pins the guard. The rebound storage .beads holds no redirect, so
the rebind arm only checks that both states of the variable agree.
Iteration-3 tests: nested-workspace and worktree-without-own-.beads cells,
each with BEADS_DIR unset, as exported, and as rebound before RunE. Against
the unchanged 07c7373dfb code the four set-BEADS_DIR cells fail and both
unset controls pass. A new test pins the target comparison: from a
redirected workspace, an exported BEADS_DIR naming a different,
non-redirected project still binds that project.
TestGetDiscoveredRedirectInfo pins the new API against GetRedirectInfo in
both directions (a nested redirect that BEADS_DIR masks, and a BEADS_DIR
redirect the CWD does not hold). Five mutants each turn a test red: probing
with GetRedirectInfo again (the iteration-1 rule, which fails both rebind
cells and the foreign test), dropping the target comparison, dropping the
worktree-fallback tier, letting discovery honor BEADS_DIR, and restoring the
git-root guard.
Validated (iteration 3): gofmt, git diff --check, go build ./..., go vet
./cmd/bd/ ./internal/beads/ ./internal/routing/, golangci-lint v2.10.1
--new-from-rev=HEAD on cmd/bd and internal/beads (0 issues), go test
./internal/beads/ ./internal/routing/, and a focused cmd/bd run over the
role, routing, redirect, envfile and context-binding tests against the
Dolt test server (47 passed, 0 failed, 0 skipped). No files were added,
so no BUILD.bazel change is owed.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Osamu Okano <okano.osamu@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(dbproxy): prove the managed dolt owns its port; move a taken Beads-chosen port
The managed-local backend's dolt port comes from a bind-and-close
(proxy.PickFreePort) when bd writes the generated config. The dolt
sql-server binds it only later, after the proxy child has run dolt
config and init and booted the server. If another process takes the port
in that gap, dolt logs "Port N already in use." and exits. But
DoltServer.waitReady only dialed the port, so it accepted the other
process's listener as ready. The proxy then published proxy.pid, its
backend health check saw dolt gone, and it shut down. bd init's first
ping got "unexpected EOF" and every retry after that got "connection
refused". Under parallel tests this hit any test that starts its own
managed backend.
Readiness now requires proof that the process Start launched owns the
port:
- DoltServer sends the child's stdout/stderr through a watcher that
forwards to the server log. A dial counts only after dolt's own
"Server ready. Accepting connections." line has appeared on that
output. That line is info level, and every generated config uses
info. A config with a quieter log_level has no such signal and keeps
the dial-only check.
- A child that exits first is reported as the new server.ErrPortInUse
when its output said its port was taken.
Recovery: DoltServer.SetPortRepicker lets Start move the config to a
fresh port, re-read it, and relaunch, up to 5 ports. dolt config/init
run only on the first attempt. bd's repicker,
repickManagedProxiedServerPort, needs to tell a port Beads chose from
one an operator set, so generated configs now record the chosen port
on a "# beads-chosen-listener-port: N" line after the managed marker.
The repicker moves the port only when the file is Beads-generated,
carries that record, and its listener.port is still the recorded port.
Otherwise the port is treated as pinned and Start fails with
ErrPortInUse. That includes configs generated before this change. It
rewrites only listener.port and the record, through a yaml.Node so the
rest of the file is kept, and writes the file atomically.
db-proxy-child installs it for the local backend.
The proxy's waitForServerReady also re-checks Running after its dial.
Start has already proved ownership, and a running dolt holds its
listener, so only a backend that exited between the two checks could
let a dial reach another process.
Tests:
- server: a held port is not accepted as ready (ErrPortInUse; this
test fails on main), a repicker brings the server up on a new port
that the pid record and DSN both use, and a declining repicker ends
Start with ErrPortInUse.
- cmd/bd: the generated config records its port, a Beads-chosen port
moves while hand edits survive, and a hand-set port, a config
without the record, an operator config, and a stale in-use port are
all refused with the file left untouched.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(dbproxy): move a taken managed port via a runtime config, never config.yaml
This reworks cd00c5acb after review. That commit recovered from a taken
Beads-chosen port by rewriting the managed config.yaml. That broke the
file's own contract ("Never rewritten afterward; hand edits are
preserved", #4986), and #5024 had deferred that contract change to an
RFC.
dolt sql-server has no command-line way around the file: with --config,
-P/--port is silently ignored (checked against dolt 2.1.8 and 2.2.0, in
both argument orders). So on ErrPortInUse the proxy child now writes
proxy-child.runtime-config.yaml (server.RuntimeConfigFileName) in the
server root. That file is the operator config with only listener.port
moved to a free port. The child relaunches dolt from it and records the
effective port where runtime readers already look: the backend pid
record and the DoltServer's dial/DSN config. The runtime config is
removed when the server stops, when Start fails, and by the next Start.
config.yaml is never written.
- server.PortRepicker becomes server.PortConflictPolicy. It only decides
whether the port may move; the server does the move.
- bd's policy (managedPortConflictPolicy) allows a move when the file
carries the managed marker and either:
- has the port record and listener.port still equals it, or
- is byte-identical to the config bd generated before the record
existed, so existing unedited workspaces recover too.
- Everything else is pinned: operator configs, hand-set ports,
hand-edited legacy files, and configs with ${...} placeholders (a
runtime copy would put the expanded values on disk).
- The record line now says plainly that Beads runs on a free port
without editing the file, and that deleting the line or changing
listener.port pins the port. The record parser now requires the
digits to end at a space or line end and to be in 1..65535.
- ErrPortInUse messages say what to do: free port P, set listener.port
in <path> to a free port, or (for a generated file) delete it so
Beads regenerates it. The give-up message names the last port tried.
- A dolt that never logs the ready line is still not accepted. A
grace-period fallback would let a foreign listener through while dolt
is still starting. The timeout error now names the missing line, says
whether anything answered, and points at the escape hatch: at
log_level warning, readiness is dial-only.
- Port-conflict detection matches go-mysql-server's "Port host:port
already in use." and the Windows bind error, and requires the SQL port
in the kernel's bind error, so a metrics or MCP listener failure is
not taken for the SQL port.
- Spawn error paths reap with cmd.Wait(). cmd.WaitDelay is set, and a
comment notes that the backend's output is now a pipe into the proxy
child.
Tests:
- Output-watcher table tests: split, one-byte and CRLF writes, output
past the 4 KiB tail, the MCP ready line, port boundaries, the
go-mysql-server and Windows forms, another listener's bind error, the
unix-socket warning, and nil log.
- A real dolt at log_level warning starts through dial-only readiness.
- With a stand-in dolt (the test binary in fake mode, wired in
TestMain): Start gives up after maxStartPortAttempts, a missing ready
line is diagnosed, plus a positive control.
- With real dolt: a move keeps config.yaml byte-identical, runs from the
runtime config, and the runtime config is removed on Stop. A declining
policy and the no-policy remedy are covered.
- The bd policy's allow and pin cases.
- The managed-local lifecycle test's config/pid port check accepts the
runtime config.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(dbproxy): ask the port policy once, about the operator's port; copy raw config text
Re-review of the runtime-config rework found a regression. After the
first move, Start asked the PortConflictPolicy about the runtime port.
bd's policy re-reads config.yaml, whose listener.port is still the
operator's port, so it refused with "listener.port is A, not the in-use
port B". The "up to 5 ports" retry therefore never ran in production;
the fake-dolt test missed it because its policy always allowed.
Start now asks the policy once per Start, on the first conflict, about
the operator config's port. Ports Start picked itself are its own to move
again. Start also re-reads the operator config up front, so every Start
begins from that config's port.
The runtime config is now built from config.yaml's raw text
(servercfg.NewYamlConfig) instead of the env-interpolated
YamlConfigFromFile result. dolt interpolates the runtime file when it
reads it, so the old way expanded placeholders twice: "$$" escapes lost a
level and placeholder values landed on disk. The server reads the
runtime file back with interpolation for its own Dial/DSN view. Since
placeholders no longer expand on disk, bd's policy stops refusing
configs that contain them.
Tests:
- bd's real policy driving a real DoltServer with a stand-in dolt that
reports every port taken: Start makes five launches on five distinct
ports, starting with config.yaml's, then gives up. It is not refused
on the second move, and config.yaml stays unchanged.
- A frozen byte-for-byte literal of the config bd v1.3.0/v1.3.1
generates. The legacy render must equal it, and the policy must find
it eligible.
- The runtime config keeps placeholders and "$$" verbatim and is mode
0600, while the server dials the interpolated host.
- The give-up test asserts the policy is asked once, about the
operator's port.
- The missing-ready-line test timeout is raised to 30s for the slow
fake-dolt exec under race.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(dbproxy): classify a child that exits before its identity is captured
TestManagedPortConflictPolicy_ConsecutiveCollisions failed on the farm
with "capture child birth identity: procid: process is no longer
running", after 2 launches instead of 5. Its stand-in dolt reports
"Port N already in use." and exits immediately, and it exited before
Start captured its birth identity. Start treated that capture failure as
fatal, so an ErrPortInUse that Start could recover from became a hard
error. A real dolt that finds its port taken can exit just as fast, so
this race exists in the product, not only in the test.
Every spawn step before the child is handed to its supervising
goroutine (identity capture, root identity, pid record) now fails
through failSpawn. failSpawn kills and reaps the child; reaping also
drains its output into the watcher. The child's own exit then decides
the error:
- the child reported its port taken: ErrPortInUse, so the normal policy
and retry path runs;
- the child exited by itself for another reason: "exited (status N)
before startup completed";
- the child was alive and we killed it: the step's own error, as
before.
On Windows, a killed child reports an ordinary exit code, so there an
exit cannot be told from a kill. Only the port-in-use classification
applies there.
procid.Capture is reached through a package var so tests can make the
capture lose the race deterministically.
Tests, using a shell-script stand-in dolt that starts in milliseconds:
- a fast port-in-use exit that beats the capture is ErrPortInUse, and
with a policy it is retried up to the 5-port budget;
- a fast exit for another reason reports its status;
- a capture failure while the child is alive stays fatal and kills the
child;
- ten immediate port-in-use exits with the real capture are all
ErrPortInUse.
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>
* test(cmd/bd): run TestSharedServerConcurrent in the doltserver-cmd lane
TestSharedServerConcurrent was gated on BEADS_TEST_SHARED_SERVER=1, which
no CI job or Bazel target sets, so it skipped everywhere (the only
non-lane skip in //cmd/bd:bd_dolt_server_test). It predates the workspace
gate (#5093), and once enabled it failed immediately: in shared-server
mode every project's physical root is the one shared dolt dir, and bd init
holds that root's gate EXCLUSIVELY with a 5s wait, so concurrent inits of
different projects refuse each other ("bd init refuses to run over live bd
activity on this workspace"). That exclusivity is deliberate, and a single
init takes ~8s here, so the test now inits its projects one at a time; the
concurrent multi-writer workload phase, which is what the test exists for,
is unchanged.
- Also run when BEADS_TEST_SHARED_SERVER_CONCURRENT=1 (distinct from
BEADS_TEST_SHARED_SERVER, which scripts/test.sh also reads to start a
shared server).
- bd_dolt_server_test sets it with BEADS_TEST_SS_DIRS=2 and
BEADS_TEST_SS_CLIENTS=6: a bounded smoke (~50s, 3 writers per database)
against the lane's hermetic local dolt sql-server on an ephemeral port.
- Under BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 a server that cannot start
fails the test instead of skipping it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): size and shard //internal/storage/uow:uow_test for its configless run
uow_test timed out at the default medium 300s whenever it ran without a
lane config (`bazel test //internal/storage/uow:uow_test`, also on
origin/main). No CI lane runs it that way: --config=ci and
--config=integration set BEADS_TEST_SKIP=dolt, so its Dolt-backed tests
skip and the target takes 3-14s there (BEP of recent ci/integration
runs), and the full Dolt workload runs as uow_dolt_test (8 shards, slowest
~90s remotely on main) and uow_docker_test (4 shards, large).
Without a config nothing skips: every newTestUOWProvider test starts its
own dolt sql-server (~6-8s apiece) and the package needs ~7 min serially;
TestBatchApplyContract alone is ~1 min because BoundsTheItemCount applies
1000+1001 real items by design. That is the variants' workload, not a slow
test to fix, so give the base target the variants' shape: size = "large"
(900s) and shard_count = 4. Locally, on a host at load ~185, the shards
took 162-309s (unsharded it was killed at 300s); under --config=ci the
four shards still pass in seconds.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): reset cobra flags between in-process runs; keep them out of parallel tests
runBDInProcess and runBDInProcessAllowError execute the package-level
rootCmd tree again and again in one process, and cobra never resets a
flag between Execute calls: a value one invocation parsed (create's
--title, --labels, list's --status, ...) and its Changed bit stayed on the
FlagSet, so the next invocation saw it, and a slice flag that had been
set appended to the stale value instead of replacing it. With a Dolt test
server (the only setup in which these tests run) that failed about 20
TestCLI_* tests depending on suite order.
TestMain now snapshots every flag of the tree (snapshotCommandFlags,
after all init()s registered them, before any test runs) and both runners
put the tree back before and after each run (resetCommandFlags): the
pointee of each flag.Value is restored (for pflag's scalar types that is
the bound variable; for slice types it also clears the internal "changed"
bit, so the next Set replaces), slice contents via SliceValue.Replace,
and Changed=false. TestResetCommandFlagsRestoresEveryFlag sets every flag
of the real tree and checks the reset. The ad-hoc --title reset in
TestCLI_CreateRejectsEmptyTitle_ProxiedServerMode is no longer needed.
Seven TestCLI_Comment* tests called t.Parallel() around the runners.
inProcessMutex serializes the runners only against each other, so their
chdir, stdio swap, env and config re-initialization raced every other
parallel test (data races on config globals; TestCobraParallelPolicyGuard
failing to read its own source files after a concurrent chdir). They run
serially now, and the guard treats the two runners like rootCmd.Execute.
Also two stale TestCLI_Create* cases: DryRunWithRigPrefix exercised a
create --prefix flag that no longer exists, and the flag-like-title cases
passed "--help" or "--foo-bar" where cobra parses them as flags; they now
pass the title after "--", the only way it reaches create's own guard.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): fix the ADO round-trip and bulk-delete tests that rotted unseen
Both need the integration tag and a Dolt test server, which no CI lane
gave cmd/bd (BEADS_TEST_SKIP=dolt everywhere), so they failed unnoticed:
- TestADORoundTrip* stored ado.pat in the database. ado.pat is a secret
read only from config.yaml or AZURE_DEVOPS_PAT (config.IsYamlOnlyKey),
so the tracker found no PAT. The fixture sets AZURE_DEVOPS_PAT.
- TestBulkDeleteNoResurrection expected GetIssue to return (nil, nil) for
a deleted issue; the Dolt store reports storage.ErrNotFound.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): fix parity, completion and notion tests that only fail with a Dolt server
These are Dolt-gated (integration tag + test server), so no CI lane ran
them and they rotted:
- TestParityCreate*/TestParityReopenErrorExits1Silently: bd create
auto-routes via routing.DetectUserRole("."), which warns "beads.role
not configured (GH#2950)" on stderr when the working directory's git
config has no beads.role. The suite pins the configured case, so the
parity env now sets beads.role=maintainer in a test-owned global git
config ($XDG_CONFIG_HOME/git/config; the role lookup scrubs every
GIT_CONFIG_* variable, so those cannot be used).
- TestIssueIDCompletion: issueIDCompletion resolves a database path
before looking at the open store and returns nothing when there is
none; the test now sets dbPath to its store's path.
- TestIssueIDCompletion_UsesWorktreeFallbackWhenStoreNil and
TestGetNotionConfigReadsDBPathWhenStoreUnset: the code under test
reopens the store from metadata.json, which names a database but not
the per-test branch of the shared database that newTestStore uses, so
the reopened store saw none of the test's rows. They now use their own
database (newTestStoreIsolatedDB).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): fix stale doctor/e2e/autocommit/readonly Dolt-gated tests
These need the integration tag and a Dolt test server, which no CI lane
gave cmd/bd, so they rotted unseen:
- TestE2E_DoctorFixMetadataRoundtrip, TestE2E_MigrateDoltMetadata,
TestDoctorCheckHealthReportsVersionMismatchOnRepoLocalPort: bd init now
defaults to embedded mode, where `bd sql` and `bd dolt start` are
refused. Init with --server on a repo-local server of their own
(repoLocalServerEnv: the suite's shared-server port vars cleared, server
stopped at cleanup) and start it explicitly, since BEADS_TEST_MODE=1 never
auto-starts one. MigrateDoltMetadata's DELETE also needed `key` quoted.
- TestDoctor{Conventions,Pollution}MaxRows_EnvOnly_Exits2: bdRunRaw drops
every BEADS_* variable, so the subprocess hit dolt.New's test-database
firewall (exit 1) before the row cap; pass BEADS_TEST_SERVER=1.
- TestDoltAutoCommit_On_WritesAdvanceHead: the embedded engine keeps its
data under .beads/embeddeddolt, not .beads/dolt; findDoltRepoDir looks
in both.
- TestValidateCheck_AllClean: bd doctor validate runs five checks since
the cross-table duplicates check was added.
- TestConfigValidateReadOnlyIsHermetic: readonly commands take a shared
workspace gate, whose lock file (.beads/dolt.gate.lock) workspacegate
creates on first use by design; compare the .beads tree without gate
lock files.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): undo each in-process execution's env and storage-mode leaks
Every in-process run of the bd command tree (runBDInProcess and the many
tests that call rootCmd.Execute directly) leaves process state behind:
PersistentPreRun exports the selected workspace as BEADS_DIR, loads its
.beads/.env, and records the workspace's mode in serverMode /
proxiedServerMode. With a Dolt test server, later tests in the same shard
then resolved a deleted fixture ("no active beads workspace found",
"migration sidecar is missing"), ran subprocess bd against the wrong
workspace ("recorded as proxied-server in .beads/metadata.json"), or took
the proxied path in RunE-level tests ("proxied-server UOW provider not
initialized", a nil-UOW panic in reopenProxiedResolve that killed a shard).
TestMain now registers a cobra initializer/finalizer pair
(installExecuteIsolation) that snapshots the environment and the two mode
globals when an execution starts and restores them when it ends; the
runners' restoreEnvSnapshot shares the helper. TestDoltConfigEnvironmentOverrides
used os.Setenv + defer os.Unsetenv, which deleted the suite's
BEADS_DOLT_SERVER_PORT (the test server's port) for every later test; it
uses t.Setenv now.
Full integration-tagged cmd/bd suite against a hermetic dolt (16 shards):
18 order-dependent failures and the shard panic gone; the 27 remaining
failures all fail alone too.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(init): keep --quiet quiet through the Claude/Codex/Cursor auto-setup
`bd init --quiet` ("Suppress output") still printed the project
integration installers' progress to stdout ("Installing Claude hooks for
this project...", "Claude Code integration installed", ...): the
installers write to os.Stdout unconditionally. Point stdout at the null
device around them while quiet; their failures keep going to stderr as
before. Found by TestInitCommand's quiet case, which asserts no output and
had not run in CI (Dolt-gated).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(init): bring the Dolt-gated init tests up to the current init contract
These tests need a Dolt test server, so no CI lane ran them and they
drifted from the product:
- Embedded is init's default mode, so the server-mode assertions
(.beads/dolt, opening the database on the test server, dolt_mode
"server" in metadata.json) now pass --server (TestInitCommand,
TestInitAlreadyInitialized, TestInitRedirect, TestInitBEADS_DIR,
TestInitDoltMetadata, TestInitDoltMetadataNoGit, TestInitDatabaseFlag's
metadata subtests). The in-process ones reset rootCmd's flags around
themselves so --server cannot leak into later in-process inits.
- Each server init gets its own --database: the suite shares one test
server, and a "test" database another test created belongs to another
project (init refuses: PROJECT IDENTITY MISMATCH).
- The marker tests seed a current-era version witness: the legacy-upgrade
guard refuses a non-empty .beads/dolt without one.
- The redirect test provisions the canonical target with config.yaml: bd
ignores a redirect to a directory with no project files (#4692).
- Shared-server inits get a free port of their own
(sharedServerTestEnv): the inherited BEADS_DOLT_SERVER_PORT is the
suite's test server, which a shared-server start refuses as another
project's, and the default shared port is 3308, a developer's live
server.
- --shared-server's config.yaml is now nested YAML (dolt: shared-server:
true); parse it instead of matching the old flat line.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): run the Dolt-gated tests that skipped on a bare dolt.New
setupTestDB (config, kv and Linear round-trip tests), setupGatedTestDB
(mol ready --gated) and the rename-prefix and bd sql tests opened stores
with dolt.New(&dolt.Config{Path: ...}): no server port, no
CreateIfMissing, so against a running test server they got "database ...
not found" and skipped as "Dolt server not available". They now use the
suite's newTestStore helpers (skip only when no test server runs), and
what that exposed is fixed test-side:
- TestCustomStatusConfig: custom_statuses is read back ORDER BY name;
look statuses up by name / expect name order.
- TestLinearRoundTripCoreFields, TestLinearPullMilestonesCreatesEpicHierarchy:
linear.api_key is a yaml-only secret (LINEAR_API_KEY), push now needs an
explicit linear.state_map, and batch push uses TeamLabels and
issueBatchCreate, which the mock server now answers.
- TestSqlCommand: bd sql refuses in the default embedded mode; set
serverMode for the server-backed store, and stop discarding RunE errors.
- TestE2E_AutoStartedRepoLocalServerPersistsAcrossCommands skipped on
this process's embedded mode although every bd it runs is a subprocess
on a --server workspace; gate on the dolt binary instead and stop the
auto-started server at cleanup.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): no fixed "unused" port, no swallowed JSON, no leaked front-door server
Three more things the Dolt-backed cmd/bd run exposed:
- TestTestServerConnection, TestSharedServerCfgNilHonorsSharedServer and
the two TestLegacyGuard* e2e tests pointed bd at 127.0.0.1:59999 as a
port nothing listens on. Any process on the host may hold it; a
listener that accepts and resets turns the expected "connection
refused" / "Dolt server unreachable" into another error. They take a
just-freed port from closedLoopbackPort (testutil.FindFreePort) now.
- TestDoltSetConfigJSONOutput and TestDoltSetConfigWithUpdateConfig
created .beads 0755, so bd's permissions warning landed in the JSON
under test and the tests skipped ("output not pure JSON") every run.
The fixture uses 0700, and non-JSON output fails instead of skipping.
- TestMigrateDoltModeFrontDoor's closing show/list auto-start a
repo-local server after the reverse migration; nothing stopped it, so
the suite's leak check failed (when the opt-in
BEADS_TEST_MIGRATION_FRONTDOOR suite runs). It stops it at cleanup.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): advisory cmd/bd Dolt-server tier (bazel-cmd-dolt)
No CI lane ran cmd/bd's Dolt-gated tests (TestCLI_*, the init and
store-backed suites, the doctor/e2e tests): main.yml's integration shards,
nightly's Full Test Suite, and Bazel's --config=prcore/ci and
--config=integration all pass BEADS_TEST_SKIP=dolt, so cmd/bd's TestMain
never starts a test server and those tests skip; the proxied and embedded
tiers run only their manifests' tests. They rotted unseen.
//cmd/bd:bd_dolt_server_test (tag dolt-server-cmd) runs the whole
integration-tagged cmd/bd suite, the integration build's bd_test, against
a hermetic dolt sql-server: BEADS_TEST_DOLT_SERVER=local starts it from
the pinned dolt in the test wrapper's runfiles, and
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 fails the target instead of skipping
into a cached pass. No test selection: the Go binary shards itself over
every top-level test (32 shards), so each runs exactly once, and
check_testcases.py fails a shard that ran none. --config=doltserver-cmd
has exactly --config=integration's build flags, so the two lanes share
bd_test's compile; prcore/ci and integration exclude the tag.
bazel.yml's new bazel-cmd-dolt job runs it exactly where bazel-integration
runs (same if: remotely on the farm for same-repo PRs, fork-ro/fork-rw,
and locally with the read-only cache in mode cache for forks). It is
advisory: job-level continue-on-error keeps a failure out of the call's
aggregate (BAZEL), and pr.yml's ci-gate reads its result (BAZEL_CMD_DOLT)
but requires it only while the committed top-level flag
BAZEL_CMD_DOLT_REQUIRED is "true" (now "false"; flipping it is the one
change needed). bazel-gate.sh accepts its skip in modes skip and local.
Policy tests: a third lane category in TestBazelLaneIsGatedAlongsideLegacy
(bazelFlagGatedLanes: gate env wired, never statically required, added by
the run script exactly when the pinned flag is "true"), the gate
simulation over every mode with the flag off (advisory: nothing it
reports reddens the gate) and on (exactly a gated lane), the cache-mode
and execution-mode checks, the tag taxonomy and prcore/integration
exclusions, and TestBazelCmdDoltJob (job steps, timeouts, .bazelrc
config equal to integration's build with no dolt skip or test selection,
the target's dolt-server rules, and bd_test's env repeated).
Measured locally (all fixes in this series, 32 shards, 16 at a time on a
shared host): 3267 top-level tests, all shards pass, max shard 313s (one
5001-issue export test, 214s, sets it), mean 100s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(init): hand the project installers a writer instead of swapping os.Stdout
The --quiet fix earlier in this series pointed the process-global
os.Stdout at the null device around the Claude/Codex/Cursor installers.
That works, but it mutates a global from inside a cobra Run: anything else
writing to stdout meanwhile (a goroutine, a future concurrent installer)
would vanish, and a concurrent read of os.Stdout is a data race.
The installers already write through env structs with stdout/stderr
fields. setup.ProjectInstallOutput carries the two writers, and
InstallClaudeProjectTo / InstallCodexProjectTo / InstallCursorProjectTo
use them (the old entry points keep the process streams). init passes
QuietProjectInstallOutput() under --quiet: progress discarded, error lines
still on stderr. The proxied-server init path (domain adapter
InstallClaudeProject now takes quiet) does the same, so its
"Installing Claude hooks..." is quiet too.
Consistent error policy under --quiet: errors still reach stderr. init's
own "Warning: failed to setup <installer>" lines were suppressed under
--quiet while the installers' "Error:" lines were not, and some installer
failures (Cursor rules) print nothing themselves; the warnings now print
whether or not quiet, like the installers' errors.
Coverage in required lanes: TestProjectInstallersReportToTheGivenOutput
(cmd/bd/setup) and TestEmbeddedInitA/basic, which now asserts that
`bd init --quiet` with agents enabled installs the Claude hooks and prints
none of the installers' progress (verified to fail with the quiet output
disabled).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(export): exercise the incremental-export fallback with a small threshold
TestTryIncrementalExport_ThresholdExceededFallsBack seeded
incrementalExportThreshold+1 = 5001 issues to cross the threshold. Batch
create is one transaction but still several statements per issue, so under
-race against the shared test server it took ~214 s, the longest test in
cmd/bd's Dolt-backed suite by far. The behaviour under test is only
"more changed issues than the threshold -> full export fallback".
incrementalExportThreshold becomes a var (same value), and the test, which
is not parallel, sets it to 20 and seeds 21 issues: 214 s -> 0.6 s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): tighten the flag-reset self-test, guards and canaries
Review follow-ups:
- TestResetCommandFlagsRestoresEveryFlag no longer skips a flag it cannot
set: a flag type without a sample value, a Set error, or a non-pointer
Value (which resetCommandFlags could not restore) is an error, so a new
flag type cannot go untested. resetCommandFlags documents that it also
resets flag-bound package globals.
- TestCobraParallelPolicyGuard treats .ExecuteC/.ExecuteContext/
.ExecuteContextC like .Execute (the per-execution isolation writes the
mode globals; a parallel execution would race).
- TestConfigValidateReadOnlyIsHermetic ignores only the gate a readonly
command takes (.beads/dolt.gate.lock and its .info sidecar), not any
"*.gate.lock*" file, so a new unexpected gate still trips the canary.
- TestCLI_CreateRejectsFlagLikeTitles: a bare `bd create --foo-bar` must
fail and create no issue (bd-2c0's intent), next to the "--" cases.
- TestCustomStatusConfig cites why statuses come back in name order: the
normalized custom_statuses table (#2961, 8537d943b) has no ordinal and is
read ORDER BY name, like custom_types; the test predates it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the cmd/bd Dolt-server tier in 16 shards
Each shard pays ~30-40 s of fixed cost (TestMain plus its own dolt
sql-server), so 32 shards spent roughly 40% of the lane's executor time on
setup and added 32 farm actions to every PR touching cmd/bd. With the
5001-issue export test cut to under a second, 16 shards measure (locally,
--nocache_test_results): max 186 s, mean 137 s, 2,187 executor-seconds
(vs ~2,800-3,200 at 32), all 3,267 top-level tests, every shard passing.
TestBazelCmdDoltJob pins the count; bazel.yml's timing comment is
restated (cache mode ~20-30 minutes).
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(proxy): fail fast with a MySQL error when the external upstream is unreachable
A proxied-server command against a stopped external Dolt upstream stalled
~20-30s before failing with a bare "invalid connection". The local db proxy
stays up, so on a refused backend dial (or a front such as stunnel/socat
that accepts and closes because its own upstream is gone) it simply closed
the client connection. The MySQL driver reports that as invalid
connection / unexpected EOF, which the uow bootstrap ping (#6003) classifies
as a transient drop and retries with exponential backoff for its whole 30s
budget. Retrying cannot help: the proxy already proved the upstream at its
own startup, and the outage is the upstream's.
The proxy now answers such a connection itself with a MySQL ERR packet
(2003, HY000) in place of the server greeting, naming the upstream and the
cause, exactly as a real server refuses a connection before the handshake.
The driver surfaces it as a *mysql.MySQLError, which the bootstrap retry
already treats as permanent, so the command fails in ~0.1s with an
actionable message. Only shapes that prove the upstream is not serving
qualify: ECONNREFUSED/ENOENT/EHOSTUNREACH/ENETUNREACH on dial, or a backend
that reaches EOF having sent zero bytes (a MySQL server always speaks
first). A dial timeout or a drop after the greeting keeps the plain close
and the client's transient retry.
External backends only: a managed (local sidecar) backend is owned by the
proxy and its dial can be refused transiently while bd drives it (the
full proxied lane caught TestProxiedServerInitExplicitBeadsDirIsAuthoritative
hitting exactly that mid-init when this applied to every backend), so
managed backends keep the bare close and the client's bootstrap retry.
TestExternalProxyOutageAndRestoreReDialsTCPAndUnix asserted the old
silent close during an outage; it now asserts the ERR packet.
With the latency fixed, TestProxiedOutageReconnectAcceptanceMatrix is
renamed into the proxied discovery pattern as
TestProxiedServerOutageReconnectAcceptanceMatrix and placed in the Bazel
30-shard block by gen_proxied_shard_manifest.py's incremental --write
(shard 8). The frozen legacy 15-shard block is untouched; the test
hash-distributes there like every other test added since it was frozen.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(proxy,uow): retry the proxy's upstream-outage report for ~1s; hedge the zero-byte case
Review follow-up to the fail-fast change.
A zero-byte close from the upstream is not proof it is down: Dolt closes
queued connections without a byte when max_connections/back_log are full,
when a queued connection times out, and while it shuts down for a
restart; an L4 front does the same while its target is replaced. Its
report now says "closed the connection before the MySQL greeting (down,
restarting, or at its connection limit)" instead of "unreachable", and
the comment no longer claims proof.
Refusals and endpoint churn also lost #6003's retry entirely, so an
external Dolt restart or a Service with no ready endpoints failed a
command at once. The client now retries the proxy's report
(proxy.IsUpstreamOutageError: 2003 with the "beads db proxy: " prefix)
for upstreamOutageRetryWindow (1s) from the first time it sees it, with
the backoff clamped so the last attempt lands at the window's end; other
transient errors keep the 30s budget. A real outage still fails in about
a second, inside the acceptance test's 3s bound.
Also: the dial report drops Go call-site wrapping ("dial tcp H:P:
connection refused"), truncation keeps UTF-8 intact, the comment states
how the packet differs from a real server's pre-handshake ERR (keeps the
'#'+SQLSTATE marker for vitess; 2003 is a client code chosen on purpose),
a Stats counter for reported outages, and the isTransientPingError
paragraph is reflowed and corrected.
Tests: pingWithRetry retries the report inside the window and gives up
at its end without using the full budget; openDB against a front that
plays the proxy (its real packet) and comes back 300ms after the first
connection succeeds in one call, and fails in about the window when it
never does; NewProxyServer enables the report for external backends
only; the dial message carries no Go type names; rune-safe truncation.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(proxied): fail, not skip, socat-bridged subtests in the Bazel lane
The external-unix front-door matrix subtest and both outage/reconnect
matrix subtests bridge an external endpoint with socat and skipped when
it was missing, so they could stop running without anyone noticing (the
parent test still passes). requireSocat now fails them when
BEADS_TEST_REQUIRE_SOCAT=1, which //cmd/bd:bd_proxied_test sets (its
remote workers have socat; a recent main run's external-unix subtest
passed there). The legacy GitHub 15-shard jobs have no socat and leave
it unset, so the subtests keep skipping there. The check now runs before
the upstream Dolt server is started, so a skip no longer pays for one.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(proxied): measured weight for the outage matrix; pin it to legacy shard 1
Give TestProxiedServerOutageReconnectAcceptanceMatrix a duration entry
(80s: local runs measured 55-79s alone, 60-70s in its shard, and review
68-109s under load) and re-place it with the generator's incremental
--write: it moves from 30/8 to 30/11, one line, nothing else moved. The
heaviest estimated shard is now 435s against a ~357s median; a repack
would even that out but moves most assignments, so it is left to a
separate CI-only change that refreshes all durations together.
Legacy 15-shard block: the test would hash onto shard 14, already ~13.5
of the 15 min timeout on main. It is pinned to shard 1 (~6.5 min in
recent main runs) under the block's reviewed-pin rule; it skips there
today (no socat), and the pin keeps shard 14 safe if that changes.
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>
The Bazel client's JVM defaults to 25% of RAM, about 2 GB on the 8 GB
2 vCPU Blacksmith runners every remote lane runs on. //... analysis fits
today with little headroom, and the plan moves more lanes and targets
onto these runners. write-bazelrc.sh now writes
`startup --host_jvm_args=-Xmx4g`: a startup option, so it changes no
action key and only restarts the server. Verified with Bazel 9.2.0:
`bazel --bazelrc=<generated rc> info max-heap-size` reports 4294MB.
gascity's W1 byte-copies this composite, so the change lands here first.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
beads allows every action today (allowed_actions: all, no SHA pinning),
so a fork PR's workflow can call any action, including Blacksmith's
sticky-disk action that commits state later trusted runs restore.
.github/allowed-actions.json is the exact body of the selected-actions
setting: GitHub-owned actions plus gascity's list plus the third-party
actions beads uses. That includes DeterminateSystems/nix-installer-action,
which determinate-nix-action calls, and peter-evans/create-pull-request.
Every uses: under .github is already pinned to a full commit SHA. The new
ci_actions_policy_test.go keeps it that way: each reference is local or
owner/repo[/path]@<40-hex>, and allowed by the file, so the repository
setting can switch to allowed_actions=selected with
sha_pinning_required=true without breaking a workflow. Negative controls:
an @v6 tag ref and an unlisted owner/repo each fail the test.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Main's "Test (proxied-server cmd 5/15)" has hit the 15m -test.timeout in
6 of the 9 Main runs since #7129 where the shard ran to completion.
That PR renamed 12 proxied tests into TestProxiedServer* discovery.
They are not in the frozen 15-shard legacy block, so they hash-place,
and two landed on shard 5:
TestProxiedServerStorageClass (nine parallel inits, the heaviest of the
12) and TestProxiedServerServeRefusesAStaleCheckpointWithGone. Shard 5
went from 430-620s of job time to 800-950s. In those runs the timeout
fired while TestProxiedServerMolReadyGated's parallel subtests were still
queued behind the rest of the shard. That test is the victim, not a
pathological one. Shard 3 (also hash-loaded) runs 810-870s, within about
a minute of the same limit.
Measured locally (4 pinned CPUs, GOMAXPROCS=4), shard 5 took 897s with
its current test set and 524s with the pre-#7129 set.
Pin those two tests, plus shard 3's two heaviest hash-placed tests
(TestProxiedServerListComments and
TestProxiedServerServeRefusesAStreamOnADisabledJournal), onto the legacy
shards with the lowest measured job time: 14, 7, 4 and 1. Every test
already listed in the block stays where it is, so shard 5 is back to its
pre-#7129 test set. pr-risk.yml's fork jobs read the same block, so they
get the same relief. The script's 15m timeout, the job and step
timeouts, and the Bazel 30-shard block are unchanged. The block header
and the generator's legacy header now say a reviewed pin is allowed.
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(delete): drop stale TestDeleteIssueUnsupportedStorage
The test asserted that deleteIssue returns "delete operation not supported
by this storage backend" when the global store is nil. That error came
from a type assertion to a deleter interface that a5da57e39 (Phase 7:
remove storage factory/memory backend/provider abstraction) removed:
store is now storage.DoltStorage, whose method set always includes
DeleteIssue, so there is no unsupported backend left to report. With the
assertion gone, the test's nil store is just a nil-interface method call
and panics at deleteIssue, killing the whole cmd/bd test binary.
The nil store is not reachable in production: deleteIssue's only caller
(bd doctor --check=pollution --clean) has already queried the store to
find the issues it deletes. So the test constructs an impossible state
for a removed behavior; delete it rather than reintroduce a dead branch.
No CI lane ran it: it needs the integration tag and a Dolt test server
(testDoltServerPort != 0), and every integration lane that builds
cmd/bd (main.yml integration cmd/bd shards, nightly Full Test Suite,
bazel --config=integration) sets BEADS_TEST_SKIP=dolt, while the
proxied/dolt-server lanes run only their TestProxiedServer*/
TestServerMode* manifests. It only ran in local integration runs with
Docker or a matching dolt.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): build the fallback bd by package path, independent of CWD
When BEADS_TEST_BD_BINARY is unset, buildEmbeddedBD and its sibling
helpers fall back to `go build -tags gms_pure_go -o X .`, which builds
whatever package is in the process's working directory. That is cmd/bd
only if the first caller of the sync.Once has not chdir'd into a fixture
and the test binary was started in cmd/bd. A precompiled test binary run
from the repo root (the pr-risk pattern) builds the root library package
instead: go writes a non-executable archive to X and the test dies with
"fork/exec .../bd: permission denied" (reproduced with TestEmbeddedCount).
Add goBuildBDCommand: the same non-race -tags gms_pure_go build CI
prebuilds BEADS_TEST_BD_BINARY with, naming
github.com/steveyegge/beads/cmd/bd explicitly and running in cmd/bd's
source directory, resolved at package init (this file's compiled-in path,
else the start-up working directory) before any test can chdir. Use it in
buildEmbeddedBD and the other copies of the pattern (cli_fast,
doctor_repair, explicit_db_nodb, init_permissions, scripttest,
shared_server, buildBDForInitTests); migrationFrontDoorBinary keeps its
untagged cgo build but gets the same package path and directory.
TestGoBuildBDCommandIsCWDIndependent checks it from a chdir'd temp dir
with go list (no link).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(cmd/bd): stop in-process bd from leaking BEADS_DIR into later tests
TestResolvedConfigRepoRoot's two CWD-discovery subtests ("uses local
workspace from subdirectory", "uses worktree fallback when local .beads
is absent") failed in full cmd/bd runs with "no active beads workspace
found" but passed alone. Cause: runBDInProcess / runBDInProcessAllowError
run rootCmd.Execute in the test process, and PersistentPreRun exports the
selected workspace with a raw os.Setenv("BEADS_DIR", ...) that nothing
restores. After any TestCLI_* test, BEADS_DIR still names that test's
since-deleted bd-cli-test-* fixture; FindBeadsDir honors an explicit
BEADS_DIR before walking from CWD, finds nothing there, and reports no
workspace. Minimal repro: -run '^(TestCLI_Ready|TestResolvedConfigRepoRoot)$'.
The leak also broke later TestCLI_* tests themselves: with
-run '^(TestCLI_.*|TestResolvedConfigRepoRoot)$' against a Dolt test
server, failures drop from 47 to 20 with this change and no new ones (the
remaining 20 are leftover cobra flag values between in-process runs, a
separate issue).
- runBDInProcess(AllowError): snapshot os.Environ() around Execute and
restore exactly the keys it changed (restoreEnvSnapshot).
- TestResolvedConfigRepoRoot: clear BEADS_DIR (t.Setenv) in the two
subtests that test CWD discovery, so neither a leak nor a developer's
exported BEADS_DIR decides them.
Not host-specific (HOME, global git config and ceilings play no part),
and CI never saw it: the TestCLI_* leakers need a Dolt test server, and
every CI lane that runs cmd/bd's integration tests sets
BEADS_TEST_SKIP=dolt, so they skip and BEADS_DIR is never set.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(delete): expect storage.ErrNotFound after delete in TestDeleteIssueWrapper
"successful issue deletion" asserted that GetIssue returns (nil, nil)
for a deleted issue; the Dolt store reports a missing issue as
storage.ErrNotFound, so the subtest failed with "GetIssue failed: not
found: issue test-xxx" whenever it ran. Like TestDeleteIssueUnsupportedStorage
it needs the integration tag and a Dolt test server, which no CI lane
provides to cmd/bd (BEADS_TEST_SKIP=dolt), so it rotted unseen.
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>
TestSharedServerModeServeGlobalReportsTheServedDatabase was parked outside
the proxied discovery pattern because `bd serve --global` exited 1 on the
#5920 shared-store migration guard (v65 -> v69). The guard was right; the
test setup was wrong.
The workspace was a plain `bd init --server --server-port <test server>`
that only flipped BEADS_DOLT_SHARED_SERVER=1 afterwards. Shared-server
mode deliberately ignores the workspace's own dolt_server_port and
resolves the machine-wide shared server (BEADS_DOLT_SERVER_PORT, the
shared port file, ..., then the 3308 default), so every --global command
dialled 127.0.0.1:3308 rather than the hermetic test server. On CI nothing
listens there; on a developer machine running a real shared server, the
test read that server's own beads_global (created by an older bd at v65)
and serve asked to migrate it. beads_global was also never provisioned on
the test server, because only `bd init --shared-server` does that.
Set the workspace up the way an operator joins an externally-managed
shared server: `bd init --shared-server --external` (provisions
beads_global on the test server at the current schema) plus
BEADS_DOLT_SERVER_PORT naming that server. No product change: the guard
correctly refuses an un-consented migration of a shared database, and a
freshly created one (version 0) passes it.
Rename the test into the TestServerMode* discovery pattern and add it to
the Bazel 30-shard block via the generator's incremental --write. The
frozen legacy 15-shard block is untouched; the name hash-distributes there
(shard 12/15).
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
TestProxiedServerSQLDatabaseFlag (and its sibling
TestProxiedServerMultiStatementSQL) flaked in the proxied-server tier with
bd init --proxied-server failed: exit status 1
[mysql] packets.go:58 unexpected EOF
Error: failed to open uow provider: uow: ping db: dial tcp ...: connection refused
Both called bdProxiedInit with no backend flags, so every run spawned a
managed-local dolt sql-server. Its port is picked bind-and-close
(proxy.PickFreePort) when bd init writes the managed config and bound by
dolt only after the proxy child runs dolt config/init and boots the
server. Under the parallel tier another process can bind that port in the
gap. dolt then logs "Port N already in use." and exits, but
DoltServer.waitReady and the proxy's waitForServerReady only dial the
port, so they accept the foreign listener and the proxy publishes
proxy.pid. Its 100ms backend health check then sees dolt gone and shuts
the proxy down: init's first ping gets EOF, and every retry for the
rest of the 30s budget gets connection refused.
These tests cover bd sql, not the managed-local lifecycle, so move them
to newSharedProxiedProject like most of the suite. The shared server's
startup (testutil.localDoltServer) waits for dolt's own ready line and
retries on a new port, so it does not have this race. The second
database name now comes from the project's unique database, because the
server is shared.
The product race in the managed-local backend (dial-only readiness plus a
bind-and-close port) is unchanged. The code already marks it as deferred
in PickFreePort.
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(git): canonicalize PinNoRepositoryUnderForTesting root so the pin matches on macOS
On macOS t.TempDir()/os.TempDir() live under /var/folders/..., but /var is
a symlink to /private/var and getcwd(2) reports /private/var/folders/....
underPinnedRootForTesting compared the raw pin against os.Getwd() with a
string prefix test, so the pin never matched there and
TestPinNoRepositoryUnderForTestingSurvivesResetCaches failed on every Main
macOS run (GetRepoRoot() returned the /private/var repo instead of "").
Store the pin both as given (absolute) and symlink-resolved, and match the
working directory in both raw and resolved form. Canonicalization can only
widen the fence, never narrow it (e.g. Bazel runfiles symlink trees keep
matching exactly as before).
TestPinNoRepositoryUnderForTestingMatchesThroughSymlinks reproduces the
macOS shape on any platform with a symlinked repo root; it fails without
this change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): make run-go-test-binary.sh and install-golangci-lint.sh parse under bash 3.2
The Main macOS job runs the scripts package tests with macOS's /bin/bash
3.2, where two constructs abort under `set -u`:
- run-go-test-binary.sh expanded the usually-empty PASSTHROUGH array bare;
bash < 4.4 treats that as an unbound variable ("PASSTHROUGH[*]: unbound
variable"), failing TestTestScriptPrebuiltTestBinaryContract and
TestRunGoTestBinaryDefaultsTimeoutWhenOmitted. Use the ${arr[@]+...}
guard.
- install-golangci-lint.sh used `declare -A`; bash 3.2 parses it as an
indexed array and `[amd64]=` dies as an arithmetic lookup ("amd64:
unbound variable"), failing
TestInstallGolangciLintFailsClosedOnChecksumMismatch. Replace it with a
case function and update TestGolangciLintInstallScriptPinned's pin check.
Reproduced and verified against a bash 3.2.57 build: all four tests fail
on origin/main and pass with this change.
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>
actions/create-github-app-token (v3.2.0, pinned) deprecates its app-id
input in favor of client-id. rbe-prewarm's mint step now passes the
bazel-allocator App's public Client ID (Iv23ligrqVEhlamZnoPU, from
GET /apps/bazel-allocator) as a reviewed literal: it is not a credential,
and a literal keeps it policy-tested with the rest of the step instead of
in an unversioned repository variable. The private key stays a secret.
RBE_POOL_APP_ID is now unused, so its workflow_call declaration in
bazel.yml and its pass-through in pr.yml and nightly.yml are removed,
and a policy test rejects any workflow mentioning it again. The
repository secret can be deleted.
engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md's "rbe-west Pre-warm" section now
documents the client-id, the single remaining secret, and
RBE_PREWARM_WORKERS (default 1, clamped to 4, 0 = kill switch, repo
variable currently 2). It also no longer cites a maintainer's local
planning-notes path; a new tracked-file policy test fails if one
reappears.
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The prebuilt twins of the Windows liveness and worktree-remove jobs passed
alongside the native ones on every PR since F4 (#7135): #7139, #7145,
#7147, #7155, #7156, #7159, #7160 — 1-1.5 min vs 3-8 min native. Flip the
committed flag so ci-gate enforces the prebuilt pair; the native pair keeps
running as advisory and is the rollback (set the flag back to "false").
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): best-effort pre-warm rbe-west's OSS worker pool on PR open
bazel.yml's Bazel lanes each separately wait ~120s at "N actions, 0
running" while gastownhall/gascity's rbe-west NativeLink worker pool
scales up from zero. Add an advisory rbe-prewarm job (never a `needs`
of any lane, never in bazel-gate.sh's vocabulary, job-level
continue-on-error so it can never fail bazel.yml's own run) that
mints a short-lived installation token for a "bazel-allocator" GitHub
App (installed on gastownhall/gascity only, Actions read/write +
Metadata read) and dispatches gastownhall/gascity's
rbe-worker-pool.yml ahead of time, only when this run's lanes will
actually target rbe-west's "oss" instance (modes remote and fork-rw;
fork-ro targets a separate pool this doesn't serve).
Adds RBE_POOL_APP_ID / RBE_POOL_APP_PRIVATE_KEY as new optional
workflow_call secrets, threaded through every caller (pr.yml,
bazel-farm.yml, nightly.yml); either secret missing (the app not yet
provisioned) or repo var RBE_PREWARM_WORKERS=0 disables pre-warming
cleanly. Policy tests (scripts/bazel_rbe_prewarm_test.go, plus updates
to the existing bazel.yml structural tests) pin the mode gate, the
credential scope, the dispatch target, and that the job can never gate
or fail a run; each invariant was hand mutation-tested. Docs added to
engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md ("rbe-west Pre-warm").
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): close rbe-prewarm token-theft path, fix stale secret-count docs (B1)
Security review of bdef342d5 found a BLOCKER (B1): the rbe-prewarm job
checked out inputs.checkout-sha (the fork head, reachable via
bazel-farm.yml's pull_request_target path) and then ran
.github/scripts/rbe-prewarm.sh with the minted gastownhall/gascity
dispatch token present. Script-file edits don't require workflow-approval
the way workflow-file edits do, so a VIP fork or same-repo branch pusher
could edit that script to steal the shared bazel-allocator key.
Fix: delete the checkout step and the .sh file; inline the dispatch logic
into the step's own `run:` block, whose bytes always come from the
trusted (approval-gated) workflow definition even under
pull_request_target. Mint the token in the immediately preceding step;
nothing after the mint step touches a repo-relative path. Stop forwarding
RBE_POOL_APP_ID/RBE_POOL_APP_PRIVATE_KEY from bazel-farm.yml (that fork
path now gets a cold start instead of pre-warming) and narrow the job's
`if:` to mode == 'remote' only (fork-rw never carried secrets anyway, so
it was dead weight - S1).
Also addresses the review's should-fix items:
- S2: document the widened trust boundary (the bazel-allocator key is
shared with gascity's own rbe-west scaler; leak blast radius; rotation
breaks the scaler, so the kill switch is unset-secret /
RBE_PREWARM_WORKERS=0, not rotation) as an accepted risk in bazel.yml's
header and engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md.
- S3: fix stale "exactly four secrets" claims (pr.yml/nightly.yml pass 6;
bazel-farm.yml now correctly passes 4 again) and the false "never a
long-lived credential" claim.
- S4: flag the continue-on-error-preserves-caller-success assumption as
reasoned-through but not live-validated in this sandbox.
- N1: drop the unused RBE_PREWARM_IDLE_MINUTES knob entirely.
- N4: strengthen the dispatch-target test to check exact gh command
strings and ban hardcoded repo/workflow literals outside $POOL_REPO/
$POOL_WORKFLOW.
Test changes (scripts/bazel_rbe_prewarm_test.go rewritten; ci_workflow_test.go,
bazel_farm_workflow_test.go, bazel_cache_mode_test.go updated for the new
job shape): new TestRBEPrewarmNoCheckoutStep,
TestRBEPrewarmNothingAfterMintTouchesARepoPath,
TestRBEPrewarmTokenOnlyInDispatchStep, and
TestRBEPrewarmAppSecretsOnlyExpectedCallers directly target the B1
mutation class; TestRBEPrewarmDispatchScriptBehavior keeps the fake-gh
behavioral coverage for the now-inlined dispatch script. Verified by hand
that both of the reviewer's mutations (widen the `if:` back to include
fork-rw; add a step after mint running a checked-out script) are now
caught.
Verification: go test ./scripts/..., go vet, gofmt, actionlint on the
four touched workflow files, make ci-pr-policy, make bazel-sync-check,
and `bazel test //scripts:scripts_test` all pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
TestProxiedServerShowWatch/deleted_issue_polls_stay_quiet flaked with
"stdout grew after the delete" (PR #7139 run 37146882037, shard 25/30).
exec.Cmd copies Stdout and Stderr through two independent goroutines
reading two independent OS pipes, so there is no happens-before
relationship between the stderr "Watching for changes..." banner and
the render's own trailing bytes landing in the stdout buffer.
proxiedRenderIssue's final line is an unconditional trailing
fmt.Println, written after dependency/comment lookups, so the first
render's tail can still be in flight on the stdout pipe after the
banner already confirms the render started; capturing a "no growth"
baseline right after the banner is racy.
Reproduced directly via Bazel (--runs_per_test=40..50,
--local_test_jobs up to 80): 2/40 and 2/50 failures, with diagnostics
confirming "after" was just the tail of the first render's trailing
DESCRIPTION/blank-line output.
Fix the test's synchronization instead of the product: ping
watchBannerWriter.renders on every write (not just banner increments)
and add waitForQuiet, which blocks until a stream has been idle for a
bounded window. The delete subtest now waits for stdout to go quiet
after the banner before taking its "before" baseline, so the first
render has fully landed before growth is measured. No product code
changed; the "no output growth after delete" property is unchanged.
Verified: 60/60 and 80/80 runs clean post-fix (0/140), versus the
pre-fix reproductions above.
Note: an independent upstream PR (#7141, bee/show-watch-stdout-race)
also fixes this race via a different os.Pipe-based approach; this
commit addresses it independently per this worktree's task scope.
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): embedded-Dolt tier 20/5 -> 40/14 duration-balanced shards (F1)
Give the Bazel-only bazel-embedded job its own duration-balanced manifest
blocks for //cmd/bd:bd_embedded_test (20 -> 40 shards) and
//internal/storage/embeddeddolt:embeddeddolt_embedded_test (5 -> 14
shards), decoupled from PR Risk's/main.yml's legacy frozen 20/5-shard
fork/push jobs, mirroring F2's bd_proxied_test precedent.
- Measured every TestEmbedded* / embeddeddolt test's wall time in
isolation; split 21 cmd-tier and 1 storage-tier single top-level test
over 180s into disjoint sub-tests (3 irreducible exceptions left:
TestEmbeddedUpdateConcurrent 475s, TestEmbeddedCloseConcurrent 308s,
TestLargeBatchApplyStatementCounts712_Embedded 261s).
- New scripts/ci/gen_embedded_{cmd,storage}_shard_manifest.py +
_embedded_shard_manifest_lib.py generate/check duration-balanced
manifest blocks (LPT packing, incremental --write/--repack, exact-once
--check), chosen at N=40/M=14 where the heaviest shard reaches the
irreducible-test floor.
- Fixed 18 stale legacy 20-shard cmd manifest entries (and 1 storage
entry) left over from earlier test splits, which would have hard-failed
every shard of PR Risk's real test-embedded-cmd jobs on their next run.
- New scripts/embedded_shard_count_test.go policy tests tie the
Bazel-only block's shard count to bazel.yml's check_shard_coverage.py
argument and catch generator staleness; generalized
TestBazelRetiredLanesCheckListedTestsRan's live-shard-count dispatch
from bd_proxied_test-only to a map covering both embedded targets;
removed TestBazelEmbeddedJobMirrorsEmbeddedTier's now-invalid
BUILD.bazel-shard-count-equals-PR-Risk-matrix assertion.
- Verified: go test ./scripts/..., bazel test //scripts:scripts_test,
actionlint, make ci-pr-policy, make bazel-sync-check all pass; full
local bazel test of both targets at 40/14 shards passes 2/2; mutation
testing confirms each new/changed policy test fails exactly when it
should.
See ~/beads-bazel-plan/f1/impl-report.md for full detail.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(embedded-dolt): skip 712-item statement-count assertion under -race (F1)
TestLargeBatchApplyStatementCounts712_Embedded genuinely costs ~260-300s
under -race (confirmed by solo re-measurement: 298.60s) -- 14014 real SQL
statement round-trips through the race-instrumented in-process Dolt engine,
not an artifact and not splittable (one indivisible ApplyBatchInTx
transaction). It was the storage tier's single-test floor for CI shard
packing.
Apply the exact precedent TestLargeBatchApplyWallClock_Embedded already set
for its 1000-item shape: skip this assertion under raceEnabled (the cost is
race-instrumentation overhead on the Dolt engine's own internal
goroutine/lock machinery, not this test's own logic) and extend nightly.yml's
"Embedded Dolt batch-apply suite (non-race)" step's -run regex so the full
pinned 14014-statement baseline still runs, non-race, every night. Verified
directly: under -race the assertion now skips in 0.00s; without -race it
still runs and asserts Total=14015 (within the existing +/-2 tolerance) in
36.76s.
Updates scripts/ci_workflow_test.go's
TestNightlyFullTestRunsEmbeddedDoltBatchApplySuite to match the extended
regex.
Storage tier's new single-test ceiling under the per-PR -race lane drops
from ~260.7s to 152.38s (TestBatchApplyContract).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): correct cmd-tier long-pole durations, re-pack embedded manifolds (F1)
Investigated coordinator item 2 (single-test long poles): TestEmbeddedUpdateConcurrent
(recorded 475.39s) and TestEmbeddedCloseConcurrent (recorded 308.06s), plus
the two other >180s cmd-tier entries from the same capture
(TestEmbeddedInitA 196.94s, TestEmbeddedEpicCloseEligibleReason 192.47s).
Root cause: NOT host contention, NOT backoff/retry sleeps (bdRunWithFlockRetry
contributes negligibly), NOT race-instrumented-subprocess overhead alone.
These numbers were captured via `bazel --nohome_rc test --config=embedded`
with the then-current 20-shard legacy manifest (~10-11 tests/shard) and
`-test.parallel=4`. Go's t.Parallel() starts each parallel test's elapsed
clock when its function is invoked, before the Parallel() call blocks it
waiting for a free one-of-4 slot -- so a test queued behind several other
heavy shard-mates has that queueing wait baked into its own recorded
`--- PASS: TestX (Ys)` time. This is shard-composition-dependent scheduling
delay, not a cost intrinsic to the test.
Confirmed two ways in an isolated clone (not this worktree, per the
no-plain-go-test-from-a-beads-checkout rule):
- Solo (no rivals at all): 151.83s / 106.48s / 63.58s / 66.08s.
- All four together with the real -race -test.parallel=4 flags and exactly
4 tests requested (so nobody queues -- parallel slots == test count):
141.34s / 113.80s / 69.79s / 74.63s.
Both agree closely and both are far below the capture-time numbers.
F1's LPT packer already isolates the heaviest tests into shards with few or
no other heavy rivals (TestEmbeddedUpdateConcurrent lands alone in its own
40-shard-block shard), so under the new manifest these tests see little to
no queueing delay in real CI. None of the four needed splitting, parallel
subtests, or raceEnabled-scaled N: once correctly measured, none exceeds the
180s single-test guideline (new corrected weights: 155.0 / 115.0 / 72.0 /
77.0s). Corrected scripts/ci/embedded_cmd_test_durations.json accordingly
(with a doc-comment explaining the methodology and both confirmations) and
re-packed the 40-shard Bazel-only block (--repack --write); --check passes
(exact-once coverage of all 241 discovered tests). The frozen legacy 20-shard
block is untouched and independently re-verified exact-once by simulating
embedded-test-shard.sh across all 20 shards (241/241 tests, no
duplicates/misses/errors).
New cmd-tier single-test ceiling: 179.47s (TestEmbeddedCloseAlreadyClosed,
likely itself somewhat inflated by the same mechanism but already under the
180s line as recorded, so no action needed).
Also updates scripts/ci/embedded_storage_test_durations.json: the prior
commit's raceEnabled-skip for TestLargeBatchApplyStatementCounts712_Embedded
means it now costs ~0s in the per-PR -race lane bazel-embedded actually
packs for (not its real ~260-300s non-race cost, which nightly.yml still
exercises) -- weight set to 1.0 with a doc comment tying it to the skip in
large_batch_apply_measure_test.go. Re-packed the 14-shard Bazel-only block
accordingly; --check passes (exact-once coverage of all 387 discovered
tests, excluding TestMain/TestConformance per that file's existing
convention). The frozen legacy 5-shard block is untouched and independently
re-verified exact-once via embedded-storage-test-shard.sh simulation
(388/388 tests, no duplicates/misses/errors).
Verification: go test ./scripts/... (includes the nightly.yml policy test),
make ci-pr-policy, make bazel-sync-check, actionlint all pass. Real local
`bazel --nohome_rc test --config=embedded //cmd/bd:bd_embedded_test
//internal/storage/embeddeddolt:embeddeddolt_embedded_test`
(--local_test_jobs=8, both targets together, on a shared/noisy sandbox host)
passes both targets; per-shard wall time from each shard's test.xml: cmd/bd
max 218.9s (shard 23/40, min 20.6s), storage max 251.1s (shard 5/14, min
0.98s) -- down from the prior oversubscribed sweep's 783.41s / 351.94s and
well under the single-test-floor-based ~475s projection this slice started
from. Projected tier lane time (max of the two targets, real dedicated CI
runners should do at least this well): ~251s, under the 5-minute target.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(embedded): un-vacuous TestEmbeddedDepB edges, split epic-close test, trim concurrency stress N (F1 review)
Coordinator review follow-ups on the F1 embedded-Dolt resharding slice:
- TestEmbeddedDepB (one of TestEmbeddedDep's two CI-speed split halves) was
asserting its tree_* subtests against an edgeless graph, passing
vacuously; restores the same parent-child/blocks edges TestEmbeddedDepA
builds so those subtests exercise real multi-node traversal (review S2).
- TestEmbeddedEpicCloseEligibleReason split into
TestEmbeddedEpicCloseEligibleReasonFlag/...Output for CI shard balance,
matching the project's established single-concern split pattern.
- TestEmbeddedUpdateConcurrent/TestEmbeddedCloseConcurrent's
issuesPerWorker reduced 5->2: under real concurrent-shard-load
measurement these were genuine (not queueing-artifact) serialized-write
costs; 2 preserves every invariant the test checks (duplicate-ID
detection across all workers, one non-decreasing-list-count check per
worker) at a fraction of the serialized work.
- large712ShapeName: the 712-shape's race skip and its zero-match guard now
share one named constant instead of two independent literal shape-name
strings, so a future rename of the shape can't silently skip the pinned
statement-count assertion under race (review N2).
- Comment-only fixes (review N5) in files referencing test names since
renamed/split by this slice's earlier work: close_proxied_integration_test.go,
graph_apply_test.go, storage_class_proxied_integration_test.go,
tests/regression/discovery_test.go, plus doc-comment path cleanups (N1:
drop unverified ~/beads-bazel-plan paths/bead ids in favor of the
committed duration JSON files and engdocs/TESTING.md).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): re-derive embedded-Dolt durations under concurrent load; cap cmd shards at Bazel's 50-shard limit (F1 round 2)
Coordinator review required re-deriving every per-test duration weight from
a single, consistent, CI-realistic measurement (all shards running
concurrently, -test.parallel=4, race-enabled) instead of the prior pass's
mix of crowded-shard captures and solo/4-together spot-corrections, and
required measuring per-shard wall time via BEP testAttemptDuration rather
than a shard's outer test.xml <testsuites time> (which can include a
different, already-finished shard-mate's setup/teardown).
- scripts/ci/embedded_cmd_test_durations.json (242 tests) and
scripts/ci/embedded_storage_test_durations.json (387 tests) rewritten in
full from one consistent sweep. Every entry is now a fresh measurement;
none is a carried-over capture-time value or an unverified estimate. Both
files' _comment blocks retract the earlier "queueing delay baked into a
test's own reported elapsed time" theory (testing.go's (*T).Parallel does
not add wait time to a blocked test's own clock) and document the real
methodology.
- Only one cmd-tier test remains over 200s (TestEmbeddedListFiltering,
239.70s), already under the ~240s ceiling; no further top-level splits
were needed this round.
- New finding: Bazel hard-caps shard_count at 50 per sh_test-like rule
("Having more than 50 shards is indicative of poor test organization";
a native analysis-time limit, not configurable). The previous 88-shard
plan for //cmd/bd:bd_embedded_test (chosen as the LPT-packed floor before
this limit was discovered) is reverted to 50, Bazel's real ceiling.
Repacking the fresh weights at 50 shards gives a heaviest shard of
409.6s -- above the single-test floor of 239.7s, because 50 bins is not
enough headroom over the suite's ~20145 measured test-seconds to flatten
every bin to that floor. This makes the <=5 min lane target unreachable
for the cmd tier via resharding alone within Bazel's native per-rule
limit; see ~/beads-bazel-plan/f1/impl-report.md section 3c for the full
writeup and the two remaining levers (suite-wide speedups or a
multi-Bazel-rule split), neither attempted in this slice.
- internal/storage/embeddeddolt gets 15 Bazel-only shards (unaffected by
the 50-shard cap): LPT-packed heaviest shard 225.3s, within target.
- cmd/bd/BUILD.bazel, internal/storage/embeddeddolt/BUILD.bazel,
.github/workflows/bazel.yml, engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md,
scripts/embedded_shard_count_test.go, scripts/pr_risk_bazel_coverage_test.go,
scripts/ci/gen_embedded_cmd_shard_manifest.py updated to the corrected
50/15 shard counts (and, for the generator, N3: --write without an
explicit total_shards now errors instead of silently regenerating the
frozen legacy 20-shard block).
- .github/scripts/embedded-{cmd,storage}-test-shards.txt: re-packed
Bazel-only blocks at 50/15; frozen legacy 20/5 blocks untouched except for
N5 fixes to stale entries left by this slice's earlier test splits
(TestShardScriptsListOnlyRealTests catches this class of bug; both
legacy blocks reconfirmed exact-once).
- .github/workflows/nightly.yml / scripts/ci_workflow_test.go (N4): the
embedded-dolt batch-apply nightly step now runs with `if: ${{
!cancelled() }}` and its own explicit `-timeout 20m`, independent of the
job-level timeout, with both halves now asserted by
TestNightlyFullTestRunsEmbeddedDoltBatchApplySuite.
Verified: gofmt -l clean, go vet ./scripts/... clean, go test ./scripts/...
green, both generators' --check pass at 50/15 (and legacy 20/5 remain
exact-once via the frozen-block invariant).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ci): rename embedded manifest staleness tests out of the ^TestEmbedded skip
The allowlisted go-test leg runs with -skip ^TestEmbedded, so tests named
TestEmbedded*ShardManifestGeneratorNotStale never ran there and the leg
failed with "matched no test that ran".
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 Sonnet 5 <noreply@anthropic.com>
* ci: move same-repo PR Linux/Windows/macOS legs to Blacksmith, shard preflight (F7b)
PR-path jobs for same-repo PRs/merge_group now run on Blacksmith instead
of GitHub-hosted runners, following F4/F7a's ternary-expression and
restore-only-cache patterns; forks/Dependabot are unaffected:
- scripts-go-checks, pr-lint-wrapper: same-repo Blacksmith 4vcpu Linux.
- check-doc-freshness-platforms, pr-preflight-platforms: restructured
from a top-level matrix.os list to an include:-only "matrix marker"
shape (runner: same-repo-linux/-windows/-macos) so each host can
resolve an independent same-repo Blacksmith selection via one chained
ternary runs-on expression.
- Six standalone Windows jobs (test-windows-liveness,
worktree-remove-windows, test-windows-small,
test-windows-liveness-prebuilt, worktree-remove-windows-prebuilt,
windows-make-shell) move to same-repo Blacksmith Windows
(blacksmith-{2,4}vcpu-windows-2025, public beta). CGO/mingw-w64 and
Chocolatey preinstall are unconfirmed on that image; both risks are
flagged with one-line rollback instructions at the call sites.
- pr-preflight-platforms' Windows leg is split into two shards (common
steps on shard 1, the three Windows-only heavy steps on shard 2) to
shorten its critical path; shard 2 downloads Go modules directly
instead of sharing shard 1's runner/cache.
main.yml gains cache savers for the newly same-repo-Blacksmith PR
consumers, since Blacksmith and GitHub-hosted runners cannot see each
other's actions/cache entries even for identical keys:
- blacksmith-go-build-cache warms the Blacksmith-selection race/non-race
GOCACHEs scripts-go-checks and pr-preflight-platforms/check-doc-
freshness-platforms' ubuntu legs need, push-to-main only. Its non-race
leg shares scripts/ci/warm-non-race-cache.sh with build-artifacts, and
compiles tools/bazel/run_allowlisted_go_tests.py's allowlisted
packages via its new --compile-only flag, so the two paths and the
warm-up can never drift from what they actually run.
- pr-lint-wrapper, go-vet-cache, test-windows gain a venue: [blacksmith,
github] matrix leg to seed both runner selections pr.yml's
same-repo-Blacksmith-or-fork-hosted consumers can land on.
Updates the policy-test suite (ci_workflow_test.go,
ci_blacksmith_runner_test.go, pr_lanes_bazel_coverage_test.go) to cover
the new runner selections, matrix-marker shape, shard gating, and cache
topology, including a dedicated inventory/writer check for
blacksmith-go-build-cache.
Deferred follow-up (not done here): sharding check-doc-freshness-
platforms and the standalone Windows jobs, and moving/sharding macOS
legs beyond what check-doc-freshness-platforms'/pr-preflight-platforms'
matrix-marker form already covers.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): F7b review response -- msys2/Blacksmith-saver guards, macOS stays hosted (B1/B2/S3)
Addresses ~/beads-bazel-plan/f7b/review.md's two cache-safety blockers and
one follow-up gap found after F7b moved same-repo PR Linux/Windows/macOS
legs onto Blacksmith and added push-to-main Blacksmith cache seeders:
- B1: windows-make-shell's msys2/setup-msys2 step caches its installed
packages by default, which implicitly SAVED a GitHub Actions cache entry
from a same-repo PR the moment it ran on a Blacksmith runner (confirmed
via a real cache-list entry from a refs/pull/.../merge ref). Disabled with
a fail-closed `cache: ${{ runner.environment == 'github-hosted' }}`, and
generalized the sweep (TestBlacksmithReachablePRJobsDisableDefaultCachingActions)
to cover any default-caching setup-* action on a Blacksmith-reachable job,
not just this one.
- B2: blacksmith-go-build-cache, pr-lint-wrapper, go-vet-cache and
test-windows (main.yml) had no (or an incomplete) same-repo push-to-main
guard, so a same-repo fork with push access to its own main could run --
and save a cache entry from -- a paid Blacksmith job. Added the exact
push-to-main/same-repo `if:` F7c's own blacksmith-setup-go-cache already
uses, pinned by TestBlacksmithSaverJobsGuardedAgainstPullRequest.
- S3: the macOS leg of pr-preflight-platforms/check-doc-freshness-platforms
resolved to Blacksmith for same-repo PRs; Blacksmith bills macOS at
roughly 20x its Linux/Windows rate and no push-to-main Blacksmith-macOS
saver exists, so that leg would pay the premium for a guaranteed cold
cache. macOS now stays unconditionally on GitHub-hosted macos-latest.
Also pins S7 (blacksmith-go-build-cache/go-vet-cache/test-windows's cache
keys are bounded by go.sum+UTC-day, not github.sha) and S6/S8 (their
20-minute timeouts), both already in place but previously unpinned, and
replaces run_allowlisted_go_tests.py's fragile GO_TEST_FLAGS[-2:] slice with
an explicit BUILD_FLAGS constant (N1).
Re-ran the reviewer's 15 mutations (~/beads-bazel-plan/f7b/review/mutate.py):
all now killed or structurally moot (the Windows preflight shard split this
review asked to revert-unless-helpful was reverted, in an earlier commit on
this branch, removing the vulnerability surface 6 of them targeted).
scripts/BUILD.bazel: add the new ci_f7b_review_test.go to scripts_test's
srcs -- bazel test caught it missing (file existed on disk but was not
compiled into the Bazel-built test binary).
Verification: go vet/test/build, gofmt, bazel --nohome_rc test
//scripts:scripts_test, actionlint -shellcheck, shellcheck, make
ci-pr-policy, make bazel-sync-check all pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ci): drop local review-doc path from comment
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 Sonnet 5 <noreply@anthropic.com>
* ci(advisory): move Conformance/Regression/Migration/Smoke/Docs/Proxied-Local to Blacksmith, fold matrices, path-filter, drop redundant nix-build PR trigger (F7c)
Reduces per-PR GitHub-hosted job load for advisory (non-required) workflows
per the "PR CI -> 5 min" plan, slice F7c. None of these workflows gate the
required CI Gate / PR Risk Gate checks.
- conformance.yml: same-repo PR/merge_group runs move to Blacksmith
(4vcpu); PR trigger gets the shared "upgrade-relevant code" path filter
(any non-test Go change or build input); also now runs on push to main.
- regression.yml: fold detect-regression-need into regression's first step
(gated via `if:`), eliminating a whole job; move to Blacksmith.
- migration-test.yml: fold the 14-version x cache-identity matrix into 3
shards (src/pre-dolt/dolt-runtime), looping every version in a shard via
a new "Verify explicit historical upgrades" step so a bad version does
not hide the rest; gains the shared path filter; move to Blacksmith.
- cross-version-smoke.yml: fold the 1-job-per-version matrix into chunks of
5 (delegated to upgrade-smoke-test.sh's native SMOKE_VERSIONS support);
gains the shared path filter; move to Blacksmith.
- docs-mintlify.yml, proxied-local-smoke.yml: move to Blacksmith
(2vcpu/4vcpu); add missing timeout-minutes where absent.
- nix-build.yml: drop the pull_request trigger — pr-risk.yml's required
test-nix job (nix run + nix flake check) is a strict superset of
`nix build .#default`, pinned by a new regression test.
- main.yml: add blacksmith-setup-go-cache, a push-to-main-only job that
warms setup-go's implicit cache with cache: true, since Blacksmith
runners cannot see GitHub-saved actions/cache entries that the six
workflows above now rely on via setup-go's own caching. Carves a scoped,
documented exception into assertPinnedGoCacheActions for this one job;
every other setup-go step in main.yml/pr.yml/pr-risk.yml still must pin
cache: false.
Forks and Dependabot PRs are unaffected (still ubuntu-latest, no secrets),
via the same conditional runner expression used elsewhere in the repo.
New policy tests in scripts/ci_f7c_advisory_test.go pin: path-filter
identity across the three filtered workflows, full version-set coverage
of the migration-harness fold (no scenario dropped), the per-shard/per-
chunk retry-all-versions-even-on-failure loop, fork/dependabot runner
selection semantics, no Blacksmith job reads secrets, and that the new
cache-seed job exists and that its six consumers don't disable the cache
it warms. All new tests and their underlying behaviors were mutation-
tested (each fails when the behavior it pins is reverted).
Caveat for rollout: the Blacksmith cache-seed job assumes Blacksmith
labels have branch-protected cache isolation from fork/untrusted PRs at
the org level (spec-f7.md Group B precondition) — this needs confirming
with an org admin before merge, since the seed job's cache becomes shared
infrastructure the six advisory workflows implicitly trust.
Replayed the last 60 merged PRs' changed-file lists against the new path
filter: 20/60 would now skip Conformance/Migration/Smoke (matches the
spec's estimate), and none of the 60 touched non-test Go code while being
classified as skip.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,advisory): F7c review B1/B2 - pin migration fallback, restore-only Blacksmith caches
B1: migration-test.yml's non-Blacksmith historical-upgrades fallback was
`ubuntu-latest`, which actions/runner-images#14748 schedules to move from
24.04 to 26.04 starting 2026-10-19. 26.04 drops libicu74, which the v0.55.4
fixture's ICU ABI depends on (and which "Install test dependencies" installs
explicitly). Pin the fallback to the literal `ubuntu-24.04` label instead, and
add the matching sameRepoBlacksmith4vcpuNoble constant so the pin itself is
tested. Confirmed via `git show <pre-F7c>` that none of the other five
workflows F7c touched ever had a pinned-OS fallback, so this regression was
scoped to migration-test.yml only.
B2: Blacksmith cannot see GitHub-hosted cache entries, and a same-repo PR
writing a cache entry another PR or main later reads back unverified is a
poisoning vector. Make every advisory consumer (conformance, regression,
migration-test, cross-version-smoke, docs-mintlify, proxied-local-smoke)
disable setup-go's own implicit cache on self-hosted runners and restore-only
from a self-defined `blacksmith-sg-v1-...` key namespace (not setup-go's own
implicit key, so there is no dependency on Blacksmith's $ImageOS matching
GitHub-hosted resolution). Only main.yml's new blacksmith-setup-go-cache job
(push-to-main only, always trusted) saves: it always restores, unconditionally
re-runs every warm-up command (no longer gated on a cache hit, so a stale or
partial restore self-heals), and always saves under the same key. Delete the
now-unneeded goCacheImplicitCacheExceptions carve-out in ci_workflow_test.go.
Also convert cross-version-smoke.yml's smoke-binaries-* and regression.yml's
regression-baseline-* caches from a monolithic actions/cache (auto-saves on
any miss) into an explicit restore (always, modulo the job's own gate) / save
(gated off pull_request) pair, closing the same poisoning vector for
per-release binaries. migration-test.yml's historical-dolt-* cache is left
unchanged: it is already checksum-verified on every read by
scripts/migration-test/lib/binary.sh.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ci,advisory): F7c review SF - behavioral tests, path filters, F7a naming coordination
Replace substring-matching tests with behavioral ones that execute the real
embedded bash/jq against synthetic input, closing the reviewer's 12 surviving
mutations:
- TestMigrationHarnessLoopExecutesBehaviorally runs the real "Verify explicit
historical upgrades" step against a stub run.sh: every version in a shard
still runs after an earlier one fails (closes `exit 0`/`break` mutations),
failures are ::error:: annotated and written to $GITHUB_STEP_SUMMARY, a bad
or empty SHARD_VERSIONS fails closed without ever invoking run.sh, and a
hung version is bounded by `timeout --kill-after` without hiding the version
queued after it. The step's env now exports SHARD so its run: body has no
literal ${{ }} GH-expression syntax left for a test harness to choke on.
- TestMigrationHarnessCacheHashMatchesDerivation pins each shard's cache-hash
against sha256(join(",", <shard's cache-identity strings>))[:16], recovered
from the pre-fold 14-entry table (git show 362eecc6bf), closing a stale-
cache-hash mutation.
- TestMigrationHarnessDoltRuntimeStepGatedByShard pins the exact gate
expression for "Install Dolt test runtime".
- TestCrossVersionSmokeChunksEveryResolvedVersion now executes the real jq
chunking and join programs (via the new ghExtractJQProgram helper) against
synthetic version lists of several sizes, and asserts the smoke step's run:
command is an exact match - closing jq-slice-off-by-one and
dropped-SMOKE_VERSIONS mutations a substring check could not catch.
- TestRegressionStepsAfterDetectAreGated pins that every step after
regression.yml's detect step stays gated on
steps.detect.outputs.run_regression == 'true', closing an
ungated-regression-step mutation.
- TestBlacksmithSetupGoSeedExistsForAdvisoryConsumers,
TestAdvisoryBlacksmithConsumersAreCacheRestoreOnly (replacing
TestAdvisoryBlacksmithConsumersKeepImplicitSetupGoCache),
TestBlacksmithSetupGoCacheKeysMatchAcrossSeederAndConsumers, and
TestAdvisoryBinaryCachesAreRestoreAlwaysSavePRGated cover the B2
restore-only/seeder-saves cache topology end to end, including a
seeder/consumer key-match check and scoping the "no save in a consumer job"
check to the blacksmith-sg-v1- namespace specifically so migration-test.yml's
legitimate, checksum-verified historical-dolt-* cache is not flagged.
Path filters: add scripts/migrate-legacy-to-current.sh to migration-test.yml
(the harness invokes it directly but it lives outside scripts/migration-test/)
and internal/storage/embeddeddolt/conformance_test.go plus backend/conformance/**
to conformance.yml, with a new TestConformancePushPathsMatchPullRequestPaths
pinning push.paths and pull_request.paths stay identical.
Coordination with F7a (ci/f7a-blacksmith-fold, lands before F7c): F7a
independently defines its own sameRepoBlacksmith4vcpu/2vcpu constants and a
TestSameRepoBlacksmithExpressionSemantics, and is moving a real GH-Actions
expression evaluator into a shared scripts test helper file. Per the
coordinator, rename this branch's same-named test to
TestF7cAdvisorySameRepoBlacksmithExpressionSemantics (deliberately left as the
same simple literal mirror it always was, not a competing evaluator) so it
does not collide with F7a's helper on rebase; at rebase time this test should
be reduced or replaced in favor of F7a's shared evaluator.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(ci): update stale nix-build PR-trigger and renamed check-name references (F7c review S6)
F7c (bb81136203) dropped nix-build.yml's pull_request trigger as redundant
with PR Risk's test-nix job, and folded cross-version-smoke.yml's one-job-
per-version matrix into one job per 5-version chunk. Update the docs that
still described the old topology:
- CONTRIBUTING.md: nix build .#default no longer runs on PRs; point at PR
Risk's required test-nix job instead.
- update-vendor-hash.yml: same correction in its header comment and the
GITHUB_TOKEN-retrigger caveat.
- engdocs/CI_TEST_SURFACE_AUDIT.md: migration-test.yml now also runs on PRs
(path-filtered, advisory) across 3 shards instead of 14 per-version legs;
nix-build.yml's row now reflects push-to-main-only.
- engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md: replace `Upgrade smoke
(<version> -> candidate)` with the current `Upgrade smoke (chunk N)` job
name in both the "do not require directly" list and the Cross-Version
Smoke section; rewrite the Nix Build section to describe nix-build.yml as
push-to-main-only (no longer a PR check to warn about requiring directly)
and remove the now-unreachable `nix build .#default` bullet from the
"do not require" list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* ci(advisory): rebase onto F7a shared Blacksmith helper, drop duplicate const/evaluator
F7a (PR #7139, ci/f7a-blacksmith-fold) landed its own sameRepoBlacksmith4vcpu
const and TestSameRepoBlacksmithExpressionSemantics, plus a real GitHub
Actions expression evaluator (evalGHExpr/mustEvalGHRunsOn) in a new shared
scripts/ci_blacksmith_runner_test.go. This branch rebased onto
origin/ci/f7a-blacksmith-fold and reconciles the two:
- Removed this branch's duplicate sameRepoBlacksmith4vcpu definition in
ci_workflow_test.go (rebase conflict); it's now served solely by F7a's
shared const. sameRepoBlacksmith4vcpuNoble (F7c's B1 fix, fallback pinned
to ubuntu-24.04 instead of ubuntu-latest) is kept as its own const, as
instructed, since it is F7c-specific and not shared.
- Replaced TestF7cAdvisorySameRepoBlacksmithExpressionSemantics's
hand-written Go mirror of the same-repo Blacksmith boolean logic with real
evaluation of each F7c advisory job's actual, as-parsed runs-on expression
text via F7a's evalGHExpr/mustEvalGHRunsOn, across the same event-shape
truth table F7a's own test uses (same-repo/fork/dependabot/deleted-fork-
head/merge_group/push/pull_request_target/schedule/workflow_dispatch).
This covers all 8 F7c advisory Blacksmith jobs, including
migration-test.yml's historical-upgrades job falling back to the literal
ubuntu-24.04 label rather than ubuntu-latest. Confirmed via a cp-backed
mutation (flipping the Noble fallback back to ubuntu-latest) that this new
test, unlike the deleted hand-written mirror, actually catches a
regression in the real expression text.
- Merged two more rebase conflicts in ci_workflow_test.go: the
assertNoUnmanagedGoCacheSteps main.yml allowlist (F7a's
windows-test-binaries-cache plus F7c's blacksmith-setup-go-cache) and a
subsequent non-conflicting-but-incomplete 3-way merge of
TestSameRepoBlacksmithRunners' main.yml entry (added
windows-test-binaries-cache alongside blacksmith-setup-go-cache so the "no
other Blacksmith label leaks" sweep covers both).
Did not merge TestBlacksmithAdvisoryJobsReadNoSecrets into F7a's
TestBlacksmithJobsReadNoSecrets (ci_workflow_test.go) even though the shared
helper file's doc comment suggests it; out of scope for this round per the
coordinator's explicit instructions, left as a follow-up.
Re-ran full verification after rebase + reconciliation: go build/vet/test
./scripts/..., bazel --nohome_rc test //scripts:scripts_test, actionlint
-shellcheck=shellcheck across all touched workflows, make ci-pr-policy, make
bazel-sync-check - all green. gofmt -l clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,advisory): close F7c re-review blocker X1 and S1-S5/N1 gaps
Re-review (~/beads-bazel-plan/f7c/rereview.md) found one blocker and five
should-fix gaps against ci/f7c-advisory-workflows:
X1 (blocker): migration-test.yml's historical-dolt-* cache was still a bare
actions/cache that auto-saves on any key miss on Blacksmith for same-repo
PRs. tar -P extraction plus lib/binary.sh's cp -f following a planted
symlink can redirect a write before sha256 verification ever runs, so the
"checksum-verified" exemption was unsound. Converted to the same
restore-always/save-off-PR split as smoke-binaries-*/regression-baseline-*,
dropped the exemption comments, and added it to advisoryBinaryCaches.
S1: TestRegressionDetectStepBehavioral executes regression.yml's detect
step's actual bash against a scratch git repo, closing mutation M13 (detect
step hard-wired to emit run_regression=false).
S2: TestBlacksmithReachableAdvisoryJobsNeverSaveACache sweeps every job in
every F7c advisory workflow (plus main.yml) whose runs-on resolves to a
Blacksmith label under a same-repo pull_request/merge_group context, and
fails on any bare actions/cache, any un-gated actions/cache/save, or any
setup-go/setup-node/setup-python step that would still cache there. Also
added a job-level `if: github.event_name == 'push' && github.ref ==
'refs/heads/main' && github.repository == 'gastownhall/beads'` guard to
main.yml's seeder job (TestBlacksmithSeederGuardedAgainstPullRequest) so a
future pull_request/merge_group trigger on main.yml can't turn the seeder
into a same-repo-PR-reachable cache writer.
S3: advisoryBinaryCaches' save-gate check is now exact-equality, not
strings.Contains, so a `... || true` gate can no longer slip past it.
S4: conformance.yml's path filters now include
internal/storage/embeddeddolt/test_fixture_test.go, which holds TestMain
for the whole package (moved out of conformance_test.go) and was previously
excluded by the blanket !**_test.go negation.
S5: main.yml's blacksmith-setup-go-cache seeder keyed its save on
github.sha, so every push to main - regardless of whether go.sum changed -
wrote a new multi-GB ~/go/pkg/mod + ~/.cache/go-build entry, risking LRU
eviction of F7a's own Blacksmith-seeded caches. Added a "Compute cache
date" step and keyed on the UTC calendar day instead, capping writes to at
most once per day; the same step/key was added to all 6 consumers so their
restore key stays byte-identical to the seeder's save key
(TestBlacksmithSetupGoCacheKeysMatchAcrossSeederAndConsumers).
N1: flipped `cache: ${{ runner.environment != 'self-hosted' }}` to
`cache: ${{ runner.environment == 'github-hosted' }}` on setup-go's own
implicit cache across all 7 call sites, so an empty/unknown
runner.environment value fails closed (caching off) instead of open.
Verification: go build/vet/test ./scripts/..., bazel --nohome_rc test
//scripts:scripts_test, actionlint -shellcheck=shellcheck
.github/workflows/*.yml, make ci-pr-policy, make bazel-sync-check all pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,advisory): close merge_group gap in binary-cache save gates
Running TestBlacksmithReachableAdvisoryJobsNeverSaveACache against every
Blacksmith trust context it is reachable under (instead of stopping at the
first match found, which made the check's coverage depend on Go's
randomized map iteration order) surfaced a real gap the S2 sweep was meant
to close: smoke-binaries-*, regression-baseline-* and historical-dolt-*'s
save gates were all `if: github.event_name != 'pull_request'`, a deny-list
that also admits a hypothetical future merge_group event. All three jobs'
runs-on expressions already resolve to a Blacksmith label under
merge_group, so a merge_group run would have been able to write those
caches too - the same same-repo-writer risk X1 closed for pull_request,
just not currently reachable since none of these three workflows has an
`on: merge_group:` trigger today.
Changed all three save gates to an exact allow-list of the triggers they
actually intend to write from (push, workflow_dispatch) rather than a
deny-list of the one trigger they don't. Updated
TestAdvisoryBinaryCachesAreRestoreAlwaysSavePRGated's wantSaveIf strings to
match, and made TestBlacksmithReachableAdvisoryJobsNeverSaveACache check
every blacksmithTrustContexts entry per job (sorted for determinism)
instead of breaking on the first Blacksmith-reachable context, so this
class of context-dependent gate gap can't hide behind map iteration order
again.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ci,advisory): directly assert main.yml has no PR-reachable trigger
TestBlacksmithSeederGuardedAgainstPullRequest's job-level guard defuses the
vulnerability structurally, but a mutation that only edits main.yml's on:
block (adding pull_request:) without touching the job-level if: was not
caught by any existing test (confirmed: mutate.py's N6 probe survived).
Add TestMainWorkflowHasNoSameRepoPRReachableTrigger, the direct half of
F7c review fix S2's "pin the seeder's trust boundary" ask: assert main.yml's
on: has none of pull_request/pull_request_target/merge_group/workflow_run,
and still has push. Confirmed this kills N6 (manually applied and reverted
via a cp backup).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37159233834
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
TestAddWispDep_InfraWispToInfraWisp/agent flaked under
//internal/storage/dolt:dolt_server_full_test shard 12/16 with "failed
to initialize branch-local ignored schema: schema migration: schema:
acquire migration lock: schema migration lock unavailable: timeout"
(job 111272709796).
Root cause: schema.MigrationLockName keys the GET_LOCK name by
database name only, not by branch. setupTestStore gives every test its
own Dolt branch (testutil.StartTestBranch) but all of them share one
database (testSharedDB), so their branch-local schema passes
(initSchemaOnDB, called after the branch checkout to materialize
branch-local ignored-migration state) all contend for the identical
named lock. AcquireMigrationLock's GET_LOCK wait is a hard 5s budget
(migrationLockAcquireTimeoutSeconds) — too short to always win under
host load with multiple contenders.
Production already has a deterministic answer to this exact shape of
contention: initSchemaOnDBWithRetry wraps the same call in a 30s
exponential-backoff retry whose isRetryableError check treats
schema.IsMigrationLockError as transient ("concurrent bd processes
converge instead of failing one unlucky waiter" — see store.go). New()
already goes through that retrying path for a store's initial schema
init; only setupTestStore's second, branch-local pass called the bare,
non-retrying initSchemaOnDB, skipping the resilience production
relies on for the identical lock. TestConcurrentInitSchema already
demonstrates this same contention/retry shape against a fresh
database with 20 concurrent callers, corroborating the mechanism.
Fix: call initSchemaOnDBWithRetry instead of initSchemaOnDB for the
branch-local pass. This is not a timeout bump — it reuses production's
existing contended-lock retry budget instead of inventing a new wait.
Verification: reproduction attempts (up to 300 concurrent Bazel test
actions, and a cgroup-throttled run limiting the whole job to a ~1.5
CPU-core budget while running up to 80 concurrent actions, confirmed
throttling via cpu.stat) did not trip the pre-fix race on this
higher-core sandbox hardware, unlike the original 4-vCPU CI runner;
root cause is established via static analysis plus the matching
TestConcurrentInitSchema precedent instead. Post-fix, 40 runs under
the same cgroup-throttled load passed cleanly (0 failures).
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Under Bazel, prlintmake_test resolved go.mod's toolchain (go1.26.7)
through whatever go the executor has on PATH. When that is another
release, gofmt-bin.sh's GOTOOLCHAIN=go1.26.7 fallback downloads the
toolchain from proxy.golang.org on every run, and fails where actions
have no network: rbe-west's fork pool runs every action in its own
network namespace with loopback only (NETNS=1). Three tests failed
there (TestGofmtBinMatchesGoModToolchain, TestGofmtBinIgnoresPathGofmt,
TestFmtCheckReportsGofmtVersion) and passed with NETNS=0.
The registered SDK is go.mod's toolchain (bazel_policy_test pins them),
so declare it as data and have testGo put it first on PATH. gofmt-bin.sh
then takes its "host go already is the pinned one" path and fetches
nothing. Plain `go test` is unchanged.
Co-authored-by: gascity-agent <agent@gascity.ai>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci: F7a same-repo Blacksmith moves and job folds (pr.yml, pr-risk.yml)
Move cache-free same-repo pr.yml/pr-risk.yml jobs onto the org's Blacksmith
runner pool (forks/Dependabot stay ubuntu-latest), and fold several
independent single-purpose jobs into fewer multi-step jobs, to cut same-repo
PR queue time without changing either required gate's name or its token
contract:
- fast-checks: folds check-build-tags, check-version-consistency,
check-migration-hygiene, check-no-beads-changes and fmt-check into one
Blacksmith job with five independent steps; ci-gate reads each step's
outcome via job outputs into the same CI_GATE_REQUIRED token the standalone
job used, plus a FAST_CHECKS backstop token for a lost job.
- check-release-target-cross-compilation: 8 per-target matrix legs collapse
to 2 (unix/desktop), driven by the new scripts/ci/release-targets.txt
manifest (kept in sync with .goreleaser.yml) and
scripts/ci/check-release-cross-compile.sh.
- advisory-reports: folds build-examples and complexity-report (both
already advisory) into one job, keeping their pre-fold
step-level continue-on-error/timeout design.
- windows-make-shell: 3-way host matrix folds into one job with an
aggregator step reproducing the old native/MSYS2/Cygwin pass/fail rules;
test-windows-doltversion and test-windows-dbproxy-server fold into
test-windows-small (neither was gated).
- Runner moves: fast-checks, advisory-reports,
check-release-target-cross-compilation, check-doc-flags,
pr-policy-wrapper, test-dolt-server-fingerprint (pr.yml) and test-nix
(pr-risk.yml) move to the same-repo Blacksmith expression at their
measured vCPU size.
Policy tests: extend TestSameRepoBlacksmithRunners for the moved/added jobs,
add TestSameRepoBlacksmithExpressionSemantics, TestBlacksmithJobsReadNoSecrets
and TestPRCIGateFastChecksTokens, retarget the complexity/build-examples and
dolt-server-fingerprint tests, rewrite
TestReleaseTargetCrossCompilationMatrixMatchesGoreleaser against the new
manifest, and teach the ci-gate simulation helper to resolve
needs.fast-checks.outputs.*. Document the moves/folds and the Blacksmith-off
revert set in engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): windows-make-shell/test-windows-small fail natively, raise advisory-reports headroom (review SF-1, SF-2, N-2, N-3)
- windows-make-shell: drop continue-on-error from install/exercise steps
(kept only on the Cygwin setup step), delete the hand-written "Fail if a
required Windows Make shell leg failed" aggregator, and delete the unused
native/msys2/cygwin job outputs. A failing leg now reds the job via native
GitHub Actions propagation instead of relying on an aggregator step that a
mutation showed could silently undershoot (SF-1, N-3).
- test-windows-small: same fix - drop continue-on-error from doltversion/
dbproxy-server steps and delete their aggregator step.
- Add timeout-minutes: 10 to the MSYS2 and Cygwin "Set up ... GNU Make"
steps, so a hung installer download can no longer take out the whole job
(SF-2).
- advisory-reports: raise timeout-minutes from 45 to 60 for more headroom
above the sum of its step timeouts (N-2).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ci): real GH-expression evaluator shared with F7c, behavioral xcompile test, secret/run-command coverage (review SF-3, SF-5, SF-6, N-1, N-4, N-6)
- New scripts/ci_blacksmith_runner_test.go: a real GitHub Actions expression
evaluator (tokenizer + recursive-descent parser for ==, !=, &&, ||, !,
parens, string literals, dotted lookups, with GitHub's short-circuit-
returns-operand && / || semantics) that evaluates the REAL pinned
sameRepoBlacksmith{2,4,8}vcpu expression strings from pr.yml/pr-risk.yml,
replacing the old TestSameRepoBlacksmithExpressionSemantics' tautological
hand-written Go mirror (SF-3). This file is the shared helper F7c's own
TestSameRepoBlacksmithExpressionSemantics should rebase onto - see its
doc comment for the "Public surface" (the three consts, evalGHExpr, and
mustEvalGHRunsOn) (SF-5).
- ci_workflow_test.go: drop the old consts/test now living in the shared
file; extend TestBlacksmithJobsReadNoSecrets to also scan job.If and
step.If for secret references, not just env/with/run (N-4; container/
services credentials and matrix-marker resolution stay deferred to F7b);
pin fast-checks' build-tags step invoking all 3 scripts and the
migration-hygiene BASE_SHA env, and add
TestPRWindowsSmallDbproxyServerIsCGODisabled (N-6); add
TestPRWindowsMakeShellLegsFailTheJob and
TestPRWindowsMakeShellSetupStepsHaveTimeouts pinning the SF-1/SF-2 fixes.
- New scripts/check_release_cross_compile_test.go: behavioral test for
check-release-cross-compile.sh using a fake `go` on PATH - asserts a
failing target propagates as non-zero, every target in the group is still
attempted, every invocation passes CGO_ENABLED=0 and the gms_pure_go tag,
and an unknown group fails loudly with zero invocations (SF-6).
- check-release-cross-compile.sh: document the deliberate sequential-build
(vs. the spec's 2-wide suggestion) choice and its revisit trigger (N-1).
- scripts/BUILD.bazel: add the two new test files to scripts_test's explicit
srcs list (not a glob); verified against `make bazel-sync-check`.
All new/changed tests mutation-tested: each production-code mutation was
caught by the relevant test, then reverted via `cp` from a /tmp backup and
diff-verified byte-identical (never git stash / git checkout --).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(ci): fix stale check names and aggregator description in CI_REQUIRED_CHECK_TOPOLOGY.md (review N-7)
- Replace the stale "Check build-tag policy", "Check version consistency",
"Check for .beads changes" and "Check formatting" entries under "Do not
require these existing check names" with the actual post-fold name,
"Fast checks (build tags, versions, migrations, beads diff, fmt)", and add
the cross-compilation and windows-make-shell fold's actual check names.
- Rewrite the windows-make-shell fold description: it no longer has a
hand-written aggregator step (deleted per SF-1 in the prior commit), and
"the separate cygwin job" is now described correctly as a pre-fold matrix
leg, not a job.
- Update the advisory-reports timeout mention from 45 to 60 minutes (N-2).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(ci): drop local design-doc path from topology doc
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 Sonnet 5 <noreply@anthropic.com>
* ci(bazel): fork and Dependabot PRs execute remotely on rbe-fork when rbe-west's mint is open (F9)
Fork and Dependabot pull_request runs get no secrets, no OIDC token and no
repository variables, so rbe-west decides for them. bazel.yml's rbe job asks
rbe-fork-mint's /v1/status (rbe-mint.ops.gascity.com:8444) once per run:
- open, tier ro: mode fork-ro (instance oss-fork, the fork pool, nothing
cached for anyone);
- open, tier rw (allowlisted author's own fork, allowlisted trigger): mode
fork-rw (instance oss, the OSS pool);
- closed, refusing, unreachable or anything else: mode cache, exactly as
today (local execution plus the anonymous read-only cache).
In the fork modes every lane runs, remotely, from a GitHub-hosted runner:
setup-bazel makes an EC P-256 key and a CSR, uploads the CSR as an artifact
of this run (the mint's proof), gets a ~2 h certificate
(fork-credential.sh, a byte copy of gascity's tools/rbe/fork-credential.sh
from F6) and writes an rc for grpcs://rbe-fork.ops.gascity.com:8444 with
the mint's instance. A lane whose certificate names another tier than the
rbe job fails ("re-run all jobs"). Fork lanes add --config=sole-run like
mode remote.
BAZEL_COVERS_FORKS ships "false" in pr.yml and pr-risk.yml: forks and
Dependabot keep their legacy tiers, and the Bazel lanes run beside them
(remotely while rbe-fork is open). F13 commits "true"; then a covered fork
run in mode cache is red, like a covered same-repo PR without the secret.
Safe while rbe-fork is dark: with the gate closed the mint's port resets
connections and the status probe falls back to mode cache in seconds; with
the mint up but disabled, canaried or rw off it answers open false or 403,
also mode cache.
Not in this change (later slices): bazel-farm.yml and its inputs stay (F12),
bazel.yml keeps its push trigger and pr.yml/pr-risk.yml gain none (F14).
keep their go build fallback on GitHub-hosted runners.
Tests: the rbe decision against a stubbed mint (ro, rw, closed, rw closed,
canary, busy, garbage, unknown tier, unreachable); the coverage and gate
matrices learn the fork modes, BAZEL_COVERS_FORKS and mint answers that
change between runs; TestBazelCacheModeReachesTheRC drives setup-bazel's
fork steps against a stand-in mint and checks each lane's rc;
fork-credential.sh's client contract and write-bazelrc.sh's fork mode and
exclusivity; the endpoint pin is allowed as exactly its one line.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): fork-credential.sh retries the mint's 429 and never sleeps after the last try
A 429 (per-minute rate, live-certificate quota) may pass on its own like a
502, so it is retried with the same 10/20/30 s backoff (one minute, the
rate window); the loop no longer sleeps after the fourth failed attempt.
The cert request and the rbe job's /v1/status probe give up connecting
after 5 s, so a closed gate (dropped SYNs) costs seconds, not minutes.
Byte-identical to gascity's tools/rbe/fork-credential.sh.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: gascity-agent <agent@gascity.ai>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(F4): advisory Linux-cross-built Windows test binaries, macOS cache restore
Side-by-side rollout slice of the PR CI -> 5 min plan (F4):
- Add pr.yml `windows-test-binaries`: a Linux job that cross-compiles
bd.exe and two go-test-c binaries (cgo and nocgo) for windows/amd64
via mingw (CC/CXX=x86_64-w64-mingw32-*, matching release.yml's
goreleaser setup), driven by a committed manifest
(scripts/ci/windows-test-binaries.txt) and build script
(scripts/ci/build-windows-test-binaries.sh). Artifacts are uploaded
and consumed by two new advisory "-prebuilt" twins
(test-windows-liveness-prebuilt, worktree-remove-windows-prebuilt)
that run the identical test selection/flags/env (including
BEADS_TEST_REPO_ROOT) against the prebuilt binaries via
scripts/ci/run-go-test-binary.sh and scripts/test.sh's new
BEADS_TEST_PREBUILT_TEST_BINARY short-circuit.
- The original native Windows jobs are untouched and remain required;
the new jobs are advisory only (not in CI_GATE_REQUIRED) for this
rollout phase. Flipping to the cross-built path later is a one-line
CI_GATE_REQUIRED change.
- Add main.yml `windows-test-binaries-cache`: seeds the Go build cache
for the cross-compile toolchain/packages on a schedule, mirroring
the existing module/build cache warmers; reorder build-artifacts'
warm-cache step to precede the module-cache save for a cleaner
build -> warm -> save grouping.
- Restore macOS's native build-cache save step in main.yml (lost
during an earlier job consolidation).
- Remove the non-required "Test (macos-latest)" full-suite job from
PRs; the native macOS gate jobs still run, so required coverage is
unaffected. This does drop a non-required pre-merge macOS race
signal; see docs/notes for the accepted tradeoff.
- Add scripts/windows_test_binaries_manifest_test.go: policy tests
pinning the manifest's three advisory-phase entries, pinning the
mingw toolchain to release.yml's, checking consumer jobs only
reference manifest-listed binaries, checking upload/download
artifact names and `needs` match, checking the prebuilt jobs select
exactly the same tests (-run literals) as their native counterparts,
and checking none of the new jobs reference secrets (fork safety).
All mutation-tested.
- Add two scripts/ci_workflow_apt_get_timeout_test.go budget entries
for the new "Install mingw cross-compiler" steps.
- Fix two latent Bazel-only scripts_test failures surfaced while
wiring the new test file into scripts/BUILD.bazel: materialize
cmd/bd's sources via the existing //cmd/bd:go_srcs filegroup so
sourceRepoRoot(t)-based package-directory checks work under Bazel's
runfiles root, and strip Bazel's own TEST_TIMEOUT env var before
exercising scripts/test.sh's hardcoded default in
test_script_test.go (name collision with test.sh's own override
knob).
Verified: go test ./scripts/...; bazel --nohome_rc test
//scripts:scripts_test; actionlint; shellcheck; make ci-pr-policy;
make bazel-sync-check; a from-scratch /tmp clone cross-build using
the exact job commands (cold 130.2s, warm/cache-hit 30.3s, PE32+
x86-64 validity via file/objdump, byte-identical SHA-256 across
cold/warm/traced runs); wine -test.list confirms
TestPrimeBinaryPortfolio/TestIsServerProbablyRunning* present in the
cgo binary and the full TestWorktreeRemove* family (including
Windows-specific variants) present in the nocgo binary.
Scoping note: only 2 of the spec's 4 consumer jobs (liveness,
worktree-remove) get prebuilt twins, and only 3 of 8 spec-listed
manifest binaries are built this slice; preflight, doc-freshness and
credential-fixture consumers are deferred as documented follow-up.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): address F4 review findings (SF-1..SF-6 + nits)
Addresses the F4 review (~/beads-bazel-plan/f4/review.md): no blockers, six
substantive findings plus several nits.
- SF-1: main.yml's windows-test-binaries-cache job now seeds the Windows
cross-compile cache from both runner selections pr.yml's consumer job can
land on (Blacksmith for same-repo PRs/merge_group, ubuntu-latest for
forks/Dependabot) via a 2-leg matrix with identical keys/paths, instead of
a single ubuntu-latest leg Blacksmith runners can never see.
- SF-2: removed the two consumer-less "Warm non-race Go build cache
(test-only packages)" steps from main.yml (build-artifacts, test macOS
leg); they had no real consumer and cost ~270s on main's macOS leg for
nothing.
- SF-3: scripts/ci/run-go-test-binary.sh now injects the same
-test.timeout=10m default (when -timeout is omitted) and unconditional
-test.paniconexit0 flag `go test` itself injects; added
timeout-minutes to test-windows-liveness-prebuilt; added a direct
regression test (TestRunGoTestBinaryDefaultsTimeoutWhenOmitted) for the
omitted-timeout branch, which no path through scripts/test.sh can reach
(test.sh always supplies its own -timeout default first).
- SF-4: scripts/test.sh's BEADS_TEST_PREBUILT_TEST_BINARY branch now runs
run-go-test-binary.sh as a child process (capturing and re-exiting its
status) instead of `exec`-ing it, so the EXIT trap (beads_test_env_cleanup)
still runs and the per-run BEADS_TEST_ENV_ROOT temp dir (and, with
BEADS_TEST_SHARED_SERVER=1, the shared dolt sql-server) is cleaned up
instead of leaked/orphaned.
- SF-5: closed the five surviving mutations (cgo/nocgo swap between the
Windows prebuilt twins, dropped -count=1, an unguarded twin in
ci-gate.needs, a goreleaser compiler change, a PKGDIR change) with
dedicated policy tests, and replaced the three-edits-per-job required/
advisory toggle with a single committed WINDOWS_PREBUILT_REQUIRED flag
(pr.yml top-level env) in the style of the existing BAZEL_RETIRES_LEGACY_*
flags: both Windows pairs are now unconditionally in ci-gate.needs and
always evaluated, and only which pair lands in CI_GATE_REQUIRED vs.
CI_GATE_SKIPPED_OK is decided by the flag, in one place.
- SF-6: dropped the //cmd/bd:go_srcs data dep from scripts_test; the
prebuilt-binary contract test now exercises ./scripts/ci (already a data
dep of this target) instead of ./cmd/bd, since it never builds or runs the
real package.
- Nits: removed dangling ~/beads-bazel-plan references and a nonexistent
test name from committed comments; log the resolved mingw-w64 version
when cross-compiling; removed a no-op shellcheck disable comment;
documented why run-go-test-binary.sh's BEADS_TEST_REPO_ROOT re-export
doesn't race beads_test_env_enter's unset; rewrote the pr.yml tombstone
comment for the removed macOS PR job to state the actual, narrower
tradeoff instead of an overclaiming "main.yml covers this" statement.
Verified: bazel --nohome_rc test //scripts:scripts_test passes; actionlint
clean on pr.yml/main.yml; shellcheck clean on all edited scripts (only
pre-existing, unrelated warnings remain elsewhere); make bazel-sync-check
and make ci-pr-policy both pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(scripts): isolate prebuilt-binary contract test from ambient hermetic env
TestTestScriptPrebuiltTestBinaryContract's "cleans up BEADS_TEST_ENV_ROOT
after the binary exits" subtest (added for F4 review finding SF-4) passed
locally but failed in CI's scripts-go-checks/scripts-test leg.
scripts/ci/scripts-go-test.sh (the CI driver for this package's `go test
./scripts/...` run) calls beads_test_env_enter in its own shell before
invoking go test, so BEADS_TEST_ENV_ACTIVE=1 and an outer
BEADS_TEST_ENV_ROOT are already present in this test binary's own
os.Environ(). runTestScriptPrebuiltBinary built the scripts/test.sh
subprocess's env from os.Environ() (minus TEST_TIMEOUT), so that ambient
state leaked through. Inside the subprocess, scripts/test.sh's own
beads_test_env_enter call (test.sh:17) saw the already-active guard and
no-opped: no new root, no new EXIT trap armed in that process - so the
fake binary observed the outer, still-alive root, and the subtest's
"directory is gone after test.sh exits" assertion failed, even though the
SF-4 fix (run the prebuilt binary as a child instead of exec'ing it) is
correct.
Every real production caller of scripts/test.sh's prebuilt path (pr.yml's
Windows liveness/worktree-remove prebuilt steps) runs it as the first
command of a fresh GitHub Actions `run:` step, never nested under an
already-entered hermetic env, so this nesting is purely an artifact of
this test binary's own ambient environment under scripts-go-test.sh, not
a real CI behavior gap.
Strip BEADS_TEST_ENV_ACTIVE/_ROOT/_DISABLE/_KEEP (alongside the existing
TEST_TIMEOUT filter) from the child env in runTestScriptPrebuiltBinary so
the subtest deterministically exercises scripts/test.sh's real top-level,
non-nested invocation regardless of what ambient hermetic-env state this
test binary itself happens to be running under.
Verified: reproduced the CI failure locally by exporting
BEADS_TEST_ENV_ACTIVE=1/BEADS_TEST_ENV_ROOT before `go test ./scripts/...`;
confirmed the fix resolves it; re-ran bazel test //scripts:scripts_test
and scripts/ci/scripts-go-test.sh directly, both pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* ci(lint,scripts): fold duplicate Lint job; matrix PR Lint and scripts-go-checks (F5)
Lint (golangci-lint-action, only-new-issues) was functionally identical to
pr-lint-wrapper's native leg (H7): same pinned binary, config, flags, and
diff scope. Fold it into the wrapper in both pr.yml and main.yml, and drop
LINT from pr.yml's ci-gate.
pr-lint-wrapper becomes a 3-leg matrix (native/windows/darwin, fail-fast:
false) under the same PR_LINT_WRAPPER gate id, installing golangci-lint
v2.10.1 from a pinned, sha256-verified release binary
(scripts/ci/install-golangci-lint.sh) instead of go install/the Action, with
a per-leg golangci-lint cache (pr.yml restores only; main.yml's matrix is
the sole saver). scripts-go-checks becomes a 3-leg matrix
(scripts-test/vet/allowlisted, fail-fast: false) under the same
SCRIPTS_GO_CHECKS gate id, giving go vet its own build cache instead of
sharing the race build cache. main.yml gains a go-vet-cache job to warm that
cache on push; build-artifacts remains the Go module cache's sole saver.
Splitting each job's previously-sequential passes into parallel matrix legs,
combined with removing the duplicate Lint job outright, takes wall-clock
time off the PR gate's critical path.
Updates scripts/ci_workflow_test.go and scripts/pr_lanes_bazel_coverage_test.go
for the new matrices, cache topology, and the removed LINT id; adds
TestGolangciLintInstallScriptPinned. Updates engdocs/LINTING.md and the live
prose in engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md (its disclaimed "historical
snapshot" gate-wiring block is left as-is).
Verified: go test ./scripts/..., bazel --nohome_rc test //scripts:scripts_test
(after adding engdocs/LINTING.md and .githooks/pre-commit as scripts_test
data), actionlint, shellcheck, make ci-pr-policy, make bazel-sync-check.
Confirmed lint-leg parity against current main with the pinned binary (0
issues PR-scoped; the same two pre-existing unparam findings full-tree,
unchanged) and scripts-go-checks leg parity standalone. Mutation-tested the
new/updated policy assertions with six deliberate breaks (dropped matrix
leg, reintroduced LINT, corrupted the pinned sha256, removed a cache-save
step, dropped the vet leg, reintroduced the lint job); each was caught with
an on-target failure.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): review-fix pass on F5's lint/scripts-go-checks matrix (SF-1..SF-5, N-1..N-8)
Addresses all SHOULD-FIX and NIT findings from the review of 7e858e2714
(no BLOCKERs):
- SF-1: lint/vet cache saves now run on !cancelled() instead of bare
cache-miss, so a red lint/vet run (main is currently lint-red on two
pre-existing, unrelated unparam findings) still warms the cache for
PR legs.
- SF-2: ci-measurements.yml now exports golangci-lint's install dir onto
PATH in the same step, since $GITHUB_PATH only takes effect in later
steps.
- SF-3: adds a behavioral test (fake curl/tar) proving the install
script's sha256 verification fails closed.
- SF-4: drops the commit sha from the golangci-lint cache key (saves
only on config/dependency change, not every push) and trims the
windows/darwin legs to cache only the small golangci-lint result
cache, not their large GOCACHE.
- SF-5: removes the vet cache's dead non-race-build-cache fallback
restore key (different path list, can never hit) in both pr.yml and
main.yml.
- N-1..N-8: doc/comment accuracy fixes, restores the "moved code reads
as new" caveat, adds a module-cache restore step and timeout-minutes
to pr-lint-wrapper/go-vet-cache, pins fetch-depth/GOCACHE via new
policy-test assertions, and flags a superseded doc snapshot.
New commit on top of 7e858e2714; existing commit trailers are left
untouched per explicit instruction. Not pushed, no PR opened.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): auto-sync BUILD files
Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/37105481015
(`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy).
Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see
scripts/bazel-autofix-push.sh.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* ci(bazel): raise proxied-server tier from 15 to 30 shards (F2)
bazel.yml's bazel-proxied lane (//cmd/bd:bd_proxied_test, run only with
remote execution) was sharing PR Risk's legacy 15-shard, frozen
bd-init-cost-proxy manifest block, so its longest shard was the long
pole of the Bazel-only lanes. Give it its own 30-shard block in
.github/scripts/proxied-cmd-test-shards.txt, bin-packed
longest-processing-time-first by measured wall-time
(scripts/ci/proxied_test_durations.json, captured from two bazel-proxied
job failures' testlogs) instead of the bd-init count proxy, via
scripts/ci/gen_proxied_shard_manifest.py's new --weights=duration mode.
Coverage is proven equal to the full discovered test set by two
independent methods (sorted-name diff and an actual 30-shard invocation
of proxied-test-shard.sh in list-only mode), both exact matches with no
duplicates.
cmd/bd:bd_proxied_test's shard_count moves to 30; PR Risk's and
main.yml's own test-proxied-cmd jobs keep their 15-shard matrix and
frozen manifest block untouched, per D2's retirement design (the Bazel
lane only needs to run the same tests, not the same split). Updated the
two coupled policy tests (scripts/ci_workflow_test.go's
TestBazelDoltServerTiersMirrorPRRisk, scripts/pr_risk_bazel_coverage_test.go's
TestBazelRetiredLanesCheckListedTestsRan) to allow the Bazel target's
shard_count to differ from its legacy job's own matrix size, and
engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md / engdocs/TESTING.md to document
the split.
Verified: go test ./scripts/...; bazel --nohome_rc test
//scripts:scripts_test; actionlint on bazel.yml; make bazel-sync-check;
make ci-pr-policy; 3 representative shards (1, 15, 30 of 30) run
directly against Bazel-built race bd_test/bd_for_tests binaries and the
pinned dolt 2.2.0 release, all green, 55-81s wall time each (the
duration data's absolute seconds are from a contention-era sample and
run far faster here; the LPT balance itself, not the absolute SLA, is
the property that matters).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,bazel): close fork-PR gap in proxied 30-shard manifest validation (review B1/S1)
TestShardScriptsListOnlyRealTests only ran proxied-test-shard.sh at PR
Risk's legacy 15-shard matrix, never at the Bazel-only bazel-proxied
lane's 30-shard manifest block. bazel-proxied only runs in mode=remote
(skipped on fork PRs), so a fork PR could rename, duplicate, or corrupt
a TestProxiedServer*/TestServerMode* manifest entry in the 30-block and
merge green via go test ./scripts/... (which runs on every PR), only
breaking the required lane afterward on main and every same-repo PR.
Fix: the test now computes every shard total it must validate per
script (this job's own PR Risk matrix size, every distinct total found
in that script's own committed manifest, and - for proxied-test-shard.sh
- cmd/bd:bd_proxied_test's live shard_count from BUILD.bazel) and runs
the full per-shard validation loop at each one, relying on the script's
own duplicate/stale-name guards. It also sums each total's "manifest: N"
counts across all shards and fails if they sum to zero, catching a
silently-deleted block that would otherwise fall back to 100% hashing
undetected.
Also fold in S1: replace the independently hard-coded `30` overrides in
ci_workflow_test.go and pr_risk_bazel_coverage_test.go with
bazelProxiedShardCount(t), a new shared helper that reads
cmd/bd:bd_proxied_test's shard_count live from cmd/bd/BUILD.bazel. This
turns the check_shard_coverage.py argument comparison in
pr_risk_bazel_coverage_test.go into a genuine cross-file pin (BUILD.bazel
vs bazel.yml) instead of two literals that could drift together
unnoticed. ci_workflow_test.go's tiers loop no longer asserts
BUILD.bazel's shard_count against a value read from the same file
(tautological); it instead asserts pr-risk.yml's and main.yml's legacy
test-proxied-cmd matrices equal each other, restoring the pin S1 found
removed on this branch relative to base.
Verified against the reviewer's mutations (duplicate entry, bogus
entry, whole-block deletion, stale rename, matrix divergence, BUILD
shard_count drift, bazel.yml arg drift): each now fails go test
./scripts/..., where it previously passed.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,bazel): add generator --write/--check and freeze legacy manifest block (review S3/N1/N4/N5)
gen_proxied_shard_manifest.py:
- Add --write (rewrite only the target total_shards block in place,
leaving every other block's header/body text untouched) and --check
(regenerate in memory and diff against the committed block, exiting
1 with the exact --write command needed if stale). Both operate via
new split_blocks()/write_block()/check_block() helpers that round-trip
the real manifest file losslessly.
- N1: fix the duration-weights header's false claim about the
fallback ratio.
- N5: warn on stderr when proxied_test_durations.json has duration
captures for tests that no longer exist in cmd/bd/*_test.go (renamed,
split, or deleted since the last capture).
proxied-cmd-test-shards.txt:
- N4: mark the legacy 15-shard block's header as frozen for
pr-risk.yml's/main.yml's legacy fork/push jobs: it is deliberately
not kept in sync with newly-added tests (those hash-fallback
instead), so regenerating it is not routine maintenance. Only the
header text changed; all 149 explicit assignment lines and the
"known blind spots" callouts are untouched (verified: a fresh
--write would pack all 164 currently-discovered tests explicitly,
silently changing which shard runs which test for this block, which
is exactly what "frozen" means to avoid).
- Regenerate the Bazel-only 30-shard block's header via
`gen_proxied_shard_manifest.py 30 --weights=duration --write` to
describe --write/--check instead of the old manual-copy-paste
instructions. proxied_test_durations.json has not changed yet (S2
is still in progress), so this run only touched header text; the 164
assignment lines are unchanged.
pr_risk_bazel_coverage_test.go:
- Add TestProxiedShardManifestGeneratorNotStale: runs
gen_proxied_shard_manifest.py 30 --weights=duration --check under
plain `go test` (skipped under `bazel test`, whose runfiles hold
neither the generator's sources nor cmd/bd) so a stale 30-block
(e.g. committed by hand, or left behind after adding tests without
regenerating) fails scripts-go-checks on every PR, including forks.
tools/bazel/equivalence_allowlist.txt: allowlist the new test's guarded
Bazel skip.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,bazel): rename 14 undiscovered proxied-gated tests; N2/N3/N6 doc fixes
cmd/bd/*_test.go: 14 tests call requireProxiedServerEnv/
requireSharedProxiedServer but their names did not match the shard
scripts' discovery regex ^Test(ProxiedServer|ServerMode), so no CI lane
ever set BEADS_TEST_PROXIED_SERVER=1 for them and they silently skipped
everywhere (pre-existing gap, not caused by F2; list was in
~/beads-bazel-plan/f2/review/undiscovered_gated.txt).
Fixed by renaming rather than widening discovery: 162 of the 164
already-discovered tests call one of the two gate functions in the first
few lines of their body, so name and gate already correlate almost
perfectly, but the 14 tests' names are each styled differently with no
single regex term that would cover all of them without a hand-maintained
list. Renaming lets the existing discovery mechanism, hash-fallback
behavior, and both shard-coverage policy tests pick them up with zero
other changes. Checked each of the 14 names for cross-references first;
each appeared only in its own file plus at most one doc-comment in a
sibling file, both updated alongside the rename. No collisions with
existing test names.
Discovery went from 164 to 178 tests. Regenerated the Bazel-only 30-shard
block (gen_proxied_shard_manifest.py 30 --weights=duration --write) to
pack the 14 new tests; this is the first --write this round to actually
change assignments, not just header text. The frozen legacy 15-shard
block (N4) was deliberately left alone: the 14 renamed tests now
hash-fallback into it, exactly like every other test added since it was
last generated.
cmd/bd/BUILD.bazel (N6): restore the bd_proxied_test comment sentence
bazel.yml's mirror comment kept but BUILD.bazel's had dropped: PR Risk
builds its bd-cmd-test with -race, as here; main.yml's test-proxied-cmd
twin uses build-artifacts' non-race bd-cmd-test, so this lane is the
stricter of the two.
.github/workflows/bazel.yml, .bazelrc (N2/N3): remove stale timing
language ("30 shards of ~5-10 minutes" / ".bazelrc's leftover "15 shards
of ~10 minutes") never reconciled with this task's own local
representative-shard measurements (55-81s/shard); replaced with the
concurrency argument (30 simultaneous dolt sql-servers don't fit a
GitHub-hosted runner regardless of any single shard's wall time). Also
removes the "within 5s of each other" balance claim (S2): the underlying
duration weights are contaminated by -test.parallel overlap in the
top-level <testsuite time> figures they were derived from; a corrected
re-measurement is in progress (separate commit once it lands).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,bazel): re-derive proxied duration weights without overlap double-counting (review S2)
scripts/ci/proxied_test_durations.json's 178 entries are now each a
clean, single-job (no concurrent heavy bazel/dolt job on the box),
-test.parallel=1 measurement: a fresh manifest-aligned 30-shard sweep's
own <testsuite time> per top-level test where errors="0" (including
failing-but-complete suites, whose elapsed time is still trustworthy),
plus, for the handful too slow to finish inside Bazel's default
per-target timeout, a `bazel run` leaf-subtest-only sum that never adds
a parallel group's own PASS/FAIL line on top of its already-overlapping
children's lines. An earlier pass at this data summed every PASS/FAIL
line indiscriminately, double-counting parallel subtest groups.
A first attempt at re-measuring the slow stragglers overlapped in
wall-clock time with a second, unrelated heavy sweep and came out 2-3x
inflated versus the same tests measured cleanly; that contaminated data
was discarded in favor of isolated re-runs. TestProxiedServerDep2
initially looked hung during its isolated re-run (15+ minutes with no
PASS/FAIL output and no CPU growth in the top-level test binary) but
was not: each of its subtests does real `bd init --proxied-server`
work in a short-lived child process, and Go buffers a parallel
subtest group's output until the group's last member finishes. Letting
it run to completion (2357.72s) rather than guessing avoided reporting
bad data.
seconds_per_init_fallback is recomputed as the weighted average
seconds-per-init across all 178 measured tests (sum of durations / sum
of inits), for use only when a brand-new test has no entry yet.
Re-packing the 30-shard manifest with this corrected data changes the
shard-balance picture: TestProxiedServerDep2 and TestProxiedServerClose
are each large enough, alone, to dominate their own shard (~2358s and
~1105s locally) while every other shard clusters around 741-876s. The
"within 5s" claim this replaces was never earned by the underlying
data; .github/workflows/bazel.yml now documents the real, uneven
spread and flags that the two outlier shards' local numbers already
exceed the job's 25m step timeout on their own merits (unverified
against RBE's actual per-shard throughput, since this job has only
ever run remote).
Verified: go vet ./scripts/..., go test ./scripts/... (includes the
manifest/coverage policy tests), actionlint, make bazel-sync-check,
make ci-pr-policy all pass. Exact-once coverage re-confirmed: 178
manifest assignments for 178 discovered tests, zero duplicates, zero
gaps.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cmd/bd): apply re-review candidate fixes; revert 2 unready renames (R-B1)
Re-review found the prior round's 14 renames would turn the required
Bazel + legacy 15-shard lanes red once discovered:
- TestProxiedServerHistoryRemoteRefusalFrontDoorMatrix/external-unix and
TestProxiedServerOutageReconnectAcceptanceMatrix/external-unix-socket
built a dolt.sock path under t.TempDir(), which nests Bazel's hermetic
tmp-root plus the (64-byte-truncated) test name deep enough to exceed
sockaddr_un's 108-byte sun_path limit. Both now use a new shortSocketPath
helper (a short os.MkdirTemp("", "bds") directory) instead.
- runProxiedDeadline raced a deadline-watcher goroutine against
exec.Cmd.Start()/Run()'s write to cmd.Process, caught by -race. Replaced
with cmd.Cancel, which exec.CommandContext only invokes after Start, so
the read is ordered after Start's write.
With those two fixes applied, TestProxiedServerHistoryRemoteRefusalFrontDoorMatrix
passes outright. TestProxiedServerOutageReconnectAcceptanceMatrix's race is
fixed, but both its subtests still fail a real "exceeded 3s bound" assertion
against a stopped external upstream -- a genuine latency issue, not a test
bug -- so it is reverted back to its original name
(TestProxiedOutageReconnectAcceptanceMatrix) with a comment explaining why,
pending a bead against the underlying latency.
TestServerModeSharedServeGlobalReportsTheServedDatabase also reverted back
to TestSharedServerModeServeGlobalReportsTheServedDatabase: `bd serve
--global` refuses to auto-apply 4 pending schema migrations (v65->v69) to a
shared/proxied server database and exits 1 with a consent-required usage
message instead of starting, per the #5920 migration-consent guard. Also a
genuine product/test-fixture question, not fixed here; reverted with a
comment, pending a bead.
The other 12 of the original 14 renames are kept; all 12 verified passing
in both lanes (see commits that follow for the manifest update and full
verification).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,bazel): re-derive proxied weights from parallel=4 CI-identical sweep (R-S1)
The prior round's duration data (committed in 6be9605d9f) was captured at
-test.parallel=1 (serial). That fixed a real double-counting bug, but
serial timings don't model this lane, which always runs -test.parallel=4
(--config=doltserver-proxied's own setting). Re-review measured near-zero
correlation (r=0.08) between the serial-derived predicted shard load and
actual parallel=4 wall time -- e.g. TestProxiedServerRecomputeBlocked was
weighted 812s serially but measured 33s actual at parallel=4.
Replaced with a full fresh capture: `bazel --nohome_rc test
--config=doltserver-proxied //cmd/bd:bd_proxied_test` (local execution
only, the exact config bazel.yml's proxied-server tier uses), 30/30 shards
passing, 0 failures, 0 races. Every one of the 176 discovered tests'
top-level <testsuite time> was captured directly from this run's
bazel-testlogs test.xml files -- no leaf-summation workaround was needed
this time, since none of the 176 hit Bazel's per-target default timeout
running alongside the rest of its shard.
Re-ran `gen_proxied_shard_manifest.py 30 --weights=duration --repack
--write` with these corrected weights: a deliberate full reweight, not an
incremental add, since every weight changed. The new packing clusters all
30 shards within a few seconds of ~355-360s each (176 tests summing to
10712s / 30), a dramatic improvement over the serial data's wrongly
implied two-outlier-shard spread (TestProxiedServerDep2 alone at ~2358s,
TestProxiedServerClose alone at ~1105s -- both artifacts of serial
timing, not real per-shard cost). Updated bazel.yml's paragraph to report
this honestly instead of the prior, false "exceeds 25-minute timeout"
claim, which was itself downstream of the serial/parallel mismatch.
Verified: the 12 tests kept renamed in the previous commit, plus
TestProxiedServerHistoryRemoteRefusalFrontDoorMatrix's socket-path fix,
all pass under the new 30-shard Bazel manifest (this capture run) and
under the legacy 15-shard hash-fallback script (ran the 7 shards their
hash lands in: 2, 3, 4, 5, 8, 10, 11 -- all pass).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,bazel): incremental --write, --repack, name-coverage --check (R-S2)
The prior --check compared the committed 30-shard block byte-for-byte
against a fresh from-scratch LPT pack, and --write always did a full
repack. That meant any weight drift (even from proxied_test_durations.json
alone, with no test added/renamed/removed) failed --check, and two
unrelated PRs each adding one proxied test would both force a full
repack and conflict on unrelated shard lines -- re-review demonstrated
one new test moving 73 assignment lines under the old full-repack
behavior.
Redesigned:
- --check now verifies exact-once NAME coverage of the currently
discovered TestProxiedServer*/TestServerMode* set against the
committed block -- missing, stale, or duplicated names fail with an
actionable message -- but does NOT compare shard assignments, so a
weights-only change no longer forces --check to fail.
- --write is now incremental by default: every already-assigned test
keeps its current shard, stale (no longer discovered) names are
dropped, and only newly-discovered names are LPT-placed onto whichever
shard is currently lightest. A full from-scratch LPT pack now requires
the explicit --repack flag (used in the preceding commit for the
deliberate full reweight; ordinary new-test additions should use the
incremental default).
Mutation-tested directly (not just reviewed): verified --check correctly
flags a stale name as "stale/unknown" and a newly added test as "missing"
with the exact --write command to fix it; verified incremental --write
touches only the lines for the added/removed names; verified --repack
--write produces a materially different (full rebalance) diff from the
incremental default.
Updated TestProxiedShardManifestGeneratorNotStale's comment in
pr_risk_bazel_coverage_test.go to describe the new name-coverage-only
--check semantics (it previously described the old byte-identical-packing
behavior; the test's own assertion -- exit code only -- was already
correct and unaffected).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(lint): drop unparam findings in primeGitCmd and expandStep
primeGitCmd's error return was always nil (GH#4927 made every path
infallible but left the signature); drop it and update both call sites.
expandStep's depth parameter was always called with 0 from every caller;
recursion depth is tracked internally by expandStepWith via its own
depth+1 calls on children, so the parameter was dead. Hardcode the 0
start inside expandStep and drop the parameter.
Fixes golangci-lint unparam findings:
cmd/bd/prime.go:306:67: primeGitCmd - result 1 (error) is always nil
internal/formula/expand.go:197:49: expandStep - depth always receives 0
make ci-pr-lint is clean (native + windows/amd64 + darwin/arm64 non-CGO).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(dolt): give each TestBatchApplyContract subtest its own context
TestBatchApplyContract's subtests all shared one 90s context built once
in newDoltBatchApplyFixture. BoundsTheItemCount legitimately needs most
of that budget against the server-Dolt tier (ApplyBatchInTx's create
path calls ExecuteCreate once per item, ~5-8 round trips each, for all
1000 items at the MaxApplyBatchItems bound raised by #7051). Once
earlier subtests had spent part of the shared budget, BoundsTheItemCount
would blow the deadline and every subtest that ran after it in the same
parent would fail too with "context deadline exceeded", masking the
real failure behind unrelated red subtests (nightly run 37089445362,
shard 2/16: BoundsTheItemCount at 78.9s, deadline exceeded).
Give each t.Run its own fresh testContext(t) instead of sharing one,
mirroring openStoreWithOwnBudget's established rationale for the same
bug class (be-gvnsq). The store and its copy-on-write branch stay
shared across subtests, and subtests still run in sequence; only the
per-subtest deadline is decoupled. No production code changed: the
underlying per-item round-trip cost is genuine, documented, deliberate
behavior (see applyCreate's doc comment), and batching it safely would
be a larger, riskier change than this CI flake warrants.
Verified via bazel --nohome_rc test --config=doltserver-integration
//internal/storage/dolt:dolt_server_full_test --test_filter=TestBatchApplyContract
-t- --test_output=all: shard 2/16 (same shard as the original failure)
now passes, TestBatchApplyContract in 77.68s with BoundsTheItemCount at
66.08s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(embeddeddolt): skip redundant 1000-item wall-clock case under -race
TestLargeBatchApplyWallClock_Embedded's 1000-item shape was taking
597-651s under --config=embedded (-race), inflated by race-instrumenting
the in-process Dolt engine's own internal goroutine/lock machinery on
every statement issueops.ApplyBatchInTx issues. The Dolt server (TCP)
tier doesn't pay this cost: its sql-server runs in a separate,
non-raced subprocess (dolt_race_off), but the embedded backend runs
Dolt entirely inside this test binary, so -race instruments all of it.
This pushed the embedded-storage CI lane's shard 5 over its 19-minute
per-shard test timeout (panic: test timed out after 19m0s).
The 1000-item case carries no pass/fail assertion on duration or count
(the test is explicitly a logging-only measurement, not a regression
gate), so skipping it under race removes no coverage. Real 1000-item
(issueops.MaxApplyBatchItems) correctness coverage is unaffected: it
still runs and is asserted by TestBatchApplyContract/BoundsTheItemCount
in this same package, under the same race lane.
Adds the established raceEnabled build-tag pair (see
internal/workapi and cmd/bd for the sibling idiom) to this package so
the skip can be conditioned on -race.
Verified via Bazel (--config=embedded, --nohome_rc):
TestLargeBatchApplyWallClock_Embedded: 651.23s -> 86.79s
(1000 now SKIPped; 356 still runs and passes)
Shard 5 of embeddeddolt_embedded_test: FAIL -> PASS
Not fixed in this commit: TestBatchApplyContract/BoundsTheItemCount's
embedded instantiation still takes ~903-945s under -race and leaves
shard 4 of embeddeddolt_embedded_test over its 19-minute budget. Unlike
the wall-clock test, that subtest carries real correctness assertions
via the shared backend/conformance.RunBatchApplyBoundsTheItemCount, and
shrinking it would require a cross-backend conformance-test design
decision (e.g. a per-fixture item-count override) that trades away real
MaxApplyBatchItems boundary coverage for one backend - judged out of
scope for an isolated test-only fix here. Flagging for a deliberate
follow-up rather than weakening the assertion to make it fast.
TestLargeBatchApplyStatementCounts_Embedded and the dolt-tier
TestLargeBatchApplyStatementCounts_Dolt were checked and left
untouched: neither includes the 1000-item shape, neither showed any
slowness or flakiness, and both pin exact statement-count regression
baselines that should not be disturbed without cause.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(cmd/bd): fence test-binary beads/git discovery against ancestor .beads
cmd/bd's test binary ambiently discovers its beads workspace the same way
production bd does: via internal/beads.FindBeadsDir's worktree-fallback and
ancestor-walk logic. When this package's checkout is itself a linked git
worktree (e.g. a sibling checkout like beads-bazel-y next to beads), the
first cached git-context call made anywhere in the test binary - before any
individual test has had a chance to chdir into its own isolated fixture -
permanently answers isWorktree=true/a real --git-common-dir for the rest of
the process. beads.FindBeadsDir then treats that as license to read (and
tests that don't isolate properly could write) the main checkout's shared
.beads database.
Confirmed via direct reproduction in a disposable scratch main+worktree pair
under /data/tmp (never /data/projects/beads): running a correctly-built `bd
--version` from the worktree checkout's cmd/bd directory resolves and warns
about the fake main checkout's .beads permissions, demonstrating the
fallback is reachable from plain ambient discovery, not just from a
contrived unit test.
internal/git.PinNoRepositoryForTesting seeds the process-wide git context
cache with a "not a git repository" sentinel as the first statement of
testMainInner, making the worktree-fallback vector inert by default. Tests
that need real git behavior for a fixture they control already call
git.ResetCaches/beads.ResetCaches after chdir'ing there (the existing
cmd/bd/git_test_helpers.go idiom), which overrides the pin for their own
scope - this is unchanged.
Separately, testMainInner now appends (never overwrites) a
BEADS_CEILING_DIRECTORIES entry for the package's own repo root, bounding
any literal ancestor-directory walk that starts at or under this checkout -
closing a second vector (an ancestor walk escaping past a nested worktree
root into a directory-with-.beads further up) that the pin alone doesn't
address. The existing pollution guard is extended to also watch the
worktree-fallback .beads directory (resolved via a direct, cache-independent
git shell-out) as a defense-in-depth detection backstop.
Verified via two full before/after `go test -tags "cgo integration" -v .`
runs of cmd/bd in a disposable linked-worktree scratch clone: identical
pass/fail sets before and after (no regressions), and zero filesystem
writes observed (inotify-monitored) in the scratch main checkout's .beads
in either run - the existing subprocess test helpers already discipline
themselves to set an explicit cmd.Dir/BEADS_DIR, so no currently-live test
was caught actively polluting the fallback directory in this repro. This
change is defense-in-depth against the mechanism itself (and against
regressions reintroducing it), rather than a fix for an empirically
isolated failing test in the current suite.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): make embedded-dolt and go:embed tests discoverable by their CI shards
embedded-test-shard.sh discovers cmd/bd's embedded-dolt tier by grepping
`^func TestEmbedded` out of cmd/bd/*_embedded_test.go — a filename-glob
match, not a package-wide one. 11 TestEmbedded* functions lived in files
that didn't match that glob (auto_import_upgrade_test.go,
dep_list_cross_db_test.go, and four files mixing TestEmbedded* with
unrelated TestProxiedServer*/TestServerMode*/TestWithFetchOneExtra_*
siblings: max_rows_test.go, store_factory_test.go,
purge_wisps_plane_integration_test.go, types_create_agreement_test.go).
They compiled and would run under a plain `go test`, but were invisible
to every CI lane that drives this tier off that discovery (the 20-shard
embedded cmd matrix), so they never ran in CI at all.
Fixed by relocating them into *_embedded_test.go files: a straight
`git mv` for the two files that were purely TestEmbedded* content, and a
function-level split for the four mixed files (moving just the
TestEmbedded* function itself; shared helpers/types stay put since
Go doesn't care which file in a package defines a symbol). The newly
discoverable tests aren't in embedded-cmd-test-shards.txt — consistent
with the ~55 pre-existing discovered-but-unlisted tests already in this
suite, they fall back to the manifest's documented hash(name)%shards
assignment. Verified via `BEADS_TEST_SHARD_LIST_ONLY=1` across all 20
shards: all 212 tests (201 + 11) are now listed exactly once, no shard
comes up empty. Also verified for real: built the cmd/bd test binary
and ran all 11 against a prebuilt bd binary (BEADS_TEST_BD_BINARY) from
the repo root, matching how CI invokes the prebuilt CMD_BINARY — all 11
pass.
Separately, 5 functions had a `TestEmbedded` prefix for an unrelated
reason — go:embed'd content (agents_test.go's AGENTS.md template tests,
schema_test.go's migration-source duplicate-version check) — and so were
being silently caught and skipped by the repo-wide `-skip '^TestEmbedded'`
pattern PR Core/main CI lanes use to exclude the Dolt-embedded tier from
./... runs. Renamed to a TestGoEmbed* prefix so they run where every
other unit test in their packages does; no other references to the old
names exist in the repo. Confirmed with `-skip '^TestEmbedded'` locally:
all 5 now run (previously would have been silently skipped).
Repo-wide grep for stray `^func TestEmbedded` outside cmd/bd,
internal/storage/embeddeddolt and internal/storage/dolt now returns only
internal/tracker's TestEmbeddedDoltExternalRefChangedAfterUsesHistoryFastPath,
which is genuinely about the Dolt-embedded backend and correctly named.
cmd/bd/BUILD.bazel regenerated via `bazel run //:gazelle` to reflect the
renames/new files; it also picked up internal/ceiling as a go_test dep,
a sync gap left over from test_repo_beads_guard_test.go's import in the
prior commit on this branch.
Verified: go build/vet (default, -tags cgo) clean; gofmt clean; go test
./scripts/...; bazel --nohome_rc test //scripts:scripts_test; bazel
--nohome_rc build //cmd/bd:bd_embedded_test; bazel --nohome_rc run
//:gazelle (cmd/bd/BUILD.bazel diff only); python3 tools/bazel/go_srcs.py
--check (make bazel-sync-check); make ci-pr-policy; make ci-pr-lint
(gofmt + golangci-lint native/windows/darwin, 0 issues). cmd/bd test
binary runs were built from cmd/bd (not the module root) and executed
with BEADS_TEST_BD_BINARY set to a binary built the same way, to avoid
buildEmbeddedBD's `go build -o X .` resolving "." against the wrong
package when invoked outside `go test`'s own working directory — not a
bug in this change, reproduced identically against an untouched,
already-correctly-named test (TestEmbeddedVersion). /data/projects/beads/.beads
checked before and after: no change beyond the pre-existing 166 untracked
.beads/formulas/*.toml files already present at session start.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(embeddeddolt): shrink BoundsTheItemCount's real apply under -race
TestBatchApplyContract/BoundsTheItemCount's embedded instantiation
measured 903-945s under -race (shard 4's single biggest long pole),
because the in-process cgo Dolt engine's own goroutine/lock machinery
runs inside the race-instrumented binary for a full 1000-item apply.
Every backend's ApplyBatch validates via the same storage.PlanApplyBatch
before opening any transaction, so the refusal half of this subtest is
already O(1) regardless of count, and the exact 1000/1001 boundary is
already pinned, for real and sub-millisecond, by
TestPlanApplyBatchAcceptsTheBoundary in internal/storage/batch_apply_test.go.
That leaves only "does this backend's own write body durably land N
accepted rows" as the expensive, backend-specific thing this subtest's
"at bound" half needs N real items for - and N does not need to be 1000
to prove that.
Split RunBatchApplyBoundsTheItemCount into a thin wrapper (unchanged,
still used by internal/storage/dolt and internal/storage/uow at the
full MaxApplyBatchItems) plus a new RunBatchApplyBoundsTheItemCountAtScale
taking an explicit atBoundItems. Embedded's subtest now applies 150 items
under -race (65.33s locally, down from 749.22s unmodified on the same
host) and the full 1000 otherwise, via the existing raceEnabled idiom.
internal/storage/dolt's non-race BoundsTheItemCount still covers the
shared inner write body at the full 1000-item count every PR. No CI lane
covers embedded's own post-commit wrapper at 1000 items anymore after
this change (the only non-race embeddeddolt build is compile-only and
never executed) - a known, reported, deliberate gap, documented in both
the updated large_batch_apply_measure_test.go comment and the task's
impl-report.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(git): make test-repository pin survive ResetCaches
PinNoRepositoryForTesting wrote its "no repository" sentinel into the
same gitCtx variable ResetCaches() unconditionally clears, so any test
fixture that calls ResetCaches() after the pin is set (runInDir's
cleanup, resetRepoCachesForTest, 25+ call sites) silently un-pins the
whole test binary for every later test. A reviewer's probe test proved
the bypass: GetRepoRoot() returned the real checkout path after a single
runInDir round-trip.
Replace it with PinNoRepositoryUnderForTesting(root), a separate,
directory-scoped pin checked live against os.Getwd() on every
getGitContext() call, before the gitCtxOnce/gitCtx one-shot cache is
touched at all. The pin survives ResetCaches() for any working directory
at-or-under the pinned root, while fixtures that chdir OUTSIDE that root
(the normal t.TempDir() pattern) still get real git detection.
Add TestPinNoRepositoryUnderForTestingSurvivesResetCaches, reproducing
the reviewer's exact repro and proving the fix: pins a real repo root,
confirms unpinned after chdir+ResetCaches outside the root, and confirms
STILL pinned after chdir+ResetCaches back inside the root (mimicking
runInDir's cleanup).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(cmd/bd): widen guard fallback coverage, document -C/doctor gap
Two review follow-ups on the test-repo .beads guard:
1. Honest scope documentation: FindBeadsDirFrom/ResolveBeadsDirForRepo's
-C/doctor paths shell out to git directly with the ceiling env var
stripped, so PinNoRepositoryUnderForTesting (see previous commit) does
not fence them. Document this residual gap explicitly rather than
implying full coverage; covering it would need those call sites to
consult the pin too, which is out of scope here.
2. The guard's fallback-.beads watch list only watched metadata.json and
skipped watching entirely when the main .beads directory was absent —
exactly the layout where the worktree fallback is actually in use.
Restructure to check the main and fallback directories independently,
add config.yaml/routes.jsonl to the flat watch list, and add a
recursive snapshot of dolt/ (snapshotDoltTree) so a real pollution
write anywhere under the fallback's Dolt-backed state is caught.
diffSnapshots is generalized to also report newly-appeared keys, since
a recursive tree snapshot can legitimately gain entries between
before/after in ways the old fixed-name flat list never could.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci): pin MaxRows embedded tests off their shared race shard
TestEmbeddedMaxRowsNonListPaths and TestEmbeddedMaxRowsList both hashed
to embedded cmd shard 16, which measured 746s wall under -race
(605s + 214s) against a 19-20 minute budget on a 192-core host with
effectively unbounded test.parallel; CI's 4-way parallelism would be
worse. Neither test had ever run under race in CI before this branch
surfaced them to their own shards.
Both tests spawn many independent bd subprocesses per subtest
(bdInit + exec.Command), so their cost is dominated by subtest/subprocess
count rather than a single large-N parameter; buildEmbeddedBD also never
passes -race to the spawned bd binary, so there is no raceEnabled-style
"shrink N" lever analogous to BoundsTheItemCount's that would apply here
without just deleting coverage. Pin them to shards 11 and 13 instead,
the two lightest shards by current manifest+hash-fallback test count
(verified via BEADS_TEST_SHARD_LIST_ONLY=1, which lists shard
composition without executing any tests).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(embeddeddolt): correct coverage comments, range-check, document build tags
- large_batch_apply_measure_test.go's doc comment above
TestLargeBatchApplyWallClock_Embedded had three factual errors: the
150-item sibling subtest does not always run at 150 "race or not" (it's
1000 without -race); the 356-item shape is not "non-race only" (it runs
under race too, as the same comment's next line said); and the
server-Dolt full suite does not run on "every PR" (full_embedded in
.github/scripts/ci-embedded-tier.sh is unconditional on merge_group/push
but conditional on PRs, per pr-risk.yml's gating). Rewrote the comment to
be self-contained (no out-of-repo citation) and accurate, and reworded
the related t.Skip message. Fixed the same "every PR" overstatement in
batch_apply_contract_test.go's BoundsTheItemCount race-branch comment.
- Added a range-check to
conformance.RunBatchApplyBoundsTheItemCountAtScale: atBoundItems must be
1..publicops.MaxApplyBatchItems, since that's the production bound this
contract pins.
- Documented why race_detector_on_test.go/race_detector_off_test.go use
`cgo && race`/`cgo && !race` instead of the plain `race`/`!race` pair
used by internal/workapi and cmd/bd: every consumer of raceEnabled here
is itself cgo-gated, so the matching cgo tag keeps this file out of
non-cgo builds too, where it would otherwise compile with no consumer
and trip an unused-lint finding.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(dolt): give BoundsTheItemCount 3x timeout budget
The server-Dolt tier's BoundsTheItemCount subtest measured 66s against
the package's shared 90s testTimeout — a thin margin on a loaded CI
runner. Give it a dedicated 3x (270s) context.WithTimeout instead of
raising the shared testTimeout constant, since that constant also scales
every other subtest's 5*testTimeout cleanup bound package-wide; a local
override keeps the blast radius to the one expensive subtest.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(ci): run embedded-Dolt batch-apply suite non-race in nightly
The nightly full-test job's main suite (go test -race ... ./...) never
sets BEADS_TEST_EMBEDDED_DOLT, so every skipUnlessEmbeddedDolt-gated test
in internal/storage/embeddeddolt — including TestBatchApplyContract and
the 1000-item case of TestLargeBatchApplyWallClock_Embedded — is skipped
on every CI lane, not just this one. Add a dedicated non-race step so a
real 1000-item apply through the embedded backend's own
version-commit-published-after-the-tx wrapper gets exercised somewhere:
non-race because the embedded engine's own goroutine/lock machinery runs
inside this test binary and the race detector dramatically inflates its
wall-clock (see race_detector_on_test.go), which would defeat the wall-
clock test's purpose and reintroduce the kind of shard-timeout pressure
the MaxRows shard-pin commit just worked around elsewhere.
Verified locally from a fresh /tmp clone (outside any .beads ancestor,
per this task's safety rules):
BEADS_TEST_EMBEDDED_DOLT=1 go test -tags gms_pure_go -run '^(TestBatchApplyContract|TestLargeBatchApplyWallClock_Embedded)$' ./internal/storage/embeddeddolt
PASS, 178.3s total (BoundsTheItemCount 81.06s, WallClock/1000 63.14s),
comfortably inside the job's 45-minute timeout.
Add TestNightlyFullTestRunsEmbeddedDoltBatchApplySuite to
scripts/ci_workflow_test.go, pinning the step's exact run command, its
BEADS_TEST_EMBEDDED_DOLT=1 env, that it runs after the main suite step,
and that it stays non-race.
Co-Authored-By: Claude Sonnet 5 <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>
* ci(bazel): move package-mcp/package-npm gates into bazel.yml (F3)
Package gates now build bd via Bazel (no --config=ci) when the rbe job
enables it and fall back to go build otherwise, so forks/Dependabot/rbe-off
runs are unaffected. pr.yml's CI Gate keeps PACKAGE_MCP/PACKAGE_NPM required
and never-skippable, now sourced from needs.bazel.outputs.*; the retired
detect-package-gates/package-mcp/package-npm pr.yml jobs and
DETECT_PACKAGE_GATES are deleted. MCP pytest pins -n 8 explicitly with
pytest-xdist locked via uv lock. rbe, bazel-coverage, and both required gate
jobs move to Blacksmith for same-repo PRs (gate names unchanged).
Also closes a gap in detect-package-gates.sh (missing bazel.yml in the
force-both-gates path list, since the job definitions moved there) and wires
integrations/beads-mcp's manifest/lock into scripts_test's Bazel data so the
new pytest-xdist pin check runs under `bazel test` too.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): review fix-up for F3 package gates (SF-1, SF-2, nits)
Review of 65f378d241 (~/beads-bazel-plan/f3/review.md, no blockers) found:
- SF-1: the package gates' `bazel build //cmd/bd:bd_for_tests` resolved to
a different output configuration (k8-fastbuild) than `bazel test
--config=ci`'s bd_for_tests (k8-fastbuild-ST-..., via test:ci ->
test:prcore's --@rules_go//go/config:race), so it got no action-cache
reuse from the test job. Add the matching race flag to both jobs' build
step; verified with cquery that both invocations now cquery to the
identical bazel-out/k8-fastbuild-ST-.../bin/cmd/bd/bd_for_tests/bd path,
and with a real build that it's an action-cache hit once bazel test
--config=ci has run. Update the pinned Run string in
pr_lanes_bazel_coverage_test.go and the impl report's cache-reuse claim.
- SF-2: drop stale comments/doc text saying the package gates download
bazel-ci-build-artifacts; they build their own bd now (bazel.yml,
pr.yml, engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md).
Nits: pin both required gates' display names in TestSameRepoBlacksmithRunners
(nothing else reads job.Name, so a rename would otherwise go uncaught); pin
the package jobs' Python/uv/Node setup against main.yml's copies; add
timeout-minutes to both gate jobs and detect-ci-tier (same-repo PRs now run
on paid Blacksmith minutes, not a free runner's 360-minute default); shut
down Bazel and remove the RBE client key right after each package job
packages its Bazel-built bd (nothing downstream needs either); add
scripts/ci/package-bazel-bd.sh to detect-package-gates.sh's both-gates
trigger arm and pin it in TestDetectPackageGatesCoversBazelWorkflow.
Every fix mutation-tested (mutate -> test fails with a specific message ->
restore from a /tmp backup, diff-confirmed identical -> test passes again).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* ci(bazel): retry Go module fetches and scale download timeouts in every mode
A fork run failed Bazel / test on one proxy.golang.org TLS handshake
timeout. gazelle's go_repository fetches modules with the go command
(fetch_repo), which never retries, and Bazel's downloader retry flags do
not reach it. setup-bazel's generated rc now sets
--repo_env=GOPROXY=https://proxy.golang.org|https://proxy.golang.org|direct:
with "|" the go command moves to the next entry on any error, so the proxy
is tried twice and then the module's origin. fetch_repo checks every
module against its go.sum hash whatever the source. Verified with Bazel
9.2.0: an unreachable first entry still fetches all 438 go_deps repos,
and without a fallback the fetch fails.
--http_timeout_scaling=2.0 doubles the timeouts of Bazel's own
downloader (the Go SDK, http_archive), which already retries.
Both flags are key neutral (repository fetching only) and apply in every
mode, because repository fetching always runs on the runner.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the integration lane for fork and Dependabot PRs in cache mode
bazel-integration was remote-only, so fork and Dependabot PRs (mode
cache) had no PR-time integration run at all: main.yml's integration jobs
run only after merge. With rbe-west's anonymous read-only cache, every
action trusted CI already ran is a hit, so the GitHub-hosted runner builds
and tests only what the PR changed.
Simulated in an ubuntu:24.04 container with 4 CPUs and only the generated
rc (no user rc). This setup's action keys match CI's: the ci lane
reproduced the fork run's 6550 processes with 4847 cache hits.
- Main HEAD: 143 s (4656 hits, 12 local, 113 of 115 tests cached).
- A cmd/bd change: 170-290 s.
- Cache closed (cold, all local): about 30 minutes.
- bazel.yml: the lane's if is now mode remote or cache, never local
(rbe=off). The step timeout goes from 45 to 75 minutes (job 85), so a
closed cache (the farm's kill switch) still leaves fork PRs green.
- bazel-gate.sh: mode cache no longer allows BAZEL_INTEGRATION to skip.
Mode local still does.
- New TestBazelCacheModeReachesTheRC runs, end to end, the real decision
step for 22 starts:
- fork, Dependabot and same-repo PRs, push, rbe=cache/off dispatches
and bazel-farm, each with the variable on and unset;
- same-repo runs with and without the secret;
- a fork PR that "has" the secrets, and one passing fork-farm.
For each start it evaluates every lane's if and setup-bazel env, runs
write-bazelrc.sh, and checks bazel-gate.sh's skips. A cache-mode rc
carries --config=fork-cache and the fetch hardening, and no executor,
TLS file, instance, upload, header, BES or masked secret.
- ci_workflow_test.go: the integration if, the run modes, and a
closed-cache floor for the step timeout.
- Comments in bazel.yml, pr.yml and bazel-farm.yml, and the topology
engdoc. The engdoc also covers:
- fork-cache's slow-blob behaviour: 15 s read deadlines trip the
breaker, then "Lost inputs" and one build restart, still green;
- why the endpoint's FindMissingBlobs denial never affects cache-only
clients.
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>
* ci: retire pr.yml's legacy PR Core, build, pure-Go, domain+uow and contract jobs where the gated Bazel lanes run them (D2 step 3)
On same-repo, non-Dependabot pull_requests while the committed
BAZEL_RETIRES_LEGACY_PR_LANES flag is "true" (bazel-coverage's new
pr_lanes output; the job stays identical in pr.yml and pr-risk.yml),
pr.yml's build-artifacts, pr-core-wrapper, check-cmd-bd-puregeo-tests,
test-domain-uow and contract-corpus stand down. ci-gate accepts those
skips only then, and BAZEL_PR_LANES_RETIRED requires the same run's
Bazel test, pure-Go/js-wasm and dolt-server lanes to have run remotely
and passed. Revert: commit the flag "false" in both workflows.
What the retired jobs did besides their tests keeps running on every PR:
- the package gates take bazel-ci-build-artifacts (bazel-test's bd, same
layout) where build-artifacts stands down;
- the Dolt server fingerprint moves to its own required job;
- the Go tests Bazel does not run or skips (equivalence allowlist) run
under go test in pr-preflight-platforms' Linux leg, each required to
pass (tools/bazel/run_allowlisted_go_tests.py).
In mode remote the three lanes' bazel test invocations add
--config=sole-run (no cached test results, no whole-invocation retry on
remote cache eviction), as steps 1 and 2 do for their lanes.
Policy tests: decision matrix and named cases extended to the third
flag, gate simulation for the pr.yml tier, artifact consumers, pinned
lane steps and rc lines, a repo-wide narrowing scan of BUILD rules and
.bzl files, and the allowlisted-test runner.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record the retired pr.yml PR Core, build, pure-Go, domain+uow and contract jobs in the check topology
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): only pr.yml's workflow env sets a BAZEL_RETIRES_* flag, and only the decision step reads one
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(pr): keep go test ./scripts/..., go test's vet and the Bazel-skipped tests on every PR (D2 step 3 review F1, F1b, F3, L2)
Review of D2 step 3: retiring PR Core removed the only required pre-merge
`go test` of the scripts packages, whose policy tests (the D2 guards
among them) check part or all of their rules under go test only, and
go test's implicit vet for every package (rules_go's go_test runs none).
New required job scripts-go-checks (SCRIPTS_GO_CHECKS), on every PR, in
PR Core's environment (dolt, git and dolt identity, test-env):
- scripts/ci/scripts-go-test.sh: `go test ./scripts/...` with PR Core's
flags;
- scripts/ci/go-test-vet.sh: `go vet` with cmd/go's defaultVetFlags over
./..., policy-tested equal to the running toolchain's list;
- scripts/ci/allowlisted-go-tests.sh, moved here from
pr-preflight-platforms.
TestBazelOnlySkipsAreAllowlisted also requires every test that runs part
of its checks under go test only (a Bazel-guarded return/continue, or a
go-test-only block that reports failures) to live under ./scripts, the
only packages go test still runs on every PR; and step 3's
TestRunAllowlistedGoTestsScript gets its allowlist entry.
Package gates on a covered PR whose Bazel call did not run remotely (the
farm switch off) now fail in their own step naming
BAZEL_PR_LANES_RETIRED instead of on a missing artifact (L2).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record scripts-go-checks, the skip-allowlist check and the re-run-safe uploads for D2 step 3
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(ci): allowlist the scripts tests that skip under Bazel, and check new ones before merge
nightly.yml's skip-parity check (equivalence.py --go-test-json) went red
on 2026-10-02 (run 36955306415): TestBazelGatedLanesNeverRetryFlakyTests
and TestCheckShardCoverageScript pass under go test and deliberately
t.Skip under Bazel (their inputs are not in //scripts:scripts_test's
runfiles), but had no `skip` allowlist entry. Step 2's
TestShardScriptsListOnlyRealTests and TestShardScriptNarrowingCheck, now
on main, have the same shape and would have turned the next nightly red.
Add the four entries, and TestBazelOnlySkipsAreAllowlisted: it parses
every _test.go file of the module and requires each top-level test whose
t.Skip is guarded by TEST_SRCDIR or bazeltest.IsBazel() (directly or
through a helper) to have an entry, so a new one fails under go test
before the merge instead of in the next nightly. It skips under Bazel
itself and is allowlisted too.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(test): keep cmd/bd's integration init out of the credential-command helper process
nightly.yml's Full Test Suite (go test -tags=integration ./...) failed
TestApplyInitGatewayCredentialAdoptsToken and ...FailsClosed on
2026-10-02 (run 36955306415): credentialcmd re-execs the test binary as
the credential helper, and cli_fast_test.go's integration-tagged init()
runs in that child before TestMain can dispatch it, tries `go build .`
from the helper's working directory and panics, so the helper exits 2.
Add credentialcmd.IsHelperProcess (Dispatch's two gates) and return from
that init early, as it already does for the worktree-remove helper.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): overwrite fixed-name artifacts so "Re-run failed jobs" does not 409
A job re-run is the same workflow run, and upload-artifact v4+ refuses a
second artifact of the same name there (409 Conflict). bazel-test uploads
the bd package even after its tests fail, so re-running a failed Bazel /
test lane, the documented recovery for an eviction or a flake, failed on
the upload even when every test passed. Set overwrite: true on all eight
uploads in bazel.yml (the bd package, BUILD sync patch, every lane's test
logs) and policy-test it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(test): keep skip-scan fixture functions out of line-based test discovery
The fixture source in bazel_skip_allowlist_test.go had top-level
`func TestXxx(t *testing.T)` lines, which equivalence.py (and the CI shard
scripts) count as tests of the scripts package; write them with a FUNC
placeholder and substitute at write time.
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>
* ci: retire PR Risk's legacy proxied and server-Dolt tiers where the gated Bazel lanes run them (D2 step 2)
On same-repo, non-Dependabot pull_requests, PR Risk's test-proxied-cmd (15),
test-server-storage and test-server-storage-full (16) jobs stand down while
the committed BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS flag is "true" (in both
pr.yml and pr-risk.yml, policy-tested equal); pr.yml's gated Bazel
proxied-server and server-Dolt storage lanes are then the tiers' only
pre-merge run. build-embedded, whose embedded-test-binaries artifact feeds
exactly the six retired legacy test jobs, stands down where both D2 steps
apply.
Generalizes step 1 instead of copying it:
- bazel-embedded-coverage becomes bazel-coverage (identical in both
workflows): one decision step, outputs embedded and dolt_server, each
flag && pull_request && !fork && actor != dependabot[bot]; gate id
BAZEL_COVERAGE.
- PR Risk's gate accepts the retired jobs' skips only when their output is
true, and BUILD_EMBEDDED's only when both are.
- pr.yml's gate adds BAZEL_DOLT_SERVER_RETIRED: red when dolt_server is true
and the mode is not remote or BAZEL_PROXIED / BAZEL_SERVER_STORAGE is not
success (shared helper with BAZEL_EMBEDDED_RETIRED).
- Lane hardening as for embedded: --nocache_test_results for
doltserver-proxied and doltserver-integration, the flaky-target query,
check_shard_coverage.py (proxied 15 shards; server full suite 16 shards
plus --whole conformance), pinned test steps, rc lines and target
args/env; the shard listings now run concurrently (the server script
forks per test).
- Policy tests generalized over the retired tiers: decision equivalence
with bazel.yml's mode across two runs, both gates simulated, flag
equality, artifact consumers, real shard scripts in list-only mode.
Revert: commit BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS: "false" in both
workflows.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record the retired legacy proxied and server-Dolt tiers in the check topology
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): no whole-invocation retry on remote cache eviction in the retired tiers' lanes
Review F1 (D2 step 2): Bazel 9 re-runs a whole `bazel test` invocation
(--experimental_remote_cache_eviction_retries, default 5) when an input was
evicted from the remote cache, and that exit code outranks a test
failure. With --nocache_test_results every test runs again and only the
retry is reported, so a flaky failure in the embedded, proxied or
server-storage lane (each now its tier's only pre-merge run) could turn
green. Set the retries to 0 in test:embedded, test:doltserver-proxied and
test:doltserver-integration (not remote-exec, which must stay key-neutral),
pin the lines, forbid any other line or the setup-bazel action from
setting the count, and correct the topology doc, which claimed the retry
never re-runs a failed test.
Reproduced against a local HTTP cache emptied mid-build: with the default
the build hit "Lost inputs", retried and exited 0; with 0 it failed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): pin how the retired lanes' shard scripts run their tests
Review F2 (D2 step 2): the narrowing scan covered tools/bazel and the
setup-bazel action but not the four .github/scripts/*-test-shard.sh
scripts the sharded targets execute, so appending -test.short to an exec
line or exporting BEADS_TEST_SKIP there passed the policy tests (and
check_shard_coverage.py only rejects a shard that is entirely skipped).
Pin each script's prebuilt-binary and go test fallback commands exactly
and its RUN_REGEX construction, and forbid anything else in the scripts
from running tests or selecting, skipping or switching them. The scripts
themselves are unchanged (the legacy jobs run them too); a self-test
checks that six narrowing edits are rejected.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): simulate a non-true coverage decision per retired tier
Review F3 (D2 step 2): the "decision succeeded but its output is not
exactly 'true'" gate scenarios set both bazel-coverage outputs bad at
once, so the embedded ids reddened the gate whatever the dolt_server rule
said, and weakening PR Risk's gate to `!= "false"` for one tier passed.
Run them per tier, with the other output a valid "false" and only that
tier's job skipped, and isolate build-embedded's both-true rule the same
way. Failed or cancelled decisions keep the all-skipped scenarios.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): list Bazel tier coverage and the proxied/server-Dolt checks as not directly required
Review F4 (D2 step 2): the topology doc still named the renamed
`Bazel embedded coverage` job, and its list of check names not to require
directly lacked the proxied and server-Dolt test jobs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): skip the real shard-script listing test on bash < 4
The CI shard scripts use associative arrays and only run on Linux runners;
macOS's /bin/bash 3.2 can't execute them.
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>
Post-merge review follow-up to #5614.
#5614 replaced the shell checker's three-way drift remedy with a bare
"Run: scripts/update-versions.sh <canonical>" in both the Go checker
(status 1) and bd preflight's Version sync output, and the release-tag
pre-push hook kept answering status 1 with "Fix with:
scripts/update-versions.sh <version>". update-versions.sh derives the old
version from cmd/bd/version.go and anchors its substitutions on it, so
with version.go already at the canonical version that re-run rewrites
only the .githooks markers and uv.lock and leaves any other drifted file
as it was.
Restore the remedy as versioncheck.Report.MismatchRemedy, shared by the
checker and preflight:
- one file drifted: edit it to the expected value
- several drifted: set version.go to the previous version, then replay
scripts/update-versions.sh <canonical>
- version.go is wrong: scripts/update-versions.sh <intended-version>
The hook's status-1 text now points at the checker output instead of
prescribing update-versions.sh; status 3 is unchanged. The text is sized
so one drifted file shows in full within preflight's 500-byte human
output, with the several-files case ahead of the version.go one.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(storage): measure ApplyBatchInTx SQL statement counts (B0)
Adds a driver.Connector-level counting/latency-injecting wrapper
(internal/storage/sqlcount) plus shared plan-request fixtures
(internal/storage/batchfixtures: mol-normalized 356/712-item shapes and a
40-item classic shape) and backend-specific pinning tests + benchmarks
(internal/storage/embeddeddolt, internal/storage/dolt) that measure the
ACTUAL number of SQL statements issueops.ApplyBatchInTx issues for each
shape, on both the embedded and Dolt (TCP) backends.
Measured totals (Prepare+Exec+Query+StmtExec+StmtQuery inside one
transaction): 356 items ~7008-7009, 712 items 14014-14015, 40 items 846,
identical on both backends (expected: statement issuance is driven by Go
application logic, not backend-specific SQL planning). Pinned with a small
(+/-2) tolerance to absorb an observed, host-contention-driven +/-1 Query
drift (Exec is deterministic on every run). This is the regression baseline
slice B2 (a later, lighter fast path) must demonstrably lower.
batchfixtures.UncappedPlan bypasses issueops.MaxApplyBatchItems so this
measurement does not depend on slice B1's cap raise.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(httpapi,issueops): raise batchApply envelope to 1000 items with bounded large-apply handling
POST /v0/beads/issues:batchApply now accepts up to 1000 items (up from 100);
issueops.MaxApplyBatchItems moves accordingly and the request body cap rises
to 16 MiB. The whole plan still applies in exactly ONE transaction. A request
over 100 items runs under a separate, flat, operator-configured whole-run
budget (`bd serve --large-apply-ceiling`, 5 minutes by default) instead of
the ordinary 60s request deadline; a request at or under 100 items is
unaffected and keeps exactly the 60s deadline and 15s commit-retry ceiling it
always had.
Concurrency and shutdown are bounded, not just documented:
- Oversized requests serialize through a dedicated one-wide semaphore, and at
most one caller may wait for that semaphore at a time (a CAS-guarded single
waiter) — a burst of oversized requests is shed with 503 rather than
queuing and starving ordinary traffic behind the general semaphore.
- The run deadline is stamped only once the slot is actually acquired, not
at the time the request arrived.
- Graceful shutdown closes new admissions before computing its drain budget,
then waits out an in-flight large apply up to its own remaining deadline
(plus a few seconds' grace for the response to write); any large apply
still queued for the semaphore when shutdown begins is refused rather than
extending the drain further. A queued caller that disconnects gets a clean
503, never a misclassified context error. `bd serve`'s orchestrator stop
grace must be at least `--large-apply-ceiling` — see
engdocs/SERVE_RUNBOOK.md.
- ApplyBatch's commit-retry budget only extends past the ordinary 15s ceiling
on this explicit large-apply path (via a context marker), with headroom
reserved so the final retry attempt can't be killed mid-commit by the
context's own expiry.
A new `issues.batchApplyLarge` capability token on `GET /v0/beads/context`
lets a client learn whether a given server accepts the raised envelope.
Wall-clock measurement (embedded Dolt, whole-transaction build+commit) backs
the 5-minute ceiling default: 356 items ~12.6s (23.8x headroom), 1000 items
~57.5s (5.2x headroom).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(httpapi,serve): wire the large-apply retry budget; repair stale pins
Review fixes for the large batchApply envelope, on top of the test
repairs the PR needed against main.
The extended commit-retry budget was never switched on.
internal/storage/uow's retryTxBudget lets a large apply keep retrying a
commit-time conflict past the ordinary 15s ceiling only when its context
carries issueops.WithExtendedRetryBudget's marker, and the docs on both
sides say admitLargeApply sets it, but nothing did: the marker's only
callers were the uow tests, which mark their contexts by hand. A
1000-item apply that hit a conflict still gave up after 15s with most of
its 5-minute ceiling unused. admitLargeApply now marks the run context
it builds, and TestApplyBatchMarksOnlyALargeApplyForTheExtendedRetryBudget
pins the seam over HTTP: marked at 101 and 1000 items, unmarked at 100.
Removing the mark fails the 101 and 1000 cases; marking every request in
handleApplyBatch fails the 100 case.
Smaller fixes from the same review:
- `bd serve --large-apply-ceiling` repeated the 5m default as a literal
of its own, and since bd serve always passes a positive ceiling, that
literal, not httpapi's, was the default every deployment ran. Export
httpapi.DefaultLargeApplyCeiling, default the flag to it, and pin the
flag's 5m0s default in TestServeFlags.
- admitLargeApply's release cancels the run context before clearing
s.largeApplyDeadline, the order acquireLargeApply's doc states; it
cleared the deadline first.
- Drop the batchfixtures test's dead t.Skipf, which waited for the cap
to reach 1000, and correct a graph-counter comment that still cited
the 100-item cap and the TestServeFlags doc line that called the
no-argument server unchanged.
The PR raises issueops.MaxApplyBatchItems from 100 to 1000 and adds
`bd serve --large-apply-ceiling`, but two base-owned tests still pinned
the old surface and went red on every lane that runs them (Bazel / test,
Test (macos-latest)):
- TestServeFlags pins the exact `bd serve` flag list; add
large-apply-ceiling.
- TestPlanApplyBatchRefusesAnUnusableRequest/too_many_items built 101
items and expected "at most 100 items", a request the 1000 cap now
plans successfully. Size the over-cap request and its message from
issueops.MaxApplyBatchItems, as TestPlanApplyBatchAcceptsTheBoundary
already does for the other side of the cap; the cap's value stays
pinned by TestCapBatchApplyLargeTiesAllThreeLimits.
The PR's own TestLargeApplyBurstNeverStarvesSmallRequestsForSemTimeout
also went red in PR Core (-race, -p 4 on a 4-vCPU runner): all eight
small requests took 160-165ms against a 100ms bound. The stall it
guards against lasts semTimeout (5s), while a small request can still
queue briefly behind the refused large requests, each holding a general
sem slot while its body decodes. Bound it at a second, the "want well
under a second" its sibling TestLargeApplyQueueDoesNotStarveOrdinaryRequests
already uses. Pinned to four cores beside 24 busy loops, small requests
measured 183ms mean and 338ms max, and the 1s bound passed 80/80 runs;
with the one-waiter gate in acquireLargeApply disabled the test still
fails 3/3, on its 2s never-completed check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(uow): stop a doomed large-apply retry before ctx cuts it off
retryTxBudget sizes maxElapsed once at ApplyBatch entry, but says nothing
about how long an individual attempt takes. A slow first attempt (e.g.
157s of a large apply's commit) left little of the budget for a retry,
which then got killed mid-transaction by ctx's own deadline instead of
finishing and reporting its own outcome -- surfacing as
context.DeadlineExceeded (isUnavailable excludes it -> a generic 500)
instead of the exhausted-write-conflict result this loop already reports
correctly (-> 503 + Retry-After).
RunTxResultWithin now tracks the previous attempt's duration and, before
starting a new one, stops early with the last real serialization error
when time left on ctx is less than that duration plus a fixed headroom --
but only when publicops.HasExtendedRetryBudget(ctx) is set (the same
marker retryTxBudget itself checks). Applying the look-ahead
unconditionally regressed TestApplyBatchHonorsAnExtendedRetryBudgetFromContext's
unmarked case: ordinary requests have cheap attempts and are meant to run
until their own ctx deadline ends the loop, and the large-apply-sized 5s
headroom was tripping that for any short-ctx caller with a near-instant
failing attempt.
Adds TestRunTxResultWithin_SlowAttemptStopsBeforeADoomedRetry (a 1.2s
commit against a 2s marked ctx must stop after one attempt with its own
serialization error, never DeadlineExceeded, and never touch a second
unit of work) and its control, TestRunTxResultWithin_ShortAttemptStillRetries
(a 50ms attempt against the same shape must still retry and succeed).
Both mutation-checked against the look-ahead condition and its gate.
Also updates the stale "items accepts at most 100 entries" prose on the
applyBatch endpoint description (openapi.v0.yaml) to the large-envelope
wording already used elsewhere in the spec: 1000-item cap behind the
issues.batchApplyLarge capability, large-apply-ceiling deadline extension,
<=100 unaffected. dependencies:count's own "at most 100" lines are
unrelated and untouched.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci,serve): fit the 1000-item cap's tests in the storage shard budget
Review fixes for the relaunched #7051, iteration 1.
Raising issueops.MaxApplyBatchItems from 100 to 1000 made the base-owned
TestBatchApplyContract take 604s under -race, against 97s at the old cap
(main run 35862663577). It hashed onto the legacy test-embedded-storage
shard 2/5, beside ~5m of other tests, and that shard hit its 15m budget
twice (PR Risk run 36807191489). PR Risk no longer runs the legacy tier
on same-repo PRs (#7071), but Main's push run and fork PRs still do, so
the merge would have carried the timeout to Main.
Raising the jobs' timeout-minutes alone would not fix it: the shard
script passes the binary its own -test.timeout=15m. So:
- embedded-storage-test-shard.sh passes -test.timeout=20m (and its go
test fallback -timeout 20m), as embedded-test-shard.sh does for
cmd/bd.
- test-embedded-storage in main.yml and pr-risk.yml: timeout-minutes 15
-> 25, the script's 20m plus setup.
- embeddeddolt_embedded_test appends -test.timeout=19m, as
bd_embedded_test does, so Go's timeout, which dumps every goroutine,
fires before rbe-west's 1200s action kill, which does not.
TestBazelEmbeddedJobMirrorsEmbeddedTier now checks the override on
both sharded targets instead of only cmd/bd's, and the PR Risk
coverage test pins the storage target's new args.
- embedded-storage-test-shards.txt places TestBatchApplyContract on
shard 4, which has ~3m of other tests, and the PR's two large-batch
tests, TestLargeBatchApplyStatementCounts_Embedded (247s) and
TestLargeBatchApplyWallClock_Embedded (261s), on shards 2 and 5. From
the PR run's per-test times, the heaviest shard projects to ~13m, down
from shard 2's 15m-plus.
Also correct the stop-grace guidance. For an in-flight large apply,
Serve's drain waits out the apply's remaining deadline plus drainGrace
(5s), so the orchestrator's stop grace must be at least
--large-apply-ceiling plus 5s, as Serve's own doc says. The runbook, the
flag help, the LargeApplyCeiling field doc and the CHANGELOG entry asked
for the ceiling alone.
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 Sonnet 5 <noreply@anthropic.com>
The PAUSED warning, the `bd backup status` PAUSED line, CHANGELOG and
configuration.md told operators to switch to a fresh destination with
`bd backup init <new-path>`. That never ends the pause: backupDir()
reads only backup.git-repo, while `bd backup init` registers the
separate destination that manual `bd backup sync` pushes to, so
auto-backup keeps targeting the over-cap directory and stays paused.
Name the two levers that do end it: raise backup.size-cap-mb, or point
backup.git-repo at a different git repository. Also correct the
backup.git-repo row in configuration.md, which called it a repo URL
although backupDir() requires a local path containing .git (anything
else falls back to .beads/backup/), so the new advice is actionable.
TestPauseAutoBackupForSizeCap_RemediationAdvice and the status PAUSED
line now require backup.git-repo and reject `bd backup init`.
TestMaybeAutoBackup_RemediationLevers runs all three for real: raising
the cap and switching backup.git-repo each resume a sync, while
`bd backup init` leaves auto-backup paused.
Post-merge review follow-up to #6071.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
#5725 gave the cmd/bd init gateway credential fixtures a private helper
protocol. While it was queued, #5749 landed internal/testutil/credentialcmd
for the same production shell boundary, leaving two parallel
implementations: the same emit/exit-23/marker operations, the same exit-97
malformed sentinel and the same Windows .cmd trampoline. They had already
drifted. The private copy claims a process on an env var alone, with no
argv sentinel, and its command text is stable rather than unique per call,
although the production credential cache is keyed on that text.
Port cmd/bd onto the shared fixture, as internal/creds and
internal/storage/dolt already use it:
- TestMain claims helper processes with credentialcmd.Dispatch() before
any suite setup, and calls credentialcmd.Cleanup() after the suite.
- AdoptsToken, SkipsEmbeddedMode, FailsClosed and PresetWins build their
commands with credentialcmd.Emit/Exit23/Marker and check non-invocation
with credentialcmd.AssertMarkerAbsent. Their assertions are unchanged.
- The private protocol, its constants and
TestApplyInitGatewayCredentialHelperProtocol, which tested only that
protocol, are removed. credentialcmd's own TestProtocol covers the
shared one and already runs natively on Windows in pr.yml.
- The native driver's fixture list drops the removed test, and bd_test
gains the //internal/testutil/credentialcmd dep (gazelle agrees).
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: make release-version checks shell-free (#5533)
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* fix(release): preserve checker status and explain gate failures (saa-cgh.16)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs: retain release-pinned CLI references (saa-cgh.16)
Preserve corrected live preflight help while generated references continue to match docs/cli-docs.pin v1.2.2. Fix the exact two-line hosted docs-policy failure without changing pin authority.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(versioncheck): carry base's release gates into the Go checker
The base branch gained three release-metadata gates in scripts/check-versions.sh
after this PR's merge point (release: prep v1.3.0, b3ef65c854): the Copilot
plugin manifest, the four winres.json Windows PE version fields, and
manifest.xml's assemblyIdentity version. This PR replaces that shell body with
the Go authority, so adopting it as-written would have silently dropped all
three — each one guards a file whose bump is a sed anchored on the old value,
so a drifted copy no-ops and ships advertising the previous version.
Port them into internal/versioncheck so the shell-free checker enforces the
same set:
- source gains an optional expected() so a surface can derive its required
value; the Windows PE numeric fields must be purely numeric and so carry the
prerelease-stripped form, and manifest.xml carries the four-part form.
- readWinresVersionField reads the nested RT_VERSION resource path through the
existing duplicate-key-checked JSON helpers.
- readManifestAssemblyVersion anchors on line start, since the XML declaration
also carries a version attribute.
Also regenerate the Bazel BUILD files (make bazel-sync). cmd/bd/BUILD.bazel
enumerates srcs explicitly, so the PR's new preflight_versions.go was missing
from it and //cmd/bd:bd_lib failed to compile with `undefined:
runBeadsVersionSyncCheck`; gazelle adds that src, the //internal/versioncheck
dep edge, and BUILD files for the two new packages.
Known follow-up for review: the PR's TestRepositoryReleaseVersionsMatch and
TestPrePushHookOrdinaryPushWorksWithSystemBash read repository files directly,
so they need `data` runfiles to pass under `bazel test` (advisory lane only).
* fix(versioncheck): stop the release gate over-claiming docs coverage; distinguish --expect mismatch
Maintainer review fixup for iteration 1 (both findings minor, non-gating;
scorecard 915/850 approve with Required Changes: None).
Contract & Interface Fidelity (claude + codex): the success line claimed
"Version files and released-docs policy pass" while the checker reads no
documentation surface, and it replaced the shell predecessor's explicit
disclaimer that the docs release line and docs/cli-docs.pin are manual
release steps. Restore the base wording ("Version files in sync at: <v>")
plus the disclaimer, and update the three pins in main_test.go.
This also repairs a consumer neither review lane censused: the tracked
release runbook .beads/formulas/beads-release.formula.toml:475 instructs the
operator that the gate "must print `✓ Version files in sync at: <version>`
before you continue" — the renamed string had silently broken that
acceptance check. Grepping the new spelling finds nothing; the breakage only
shows up when grepping the old one.
Error Handling & Resilience (codex): --expect mismatch reused exit 1, so
.githooks/pre-push answered a tag/checkout mismatch with the version-drift
remedy ("Fix with: scripts/update-versions.sh <version>") — advice that
would rewrite every release surface to the wrong version. Give that case
status 3 and add the matching hook branch pointing at CONTRIBUTING's actual
rule. Only two --expect call sites exist: release.yml:45 (bare non-zero
check, unaffected) and this hook.
Verified at this head: check-versions.sh rc=0 (24 green rows, all three
ported base gates); exit taxonomy 0/2/3 as documented; go test
./internal/versioncheck/ ./scripts/check-versions/ PASS=65 FAIL=0 SKIP=0;
cmd/bd TestTrackedManagedHookSectionsMatchGenerator ok (hook edit sits above
the generator-managed markers); gofmt/vet clean. Both fixes proven
non-vacuous by mutating each back and requiring red.
Declined as out of cleanup scope, recorded for follow-up: making
TestRepositoryReleaseVersionsMatch fixture-based (redesigns the PR's own
test architecture and interacts with the deliberate untracked-discovery pin
at check_test.go:174; harm measured local-only) and declaring bazel data
runfiles (gate impact none — no BAZEL key in either CI_GATE_REQUIRED map at
this base; the remedy needs root filegroups that touch
scripts/bazel_policy_test.go invariants).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(versioncheck): declare the release-gate tests' repo inputs as Bazel data
Base commit e1b2e79484 (#6941) promoted the seven BAZEL* lanes into pr.yml's
CI_GATE_REQUIRED after this branch's merge point, so the two packages this PR
adds are now graded by a required check. Both reach real repository files
through a hand-rolled filepath.Join("..", ".."), which resolves outside the
runfiles tree, and `bazel test //...` failed on them:
TestRepositoryReleaseVersionsMatch
open ../../cmd/bd/version.go: no such file or directory
TestPrePushHookOrdinaryPushWorksWithSystemBash
runfiles .githooks/pre-push: No such file or directory
Resolve the root through internal/testutil/bazeltest.RepoRoot, the base's
helper for exactly this, which reduces to the previous behavior under plain
`go test`; and declare the inputs as data through a //:release_metadata_files
filegroup aggregating the surfaces versioncheck.releaseSources gates, the
canonical version it compares them against, the uv.lock pin and the tracked
hooks, exported from the packages that own them. The filegroup is hand-listed
because releaseSources is itself a closed list: a newly gated surface must be
added there too, and until it is the test fails under Bazel.
The shell entrypoint's exit-status subtests build the checker from source at
the repository root, which cannot work against a runfiles tree that has no
go.mod, so they skip under Bazel and keep running under `go test`. The guard
sits inside each subtest, not above the loop, so the ordinary-push assertion
still reports as run rather than hiding behind a skip.
Validation: `go test ./internal/versioncheck/ ./scripts/check-versions/` is
unchanged at 65 pass / 0 skip, with all three entrypoint subtests still
executing; both targets pass `bazel test --config=ci`; //scripts:scripts_test
(the tag-taxonomy and Bazel policy tests) passes; `bazel build //...` is clean
across 321 targets; `make bazel-sync` reports no drift and is idempotent.
* test(versioncheck): stop declaring the bazelignored npm manifest as Bazel data
The required `Bazel / test` lane failed on the refreshed head in fork-PR CI:
TestRepositoryReleaseVersionsMatch
npm package.json: open .../versioncheck_test.runfiles/_main/
npm-package/package.json: no such file or directory (expected 1.3.0)
npm-package/ is in .bazelignore (#6798), so Bazel never links it into the
execroot, and a local sandbox cannot stage npm-package/package.json even
though //:release_metadata_files named it and analysis accepted the label.
It resolved only under remote execution, where the client uploads the file
from the workspace. That is how the previous fixup's `bazel test
--config=ci` passed on a host whose bazelrc defaults to remote execution.
Fork PRs get no remote-execution secrets, so CI runs the test in
processwrapper-sandbox, where it fails.
Drop the entry from the filegroup. Under Bazel only, let
TestRepositoryReleaseVersionsMatch tolerate exactly that surface's absence:
the file must be missing, and every other gated surface, the uv.lock pin and
the hook markers must pass. The test logs the gap. This mirrors the base's
skipReleaseFormulaUnderBazel for the bazelignored .beads/. `go test`, which
sees the real checkout, still checks the npm manifest.
Validation: forcing local execution the way fork CI runs (`bazel test
--config=ci --nocache_test_results --remote_executor=
--strategy=TestRunner=processwrapper-sandbox`) reproduced the failure before
the change. After it, //internal/versioncheck:versioncheck_test,
//scripts/check-versions:check-versions_test and //scripts:scripts_test pass
(3 of 3 executed), and both release-gate targets also pass under remote
execution. Drifting a declared surface still fails the sandboxed run. The
tolerance was probed through TEST_SRCDIR and BEADS_TEST_REPO_ROOT: each of
these still fails:
- another drifted surface
- a present but mismatched npm manifest
- an unreadable canonical version
- plain `go test` with the manifest missing
`go test ./internal/versioncheck/ ./scripts/check-versions/`, golangci-lint
and `make bazel-sync-check` are clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* hooks: don't report foreign hooks as installed (GH#6084)
CheckGitHooks was calling getHookVersion and treating any nil-error
return as proof that beads installed the hook. getHookVersion returns
hookVersionInfo{} (IsBdHook=false) with a nil error when the file is
readable but contains no beads markers, so a foreign hook written by
another tool was falsely shown as installed in bd hooks list.
Fix: gate status.Installed=true on versionInfo.IsBdHook. The inner
Outdated check is unchanged in effect: it is now only reached when
IsBdHook is true (guaranteed by the new early-exit), so the
now-redundant IsBdHook guard in that condition is dropped.
Add TestCheckGitHooks_ForeignHookNotInstalled (regression for the bug)
and TestCheckGitHooks_BeadsHookIsInstalled (positive coverage for all
four recognised beads marker variants: section-marker, legacy-version,
shim, and inline).
* fix(hooks): count a bd hooks run integration as installed, not as bd-owned
Review fix for the findings filed on PR #6274 (GH#6084). Gating
HookStatus.Installed on IsBdHook also reclassified the integration beads itself
prescribes for external hook managers: a hook that calls `bd hooks run <hook>`
and carries no beads marker (GH#946). bd doctor has recognized that shape since
GH#946 via bdHooksRunPattern; cmd/bd's getHookVersion did not, so bd hooks list,
bd info and bd config drift disagreed with bd doctor about the same file, and
`bd config drift`'s documented exit code flipped from 0 to 1 for those users.
doctor.isBdHookContent is exported as doctor.IsBdHookContent and getHookVersion
now calls it, so a single classifier answers "is this a bd hook" for both
packages.
The classification is carried on a new hookVersionInfo.IsExternalIntegration
field, not on IsBdHook. IsBdHook is not only the display predicate: it is the
ownership predicate at three write sites, and setting it for a file bd never
wrote made bd destroy exactly the setup this branch exists to protect. Measured
on a scratch repo whose .git/hooks/pre-commit is `lefthook run pre-commit "$@"`
plus `bd hooks run pre-commit "$@"`, against the same tree with only
cmd/bd/hooks.go reverted:
reverted IsBdHook this commit
install: manager's own line survives yes no yes
install: pre-commit.backup written yes no yes
uninstall: hook file survives yes no yes
Both commands printed success and exited 0 in every arm, so the loss was silent
and, with no sidecar, unrecoverable. Mechanism: installHooksWithOptions
(hooks.go:1026) took the "legacy bd hook — replace entire file" arm instead of
the arm that writes the .backup sidecar and injects; uninstallHooks
(hooks.go:1438) os.Remove'd instead of reaching "not a bd hook at all — leave it
alone"; and isBdOwnedHookFile (hooks.go:913) returned true, so the tracked-file
write refusal in guardHookWritePath stopped refusing.
So ownership decisions keep asking IsBdHook, and only the two predicates that ask
"is this a working beads integration" widen: the CheckGitHooks installed gate,
and the runChainedHook recursion guard. The guard needs it — a <hook>.old that
delegates via `bd hooks run` re-enters bd, which chains to the same .old again;
it is skipped at this commit and at the previous one, and executed before either.
That is a recursion question, not an ownership question.
Reporting the shape as a shim is what keeps Outdated false. CheckGitHooks sets
Outdated when !IsShim && Version != Version, so an unversioned non-shim would be
reported outdated, `bd config drift` would still exit 1 — with a hooks.outdated
item instead of hooks.missing — and bd info would still say to run `bd hooks
install`, which would overwrite the manager's own hook. The behavior lives in the
bd binary the hook calls, so there is no hook template to re-install.
The read surface is unchanged from the previous commit and still measured on five
hooks, since CheckGitHooks iterates all five: the delegating shape reports
installed with `bd config drift` exiting 0, five genuinely foreign hooks report
not installed, and a GH#1120 inline hook is still outdated because bd wrote that
template.
Tests cover both consumer kinds. The previous commit pinned the read surface
only, which is why the write-path regression above left the suite green: the
existing install/uninstall fixtures use hook bodies with no `bd hooks run` line,
so they never took the changed branch. Adds a fixture that does, and with it an
install-backup case, a tracked-file refusal case and an uninstall-survival case.
All three fail if the classification moves back to IsBdHook, each on its own
assertion — missing .backup, nil refusal error, deleted file — while the two
read-surface tests stay green, so they pin the write surface specifically.
The recursion guard is pinned the same way. Its fixture comments the `bd hooks
run` line out: the classifier matches the call anywhere in the file, so the .old
still classifies as an external integration, but a guard that stops firing only
leaves a marker file behind instead of looping. Narrowing the guard back to
IsBdHook fails the delegating case, a guard that skips every .old fails the
plain case that must still run, and moving the classification back to IsBdHook
fails the fixture's own classification check.
Also narrows the CHANGELOG: it claimed bd hooks list, bd info, bd config drift
and bd doctor "cannot disagree about the same file", but doctor still splits
installed from missing by bare os.Stat (doctor/git.go:65) and uses the shared
predicate only for outdatedness, so the divergence is real and stays tracked
separately. And bd hooks list no longer prints the dangling `installed (shim )`
for a versionless integration — the rendered string only; HookStatus is
marshaled verbatim by --json.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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(init): name --recreate-missing in the refusal without a paste-ready command
The missing-server-database refusal added in #5791 ended with a complete
`bd init --recreate-missing --prefix <prefix>` line. ADR 0002 Invariant 4
keeps complete destructive invocations out of bd error output, and this
refusal also fires when the server merely could not be reached: a stopped
server, a wrong port and a wrong data dir all look the same from here, and
recreating in any of them strands the real data behind an empty database of
the same name. The line also echoed the raw --prefix flag value, so a run
without --prefix printed `--prefix ` with nothing after it.
The refusal now names the flag and points to `bd help init-safety`, which
keeps the full invocation behind the diagnosis it requires. The unused
prefix parameter stays as `_` so the guard call sites are unchanged.
Also:
- --force / --reinit-local flag help, `bd help init-safety` and the init
guard comment now say neither flag authorizes recreating a missing
server-mode database; the --recreate-missing stanza says to rule out a
stopped server or wrong port/data dir and restore first.
- bootstrap.go comments no longer describe #5791 as open and unmerged.
- TestInitGuardMissingServerDBMessage_RefusalTextNoEcho pins the wording
for both evidence arms, with and without a prefix.
- TestInitGuard_RecreateMissingE2ECreatesMissingServerDB runs the real
binary against a live server lacking the database: refused without the
flag, created with it. The unit tests flip initAllowRecreateMissing
directly, so nothing exercised the documented command end to end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(recovery): init-missing-server-db covers both evidence arms and the flag limits
The init-missing-server-db section described only the project_id arm of the
guard. Under --reinit-local or --force a workspace that predates project_id
is also refused when its local Dolt data directory survives, and the refusal
then cites that directory instead of metadata.json. "What happened" now
covers both arms.
"Limits worth knowing" replaces the stale "fails open" bullet with a table
of which local state meets the refusal under bd init and under
--reinit-local / --force, and what --recreate-missing changes. The
init-force-refused section now says --force / --reinit-local bypass only the
local data-safety guard, not this refusal or the remote one, and step 3 says
why the refusal names --recreate-missing without printing the command
(ADR 0002 Invariant 4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(adr): mark ADR 0004 Accepted now that #5791 has landed
ADR 0004 (the missing-database guard signal) still read "Proposed" after the
guards implementing it merged in #5791, and its Consequences said
checkExistingBeadsDataAt "does not change" although the same PR gave it the
Tier 1 probe ahead of project_id. Record the acceptance and say what the PR
already changed; DOC_INVENTORY.md follows the status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(context): resolve from .beads when outside a git repository
`bd context` is documented to read directly from config files and work "in
degraded states", but it hard-failed with "cannot determine repository root:
not a git repository" whenever the working directory wasn't inside a git
repo — even with a valid, discoverable .beads/ present. Consumers that use
`bd context --json` as a health/identity probe got a false "unreachable" in
healthy non-git scopes (GH#4772).
When GetRepoContext returns the repo-root error, a boundary-checked .beads
directory has already been found and the only missing piece is the git repo
root. Fall back to the .beads parent as the repo root and continue, so
backend identity still resolves from config. Only this specific error
triggers the fallback; "no .beads directory found" and unsafe-location
errors still surface as before.
Adds an embedded regression subtest that removes .git from a workspace and
asserts `bd context --json` still resolves (backend/beads_dir populated, no
error). Verified end-to-end: reproduced the exact "cannot determine
repository root" error pre-fix; post-fix reports backend=dolt.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(context): select the no-git fallback by type, and cover both routes
Review follow-up on the GH#4772 fix.
The fallback was selected with strings.Contains(err.Error(), "cannot
determine repository root"). buildRepoContext's other failure — the
SEC-003 unsafe-location rejection — embeds the offending path verbatim
in its message, so the discriminator was controlled by the path being
rejected: a workspace whose path contained the probe phrase would take
the fallback and have its unsafe-location error cleared.
Replace it with a typed error. buildRepoContext now returns
*beads.NoRepoRootError, carrying the .beads directory that has already
cleared the found + safe-boundary checks — which is exactly what makes
recovering from this one failure safe, and removes the need to
re-derive it with a second FindBeadsDir call. The message text is
unchanged.
The recovery itself moves into beads.GetRepoContextAllowingNoGit, so
both `bd context` routes share it: the direct one in context_cmd.go and
the proxied one, whose provider (domain/fs contextRepositoryImpl
RepoContext + Role) propagated GetRepoContext's error unchanged and so
still failed outside git. Callers that actually run git commands keep
using GetRepoContext, so a missing repository stays an error where it
matters.
Tests:
- Discriminator regression: an unsafe-location error built with a
hostile path still matches the old substring test but does NOT
satisfy errors.As for *NoRepoRootError.
- GetRepoContextAllowingNoGit resolves a non-git workspace (BeadsDir,
RepoRoot = .beads parent, empty CWDRepoRoot) while GetRepoContext
still refuses.
- The embedded regression now decodes ContextInfo and asserts exact
beads_dir, repo_root, backend, bd_version and is_worktree instead of
probing for a key name (fields are not omitempty, so an empty or
wrong value passed before).
- Same assertions added for the proxied route.
- ngDir -> nonGitDir.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(context): report the redirect on the no-git path, and test the discriminator
Two blocking items.
B1. The synthesized context left IsRedirected at its zero value, so a
workspace reached via BEADS_DIR from a non-git working directory denied
being redirected, and Role() withheld the Contributor that
"BEADS_DIR implies contributor (external repo mode)" promises. That
contradicts the field's own contract two screens up in the same file,
and a probe sold as a health/identity check giving the wrong identity is
a worse failure than the error it replaced.
The normal path's answer is genuinely unavailable here:
isExternalBeadsDir compares git COMMON DIRS, and the CWD side of that
comparison cannot be computed without a repository — which is exactly
the state this branch serves. An explicitly-set BEADS_DIR is the only
evidence left, and it is the same signal FindBeadsDir's step 1 used to
choose the directory, so the fallback now mirrors that condition. A
.beads found by the working-directory walk still reports false.
IsWorktree stays false, with a comment saying why rather than by
omission.
B2. TestNoRepoRootError_DoesNotMatchUnsafeLocation never called the
selection. Asking errors.As about two hand-built values tests the
standard library, and passes whatever discriminator this package
actually uses — which the reviewer demonstrated by swapping the typed
check for the substring test the test is named after and watching it
stay green.
The selection is now recoverNoGit(rc, err), split out of
GetRepoContextAllowingNoGit, and the test drives it: the unsafe-location
error must come back out unchanged, and so must the no-.beads error and
a successful context. Under the reviewer's probe B it now fails, naming
the context the substring version wrongly recovered.
Nits, taken:
N1. NoRepoRootError's doc claimed the workspace "is not inside a git repo".
It means git could not tell us a root: GetMainRepoRoot bottoms out in
one `git rev-parse`, so a dangling gitfile, a dubious-ownership refusal
or git missing from PATH all arrive the same way. Recovery is equally
safe in all of them, but the command whose pitch is diagnostics in
degraded states should not swallow the fact — printContextText now
prints `cwd repo: git: unavailable` instead of nothing, which is the
text-output counterpart of the omitted JSON field.
N2. The comment on fs/context.go claimed there is no `git config beads.role`
to read outside a repo. `git config --get` reads global and system
config with no repository; I hit it by accident running the probe above,
where Role() returned "maintainer" from my own ~/.gitconfig. Comment
corrected — the behavior was fine.
N3. CHANGELOG [Unreleased] entry citing #4772, and a "Resolving Without Git"
section in engdocs/REPO_CONTEXT.md — the reference for this module,
which documented the boundary validation and the IsRedirected semantics
B1 bends but neither the new entry point nor the no-git case. It carries
the typed-selection rationale and a table of what the synthesized
context can and cannot know.
N4 (allocation) noted and left: correctness first, and two allocations on a
config-reading path is not worth a cache whose invalidation would be a new
thing to get wrong.
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(context): ask the caller's BEADS_DIR, not the one bd exported for itself
Round-2 blocker, and an embarrassing one: this is the same provenance bug I
fixed in #4795 an hour earlier, reintroduced one layer up.
beadsDirNamedByEnv read os.Getenv("BEADS_DIR") live. By the time
recoverNoGit runs, bd has already exported one: cmd/bd/context_cmd.go:75
calls prepareSelectedNoDBContext(selected) immediately before
GetRepoContextAllowingNoGit, and that ends in os.Setenv("BEADS_DIR", ...)
with whatever discovery just found. The proxied route arrives the same way
through the root pre-run. So on the no-git path EVERY walk-found workspace
reported itself as a redirect and claimed Contributor — the opposite of the
Round-1 bug, and worse, because it is the common case rather than the
unusual one. Reproduced against the built binary:
$ cd $T/proj/sub && env -u BEADS_DIR bd context --json
"is_redirected": true, "role": "contributor" ← no BEADS_DIR anywhere
internal/beads now takes the same package-init snapshot package main does,
for the same reason: provenance has to be captured before the process starts
overwriting the evidence. beadsDirNamedByCaller compares against that.
Two things worth recording while I was in there. First, a redirect FILE
cannot be missed by this branch: buildRepoContext checks GetRedirectInfo()
at step 3, and a redirect sends it down the isExternal branch that never
asks git for a root — so by construction the only redirect this code can be
looking at is a caller-named BEADS_DIR. That is now a comment rather than an
assumption. Second, the unit tests passed through the bug because they drive
recoverNoGit directly with an env they set themselves, which is exactly the
distinction that cannot be tested in process.
So the regression is end-to-end, on both routes, as asked:
- assertNonGitContext (shared by the embedded and proxied route tests) now
asserts is_redirected == false for the walk-found case. Reverting the fix:
"is_redirected should be false for a .beads found by the
working-directory walk".
- a new embedded subtest runs the binary from an unrelated directory with
BEADS_DIR supplied in the subprocess environment — the only place a
caller-supplied value is distinguishable from a bd-exported one — and
asserts is_redirected == true AND role == contributor.
N1: the `cwd repo: git: unavailable` line was unpinned (their probe P3
deleted the branch and every -run Context test stayed green).
TestPrintContextText_* now pins all three cases: empty CWD repo root reports
git unavailable, a matching one prints nothing, a differing one prints the
path and must NOT say unavailable. Deleting the branch now fails. Kept as an
in-process capture rather than another subprocess, since cmd/bd has no
runtime budget to spare (GH#6253).
N2: filed as GH#6560 — and my attribution on the PR thread was wrong. It is
not a legacy ~/.beads/config.yaml (I have none); it is BEADS_ACTOR in the
environment, which resolveConfiguredActor deliberately checks ahead of
config.yaml as the fix for GH#4645. `env -u BEADS_ACTOR` makes both tests
pass.
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>
* chore(bazel): enumerate the PR's two new test files in go_test srcs
Pre-review CI repair for PR #4792. The helper reads CI Readiness: pass, but
those nine green runs were created 2026-09-23 against the contributor head
961aa6239 -- before this branch was rebased onto 8269a88cb, an advance that
brings in the entire Bazel scaffold (.bazelrc, .bazelignore,
.github/actions/setup-bazel). So the green cohort predates the Bazel lanes
entirely and cannot certify them; the adopted head has never been seen by CI.
Both affected packages declare go_test srcs as an EXPLICIT list, not a glob, so
the PR's two added test files were invisible to bazel:
cmd/bd/BUILD.bazel + "context_text_test.go"
internal/beads/BUILD.bazel + "no_repo_root_test.go"
Base parity puts the obligation on this PR rather than on base: neither file
exists at the rebase base, so neither row could have been owed there.
The failure mode is a FAKE GREEN, not a red, which is why no check caught it.
Measured on //internal/beads:beads_test: with the row, bazel runs
TestGetRepoContextAllowingNoGit_RecoversOutsideGitRepo (rc=0). With the row
removed, the target still exits 0 -- and that test never runs. A silently
unexecuted regression test is exactly what this enumeration prevents.
Generated by the repository's own `make bazel-sync` (gazelle); the rows are
placed alphabetically, the diff is +1/-0 per file, and a second sync is a no-op.
* fix(context): root the no-git context at the .beads repo and decide redirects positionally
Maintainer review fixups for the two gating findings on the no-git recovery
path, plus the nearby non-gating cleanups.
Finding 1 (major) -- recoverNoGit rooted repo_root at filepath.Dir(BeadsDir),
but the failure that reaches it is the CWD's missing repository, not the
.beads's. A .beads that did live inside a repo therefore reported a
SUBDIRECTORY of that repo, so one workspace answered differently depending
only on where the caller stood. Root via repoRootForBeadsDir, which asks git
from the .beads side (needing no CWD repo) and already falls back to
filepath.Dir(beadsDir), so the documented no-git-anywhere answer is unchanged.
The conflated premise is corrected in the field comment and in
engdocs/REPO_CONTEXT.md.
Finding 2 (major) -- the provenance snapshot was captured at package init and
covered only BEADS_DIR, but bd has four caller-directed workspace channels:
--db, BEADS_DB/BD_DB and -C all resolve through selectedNoDBBeadsDir and end
in an os.Setenv("BEADS_DIR", ...) that runs after init, so the snapshot could
not see them and they reported is_redirected:false / role:maintainer outside
git. Decide externality POSITIONALLY instead: the resolved .beads is a
redirect iff discovery standing in the CWD would not have found it. This is
the reviewer's preferred arm -- it needs no environment inventory, so it
covers all four channels uniformly and stays correct as channels are added (a
further BEADS_DIR writer already exists in cmd/bd/doctor.go). It reuses
FindBeadsDirFrom, the same primitive -C itself resolves through, which reads
none of the routing variables and scrubs routing env from its git probe. The
package-init snapshot and its helper are removed. The boundary the review left
unspecified is settled deliberately: a store reachable only by being named is
a redirect, including one in a sibling directory of the CWD, because with no
repository for the CWD there is no enclosing scope that could make a sibling
local.
Finding 3 (minor) -- TestGetRepoContextAllowingNoGit_RecoversOutsideGitRepo
now scrubs BEADS_DIR, which takes priority at FindBeadsDir step 1. Measured:
three assertions fail under an ambient BEADS_DIR without the scrub and the
package is ok with it. The remedy's second part (stubbing the init snapshot)
is obsolete rather than skipped -- positional provenance reads no snapshot, so
there is nothing left to stub.
Findings 4 and 5 (nits) -- the beadsDirFromCaller / GH#4635 cross-reference
resolved to nothing at head or at base; it is gone along with the snapshot it
described. The CWDRepoRoot comment now states the value is known-empty because
the one cached git context its three readers share has already failed, which
is also a firmer justification for IsWorktree: false than "there is none".
Verification: both majors are pinned by new tests proven to red when the fix
is reverted, and measured end to end with a built binary from a non-git cwd --
BEADS_DIR, BEADS_DB, BD_DB, --db and -C all now report is_redirected:true /
role:contributor, while a walk-discoverable workspace correctly reports
false / maintainer. Contributor commits are preserved.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(dolt): honor BEADS_DOLT_MAX_CONNS / dolt.max-conns on every store open
The pool-size knob (GH#3140) was read only in applyResolvedConfig, which
the CLI's main store open never reaches: main.go hand-builds its
dolt.Config and goes newDoltStore -> dolt.New -> applyConfigDefaults.
Ordinary bd commands in server mode therefore always ran on the built-in
10-connection pool whatever BEADS_DOLT_MAX_CONNS or dolt.max-conns said;
only the NewFromConfig* opens (routed stores, bd doctor, ...) honored it.
This is the same hole #6144 found for the pool deadlines, which #6145
closed by applying their ladder from applyConfigDefaults.
Fold the pool-size ladder into that seam: applyPoolTimeouts becomes
applyPoolKnobs, covers max-conns plus both deadlines, and runs from
applyConfigDefaults (every New) and, idempotently, from
applyResolvedConfig. The max-conns config.yaml rung now reads
cfg.BeadsDir through the shared poolKnobFromConfig helper (formerly
poolTimeoutFromConfig) instead of a beadsDir-parameter closure, so the
two knob families can no longer resolve config.yaml from different
directories. The old precedence comment ("env var > config.yaml > caller
override") was also wrong, since a caller-set value always won; it now
reads caller override > env var > config.yaml > built-in default.
TestApplyConfigDefaultsAppliesPoolSizeLadder pins the ladder on the
constructor path (env, caller wins, unset default, config.yaml) and
follows it through applyPoolLimits to the *sql.DB's MaxOpenConnections.
The env and config.yaml subtests fail on the pre-fix tree.
Post-merge review follow-up to #6145.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): note that dolt.max-conns now sizes the CLI's pool
Release note for the previous commit, beside #6145's entry for the
deadline knobs: operators who set BEADS_DOLT_MAX_CONNS or dolt.max-conns
and saw no effect on ordinary bd commands in server mode will now see it
honored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(dolt): red — federation tests hardcode main and share one database (refs be-dk4a)
Uniquify feature-branch per test (was a global name colliding under
t.Parallel across the shared test database) and capture the starting
isolated branch for later use. The checkout-into-shared-main and
unchecked-error crash (federation_test.go:209) and the database-isolation
bug (setupFederationStore hardcoding Database: "beads") are still present
and still reproduce:
TestFederationVersionControlAPIs — SIGSEGV, nil deref after checkout main
TestFederationDatabaseIsolation — isolation violated: alpha found beta-001
TestFederationListRemotes — passes (confirms it is collateral, not
an independent failure)
* feat: green — Fix: federation tests hardcode main and share one database, so a nil deref SIGSEGVs the whole shard-5 binary (refs be-dk4a)
Bug 1: TestFederationVersionControlAPIs checked out the literal "main"
after merging, but setupTestStore's store shares its database with
every other test in the package — the test actually starts on its own
isolated branch, not "main". Checking out "main" then reading with an
unchecked GetIssue error produced a nil *types.Issue, and dereferencing
its .Title field SIGSEGV'd the whole test binary. Fix: check out back
to the captured starting branch instead of "main", and check errors on
both post-merge GetIssue calls.
Bug 2: setupFederationStore hardcoded Database: "beads" for every town,
so alpha and beta shared one database with no real isolation —
TestFederationDatabaseIsolation could only ever pass by accident. Fix:
give each town its own database via uniqueTestDBName(t), with a
DROP DATABASE IF EXISTS cleanup mirroring dolt_test.go's established
pattern. This also exposed that GetIssue's documented not-found
contract is a wrapped storage.ErrNotFound, not (nil, nil) — the
isolation assertions were checking the wrong shape and are corrected
to match.
* fix(dolt): parallelize federation town setup to fix isolation-test timeout
TestFederationDatabaseIsolation sets up two independent databases (alpha
and beta towns) with no dependency on each other, but paid their cold
schema/migration chains sequentially inside one 2-minute context. As
that chain has grown, round 2 review reproduced this 2/2 as "context
deadline exceeded creating the alpha store."
Root-cause check (be-8zggi round 2): a throwaway probe measured cold
migration cost against an isolated, unloaded local dolt-sql-server
(dolt v2.2.3) to separate real cost growth from host-load noise before
touching the timeout, per the CI-red playbook. Results: single cold
migration ~5s, two sequential ~9.8s, two concurrent ~6.1s (1.61x
speedup) — both comfortably under the 2-minute budget in isolation.
That rules out "budget needs raising" and puts most of the originally
observed timeout on ambient host/shared-server contention rather than
inherent migration cost, but running the two independent setups
concurrently is still a genuine, zero-risk reduction in this test's own
wall-clock footprint (not a timeout bump), so it's the right fix either
way.
newFederationStore now returns an error instead of calling t.Fatalf
directly, since testing.T's FailNow must only be called from the
goroutine running the test itself, not one it spawns.
Also: filed be-pwox9 for an unrelated bug the probe's own ambient-env
sanity check surfaced (applyConfigDefaults lets BEADS_DOLT_SERVER_PORT
clobber an explicit Config.ServerPort) — out of scope here since the
real federation test path never sets ServerPort explicitly.
refs be-dk4a, be-8zggi
* test(dolt): red — guard federationIsolationTimeout has contention headroom (refs be-8zggi round 3)
Adds TestFederationIsolationTimeoutHasContentionHeadroom, which asserts a
not-yet-defined federationIsolationTimeout constant is >= 2x the fixed
2*time.Minute deadline it will replace in TestFederationDatabaseIsolation.
Fails to build until the constant is defined (RED).
Round 2 proved TestFederationDatabaseIsolation's fixed 2-minute budget fails
under ambient multi-agent host contention on this shared rig (6/6 repro,
~120s context deadline exceeded), not migration-cost growth (base-ref
comparison: old code fails identically under the same conditions). Per
ga-sui3p4 (gascity architect ruling), the fix is a named, justified
package-local constant with a guard test proving real headroom — not a bare
literal bump.
* fix(dolt): green — federationIsolationTimeout replaces fixed 2m deadline
Defines federationIsolationTimeout (5*time.Minute) and wires it into
TestFederationDatabaseIsolation's context.WithTimeout, replacing the
fixed 2*time.Minute deadline that reproducibly failed under ambient
multi-agent host contention (be-8zggi round 2: 6/6 failures, ~120s
"context deadline exceeded", load average up to 143.96).
Sized against in-package precedent (concurrent_test.go's 60s
concurrentTestTimeout, initschema_idempotent_test.go's 3m single
cold-init budget) for a test that pays that cold-init cost twice,
concurrently. Guarded by
TestFederationIsolationTimeoutHasContentionHeadroom, which enforces
>=2x the replaced deadline per ga-sui3p4.
Verified against a live podman-backed testcontainers dolt-sql-server:
TestFederationDatabaseIsolation (3.56s), the new guard test,
TestFederationVersionControlAPIs, and TestFederationListRemotes
(non-regression, unmodified) all pass.
* docs(release-gates): add be-mp5ag gate evidence — federation test reliability
All 7 criteria PASS. cmd/bd timeout under make ci-pr-core attributed per
criterion 3a (not diff-owned, tracked as bd-jxmz5 et al., reproduced
independently at base-ref, no path overlap).
* docs(release-gates): backfill be-mp5ag PR URL
* test(dolt): keep the town in the federation database name, drop a duped call
Review nits on the federation isolation work.
uniqueTestDBName alone yields "testdb_<hex>", so moving the two towns onto
per-run names cost the ability to tell alpha from beta server-side -- in SHOW
DATABASES, or when hunting a leaked test database. A federationDBName(t, town)
helper appends the town, keeping both properties. Applied at both call sites,
so setupFederationStore's caller in pull_branch_tracking_integration_test.go
gets it too.
TestFederationVersionControlAPIs called CurrentBranch twice for the same value,
binding startBranch and start. start is gone; its one other use, the post-merge
t.Logf, now reads startBranch.
Verified with -tags integration against a live containerized dolt-sql-server,
which the review could not do for lack of a testcontainer provider:
TestFederationDatabaseIsolation and TestFederationVersionControlAPIs both PASS.
go vet clean both tagged and untagged. (refs be-mp5ag)
* chore: remove leaked internal release-gate doc from PR branch
release-gates/federation-test-reliability-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
* test(dolt): correct federation test comments (review nits)
Maintainer fixup for adopt-pr review iteration 1 (non-gating nits):
- TestFederationDatabaseIsolation: the setup comment said running the
alpha/beta chains concurrently fixed the budget overrun "without
touching the deadline", but this PR also widens that deadline from 2m
to 5m via federationIsolationTimeout. Say both layers are load-bearing.
- Move setupFederationStore's doc sentences off federationDBName and
onto func setupFederationStore, where source readers look for them.
Comment-only; no behavior change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
#5677 made addToGitignore preserve a CRLF .gitignore by consuming
gitignore.AppendLineEnding, but it re-implemented the rest of the #6343
append policy inline: the final-line completion, including the rule that a
trailing CR is completed with a bare LF. That policy already lives in
gitignore.AppendLines, which the three other project-ignore writers call.
The two copies are byte-equivalent today, and only one of them is
discoverable when the policy changes.
Derive the appended bytes from AppendLines instead. Its contract leaves the
existing bytes unchanged, so everything past len(content) is exactly the
append, and writing only that suffix keeps the O_APPEND handle: the user's
.gitignore is still appended to, never truncated and rewritten. The write
also becomes a single Write call instead of a separator write followed by an
Fprintf.
No behavior change. The call-site tests pass unmodified, byte for byte. The
doc comment on TestAddToGitignoreCompletesUnterminatedCRLFLine is reworded
because it described the removed separator variable; the arm it pins, and
why only that test reaches it, are unchanged.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci(bazel): fork PRs use rbe-west's anonymous read-only cache (mode cache)
Fork PRs (unless bazel-farm.yml authorized them), rbe=cache dispatches and
secret-less same-repo runs (Dependabot) now run in mode "cache": local
execution on ubuntu-latest as before, plus .bazelrc's new fork-cache config,
rbe-west's credential-free rbe-cache endpoint (instance oss, reads only).
rbe=off keeps the old local mode without the cache.
- .bazelrc: build:fork-cache. Only key-neutral flags (--jobs, --remote_*), so
fork actions hash like trusted ones. --noremote_upload_local_results, and
--remote_local_fallback plus
--incompatible_remote_local_fallback_for_remote_cache: without both, a
closed endpoint (farm kill switch) fails every action in GetCapabilities.
- setup-bazel: BAZEL_FORK_CACHE=true appends --config=fork-cache; it is
mutually exclusive with the RBE secrets; new output cache.
- bazel.yml: RBE_INPUT_CACHE, mode cache, dispatch option cache; every
setup-bazel step gets BAZEL_FORK_CACHE. Remote and fork-farm paths
unchanged.
- bazel-gate.sh: cache/false is valid and skips what local skips.
- Policy tests: the two public endpoint lines are allowlisted in .bazelrc
only; TestBazelForkCacheConfig pins the fork-cache contents and checks both
fork-cache and remote-exec stay key neutral; decision, gate and rc-writer
tests cover cache mode.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): fork cache gives up on a slow endpoint and uploads no BEP files
Review fixes for the fork read-only cache (mode cache).
- .bazelrc fork-cache: --remote_timeout 60 -> 15 and
--experimental_circuit_breaker_strategy=failure, so a slow (not closed)
endpoint stops being called once too many lookups fail instead of
costing every lookup 60s x retries; --experimental_build_event_upload_strategy=local,
because bazel.yml's --build_event_json_file and --profile otherwise make
Bazel upload test logs and the profile over ByteStream. equivalence.py
and check_testcases.py read test.xml from the local testlogs dir, not
from BEP URIs, so they are unaffected.
- Policy test: parseBazelrcOptions now scans plain command lines too
(lane checks still ignore them), so `build|common --config=fork-cache`
is caught. Outside fork-cache and remote-exec, no line (test: lines
included) may turn uploads on, turn either fallback off, or set a
non-local BEP upload strategy. fork-cache must end with the breaker,
the local BEP strategy and a --remote_timeout of 1-15s; keyNeutralFlag
accepts the breaker and BEP-strategy flags.
- engdoc: the closed-endpoint fallback sentence now also describes the
slow-endpoint path (timeout, breaker). bazel-farm.yml and pr.yml
comments say fork PRs run in mode cache, not plain local.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): reconcile fork cache (mode cache) with the legacy embedded retirement
After the rebase onto D2 step 1 (#7071), two policy tests failed against
mode cache.
- evalRBEExpr learns `inputs.rbe == 'cache'` (bazel.yml's RBE_INPUT_CACHE).
The decision itself is unchanged and right for mode cache: covered never
depends on the mode, forks and Dependabot (now mode cache) keep the legacy
tier, and a covered same-repo PR without the secret (now mode cache, not
local) still turns pr.yml's gate red. The named cases now pin the mode
too, and the "mode alone makes it red" check includes cache.
- TestBazelEmbeddedLaneCannotBeNarrowed treats fork-cache like remote-exec:
a config setup-bazel's rc enables for every command. Its lines (and any
config they reference) are now in use for the lane, so the rc narrowing
regex applies to them, including a forbidden nested --config=. The
setup-bazel scan accepts exactly --config=remote-exec and
--config=fork-cache.
- Comments in bazel.yml, pr.yml, pr-risk.yml and the engdoc that said
missing-secret, fork or Dependabot runs take mode local now say cache.
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>
* test(dolt): red — testdb_* leak onto production Dolt port when Docker absent (refs be-h2h25)
* feat: green — Test suites create testdb_* on the PRODUCTION dolt server: harness fails open on the ambient port when Docker is absent (refs be-h2h25)
* docs(release-gate): add be-napos gate — ambient Dolt port fail-open to fail-closed
Deploy bead be-napos (build be-h2h25, review be-7fym1, verdict pass round 2).
7/7 gate criteria PASS; full independent evidence in the gate doc.
refs be-napos, be-h2h25, be-7fym1
* docs(release-gate): record PR link for be-napos gate
refs be-napos
* test(testutil): make the fail-closed gate deterministic, not Docker-conditional
The regression test skipped itself on every host that has Docker, by calling
the real EnsureDoltContainerForTestMain and skipping when it succeeded. That
asserted nothing on CI -- the only lane where it matters -- and on a
Docker-having host it also started the shared singleton container purely to
decide to skip, with no TestMain in internal/testutil to terminate it.
Add checkDoltFn, a package-level seam over checkDolt, so the test can force a
not-ready state without a Docker daemon and without starting a container. Only
EnsureDoltContainerForTestMain routes through it; the neighbouring t.Skip call
sites gate a skip rather than the fail-closed behaviour, so they keep calling
checkDolt directly.
The gate now covers all four not-ready states rather than the one the old test
happened to hit, which also pins the intent that an explicit
BEADS_TEST_SKIP=dolt opt-out must fail closed exactly as a Docker-less host
does. Split into a platform-independent half (the helper's own contract, both
variables cleared, idempotent) and a !windows half (the wiring, via the seam).
Red/green: with the neutralizeAmbientDoltPort call removed from the not-ready
branch, 4 of 4 subtests fail and 0 pass; restored, 4 of 4 pass in 0.06s with
no Docker and no container. (refs be-napos)
* fix(testutil): clear the ambient Dolt port on the Windows stub too
The Windows EnsureDoltContainerForTestMain returned its error without touching
BEADS_DOLT_SERVER_PORT / BEADS_DOLT_PORT, so the fail-open this branch fixes
still shipped there -- unconditionally, since that stub never succeeds. Windows
is a real lane: .github/workflows/pr.yml runs windows-latest on four jobs plus
the cross-platform matrix.
Gating it needed one pre-existing repair. testdoltserver_env_test.go has no
build tag but calls checkDolt, which is !windows-only, so the internal/testutil
test binary has never compiled for Windows -- reproduced identically on
origin/main. Tagging that file !windows fixes the whole package's Windows test
lane; without it a new Windows gate would compile nowhere and assert nothing,
which is the same defect this branch is already correcting.
Verified GOOS=windows go vet ./internal/testutil/ clean (it fails on
origin/main), and GOOS=windows go build clean before and after. The Windows
gate itself is compile-verified only -- no Windows host here to execute it.
(refs be-napos)
* docs(testing): state that ambient BEADS_DOLT_*_PORT is never honored
The guard fires on every not-ready state, not only "Docker unavailable" -- a
missing or wrong-version image and an explicit BEADS_TEST_SKIP=dolt opt-out
clear the ambient port too. That is deliberate: the invariant is the absence of
a test container, not the reason for it. Say so where the next person will look
before investigating, and name the supported way to target a specific server.
(refs be-napos)
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-napos-ambient-dolt-port-failclosed-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 the PR's new test files in BUILD.bazel
Base added BUILD.bazel to internal/testutil and internal/storage/dolt after
this PR was opened (#6881 made the Bazel lane real, and fork PRs always run
it). The four new test files this PR adds were therefore absent from the
go_test srcs lists, which the bazel lane's equivalence check reports as a
missing target.
Generated by 'make bazel-sync' (gazelle), not hand-edited, because the CI
drift step diffs against exactly what gazelle emits.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(testutil): reconcile the shared-server harness with the fail-closed clear
Review iterations 1-2 (adopt-pr, PR #5885): every gating finding from both
review syntheses, plus their minors and nits.
Iteration 1, Major 1 (Change Impact / Blast Radius). scripts/test.sh's
BEADS_TEST_SHARED_SERVER=1 flow starts a dockerless `dolt sql-server` and
exports BEADS_DOLT_PORT for every package to reuse. checkDolt() has no notion
of an already-provisioned shared server, so on that flow's primary audience --
a host without Docker -- all 12 EnsureDoltContainerForTestMain callers erased
the harness's own sanctioned port before m.Run(), turning green dockerless runs
red, while engdocs/CI_TEST_SURFACE_AUDIT.md and the new TESTING.md paragraph
advertised the two mechanisms unreconciled.
Taken: a dedicated marker, BEADS_TEST_SHARED_DOLT_SERVER, exported by
scripts/test.sh beside the port it allocated, which the helper's failure paths
honor. Both docs state the reconciliation, including the precedence: a
container, where one can be started, still overwrites both variables. Not
taken: "skip the clear when BEADS_TEST_SHARED_SERVER=1 and a port var is
already set". That flag is overloaded (cmd/bd/shared_server_integration_test.go
reads it too), and the script starts no server when a port is already set, so
the flag beside a port is exactly the case where the port is ambient.
Iteration 2, blocker (Behavioral Correctness). Iteration 1 shipped that marker
as a boolean ("1") which spared BOTH port variables, while the script vouched
only for the BEADS_DOLT_PORT it exported and its entry guard never looked at
BEADS_DOLT_SERVER_PORT -- the variable applyConfigDefaults resolves first. The
runner's test environment (beads_test_env_enter) unsets both variables before
the flow runs, so the hole needed that isolation skipped, e.g. with the
documented BEADS_TEST_ENV_DISABLE=1; then an inherited BEADS_DOLT_SERVER_PORT
reached `go test` beside the marker and outranked the shared server --
gm-2g3g5r, re-opened by its own fix. Measured with a fake `go` that prints its
environment: SERVER_PORT=59999 PORT=<shared> MARKER=1 under the iteration-1
script. Now:
- the marker's value is the port it vouches for, and the helper decides per
variable (neutralizeUnvouchedDoltPorts): only a variable holding exactly
that port survives, and says so on stderr; every other one is cleared,
marker or not;
- the flow starts only when neither port variable is set, and says on stderr
when BEADS_TEST_SHARED_SERVER=1 is ignored for that reason.
Not taken: also exporting BEADS_DOLT_SERVER_PORT from the flow. The widened
guard means it is always unset there, so the export adds no safety, and five
sites read that variable alone (internal/doltserver/doltserver.go:796,
cmd/bd/init.go:773 and :1351, cmd/bd/bootstrap.go:857,
internal/testutil/testdoltbranch.go:164) -- consumers the flow has never fed.
Iteration 2, minor (Test Evidence Quality). The exception's second arm, a
container that would not start, was reached by no test with its guard live.
Both failure paths now share one clear, and the container start is a seam
(startSharedContainerFn, pinned to startSharedContainer by identity) so tests
reach that path without consuming doltServerOnce.
TestEnsureDoltContainerForTestMain_KeepsHarnessProvisionedPort runs its whole
table, marked_but_divergent_var included, through both paths.
Iteration 2, minor (Contract & Interface Fidelity). The marker prose in
TESTING.md, CI_TEST_SURFACE_AUDIT.md, test.sh and testdoltserver.go describes
the per-port behavior the code now implements.
Iteration 1, Major 2 (Contract & Interface Fidelity). neutralizeAmbientDoltPort's
doc comment claimed "With no port resolvable, applyConfigDefaults'
BEADS_TEST_MODE guard forces port 1". Clearing the env vars is not "no port
resolvable": resolution falls through to the file chain and derives a
directory from filepath.Dir(cfg.Path) when BeadsDir is empty
(store.go:1661-1664), so a reachable .beads/dolt-server.port still yields a
non-zero port and the ServerPort == 0 arm (store.go:1683-1687) never fires;
production-port detection is strictly narrower than resolution. Narrowed to
what the change actually guarantees -- no environment-named port is honored --
at all three sites carrying the claim: the helper doc, the TESTING.md
paragraph, and TestApplyConfigDefaults_NoResolvablePortFailsClosed's own
comment, whose fixture (an empty beadsDir) is what excludes the surviving
path. The residual stays tracked in be-rl6tm. That test's stale
cross-reference to a renamed test is corrected in the same pass.
Iteration 1, minor (Test Evidence Quality). The Windows gate's comment claimed
a CI lane it does not have; it now states the coverage exactly --
compile-checked, not CI-executed -- and lists the four windows-latest jobs'
named selectors.
Iteration 1, nits. doltServerErr is read under doltServerMu via
sharedContainerErr(); TestCheckDoltFn_DefaultsToRealProbe pins function
identity with reflect instead of asserting non-nil, which any leaked stub
satisfied.
Mutation ledger (scoped `go test ./internal/testutil/`, scrubbed env; every
mutant restored from a copy and verified byte-identical):
a set marker spares every marked_but_divergent_var, divergent_legacy_var,
variable (the i2 blocker) marker_names_neither_var and boolean_marker red
on BOTH failure paths
the marker covers marked_but_divergent_var, marker_names_neither_var
BEADS_DOLT_PORT only and boolean_marker red on both paths
presence instead of value the same red set as the first row
no clear after a failed the 5 container_start_failed cases that expect
container start a clear red; every not_ready case stays green
start attempted before the all four incumbent fail-closed subtests and
probe every not_ready case red
leak a wrapper into StartSharedContainerFn_DefaultsToRealStart red
startSharedContainerFn
delete the hermetic ClearsAmbientPortWhenNotReady red
t.Setenv, marker ambient
at the fixture's port
Full package green with Docker, including the real-container
EnsureDoltContainerForTestMain path (43 test and subtest passes, no skips);
`go test ./scripts/`, which drives test.sh, green; `GOOS=windows go vet
./internal/testutil/` clean; `tools/bazel/go_srcs.py --check` clean, and no
BUILD change is due (no new files, no new non-stdlib imports).
Deferred deliberately: the iteration-1 synthesis's optional windows-latest step
for ./internal/testutil/. It is newly feasible -- this branch is what made the
package's Windows test binary compile -- but it would also newly execute four
pre-existing test functions in this package that have never run on Windows, so
it belongs in its own change. RequireDoltContainer's unsynchronized
doltServerErr read is base-owned and left alone for the same reason.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(epic): do not treat duplicate/wontfix closes as complete
GetEpicsEligibleForClosure counted any closed child as complete work.
An epic whose only child was closed as duplicate (or wontfix/superseded)
was flagged "complete-but-unclosed" and doctor suggested bd close — even
when the epic still had unfinished scope (GH#5026).
- Fetch close_reason with status; only completing closes count for eligibility
- IsNonCompletingClose for duplicate/wontfix/superseded/obsolete keywords
- Soften doctor/mol stale copy: review scope before closing
Fixes#5026
* fix(epic): word-boundary close-reason matching + conformance coverage (GH#5026)
Review follow-ups from maphew on #5138:
- IsNonCompletingClose now matches close_reason on word boundaries via a
precompiled regexp instead of raw strings.Contains. Bare "dup" is dropped
(redundant with duplicate/dupe, only added false positives on "dedup").
Bare "obsolete" is dropped in favor of "obsoleted" — "removed obsolete
migration shim" is completing work, not a redirect, and was silently
making such epics ineligible forever with no explanation.
- testAuditEpicsEligiblePartial (conformance, runs on every backend) gains
an ee-4 epic whose only child closes with reason "duplicate of ee-1",
asserting {Total:1 Closed:1 Eligible:false} — the dcr-tf2 regression from
#5026 end to end. Its doc comment now states the invariant this PR
actually enforces (Total == completing-closed), not the one it broke.
- cmd/bd/info.go and cmd/bd/doctor/maintenance.go no longer advertise the
retired "complete-but-unclosed" framing.
Generated CLI docs (docs/CLI_REFERENCE.md, docs/cli-reference/) are left
untouched: docs/cli-docs.pin freezes them to the released v1.1.0 tag, so
regenerating with the pinned build (matching CI's check-doc-flags job) is
a no-op regardless of source changes on this branch, and overriding the
pin pulls in ~100 files of unrelated accumulated drift. Verified via
scripts/check-doc-flags.sh against a CI-equivalent CGO_ENABLED=0 build.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015AfaSMkMRF5BTzuPNFnqHY
* fix(epic): match hyphenated wont-fix and curly-apostrophe won't fix (GH#5138)
Maintainer review on GH#5138 found the close-reason regexp missed two
forms of the already-handled wontfix keyword: a hyphen between "wont"
and "fix" (the ` ?` quantifier only tolerates a space, not a hyphen),
and "won't fix" written with the U+2019 typographic right single
quote instead of the ASCII apostrophe.
Extend the regex directly rather than normalizing the whole
close-reason string: `wont[- ]?fix` accepts a hyphen, a space, or
neither, and `won['\x{2019}]t fix` accepts either apostrophe form.
Scoping the hyphen tolerance to just this keyword pair (rather than
folding all hyphens to spaces) avoids the risk of turning unrelated
hyphenated prose into a false match.
Adds table cases for both forms plus a negative case confirming
ordinary hyphenated prose ("not-yet-planned") still doesn't match.
* style: gofmt maintenance.go after comment split the struct alignment
The GH#5026 wording comment inside the DoctorCheck literal splits gofmt's
alignment group, so Name/Status align independently of Message. CI's
"Check gofmt" caught this on the rebase; main's copy is clean, so the
violation is ours.
Whitespace only: `git diff -w` is empty.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(epic): compose wont-fix separators, sync epic_closeable classifier (GH#5138 review)
bee-ghosttrack's desk review on PR #5138 raised two asks:
1. The hyphen and curly-apostrophe fixes didn't compose: "won't-fix" and
"won't-fix" (curly quote) still matched as completing. The apostrophe
alternative in nonCompletingCloseRegexp required a literal space after
"fix"; give it the same [- ]? hyphen tolerance the plain "wont[- ]?fix"
alternative already had.
2. epic_closeable (internal/workapi/detail.go) computed closeable as raw
total==closed, disagreeing with issueops.GetEpicsEligibleForClosureInTx's
real classifier — an epic whose only child closed "duplicate of X" read
epic_closeable=true in `bd show --json`. Moved IsNonCompletingClose from
issueops into the leaf internal/types package (issueops already imports
workapi, so workapi importing issueops back would cycle) and had
applyEpicProgress apply the same classifier. That also surfaced a second
bug on the way: shallowDep, which every dependent row passes through
before applyEpicProgress ever sees it, was dropping CloseReason along
with the other free-form text fields — so the classifier was reading an
always-empty string. Fixed by keeping CloseReason (short, not a hub-scale
blob) in the shallow copy.
Regression test in workapi added and verified to fail without the
shallowDep fix and pass with it (both outputs recorded in review).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(epic): apply the eligibility classifier to bd show and doctor --deep (#5138 review)
Review iteration 1 (synthesis: request_changes, 1 major + 1 nit).
Major (Change Impact / Blast Radius) — two surfaces still computed epic
closeability from their own raw closed counts, so after this PR they
contradicted the eight sites that read the shared EpicStatus.EligibleForClose:
- cmd/bd/show_format.go: printEpicChildProgress gates only the
"— eligible for close" suffix on types.IsNonCompletingClose. The
closed/total figure stays raw, matching the deliberate raw ClosedChildren
convention pinned by the conformance test.
- cmd/bd/doctor/deep.go: checkEpicCompleteness routes through
issueops.GetEpicsEligibleForClosureInTx instead of its own SQL, so one
classifier remains and `bd doctor --deep` agrees with `bd doctor`'s Stale
Molecules check by construction. Side effects, both improvements: the local
LIMIT 20 is gone (the reported count is now exact), and the shared query's
isTableNotExistError tolerance replaces a LEFT JOIN that required the
optional wisps/wisp_dependencies tables unconditionally.
- cmd/bd/doctor.go: the --deep help text no longer says "all children closed".
Nit (Behavioral Correctness) — internal/types/non_completing_close.go spells
the keyword "not[- ]?planned", giving it the same per-keyword separator
tolerance the "wont fix" pair already had. The comment no longer rests the
space-only spelling on the "not-yet-planned" counterexample, which an
intervening word blocks under either spelling.
Bazel: gazelle had never been run for this PR's new files, so //internal/types
omitted non_completing_close.go and the Bazel build failed with
"internal/workapi/detail.go:275: undefined: types.IsNonCompletingClose".
`bazel run //:gazelle` adds those rows and the new cmd/bd test src.
Tests (each new pin mutation-proved: reverting the fix reds exactly the
intended case and nothing else):
- cmd/bd/show_format_test.go (new): first coverage for printEpicChildProgress;
asserts both halves — raw progress preserved, suffix gated.
- cmd/bd/doctor/deep_test.go: a duplicate-closed-child epic is not reported
ready to close and ships no `bd close` Fix line; the three pre-existing
cases pass unchanged.
- internal/types/non_completing_close_test.go: "not-planned"/"notplanned"
classify as non-completing; "not-yet-planned" still does not.
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>
* test(cli): scope workspace and Git caches together
Add resetRepoCachesForTest for serial fixtures that change directories.
Reset both successful and failed discoveries on entry and cleanup, and use
it in the three remaining beads-only context/serve reset sites.
Exercise non-repo to nested repository to non-repo discovery through both
cache owners. Preserve runInDir's callback lifetime and the two original
fixture repairs already owned by PR5747.
Fixes#6207
Reported-by: bee-ghosttrack
Bead: saa-cgh.92
Agent-Signature: unknown-model/unknown-reasoning
* test(cache): leave conventional helper filename available (saa-cgh.92)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(cli): apply review fixes — one reset invariant, gazelle-synced srcs
Maintainer review fixup for #6320 (iteration 1). Both minors from the review
synthesis; no blocker or major was filed.
Architectural Consistency (minor, both lanes): runInDir reset only the Git
cache, the inverse of the leak this PR fixes — a workspace context primed by an
earlier fixture survived its chdir. Extract the pair into resetRepoCaches() so
one definition owns the invariant, and route both resetRepoCachesForTest and
runInDir through it. Deviation from the synthesis's parenthetical "(or
resetRepoCachesForTest)": calling that helper inside runInDir would move the
exit reset from runInDir's own defer to a t.Cleanup at end of test, dropping
the before/after guarantee its doc comment states, so the shared closure is
extracted instead. The doc comment is updated to match the widened behaviour.
TestRunInDirScopesWorkspaceDiscovery pins both halves. Restoring the git-only
entry reset reds it at :94 ("no .beads directory found" — the finding's own
observable); restoring the git-only exit reset reds it at :110 with the leaked
context. In both arms the existing TestResetRepoCachesForTestScopesDiscovery
stays green, so the new test covers an uncovered site rather than duplicating
it.
Test Evidence Quality (minor, codex): the new test file was absent from the
gazelle-managed go_test srcs list, so bazel test never ran it. Ran make
bazel-sync (gazelle, go_srcs.py, mod tidy) rather than hand-editing. Its entire
output was three srcs lines: ours, plus two base-inherited absentees that
landed in this PR's own base commit. Only the line for the file this PR adds is
carried here, because shipping all three conflicts with origin/main. Measured,
not assumed: git merge-tree --write-tree against origin/main puts BUILD.bazel
in the conflict set with all three lines and merges it cleanly with one, while
the merged tree's bd_test srcs holds the same 648 entries — including all three
files — either way, since origin/main has already gazelle-synced the two
base-inherited ones. The one-line form is therefore what gazelle emits at the
merge target, and it leaves the base's own drift as found rather than fixing it
in this PR.
Validation: 32 tests covering all 22 package-main runInDir call sites pass
before and after with an identical name-level PASS set; the PR's four affected
tests plus the new pin are 5/5 anchored PASS; go vet, gofmt, git diff --check,
golangci-lint (0 issues) and go_srcs.py --check all clean.
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>
* feat(label): add --prefix to bd label remove
bd list/bd ready already support --label-pattern/--label-regex for
finding issues by label shape. label remove had no equivalent for
stripping a whole label family in one call: callers had to fetch an
issue's labels themselves and issue one exact-match "bd label
remove" per matching label.
--prefix resolves the matching labels per issue (labelsWithPrefix, a
plain strings.HasPrefix filter over the labels already returned by
GetLabels) and removes them in a single transaction. Implemented for
both the embedded store path and the proxied-server (bd serve) path,
wisp-aware in the latter via workapi.GetIssueOrWisp — gc bd in Gas
Town runs proxied against a shared Dolt server, so an embedded-only
implementation would not have been usable there.
TDD: pure-function unit test (TestLabelsWithPrefix), plus embedded
and proxied CLI-level integration test cases mirroring the existing
label_remove_batch/add_list_remove conventions. Full existing
cmd/bd label suite re-run green (24/24 embedded subtests) for
regressions. The new proxied integration subtest could not be run
locally (this environment has no Docker, which the
testcontainers-go Dolt harness requires) but compiles clean under
go vet and golangci-lint and mirrors the existing, working
labelMutateProxied/runLabelListProxiedServer structure exactly.
Ref: ga-r8haw (gastownhall Gas Town city, Proposal 1).
* fix(label): address review feedback on --prefix (tense, arg validation, help text)
steveyegge's PR review (2026-08-08) asked for three small fixes before
merge, none of which the two subsequent rebases (2026-08-29, 2026-09-07)
touched:
1. Error-string tense: both label-remove failure paths (applyLabelEdit,
shared with label add; removeLabelsByPrefix) rendered "label
removed"/"added" on a FAILURE, claiming success on the very branch
that reports an error. Added labelOperationGerund() and used it on
both failure paths ("removing"/"adding"); the success-path constants
(labelOperationAdded/Removed, used by reportLabelEdit's JSON status
and human-readable verb) are untouched — they were already correct.
2. Reject --prefix combined with a label-shaped positional explicitly:
`bd label remove bd-1 stale-label --prefix x` used to hand ALL
positionals to resolveLabelIssueIDs, which (a) failed with a
confusing "could not resolve issue ID" error whose hint recommends
the exact comma-separated label syntax --prefix does not take, and
(b) left a live (if unlikely) risk that ResolvePartialID's fuzziness
could silently resolve a label-shaped string to an unrelated real
issue. Added resolveIssueIDsForPrefix, used only by the --prefix
branch of labelRemoveCmd's RunE, which fails with an explicit
"cannot combine --prefix with label arguments" instead.
3. Sharp-edge guard: per the reviewer's "at minimum" option, expanded
the --prefix flag help text to name the blast radius (a short
prefix can remove multiple unrelated label families in one
transaction) and point at `bd set-state` for state-dimension labels
(launch:, scalegate:), which --prefix bypasses without the
event-bead audit trail bd set-state provides.
TDD: new TestLabelOperationGerund (pure unit) and
label_remove_prefix_rejects_label_shaped_positional (embedded CLI
integration, mirrors the existing label_remove_prefix* subtests) —
both confirmed RED against the pre-fix code (temporarily reverted,
re-run, restored) before GREEN. Full cmd/bd label suite re-run green:
25/25 embedded subtests (24 pre-existing + 1 new), no regressions.
go vet + gofmt clean.
Ref: ga-r8haw (gastownhall Gas Town city, Proposal 1 — addresses the
2026-08-08 review verdict "MERGE AFTER FIXES (small ones)" on PR #5384).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): add label_prefix_test.go to cmd/bd go_test srcs
cmd/bd/BUILD.bazel enumerates go_test srcs explicitly, so this PR's new
label_prefix_test.go was absent from the list. bazel.yml's "BUILD files in
sync" step runs `make bazel-sync` and exits 1 on any resulting drift
(.github/workflows/bazel.yml:382-406), and that job feeds pr.yml's
required CI_GATE_REQUIRED contexts (BAZEL, BAZEL_TEST, BAZEL_PURE, ...),
so the branch would red a required gate.
The bazel lane did not exist at the merge base the PR's green CI run was
built on, so no existing green covers it.
Generated with `make bazel-sync` (gazelle); re-running it is a no-op.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(label): report --prefix removals from the write result, not the pre-read set
Review fixes for the adopted PR. The gating finding is the reporting
contract on the new --prefix path.
MAJOR - removeLabelsByPrefix discarded the UpdateResult (`if _, uerr :=
lifecycle.Update(...)`) and then printed one `status: "removed"` row and one
`✓ Removed` line per entry in the pre-read snapshot, so it asserted label
removals that had not happened. That is the GH#5988 false-confirmation
defect base commit 0b9e644ba9 removed from the sibling path three commits
earlier, reintroduced on a new surface that never called the handler which
fixes it.
The path now builds a labelEditOutcome per issue from the returned
UpdateResult and reports through reportLabelEdit, the same handler the plain
path uses, so an edit that wrote nothing reports "unchanged" and the human
"was not on" line instead of a removal. Per-label attribution stays
best-effort on the same terms applyLabelEdit documents (the Get is outside
the write transaction); what is no longer possible is claiming a removal for
an edit that wrote nothing at all.
labelEditOutcome carries its own label set, because --prefix resolves a
different set per issue while applyLabelEdit repeats one caller-supplied
set. reportLabelEdit therefore reads outcome.labels and its shared `labels`
parameter is gone; it had one caller before this change and has two now.
resolveIssueIDsForPrefix collapses duplicate ids. Naming one issue twice
used to yield two "removed" rows per label deterministically - the grouping
map recorded the repeat once, but the report loops iterated the ungrouped
pairs - which is the arm that needed no concurrency to reproduce.
Minors from the same review:
- cmd/bd/label.go:159 passed the past-tense `operation` constant into an
error string, the anti-pattern this PR's own labelOperationGerund exists
to remove; the site is byte-identical at base, so the PR did not introduce
it, it shipped the remedy and applied it 13 lines below only.
- resolveIssueIDsForPrefix prefixed EVERY resolution failure with "cannot
combine --prefix with label arguments", blaming a lone typo'd id on an
argument mistake the caller did not make. The hint is speculative, so it
is now gated on len(issueIDs) > 1, matching resolveLabelIssueIDs' twin.
- The --prefix help text claimed a short prefix "removes every match in one
transaction", but a multi-issue call is one Update per issue and can land
some and fail others - the partial application applyLabelEdit documents.
Reworded to per-issue semantics, keeping the breadth caution. The same
overclaim was in this PR's own CHANGELOG entry and is reworded there too.
Tests: six subtests on TestEmbeddedLabel covering the surfaces that had no
guard - the --json row shape, the no-match empty array, two issues with
different matching sets, the duplicate-id arm, an already-removed re-run,
and the lone-bad-id message. The duplicate-id case is the pin for the
major: run against the pre-fix label.go it gets 4 rows for 2 labels. The
re-run case is not a pin. A re-run matches nothing and takes the no-match
branch before any write, so it passes against the pre-fix code too; the
"unchanged" report it cannot reach is covered through the shared handler
by the plain path's GH#5988 subtests.
Verified at this head: cmd/bd TestEmbeddedLabel 36/36 subtests and
TestProxiedServerLabel 22/22 PASS (BEADS_TEST_EMBEDDED_DOLT=1 and
BEADS_TEST_PROXIED_SERVER=1, ambient BEADS_* scrubbed), TestLabelsWithPrefix
5/5, TestLabelOperationGerund 3/3, 0 FAIL and 0 SKIP; the GH#5988
discovery-suite regression checks for the plain path
(TestDiscovery_LabelRemoveNonexistentSilentSuccess,
TestDiscovery_LabelAddDuplicateReportsAdded) PASS; build, vet and gofmt
clean; `make bazel-sync` produces no drift (no files added); and
scripts/check-doc-flags.sh passes, including the CLI docs freshness gate.
Measured complexity moved down where it changed: removeLabelsByPrefix
cyclomatic 16 to 12 and cognitive 21 to 16; reportLabelEdit is unchanged at
12 and 25.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.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(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.
* feat(embeddeddolt): warn when a stored peer suppresses an ambient DOLT_REMOTE_PASSWORD
A peer saved with a username but an empty password (Enter at the
interactive prompt) deliberately suppresses an ambient
DOLT_REMOTE_PASSWORD, the intended security default from the
withPeerAuth unit rule. A setup that used to authenticate off the
environment then fails with no hint about why (#5085 review,
follow-up 4).
Emit one stderr line when the resolved peer has a username, no stored
password, and DOLT_REMOTE_PASSWORD set, naming the peer and how to
store a password. Fired under federationEnvMutex before overrideEnv
rewrites the pair, so the value read is the ambient one and not
another peer's installed password. No credential behavior changes.
Tests pin the exact rendered line and the three silent cases (stored
password present, ambient unset, ambient empty), plus a direct-call
row pinning the all-empty-peer boundary.
Refs #5080
* merge: main into fix/peer-empty-password-warning
Catches the branch up 329 commits. No conflicts: main did not touch
internal/storage/embeddeddolt/federation.go or its credentials test,
which are the only two files this branch changes.
Verified on darwin/arm64: gofmt and go vet clean, and
go test ./internal/storage/embeddeddolt/ passes. That package needs ICU
headers to build here, so it was run with CGO_CPPFLAGS pointed at the
brew icu4c prefix; without them the cgo dependency fails to compile on
upstream main too.
Refs: gastownhall/beads#5215 (review)
* fix(embeddeddolt): keep the tier and prompt for the password in the remedy
Review fixup for #5215 (adopt-pr review loop, iteration 1). Both review
lanes approved (scorecard 974/1000, no blockers or majors). This fixes
the two gated minors, both in the add-peer command the new warning
prints.
- Change Impact: the printed command had no --sovereignty. add-peer
upserts the whole row (issueops/federation.go: ON DUPLICATE KEY UPDATE
... sovereignty = VALUES(sovereignty)), so running it as printed on a
T1-T4 peer cleared the tier (#5213, still open). The command now
includes the peer's stored tier when it has one. The PR body says the
--password form avoids #5213, but it does not: step 6 of #5213's own
repro is add-peer with --password and without --sovereignty, and it
clears the tier. The control below reproduces that.
- Security Surface: the command put the secret on the command line
('--password <password>'), where it ends up in shell history and in
/proc/<pid>/cmdline. add-peer already prompts for the password without
echo when --user is given without --password, so the warning now
points to the prompt, as the verifyPeerRemoteURL message in this file
already does.
The test gets a new case that pins the tiered wording verbatim, and the
existing open-pwd pin is updated.
Not changed:
- Readability nit (shell-quote the username): doltutil.ShellQuote is
only used by this package's go_test today. Using it here would add a
go_library dependency and a BUILD.bazel deps change for a nit that
does not gate.
- Architectural Consistency (the server-mode internal/storage/dolt
backend prints no such warning; does not gate): left for finalize to
file as a follow-up bead.
Validation (ambient BEADS_*/BD_*/DOLT_* unset, TMPDIR=/tmp):
- go test -tags gms_pure_go -count=1 -run TestWithPeerAuth
./internal/storage/embeddeddolt/: all 8 tests pass, including all 8
subtests of the warning test.
- Mutation: removing the branch that adds the tier fails only the new
tiered subtest. The file was restored byte-identical.
- E2E with bd built from this tree: a T2 peer that stores a username
and an empty password, used with DOLT_REMOTE_PASSWORD set in the
environment, prints one warning. Running the printed command and
typing a password at the prompt keeps sovereignty T2 and stores the
password (checked with dolt sql), and the warning no longer appears.
Control: the old '--password' command on a T3 peer stores the password
but clears the tier.
- go vet -tags gms_pure_go ./internal/storage/embeddeddolt/, gofmt -l,
git diff --check: clean. No imports or files were added, so there is
no Bazel drift.
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: Michael Pursifull <mike@arcaven.com>
Co-authored-by: Steve Yegge <steve.yegge@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
* fix(pour): reject --var names the proto cannot consume
An unrecognized --var name was dropped without comment. The failure that
surfaces is not a missing substitution but a missing step: a typo in an
optional var leaves its condition evaluating against an unset name, so
the conditional step is quietly never poured and the molecule looks like
it simply does not have that step.
checkPourVars now rejects names that no proto in the pour declares in
VarDefs or references as a {{handlebar}}, listing what is available.
Anything that could still affect the pour is accepted: a documentation
handlebar the formula never declared, and a var belonging to an --attach
proto rather than the root, both pass. Missing required vars are reported
first, unchanged, since the caller's hint is derived from them.
That hint is now only attached when a required var really is missing.
It interpolated missingVarHint unconditionally, so any other failure from
checkPourVars would have advised "--var =<value>".
* fix(wisp): reject --var names the proto cannot consume
bd mol wisp validates vars through checkRequiredVars rather than
checkPourVars, so the unknown-name rejection added for pour did not reach
it and a typo was still dropped without comment on the wisp path.
Route it through the same check. A wisp instantiates one proto with no
attachments, so the known set is that proto's declared vars plus the
handlebars it references.
The missing-var hint is now only attached when a var really is missing
here too, matching pour: otherwise any other failure from this check
advised "--var =<value>".
* fix(pour): count a var used only by a step condition as consumable
checkUnknownVars built its known set from the cooked subgraph, so it could
not see step conditions: formula.FilterStepsByCondition consumes them and
drops the steps carrying them BEFORE the cook, and nothing requires a
condition var to be declared in [vars]. An undeclared var that decides
which steps get poured therefore left no trace anywhere the check looked,
and a hard error turned a working pour into a failing one - exactly the
case the rule ("a name is rejected only when nothing in the pour could
consume it") means to accept.
TemplateSubgraph gains ConditionVars, recorded by
resolveAndCookFormulaWithVars immediately before the condition filter runs
- the last point at which those names are still visible. Collected
unconditionally, since they are a property of the formula rather than of
this pour's --var values, which is what makes the falsey case work: the
step is gone, and the var that removed it still counts. knownVarsAcross
adds them. A persisted proto loaded from the database leaves the field
empty, correctly: it has no formula behind it and its conditions were
resolved at cook time.
The reviewer's reproduction, against the pre-fix code:
Error: unknown variables: has_spike (available: story)
Regression coverage answers the fifth review point as well - that every
existing test called checkPourVars directly with a hand-built subgraph,
which is precisely why this was invisible.
TestBdMolPour_AcceptsAVarUsedOnlyByAStepCondition runs the CLI through the
real cook pipeline with has_spike both true and false (the falsey case
being the one that regresses if the collection ever moves after the
filter), plus a typo case proving the widened set does not disable the
check. Two unit cases cover the same pair.
The check does not disable itself: a typo in a condition var is still
reported, now with the condition var among the available names.
Non-blocking review points 3 and 4: pour's and wisp's --var flag help says
an unusable name is an error, and the CHANGELOG entry states the new
behavior and says plainly that `bd mol bond --var` and `bd mol seed --var`
remain out of scope - both go through formula.ValidateProvidedVars, which
only iterates declared vars and so never examines a provided name with no
VarDef.
On review point 2 (the interaction with #5758): no action needed either
way round. #5758 widens extractAllVariables itself, and knownVarsAcross
calls that same function, so a var referenced only from a step's
assignee/labels/metadata joins this known set automatically when #5758
lands, in whichever order the two merge.
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>
* test(pour): exercise the real cook pipeline without spawning a binary
The end-to-end case spawned an embedded bd and ran three CLI invocations,
the most expensive shape of test in cmd/bd - and cmd/bd already runs 477s
of its 600s budget on the macos runner, so the addition timed the package
out.
The process boundary was not the point. What the unit tests could not see
was the ORDERING inside the cook pipeline, and
resolveAndCookFormulaWithVars takes its search paths as an argument, so
the real pipeline - control flow, expansions, FilterStepsByCondition, the
cook - runs directly against a formula in a temp dir. Same coverage in
0.01s instead of 32s.
It is also a sharper test than the CLI version was. It now asserts the
PREMISE of the falsey case (that the conditional step really is absent
from the cooked subgraph, so the case is testing the ordering rather than
passing for an unrelated reason), and that the typo error offers the
condition var among the available names, which is the actual user-visible
point of carrying those names into the known set.
Both reds confirmed, including the near-miss: with the known-set change
reverted all three cases fail, and with the collection moved to AFTER the
condition filter - the plausible fix, and the one the reviewer's suggested
call site would have produced - has_spike=true passes while has_spike=false
still fails:
--- FAIL: .../has_spike_false
pour rejected a var its own step condition consumes (has_spike=false):
unknown variables: has_spike (available: story)
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>
* chore(bazel): enumerate the PR's new cmd/bd test files in go_test srcs
gazelle-generated. cmd/bd/BUILD.bazel lists go_test srcs explicitly, so the
two untagged test files this PR adds would not run under the advisory Bazel
lane added in #6881. Base parity at 6da2a4347 is exhaustive for untagged
tests (the only two unenumerated files are //go:build cgo && integration),
so the omission is PR-introduced rather than a pre-existing pattern.
Produced by make bazel-sync; no deps line was needed because go_test embeds
:bd_lib, which already depends on //internal/formula and //internal/types.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(pour): read every substituted field into the unknown-var known set
Maintainer review fixup for the unknown-`--var` refusal. The refusal failed
CLOSED on a known set narrower than what the pour actually substitutes, so it
rejected names the clone demonstrably consumes.
- knownVarsAcross read the five prose fields only, missing a gate's await_id
and a gh:* gate's metadata.repo selector; a formula's `repo = "{{gate_repo}}"`
is stored literally on the proto and filled in at clone time, and nothing
mirrors that name into a scanned field. substitutedIssueFields now mirrors
cloneSubgraphInto's substitution set, and gateRepoSelector is factored out of
substituteMetadataRepo so the read and write sides of the selector cannot
disagree about which issues carry one.
- a proto loaded from the database has no formula behind it, so its [vars]
declarations are gone and a declared-but-unreferenced name cannot be told
apart from a typo. `VarDefs == nil` does not identify that case - a formula
declaring no [vars] is also nil, and that proto really does take none - so the
cook stamps DeclaredVarsKnown and the refusal stands down without it. That
covers every `bd cook --persist` proto and every --attach proto, which is
always DB-loaded.
- a handlebar living only inside a step the condition filter dropped left the
known set, so `--var deploy=false --var deploy_target=prod` failed while
deploy=true succeeded. ConditionVars becomes FormulaVarRefs and is collected
from the unfiltered steps' text and gate fields as well as their conditions,
making a name's validity a property of the formula rather than of another
var's value.
- a standalone `type = "expansion"` formula has no [[steps]]:
MaterializeExpansion builds them from its [[template]] before the cook,
substituting --var values into single-brace `{name}` placeholders, so a name
used only there was consumed and then refused as unknown.
formula.ExpansionVarRefs reports those names by running that same expansion
- expandStep now wraps expandStepWith - with a substitution that records
instead of replacing, so it covers exactly the fields the expansion fills in,
including a name that `{target.description}` pulls in from the formula's own
description. cook adds them to FormulaVarRefs ahead of the filter, and
without MaterializeExpansion's has-Steps skip: the filter can remove every
step, and then the template is materialized after all.
The hint-suppression branch was hand-copied to three sites and tested at none;
it is now handleVarErrorWithHint, pinned by a stderr assertion that an
unknown-var error prints no `Provide them with: --var =<value>`.
Tests: table cases for both gate fields and for `repo` on a non-gh gate staying
unsubstituted (the polarity that keeps the read side honest), for the DB-loaded
stand-down directly and via an --attach proto, and real-pipeline cases for the
dropped-step var, for vars only a dropped step's gate uses (await_id and a
gh:* repo), and for a template-only placeholder var, whose typo is still
refused with the real name offered. ExpansionVarRefs is pinned per substituted
field, per field the expansion drops (notes, condition), and for an expansion
formula that also has steps. Mutating each arm reds exactly the matching cases
and nothing else.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <agent@gascity.ai>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(config): unset a nested key in config.yaml instead of reporting a no-op
commentOutYamlKey matched only a flat "a.b:" line, so unsetting a key
written in nested form left the file untouched while bd printed
"Unset <key> (in config.yaml)" and the value stayed effective. The write
side does not have this limitation: SetYamlConfig routes dotted keys
through updateNestedYamlKey, and readUserGlobalYamlValue accepts either
shape, so bd could produce and read a nested key it could not remove. The
shipped config.yaml template documents the nested form in its commented
examples, which is the likeliest way a user acquires one.
Locate the leaf through the yaml node tree and comment out its source
line rather than re-marshalling, so the file's comments and layout
survive. A leaf whose value is not a scalar on the key's own line is
refused: commenting one line of a multi-line value would leave the file
unparseable. The flat form is still tried first and still wins when a
file somehow carries both.
* fix(config): do not comment out a yaml key whose value is the block below it
commentOutYamlKey matched any line opening with the key, so unsetting a
key that names a mapping commented out only that line and left the block
beneath it indented under nothing. The result does not parse, and the
next bd command in that workspace fails to read its config rather than
losing one setting.
Skip a match whose value is empty and whose following content line is
indented deeper: that line is the head of a block, not a setting. A key
with a genuinely empty value is still commented out, including at end of
file, where there is no following line to judge.
* fix(config): clear the config.yaml layer on unset of a database-backed key
bd config unset routes a key IsYamlOnlyKey does not claim to
UnsetSetting, which deletes the database row and nothing else. A key that
also appears in .beads/config.yaml therefore survived its own unset:
"Unset <key>" was printed, and bd config show still resolved the value
from config.yaml on the next read. types.custom and types.infra are the
keys this bites, since neither is yaml-only and both are read back out of
the file.
Clear the file layer too when the key is set there, and name the
locations that were actually cleared so the message can be trusted. The
JSON form gains the same location field the yaml-only branch already
emits. Removing the key from config.yaml comments the line out rather
than deleting it, so the file keeps documenting the setting.
Stacked on the nested-key fix: without it this path would report
config.yaml as cleared while a nested key stayed effective.
* style(config): fix the misspell lint on the new doc comment
golangci-lint's misspell linter fails the PR on "re-marshalling" in the
commentOutNestedYamlKey doc comment: the enforced spelling is
"marshaling". Comment-only change.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(config): report the unset location from the write, not a merged pre-check
Two blocking items from review.
1. The location guard read viper's resolved value, not the config.yaml
layer. config.GetYamlConfig is v.GetString on the merged viper, which
serves SetDefault values and AutomaticEnv, so every non-yaml-only key
with a non-empty default (no-hooks, no-db, json,
events-journal-retain-days, events-journal-auto-prune) looked present in
config.yaml even in a workspace with no config.yaml at all. That meant
bd printed "Unset <key> (in database, config.yaml)" over a file it never
touched - a more specific false claim than the message this PR set out
to remove - and, with no project config.yaml, failed the command with
"no .beads/config.yaml found" AFTER the database row was already gone,
where main printed "Unset <key>" and exited 0.
UnsetYamlConfig (and UnsetUserYamlConfig) now return whether the file
was actually changed, threading out the found/ok that
commentOutFlatYamlKey and commentOutNestedYamlKey already computed. A
missing project config.yaml, and a key not present in a shape that can
be safely commented, are both (false, nil) - "not in config.yaml" is an
answer, not a failure. The command clears the layer unconditionally and
derives the location from the result, so the string is a report of the
write rather than a guess made before it. That also settles the
non-blocking third point: a refusal path can no longer print "Unset ..."
over a no-op.
2. commentOutNestedYamlKey over-deleted a flow mapping. It accepted any
leaf whose key and scalar value shared a line, but in flow style the
leaf's line IS the parent's, so `unset dolt.mode` commented out
`dolt: {mode: server}` whole and took the entire mapping with it. On
main the flat regex never matched this, so the loss is new. The leaf now
has to start at the line's first non-space column.
Also from review: commentOutFlatYamlKey splits instead of scanning, so a
flat unset keeps the file's trailing newline like the nested and no-match
paths always did; and the "flat form wins when both are present" case says
why the nested copy survives, and what `changed` does and does not claim
when it does.
Regression coverage: four commentOutYamlKey cases (two flow-mapping, two
trailing-newline), a changed/content agreement assertion across the whole
table, and two embedded CLI subtests - one proving the location no longer
names config.yaml for a defaulted key that was never written there, one
proving an unset with no project config.yaml exits 0 and does not recreate
the file. All four reproduce red against the pre-fix code.
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(config): address #5760 review — top-level flat match, lists at the key's indent
Blockers from the re-review at d168df1841:
- The flat-key match accepted any indentation, so on the database-backed
path `bd config unset enabled` commented out a nested backup.enabled and
reported "in database, config.yaml". A flat key is a top-level key whose
name contains the dots, so it now matches only at the document's
top-level indentation, read from the first key line (yaml.v3 accepts a
document whose whole mapping is indented, which main's "preserve
indentation" case covers). The same change stops `mode` under
`dolt: mode: x: 1` from triggering a refusal that did not apply.
- A list at the key's own indentation (`types.custom:` then `- step`)
slipped past the refusal and left config.yaml unparseable. A `-` item at
the key's indentation now counts as the key's value.
Smaller:
- Only a comment, an anchor or a tag after the colon (`b: # note`,
`base: &b`) still leaves the value to the lines beneath, and is refused.
- Blank-line detection uses TrimSpace, so a CRLF blank line no longer ends
the value early.
- The message no longer calls a plain scalar on the next line "a mapping or
list".
Each has a case in TestUnsetRefusesShapesItCannotEdit or
TestCommentOutYamlKey, and undoing each fix fails its case.
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(config): refuse a single-segment block scalar; pin the tag and dedent branches (#5760 review)
- unsupportedUnsetShape returned early for single-segment keys, so
`notes: |` with an indented body plus `unset notes` commented the key and
orphaned the body, and the file stopped parsing. The database-backed
unset now reaches this path for every key, so single-segment keys are
checked too.
- New pins: a tag alone after the colon (`m: !!map`) leaves the value
below, and a dedent ends the value (`outer:` / ` k:` / `z: 1`, unset
outer.k, is commented). Undoing either branch fails its case.
- The database-path error no longer claims a row was unset.
UnsetSettingResult cannot say whether one existed.
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(config): restore CRLF normalization lost by the split-based unset rewrite
Base commentOutYamlKey scanned with bufio.Scanner, whose ScanLines drops a
trailing \r, so CRLF files came back LF-only. The PR switched to
strings.Split to preserve the file final newline, which carried every \r
through. Normalizing at entry keeps both properties: base own
TestCommentOutYamlKeyPreservesTheTrailingNewline now passes 9/9.
* fix(config): keep the no-config.yaml unset failure reportable for yaml-only keys
Base extracted the yaml-only unset into runConfigUnsetYamlOnly, which runs the
leaked-secret row cleanup independently of the YAML edit and folds the row's fate
into the returned error. This PR widened UnsetYamlConfig to (bool, error) and
swallowed the missing-config.yaml case as (false, nil) so its own new
database-backed call site would stop failing after the row was already gone.
Merging both turned base's report into a success, so
TestConfigUnsetCleansTheRowWhenTheYamlUnsetFails lost the error it asserts and
the leaked-credential rotation notice went to stdout instead of the error.
The two call sites need opposite answers, so report the case as a sentinel,
ErrNoProjectConfigYaml, and let each state its own contract. Resolution stays in
findProjectConfigYaml so neither caller re-derives it - a caller-side pre-check
is what produced the false "(in config.yaml)" claims this PR removes.
* fix(config): compare the unset against the normalized content, gate the hint
Maintainer review fixup for PR #5760 (adopt-pr iterations 1 and 2).
Iteration 1 addresses the synthesis Pre-Merge Checklist in full; iteration 2
takes both of its non-gating follow-ups.
New Finding 1 (major) — commentOutYamlKey rewrites CRLF to LF as its first
statement, but both public callers compared its result against the raw
os.ReadFile bytes. On any CRLF config.yaml those always differ, so the `changed`
bool meant "the bytes moved", not "the key was there": unsetting an ABSENT key
returned (true, nil), printed "Unset <key> (in config.yaml)" — the exact false
claim this PR exists to remove — rewrote the whole file to LF, and made the new
"was not set" branch unreachable on a supported platform. Both callers now
normalize once up front and compare like for like, so a no-op leaves the file
byte-identical. A real unset still normalizes to LF, which is base behavior; it
is pinned at the callee and, since iteration 2, through both callers. Note this
was introduced by the adopt lane's own CRLF-restoration repair (59463663e), not
by the contributor.
New Finding 1 test cell (required) — every change-report fixture in the package
was LF, so nothing in-tree could catch this. Added a CRLF absent-key cell for
BOTH callers asserting changed=false and byte-identity. Proven non-vacuous:
reverting one caller to the raw-byte compare reds that caller's subtest on both
assertions and leaves its sibling green.
New Finding 2 (minor) — printConfigSideEffects sat outside the if/else, so the
no-op branch printed "Backup config removed..." right after saying the key was
never set. All four side-effect keys are yaml-only by prefix, so 4/4 route
through the new branch. Gated on `changed`, which covers the --json arm too
since the hint goes to stderr and was never suppressed there.
New Finding 3 (minor) — the yaml-only --json payload rendered location as ""
both for an absent key and for an unpopulated field, with no way to tell them
apart; added a `changed` bool and pinned one --json cell per route.
New Finding 4 (nit) — the ErrNoProjectConfigYaml doc comment was written as a
caller census and was short by two. Re-censused: four non-test callers, taking
three different answers. Reworded to say so.
CHANGELOG: the honesty claim is no longer LF-only; recorded the no-op
byte-identity, the gated hint, and the new --json field.
Iteration 2, minor (test evidence) — the absent-key cell pins only the no-op
direction of the new compare. A caller that returned early whenever the
up-front normalization changed anything passed the whole package, and it turns
every unset on a CRLF config.yaml into a silent "<key> was not set" while the
key stays effective. Added TestUnsetOfAPresentKeyInACRLFFileReportsTheWrite for
both callers: changed=true, the key line commented out, and the file
LF-normalized. Proven non-vacuous: that early return in both callers reds only
this test, both subtests on both assertions; in one caller it reds only that
caller's subtest; and writing CRLF back reds only the file assertion. The rest
of the package stays green under each.
Iteration 2, nit (contract) — the CHANGELOG said `--json` carries a `changed`
boolean, but only the yaml-only route's payload does; the DB-backed route still
emits just key and location. Scoped the sentence to the yaml-only payload.
Validation (scrubbed env — ambient BEADS_* and BD_* variables fake reds here):
internal/config full package is 450 PASS / 0 FAIL; cmd/bd seam selector with
BEADS_TEST_EMBEDDED_DOLT=1 is 63 PASS / 0 FAIL / 2 SKIP over 65 runs, the two
skips being the cells that need a Dolt server. The new embedded cell executes
rather than skipping, and reverting the two config.go changes reds it on both
the payload and the hint assertions.
Co-Authored-By: Claude Opus 5.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>
* Refuse reserved words and fuzzy id matches on bd comment writes
bd comment <id> [text...] treated its first argument as an id via the
same abbreviation-tolerant resolver used everywhere else, with no
protection against the id slot holding something that was never meant
to be an id. Two related failure modes came from that:
- "bd comment list <id>", a typo for "bd comments list" (or "bd
comments <id>"), silently ran with id="list" and text="<id>" instead
of erroring.
- If "list" (or any other stray first word) happened to be a
leading-prefix abbreviation of some unrelated issue's hash, the
resolver picked that issue and the comment landed there instead of
failing with "not found". This is exactly what happened in
production: 15+ automated sessions made the "bd comment list <id>"
typo over two days, and because "list" was a leading-prefix
abbreviation of an unrelated wisp's hash ("list3t0"), every one of
them wrote a garbage comment onto that wisp.
Fixes both, independently:
- checkCommentIDNotReservedWord rejects list/add/rm/delete as the id
argument before any resolution is attempted, mirroring the existing
"bd comments list" misplaced-subcommand guard.
- ResolvePartialIDExact (internal/utils) is an exact-match sibling of
ResolvePartialID: identical exact-ID and exact-hash matching
(including a wisp's hash with its "wisp-" infix stripped), but never
falls through to leading-prefix abbreviation matching. bd comment
now resolves through this via a new resolveAndGetIssueForMutationExact,
which keeps the existing cross-rig prefix-routing and contributor
auto-routing fallbacks intact (tightened to exact matching too) so
cross-repo comment writes by full id are unaffected.
Every other caller of the touched shared functions (ResolvePartialID,
resolveAndGetIssueForMutation, resolveViaPrefixRoutingWithAccess,
resolveViaAutoRouting) keeps its exact current behavior — the new exact
variants are additive, and existing call sites were updated to pass an
explicit "false" for the new parameter rather than changing behavior.
Testing: go build/go vet pass across the whole module. The new pure-Go
guard test and a hand-rolled in-memory PartialIDResolverStore test both
run and pass without Docker or a live Dolt server, and the latter
reproduces the original collision (ResolvePartialID) before asserting
the fix (ResolvePartialIDExact) in the same test, so the fixture is
proven to exercise the real failure mode rather than trivially passing.
The Dolt-container-backed table tests (mirroring the existing
TestResolvePartialID_Wisp / TestResolvePartialID suites) could not be
run locally (no Docker in this environment) — they compile and skip
cleanly the same way the pre-existing suite does, and will run for real
in CI.
* fix(ga-wpdum): address steveyegge's PR #5393 review items b/c/d
Review (2026-08-07, posted as a PR comment, not a formal GitHub review —
hence reviewDecision stayed empty) asked for four things before merge; (a)
rebase onto #5369 was already done (2026-09-07, see PR history). This
addresses the rest:
(c) MAJOR — comment writes require an exact id, but a REAL abbreviated id
was refused with "no issue found matching %q", which is false: the issue
exists, only the abbreviation was rejected. ResolvePartialIDExact now
distinguishes the two failure modes via a new sentinel,
ErrAbbreviatedIDNotAllowed, wrapped only when the input would have resolved
via leading-prefix abbreviation. bd comment's RunE checks errors.Is against
it and returns a truthful, actionable message pointing at `bd show <id>`
instead of claiming the issue is missing. Docs (hash-ids.md) and CHANGELOG
updated with the read/write carve-out this creates.
(b) MAJOR — investigated whether the proxied-server comment path needed the
same exact-match treatment. It doesn't: resolveCommentTargetProxied resolves
via workapi.GetIssueOrWisp with the raw id, which bottoms out in
issueSQLRepositoryImpl.Get's plain "WHERE id = ?" — SQL exact equality, with
no abbreviation-matching layer anywhere in that call chain (unlike the
embedded path's utils.ResolvePartialID). Comment writes over the proxied
server were already exact-id-only before this PR. Per the review's own
fallback ("extend exact matching to that path, or document/test the gap
explicitly"), added a regression test locking this in rather than leaving it
implicit.
(d) Added CLI-level (cobra-dispatch, in-process rootCmd.Execute) tests for:
- "rm"/"delete" reserved-word rejection, the two words the #5369-inherited
tests don't cover (only "list"/"add" have hand-written cases).
- The new (c) abbreviation-refusal message end-to-end, including a
same-abbreviation sanity check against `bd show` to prove it's a real,
resolvable abbreviation and not a fixture accident.
Plus a Docker-free fake-store test in internal/utils pinning
ErrAbbreviatedIDNotAllowed's distinguishability from a genuine not-found.
Fixed in the same pass, same class of defect as (c): checkCommentIDNotReservedWord's
message claimed every reserved word is a "misplaced bd comments subcommand" —
true for "list"/"add", false for "rm"/"delete" (no such subcommand exists;
bd has "delete" as a top-level command and "rm" as an alias elsewhere, e.g.
"dep rm"). Message now says "reserved word" generically, true for all four.
Testing: go vet (plain and -tags=integration) clean on cmd/bd and
internal/utils. go test ./internal/utils/... passes including the new
ErrAbbreviatedIDNotAllowed test. go test ./cmd/bd/. (non-integration tag)
passes including both reserved-word cases. The new CLI-level and
proxied-server integration tests need a Dolt test container (Docker) this
environment doesn't have — same limitation the original commit's own
Dolt-backed tests already disclosed; they compile clean under
-tags=integration and skip cleanly the same way the pre-existing suite does.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ga-wpdum): address bee-ghosttrack's R1 review (M1 + the flagged MINOR)
R1 (aec6de4ad, REQUEST-CHANGES) found that CHANGELOG.md and hash-ids.md
claim `bd comments add` is guarded against abbreviated ids and reserved
words exactly like `bd comment`, but the code never extended the guard
to the plural form — `commentsAddCmd` had no Args validator and resolved
through the abbreviation-tolerant `resolveAndGetIssueForMutation`. Per
the reviewer's preferred fix (option ii), extend the guard instead of
softening the docs:
- Add `validateCommentsAddArgs` (mirrors `comment`'s `validateCommentArgs`
minus the singular/plural-confusion special cases) and wire it as
`commentsAddCmd.Args`, so a reserved-word id is refused before either
dispatch branch.
- Switch the embedded-path resolution from `resolveAndGetIssueForMutation`
to `resolveAndGetIssueForMutationExact`, with the same
`errors.Is(ErrAbbreviatedIDNotAllowed)` truthful-message mapping
`comment` already has. (The proxied path already resolved exactly —
it shares `addCommentProxied`/`resolveCommentTargetProxied` with
`comment` — so this closes the embedded-path gap only.)
- Update the one pre-existing test that asserted the old, now-removed
behavior (`PartialIDWithCommentsAdd` expected a genuine abbreviation to
succeed) to assert the refusal instead, and add a CLI-level regression
test mirroring `TestCLI_CommentAbbreviatedIDRejectedWithTruthfulMessage`.
- Add `TestValidateCommentsAddArgs`, a pure Args-validator unit test
(no store/Docker needed) mirroring `TestValidateCommentArgs`.
Also treats the one MINOR the review flagged as an actual gap (not just
a suggestion): the wisp-branch abbrevOnly tracking in id_parser.go had no
test pinning it — P3 (making the wisp-branch abbrevOnly append a no-op)
went uncaught. Strengthened
TestResolvePartialIDExact_FakeStore_ReproducesReportedIncident's "list"
assertion from a bare `err != nil` to `errors.Is(err,
ErrAbbreviatedIDNotAllowed)`, which is exactly the incident's own shape
in the wisp branch.
CI (PR Core / wrapper timing) is failing on this branch, but independently
confirmed pre-existing and unrelated: `ci-pr-core.sh` runs `go test -race
./...` with no `-timeout` override, so cmd/bd (a large package under
-race) hits Go's default 10-minute per-package ceiling; same-hour green
runs on other PRs measured 11-13.5 min total job time, already at the
edge, and the actively-running test at the deadline
(TestWhereCommand_ReadsPrefixFromEmbeddedStore) is unrelated to this
diff. R1 independently measured the same thing (541.6s/387.0s on other
green runs vs. 600.9s here). Needs a green re-run, not a code fix.
Verified locally (no Docker in this environment, so the two integration-
tagged CLI tests above compile-check clean via `go vet -tags=integration,
gms_pure_go` but run as SKIP rather than PASS; will run for real in CI):
- go build ./...; go vet ./cmd/bd/ ./internal/utils/: clean
- go vet -tags=integration,gms_pure_go ./cmd/bd/: clean
- gofmt -l on all 4 changed/added files: clean
- go test ./internal/utils/... -run ResolvePartialID: PASS
- go test ./cmd/bd/. -run 'TestValidateCommentsAddArgs|TestValidateCommentArgs|TestCheckCommentIDNotReservedWord': PASS
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ga-wpdum): address bee-ghosttrack's R2 review (dead-red fixture + cobra-dispatch wiring test)
R2 (a639234a0, CHANGES_REQUESTED): TestCLI_CommentsAddShortID/PartialIDWithCommentsAdd
was dead-red in its own setup — it only truncated the fixture hash to a
4-char abbreviation when len(hash) > 4, but fresh test DBs mint 3-char
hashes (min_hash_length unset), so shortID always equaled the full hash
and the t.Fatalf guard fired before any of the subtest's real assertions
ran. That meant mutation P-B (reverting comments.go's exact resolver back
to the abbreviation-tolerant one) went uncaught.
Fix: derive the abbreviation as a strict, one-character-shorter leading
prefix of the real hash (hash[:len(hash)-1]), the same derivation
comment_proxied_integration_test.go already uses — correct regardless of
fixture hash length, with a length>=2 guard instead of the old
always-true-in-practice one.
Also closes R2's recommended "NEW MINOR — the guard's wiring is
untested": comments_add_test.go drives validateCommentsAddArgs directly
(catches a gutted body, mutation P-C) but nothing exercised
commentsAddCmd's Args field through real cobra dispatch, so unwiring it
back to cobra.MinimumNArgs(1) left every test green (mutation P-D). Added
TestCLI_CommentsAddReservedWordRejectedThroughCobraDispatch, which runs
`bd comments add <reserved-word> ...` through actual rootCmd.Execute()
dispatch for all four reserved words and asserts the bystander issue
receives no comment.
Not touched, per R2: the carried-over m1 (cross-rig abbreviation error
message) — reviewer marked "Not a blocker" — and the CI race-default
timeout on cmd/bd, already diagnosed (R2 + prior PR comment) as
pre-existing infra flakiness needing a fresh run, not a code change.
Verified in this environment (no Docker/testcontainers available, same
disclosed limitation as prior rounds): gofmt clean; go vet -tags=integration
./cmd/bd/... clean (requires CGO_CPPFLAGS/CGO_LDFLAGS/PKG_CONFIG_PATH
pointed at the keg-only icu4c@78 install); go test -tags=integration
-run 'TestCLI_CommentsAddShortID|TestCLI_CommentsAddReservedWordRejectedThroughCobraDispatch'
./cmd/bd/ -v passes with all Dolt-backed subtests skipping cleanly
(Docker not available) rather than panicking — confirms both tests compile
and execute up to the container-availability skip. The actual fixture-hash
logic under test only runs where a Dolt container exists (CI); it has not
been exercised against a real container here.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): enumerate the PR's 4 new test files in BUILD.bazel (adopt-pr rebase gate)
Base added cmd/bd/BUILD.bazel and internal/utils/BUILD.bazel enumerates
go_test srcs explicitly, so PR #5393's four new test files were unlisted.
Output of 'make bazel-sync' (gazelle + go_srcs.py + mod tidy), verbatim and
idempotent. Measured: the unrepaired //internal/utils:utils_test binary lists
0 of the PR's 5 TestResolvePartialIDExact* tests while still building green
(a fake green); repaired it lists 5/5.
* fix(review): surface a routed-tier abbreviation refusal on comment writes
Review-loop fixup for PR #5393 (iteration 1). The review approved with no
required changes; these are the non-gating minor plus one of the two nits,
taken because the minor is a user-visible false message on this PR's own
headline contract.
[minor] Contract & Interface Fidelity. resolveAndGetIssueForMutationExact
passes exact=true to all three tiers, so the cross-rig and auto-routed tiers
can mint utils.ErrAbbreviatedIDNotAllowed too -- and both wrappers propagate it
unwrapped (routed.go:303-305) -- but each routed error was bound inside an `if`
statement and discarded, and `return nil, err` returned the LOCAL error. The
consumers' errors.Is (comment.go:158, comments.go:238) was therefore
structurally unable to observe a routed-tier refusal, so `bd comment hr-8wn
"text"` printed `no issue found matching "hr-8wn"` for an issue a routed rig
demonstrably holds -- the exact falsehood the sentinel's own doc condemns, at
the caller that doc names (internal/utils/id_parser.go:33). Both tiers' errors
are now captured and the first abbreviation refusal is returned in preference to
the local not-found. The wrong write was already refused on every tier; only
the message contract was unmet.
The new pin cmd/bd/comment_routed_exact_test.go drives the real seam (local
town store + routed rig + routes.jsonl, mirroring
TestCheckBeadGateCrossRigPrefixRoute) in both directions, because either
assertion alone passes for the wrong reason: an abbreviation of a routed issue
must select the ROUTED refusal, and an id absent everywhere must stay a plain
not-found. Proven non-vacuous by mutation -- dropping only the selection reds
direction 1 with `no issue found matching "gt-abcdefg"`, the original symptom
verbatim, while direction 2 still passes.
[nit] Test Evidence Quality. The proxied regression test asserted only
strings.Contains(stdout+stderr, id), which passes identically on the false and
the truthful message and so locked the local/proxied message asymmetry in where
the suite could not see it. It now asserts the whole message (verified
empirically: `Error: issue pa-2u not found`) and empty stdout, matching the
exact-message norm of the sibling missing-ID subtest. The asymmetry itself is
deliberate and stays: the proxied route resolves through one exact
`WHERE id = ?` and cannot distinguish an abbreviation of a real issue from an
absent id without adding back the abbreviation probing this PR exists to remove
from write paths.
[nit] Release Safety -- DECLINED, measured. The prescribed `### Changed` bullet
belongs at the top of the first `### Changed` block in `## [Unreleased]` (base
CHANGELOG.md:383), and main has since inserted its own bullet at exactly that
anchor (`@@ -384,0 +492,16`, the #6111 entry). Adding it would mint a second
CHANGELOG add/add conflict for the finalize base-refresh on top of the
`### Fixed` re-conflict already predicted by the rebase gate -- not worth it for
an optional nit whose own text says "No code change".
cmd/bd/BUILD.bazel gains one srcs row for the new test file (via make
bazel-sync, a no-op on a second run) so bazel.yml's "BUILD files in sync" gate
stays clean.
Validation: go build ./... rc 0; go vet ./cmd/bd/ ./internal/utils/ rc 0; gofmt
clean; git diff --check clean; cmd/bd selectors 11/11 PASS including base's own
TestMatchPrefixRoute (the GH#5048 longest-prefix union guard) and
TestResolveCloseTargets (the abbreviation-tolerant sibling path);
TestProxiedServerComment 3/3 under BEADS_TEST_PROXIED_SERVER=1.
* test(utils): pin #6215's sentinel guard to the shared resolver (#5393 base refresh)
Rebasing this PR onto current main (e7138e93af -> a1ac9f4dcb, 27 commits) hit
two conflicts. Both are recorded in .gc/reviews/<root>/base-refresh-repair.md;
this commit carries the one piece of the repair that is not simply a replayed
contributor hunk.
The substantive conflict was internal/utils/id_parser.go against ab88b20517
(#6215, "refuse a bare jq/JS sentinel ... as an issue ID", which itself says
Refs #5393). Both sides ADD at the same point -- the diff3 ancestor section is
empty -- so nothing base-owned is rewritten, and the only question is WHERE
#6215's guard lands now that this PR splits the resolver into ResolvePartialID
(abbreviation-tolerant) and ResolvePartialIDExact (exact-only) over a shared
resolvePartialID.
It belongs in the shared body. #6215 put it in ResolvePartialID only because
that was then the repository's single ID-resolution entry point ("One guard
covers the direct, embedded and proxied-server paths uniformly"); this PR adds
a second. Its changelog entry on main states the guarantee directly -- "bd
update null, bd comment null and every other command that resolves an ID now
fail before any lookup, because the guard sits in the shared resolver" -- and
bd comment is precisely what this PR routes through the exact-only path. The
relocation costs no patch delta: the guard re-anchors as unchanged context
after the PR's insertion, so the content-line diff of (old base..old head) vs
(new base..new head) is empty, and the PR's stat is 16 files +1212/-31 before
and after.
Nothing covered that choice, which is why this test exists. #6215's own
id_parser_sentinel_test.go exercises only ResolvePartialID, so the naive
textual resolution -- guard left in the exported wrapper -- keeps every one of
its assertions green while a sentinel reaching the exact path degrades into
`id is a valid abbreviation, but exact-match resolution is required here:
"null" (matches [hq-null3t0])`: it names an unrelated decoy issue and tells
the caller to use the full id, when in truth their selector matched nothing.
Mutation-proved in both directions: with the guard moved into the wrapper
alone, #6215's two tests still PASS and this test FAILs; with the guard deleted
outright, #6215's refusal test and this one both FAIL (so neither is vacuous).
The over-refusal arm mirrors #6215's accepted-inputs test through the exact
path, so hq-null3t0 and the bare hash null3t0 must still resolve.
No new file, so no BUILD.bazel srcs row is owed. 61 PASS / 0 FAIL / 0 SKIP for
-run 'Sentinel|ResolvePartialID' against a real Dolt container.
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(update): fence unforced --notes overwrites behind --force across all surfaces
bd update --notes silently replaced existing notes, destroying handoff
history. The contract now refuses an unforced overwrite of non-empty
notes with ErrNotesOverwrite (409 notes_overwrite_refused over HTTP,
force_notes_overwrite to override), enforced inside the mutation
transaction on both the dolt and uow backends, for single updates and
batch apply alike. CAS guards keep precedence: a stale
--if-assignee/--if-status still surfaces as the exit-13 mismatch, on
both backends, before the fence speaks.
CLI: --force and --if-assignee are no longer mutually exclusive (that
exclusion made overwriting under a guard impossible); both update
routes translate the fence's sentinel into the same actionable advice
(--force to overwrite, --append-notes to preserve history), and the
post---force warning is worded as an audit statement. The shipped
plugin skill docs and bd note help now prescribe --append-notes for
handoffs instead of the newly fenced bare --notes.
The fence is the single enforcement point: no client-side pre-read
copies of the rule. Conformance contracts, unit tests for
AuthorizeNotesOverwrite, and embedded/proxied/httpapi regression
coverage included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MAFpn9pUw8WKMfymteZHbh
* fix(update): exempt explicit clears from the notes fence; share its predicate
CI surfaced three gaps in the fence's reach:
- Clearing notes (--notes "" / patch.notes: "") was refused, diverging
from every sibling text field's clear and from the backend behavior
contracts. The fence now targets only its actual footgun — replacing
non-empty notes with different non-empty content — via a single shared
predicate, issueops.NotesReplacement, used by both the contract's
AuthorizeNotesOverwrite and the CLI's warning path, so the two can no
longer drift. Prose updated to match everywhere the rule is stated
(ErrNotesOverwrite, ForceNotesOverwrite, OpenAPI spec + regenerated
types).
- The revision-CAS integration tests' incidental concurrent writes now
patch design instead of notes, so they no longer depend on notes-fence
semantics at all.
- The historical-upgrade harness deliberately replaces fixture notes and
asserts the new value; its two bd update --notes calls now pass
--force.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MAFpn9pUw8WKMfymteZHbh
* fix(update): address review — changelog BREAKING entry, problem.go doc block, close-policy-under-guard test
Review follow-ups on #5946 (bee-ghosttrack, MERGE-AFTER-FIXES):
- CHANGELOG: BREAKING entry under [Unreleased] ### Changed for the notes
fence on both wires (CLI exit 1, HTTP 409 notes_overwrite_refused), with
the --force / --append-notes migration line. It also names the two
deliberate edges: the explicit-clear exemption, and --force widening to
the close-policy half under --if-assignee now that the flag pair is legal.
- problem.go: CodeNotesOverwrite's comment had landed inside
CodeDependencyCycle's doc block; each const now sits under its own docs.
- assign_fence_embedded_test.go: pin the previously untested close-policy
half of --force under --if-assignee (refused unforced, authorized forced).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyuQ6Tjv3D7tpNqeb2WDED
* test(update): align TestWarnNotesReplacement with the post-fence warning copy
The test landed on main after this branch was cut and pins the pre-fence
wording, where the warning fired on any unforced overwrite. Since the fence,
an unforced overwrite is refused outright and warnNotesReplacement fires only
after a forced one — the audit trail for a habitual --force — so the copy it
pins is now '--force replaced existing notes'.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyuQ6Tjv3D7tpNqeb2WDED
* docs(import): record bd import's notes-fence exemption as by-design (GH#6190)
Import consults none of the per-field live-state fences — notes overwrite,
live-claim reassign, close policy — and that is the intended shape, not an
omission: its contract is wholesale row replacement, guarded by its own
staleness check (only strictly-newer rows rewrite local state, --allow-stale
is the single deliberate-overwrite opt-in) and reported field-by-field in
updated_issues. Named in AuthorizeNotesOverwrite's enforcement-boundary
comment and in bd import's help; the published CLI docs pick the help text
up at the next release pin bump.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyuQ6Tjv3D7tpNqeb2WDED
* fix(update): refuse --notes "" and add --clear-notes; stop --notes help reading as additive
GH#6021: an empty --notes wiped the whole notes field at exit 0 behind the
same ✓ Updated receipt as a successful write — and the empty string is
exactly what a dead command substitution collapses to. The empty value is
now refused on both CLI routes (the accident and the deliberate clear are
the same bytes at the flag layer), and the deliberate clear gets its own
verb, --clear-notes, mutually exclusive with --notes/--append-notes. A verb
rather than the proposed --allow-empty-notes opt-in: what needs authorizing
is an intent, not an input path — --allow-empty-description unblocks
stdin/file plumbing, which notes does not have — and an opt-in passed
habitually would silently disarm the guard while a habitual --clear-notes
fails loudly. --force does not bypass the refusal; the fence's clear
exemption stands, so the verb alone authorizes the erase. The HTTP API is
unchanged: patch.notes "" still clears.
GH#6272: bd update --help called --notes "Additional notes" and the prime
text said "Add supplementary notes" — both read as appending, so agents
following the injected guidance faithfully clobbered prior context. The
update help now names the operation with the --append-notes contrast at the
point of use, the shared/create help is field-named like --description and
--design, and the prime line points at bd update --append-notes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyuQ6Tjv3D7tpNqeb2WDED
* fix(bazel): enumerate the PR-new files in cmd/bd and issueops srcs
The base added cmd/bd/BUILD.bazel and internal/storage/issueops/BUILD.bazel
with EXPLICIT srcs lists after this branch was cut, so the three files this
PR adds were never enumerated:
cmd/bd/update_notes_guard.go (go_library bd_lib)
cmd/bd/update_notes_guard_test.go (go_test bd_test)
internal/storage/issueops/aggregate_authorize_notes_test.go (go_test)
The go_library omission is a hard build break, not a silent skip:
update.go:215,220 and update_input.go:106,111 are enumerated and call
validateNotesUpdate / clearNotesRequested, so //cmd/bd:bd_lib compiles the
callers without the callee. bazel.yml arms unconditionally for fork PRs
(head.repo.fork == true) and builds //cmd/bd:bd + //cmd/bd:bd_test, so this
reds the lane. make bazel-sync-check cannot see it -- go_srcs.py only
validates the glob-based go_srcs filegroup, never the rule srcs lists.
Generated by make bazel-sync (gazelle), not hand-edited, so the workflow's
own BUILD-files-in-sync drift step agrees byte-for-byte.
* fix(notes): name --clear-notes in bd note's rm guidance, correct the fence boundary comment, pin both request-shape rules
Takes all three non-gating minors from the review. No behavior change: two
prose fixes and two test cases.
1. cmd/bd/note.go's rm|remove|delete branch advised
`bd update <id> --notes "text" --force` under "To change or clear notes",
but clearing through --notes is exactly what this PR made impossible --
validateNotesUpdate refuses an empty value unconditionally and --force does
not reach it. The branch now names both verbs separately: --notes --force to
replace, --clear-notes to clear. The edit and update branches speak only of
replacing and were already correct, so they are untouched.
2. aggregate.go's enforcement-boundary comment claimed the UpdateIssueInTx
funnel's "one notes-replacing caller is bd edit". Under this PR's own
NotesReplacement predicate there are at least four more (bd note's
read-combine-write, bd defer --reason, bd rename and delete-tombstoning's
mechanical ID rewrites, bd compact's clears). The exemption is still sound --
every funnel writer derives its new value from the current notes -- so the
comment now names those CLASSES instead of a single caller, which is the
claim that is actually true and that a future fence auditor can check.
3. Both branches this PR adds to ValidateUpdateRequest were uncovered: the
batch apply leg reaches them here and nowhere else, while the single-issue
HTTP handler's own pre-check returns before storage. Added a sibling table
(the existing one varies only the patch; these two rules are properties of
the REQUEST) with a case each. Mutation-checked, disjoint: neutralizing the
force-without-notes branch reds only the first case, neutralizing the
notes+append branch reds only the second, and the pre-existing
canonical-fields table stays green under both.
Not an amend of 5ffcc9c16c: that commit's message states it was generated by
make bazel-sync and not hand-edited, so folding hand-written Go into it would
falsify the claim its own BUILD-files-in-sync argument rests on. No new files,
so the srcs lists it repaired stay correct.
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* ci(pr-risk): stand down legacy embedded tier where the gated Bazel lane runs it
D2 step 1. A new bazel-embedded-coverage job decides, from the same
expressions as bazel.yml's rbe job, whether pr.yml's Bazel call takes
execution mode remote on a same-repo pull_request (RBE_WEST_WORKERS on,
executor secret present, not a fork). Only then do test-embedded-storage,
test-embedded-conformance and test-embedded-cmd (27 jobs) skip, and PR
Risk's gate accepts those skips only then; a failed or missing decision is
red. Forks, Dependabot, secret-less runs, the farm switch unset and
merge_group keep the legacy tier. build-embedded keeps running: its
artifact feeds the proxied and server Dolt jobs.
The decision job reads no repository code and the secret only as an
emptiness test. scripts/pr_risk_bazel_coverage_test.go runs both actual
decision scripts over every event/var/secret/fork combination and requires
covered <=> (pull_request && Bazel mode remote), pins the shared env
expressions, checks pr.yml still requires BAZEL_EMBEDDED and shares PR
Risk's triggers, and simulates PR Risk's gate over every tier/decision.
Revert: unset RBE_WEST_WORKERS.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record the retired legacy embedded tier in the check topology
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>
* ci(pr-risk): retire the embedded tier by committed flag; pr.yml gate fails closed
Review F1. PR Risk's coverage decision read the mutable RBE_WEST_WORKERS
variable in a different run from pr.yml's rbe job, so unsetting it and
re-running one workflow could leave both required checks green with
neither the legacy tier nor the Bazel lane having run the tier.
- Both workflows now commit BAZEL_RETIRES_LEGACY_EMBEDDED (policy-tested
equal) and run the identical bazel-embedded-coverage job:
covered = flag && pull_request && !fork && executor secret present.
RBE_WEST_WORKERS is no longer read by PR Risk at all.
- pr.yml's ci-gate requires the job's result (BAZEL_EMBEDDED_COVERAGE)
and BAZEL_EMBEDDED_RETIRED, which is red when covered but the Bazel
embedded lane did not run remotely and pass (mode skip included).
- Revert is a commit of the flag to "false" in both workflows; in-flight
PRs pick it up on their next push. The kill-switch runbook now flips
the flag first.
Tests run both decision steps, bazel.yml's rbe step and pr.yml's real
gate step over every event/var/secret/fork/flag combination, with the
variable differing between the two runs, and require no double-green
without the tier.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): never cache embedded-tier test results
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>
* test(ci): forbid flaky-test retries in the gated Bazel lanes
Review F3. Adding --flaky_test_attempts to a lane's config or
flaky = True to a lane target passed every policy test, and would hide
a flaky failure the legacy jobs (which ran each test once) would have
reported; since D2 step 1 nothing else runs the embedded tier on
same-repo PRs. TestBazelGatedLanesNeverRetryFlakyTests rejects
flaky_test_attempts and runs_per_test_detects_flakes in .bazelrc,
.github (workflows, setup-bazel's generated rc) and tools/bazel, and
flaky = True in every BUILD file and .bzl macro.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): pin the Bazel embedded lane's command line and config
Review F4. An extra --test_arg=-test.short/-test.skip on bazel.yml's
`bazel test //... --config=embedded` line, or a test:embedded
--test_filter in .bazelrc, narrowed the tier while every policy test
passed (check_testcases only rejects a shard with zero tests). Since D2
step 1 this lane is the tier's only pre-merge run on same-repo PRs, so:
- bazel-embedded's test step must be exactly the pinned script;
- the --config=embedded lines must be exactly the pinned list, in order;
- no unconfigured common/build/test line, and nothing setup-bazel's
generated rc writes, may select or narrow tests (test_filter,
test_arg, -test.short/run/skip, tag/size/lang/timeout filters).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): add the D2 policy tests to scripts_test
scripts/pr_risk_bazel_coverage_test.go was missing from
//scripts:scripts_test's srcs, so `bazel test //scripts:scripts_test`
(and the BUILD-sync check) did not see it. The repository-walking
flaky-retry test skips under Bazel, whose runfiles hold no other
package's BUILD files.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): check every listed embedded test ran in its Bazel shard
Review F5. The shard scripts discover tests from source with grep, but
each Bazel test binary holds only its target's srcs, so a discovered test
the binary lacks matches nothing in the shard's -test.run selector and
passes silently (check_testcases.py only rejects a shard with no tests).
tools/bazel/check_shard_coverage.py runs each shard script in list-only
mode (BEADS_TEST_SHARD_LIST_ONLY=1) and requires every Bazel shard's
test.xml to hold exactly the listed top-level tests: missing, extra,
wrong-shard, shard-count mismatch, missing test.xml and a failing script
are errors. bazel-embedded runs it after the tier for
//cmd/bd:bd_embedded_test (20) and embeddeddolt_embedded_test (5); the
policy test pins the suites to pr-risk.yml's jobs and shard counts, and
a fixture test exercises the script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): correct the D2 enforcement, re-run and merge-queue claims
Review F6.
- The beads-only ruleset enforces both gates on main only; release/**
PRs run them but merging does not wait for them, before and after D2.
- There is no merge queue and strict is off: merge_group runs are not a
pre-merge safety net for the retired tier.
- Spell out "Re-run all/failed jobs" semantics under the committed flag,
the remaining secret-deletion window, and that the revert needs a new
push to in-flight PRs.
- Record the lane hardening the retirement relies on (no result caching,
no retries, pinned selection, per-shard coverage check).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): drop TestMain from the embedded shard-coverage check
Re-review G1 (blocking). embedded-storage-test-shard.sh discovers tests
with `grep '^func Test'`, which also lists TestMain(m *testing.M)
(internal/storage/embeddeddolt/test_fixture_test.go). It is never a
<testcase>, so check_shard_coverage.py reported it missing on every real
remote run, turning bazel-embedded and CI Gate red on every same-repo PR.
The checker now drops NOT_TESTS = {TestMain}. The shard scripts are left
unchanged so the legacy jobs' -test.run selection stays byte-for-byte the
same (dropping TestMain there would be harmless to shard assignment,
which hashes per name, but would touch the legacy CI scripts this step
does not otherwise change).
TestEmbeddedShardScriptsListOnlyRealTests runs both real shard scripts
in list-only mode for every shard and requires each listed name to be a
`func Name(t *testing.T)` in the package, or in NOT_TESTS (which may hold
only TestMain, and only if it is not a test). The fixture shard script
now lists TestMain too, so the filter itself is exercised.
Verified on a real remote run (`bazel test //... --config=embedded
--config=remote-exec`, 4/4 targets, 27 test.xml, 582 top-level tests,
348 s uncached): check_testcases.py and check_shard_coverage.py both
pass (199 cmd + 381 storage tests); the previous checker failed on
TestMain.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(pr-risk): decide embedded coverage by actor, not by the executor secret
Re-review G2. covered still read secrets.RBE_WEST_EXECUTOR, which an admin
can delete between PR Risk's run and a re-run of pr.yml: PR Risk stayed
green with the legacy tier skipped, while the re-run computed covered =
false, took mode local and passed with no embedded lane.
Both workflows' bazel-embedded-coverage now decide
covered = flag && pull_request && !fork && github.actor != dependabot[bot]
and read no secret or variable at all (PR Risk now reads no secret).
Dependabot (no Actions secrets) keeps the legacy tier; github.actor,
unlike triggering_actor, survives a re-run by someone else. A same-repo
PR without the secret is covered, so pr.yml's gate goes red (mode local)
instead of passing.
The two-run test matrix now varies the secret as well as RBE_WEST_WORKERS
between PR Risk's and pr.yml's runs, adds the actor to the facts, and
names the missing-secret case (red). Docs updated: the residual is gone,
the cost of failing closed is recorded.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): close the remaining ways to narrow the Bazel embedded lane
Re-review G3. Skip-inducing edits outside the pinned --config=embedded
lines and command line still passed every policy test (reviewer
survivors m1, m2, m5, m6, m9, m10, m11), and the runtime checks counted
skipped testcases as run.
TestBazelEmbeddedLaneCannotBeNarrowed now rejects:
- any .bazelrc line of a config the lane uses (unconfigured, embedded,
remote-exec from setup-bazel's rc, and any config they reference) that
filters, narrows, re-runs or re-routes tests (test_filter, test_arg,
-test.*, *_filters, test_env=BEADS_TEST*/GO_TEST*/TESTBRIDGE*,
--config=, cache_test_results, run_under other than test_env, flaky,
runs_per_test, sharding strategy);
- any import other than the two gitignored try-imports, and any
committed rc file besides .bazelrc (try-import would load it in CI);
- -test.short/run/skip/list, BEADS_TEST_SKIP, BEADS_TEST_EMBEDDED_DOLT,
TESTBRIDGE_TEST_ONLY and similar in tools/bazel/*.sh (test_env.sh,
go_test_manifest_shard.sh, ...) and anywhere in the setup-bazel action,
and any --config= there but remote-exec;
- any change to the set of embedded-tagged targets or their args/env.
At run time check_shard_coverage.py fails a shard whose top-level tests
were all skipped, and its new --whole option applies the same check to
the unsharded conformance core/audit targets (added to bazel-embedded's
step). The real remote run still passes (no shard is all-skipped today;
one cmd shard has 1 of 9 tests skipped).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): ask Bazel for flaky test targets before the embedded tier
Re-review G4. The F3 grep wanted a literal `flaky = True`, so
`flaky = _RETRY` (or a macro default) slipped through (reviewer m3).
- bazel-embedded runs `bazel query 'attr(flaky, 1, tests(//...))'` after
setup-bazel and before the tier, and fails on any result (loading only;
about 0.2 s warm). Verified locally: with `_RETRY = True` /
`flaky = _RETRY` on embeddeddolt_embedded_test the query lists it.
- The policy grep now rejects any `flaky =` whose value is not a literal
False or 0, and TestBazelEmbeddedQueriesFlakyTargets pins the step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): cover the zero-testcase shard in check_shard_coverage
Re-review G5. Skipping the "listed but did not run" report when a shard's
test.xml has no top-level tests survived the fixture test (reviewer m7);
check_testcases.py catches that shard at run time, but the coverage
check should not depend on it. Two fixture cases: a shard with no
testcases, and one with only a subtest.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record the G1-G5 embedded-lane hardening in the topology doc
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(externaldeps): guard explicit claims and batch closes
Preserve external capability policy across lifecycle updates and batch close/claim-next operations, including direct, embedded, and proxied paths. Follow up on upstream PR #4753 and issue #4769.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Denis Redozubov
* test(externaldeps): include embedded regression in CI discovery
* test(serve): preserve external close policy when peeling hooks
Replace the raw batch-closer identity assertion with a behavioral policy check, retaining the no-hooks assertion. Document full-workspace claim filtering and batch lookup cost.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Denis Redozubov
* test(externaldeps): align the mixed-batch pin with #6648's partial-failure exit
Maintainer fixup applied while adopting PR #6738.
`exerciseExternalMutationPolicy`'s `mixed_batch_and_claim_next` subtest asserted
that a partially-refused `bd close` batch keeps the CLI's zero exit status. That
was true at this PR's original base, but #6740 (Beads #6648) landed on main in
the meantime and made a partial batch close exit 1 with an
`N of M issues failed to close` summary. The two changes are independently
correct and merge without a textual conflict, so the stale expectation only
surfaces as a red `cmd/bd` shard after the rebase.
The PR's substance is unchanged: the externally blocked issue is still refused
with its blocker named, the eligible item still closes, and `--claim-next` still
claims. Only the exit-status expectation moves onto the current contract, and
the summary line is now pinned so the interaction between the two features stays
covered.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(dolt): check version scope on the transaction owner
withWriteTx and withRetryTx delegate transaction creation to commitWriteTx after #6719. Point the existing completeness guard at that owner so it still checks BeginTx and the versioned-history scope together.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Denis Redozubov
* fix(ci): register external policy files and isolate server cleanup
Include all six new Go files in Bazel targets. Run the direct-server fixture before parallel proxied tests because its cleanup purges dropped databases across their shared server; observed initialization failures coincide with that cleanup.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Denis Redozubov
* fix(externaldeps): scope close-only batch policy and drop the claim --force hint
Review-loop fixup for PR #6738 (iteration 1). The review approved with no
blocker or major findings; this takes its three minors and its nit, all in
code this PR introduces. Each minor lands with a test that a mutation of the
covered code turns red.
[minor] A refused proxied claim suggested an override that cannot work. The
external claim guard ignores --force but shares ErrCloseBlocked with the close
policy, so on the proxied route `bd update <id> --claim` against an externally
blocked issue printed "(use --force to override)". proxiedUpdateFailure now
reports a refused claim as the generic update failure, as the direct route
always has. claim_is_atomic asserts the refusal never mentions --force;
restoring the unconditional hint fails it on the proxied lane.
[minor] A close-only batch demanded policy support for unrelated blockers.
Without ClaimNext the batch closer still passed the workspace's whole
externally blocked set to BatchCloserWithPolicy, so one external blocker
anywhere made a backend lacking PolicyBatchCloserSource (such as one
registered through internal/storage/backends) refuse to close unblocked
issues. The policy is now scoped to the batch items unless the batch claims
next work, which still needs every blocker for FilterClaim. CheckClose looks
up exact ids, so no refusal changes. The NewBatchClosePolicy doc now says when
the whole set is required. TestBatchCloserScopesPolicyWithoutClaim covers an
unrelated blocker, a blocked item, and a next claim against such a backend.
[minor] The policy's fallback target read had no pin.
TestExecuteCloseBatchWithPolicyDefersToTheTargetRead drives it through
sqlmock: a missing target keeps the backend's not-found, and a failing status
read reports that failure, never ErrCloseBlocked. Refusing the missing target
or swallowing the read error each fails it.
[nit] DoltStore and EmbeddedDoltStore BatchCloserWithPolicy return
ErrUnsupported on a nil receiver, as NewBatchCloser does.
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: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
* fix(doctor): gate --fix when schema is skewed (GH#4993)
`bd doctor` printed `bd doctor --fix` for cosmetic warnings without
checking whether the DB schema is ahead of (or behind) the running
binary. Following that tip can resume/write migrations on shared state —
exactly what burned a fleet change-freeze.
- AssessSchemaFixGate compares schema_migrations to LatestVersion
- Refuse apply/dry-run when the database is ahead of the binary
- Sanitize Fix recommendations so tips do not steer into unsafe --fix
- Surface a schema fix-gate footer on doctor output
Fixes#4993
* fix(doctor): assess the schema fix gate before anything can write (GH#4993)
The gate shipped downstream of the hazard it guards, which produced three
separate-looking defects with one cause:
- Fix advice was sanitized inside printDiagnostics, the else branch of the
emitter chain, and by value over a []doctorCheck. --json, --agent and
--output therefore published advice the gate had ruled unsafe.
- The --check= handlers return before any gate exists, so --check=pollution
--clean and --check=validate --fix wrote with no gate consulted.
- runDiagnostics auto-migrates near its top while the gate was assessed at
print time, so a bare `bd doctor` applied pending migrations and then
warned about them.
Assess once in the RunE preamble, before any branch that can write, and
thread that verdict through. Sanitize once into result.Checks by index so
every emitter inherits it. Gate the --check= paths at the single branch
point via checkFlagWrites.
Also splits the overloaded Safe flag into RecommendFix / AllowDBFix /
AllowFSFix, since callers were asking three different questions of it, and
adds Determined / DBReachable so an unreadable schema version fails closed
while a genuinely absent database still permits filesystem repair. Fixes
follow from that: the --fix dry-run no longer refuses (it writes nothing),
filesystem-only repairs are no longer blocked by a schema hazard that cannot
affect them, and the dead `&& !g.Safe` conjunct and a leaked internal symbol
in operator-facing output are gone.
Tests move from asserting the predicate to asserting the wiring: a property
over the whole emitter set, the --check= enumeration, and a fail-closed case.
Verified against the original range-by-value bug, which they detect.
Reported by maphew.
* fix(doctor): gate DB fixes solely on AllowDBFix, not Reason == "" (GH#4993)
AssessSchemaFixGate's unreachable branch (openDoltDB failure) returns
AllowDBFix:false and Reason:"" — both zero values. doctor_fix.go's
`gate.AllowDBFix || gate.Reason == ""` in applyFixes and
`!gate.AllowDBFix && gate.Reason != ""` in previewFixes both treated
that empty Reason as "safe to fix", admitting database repairs (and
not even flagging them as blocked in a dry run) whenever the Dolt
server is stopped or unreachable — exactly the case this gate exists
to withhold.
Gate on AllowDBFix alone in both places. Enumerated every FixGate
literal in fix_gate.go (unreachable, undetermined, ahead, pending,
default/equal) against the new condition: only the unreachable case
changes (admitted -> withheld, the fix); undetermined/ahead/pending
stay withheld and the equal/default case stays admitted, so no
legitimate case is newly blocked.
Adds doctor_fix_gate_wiring_test.go coverage driving applyFixes and
previewFixes with an unreachable-shaped gate fixture, asserting no
database fix is applied or shown as unblocked.
* fix(doctor): correct comment typo labelled->labeled
The misspell linter flags 'labelled' (British spelling) in a comment
in previewFixes, failing the Lint / PR Lint (wrapper timing) / CI
Gate checks on PR #5145.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(doctor): guard --agent commands, test the gate assessor, keep recovery fixes (GH#4993)
- --agent: enrichers hardcode `bd doctor --fix` in their Commands and never
read the sanitized dc.Fix. EnrichForAgent now takes the FixGate and
sanitizes the finished Commands. TestNoAgentEnricherLeaksUnguardedFixCommand
runs over every registered enricher (doctor.AgentEnricherNames) plus an
unenriched name, with a non-vacuity check under a safe gate.
- AssessSchemaFixGate now has tests against a real Dolt server with a seeded
schema_migrations (ahead, pending, equal, empty/absent/unreadable table)
and unreachable cases, each guard verified by mutation.
- An unopenable database no longer withholds the recovery fixers that repair
it: FixGate.AllowsFix is the single admission policy; Corrupt Manifest,
Database Integrity, Dolt Format and Dolt Schema stay available when the DB
is unreachable, schema-writing fixes stay withheld whenever the gate blocks.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): sync BUILD.bazel srcs/deps for the new doctor fix-gate files
The PR adds cmd/bd/doctor/fix_gate.go (which imports //schema), three
fix_gate*_test.go files in that package, and
cmd/bd/doctor_fix_gate_wiring_test.go. The rebase target added
cmd/bd/doctor/BUILD.bazel after this PR was opened, and it enumerates srcs
and deps exactly, so the merged tree left all five files unlisted and the
go_library missing //schema. Regenerated with `make bazel-sync`
(gazelle + tools/bazel/go_srcs.py + bazel mod tidy).
* fix(doctor): fail closed when the schema gate cannot open an existing database
Maintainer review fixes for the GH#4993 fix gate (adoption review of #5145).
The blocking defect: AssessSchemaFixGate conflated "there is no database" with
"I could not connect to one". Any openDoltDB error returned the no-hazard
unreachable shape, and the destructive `--check` refusal keyed on
gate.DBReachable, so in a server-mode repo whose server was merely stopped
`bd doctor --check=pollution --clean` skipped the refusal entirely, then the
handler's own factory open auto-started the server, applied the pending
migrations blind, and deleted rows. The identical command against the identical
schema was refused whenever the server happened to be running, so the guard was
conditional on incidental server liveness.
Split the two states. A failed connection is no longer evidence that there is
no database: when the configured database is still on disk the gate now reports
DBPresent with Determined=false, a Reason, and RecommendFix cleared, so the
refusal fires and printed advice stops steering at --fix for a schema version
it never read. The discriminator stats the path autoMigrateOnVersionBump
stats, os.Stat(cfg.DatabasePath(...)), and like it reads only ENOENT as absent,
so the gate and the auto-migrate agree about when a schema exists outside the
two deliberate departures described under the second review iteration below.
A repo with no database at all keeps the existing no-hazard shape.
DBPresent, not DBReachable, is now the hazard question, via
FixGate.BlocksDestructiveWrites(). Keeping DBReachable literal preserves the
recovery-fixer carve-out in AllowsFix unchanged: Corrupt Manifest and
Database Integrity stay available for a database that cannot be opened, which
is exactly the state they are the cure for, while a repair that opens the
migrating factory stays withheld.
Also from the review, all non-blocking:
- `--check=artifacts --clean` was refused under a blocked gate although the PR
itself classifies artifact cleanup filesystem-only, so the two planes
disagreed about one operation. The `--check` guard now routes through
FixGate.AllowsFix; pollution and validate have no filesystem-only
classification and stay refused.
- filesystemOnlyFixes omitted "Hooks Path" (a git-config unset) and
"Circuit Breaker" (stale marker files), so a blocked gate withheld them and
printed them as database fixes. Added both, plus "Database Config" (rewrites
metadata.json only and refuses Dolt outright). Audited the rest of
applyFixList's 42 dispatch names and recorded why the others stay guarded --
"Repo Fingerprint" writes through the store, so it is correctly withheld.
- applyFixes dropped a gate-withheld filesystem-only fix from both the fixable
and withheld lists, reporting nothing at all. Removed the qualifier and
relabelled the line "gated fix(es)", since the withheld set is whatever the
gate blocked.
- Corrected the gate's own ordering contract comment, which claimed assessment
happens "before anything that can write". The load-bearing guarantee is one
memoised verdict per invocation before any *gated* write, with the bd-jgxi
auto-migrate deliberately outside the gate's jurisdiction.
Tests: the fail-closed shape and its recovery/hazard admissions, the hazard
predicate across all six gate shapes, the `--check` refusal routing (including
that a read-only --check never probes the database), and the gate accessor's
laziness and memoisation. The review also asked for an assertion that the gate
is evaluated before autoMigrateOnVersionBump; that is declined deliberately,
because it would pin a contract the same review established is false -- the
auto-migrate precedes the gate by design. The lazy/memoised pins cover the part
of the contract that is real.
Validation: 29 focused fix-gate tests pass, and each of the four behavioural
changes was confirmed non-vacuous by mutating it and observing only its own
test fail. Full cmd/bd/doctor package is 387 pass / 7 fail, all 7 identical to
the same tests at the rebase base (ambient-env reds needing BEADS_TEST_SERVER
or a configured beads role). BUILD.bazel regenerated with gazelle; the new
cmd/bd test file runs under `bazel test //cmd/bd:bd_test`.
Second review iteration (one minor, non-gating): databaseExistsOnDisk's doc
called it the same probe autoMigrateOnVersionBump uses, but the two differed in
three arms. Each is now either aligned or a documented, pinned departure:
- Any stat error read as absent, where auto-migrate reads only ENOENT so. Now
only ENOENT reads as absent: a data directory that cannot be stat'ed for
another reason (ENOTDIR, EACCES) is unknown, and the gate fails closed.
- No metadata.json reads as absent, where auto-migrate falls back to
DefaultConfig. Kept deliberately and documented: the gate cannot connect
without metadata.json, so a fail-closed verdict could never be cleared by
starting a server, and SanitizeFixRecommendation would rewrite doctor's own
advice for this state (`bd doctor --fix` regenerating metadata.json, a
filesystem-only repair) into "Do NOT run 'bd doctor --fix'". The cost is one
unguarded state, left as follow-up: server mode selected by the environment
or config.yaml while metadata.json is missing, where a gated repair still
reaches the server's schema unmeasured.
- A proxied-server workspace was documented as reading absent because it
"keeps no local database", but it reads present whenever its data directory
is on disk, and the proxied root defaults to that same directory. Kept
fail-closed and corrected the doc. `bd doctor` is refused up front in
proxied-server mode (proxy.doctor.unsupported), so this arm only matters once
doctor gains a proxied route.
Also corrected the DBPresent field doc, which said only a repo with no database
at all is DBPresent:false.
Tests: the fail-closed test is now table-driven over a stopped server, a
proxied-server workspace, and a data directory whose stat fails with ENOTDIR
(skipped on Windows, where that error surfaces as path-not-found, which
os.IsNotExist matches). A new test pins the missing-metadata.json departure:
the no-hazard shape, RecommendFix kept, and Metadata Config admitted. Each arm
was confirmed non-vacuous by mutating it (a DefaultConfig fallback, an
any-error stat predicate, a proxied-mode early return) and observing only its
own test fail.
Not covered, and unchanged from main: an embedded-mode workspace keeps its
store under .beads/embeddeddolt, which this probe does not stat, so
`bd doctor --check=pollution --clean` there still gets the no-database verdict.
Validation (second iteration): git diff --check is clean; the 11 focused
doctor gate tests and the 13 cmd/bd gate-wiring tests pass.
databaseExistsOnDisk's only caller is AssessSchemaFixGate, whose only
production caller is doctor's newSchemaGate, so those suites cover every path
the predicate change reaches.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
#6153 taught the doctor version helpers to accept a leading "v"
(GH#6152). recoverPreV56IfNeeded reused IsValidSemver as the gate that
kept the v-prefixed Go pseudo-versions from #5650 off the path that
deletes .dolt, so that protection went with it: a major-0 pseudo-version
such as v0.0.0-<ts>-<hash> or v0.55.5-0.<ts>-<hash> now passes the
validity check and compares below 0.56.0. The .bd-dolt-ok marker only
stops the rebuild for databases bd 0.58.0 or later has served; 0.56.x
and 0.57.x never wrote it.
Refuse pseudo-versions explicitly with golang.org/x/mod/module, after
normalizing the stamp the way the doctor helpers read it, so the
spelling of a stamp never decides whether its database is deleted. A
pseudo-version's numbers bound the build from below only, so they can
never show that a workspace predates 0.56. This also refuses a bare
pseudo-version (0.0.0-<ts>-<hash>), which the digit scan has always
accepted. A v-prefixed release such as v0.55.4 still recovers.
Post-merge review follow-up for #6153.
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cli): --until rejection names the supported unit set
bd defer --until "+3mo" failed with: invalid --until format "+3mo".
Examples: +1h, tomorrow, next monday, 2025-01-15
The compact-duration parser accepts h, d, w, m and y, so "+3w" and "+3m"
both work. The message jumped from a single hours example straight to
absolute dates and never stated the unit set, so a caller who wanted three
months had to find "+3m" by trying units one at a time.
Months were already supported, spelled "+3m" (internal/timeparsing
applyDuration case "m" is AddDate(0, amount, 0)). This is a message change
only, parsing behavior is untouched.
The regression test pins the message to the parser it describes: every unit
the hint names must parse, and the real failure path must put the unit set
on stderr rather than only the constant being well formed.
* fix(cli): share the --until unit hint with --defer and --due
bd defer --until was not the only door onto ParseRelativeTime. bd create
--defer, bd update --defer and both --due flags still printed "Examples:
+1h, tomorrow, next monday, 2025-01-15", which names one example per
category and leaves a caller who typed +3mo guessing which units exist.
Reuse deferUntilFormatHint at the eight remaining sites, covering the
direct create and update paths and their proxied-input twins. Message
only, the parser is untouched.
A source guard pins the uniformity, because a site that re-inlines its own
example list still passes every call-level test. The proxied-input paths
also get a behavioural test that the unit set reaches the caller.
* fix(cli): name min=minutes in the shared relative-time hint
Adoption review iteration 1 found the shared hint under-reports the parser
by exactly one unit. internal/timeparsing accepts `min|[hdwmy]`
(parser.go:22) and its doc comment spells out `m = months (NOT minutes;
use "min" for minutes)`, but deferUntilFormatHint named only h/d/w/m/y --
so all nine rejection messages told a caller that minutes are unsupported,
defeating the premise the PR is built on. Measured at this head: +30min,
-15min and 90min parse; +3mo and +30mins do not.
The gap is rebase-introduced, not contributor error: min arrived on main in
eb1689cb9d (GH#6609/#6629) after the contributor's merge base. Nothing
could red on it, because the PR's own guard test hardcoded the same
five-unit list in three places, so the constant and its enforcement drifted
together.
Add min=minutes to the constant and to all three lists, and show +30min
beside +3m so the m-vs-min boundary the message exists to explain is
visible in the message itself. Reverting min out of the constant alone reds
TestDeferUntilFormatHintCoversCompactUnits,
TestDeferUntilRejectionNamesUnitSet and all five
TestGatherInputRejectionsNameUnitSet subtests, while
TestRelativeTimeRejectionsShareTheHint stays green -- it pins that sites
reference the constant, not what the constant says.
Two non-gating items from the same review, taken because they are adjacent:
- The four update sites use HandleErrorRespectJSON, whose --json branch
writes to stdout inside a JSON error payload instead of to stderr. The
existing subtests pin jsonOutput = false, so that branch carried the
~190-char hint untested. A new subtest flips jsonOutput and asserts the
unit set in the decoded payload; decoding is required because
json.Encoder HTML-escapes the angle brackets in "[+-]?<n><unit>". Making
HandleErrorRespectJSON ignore jsonOutput reds only the new subtest and
leaves the four stderr subtests green, which is what proves it is not a
duplicate of them.
- Four pins strings in tests/oracle-a/harness/scenarios/enumerated.json
quoted the message text this PR replaces. pins is documentation the
runner ignores (harness/PROVENANCE.md:13), so nothing was broken, only
stale; refreshed in place. Their stale update.go line references are left
byte-intact deliberately -- those line numbers are identical at the merge
base and at HEAD, so that staleness is base-owned, not this PR's.
Also records two edges the review raised on the PR's own mechanism: the
sign is optional, so the notation is now [+-]?<n><unit> (measured), and the
uniformity guard matches per line, which is now stated in its comment
rather than left for the next reader to rediscover.
Deliberately left out: the flag --help usage strings (create.go:955,
defer.go:156, update.go:1002) still carry the old bare example lists. They
feed the generated-and-pinned CLI reference, so aligning them owes the
docs-regen check and belongs in a follow-up. deferUntilFormatHint has no
help-string consumer today (censused: nine rejection sites and nothing
else), so this commit owes no CLI-docs regen.
Also carries the rebase gate's bazel repair, unchanged from this commit's
previous revision:
chore(bazel): enumerate defer_until_hint_test.go in cmd/bd go_test
gazelle output for the PR's new untagged test file. cmd/bd/BUILD.bazel
enumerates go_test srcs explicitly (667 files at the merge base) and the
enumeration is exhaustive for untagged tests -- the only 4 unenumerated
_test.go files on disk all carry build tags. Without this row the target
builds green while running none of the PR's 4 new tests (-test.list: 0 of
4 unrepaired, 4 of 4 repaired), and bazel.yml's BUILD-sync step reds on
the post-'make bazel-sync' git diff.
The //internal/timeparsing deps row is gazelle canonicalization, not a
compile fix: bd_test embeds bd_lib, whose deps already carry it.
The new subtest adds no BUILD row: encoding/json is stdlib, and a
re-run of make bazel-sync after these edits leaves the tree clean.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(show): disclose dependency edges the listing cannot represent (be-lpi)
`bd show --json` emitted a self-contradicting payload on any issue with a
cross-repo or `external:` dependency:
{"id":"hq-cv-ftcra","dependency_count":1,"dependencies":null}
and `bd show` in text mode rendered no dependency section at all, so
`bd dep add x liveop-y` reported success and the `bd show x` a caller ran
straight after was indistinguishable from the edge never having been written.
THE COUNT IS CORRECT. THE ENUMERATION IS THE DEFECT.
`GetDependenciesWithMetadataInTx` reads the edge rows, resolves each far end,
then does a bare `continue` past any id with no local row. An `external:` or
cross-repo target HAS no local row by construction: `IsExternalDepTarget`
routes exactly the ids this database cannot hold into `depends_on_external`,
the one target column with no foreign key into issues. The count queries have
no such join. So the count keeps the edge and every listing drops it, and the
difference is precisely the set of edges that are real, stored, and
unrenderable from here.
Reported as a phantom count on convoy beads. It is neither phantom nor
convoy-specific: `hq-cv-ftcra` carries a real `tracks` edge to
`external:liveop:liveop-kmf`, and convoys are simply the only producer of
external targets in that store (77 external edges, all `tracks`). The
`bd list --json` zero the report also cites is correct by design and unrelated
— that count is blocks-only per `SearchCountsSQL`, and the edge is `tracks`.
Publish the difference instead of leaving the caller to infer it, following
the `comments_omitted` precedent (ga-clgh):
- `IssueDetails` gains `unresolvable_dependencies` / `unresolvable_dependents`
- `BuildIssueDetails` sets them, so every frontend — CLI `--json` and the
HTTP detail view — gets it at once
- text mode says the same thing on stderr, never stdout, so the rendered
issue is byte-identical for the common fully-local case; that is the
choice `warnDroppedDepEdges` already made in dep.go for this same gap
- the notice helper is shared with the watch-mode render so the two cannot
drift apart in what they disclose
Set ONLY when the row list was actually read and came back short: the
dependency read's error is now kept rather than discarded, because a FAILED
read and a SHORT read both leave the slice empty and must not collapse into
one signal. `unresolvable_dependents` only under `IncludeDependents`, where
the rows exist — without them the slice is nil by design and a delta would
report every dependent an issue has as unresolvable.
Deliberately NOT done: making the count match the listing. The count is right
and the edge is real, so zeroing it would delete the only signal these edges
exist. Nor does `GetDependenciesWithMetadata` synthesise placeholder issues
for external targets — it has 14 non-test call sites including the Linear,
GitLab, Jira and ADO sync paths, which would then map a fabricated issue onto
a remote tracker.
`bd dep list` needed no change: bd-mtla already warns there and points at
`bd dep list <id> <id>`, which prints the raw edge record. The installed
v1.2.2 predates that fix, which is why the bead's measurements saw a bare `[]`.
Tests. `internal/workapi/detail_unresolvable_test.go` pins the arithmetic
against a source whose counts and rows are set independently, with negative
controls for a fully local store, a failed row read, a failed count read, and
count-only mode. `cmd/bd/show_unresolvable_deps_embedded_test.go` drives the
production path — init, create, `dep add`, `show` — for both target shapes
plus a fully local control, and asserts the notice reaches stderr and not
stdout. Verified the scratch fixture's stored columns are identical to the
production row rather than merely similar. Sabotage control run on both tiers:
removing the guard turns each red, and the negative controls stay green.
`docs/reference/json-schema.md` is intentionally untouched — it is
hand-written and documents the pinned release (`docs/cli-docs.pin` is v1.2.2),
not main. Follow-up filed as be-soj.
Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of Marc Cressall
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017B2Z4eQi2a9Cgfumj2RRnR
Executed-By: beadsrig/polecats/toast
* fix(show): do not read a failed dependency listing as unresolvable edges (be-lpi)
Codex review of the previous commit, and it is right.
`bd show` renders dependencies best effort and discarded the listing error:
depsWithMeta, _ := issueStore.GetDependenciesWithMetadata(ctx, issue.ID)
so when that read FAILED while the count query succeeded, the new notice
reported every counted edge as cross-repo/external. A transient backend error
was rendered as a claim about the data, which is the more expensive of the two
mistakes — the user goes looking for edges that are simply unread.
This is the distinction `BuildIssueDetails` already draws with `depsErr` on
the JSON side, and it is the reason that error is kept there. The text path
did not draw it at all, so the two planes disagreed under failure: `--json`
stayed silent and the human render accused the data.
Carry each direction's rows and error together in a `depListing` and require
BOTH reads to have succeeded before reporting a difference. Rendering stays
best effort; only the diagnosis is gated. A failure in one direction no longer
suppresses the other, which is a case the single-error shape could not express.
`cmd/bd/show_unresolvable_deps_unit_test.go` pins it: 10 cases including the
two the review found, a fully local negative control, a failed count read, and
one direction failing while the other stays reportable. Sabotage control —
relaxing the guard back to `countErr != nil` alone fails exactly the two
listing-read-failed cases and nothing else.
Reuses the existing race-safe `captureStderr` from test_helpers_pure_test.go
rather than a second copy.
Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of Marc Cressall
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017B2Z4eQi2a9Cgfumj2RRnR
Executed-By: beadsrig/polecats/toast
* fix(show): read the dependency counts before the row listings (be-lpi)
Second codex finding on this change, and it is real on the path `bd show`
actually uses.
The unresolvable-edge difference is computed from two reads. Where the source
is not snapshot-consistent, a write landing between them skews it — and with
the listing read first the skew was the expensive direction: a freshly added,
perfectly ordinary local edge came back as `unresolvable_dependencies: 1` and
as a stderr notice accusing the data.
Only the store-backed source is exposed. `uow.issueReader.Get` wraps the whole
build in `RunTxRead`, so the UOW path shares one snapshot; `storereader` — what
`EmbeddedDoltStore.IssueReader` returns, and therefore what `bd show` runs on —
issues a connection per call.
Read the counts FIRST. An edge added in the window then leaves the count
stale-LOW, the difference goes negative, and nothing is reported. The text path
gets the same order structurally: the helper is split into `readDepCounts`,
called before the listings, and `warnUnresolvableDepEdges`, called after, so
the ordering is visible at both call sites rather than buried.
THIS IS AN ORDERING MITIGATION, NOT A FIX, and the code says so. A concurrent
DELETE still leaves the count stale-HIGH and produces a spurious notice. Closing
that needs a shared snapshot across the two reads, or a store method that counts
edges whose target has no row directly — either is a new seam across both
backends and the domain path, out of proportion to an advisory field. Filed
separately. Deletion of a dependency edge is also far rarer than addition, which
is why this ordering is strictly better rather than merely different.
The first version of the JSON-side test DID NOT PIN THE ORDER. It used a source
returning fixed values, so reversing the two reads still passed — a test
pinning arithmetic while claiming to pin an order, and the sabotage run is what
caught it. Replaced with `mutatingSource`, where whichever read runs first sees
one edge and the second sees two; swapping the reads in `BuildIssueDetails` now
fails with exactly the false report the review described. The text-side case is
relabelled to say it covers the subtraction only, since the call-site order is
not in its scope.
Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of Marc Cressall
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017B2Z4eQi2a9Cgfumj2RRnR
Executed-By: beadsrig/polecats/toast
* fix(show): disclose unrenderable dep edges in proxied render (be-lpi)
`bd show` has three text renders and be-lpi closed two of them.
usesProxiedServer() returns at show.go:45 before any of the fixed code,
and runShowProxiedDefault binds the shared issueops.Reader -- hence
BuildIssueDetails, hence unresolvable_dependencies -- only when
`jsonOutput && !in.shortMode`, so plain text falls through to
proxiedRenderIssue, which rendered both dependency sections from
proxiedListDeps with discarded errors and said nothing. On a
server-backed repo the change`s own symptom survived: a cross-repo or
`external:` dependency still rendered as no dependency at all.
Call warnUnresolvableDepEdges from that route too, counts before the
listings, taking the counts through workapi.NewUOWDetailSource. The
domain use cases behind a proxied UOW are per-table, so proxiedDepCounter
carries the isWisp flag the DetailSource counts take. That flag is
arithmetically inert on this path, and the earlier claim here that the
store seam "resolves" it was the wrong mechanism: the repository read
seam discards it outright -- CountByID forwards only Direction and Types
to CountDependencyEdgesInTx, and ListWithIssueMetadata forwards only the
source id to Get{Dependencies,Dependents}WithMetadataInTx
(dependency.go:888-917) -- so both sides span `dependencies` and
`wisp_dependencies` alike and only the mutating paths pick a table.
The conclusion is unchanged and is what the notice depends on: the
arithmetic is the same on both routes, because
CountDependencyEdgesInTx counts `dependencies` plus `wisp_dependencies`
with no join to `issues`, and proxiedListDeps runs the very
GetDependenciesWithMetadataInTx the direct route runs, so the difference
means here what it means there. --refs and --children stay out of scope:
an alternate query with no count beside it to contradict. The precedent
this design cites, warnDroppedDepEdges, covers both of its own routes
(dep.go:1148, dep_proxied_server.go:457), which is the in-repo standard
applied here.
Pinned by TestProxiedServerShow2/show_discloses_unresolvable_dep_edges
with a fully-local negative control. Measured, not assumed: deleting the
new call reds the first and leaves the control green.
Also from the same review, all non-gating:
- The recovery pointer is outbound-only now. `bd dep list <id> <id>`
reaches raw edge records through the duplicate-id form, which
dep.go:1101 selects on `batchMode && direction == "down"`, and
dep.go:1144 says in the repo`s own words that "up" has the same gap
with no inbound EdgeReader role to close it. An issue short only on
dependent edges was handed a command that cannot show them, and now
gets a line saying so instead.
- The ordering comment no longer advertises a guarantee nothing holds.
Splitting readDepCounts from warnUnresolvableDepEdges makes the
counts-first order readable at the call sites; it does not pin it.
Measured: reversing it at all three sites leaves this package green,
including the embedded production-path test, because the unit test
drives warnUnresolvableDepEdges directly and no CLI test can land a
write inside the window. The only automated pin is one tier down, on
TestBuildIssueDetails_ConcurrentAddIsNotReportedAsUnresolvable. A CLI
test that could fail on the order would have to own that window, which
is out of proportion for an advisory notice, so the comment now states
its scope rather than overstating it.
- The plane asymmetry is documented rather than changed: text mode reads
dependents unconditionally and always discloses the inbound direction,
while unresolvable_dependents needs include_dependents (--json only).
The per-field restriction is the correct half -- without the rows a
delta would call every dependent unresolvable -- so the godoc and the
spec description record the disagreement.
One correction to be-lpi`s own commit message, which cannot be amended
from here: enumerating the edges via issueStore.EdgeReader() is not "a
new seam across both backends and the domain path" on the CLI path.
EdgeReader() sits on the variable that path already holds
(storage.go:235, used at show.go:177). The concurrent-DELETE residual
still stands on the two-reads argument alone, which remains true of
ReadEdges plus a set difference.
Review iteration 2 adds the BUILD-file sync the required Bazel lane
needs, plus one comment correction:
- cmd/bd/BUILD.bazel and internal/workapi/BUILD.bazel now list the three
test files this change adds. The relevant failure is not a broken
build: bazel.yml`s "BUILD files in sync" step (:382-406) runs
`make bazel-sync` and exits 1 on a non-empty `git status --porcelain`,
and that step`s job is BAZEL_TEST, one of seven Bazel rows in
pr.yml`s CI_GATE_REQUIRED (:1496-1524, mapped at :1551), so the drift
reds a required lane rather than merely leaving the files invisible to
Bazel. The repo`s own fixture agrees: scripts/ci_workflow_test.go`s
bazelLaneGateIDs holds bazel-test, and bazelAdvisoryLanes retains only
bazel-integration.
The rows are gazelle output rather than hand-written. `make bazel-sync`
on this head proposes five; init_git_bootstrap_routing_test.go and
init_role_environment_test.go are base staleness that origin/main
already lists, and a run on the merge target proposes them not at all,
so only the three this change owns are committed.
Certificate, run on the merge target rather than argued: merge
origin/main into this head, resolve, `make bazel-sync`, then
`git status --porcelain --untracked-files=all` is empty -- which is
exactly the gate step`s own test, and it also confirms the resolution
is byte-identical to what gazelle emits. `bazel build //cmd/bd:bd_test
//internal/workapi:workapi_test` on that tree completes successfully,
so the widened srcs lists compile.
These rows do introduce a merge conflict this change did not have
before: origin/main added show_watch_loop_test.go into the same slot of
the same sorted srcs list in cmd/bd/BUILD.bazel. It is an add/add with
an empty base -- neither side edits shared text -- and the resolution
is the sorted union of all three rows, which is what gazelle emits and
what the certificate above was run against.
- The ordering comment`s measurement clause named show.go and
show_display.go while the claim was true of three call sites, the
third being the show_proxied_server.go site this fixup added. It now
names all three, re-measured at this head: reversing readDepCounts
below its listings at every site leaves the selector green -- 35
subtests across TestWarnUnresolvableDepEdges,
TestEmbeddedShowUnresolvableDeps and TestProxiedServerShow2.
Maintainer fixup for PR #6352, review iterations 1-2.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(ci): red — pin TESTCONTAINERS_RYUK_DISABLED on Dolt testcontainer steps (refs be-2on)
* feat: green — pin TESTCONTAINERS_RYUK_DISABLED on Dolt testcontainer steps (refs be-2on)
Sets TESTCONTAINERS_RYUK_DISABLED=true on the 5 CI step-instances that start
a Dolt testcontainer from a package TestMain: pr.yml and main.yml's
test-domain-uow job ("Test domain + uow + tracker" and "Test doctor/fix"
steps), plus main.yml's test job "Test (with coverage + JUnit XML)" step,
whose unfiltered ./... sweep runs internal/storage/dolt, internal/molecules,
internal/tracker, and cmd/bd as concurrent Dolt-container-starting binaries.
testcontainers-go shares one Ryuk reaper per host; when a step runs multiple
such packages as concurrent test binaries, they race to attach to that
shared reaper, and a failed handshake from one process reaps a sibling's
live container mid-suite. GitHub Actions runners are destroyed after the
job, so the reaper buys nothing there and only costs this race.
* docs(release-gates): record be-9b8 deploy gate PASS
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-9b8-dolt-ryuk-reaper-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(ci): drop the inert main.yml test-job Ryuk pin; narrow the guard's universal
Maintainer review fixup for PR #5770 (adopt-pr review iterations 1 and 2).
Iteration 1, Finding 1 (major, correctness) — the main.yml `test` job's
`./...` sweep cannot start a Dolt testcontainer, so the pin there was inert
and its justification comment was false. `checkDolt` (internal/testutil/
testdoltserver.go) reaches `doltReady` only via `isDoltImageCached`
(`docker image inspect`, no auto-pull), and the image's only CI source is
scripts/ci/pull-dolt-image.sh, which in main.yml runs in `test-domain-uow`
and `test-proxied-cmd` — not in `test` (no services: block either). The
base already documents this in pr.yml's contract-corpus header ("every
broad ./... job skips them for want of a Dolt store"). Took the synthesis's
option (a): removed the env pin + its 7-line comment and dropped the fifth
guard row, rather than keeping a dead pin. This also moots the Finding 3
nit, whose four-package list was a sample presented as a census.
Iteration 1, Finding 2 part 1 (major, maintainability) — the guard's doc
comment claimed it pins "every CI step that starts a real Dolt
testcontainer" while the implementation is an allow-list of literal
triples. Narrowed the claim to the enumerated steps, stated the scope as
the `test-domain-uow` job (noting the single-package doctor/fix step is
pinned for in-job consistency, not because it has an in-step sibling), and
recorded the container-capable jobs left unpinned: pr.yml/contract-corpus,
main.yml/test-proxied-cmd, pr-risk.yml/test-proxied-cmd,
pr-risk.yml/test-server-storage(-full), regression.yml/regression, and
bazel.yml's --config=docker lane — the last needing --test_env since bazel
does not forward ambient environment. Part 2 (class detection) is left as
follow-up.
Iteration 2 (two minors, both taken):
- The doctor/fix step's comment in main.yml and pr.yml read "Same
shared-Ryuk-reaper race as the step above", contradicting the guard's
own scope note: that step runs a single package, so no sibling test
binary races it for the reaper. Both copies now say the pin is kept for
consistency with the step above.
- The guard's census named bazel.yml/bazel-docker, a job current main
replaced (#6898) with bazel-doltserver, which defaults to
--config=doltserver and pre-pulls the Dolt image only on a
dolt-lane=docker dispatch. The census now names the lane by its
--config=docker selector, which is accurate on this base (the
bazel-docker job) and on current main (the dispatch-only A/B control),
and the --test_env remark is scoped to that docker lane.
Validation: git diff --check clean; ./scripts/ package green;
TestDoltTestcontainerStepsDisableRyuk runs 4 subtests, matching the 4 pins
exactly (main.yml x2, pr.yml x2); flipping main.yml's doctor/fix pin to
"false" reds only that subtest with a step-specific message, and the file
restores byte-identical. `git merge-tree --write-tree origin/main HEAD` is
clean and ./scripts/ is green on the merged tree.
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>
* fix(ci): require direct workflow build tags
Parse workflow run scalars structurally and require recognizable direct Go commands to declare the literal gms_pure_go tag. Keep shell and Make checks lightweight and preserve their existing conventions.
Fixes#5527
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(ci): recognize double-dash Go build tag flags
Address PR #5679 review 5191180453. Preserve last-tag precedence and test argument boundaries, including --args.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(ci): bazel-sync the new checker, restore its opt-out and the Bazel census
Maintainer review fixes for PR #5679, adoption iterations 1 and 2. Iteration
1's synthesis is `request_changes` on one major plus three minors; all four
are addressed. Iteration 2 approves with one minor, also addressed.
Major (Release Safety): the PR adds two production Go packages with no
BUILD.bazel, so `bazel build //...` could not see them and the repo's own
"BUILD files in sync" step fails on the resulting gazelle drift. Added the two
generated files via `make bazel-sync`; yaml.v3 is already a direct go.mod
requirement, so no module change is owed.
Minor (Release Safety): the new checker runs in the required pr-policy lane with
no way out, while the shell checker it partly replaces honors
`# build-tags: allow-bare` in a file's first five lines (check-build-tags.sh, and
engdocs/ICU-POLICY.md documents that window). CheckDir now honors the same
marker in the same window -- one convention, not two -- pinned by a table that
includes the fifth line and the sixth, so the two checkers cannot drift apart on
where the window ends.
Minor (Change Impact): dropping the workflow glob from `candidates` moved
workflows to the Go checker but also, silently, out of the `bazel_users` census --
and the Go checker does no Bazel handling at all, so .bazelrc could have lost its
tag with this gate still green. Workflows now feed the census through their own
`git ls-files` list and a separate loop, deliberately not rejoining the `go`-verb
scan. This is not hypothetical: `.github/workflows/bazel.yml` matches the Bazel
invocation regex, so it is exactly the file the census was losing.
Minor (Test Evidence): `Line` is the operator-facing half of a violation -- it is
what the error message points at -- and nothing asserted it, so reporting every
violation at line 1 would have been invisible. Added a `wantLine` column, asserted
on the multi-line "source is not workflow authority" case (line 2), and asserted
`Path`/`Job` where CheckDir fills them in.
One deviation, recorded: the finding also asked for `Line` on the existing
"continuation" case. That case is tagged, so it reports no violation and has no
Line to assert. Added a continuing-but-violating case instead, which makes the
same attribution observable -- a logical line spanning three physical ones is
reported at the first.
Not included: `make bazel-sync` also wants `//internal/debug` in
internal/utils/BUILD.bazel. That is base drift, not PR content -- absent at this
branch's rebase base but already present on origin/main, 24 commits ahead -- so it
heals on the next base refresh, and carrying it would duplicate main's own fix on
a file this PR never touches.
Minor (Test Evidence, iteration 2): the census half of the Change Impact fix
was right in code but pinned by nothing -- turning the workflow `bazel_users`
append into a no-op, or feeding the census-only list into the `go`-verb loop,
left every check_build_tags_test.go case green. Two cases on the existing
fixture harness now pin both directions: a workflow that runs `bazel build`
with an untagged .bazelrc fails and is named as the Bazel user, and a workflow
`run: go test ./...` passes here because scripts/checkworkflowtags owns it.
Each fails under its mutant, as does one more apiece (re-adding the workflow
glob to `candidates`; dropping `*.yml` from the census list), while the three
existing cases stay green under all four.
Validation: ./scripts/workflowtags passes (all four CheckDir tests and the full
CheckRun table), `go vet ./scripts/...` clean, `bash -n` clean, and both checkers
run green against the repository itself -- check-build-tags.sh reports 90 files
scanned all clear, and checkworkflowtags reports all direct commands clear.
For iteration 2, `go test ./scripts/` passes, and on a merge with current main
`bazel test //scripts:scripts_test` passes too; on this branch's own base that
target cannot build, because of the internal/utils drift noted above.
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>
* test(ci): pin main.yml's bd-cmd-test build to the literal gms_pure_go tag
#6940 pinned main.yml build-artifacts' non-race bd-cmd-test build as
`go test -tags "$BEADS_BUILD_TAGS" -c -o artifacts/bd-cmd-test ./cmd/bd`.
This PR requires a literal gms_pure_go tag on direct workflow Go commands
and rewrites that line to `go test -tags gms_pure_go -c ...`, so on
current main TestBazelDoltServerTiersMirrorPRRisk fails in both
`go test ./scripts` and //scripts:scripts_test. Restoring the pinned
spelling is not an option: checkworkflowtags rejects it ("direct `go test`
must declare literal gms_pure_go in -tags").
Update the pin to the literal spelling. It still pins what #6940 cares
about, a non-race bd-cmd-test built from ./cmd/bd: adding -race to that
line still fails the test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
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.5 <noreply@anthropic.com>
* feat(github): sync epic/child and blocks relationships to GitHub
bd github sync only ever pushed issue content (title/body/labels/state);
Epic-child links and beads "blocks" dependencies never reached GitHub's
relationships panel. Adds a GitHub relationship-sync pass, mirroring the
existing GitLab dependency-link push, using GitHub's sub-issues and issue
dependencies REST APIs:
- internal/github/client.go: AddSubIssue/ListSubIssues and
AddBlockedBy/ListBlockedBy against GitHub's sub_issues and
dependencies/blocked_by endpoints.
- internal/github/links.go: DependencyLink + LinkResolver, converting beads
epic/child parent-child dependencies into GitHub sub-issues and beads
"blocks" dependencies into GitHub blocked_by relationships. Idempotent
(lists current relationships before creating) and additive (stale remote
relationships are left untouched).
- cmd/bd/github.go, cmd/bd/sync_push_pull.go: wires the push pass into both
`bd github sync` and `bd github push`.
Verified against a live GitHub repo (create, list, and idempotent re-push
all confirmed via the real API), in addition to httptest-mocked unit tests.
Fixes gastownhall/beads#5970
* fix(github): update last_sync after relationship push to prevent sync churn
When AddSubIssue or AddBlockedBy is called, GitHub updates the issue's
updated_at timestamp as a side effect. Without updating last_sync after
the relationship push completes, the next sync would see those issues as
'changed' and pull/push them again, causing unnecessary churn.
This fix updates last_sync to the current time after a successful
relationship push (only if links were created), accounting for any
timestamp changes GitHub made during relationship creation.
Fixes continuous sync churn observed when running bd github sync
multiple times with no local changes.
* fix(github): use relationship reader for link sync
* fix(bazel): enumerate links.go and its tests in internal/github BUILD.bazel
The base advance added internal/github/BUILD.bazel with explicitly
enumerated srcs (gazelle-generated). This PR adds links.go,
links_test.go and review_fixes_test.go, which the base-generated
enumeration cannot know about, so //internal/github:github failed to
build:
internal/github/tracker.go:41:35: undefined: LinkResolver
internal/github/tracker.go:244:30: undefined: RefScope
Regenerated with `bazel run //:gazelle` (not hand-edited). Purely
additive; no deps change is needed because links.go only imports
//internal/types, already declared.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(github): scope the relationship pass to --parent and report skipped links
Maintainer review fixup for PR #5971, adopt-pr review iterations 1 and 3.
filterGitHubLinkScopedIssues reimplemented four of the SyncOptions
selectors and dropped ParentID, so `bd github sync --push --parent X`
narrowed the content push to the subtree and then created GitHub
sub-issue and blocked-by links for every GitHub-linked issue in the
workspace -- outward API writes on issues the user had excluded. It now
resolves the subtree and requires membership in it. The traversal moves
from gitlab.go to sync_flags.go as buildSyncDescendantSet, beside the
--parent flag that populates the field, and the GitLab and GitHub link
passes share the one copy. The doc comments that claimed parity with the
engine's push loop now enumerate the selectors this path actually
applies, and name the three it does not (State, ExcludeIDPrefix,
ExcludeIDPatterns -- no GitHub command sets them today).
PushLinkResult.UnsupportedSkipped had no reader anywhere in the repo, so
a host without the sub-issue/dependency APIs reported nothing at all.
pushGitHubDependencyLinks now emits one curated line for it, and a 404
on the source issue is classified apart from a 404 on the relationship
endpoint: collapsing the two reported a deleted, renumbered or
permission-hidden issue as an unsupported host. The classifying probe is
memoized per issue number, so a source carrying both link types costs
one extra read.
`bd github push --dry-run` printed "Synced N relationship links" for
links it had only planned, because PushLinks counts planned links in
Created. The `bd github sync` twin already gated that line on its
dry-run flag; the push side now does too.
Tests: a table test over filterGitHubLinkScopedIssues with a row per
selector -- its three ParentID rows fail without the scope fix -- plus a
direct pin that a blocks-edge dependent is not a descendant, and
httptest cases driving 404 through the list call, the create call and
the source-issue probe.
Not fixed here: the PR body still describes a `lastSync` advance that
commit ee6d65692 removed from this PR. That is a PR-surface edit, not a
code change, and is left to the finalize step.
Also not fixed here, and named in buildSyncDescendantSet's doc comment
so the shared helper does not read as covering every tracker: the ADO
link pass has the same scope hole this commit closes for GitHub.
pushADOLinks takes no sync options, so `bd ado sync --push --parent X`
still writes ADO relations for the whole workspace. That predates this
PR, and ADO is outside its diff.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* feat(search): re-cut SearchIssueSummaries atop Lite as searchProjection[T]
Re-cuts release/be-nu4.3-stack onto current main, resolved against the
merged Lite foundation (#3906) instead of the stale pre-Lite conflict set.
SearchIssueSummaries moves from a standalone search_summary.go into a
summaryProjection literal alongside issueProjection/issueLiteProjection/
idProjection in issueops/search.go, sharing the generic searchInTx core
instead of a parallel top-level function — retiring the anti-pattern
coffeegoddd's CHANGES_REQUESTED flagged. LessSummary shares lessFields
with Less via a summarySortFields adapter so the two comparators can't
drift on NULL-handling or tie-break rules.
Adds parity coverage (SearchIssues vs SearchIssueSummaries agree on ID
set/order and on every IssueSummary field) and the three-way wide/lite/
summary A/B benchmark, extending dolt_benchmark_test.go — which still
only compiles together with the projection method, the fact that
retired the earlier "land the bench file first" plan.
* test(feat): red — fix parity test to compare order directly + add comparator/wisp-limit coverage (refs be-be3pj)
- TestSearchIssuesAndSearchIssueSummaries_Parity now compares
SearchIssues/SearchIssueSummaries IDs order-sensitively (slices.Equal)
instead of via the sort-then-compare equalStringSlices helper, which
would silently pass an ordering/top-N regression.
- Add TestLessSummaryMatchesLessAcrossSortKeys: Less vs LessSummary
produce identical order across every SortDefs key + "id", both
directions.
- Add TestSearchIssueSummariesInTx_MergesAcrossIssuesAndWisps: be-yrtwi
regression pattern for summaryProjection specifically, covering
wisp-merge top-N truncation under a limit.
* fix(types): give IssueSummary the same JSON tags as Issue
IssueSummary carried no struct tags, so encoding/json emitted Go's default
field names ({"ID":…,"Title":…}). The type exists to back list-shaped
rendering and `bd list --json` is one of that command's primary modes, so
the wiring follow-up would have silently changed the wire shape for every
consumer parsing bd output. Zero production callers today makes this a
zero-risk moment to fix it.
Tags mirror the same-named fields on types.Issue exactly, including
priority carrying no omitempty (0 is a valid P0). Three tests pin it: a
reflection test comparing every tag against Issue's so the two cannot
drift, an exact-key-set marshal test, and an omitempty test.
Reviewer item 1 (maphew, 2026-08-03).
* docs(storage): pin the --sort id contract on SearchIssueSummaries
The interface said SortBy/SortDesc are honored identically to SearchIssues,
which is true but left the id case looking like a gap in the summary path.
It is not a gap, and the doc now says why: sqlbuild.OrderBy emits no ORDER BY
for id (sqlbuild.IsGoSideSort), so *neither* path gets a SQL id order, and
both carry a comparator used only where the issues+wisps merge re-sorts
(sqlbuild.Less / sqlbuild.LessSummary).
The user-facing id order is cmd/bd's own, applied after the call via
utils.NaturalCompareIDs (cmd/bd/list.go sortIssues -> compareIssuesBy) —
numeric-aware, so bd-2 sorts before bd-10. Adding a lexicographic
storage-side summary sorter would therefore diverge from SearchIssues and
still not match what bd list renders.
Reviewer question (maphew, 2026-08-03): the contract no longer depends on
an unfiled follow-up to be readable.
* fix(backend): alias IssueSummary into the public backend contract
#5321 landed the public backend surface and its reflection drift guard on
2026-08-03, about two hours after this branch's last push, so the 08-11
maintenance rebase brought the branch under a gate that did not exist when
the engine interface was widened. TestPublicSurfaceComplete fails on both
platforms at the rebased head:
internal type github.com/steveyegge/beads/internal/types.IssueSummary
is reachable from the public backend contract but has no alias in
package backend
The gate is right and the rebase broke nothing. SearchIssueSummaries
returns []*types.IssueSummary on storage.Storage, which backend.DoltStorage
aliases whole, so the row type is now part of the contract an out-of-tree
backend writes against — and without the alias that backend cannot name it.
Verified this is ours rather than base breakage: the same test passes on
origin/main and fails only on this branch.
* ci: retrigger after infra-flake red on dc92c3c3
Run 34381971686 went red on two failures, neither of them in this PR's
15-file diff:
- Test (storage domain + uow): internal/tracker lost its Dolt
testcontainer mid-suite after a Ryuk reaper handshake reset
(54 failed, 1994 passed). Known parallel-binary reaper flake; the
fix is PR #5770, open and unmerged upstream since 2026-08-15. Third
recorded recurrence, same package and same mapped port as the prior
two.
- PR Core (wrapper timing): TestDoltServer_LogFile_CapturesOutput in
internal/storage/dbproxy/server, a package this PR does not touch.
Not reproducible locally in 55 attempts against clean main, 30 of
them under 2x CPU load with the CI-pinned dolt 2.2.0.
We are pull-only on the upstream repo and cannot rerun jobs, so an
empty commit is the only retrigger lever available.
* test(issueops): tie the summary column list to its scanner, delete a third copy
Review point (minor 2): IssueSummaryColumns, ScanIssueSummaryFrom's dest list
and search_summary_merge_test.go's summaryColumnNames were three hand-synced
copies of the same list, with only the real-database field-parity test to
catch a drift between them.
Two changes rather than one guard over three lists:
- summaryColumnNames now derives from IssueSummaryColumns instead of
restating it, so the fixture cannot drift at all. summaryMergeRow places
its values by column NAME against that list rather than by literal
position, so adding a column widens the row automatically instead of
silently shifting every value one slot left.
- TestIssueSummaryColumnsMatchScanner pins the remaining pair by count,
using a counting scanner that needs no database. This is the summary
counterpart of TestIssueSelectColumns_LitePlusHeavyEqualsFull.
TestIssueSummaryColumnsAreRealIssueColumns covers what a count cannot: a
misspelled column keeps the widths equal and fails only at query time against
a real database, as an opaque unknown-column error from whichever caller runs
first. Requiring membership in IssueSelectColumns catches it in a unit test.
Membership, not order: unlike IssueSelectColumnsLite, IssueSummaryColumns is
deliberately not a subsequence of the full list, so there is no analogue of
TestIssueSelectColumnsLite_IsFullMinusHeavyInOrder.
Both guards verified red-before-green by mutation: adding a column without a
dest fails the first, and misspelling one fails the second.
* fix(types): carry the wisp-plane markers through the summary projection
Review point (MAJOR): IssueSummary's doc comment promises a summary-backed
list serializes to the same wire shape a full-Issue-backed one does, and
issueops.searchInTx merges wisp rows into every result whose filter does not
set SkipWisps. But IssueSummary had no Ephemeral, NoHistory, WispType or
StorageClass, so a wisp rendered through it dropped ephemeral, no_history,
wisp_type and storage_class from `bd list --json` while every other key stayed
identical -- a wisp and a durable bead became indistinguishable on the wire.
maphew raised this on 2026-08-03 and it was still open.
Adding the fields, not excluding wisps. Excluding them would break the
same-wisp-merge-semantics claim that is this PR's central design argument, and
would make the wiring follow-up silently drop wisps from `bd list` entirely --
a strictly worse outcome than the missing keys.
Correcting our own 2026-08-03 reasoning, which argued the other way. That
comment observed that no list *renderer* reads Ephemeral or WispType back off
the row, which is true and beside the point: `--json` does not read fields,
it marshals the struct. It also treated the cost as the one D3 exists to
remove. These four are narrow scalars -- two TINYINT(1), two short VARCHARs,
already present on both the issues and wisps tables and already scanned by
ScanIssueFrom -- not the multi-KB TEXT bodies and JSON parse the projection is
narrow to avoid. Zero callers today makes this free; after the wiring lands it
is a wire-format change.
Verified red-before-green at both levels:
- TestIssueSummaryCarriesWispMarkers failed on all four fields before the
change (reflection against Issue, asserting tag AND type -- WispType and
StorageClass are named string types that a plain string would impersonate
under a tag-only check).
- TestIssueSummaryWispKeysMatchIssue marshals the same marker values through
both types and compares the four keys byte for byte, including a durable
row that must emit none of them.
- TestSearchIssueSummaries_FieldsMatchSearchIssues now seeds an ephemeral
wisp and a no-history wisp (mutually exclusive, so one row each) and
compares all four markers against SearchIssues on a real Dolt database. It
refuses to pass vacuously: fewer than two wisp rows in the result is a
fatal, since zero-vs-zero marker comparisons would otherwise succeed if
the merge stopped returning wisps. Mutating ScanIssueSummaryFrom to stop
mapping wisp_type fails it on both seeded rows.
ScanIssueSummaryFrom maps the four exactly as ScanIssueFrom does, including a
NULL storage_class staying empty for EffectiveStorageClass to resolve per
plane rather than being pinned to a literal.
* perf(sqlbuild): compare sortFields through pointers, not two copies per call
Review point (minor 3): the shared-comparator refactor made Less build two
sortFields values per comparison and pass them by value, a small regression on
the pre-existing issues+wisps merge sort inside a perf PR.
lessFields and sortKeyCompareFields now take *sortFields. sortFields is a
~150-byte struct, so passing by value copied it twice into lessFields and
twice more into sortKeyCompareFields on every comparison; that is now zero
copies after the adapters run. The adapters still build one value per row --
that normalization is exactly what buys Less and LessSummary a single shared
body, and giving it up would reintroduce the drift this PR exists to remove.
No allocation either way, before or after: escape analysis reports nothing in
Less/LessSummary/lessFields escaping to heap (the only escapes in sort.go are
the pre-existing SortDefs map and OrderBy's string formatting), and both arms
measure 0 B/op, 0 allocs/op. A throwaway A/B in one binary, -benchtime=3s
-count=3 on the priority key, put the by-value median at 26.33 ns/op and the
pointer median at 25.35 ns/op, with non-overlapping ranges -- a consistent but
small ~4% win.
Stating that plainly rather than claiming more: the value here is removing four
struct copies per comparison from the hot path, not the wall-clock number,
which is within a couple of nanoseconds. Behavior is unchanged; the sqlbuild
suite, including the parity and LessID-honors-sortDesc tests, passes.
* test(dolt): vary SortBy across the summary parity table
Review point (minor 4): none of the nine parity cases set SortBy, so
LessSummary-versus-SQL ORDER BY agreement was proven by unit test alone
(TestLessSummaryMatchesLessAcrossSortKeys) and never against a real database.
Every case ran at the default order, priority ASC.
Nine rows added, covering created, title, status, updated and assignee -- the
first two in both directions -- plus id in both directions. Each carries a
Limit, so the merge's sort-before-trim actually decides which rows survive
rather than the ordering being cosmetic: an ordering bug that only shows up in
which rows a top-N keeps is the failure mode this table exists to catch.
id is included deliberately even though sqlbuild.OrderBy emits no ORDER BY for
it. It is the one Go-side key, so these two rows pin that both paths still
agree on the order the merge comparator produces where SQL contributes none.
All nine pass against a real Dolt database.
* docs(storage): document the summary projection's caller contract
Two review points, both about the contract being legible to a caller who has
only the interface and the extension guide.
Minor 1 -- IncludeDependencies is a silent no-op on the summary path, because
types.IssueSummary has no Dependencies field to populate. hydrateSummaryLabels
says why in its own comment; the interface a caller actually reads did not.
SearchIssueSummaries' doc now states it, alongside the neighbouring facts that
SkipLabels IS honored identically and that wisps are not excluded.
Minor 5 -- engdocs/EXTENDING.md documented the Lite projection's contract and
never mentioned the third one. It now carries a parallel section: what a caller
may read, why there is no IsLitePartial equivalent (a narrower type makes a
missing field a compile error rather than a silent zero value, which is the
substantive difference from Lite), the dependency and wisp rules above, the
ordering guarantee, and where each is enforced -- including the note that
IssueSummaryColumns is deliberately not an ordered subsequence of the full
list, so it has no analogue of the lite path's in-order guard.
The Lite section is left intact, its own Backend coverage subsection included;
the new section follows it rather than interleaving.
* chore(bazel): enumerate the two new test files in their go_test srcs
The PR adds internal/types/issue_summary_test.go and
internal/storage/issueops/search_summary_merge_test.go. Both are untagged,
and both packages carry a base-added BUILD.bazel whose go_test enumerates
srcs explicitly, so bazel silently would not have compiled or run them:
measured on //internal/types:types_test, the unrepaired binary lists 0 of
the 5 new tests (68 total) and the repaired one lists 5 of 5 (73), with
both builds exiting 0 -- a fake green, since bazel reports "1 test passes"
either way.
Base parity at 43a526b828 is clean (102 packages / 1192 untagged test files
enumerated, 0 srcs gaps), so the omission is PR-introduced rather than an
unenforced list. make bazel-sync-check and tools/bazel/go_srcs.py --check
both exit 0 on the broken head; generated with make bazel-sync (gazelle),
which is idempotent here.
Maintainer fixup applied during adopt-pr rebase (PR #3458).
* docs: announce the required SearchIssueSummaries method and inventory its span
Review follow-through for #3458 (maintainer fixup, iteration 1).
CHANGELOG.md: backend/backend.go promises that a required method added to
the engine interface is called out in CHANGELOG.md. SearchIssueSummaries is
one and had no entry. Adds an [Unreleased] "Changed" bullet in the #4911
form, next to the #6731 GetReadyWorkWithCountsAndTotal announcement: the
method and its signature, that callers are unaffected while implementers
must add it to compile, and its contract (SortBy/SortDesc and SkipLabels as
in SearchIssues, IncludeDependencies a silent no-op, wisps merged with their
markers set).
engdocs/design/otel/otel-data-model.md: the direct-operations block calls
itself a complete inventory and was exact at the PR base. The PR's new
storage.SearchIssueSummaries span was the one missing name. Inserted in
alphabetical order and bumped the count to 74. A set-diff against the
s.op(ctx, "...") names in internal/telemetry/storage.go now finds 74 == 74
with no drift in either direction.
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>
* docs: add beadcyte to community tools (Web UIs)
Local web app that draws bead history and a projected future: a
historical-median estimator, a greedy WIP-cap scheduler, and an
eight-signal triage score, each with its own uncertainty. Reads and
writes only through the bd CLI.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs: correct beadcyte storage-access claim and normalize emphasis
The beadcyte entry said the tool "reads and writes exclusively through
the `bd` CLI ... never the Dolt files or `.beads/issues.jsonl`". The
first half is false for the shipped package. Measured against
beadcyte@0.9.0, the latest published version (tarball sha1
93964d9632cc1b1cc846f5d84f0dfa8a79a4ef57, matching the registry
shasum):
- The package starts exactly one process that is not `bd`:
`spawn("dolt", ["sql", "-r", "json", "-q", sql], ...)` with cwd
<project>/.beads/embeddeddolt (src/history-sql.mjs:250,
`doltSqlRunner`).
- `beadcyte freeze` reaches it through `readDoltDates`
(src/freeze-cli.mjs:110). `freeze` is a dispatched subcommand
(bin/beadcyte.mjs:37, 63-65). The path is on by default:
freeze-cli.mjs:33 sets `dolt: true`, and `--no-dolt` (:38) turns
it off.
- The author's own comment agrees: "`beadcyte freeze` is the ONE
place beadcyte reads Dolt directly ... read-only"
(src/history-sql.mjs:42-44).
Correcting an over-broad claim can easily introduce a new one, so each
clause of the replacement was checked:
- "reads and writes through the `bd` CLI": every other process the
package starts is `bd`. Writes go through `bd update`, including
freeze's own write-back (freeze-cli.mjs:127), and through
`bd dolt pull`/`push` (src/serve.mjs:498, 509).
- "read-only": `QUERIES` (history-sql.mjs:115-124) holds 4
statements, all SELECT. Every SQL call site passes one of them
(history-sql.mjs:302-303, 467-470).
- "never `.beads/issues.jsonl`": the package contains zero `jsonl`
references, so the entry still meets the page's compatibility bar
(docs/community-tools.md:8-11).
Emphasis: 51 of the page's 52 entries carry exactly one bold span, the
linked name. beadcyte carried three. Removing the bold from "happened"
and "expects to happen" brings it to 52/52.
Length: the correction adds 74 characters, bringing the entry to 1073.
That is still the longest of the 7 Web UIs entries, and 3rd on the
page after Beadazzle (1579) and Beads Dashboard (1300). Review
suggested trimming it to a feature summary. That suggestion is
optional and does not gate the review, and how the product is
described is the contributor's call, so this commit does not make it.
Gates: git diff --cached --check is clean. check-doc-flags.sh returns
rc=0 against the pinned v1.2.2 bd. check-doc-freshness.sh reports 68
PASS / 0 FAIL. go test ./test/docsync passes 8/8.
go test -tags integration -run TestDocFreshness ./scripts gives
37 pass / 0 fail / 1 skip.
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>
* test(count): pin include_ephemeral as the plane bit and nothing else
PR #6240 added `bd count --include-ephemeral` so a count can reach the
wisps table without IncludeInfra's other three changes: dropping
templates, dropping gates, and routing an infra type to the ephemeral
tier. Nothing asserted that second half. Routing IncludeEphemeral
through the builder's infra branch, or mapping `include_ephemeral` onto
IncludeInfra in the HTTP handler or the CLI, passed every existing test.
- workapi: TestCountIncludeEphemeralIsThePlaneBitAndNothingElse, the
count twin of the list pin. IncludeEphemeral (no type, a named type,
an infra type) leaves IsTemplate, ExcludeTypes and Ephemeral unset;
IncludeInfra still sets all four.
- httpapi: TestCountForwardsTheEphemeralPlaneParameter sends each plane
parameter alone and asserts the exact request the role receives.
- cmd/bd: TestCountIncludeEphemeralFlagShape pins the flag, its false
default, and that --include-ephemeral alone leaves IncludeInfra false.
Each new test fails against its mutant, and it is the only test that
does:
- builder: `if in.IncludeInfra || in.IncludeEphemeral`
- handler: `IncludeInfra: q.boolean("include_infra") || q.boolean("include_ephemeral")`
- CLI: `IncludeInfra: includeInfra || includeEphemeral`
Post-merge review follow-up for #6240.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(count): name include_ephemeral where the plane prose said include_infra alone
#6240 added a second way to reach the wisps tier, but several statements
still said only include_infra could reach it:
- spec, countIssues "Planes": "DURABLE-PLANE ONLY unless include_infra
is set" now names both knobs and says what include_ephemeral changes.
- spec, include_infra: "Unset, the count is durable-plane only" now holds
only with include_ephemeral also unset (types.gen.go regenerated).
- issueops.CountRequest: the same "Unset" sentence on IncludeInfra and on
IncludeEphemeral, each now conditional on the other knob.
- workapi.applyCountIncludeInfra: "a count without IncludeInfra keeps its
durable-only semantics" now allows for IncludeEphemeral.
- httpapi countFilters: the "plane switch" comment named one knob;
IncludeEphemeral now has its own comment saying why it is never folded
into IncludeInfra.
- count_test.go: the default-plane comment names both zero values, and
the stale "25 filters" / "26th filter" literals are dropped (the
struct has 26 fields).
Comment and spec-prose only; `make api-check` is green.
Post-merge review follow-up for #6240.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* perf(dolt): pin MaxAllowedPacket in the server DSN (#5273 item 4)
Both DSN builders construct mysql.Config as a composite literal rather than
via mysql.NewConfig(), so MaxAllowedPacket is left at zero. FormatDSN emits
maxAllowedPacket=0, and go-sql-driver/mysql then runs
SELECT @@max_allowed_packet
while establishing every new connection, because its connector takes that
probe whenever cfg.MaxAllowedPacket <= 0. That is an extra round-trip per
connection, paid on every pool expansion — the cost that matters against a
high-latency remote Dolt server, where connections are opened far more often
than the packet limit ever changes.
Pin the value to the driver's own defaultMaxAllowedPacket (64 MiB), which is
what a mysql.NewConfig() caller already gets, so the packet limit itself is
unchanged. The constant is duplicated because the driver keeps it unexported.
FormatDSN omits the parameter entirely when it equals that default and
ParseDSN starts from NewConfig(), so the value survives the round-trip
through the DSN string without being written into it.
Tests assert the parsed value rather than the DSN text, for that reason: a
substring check would pass for the wrong reason. Verified RED by reverting
just the field — both new tests fail with "got 0", and the failure message
shows the offending DSN carrying maxAllowedPacket=0.
Companion to #4617 (interpolateParams in the same file), and item 4 of the
PR #4167 showcase salvage list.
Credit: the round-trip analysis originates in the showcase work of
Hans Boese (@Shockwave2k) in #4167 / #4165.
Agent-Signature: claude-opus-5-high on behalf of maphew
* fix(dolt): pin the packet ceiling to Dolt's 1 GiB, not the driver's 64 MiB
Cross-vendor review (codex gpt-5.6-sol) caught a real regression in the
previous commit: pinning MaxAllowedPacket to go-sql-driver/mysql's own
defaultMaxAllowedPacket (64 MiB) does skip the per-connection probe, but it
also lowers the client's ceiling far below the server's.
Verified against the engine rather than assumed. go-mysql-server declares:
"max_allowed_packet": &sql.MysqlSystemVariable{
Type: types.NewSystemUintType("max_allowed_packet", 1024, 1073741824),
Default: int64(1073741824),
}
so Dolt defaults to 1 GiB and its sysvar type caps the value there — no Dolt
server can be configured to accept a larger packet. Under the old probing
behavior the driver set its ceiling from that server value; a 64 MiB pin
would instead have made the driver reject oversized statements locally with
ErrPktTooLarge, breaking large imports and base64 content that previously
succeeded.
Pin 1 GiB instead. The round-trip saving is unchanged (the probe is taken
whenever cfg.MaxAllowedPacket <= 0, not when it differs from any particular
value), and the client now never rejects a packet the server would accept.
Trade-off, stated in the code: the probe read the server's *configured*
value, so an operator who lowers max_allowed_packet below 1 GiB no longer
gets a client-side rejection — the server rejects instead. That moves the
error to the authoritative side and never silently truncates.
Both tests now assert the ceiling is at least Dolt's 1 GiB, so a future
change back to the driver default fails rather than silently shrinking the
limit.
Agent-Signature: claude-opus-5-high on behalf of maphew
* build(bazel): add the mysql dep to the two dsn go_test targets (make bazel-sync)
Both dsn_test.go files now import github.com/go-sql-driver/mysql directly
(for mysql.ParseDSN), so gazelle emits the dep on each go_test. Without it,
bazel.yml's "BUILD files in sync" step fails in the required bazel-test lane.
Generated by `make bazel-sync`; matches the drift that step reported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(dolt): correct the max_allowed_packet trade-off comment
Maintainer fixup for PR #5316 review iteration 1. The synthesis and the
quality scorecard both approve (989/1000, no blocker or major findings).
This is the one non-gating minor; both review lanes flagged it
independently.
The maxAllowedPacketBytes doc comment said that when an operator lowers
max_allowed_packet below 1 GiB, "the server rejects the statement instead".
Dolt does not do that. In the engine versions this module pins, the sysvar
has one non-test reader, go-mysql-server's LOAD_FILE
(sql/expression/function/load_file.go). vitess's MaxPacketSize is only the
16 MiB wire-framing constant, and vitess reassembles multi-packet payloads
without any size check. dolt/go never reads the sysvar. A lowered setting
is therefore honored nowhere on the statement path, which matches the PR
description's own analysis. The last paragraph now says so.
The paragraph above it rested on the same premise ("no Dolt server can be
configured to accept a larger packet than this"). Left alone, it would
contradict the corrected paragraph. It now states what the type cap does
guarantee: no Dolt server can report a larger value, so the old probe
could never have produced a higher ceiling than this pin.
Comment-only; no code or test change. The contributor's second commit
message still has the old wording. Contributor commits stay untouched to
preserve authorship, so this comment is the corrected record.
Two optional nits were left as-is:
- Asserting == 1<<30 instead of >= in both tests. The tests are correct
as written, and their stated purpose is a lower bound ("must not shrink
what the client will send"). The upward-drift harm the nit describes
assumes the server enforces the sysvar, which the fix above shows it
does not.
- The pin is one byte above the old probe's n-1 ceiling. That difference
can't be reached in practice or observed without server-side
enforcement, and the synthesis lists leaving it as-is as its first option.
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>
* fix(hooks): warn on unsupported async execution (#5669)
Report the js/wasm unsupported-hook sentinel at Runner.Run's fire-and-forget boundary while preserving synchronous errors, tracing, and native behavior.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(hooks): isolate asynchronous warning capture (saa-cgh.82)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): pin the refusal guard's polarity and Run's production route
Maintainer review fixes for the adopt-pr review of #5673, iteration 1.
Test-only; production code is byte-identical.
major / Test Evidence Quality. Nothing rejected widening runAsync's
errors.Is(err, errHookExecutionUnsupported) to a bare err != nil. On js/wasm
runHook is an unconditional stub whose only return is that sentinel, so the two
predicates agree for every input there and no wasm test can tell them apart; on
unix/windows runHook returns real exec errors, so the loosening would print
`warning: hook "..." was not run: exit status 1` for a hook that did run --
false, and a break of the fire-and-forget silence runAsync's own comment states.
Adds TestRunAsync_SilentOnHookFailure to hooks_test.go, skipped on Windows for
the reason TestRun_Async already documents and on js/wasm, which has no
executed-but-failed outcome to observe. An executable hook writes a marker and
exits 1, runAsync is called directly with an injected buffer, and the buffer must
stay empty; the marker is what separates "ran and failed" from "never ran", which
would also be silent and would pass for the wrong reason. Measured: under the
err != nil mutation this is the only test in the linux package that reds, and the
required js/wasm lane stays green -- which is the gap itself.
minor / Change Impact. No test drove the production route Run -> runAsync, so the
new warning could have been inert on the platform it exists for: the pre-existing
subtest calls runAsync directly with a hookPath it never creates. Adds a nested
subtest under TestRunHookReportsUnsupportedExecution that writes the hook at 0755
and calls Run. The exec bit was measured to survive on this js/wasm host (Node
v25.9.0, mode -rwxr-xr-x), so Run does reach the warning there. The subtest
asserts whichever outcome the host's own file mode implies rather than skipping,
because both required lanes' count guards reject a SKIP line as well as a FAIL.
Injecting the unreachable-route defect reds only this subtest while the
pre-existing one stays green, so it adds coverage rather than duplicating it.
nit / Debuggability. The sync assertion calls runHook, so its failure message now
says runHook instead of RunSync.
Per the synthesis scope note this leaves the exec-bit preflight at hooks.go:75-77
and the CI selector and its count guards untouched. Both required js/wasm lanes
(pr.yml and bazel.yml, run verbatim) still report runs=1 passes=1 nonpasses=0,
the full js/wasm package keeps the same 5 base-preexisting failures with no new
one, and gazelle leaves internal/hooks/BUILD.bazel byte-identical.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(ci): make doc-freshness selection fail closed
Require the protected doc-freshness workflow to select its exact compiled top-level inventory plus the guard that exercises real zero- and partial-selection refusals. Ordinary focused scripts tests remain unchanged unless required-suite mode is explicit.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* test(ci): fail suite self-test on inventory drift (#5726)
Fail the contract's compiled-suite subtest when an unregistered or missing
member would otherwise silently suppress its TestMain selector falsifiers.
Keep the integration-free build usable with an explicit subtest skip and
point doc-freshness test authors to the maintained registry.
The untagged TestMain fronts the entire scripts_test package, including
ordinary tagged and untagged go test ./scripts invocations. Without the
required-suite flag it delegates to m.Run; runtime failures and intentional
skips remain Go's responsibility.
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* chore(bazel): enumerate required_suite_test.go in the scripts go_test srcs
gazelle-generated, scoped to this PR only. The file is untagged so the
go_test target owes its enumeration; the in-package census showed the
gap was exactly this file with zero pre-existing untagged gaps.
Note make bazel-sync also wants internal/storage/dolt/BUILD.bazel for
version_staging_completeness_test.go, but that is a BASE-owned gap from
the just-merged #6844 and is deliberately left out of this diff.
* test(ci): register the 11th doc-freshness test and pin real flag reads
Two maintainer review fixes on top of the contributor branch.
Blocker: requiredSuiteDefinitions pinned 10 TestDocFreshness* names while 11
are compiled at this head. The 11th,
TestDocFreshnessRejectsMultipleLastReviewedMarkers, arrived on the base in
0bf13494f0 (#6482) during the 164-commit merge-base advance, so the
contributor's list was correct when written. Left unregistered, the required
check-doc-freshness-platforms step this PR itself edits fails on all three
OSes (pr.yml:476, required via pr.yml:1378 and :1408), and the same drift
independently reds TestRequiredSuiteContract/compiled_suite in every
integration-tagged whole-package lane. Registering the name is the whole fix.
Major (test evidence): the flag table injects synthetic requiredSuiteFlags
literals, so it proved only that the predicates reject narrowing flags, never
that real flag values reach them. currentRequiredSuiteFlags is the sole
production reader of real test flags and went unexercised, so a wrong lookup
key silently reopened the fail-open hole this PR exists to close. skip, cpu,
list and short all compare against zero values and so fail open; run and count
fail closed. The new "real flag reads" arms hand a child real -test.skip,
-test.cpu, -test.list and -test.short alongside a valid -test.run and require
the matching diagnostic rather than the generic prefix, because a wrong key
reads the zero value and falls through to a different failure that the prefix
would accept. Mutating each lookup key in turn reds exactly its own arm and
leaves the other three green, tagged and untagged.
Those arms are the first to hand a child a valid selection, which necessarily
selects this test too, so a child that got past a broken guard re-entered here
and spawned without bound (measured: a monotonically growing child count that
never terminates). BEADS_TEST_REQUIRED_SUITE_CHILD stops that at depth 1, so
the regression surfaces as a failed assertion in seconds instead of a hang.
The arms sit outside "compiled suite" because the flag guards run ahead of the
inventory check, so they also hold in the untagged fast and bazel lanes where
compiled suite self-skips.
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(schema): dolt_ignore the __temp__ table-rebuild intermediates
The ignored-series rebuilds stage every clone-local table through a
__temp__<table> intermediate that is renamed onto the final, ignored
name — but the intermediate names carried no dolt_ignore pattern.
Against a @@dolt_transaction_commit=1 server, every CREATE TABLE
__temp__X therefore auto-committed a real table at HEAD, and the
rename onto the ignored final name left an unstageable
"__temp__X -> X" rename half in dolt_status (content-inferred rename
classification; per-table adds and dolt_add -A all no-op on it),
wedging every later open behind the dirty-table guard.
Field impact: a three-city shared hub wedged this way twice in one
day, each time ending in fleet-wide write refusal and a manual
capture-schemas / drop / recreate repair.
Seed "__temp__%" in the canonical doltIgnorePatterns set, so the
intermediates are born ignored on every write-mode open — asserted,
like the events-journal patterns, before the series that creates the
tables runs. dolt matches ignore patterns with ? * % only
(underscores literal), so the entry covers exactly the __temp__
prefix.
Shipping the pattern makes seedDoltIgnorePatterns report a change on
every store seeded before this fix, which exposed a second bug in the
same path: under @@dolt_transaction_commit=1 the seed's INSERTs are
already dolt-committed at their own transaction boundaries, so the
scoped DOLT_COMMIT in commitSeededDoltIgnore died with "nothing to
commit" and took the whole pass down. It now passes --skip-empty
(same treatment as the migration-repair commits).
Regression coverage: an embeddeddolt test drives the exact field
sequence — clone-shaped store whose dolt_ignore predates the pattern,
@@dolt_transaction_commit=1, fresh-box MigrateUp — and asserts no
__temp__ table ever reaches committed history and the pass ends with
a clean working set. Before the fix it reproduces both failures
(the "nothing to commit" pass abort, then the materialized
"__temp__bd_events_journal -> bd_events_journal" wedge).
Reported by qcore/syl (Gas Town shared-hub incidents, 2026-08-27);
tracked locally as be-c5h.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs(changelog): fenced deployments need one privileged open after the __temp__ pattern (be-c5h)
Review: a new canonical dolt_ignore pattern un-converges every existing
database, so the next write-mode open issues one INSERT IGNORE INTO
dolt_ignore; a wire client denied that INSERT fails its open until a
privileged bd heals the pattern. Self-healing, so the entry says so and
stops there; degrading a denied seed to a skip is its own issue.
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(schema): force the untrack scratch sweep past the new __temp__% pattern
Maintainer review fixes for the dolt_ignore __temp__ intermediates change.
The new "__temp__%" pattern also matches ignoredCursorUntrackTempTable
("__temp__ignored_schema_migrations_untrack", #4356), which the sweep in
dropIgnoredCursorScratch stages with an unforced CALL DOLT_ADD(?). Dolt's
staging filter classifies purely by pattern and never consults HEAD, so a
scratch table that IS committed at HEAD is dropped from the staging list
silently, --skip-empty then commits nothing and reports success, and the
uncommitted delete delta survives forever. That delta is not an add, so
dolt refuses every later pull on it regardless of the ignore pattern,
while dirtyTables(excludeIgnored=true) hides the cause from bd's own
opens -- reintroducing the exact permanent pull wedge #4356 exists to
clear, silently.
Add commitScopedIgnoredTableChange, a forced-staging variant of
commitScopedTableChange used only by that caller, so the other caller
(commitNonlocalRepair) keeps the unforced default that stops an ignored
table riding into a repair-labeled commit. '-f' widens which names may be
staged, never how many, and dropIgnoredCursorScratch already unstages
first, so the commit stays scoped to the one table.
Re-arm the coverage the pattern disarmed. TestIgnoredCursorHealResume-
RespectsOperatorOverride manufactured the tracked scratch with
DOLT_COMMIT('-Am'), whose ignore filter is hardcoded on (there is no '-f'
form of the blanket commit), and its fixture opens a real store whose
MigrateUp now seeds "__temp__%" -- so the scratch stopped reaching HEAD,
the tracked branch stopped being entered, and the arm passed on its
weaker "gone from the working set" assertion. It now force-stages the
scratch itself, asserts that precondition, and asserts positively that
the sweep commit lands (the table leaves HEAD) with a clean working set.
Mutation-proved in four arms: reverting the production '-f' reds both the
embedded arm ("still committed at HEAD; the sweep staged nothing and
--skip-empty committed nothing") and the sqlmock pin; reverting only the
fixture re-arming leaves the suite green, and reverting both -- the state
as submitted -- is green too, which is the defect making its own test
pass.
Correct three statements the pattern falsified: the constant's "the name
is deliberately not matched by any dolt_ignore pattern", the
dropIgnoredCursorScratch contract, and the sqlmock test's restatement of
it. The remaining tracked-at-HEAD windows are a lineage repaired before
the pattern shipped, an older binary, or replication from such a peer.
Reword the doltIgnorePatterns justification comment, which asserted the
exact predicate versionGatedDoltIgnorePatterns uses ("__temp__ names
never exist on the versioned plane") and is not literally true. The
censused invariant that does hold is weaker: no __temp__ table's
committed lineage is ever read back, because every creator disposes of
its own intermediate within the pass that made it. Note this corrects
the reviewers' proposed wording, which enumerated only the SQL creators
and so omitted the Go-side untrack scratch -- it neither renames onto an
ignored final nor drops inside a migration, but is swept by the forced
commit above.
Scope that comment's conclusion as well: "so the pattern is safe
unconditionally" overclaimed. The pattern needs no version gate, but it
prevents residue rather than repairing it. Where an older binary already
committed some other __temp__X at HEAD, the pattern keeps that table's
drop or rename delta out of every ignore-filtered staging candidate set
-- dirtyTables(excludeIgnored=true) matches on the name alone, and
existingCommittableTables only lists tables that still exist -- so no
migration commit stages it, and dolt's WorkingSetContainsOnlyIgnoredTables
rejects any non-add delta before it consults a pattern, so dolt pull
fails with ErrUncommittedChanges until the store is repaired by hand.
Repairing that residue is left to a follow-up; the comment now says so
instead of calling the pattern harmless.
Add migrate_temp_intermediates_test.go to the embeddeddolt go_test srcs
(gazelle; the list is exhaustive and gazelle-owned, and main's advisory
bazel.yml diffs it), so the PR's only engine-level pin actually runs
under Bazel.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: a3ackerman <28374790+A3Ackerman@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(bd): cap auto-backup destination size to stop unbounded growth (ga-y6gjv)
ga-y6gjv asked for 4 fixes to bd's auto-backup subsystem. Three are already
merged and deployed (verified via git merge-base --is-ancestor against the
commit that built the currently-deployed ~/.local/bin/bd):
- interval throttle persists on failure too, per-workspace: 5f685959c
- default-off in sql-server/shared mode: 5f685959c, refined by 8b9429153
- `bd config get backup.enabled` reports the effective value: 5f685959c
This commit is only the fourth, still-open item: "prune/cap backup
archives." BackupSync/CALL DOLT_BACKUP('sync', ...) only ever transfers new
chunks into the destination — it never prunes ones that became unreachable
on the source DB (history rewrites, superseded data) — so even with the
interval fix slowing the frequency of syncs, the destination can still only
grow, never shrink. This was the actual disk-filling mechanism in the
2026-06-19 outage (43GB backup dir from a 1.7GB store).
I first tried wiring `dolt gc` into the post-sync path (mirroring
runCompactDolt's exec.Command("dolt", "gc", ...) pattern in compact.go).
That does not work: a backup destination is a bare Dolt chunk-store
directory with no .dolt repo-root marker, so the standalone dolt CLI can't
open it ("not a valid dolt repository") no matter what its working
directory is set to, and dolt_backup.go's SQL procedures only expose
add/sync/restore — never gc — for a backup destination. Confirmed this
empirically (a real dolt gc attempt against a real backup dir, outside any
test) before shipping anything, not just reasoned about it.
Given no supported way to prune a backup destination in place, this adds a
hard size cap instead: once the destination exceeds backup.size-cap-mb
(default 2048MB), maybeAutoBackup skips the sync attempt entirely rather
than letting it grow further, and prints a throttled warning
(backup.size-warn-interval, default 24h) telling the operator to free space
or raise the cap. This directly bounds the failure mode that caused the
outage — unbounded growth — without risking any operation against the
backup store's on-disk format.
Tests (cmd/bd/backup_cap_test.go): threshold check against a real
directory, warning-throttle persistence (mirrors the existing throttle
persisted on backup failure, backup_export.go), and end-to-end proof that
maybeAutoBackup never attempts BackupDatabase once capped. Confirmed each
new test fails against the pre-fix code (wiring temporarily reverted,
re-verified, restored) before treating it as green.
Verified: go build ./... clean, gofmt clean, go vet clean, full
cmd/bd + internal/config test run green (backup/config-focused subset run
with -v; no regressions in the wider package test runs either).
* fix(bd): address PR #6071 review feedback on backup size-cap (ga-y6gjv)
bee-ghosttrack's 2026-09-03 review of the size-cap fix (3d27d7a98) requested
changes before merge -- 4 major, 2 minor, all about the pause being
invisible rather than the cap mechanism itself. This addresses all six.
Major:
1. backup.size-cap-mb: 0 now means "no cap", not "use the 2048MB default."
effectiveSizeCapMB() centralizes the <=0-is-disabled interpretation;
backupSizeCapExceeded and the new status helpers all go through it.
Viper already registers a 2048 default for this key
(internal/config/config.go), so GetInt only returns <=0 when the
operator explicitly set 0 (or an unparseable value) -- the old code's
own `if capMB <= 0 { capMB = 2048 }` was silently overriding that
explicit choice, leaving no off switch for a legitimately larger
destination.
2. `bd backup status` (and --json) now report a `size_cap` object
(enabled, cap_mb, current_bytes, exceeded), and the human-text Config:
line grows a "Size cap: PAUSED (cap exceeded) -- X / Y..." line when
paused. Previously the pause was stderr-only and throttled to 24h, so
an agent/CI caller on --json or --quiet had no way to see that
auto-backup had silently and permanently stopped syncing.
3. The remediation message no longer says "delete the backup directory."
Nothing in this codebase demonstrates a deleted destination is cleanly
recreated by the next sync (the server-side Dolt backup remote stays
registered against that path), and following the old advice would
leave a zero-backup window while the next sync is itself
interval-throttled. It now points at backup.size-cap-mb / `bd backup
init <new-path>`.
4. docs/reference/configuration.md gains rows for both new keys plus an
expanded Auto-backup section (the cap mechanism, the pause, manual
backup staying uncapped, bd backup status reporting the pause);
CHANGELOG.md gets an [Unreleased]/Fixed entry referencing #6071.
Minor:
5. maybeWarnBackupSizeCap's throttle timestamp is now also cached in an
in-process map (capWarnFallback, keyed by dir) alongside the persisted
backup_state.json. The persist write targets the directory the cap
just declared full, so in the disk-full case this cap exists for, that
write fails and the timestamp never sticks -- a long-lived bd process
that keeps calling maybeAutoBackup for the same destination (e.g.
internal/storage/dbproxy's server mode) would otherwise re-warn on
every single call. The map is keyed by dir specifically so unrelated
destinations -- and unrelated tests -- never share a throttle.
6. The size-cap directory walk (getDirSize's filepath.Walk) now runs
after the interval throttle in maybeAutoBackup, not before. The
reviewer measured 65-100ms per bd invocation at 20k files in the
backup dir when the walk ran unconditionally on every command; moving
it below the throttle makes it free on the common (throttled) path and
only pays the walk cost once per interval, exactly when a sync attempt
would occur anyway.
Also noted by the reviewer: manual `bd backup` / `bd backup sync` stay
uncapped -- now documented in configuration.md.
Tests (cmd/bd/backup_cap_test.go, cmd/bd/backup_status_test.go): one new
test per review point. Each was confirmed to fail against the pre-fix code
for the expected reason before implementing -- including catching a
vacuous pass in my own first draft of the "disabled cap" JSON assertion
(zero-value Enabled:false matched whether the size_cap key existed at all
or not; fixed to assert key presence first). The disabled-cap test uses a
sparse file (Truncate, not a real write) to cross the legacy 2048MB
threshold without allocating 2GB of real disk or memory. The reordering
test is detected indirectly: if the cap check ran despite the throttle, it
would persist LastCapWarnAt; the interval-fresh case proves it does not.
Verified: go build ./cmd/bd/... clean, gofmt clean, go vet ./cmd/bd/...
clean, golangci-lint run ./cmd/bd/... -> 0 issues, targeted backup/status
test subset green (20/20, including every pre-existing backup test -- no
regressions).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(bazel): add backup_cap sources to //cmd/bd srcs lists
The contributor branched before `cmd/bd/BUILD.bazel` existed, so the two
files this PR adds were never enumerated there. After rebasing onto a base
that hand-maintains explicit srcs lists, `//cmd/bd:bd_lib` omits
`backup_cap.go` while still compiling `backup.go` and `backup_auto.go`,
which reference four symbols it defines:
backup.go:93 undefined: showSizeCapStatusJSON
backup.go:141 undefined: showSizeCapStatus
backup_auto.go:200 undefined: backupSizeCapExceeded
backup_auto.go:203 undefined: maybeWarnBackupSizeCap
`backup_cap_test.go` was likewise absent from `//cmd/bd:bd_test`, leaving
seven of the PR's nine new tests unreachable under Bazel.
`make bazel-sync-check` does not catch this: `tools/bazel/go_srcs.py --check`
only validates the `go_srcs` filegroup globs, not the `go_library`/`go_test`
srcs enumerations.
Four unrelated test files (config_leaked_secret_test.go, init_role_*_test.go,
init_git_bootstrap_routing_test.go) are also unlisted, but they are unlisted
on the base too, so they are left alone as pre-existing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(backup): stop the size-cap walk from running on every bd command (#6071 review)
Maintainer review fixup for PR #6071 (ga-y6gjv), iterations 1 and 2.
The gating finding, filed independently by both review lanes and confirmed
empirically: the fixup that moved the getDirSize walk behind the interval
throttle does not deliver its claimed property, because state.Timestamp —
the only thing that re-arms that throttle — is written in exactly two
places, both inside runBackupExport. The two steady states that skip
before reaching it therefore pass the throttle on every single bd
invocation and pay the full filepath.Walk forever:
IDLE no new Dolt commit; the walk runs, then change detection skips
and writes nothing.
PAUSED cap exceeded; the walk has already happened by the time
maybeWarnBackupSizeCap persists LastCapWarnAt, which is the only
field it wrote.
PAUSED is the pathological case: an over-cap destination is by definition
the largest one, so the feature's terminal state was its most expensive,
persisting until an operator intervened. This landed on read-only
commands too, i.e. the 65-100ms/command agent-polling regression the walk
was moved to avoid.
Both halves of the documented remedy:
- Move the cap check after change detection, the order
docs/reference/configuration.md already describes ("If data changed and
the throttle interval has passed, bd checks the destination
directory's on-disk size"). This makes that sentence true and closes
the docs finding with no docs edit.
- Re-arm the interval throttle (state.Timestamp) on the cap-exceeded
skip, leaving LastDoltCommit untouched exactly as runBackupExport's own
failure path does, so change detection still sees pending work once the
cap is raised.
Neither half suffices alone: the reorder still walks every command in a
PAUSED workspace where data IS changing, and the persist alone still walks
forever when IDLE. Persisting on the idle skip instead would add up to one
backup.interval of backup latency, which this pairing avoids.
Also from the same review, all non-gating:
- The cap-check error path failed open behind a debug-only line, so one
unreadable entry could silently restore unbounded growth while
`bd backup status --json` reported the very same error. It now warns on
stderr, throttled by the backup interval and deliberately not by the
LastCapWarnAt slot: spending that slot here would suppress the more
important PAUSED notice for a full warn interval.
- The warn timestamp is now recorded only when the message was actually
printed, so --json/--quiet agent calls stop consuming the 24h slot
silently.
- Dropped capWarnFallback (map, mutex, two accessors). No reachable
production path can read it: both call sites are in PersistentPostRunE,
which runs once per CLI process, and the proxy child installs an empty
PersistentPostRun. Its pinning test is repurposed to the contract that
is real — a persist failure must not block the already-decided skip.
- Registered backup.size-cap-mb / backup.size-warn-interval in
YamlOnlyKeys, so the backup block is a complete inventory again.
Functionally inert: the map has no enumerator and its one predicate
consumer already matches on the "backup." prefix.
- `bd backup status` prints "Size cap: unavailable (<err>)" instead of
dropping the line, and the JSON error object carries an explicit null
`exceeded` so a consumer cannot read a missing key as "not exceeded".
The CHANGELOG's cost claim is corrected to match the shipped order; it
described the throttle as sufficient, which is the defect above.
Iteration 2, all non-gating (that review approved):
- The walk-error path re-arms the interval throttle itself before
proceeding uncapped. Iteration 1 relied on the fall-through into
runBackupExport to bound that warning to once per backup.interval,
but not every runBackupExport exit persists state.Timestamp: a failed
post-sync GetCurrentCommit returns without saving state, so the walk,
the warning and the sync itself repeated on every command. The doc
comment now states the bound the code has: once per interval whenever
backup_state.json can be written.
- `bd backup status` echoes the configured backup.size-cap-mb when the
cap is disabled instead of a literal 0. viper's GetInt also resolves
an unparseable value ("2048MB") to 0, so the line asserted a value the
operator never wrote.
- The status readers count only a destination that does not exist yet
as empty. getDirSize aborts on the first per-entry error, so a chunk
file removed mid-walk read as 0 bytes, i.e. `"exceeded": false` for a
destination that may be over its cap. It is now reported as
unavailable, like any other walk error.
- docs/reference/configuration.md no longer says `--json` reports the
string `PAUSED (cap exceeded)`; it reports `size_cap.exceeded: true`.
- TestMaybeAutoBackup_CapCheckSkippedWhenThrottled seeded the same commit
as its watermark, so after iteration 1's reorder change detection
alone stopped the walk: it passed with the interval throttle deleted,
and so did every other Backup/Throttle/Auto test in cmd/bd. It now
seeds a changed commit, and its comment names the renamed
pauseAutoBackupForSizeCap.
Tests: iteration 1's four new/updated pins are each mutation-proved.
Dropping the throttle re-arm reds the three throttle pins and leaves the
idle pin green; restoring the original ordering reds only the idle pin;
reverting both reds all four. Iteration 2's three new pins each go red
under their own mutation only: dropping the walk-error re-arm, restoring
the literal `=0`, and swallowing a walk ENOENT (dropping the root stat
reds the missing-destination case instead). Disabling the interval
throttle now reds the throttle test.
Base refresh before approval (rebased onto main 3f9561db2b, which had
made the PR CONFLICTING):
- main 8269a88cbf (#6327) moved compact onto storeSizeBytes and
deleted getDirSize from compact.go, leaving backup_cap.go its only
caller, so the merged tree failed to build (undefined: getDirSize)
although only CHANGELOG.md and backup_auto.go conflicted textually.
getDirSize is restored verbatim in backup_cap.go (plus the
path/filepath import), and the two comments that described it as
shared with, or exercised by, compact.go are corrected.
- main 4e4ebdb443 (#6879) added acquireBackupLock where this commit
places the size-cap check. Both are kept, the cap check first, as
its comment asks: a skip should not first take the lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* feat(config): model shared remotesapi endpoint
Agent-Signature: omp-gpt-5.6-unknown-reasoning on behalf of mccraigmccraig
* feat(doltserver): manage remotesapi lifecycle
Agent-Signature: omp-gpt-5.6-unknown-reasoning on behalf of mccraigmccraig
* test(doltserver): pin remotesapi lifecycle contracts
Agent-Signature: omp-gpt-5.6-unknown-reasoning on behalf of mccraigmccraig
* fix(doltserver): warn on auto-start remotesapi gap and reword remedy to stop/start
Review fixes for PR #6020 (bee-ghosttrack, 2026-09-03 / 2026-09-25):
- verifyRemotesAPIState guidance no longer names 'bd dolt restart', which
does not exist in this PR's layer; it now prescribes
'bd dolt stop && bd dolt start'. Test assertions updated to match.
- EnsureRunningDetailed's fast path warns and keeps serving SQL when a
running server predates the configured remotesapi listener, instead of
failing every bd command until a restart. Explicit lifecycle paths
(Start, adoption) still fail hard. BEADS_DOLT_REMOTESAPI_PORT is a
pre-existing federation knob, so this running-without-listener state is
expected on upgrade, not a broken install. Pinned by an added
EnsureRunningDetailed case in the existing lifecycle integration test.
Agent-Signature: omp-fable-5 on behalf of mccraigmccraig
* docs(changelog): document remotesapi listener rollout and wildcard-bind caveat
Review fixes for PR #6020 (items 2 and 3): BEADS_DOLT_REMOTESAPI_PORT
changes meaning with this PR (federation-check knob -> actually opens the
listener on the managed server), and the listener binds all interfaces
unauthenticated, unlike the 127.0.0.1 SQL listener. Both now land with the
mechanism: a CHANGELOG entry plus the same caveat on Config.RemotesAPIPort.
Agent-Signature: omp-fable-5 on behalf of mccraigmccraig
* fix(review): address adopt-pr review findings for #6020
Maintainer fixup for the four major findings in the attempt-1 synthesis,
plus the two cheap minors in the files already being touched.
major/Change Impact: cmd/bd/doctor/federation.go resolved the remotesapi
port from configfile alone, so a shared server launched from the
user-global dolt.remotesapi-port key was diagnosed against 8080 and
reported StatusError for a correct configuration. Resolve through
doltserver.ResolveRemotesAPIPort (the same chain the launcher uses) and
report a resolved 0 as "listener disabled" instead of dialing port 0.
This also gives the new exported resolver its first production caller.
major/Test Evidence: TestMain redirected HOME to an empty temp dir, which
hid dolt's identity file, so dolt init failed "Author identity unknown"
and TestRecoverPreV56DoltDir and TestEnsureDoltInit_WritesMarker silently
became skips. Configure a dolt identity inside the isolated home
(configureDoltIdentity mirrors lifecycle_integration_test.go's helper,
which this build tag cannot see). Both tests run and pass again; the two
skip messages now name the real cause instead of "dolt may not be
installed".
major/Resource Lifecycle: TestMain called SweepOrphanedTestServers(),
whose own doc says verbatim not to call it from TestMain because the
global arm can reap a still-running foreign suite's servers. Switch to
the suite-scoped pattern already used by testmain_integration_test.go:
SweepDeadSuiteRoots before the run, an owner marker on our own root, and
SweepSuiteTestServers after.
major/Debuggability: EnsureRunningDetailed took the exclusive lifecycle
flock unconditionally, including on the already-running fast path that
was lock-free before the lock unification, so one wedged holder could
hang every bd command on the machine silently and indefinitely. Check
IsRunning first and acquire only when a start is actually needed; the
slow path re-checks under the lock and releases before adopting, keeping
the 500ms ProbeRemotesAPI dial out of the exclusive region.
acquireLifecycleLock now follows the pre-unification two-step pattern:
try non-blocking, and announce on stderr before any blocking wait.
minor/Contract Fidelity: the TestMain comment claimed an isolation
boundary the code did not provide. Clear the operator's whole BEADS_*
namespace by prefix (preserving BEADS_TEST_*) so the claim is true.
Measured: with BEADS_DIR/BEADS_DOLT_SERVER_* exported the package failed
TestDefaultConfigReturnsZeroForStandalone,
TestDefaultConfigPortFileTakesPrecedence and
TestResolveServerMode_HostInferredExternal; it is now green bare.
minor/Test Evidence: add testmain_test.go to the go_test srcs via
make bazel-sync, so a bazel run gets the isolation TestMain too.
Iteration 2: the non-gating minors from the attempt-2 synthesis that
indict text this fixup introduced.
minor/Change Impact: the federation check resolved a mode-dependent port
without classifying the mode, so on a per-project server, which bd never
gives a remotesapi listener, it prescribed "bd dolt stop && bd dolt
start", a loop that reproduces the same error, and its disabled-listener
Detail named a shared server the workspace does not have. Classify once in
a new checkRemotesAPIListener helper (IsSharedServerModeForDir +
ResolveRemotesAPIPortForMode, the same resolution as before): the shared
arm keeps the restart remedy, the per-project arm names --remotesapi-port
<port> or shared-server mode.
minor/Test Evidence: TestCheckRemotesAPIListener covers the running-server
arm the three getter tests never reach: the user-global port, the env
override, and the per-mode remedy and disabled-listener Detail.
Mutation-checked: restoring the shared-only strings reddens exactly the
two per-project subtests; restoring configfile-only resolution reddens
five of six.
minor/Contract Fidelity: dolt reads its global config from DOLT_ROOT_PATH
before HOME, so an exported DOLT_ROOT_PATH broke the TestMain isolation
claim: TestRecoverPreV56DoltDir and TestEnsureDoltInit_WritesMarker went
back to skipping while dolt wrote into the operator's directory. Pin it to
the isolated root. Measured with an identity-less DOLT_ROOT_PATH exported:
both tests SKIP without the pin and PASS with it, and the operator's
directory stays empty.
Not taken: a guard test for the lock-free fast path (the prescribed live
non-dolt PID fixture cannot reach it, since IsRunning's isDoltProcess check
reports such a PID as not running; a real guard needs a real server in the
integration build), and the inert-sweep nit (no test in this build starts
a server, and pinning TMPDIR for the whole suite is broader than the nit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(doltserver): clear port env in target-overrides subtest
Merging main brought in check 2c (#5934): an env-supplied
BEADS_DOLT_SERVER_PORT / BEADS_DOLT_PORT classifies any target external.
ResolveServerModeForMode honors it, so DefaultConfig keeps main's
resolution, but that made this subtest's "want owned" depend on the
developer's shell. Under -tags integration, whose TestMain does not
scrub BEADS_*, it failed on any host exporting a port var, while the
PR head passed the same run. Clear both, as main's own owned-expecting
resolver tests do.
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>
* fix(uimd): render bd show DESCRIPTION with terminal's actual background
glamour.WithEnvironmentConfig() defaults to styles.DarkStyle whenever
GLAMOUR_STYLE is unset, with no light/dark auto-detection. That left
the DESCRIPTION section's markdown body always dark-themed regardless
of the terminal's real background, even though internal/ui already
detects it (lipgloss.HasDarkBackground) for the header and every other
adaptive color in bd's output. Result: unreadable low-contrast body
text on light-background terminals.
Export internal/ui's detected background as IsDarkBackground and have
internal/uimd pick glamour's "light" or "dark" style from it, still
honoring an explicit GLAMOUR_STYLE override first.
Fixes#5775
* test(uimd): pin glamourStylePath, add CHANGELOG entry, harden IsDarkBackground
Address PR review requests on #5776:
- Add a table test for glamourStylePath() covering the GLAMOUR_STYLE
override and the dark/light background branches.
- Add a CHANGELOG entry under Unreleased, scoped to every markdown body
bd prints (DESCRIPTION, DESIGN, NOTES, ACCEPTANCE CRITERIA, comments,
direct and proxied), not just bd show's DESCRIPTION field.
- Turn ui.IsDarkBackground from an exported mutable variable into an
accessor over an unexported one, with a SetDarkBackgroundForTest seam
for the new table test.
- Document why glamourStylePath's read of the background can never see
an unprobed zero value: it only runs under the same ui.ShouldUseColor()
gate that guards the probe.
* docs(recovery): refresh init-safety.md freshness marker
CI doc-flags-freshness check flagged Last reviewed as stale
(2026-06-09, 110 days). Content unchanged, marker bumped.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* chore(bazel): sync internal/uimd BUILD.bazel for the new test imports
markdown_test.go gains `charm.land/glamour/v2/styles` and
`internal/ui`, but `go_test(name = "uimd_test")` carried no `deps`
attribute, so `make bazel-sync` (gazelle) rewrites the file. The
advisory Bazel lane's "BUILD files in sync" step runs that exact
command and `exit 1`s on any porcelain drift, and it arms
unconditionally for fork PRs.
Generated with `make bazel-sync`, the remedy the gate itself prescribes.
No hand-written lines.
* fix(uimd,changelog): pin the style wiring at RenderMarkdown, move the entry to Unreleased
Both review lanes filed the CHANGELOG placement and codex filed the test gap;
this takes both. Neither needed a production change.
CHANGELOG: the 16-line entry was added inside `## [1.3.0] - 2026-09-15`, a
shipped and tagged release, so it rewrote published history for a fix that was
not in 1.3.0 and the next release cut would not have picked it up. Moved under
`## [Unreleased]`, at the END of its first `### Fixed` list rather than the top:
main is appending new entries at the top of that list constantly, and an
insertion there makes the adopted head conflict with main for no benefit
(measured -- top placement gave `git merge-tree` a CHANGELOG conflict, the tail
placement merges clean). The bullet text is byte-identical to the contributor's.
Test: TestGlamourStylePath pinned the helper but nothing pinned
markdown.go's `glamour.WithStylePath(glamourStylePath())`, so the whole
user-visible fix could be reverted with a green suite. Codex confirmed that
empirically and so did this change: reverting that one line to
`glamour.WithEnvironmentConfig()` leaves every pre-existing test in the package
PASSING -- including all four TestGlamourStylePath subtests -- and reds only the
new TestRenderMarkdownUsesTheDetectedBackgroundStyle. The new test renders one
sample under each background and requires the output to differ, so it detects
exactly that regression and nothing else.
The nit (SetDarkBackgroundForTest not re-running initColors) is left alone: the
synthesis marks it "none for merge" and today's only caller reads the flag.
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(cli): stop eleven subcommands shadowing the root --json flag
--json is a persistent flag on rootCmd bound to jsonOutput. Ten
subcommands (restore, admin compact, repo add/remove/list/sync,
migrate, migrate sync/hooks/schema) also registered a local --json bound
to the same variable. pflag's AddFlagSet keeps the local flag and drops
the inherited one, so rootCmd.PersistentFlags().Changed("json") stayed
false for those commands; PersistentPreRunE and
refreshBoundCommandConfig then treated the flag as unset and reset
jsonOutput from config. `bd restore <id> --json` and friends printed text
unless config said json: true. restore_embedded_test.go recorded the
symptom as a "known issue" and skipped its JSON assertion.
bd preflight registered an unbound local Bool("json") instead; it read
its own flag and was not affected by the reset, but it shadowed the root
flag the same way and ignored a configured json default. It now inherits
the root flag like status, update and the proxied close/reopen routes.
Remove the eleven local registrations. Add
TestNoSubcommandShadowsRootJSONFlag, which walks the command tree and
fails on any command that registers its own --json (local or
persistent). Restore the restore_json assertion (parse the output, check
ID and description). Flip the compact and migrate schema registration
tests to assert the flag is inherited, matching stale_test.go.
Visible change: --json moves from each command's Flags section to Global
Flags in --help, with the root description. docs/cli-reference is pinned
to the release tag and regenerates at release time.
* fix(cli): make the --json shadow guard side-effect free
TestNoSubcommandShadowsRootJSONFlag walked every command through
LocalNonPersistentFlags(), and the --json assertions in compact_test.go and
migrate_test.go used InheritedFlags(). Both call cobra's
mergePersistentFlags(), which copies every root persistent flag into the
command's Flags() for the rest of the test process. TestServeFlags pins the
exact flag set of `bd serve`, so `go test ./cmd/bd` failed whenever it ran
after the guard; CI only stayed green because the two tests land in
different name-hash shards.
Compare the command's Flags().Lookup("json") against the root flag pointer
instead. A local registration is a different *pflag.Flag; an inherited one
is the same pointer, and a command that has not merged yet returns nil.
Verified: the four tests pass together, and re-adding a local --json to
`bd restore` still fails the guard.
bd preflight also drops its `jsonOutput, _ := cmd.Flags().GetBool("json")`
shadow of the package-level variable. The root flag is bound to that
variable and PersistentPreRun already resolves the flag/config precedence,
so the local copy was redundant and swallowed the lookup error.
* review: re-key the preflight --json test to the root flag
Base #6293 added TestPreflightJSONFlagBindsGlobal, which opens by requiring
preflightCmd to own a local --json. This PR's guard forbids exactly that, so
the two tests were mutually exclusive and the adopted head was red. The base
test arrived with a base advance after this PR was written, so nothing in the
contributed work is wrong.
Adapt the test rather than restore the local flag: every property it pins
survives re-keyed to the root persistent flag, which is BoolVar'd to the same
package global. The opening assertion becomes the shadow-aware compare this PR
already introduced in compact_test.go, the Changed==true branch is driven
through rootCmd.PersistentFlags().Set (flag.Value.Set never sets Changed), and
the config half is unchanged. Renamed to TestPreflightJSONInheritsRootFlag so
the name stops asserting the very thing the PR removes.
Also correct three CHANGELOG clauses that were true against the contributor's
older base and false at this one: #6293's commandJSONFlagChanged already
consults a subcommand's own Changed bit before the root's, preflight's local
flag was bound rather than unbound, and #6293 already announced that preflight
honors the json config default. The bullet now claims what this PR delivers
here -- deleting the shadowing registrations instead of compensating for them.
Compile the new guard into the Bazel test target. cmd/bd/json_flag_shadow_test.go
was absent from the explicit srcs of go_test(name = "bd_test"), so the invariant
this PR exists to create never ran in the BAZEL* lanes -- and those lanes are
required for merge: CI_GATE_REQUIRED on origin/main lists BAZEL, BAZEL_TEST,
BAZEL_PURE, BAZEL_EMBEDDED, BAZEL_DOLTSERVER, BAZEL_PROXIED and
BAZEL_SERVER_STORAGE. Added in sorted position between jira_test.go and
kv_embedded_test.go; the file is untagged package main, so bd_test is the right
target under the root gazelle:build_tags gms_pure_go. make bazel-sync-check
cannot catch this -- it maintains only the go_srcs filegroup globs, not go_test
srcs.
Finally, reconcile the neighbouring #6293 bullet, which this PR invalidates. It
still described preflight's --json as "bound to the same global every sibling
command binds" and closed on "because an unbound flag reports as unset" -- both
describing the local registration deleted here, fourteen lines from the bullet
announcing the deletion and shipping in the same [Unreleased] section. Trimmed
to the user-visible outcome #6293 still owns; the new bullet carries the
registration story.
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>
* feat(issueops): type the blocked-close refusal as BlockedError
Every close-policy blocker refusal was fmt.Errorf("%w: %s is blocked by
%v", ErrCloseBlocked, ...), so the blocker list existed only as prose. A
caller reporting the refusal elsewhere (the HTTP surface) had to parse it
or drop it.
issueops.BlockedError carries IssueID, the typed []Blocker (id plus the
blocking edge type when known) and the wrapped sentinel. Its message is
byte-identical to the historical sentence, so the direct and proxied CLI
lines and failed[].error do not move, and errors.Is(ErrCloseBlocked) still
matches. The sentinel is a field rather than fixed so other "X is blocked
by Y" refusals (e.g. a blocked claim) can reuse the type.
The in-transaction guard keeps the edges typed (isBlockedByInTx, with
IsBlockedInTx formatting through Blocker.String), and the external guard
builds the error from IsBlocked's []string via ParseBlocker, the inverse
of that spelling.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(httpapi): name the blockers on a live-blocker not_closable
The served close refusal said only "issue is blocked", so an HTTP client
could not tell the user what held the close, while bd close on the direct
and proxied routes prints "cannot close blocked issue: X is blocked by
[Y]".
A live-blocker not_closable now carries a `blockers` extension member,
[{id, kind: local|external, type?}], read from *issueops.BlockedError's
typed list, and a detail that opens with the direct route's sentence
built from the same list. It covers issues/{id}:close, per-item
issues:batchClose outcomes, PATCH into a done status and
issues:batchApply. The code, status and open_children discriminator are
unchanged; an error that only mentions blockers in prose keeps the old
generic detail and no member.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(issueops): test the external: prefix before the type split in ParseBlocker
Maintainer review fixup for #6893.
ParseBlocker tried the " (" / ")" split before the external: prefix
branch, so it won for any external reference whose capability ends in
")". validateExternalRef (cmd/bd/dep.go) constrains a capability to
non-empty only, so `external:remote:pay (beta)` is a legal reference
created by the sanctioned `bd dep add` path -- and it parsed to a
truncated ID of "external:remote:pay" plus Type "beta", a value outside
the documented blocks|waits-for|conditional-blocks vocabulary that
falsifies the spec's own promise that an external blocker carries no
type.
Only the structured half was wrong: the mis-split round-trips through
String(), so the prose detail and the CLI sentence stayed byte-identical
and the failure was silent on exactly the new `blockers` member this
change exists to make trustworthy.
Hoisting the prefix test is loss-free -- Blocker.Type's doc comment
already states an external reference never carries a reported type.
Pin: the ParseBlocker/String table in
TestBlockedErrorKeepsTheHistoricalSentence gains the paren-suffixed
external row; every external case tabled there was paren-free, which is
why this got through. Restoring the old ordering reds the new row.
The DeepEqual failure now prints %#v, because Blocker implements
String() and the default verbs render got and want identically for
precisely this defect.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
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>
* fix(utils): refuse a bare jq/JS sentinel as an issue ID
`jq -r` prints the literal string "null" when a selector misses, and JS
tooling prints "undefined". Both are a valid partial-ID shape, so
ResolvePartialID accepted them and resolved them through its leading-prefix
abbreviation branch: any issue whose hash began with the token became the
target, and the write reported success naming an issue the caller never
mentioned.
Reproduced on stock beads at a07794015, embedded Dolt, scratch workspace,
no orchestrator:
bd init --prefix bd
bd create --id bd-null3t0 "decoy: must not be touched"
bd update null --status closed
✓ Updated issue: bd-null3t0 — decoy: must not be touched (exit 0)
HasPrefix), so this needs a hash that begins with the token — the same case
The guard sits in ResolvePartialID rather than in a command because
internal/utils/id_parser.go is the only ID-resolution entry point in the
repository: 52 non-test call sites across 29 files, plus 2 through the
ResolvePartialIDs wrapper, and the four cmd/bd/*_proxied_server.go twins
resolve through the same function. One guard covers the direct, embedded and
proxied-server paths uniformly.
The riskiest thing this does is add a refusal to the resolver every command
shares. An ID that merely contains a token (bd-null, null3t0,
undefined-behavior) is unaffected, abbreviation matching is otherwise
unchanged, and the empty string already failed — it now says why.
Case folding is deliberate: NULL is what SQL-shaped tooling prints.
Whitespace is trimmed for the comparison only, never for resolution.
The tests use a nil store so the ordering is observable: reaching the
"storage is nil" error proves the guard did not fire. Mutation-tested — with
the guard reverted all eight refused inputs fail and the seven accepted
inputs still pass.
Fixes#6214
Refs #5393
Agent-Signature: claude-code-opus-5-unknown-reasoning on behalf of Cherub Kumar
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SDrKFyrfKTKM5J9yFbW7uA
* fix(utils): refuse none/nil too, and list the new test in the Bazel srcs
Maintainer review fixes for #6215, review iteration 1. Both lanes and the
scorecard returned approve with no required changes; this commit takes the two
actionable minors, both of which land inside the PR's own change.
Taken:
- Behavioral Correctness (minor). `bd update None --status closed` still reached
the leading-prefix abbreviation branch: strings.ToLower("None") is "none" and
every character passes looksLikePartialIDHash, so it could silently write to
whichever issue's hash begins "none" and exit 0. `nil` is the same class. That
is the identical silent-wrong-write harm this PR exists to prevent, and the
remedy lands in the switch the PR just added, so "none" and "nil" join the
same case arm and the refused-inputs table.
The error text is generalized with them: "none" is Python and "nil" is
Go/Ruby, so the previous jq/JS-only wording would have mis-described the two
new tokens.
- Change Impact / Blast Radius (minor). The PR adds two TestX functions that
`go list` selects for internal/utils but that Bazel's utils_test target could
not compile or run -- exactly what tools/bazel/equivalence.py reports as
`missing`. Gazelle's verdict, not a hand-guess: `make bazel-sync` produced
exactly `+ "id_parser_sentinel_test.go",` for internal/utils/BUILD.bazel. It
also rewrote 13 other BUILD.bazel files (pre-existing base drift), which is out
of scope here, so that output was reverted and only this PR's row re-applied at
gazelle's chosen slot. utils_test is 10 entries, sorted, no duplicates, all on
disk.
Note the review predicted the regen would also add `+ "//internal/debug",` to
this file's go_library deps "once rebased on main". It did not at this base,
because the import that needs it is not present here -- that dep is
base-owned drift and is already tracked separately.
Over-refusal is guarded, not assumed: the pre-existing accepted-inputs test
(nullos, null3t0) and the whole ResolvePartialID suite -- cross-prefix,
allowed-prefixes, wisp, title-false-positive -- all still pass.
Validation: gofmt clean, go build ./... and CGO_ENABLED=1 go vet ./internal/utils/
clean; 42 PASS / 0 FAIL / 0 SKIP over -run "Sentinel|ResolvePartialID". The new
rows are mutation-proved: dropping "none" from the case arm reds
TestResolvePartialIDRefusesSentinelTokens, and restoring returns rc=0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Cherub Kumar <5449665+ckumar1@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(formula): reject a waits_for gate that has no spawner to wait for
waits_for = "all-children" (or "any-children") names no spawner, so
collectDependencies infers one from needs[0] and emits no dependency at
all when the step has no needs. Validation accepted that step, cooking
gave it a gate:all-children label, and the result was a step with zero
dependencies that is ready immediately — a fan-in that silently never
fans in. Only the label survived to suggest otherwise.
Reject it where the intent is still visible, naming both repairs: add
needs, or name the spawner with children-of(step-id), which carries its
own spawner and stays valid without needs. depends_on is deliberately not
accepted as a substitute, because the inference does not read it.
The fan-in example in docs/workflows/gates.md taught exactly the broken
shape — a summarize step with waits_for and no needs — so it is corrected
here alongside, with the spawner step it was missing.
* fix(formula): make a validation failure distinguishable from "not a formula"
Callers that resolve a name as a formula and fall back to a proto/issue
lookup have no way to tell the two apart, so a formula that exists and
does not validate is reported as not found and its real error is thrown
away. The spawnerless waits_for gate rejected above lands in exactly that
path.
ErrVarValidation already exists for the same reason, covering bad --var
values. Give Validate the matching sentinel; the message it produces is
unchanged. Wiring the fallbacks to it is a separate change.
* fix(mol): report an invalid formula instead of calling it not found
pour, wisp, bond and seed resolve a name as a formula first and fall back
to a proto/issue lookup. Any error from the formula path was treated as
"this is not a formula", so a formula that exists and fails validation
came back as "'<name>' not found as formula or proto ID" — with bd
formula list happily showing it. The real error was never printed, and
the advice to run bd formula list confirmed the wrong diagnosis.
Each fallback now reports a validation failure directly, the way it
already does for the bad --var values ErrVarValidation covers. A name
that really is not a formula is unaffected.
* fix(mol bond): make --dry-run validate the formula the real bond validates
resolveOrDescribe resolved a formula name with parser.LoadByName, which
never calls Formula.Validate - LoadByName -> loadFormula -> ParseFile does
not, and only parser.Resolve does. The real bond path
(resolveAndCookFormulaWithVars) calls Resolve, so the dry-run previewed
"will cook as proto" for every formula the real bond rejects, including
for the waits_for-without-a-spawner rule this branch adds. The function's
own comment already promised the opposite.
resolveOrDescribe now resolves before it validates provided vars, which
also means the --var check runs against the merged formula rather than the
unmerged one, so a var declared only in a parent is checked too. The two
error wrappings match the real path's, so the routes produce the same
message rather than merely the same exit code.
TestBdMolBondDryRun_RejectsInvalidFormulaLikeTheRealBond runs both routes
against the same invalid formula and asserts they agree - both fail, both
name waits_for, neither reports it as "not found as issue or formula". It
reproduces the gap against the old code:
dry-run previewed a bond the real bond rejects:
A: dryrun-invalid-gate (formula -> will cook as proto)
Also from review:
- validation_sentinel_test.go uses strings.HasPrefix instead of a slice
that would panic with index-out-of-range rather than failing cleanly if
the message ever shortened.
- Step.WaitsFor's field doc now states the needs requirement, and
schema_gen.go is regenerated from it, so the generated schema documents
the rule the validator enforces. docs/workflows/gates.md already said it.
The condition-filtering follow-up is filed as GH#6437: Validate runs
inside parser.Resolve, before FilterStepsByCondition, so a spawner dropped
by a false condition still reaches collectDependencies as a dangling
reference and is skipped silently - the same zero-dependency gate, past
the new check.
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>
* test(mol bond): assert the dry-run gap in process, not through a subprocess
The regression test spawned an embedded bd and ran two CLI invocations,
which is the most expensive shape of test in cmd/bd - and cmd/bd already
runs 477s of its 600s budget on the macos runner, so the addition timed
the package out.
The process boundary was never what the test was about. resolveOrDescribe
and resolveOrCookToSubgraph are both reachable directly with a molReader
that answers "no such issue", and GT_ROOT puts a temp formula dir on
formula.DefaultSearchPaths without touching HOME or the working directory.
Same assertion - the two routes agree, both name waits_for, neither
reports an invalid formula as not found - in 0.03s instead of 18s.
Asserting the routes against each other rather than against a literal
message is deliberate: it is what stops a validation rule added later from
re-opening the same gap. The LoadByName control is now explicit too, since
that call still accepting the formula is the reason the bug existed; if it
ever starts validating, the comparison stops distinguishing anything and
the test says so instead of passing quietly.
Second case added while here: the dry-run validated --var values against
the UNMERGED formula, so a constraint declared only in a parent went
unchecked. Resolving first fixes that as well, and an extends chain with
the enum in the parent pins it:
dry-run accepted a var value the real bond rejects; the enum is
declared only in the parent (real bond said: formula "dryrun-child":
variable validation failed:
- variable "env": value "staging" not in allowed values [dev prod])
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>
* chore(bazel): enumerate the PR's two new test files in go_test srcs
Base added cmd/bd/BUILD.bazel and internal/formula/BUILD.bazel after this
branch's merge base, so the two untagged _test.go files this PR adds were
absent from their go_test srcs lists. Generated by 'make bazel-sync'
(bazel run //:gazelle); no hand edits. A second sync is a no-op.
* docs(formula): correct the waits_for spawner doc and the dry-run parity claim
Maintainer review fixup for the adoption of #5761 (review iteration 1
pre-merge checklist). Wording only -- no control flow changes.
internal/formula/types.go: the new Step.WaitsFor doc said "Requires needs
(or depends_on)", but Formula.Validate receives only step.Needs and cook
infers the spawner solely from Needs[0] (cmd/bd/cook.go:961-962) -- the
DependsOn loop never feeds waitsForSpawnerStepID, and the struct doc's
"merged during cooking" happens after Validate. A depends_on-only bare gate
is therefore correctly rejected: the code and the error message are right,
only the comment was wrong, and it shipped into the generated schema surface
agents read. docs/workflows/gates.md already states it correctly.
Regenerated schema_gen.go with `go generate ./internal/formula/`.
CHANGELOG.md: "so it fails on exactly what the real bond fails on" was an
overclaim. The dry-run now resolves and validates the way the real bond
does, but five later real-path failure surfaces (inline expansions,
expansions, aspect load/type, condition filtering) stay outside the preview.
Named that boundary rather than claiming total parity.
Contributor commits untouched.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(mol): print a real dispatch command in mol ready --gated
The gate-ready listing ended with "bd sling <agent> --mol <molecule-id>".
No bd binary has ever had a sling command: sling belongs to the gastown
orchestrator (gt sling), and the line was a hardcoded Println with no
implementation behind it. Following the hint gives "unknown command".
Print the bd-level action instead. The listing already knows each
molecule's ready step, so the hint names that step's ID and the assign
command that actually dispatches it; agents pick work up by claiming a
step, which is what puts a molecule in the hooked status this command
filters on.
The regression test resolves the printed command against the root command
tree, so a future hint cannot name a command that does not exist.
* fix(mol): stop a --ref arm from deadlocking the molecule it bonds into
bd mol bond <proto> <mol> --ref <name> gave the spawned arm two
relationships to mol at once: ParentID nested it under mol, and
AttachToID added a blocking dependency ON mol. Those cannot both be
satisfied. The arm waits for mol to close; mol cannot close while it
holds an open arm child. bd ready empties out with nothing naming the
cause, and the only escape is closing the parent by hand.
The documented Christmas Ornament example is exactly this shape --
"bd mol bond mol-worker-arm bd-patrol --ref arm-{{worker_name}}" takes
the default sequential bond type, so the primary use of --ref deadlocked.
Nesting already attaches the arm, and its dotted ID records it, so the
blocking edge is dropped for a nested arm rather than pointed somewhere
else. A bond without --ref is untouched: that arm is a sibling, mol
closes, and the arm then unblocks, which is satisfiable and stays. A
parallel bond never blocked and is likewise unchanged.
* fix(mol bond): refuse --ref with --type conditional instead of inverting it
Dropping the attachment edge for a nested --ref arm traded a deadlock for
lost ordering, which is defensible for a sequential bond but not for a
conditional one. DepConditionalBlocks means "B runs only if A fails"
(internal/types/types.go), so dropping it does not lose ordering - it
inverts the meaning, turning an arm that should almost never run into one
that always runs. That is a silent false dispatch, strictly worse than the
visible deadlock it replaced.
refuseConditionalRefArm now rejects the combination, consulted both from
gatherMolBondInput (so --dry-run and the proxied route refuse identically,
rather than previewing a bond the real command rejects) and from
buildAttachCloneOpts (so a caller that skips flag validation cannot
construct the arm either). The drop in buildAttachCloneOpts narrows to
DepBlocks, so a future bond type reaching that point is not silently
stripped of its edge as well.
The sequential case keeps the drop, and the loss is now stated rather than
implied: bond's long help says a --ref arm carries no ordering and is ready
as soon as it is spawned, and the CHANGELOG entry says the same. The
committed docs/cli-reference/mol.md is generated from the tag in
docs/cli-docs.pin, so it picks the wording up at the next release
regeneration - hand-editing it fails the drift gate.
Also from review: the parallel arm's redundant-but-satisfiable
DepParentChild edge is now explained rather than merely test-pinned, and
`bd mol ready --gated` says which molecule its dispatch example belongs to
when more than one is listed. registerMolBondFlags is extracted so a test
can build an isolated command instead of mutating the package-level one.
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>
* 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>
* chore(bazel): enumerate the PR's two new cmd/bd test files in go_test srcs
gazelle-generated. Both files are untagged (no //go:build), so the
bazel go_test target owes their enumeration; the in-package census showed
the gap was exactly these two and zero pre-existing untagged gaps.
Note make bazel-sync-check exits 0 on the un-synced head, so only the
literal make bazel-sync surfaces this.
* fix(mol): correct the --ref help, the refusal message and the hint header
Review iteration 1 on PR #5759. All four synthesis findings are minor or nit
with no gating impact (scorecard 967/850, Required Changes: None); taken
because a maintainer commit already exists on this branch (d66096104), so the
push is owed either way.
Finding 1 (minor) - the new --ref help paragraph asserted "B is nested inside
A", which is inverted for the proto+mol order that every --ref example in the
same help text uses: for aIsProto && !bIsProto the dispatch passes issueB as
mol, so ParentID is B. Rephrased by role, matching the CHANGELOG's own neutral
wording, and de-positionalized the parenthetical in the same paragraph, which
named A as the container too.
Finding 2 (minor) - the conditional + --ref refusal claimed "a nested arm
cannot be ordered against the molecule that contains it" from
gatherMolBondInput, which runs before operands are resolved and so also
refuses mol+mol and proto+proto, where --ref is inert and nothing nests.
Reworded to state the nesting rationale as what --ref does where it applies
rather than as a claim about the bond in front of the user.
Finding 3 (nit) - the ordering-trade comment claimed docs/cli-reference/mol.md
already documents the trade. It does not: that page is generated from the
release named in docs/cli-docs.pin (v1.2.2), whose source has zero hits for
"nested inside". Softened to name the long help as the documented place and
mol.md as where it will appear once the pin advances. mol.md is deliberately
untouched - hand-writing it would diverge from the pinned generator output and
red a currently-green required check.
Finding 4 (nit) - "for the first one above" could name a different molecule
than the step ID printed beneath it, whenever the first listed molecule has no
ready step and a later one does. Both offered arms miss that case (indexing
element 0 and dropping the fallback nil-derefs; suppressing the line only when
NO molecule has a step leaves the disagreement intact), so this implements the
stated intent instead: firstReadyStepID also returns the listing position and
the header names it.
Deviations, with the measurements behind them:
- Finding 2's "leave the nesting rationale on the attach-path error" arm was
not taken as a message split. gatherMolBondInput runs at mol_bond.go:104,
before the usesProxiedServer() branch, and buildAttachCloneOpts is reached
only via bondProtoMolWithSubgraph/bondProtoMolAttachInto downstream of it, so
the attach-path string is unreachable from every CLI route; split that way
the corrected wording is all any user would see and the rationale would be
dead text. One shared, shape-agnostic message keeps both true. Verified from
the CLI: `mol bond no-such-a no-such-b --type conditional --ref arm-ace`
refuses (rc 1), while the same nonexistent operands without --type
conditional reach operand resolution and fail there.
- Finding 2's alternative arm (scope the gather-time refusal to the attach
shapes) would falsify this PR's own CHANGELOG entry, which states the
combination is "refused outright (including under --dry-run and on the
proxied route)".
- No mol+mol refusal test was added: gatherMolBondInput never resolves
operands, so mol+mol and proto+mol are the same input to it and such a test
would be vacuous.
- Artifact sweep for the inverted claim came back empty: CHANGELOG.md and the
PR body already describe the nesting by role ("nested inside its target"), so
the A/B inversion existed only in the help paragraph.
Tests: the PR's 9 tests plus the new one pass by name (go test ./cmd/bd/ -run
'TestBuildAttachCloneOpts|TestGatherMolBondInput|TestGatedReadyHint' = 10 PASS
/ 0 FAIL; the full cmd/bd package does not finish). Mutation proof that the new
pin is not a duplicate: hardcoding the header position to 1 - the pre-fix
meaning - reds only
TestGatedReadyHintHeaderNamesTheEntryItPrinted/example_comes_from_a_later_molecule
while its sibling subtest and all 9 existing tests stay green. go build ./...
and go vet ./cmd/bd/ exit 0.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* storage: add RenameLabel primitive with merge semantics
Add a storage primitive that renames a label across every issue and
wisp that carries it, in one transaction per store. An issue that
already carries the new label is a merge - the stale old-label row is
dropped rather than raising a duplicate-key error - and the call
reports renamed/merged counts plus every touched id.
- internal/storage/issueops/labels.go: RenameLabelInTx sweeps the
labels and wisp_labels tables (INSERT IGNORE then DELETE, so the
merge never errors), emitting one EventLabelRenamed plus the usual
full-snapshot journal row per touched issue/wisp, matching
AddLabelInTx/RemoveLabelInTx's journal shape. A single batch event
was considered and rejected: the journal-completeness guard requires
every touched row to carry its own journal entry.
- internal/storage/storage.go: RenameLabel added to the Storage
interface, next to AddLabel/RemoveLabel/GetIssuesByLabel.
- internal/storage/dolt, internal/storage/embeddeddolt: direct
implementations. The dolt commit targets the fixed events/labels
table pair; doltAddAndCommit's own HasStagedChanges guard skips it
when the rename touched wisps only (wisp tables are dolt-ignored,
same as AddLabel/RemoveLabel).
- internal/storage/hook_decorator.go: HookFiringStore.RenameLabel
fires on_update per touched issue, matching AddLabel/RemoveLabel.
- internal/types/types.go: new EventLabelRenamed event type. Unlike
EventLabelAdded/EventLabelRemoved, one rename produces exactly one
of these per touched row, never a paired add+remove.
- internal/jira/tracker_test.go: mock stub for the new interface
method.
Tests: internal/storage/dolt/label_rename_test.go, against a real
dolt-sql-server container - basic rename, merge, wisp sweep,
zero-carrier no-op, over-length refusal, event assertion. All green.
Also verified TestEveryBeadMutatorJournalsOrIsExempt still passes.
Gates: gofmt clean, go vet ./... clean, CGO_ENABLED=0 go test -tags
gms_pure_go -c -o /dev/null ./cmd/bd clean, go build ./... clean.
* storage: refuse RenameLabel(x, x) instead of wiping the label
RenameLabelInTx's merge branch treats every carrier of oldLabel as
already carrying newLabel when the two names collide (they are the
same string): the batched INSERT IGNORE no-ops on every row, and the
unconditional DELETE FROM <table> WHERE label = ? that follows then
removes every row for that label plane. A self-rename silently wiped
the label instead of leaving it untouched.
Reject oldLabel == newLabel (compared after trimming, case-sensitive)
before any write, returning the new ErrRenameLabelSameName. Verified
red->green: TestRenameLabel_SameNameRefused and
TestRenameLabel_SameNameAfterTrimRefused both fail (GetLabels returns
[] on both the labels and wisp_labels planes) against the pre-fix
code, and pass against the fix. Full TestRenameLabel* suite in
internal/storage/dolt still green.
* telemetry: instrument InstrumentedStorage.RenameLabel
AddLabel and RemoveLabel already get OTel spans/metrics through
InstrumentedStorage; RenameLabel had no override and so fell through
to the embedded storage.DoltStorage passthrough, invisible to
storage.* tracing. Add the override, mirroring the AddLabel/RemoveLabel
shape: span attributes for the old/new label pair (bd.label.old,
bd.label.new, matching the existing bd.dep.from/bd.dep.to pairing
convention), and on success a bd.result.count / bd.merged.count pair
following the SearchIssues-style "set result attributes after a
successful call" pattern already used elsewhere in this file.
* storage: document the O(N) round-trip cost of RenameLabelInTx's event loop
renameLabelInPlane's per-issue loop (InsertDerivedEvent + RecordEventInTx)
is O(len(oldIDs)) SQL round trips inside one transaction, up to four per
touched issue. On a huge label population that lengthens the transaction
and raises the odds an optimistic-concurrency retry has to redo the whole
rename from scratch.
No batching added: InsertDerivedEvent's dedup SELECT is a real
cross-replica convergence check (Protocol v0.1 C2.3), not a redundant one
this transaction could skip, and no batch primitive for this shape exists
anywhere in this package - building one here would be new shared
infrastructure grown for a single caller. AddLabelInTx/RemoveLabelInTx
already pay the identical per-call cost for their one issue; this loop is
that cost repeated once per touched issue. Documented inline as a
disclosed limitation rather than silently left unremarked.
* bda-lbjv: derive rename merge count from rows-affected, not a prior read
renameLabelInPlane computed merged from a snapshot SELECT of newLabel's
carriers taken before the INSERT IGNORE - a check-then-insert whose
result is used. A concurrent AddLabel(issue, newLabel) committing between
snapshot and insert made the reported count schedule-dependent while the
stored data stayed correct (cross-model finding: the Opus panel cleared
A1, codex flipped it to NOT-SAFE on exactly this line).
Now the count is a measurement: INSERT IGNORE reports one affected row
per id actually inserted, so merged = len(oldIDs) - inserted, and the
newLabel pre-read is gone entirely.
Tests: sqlmock scripts the racing schedule (insert sees a row the
snapshot read could not); mutation control confirms the old
implementation fails the new test. Full issueops package + live-store
TestRenameLabel_* green.
* bda-c77s: first-party coverage for EmbeddedDoltStore.RenameLabel
The embedded impl had zero tests while DoltStore.RenameLabel carries a
dedicated suite; AddLabel/RemoveLabel both have parallel embedded
coverage by convention. Four wiring cases (basic, merge, zero-carrier
no-op, same-name refusal) - the deep semantics stay pinned by the shared
issueops suite and the dolt-side tests against the same implementation.
BEADS_TEST_EMBEDDED_DOLT=1: 5 RUN, all green, 2.8s.
* storage: scope the rename delete to the ids the sweep captured
An unrestricted DELETE ... WHERE label = ? makes the sweep's blast radius
engine-dependent: under current-read DELETE semantics a row a concurrent
AddLabel(oldLabel) committed after this transaction's snapshot would be
removed without ever being renamed, counted or journaled. Restricting the
delete to the captured ids touches exactly the rows the INSERT IGNORE above
accounted for on every engine; a concurrent add outside the snapshot now
deterministically SURVIVES the rename - the same observable state as that
add landing after the rename committed, which is the only order-independent
reading of the race.
sqlmock WithArgs pins the id-scoped statement shape; the embedded-Dolt
lifecycle set stays green (5/5).
* cmd/bd: add `bd label rename <old> <new>` with dry-run preview
Wire the storage.RenameLabel primitive (previous commit) into a CLI
command that renames a label everywhere it appears in one call instead
of a per-issue add-then-remove loop.
- cmd/bd/label.go: `bd label rename <old> <new> [--dry-run]`.
validateLabelRename refuses empty/identical labels and the
'provides:' reserved prefix before any store call - it is a pure
function so those rules are testable without a store. --dry-run
previews the blast radius (count plus the first issues) read-only,
via a path kept separate from the write path so it can never reach a
transaction.
- cmd/bd/label_proxied_server.go: the proxied-server route composes
the existing per-issue LabelUseCase.AddLabel/RemoveLabel (and wisp
twins) in one uow.RunTx, the same fan-out shape label propagate
already uses on this route. It journals as an add/remove pair per
issue rather than the direct route's single EventLabelRenamed,
because LabelUseCase has no rename-shaped event; the rename
semantics (merge-on-collision, honest zero-carrier no-op, dry-run
preview) are identical on both routes.
- docs/core-concepts/labels.md: documents rename, dry-run, and merge
semantics under Label Management.
Tests: cmd/bd/label_rename_test.go (pure argument-validation table
test, no store needed) plus new subtests in
cmd/bd/label_embedded_test.go covering the full CLI path - basic
rename, merge, dry-run writes nothing, zero-carrier no-op,
identical/empty/reserved-prefix refusals. All green.
Gates: gofmt clean, go vet ./... clean, CGO_ENABLED=0 go test -tags
gms_pure_go -c -o /dev/null ./cmd/bd clean, go build ./... clean.
* cmd/bd,domain: emit label_renamed on the proxied route, not add+remove
runLabelRenameProxiedServer used to fan a rename out into a per-issue
AddLabel-then-RemoveLabel pair, journaling label_added/label_removed
instead of one EventLabelRenamed - a divergence from the direct
DoltStore/EmbeddedDoltStore route the upstream reviewer has already
rejected for another PR touching the same class of proxied/direct
split.
Add domain.LabelUseCase.RenameLabel and domain.LabelSQLRepository.
RenameLabel. The repository method delegates straight to
issueops.RenameLabelInTx (r.runner satisfies issueops.DBTX
structurally), so the proxied route is not merely the same SQL SHAPE
as the direct one, it is the same function: identical merge semantics,
the same ErrRenameLabelSameName refusal, and one EventLabelRenamed per
touched issue. runLabelRenameProxiedServer now just calls
uw.LabelUseCase().RenameLabel(...) inside its existing uow.RunTx.
Declare recordingLabelUC.RenameLabel so the notifying unit of work
records one update per touched issue/wisp (mirroring
HookFiringStore.RenameLabel on the direct route) instead of silently
recording nothing through the embedded interface - caught by the
existing structural parity guard, TestRecordingLabelUseCaseCoversItsSurface,
which fails on any domain.LabelUseCase method neither declared on
recordingLabelUC nor exempted with a reason.
Tests, verified red->green:
- internal/storage/domain/db: TestLabelUseCase/RenameLabel adds 5
subtests. EmitsOneRenamedEventPerIssue is the direct regression
test - reverting RenameLabel to a simulated add-then-remove
fan-out reproduces exactly the pre-fix event counts (renamed=0,
added=2, removed=1) it now asserts against (renamed=1, added=1,
removed=0).
- cmd/bd/label_proxied_integration_test.go: new "rename" subtest
exercises `bd label rename` end to end through the real proxied
server and asserts the same label_renamed/added/removed counts
directly against the events table.
- internal/storage/uow: TestRecordingLabelUseCaseCoversItsSurface
goes red (RenameLabel inherited, records nothing) without the
recordingLabelUC override and green with it.
Full internal/storage/uow suite (287s) and the new domain/db and
cmd/bd tests all pass.
* cmd/bd: record commandDidWrite before the rename error return
runLabelRename read renamed>0 into commandDidWrite only after the
`if err != nil` early return, so a rename whose SQL side committed but
whose store call also returned an error - the Dolt publication step
failing after the working-set write landed - never marked the command
as having written. The caller's deferred auto-commit would then skip
creating a Dolt commit for a write that, on disk, actually happened.
Move the commandDidWrite.Store(true) check ahead of the error check,
matching applyLabelEdit's existing per-issue marking a few lines above
in the same file.
New test: TestRunLabelRename_CommandDidWriteSetBeforeErrorReturn wraps
a real *dolt.DoltStore in a spy whose RenameLabel reports a publish
failure (renamed>0, err!=nil) after delegating to the real rename, and
asserts commandDidWrite is set despite the returned error. Verified
red->green: reverting the ordering reproduces the exact failure this
guards against.
* bda-bnid: nolint:forbidigo on proxied bulk rename call
The route delegates to domain.LabelUseCase.RenameLabel deliberately: one
EventLabelRenamed per issue with identical merge semantics to the direct
route. Patch.Labels (the lint's suggested remedy) would reintroduce the
per-issue add/remove event divergence this delegation replaced. Matches
the file's own convention (4 sibling nolints, same shape).
Negative control: without the nolint golangci-lint forbidigo reports
exactly this line; with it, 0 issues.
* cmd/bd: address review on label rename (CHANGELOG entry, dry-run caveat, partial-failure count)
Two blocking items from review (bee-ghosttrack, PR #6009):
- Add the CHANGELOG entry for `bd label rename`, in the house voice used
by the neighboring bd-label entries (bold lead sentence, PR link, dense
explanatory prose on the merge/dry-run/partial-failure contract).
- The `--dry-run` merged count is a plain snapshot intersection of two
independent reads - exactly the check-then-count shape
renameLabelInPlane's own comment documents rejecting for the write
path, because it is schedule-dependent under a concurrent
AddLabel/RemoveLabel. That is an acceptable estimate for a preview, but
nothing said so: the command's Long text, the --dry-run flag help, and
an inline comment at the computation site now all say the number is
not authoritative.
One non-blocking nit fixed (the other - hydrating full issue rows in the
direct dry-run just to print 10 titles - is left alone; see below):
- On a partial rename failure (renamed>0, err!=nil - e.g. a Dolt
publication failure after the SQL side already committed) the command
now reports how many issues were renamed and merged before the
failure, instead of only the error. Mirrors the existing shape in
conflicts.go's ResolveConflictRows handling ("resolved %d of %d
conflict(s) before failing").
Left alone, and why: the GetIssuesByIDs-hydration nit. GetIssuesByLabel
hydrates every matching issue via GetIssuesByIDs on both the old-label
and new-label reads, which is wasteful on a label carrying 10k issues
when the text-mode preview only prints 10. But the JSON-mode contract
already returns every matching issue's id+title (not capped at the
preview limit), so avoiding hydration only helps the text-mode path and
would branch the two output modes apart for a marginal win on an
uncommon case (a rename dry-run over a 10k-issue label). Not clean
enough to do inline without its own test coverage and a decision about
whether the JSON contract should change too - flagged in the review as
skippable, so skipping it here.
Verification:
- go build ./... - clean
- go vet ./cmd/bd/... - clean
- gofmt -l cmd/bd/label.go - clean
- go test ./cmd/bd/... -run 'Label|LabelRename' - all pass
- BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd/... -run 'TestEmbeddedLabel$' -v
- all pass, including label_rename_basic/merge/dry_run_writes_nothing
- BEADS_TEST_PROXIED_SERVER=1 BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd/...
-run TestProxiedServerLabel -v - all pass, including the "rename" subtest
- BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/issueops/... -run Rename -v
- BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/dolt/... -run Rename -v (live dolt-sql-server)
- BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/embeddeddolt/... -run Rename -v
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* cmd/bd: report an upper bound on a failed rename, not a landed count
The partial-failure message asserted that renamed>0 means the SQL side committed. On both routes the counts are assigned inside the transaction closure (label_proxied_server.go RunTx, dolt/labels.go withRetryTx), so a Commit failure or retry exhaustion returns them holding the rolled-back attempt numbers - nothing landed, and the user read 'renamed 6 issue(s) before failing'. Retry exhaustion under a busy server is the likely failure for a bulk rename, so it misreported exactly when it fired. Now reports an upper bound. commandDidWrite keeps the same premise deliberately: it is fail-safe in the other direction.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* cmd/bd: pin the partial-failure wording, and hedge the merged count too
Round-3 review: the r2 correction rode unpinned. Nothing in the suite drives
a failing rename with renamed > 0, so the whole TestEmbeddedLabel suite passed
with the hunk reverted - the fix was unfalsifiable, which is the same defect
class the correction itself was about.
Extracts the sentence into labelRenamePartialFailureMessage, a pure function a
test can assert on without inducing a mid-transaction failure, and pins it:
the hedged phrasings must be present AND the two pre-correction phrasings must
be absent. Mutation-checked - restoring the old wording turns it red on three
assertions.
Also the round-3 nit: (%d merged) was the one unhedged clause in a hedged
sentence. It now reads (of which up to %d merged), so no number in the message
asserts a write that may never have landed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs: retire the landed-count premise from the CHANGELOG too
Round-4 review, MAJOR: the code retracted a premise and the CHANGELOG kept
publishing it. The entry still said a partway failure 'reports how many issues
were renamed and merged before the failure' - a landed count - while
labelRenamePartialFailureMessage had already become an upper bound.
The sentence carried the premise TWICE and the review named one: besides the
count, its parenthetical offered 'a Dolt publication failure after the SQL side
already committed' as the case, when the whole point of the correction is that
renamed > 0 cannot distinguish that from a rollback. Rewrote both halves: the
bound is explicit, and the two failure shapes are named as indistinguishable
from the count alone.
Also round-4 MINOR: the helper had been inserted between reportLabelRename's
doc comment and its func, so the comment headed the wrong function and
reportLabelRename was left undocumented. Moved back down.
Not done, deliberately: the round-4 NIT that the pin covers the helper and not
the call site. It is marked 'noting, not asking', and an unrequested fix is the
one that ships a defect - this PR already demonstrated that.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* CHANGELOG: move this PR's entry under [Unreleased]
The 1.3.0 cut renamed the old [Unreleased] block, so these lines
merged cleanly into a released section (gastownhall/beads#6643).
Moved 31 line(s); the code is unchanged.
* cmd/bd: register label rename in the proxied capability registry
TestProxyCapabilityRegistryCoversCommandTree requires every command path to
carry a proxied-server row. label rename has a proxied route (RunE hands the
rename to runLabelRenameProxiedServer and the --dry-run preview to a proxied
read UOW), so it joins its label siblings in proxyPermittedPaths.
* storage: mint a version for every bead a label rename touches
TestEveryBeadMutatorMintsOrIsExempt (added with #6650) fails on this PR:
RenameLabelInTx writes the labels table but never reached
RecordVersionInTx. A rename changes the label set - part of the durable
snapshot - of every issue that carried oldLabel, whether it gained
newLabel or already had it (merge), so each touched issue now mints one
version row, the same gate AddLabelInTx/RemoveLabelInTx draw on a row
that landed. RecordVersionInTx is already a no-op for wisps and when
versioned history is disabled, and a rename nobody carries touches no
id, so the no-op shape mints nothing.
TestRenameLabelMintsOneVersionPerTouchedBead is the runtime twin of the
static guard: plain rename +1, merge +1, untouched bead +0, a second
rename with no carriers +0, current_revision equal to the row count.
* build(bazel): list this PR's six new test files in their go_test srcs
Generated-artifact drift repair, produced by the repository's own command
(`make bazel-sync`) and inspected before committing, not hand-written.
The PR adds six `_test.go` files and none were listed in their package's
`go_test` srcs, so Bazel compiled each of those packages' test targets without
them - green by omission. That was invisible on the pre-merge head because its
CI predates the Bazel lanes entirely (zero `Bazel /` rows). This merge brings in
e1b2e79484 (#6941), which makes those lanes feed the required gate, so the
omission would now surface as a real red.
Purely additive: 6 insertions, 0 deletions, `go_test` srcs only. No `go_library`
srcs change is needed because every added file is a test, which is also why this
cannot break the build the way a missing production source would.
Verified: `make bazel-sync` is now a no-op against this tree (empty porcelain),
and `bazel build //cmd/bd/... //internal/storage/... //internal/types/...
//internal/telemetry/...` completes successfully - 3429 actions, 0 errors.
---------
Co-authored-by: Marco Del Pin <marco@omniaevo.it>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(dolt): document contention-vs-bug verdict for 2 federation tests (be-72xld)
Triaged 3 singleton real-server test failures flagged from PR #5836's
test-server-storage-full job:
- TestClaimerReclaimsAcrossSpellingWithoutWriting: already fixed upstream
by PR #5856 (canonicalActor --/__ collapse). Passes in isolation on
current main; no code change needed.
- TestFederationListRemotes: resource-contention/timeout, not a bug.
Passes in 0.11s isolated; this package serializes all tests through a
size-2 shared-server slot semaphore (acquireTestSlot), which can exceed
a test's context deadline under full-suite concurrent load without any
assertion failing. Documented in place rather than masked with a
timeout/semaphore workaround.
- TestFederationSyncCommitsPendingPeerMetadataBeforeFetch: same verdict,
same mechanism, same evidence class (0.16s isolated pass).
Refs be-72xld.
* docs(dolt): name the context that actually expires in these two tests
Review #5996: the mechanism the comments named cannot produce the symptom.
Both tests build their own context AFTER setupTestStore returns
(federation_test.go), so the size-2 test-slot queue wait is already over and
that context starts with a fresh minute. dolt_test.go's setupTestStore doc
comment prescribes exactly that ordering to prevent the failure the comments
were blaming.
Verified on origin/main c0d8da42d: setupTestStore acquires its slot, then
builds ctx via testContext(t) (the package testTimeout), then calls New() and
initSchemaOnDB under it. A genuine deadline expiry in these tests therefore
comes from that bound and surfaces as "failed to create Dolt store" or
"failed to initialize branch-local ignored schema" attributed to the test --
not from the minute-long context in the test body.
Rewords both blocks to name that context instead, and starts the second block
with TestFederationSyncCommitsPendingPeerMetadataBeforeFetch so it reads
correctly as that function's doc comment (reviewer nit).
Comment-only; no behavior change. gofmt and go vet -tags integration clean.
Refs be-vlg2c.
---------
Co-authored-by: Gas City Merge Queue <noreply@gastownhall.dev>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(doctor): accept a leading v in version strings (be-snd)
A build stamped from a Go pseudo-version reports "v1.1.1-0.2026…-<sha>",
the canonical module spelling, and bd writes that main.Version into
.local_version on every command. The version helpers parsed digits
first, so the same binary's doctor then flagged the file it had just
written ("Invalid version format in .local_version"), and a v-prefixed
version compared as major 0. A prerelease suffix passed by accident
(the leading digits of "0-rc" parse), so upstream release candidates
never showed it; only v-stamped builds did.
Strip an optional leading v before parsing in IsValidSemver,
CompareVersions and ParseVersionParts. Versions without the prefix are
unchanged; the table row that called "v1.2.3" an invalid format flips,
deliberately. Prerelease ORDERING is out of scope: the comparison stays
the dot-part parse it was.
Reproduced on stock main (40b323245): the same build stamped with and
without the v against a server-mode scratch store — warning vs
"Version tracking active".
Fixes#6152
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_01D95BMAo3WieQDwPQMNWJ2e
* fix(doctor): keep CompareVersions's doc comment on its declaration (be-snd)
Review: stripVersionPrefix had landed between CompareVersions's doc comment
and its func, so godoc hung the CompareVersions text on the helper and left
CompareVersions undocumented. The helper now sits above that comment block;
no behavior change.
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
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* feat(count): --include-ephemeral, the plane knob `bd count` never had
`bd count` can admit the wisps table only through `--include-infra`, which
makes four changes at once. This adds the flag that makes just the first one,
mirroring the `--include-ephemeral` that `bd list` gained in #6098.
## Why the plane is unreachable on its own
The write path routes on STORAGE CLASS, not type — dolt's `useWispsTable` is
`Ephemeral || NoHistory || WispType != "" || IsInfraType`. So a `no_history`
task lives in the wisps TABLE while remaining ordinary durable work, and a
default `bd count` never sees it.
Recovering it today means `--include-infra`, which this repo's own doc calls
"FOUR changes at once and not one": it admits the plane, drops the infra-type
exclusions, changes the template treatment, and reconciles cardinality with
`bd list --all`. Its template exclusion then silently drops template rows of
the named type — so a caller who wanted the plane trades one silent undercount
for another.
`ListRequest.IncludeEphemeral` has been the narrow answer on the listing side
since #5476, and #6098 gave it a CLI flag. `CountRequest` had no equivalent
field at all. This is the missing half of that pair.
## The change
- `issueops.CountRequest.IncludeEphemeral` — the plane knob alone: exactly the
first of `IncludeInfra`'s four changes, with none of the other three.
- `internal/workapi/count.go` — one line, `} else if !in.IncludeEphemeral {`.
- `cmd/bd/count.go` — flag registration, matching `bd list`'s wording.
- `internal/httpapi` — `include_ephemeral` on `countIssues`, in the spec; the
generated `types.gen.go` is `make api-gen` output, not hand-edited.
Unset, the count is durable-plane only: the historical answer, unchanged. Every
default is untouched.
It does NOT promise a count and a listing agree. They already differ on
TEMPLATES without this flag and still do with it — a count includes template
rows unless `IncludeInfra` excludes them, a listing excludes them unless
`IncludeTemplates` admits them. That predates this and is unchanged by it; only
`IncludeInfra` sets out to reconcile cardinality, and it pays with three
changes beyond the plane.
## Verification
ok github.com/steveyegge/beads/internal/workapi
ok github.com/steveyegge/beads/internal/httpapi
ok github.com/steveyegge/beads/issueops
--- PASS: TestEmbeddedCountIncludeEphemeral (39.71s)
--- PASS: TestCountIncludeInfraFlagShape
--- PASS: TestParseCountRequestCarriesEveryFilterFlag
`TestEmbeddedCountIncludeEphemeral` was run with `BEADS_TEST_EMBEDDED_DOLT=1`
and really executed — 39.71s, not a skip. The default fast tier would have
skipped it and reported `ok`.
`make api-gen` reproduces `types.gen.go` byte-for-byte from the spec hunk, so
the two cannot drift apart in review. `go build ./...`, `go vet` and `gofmt`
clean.
Claude-Session: https://claude.ai/code/session_01X1jMLQTSrCwtzFRS1xeUC6
* count: reframe the comments for this repo, not the fork they came from
Review on #6240 (bee-ghosttrack): five comment blocks were written from the
fork's point of view and become false once merged here — "belongs upstream",
"the half that still has to go upstream", "the fork's old wide default",
and "upstream's default" meaning the current default.
Find-and-replace, as asked: the reasoning is kept, only the frame of reference
changes. "upstream's default" -> "the default before this change"; the bd
list sibling "landed in #6098"; the infra-type divergence is "pinned, not
fixed, here" with the reason; the embedded test's fork-maintenance history is
replaced by what it actually pins. No code changes.
* build(bazel): list the two test files this PR adds in their go_test srcs
Maintainer review fixes for #6240, review iteration 1. The synthesis and the
quality scorecard both returned approve with no required changes; this commit
takes the one minor whose subject is the PR's own added files.
Taken:
- Change Impact / Blast Radius (minor, gate impact minor). The PR adds
cmd/bd/count_include_ephemeral_embedded_test.go and
internal/workapi/count_skipwisps_test.go, but neither was listed in its
package's explicit go_test srcs, so the PR's own assertions were invisible to
`bazel test`. Both rows are now listed.
Gazelle's verdict, not a hand-guess: `make bazel-sync` was run (bazel 9.2.0 is
available here) and it produced exactly these two entries. Its full output
also rewrote 12 other BUILD.bazel files -- pre-existing base drift from other
PRs' files, plus dep/select churn -- which is out of scope for this PR, so the
generated result was reverted and only the two rows this PR is responsible for
were re-applied, at the slots gazelle chose. Both srcs lists remain sorted
with no duplicates (cmd/bd bd_test 637 entries, internal/workapi workapi_test
24 entries).
The cgo build tag on count_include_ephemeral_embedded_test.go does not exempt
it: the repo lists tag-gated *_embedded_test.go files anyway (99 of the 101 in
cmd/bd are listed, and the sampled ones are simultaneously listed and tagged).
Declined:
- Test Evidence Quality (nit, gate impact none). The filing lane itself marked
it optional and explicitly said not to gate on it, and its own reasoning holds:
internal/storage/dolt/counts.go and internal/storage/embeddeddolt/counts.go
both delegate to the same issueops.CountIssuesInTx, differing only in
transaction acquisition.
Validation: go build ./... and CGO_ENABLED=1 go vet on cmd/bd, internal/workapi
and issueops all clean; go test ./internal/workapi/ ./issueops/ ok. No
production code changed -- the commit is two generated-list rows.
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(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(init): isolate role configuration from inherited Git routing (saa-cgh.109.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): use the selected origin in contributor setup (saa-cgh.109.7)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): isolate Git writes in planning repositories (saa-cgh.109.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): retain inherited planning commit author (saa-cgh.109.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): align embedded role gates with selected Git context (saa-cgh.109.12)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): scope embedded artifact Git operations to selected directory (saa-cgh.109.15)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover selected optional artifacts and explain refused commits (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Honor role-probe cancellation and exercise actual fork planning (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): warn when automatic contributor role write fails (saa-cgh.109.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover successful nonquiet contributor role writes (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Assert the automatic contributor setup banner alongside warnings (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(init): read persisted role routing from the store (saa-cgh.120)
Agent-Signature: Codex-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
* fix(gitignore): preserve CRLF when appending project rules (saa-cgh.96)
Reported by bee-ghosttrack in gastownhall/beads#6343.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): pin detector edge cases and clarify append behavior (saa-cgh.96)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): preserve line endings in Git exclude appends (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): clarify exclude fixture path variable (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): refuse exclude writes after read errors (saa-cgh.110)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): share append byte composition (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(gitignore): explain append aliasing and trailing CR completion (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): use shared composition for exclude rules (saa-cgh.111)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): omit the empty exclude leading separator (saa-cgh.112)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): bind exclude writers to the selected Git directory (saa-cgh.109.16)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): isolate tracked-file guard from Git routing (saa-cgh.98)
Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6356.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): retain legitimate inherited tracking context (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): isolate trusted global configuration fixture (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(hooks): explain conservative tracked-file guard (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(git): resolve hooks paths in an explicit read-only context (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Bind init hook operations to the selected repository (saa-cgh.109.17)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Give the hooks tail fixture an explicit remote context (saa-cgh.109.17)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): canonicalize the hooks fixture repository root (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): complete selected hook options and alias handling (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Clarify hooks resolver ownership and preserve work-tree diagnostics (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Explain restoration of absent routing variables in selected exclude tests (saa-cgh.120)
Agent-Signature: Codex-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): keep embedded hook setup in the selected project (saa-cgh.120.12)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init,config): maintainer fixup for #6464
Pre-review CI repair:
- Annotate #nosec G702 on the selected hooks-path git invocation. No shell
is involved, every path is passed as its own argv element, and both values
reach that line absolute via resolveInitHooksContext.
Review iteration 1, blocking:
- internal/config: give the secret-config guard the inherited-env fallback
that the structurally identical hook guard in cmd/bd/hooks.go already has.
isGitTracked is the fail-open half of "refuse to write a secret key into a
git-tracked config.yaml", and the scrub alone narrowed it to upward
discovery from the config file's directory: under a detached work tree
(GIT_DIR + GIT_WORK_TREE with no in-tree .git) the probe reported
"untracked" and the secret was written into the tracked file. Probe the
scrubbed environment first so inherited routing cannot hide a tracked
file, then the inherited one; either probe reporting the path as tracked
refuses the write. Adds the legitimate-routing subtest that the
poisoned-routing matrix could not express.
- cmd/bd/config.go: the new comment claimed "All role commands ignore
inherited Git routing". Only the writers were hardened -
routing.DetectUserRole, beads.RepoContext.Role, `bd config show` and
`bd doctor` still resolve beads.role through the inherited environment, so
`bd config get beads.role` and `bd config show` can disagree under one
environment. Narrow the comment to the four verbs it covers; widening the
boundary to the readers is a separate change.
Review iteration 1, non-blocking:
- cmd/bd/worktree_cmd.go: disclose that ClearRouting unsets the variables on
the bd process itself, and state what clearing the discovery-scope
controls does to repository selection. The comment previously claimed the
opposite of what the init path's own note admits.
- cmd/bd/init_proxied_server.go: drop isRoleGitRepo. With workDir set, gitUC
is NewInitGitRepository(workDir), whose IsGitRepo runs the same
`git rev-parse --git-dir` with the same Dir and scrubbed env; with workDir
empty the helper returned its fallback. It was isRepo in both arms, plus a
second git subprocess per `bd init --proxied`.
- cmd/bd/doctor/gitignore.go: omit the leading blank line when creating a
fresh .gitignore, matching the two sibling writers this PR already
conditionalized in cff94aa43.
Review iteration 2, non-blocking:
- cmd/bd/worktree_cmd.go: iteration 1's own rewrite lumped
GIT_DISCOVERY_ACROSS_FILESYSTEM in with GIT_CEILING_DIRECTORIES as
"removes an inherited stop". That is backwards. git(1) documents that
discovery "does not cross filesystem boundaries" by default and that this
variable "can be set to true to tell Git not to stop at filesystem
boundaries" - it only ever permits, so clearing it *adds* a stop and
narrows the walk. Split the clause per control: the ceiling widens,
GIT_DISCOVERY_ACROSS_FILESYSTEM narrows (a repository reachable only
across a mount point is no longer found by any `bd worktree` verb, with no
opt-out), and ClearRouting's GIT_CONFIG prefix match drops the whole
GIT_CONFIG* family for the command's lifetime rather than for one child
probe. This comment is the only in-tree assertion about the variable's
direction; export_auto.go:1083-1085 groups the two without claiming one.
- cmd/bd/config.go: "bd config's own beads.role reads and writes" covered
`bd config show`, which the very next sentence lists as an exception. Name
the four verbs that do scrub (get/set/unset/set-many, at config.go:209,
:355, :609 and :902 - the only four git invocations in the file).
- internal/config: make the guard's fail-open default unspellable. The
mirrored helper took `envs ...[]string`, so a future zero-probe call would
fall through to "untracked" and write the secret with no compiler
backstop. Promote the first environment to a required parameter. The tail
stays variadic rather than matching the twin's fixed (clean, inherited)
arity because the fallback's fixture guard has to probe one environment
alone, and exec treats a nil Env as "inherit the current process" rather
than as a disabled probe.
Pre-approval CI repair:
- Annotate the four gosec taint findings this PR newly introduces in package
cmd/bd: G704 on the two connectivity probes in dolt.go, G702 on the
staged-deletion probe in hooks.go and on the ls-remote probe in
sync_git.go. None of the four is reported by the PR lane, whose lint is
scoped to the diff (only-new-issues / --new-from-merge-base), and all four
sit on lines this PR does not otherwise touch - but main.yml runs the same
wrapper with BD_LINT_NEW_FROM_MERGE_BASE unset and sweeps the whole tree,
so merging as-is turns main's Lint and PR Lint jobs red. Measured
whole-tree at pr.yml's pinned golangci-lint v2.10.1 with
--build-tags=gms_pure_go: origin/main 0 issues, this head 4, this head
with the annotations 0. The findings are taint over-approximation rather
than new exposure: gosec's analysis is not field-sensitive, so routing
config discovery through env-derived paths marks the whole store value
tainted and every remote URL read back off it inherits that. Each
annotation states why its own call site is safe; the additions are
comment-only, with no deletions and no behaviour change.
The hooks.go annotation sits on the isExportFileStagedForDeletion
declaration rather than on the exec.Command call. main has since rewritten
that body to address the export file through nearestExistingDir +
filepath.Rel, so a call-site comment both conflicted with the merge and
described an argument the merged body no longer builds. On the declaration
it merges cleanly and its justification holds for either body.
Pre-approval base refresh (rebased onto 511849496):
- Reconcile this PR with gastownhall/beads#6477, which landed on main after
this branch was first rebased and which changes the same reader. The two
changes collide in both directions, and neither side's CI can see it: the
PR lane builds this branch against its own base, main's lane never has the
PR, and only the merged tree fails.
- #6477 direction: its new subtest
TestConfig_ReadFailuresAreNotMissing/invalid_routing_boolean poisons
GIT_CONFIG_NOSYSTEM and expects the beads.role read to exit 128. This PR
scrubs GIT_CONFIG* for exactly that key, so git never sees the poison and
the read succeeds. Replaced that row with
TestConfig_BeadsRoleScrubsInheritedRoutingEnv, which pins both halves of
the new contract: beads.role reads through the scrub, and a key outside it
(user.name) still surfaces the same poison as an exit-128 read error
rather than as an absent key. #6477's general guarantee is untouched -
malformed_config still proves it for beads.role through the repository's
own config file.
- Opposite direction: this PR's own
TestInitGitRepositoryUsesSelectedDirectory/captured_home asserted
require.NoError on a generic-constructor read, commented "The existing
reader maps Git exit errors to absence" - the precise behaviour #6477
removed. Expect the propagated exit error instead. The test's intent is
unchanged and in fact better served: only the current caller environment
can see the changed HOME's broken .gitconfig, so that error is itself the
proof that generic role reads still use it.
* test(init): retarget the bare row to the work-tree-less install policy
This PR's TestInitEmbeddedHooksSelectedTail/bare row (authored
2026-09-09) asserted that a bare repository fails to resolve hooks
and installs nothing. #6457 (6a4b4aa14e, 2026-09-27) added
git.ResolveWorkTreelessHooksContext specifically to end that
behavior -- its own comment calls out "turning a supported
repository into a warning and no install at all" as the defect it
fixes -- so the row pinned a policy main had deliberately
superseded by the time the two met.
Retargeted in place rather than deleted, so the bare shape keeps
coverage through the embedded-init entry point (main's new
bare/git_dir_cwd rows cover only the proxied path): bare now
installs like any other selected repository, and being its own
common directory, its hooks path lands in its own config.
Mutation-proved load-bearing: removing the work-tree-less fallback
reds this row alone (the other eight rows stay green) with
".../hooks/pre-commit: no such file or directory" -- i.e. it
reproduces the original expectation exactly.
---------
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: Gas City Adopt-PR <adopt-pr@gascity.local>
Pass the just-built binary to the flag checker when BUILD_DIR is overridden.
Preserve direct checker invocation, documentation pin precedence, and the
separately owned build-operand quoting work in PR5667.
Fixes#6197
Reported-by: bee-ghosttrack
Bead: saa-cgh.88
Agent-Signature: unknown-model/unknown-reasoning
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix: isolate 2 doctor role tests from global git beads.role (refs be-klbl6)
TestCheckBeadsRole_NotConfigured and TestCheckBeadsRole_NotGitRepo fail
when a global `git config --global beads.role` is set on the host, since
`git config --get` reads global/system scope regardless of whether the
target path is a git repo. Isolate via GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM
pointed at os.DevNull.
This commit originally also cleared the ambient BEADS_ACTOR in three
cmd/bd tests (TestCollectViperEntriesWithEnvOverride and the two
TestPrepareSelectedCommandContext_* tests). main has since fixed those
itself (06b3320a6, and clearActorEnv in context_binding_test.go), so
that half was dropped when rebasing onto main.
Test-isolation only; no production code changed.
* docs(release-gates): PASS 7/7 — be-1wwre (ambient BEADS_ACTOR / global git beads.role leak into 5 tests)
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-1wwre-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(doctor): isolate the 2 role tests via HOME/XDG, not GIT_CONFIG_*
The role reads now scrub every GIT_CONFIG* entry from the subprocess
environment (gitenv.ScrubRoutingAndSuppression, landed in #6454/#6461), so
the GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM=/dev/null suppression this PR
originally used never reaches git and the two tests still read the ambient
global beads.role. Redirect the config search path instead, matching the
idiom TestCheckBeadsRoleIgnoresInheritedRouting already uses in this file.
Adopt-pr rebase repair (base cefcabb1e).
Review iteration 1 (both nits, non-gating; scorecard 1000/1000 approve):
- Extract the repeated 4-line preamble into isolateGlobalGitConfig(t), which
returns the temp home, and call it from all three sites. The preamble went
from 3 copies to 1; TestCheckBeadsRoleIgnoresInheritedRouting keeps its
`home` for the .gitconfig/nondefault fixtures it writes.
- Record the system-scope residual in the helper doc comment: HOME/XDG
redirection cannot close /etc/gitconfig (or PROGRAMDATA), and
ScrubRoutingAndSuppression takes GIT_CONFIG_NOSYSTEM with it, so no
env-based way to close system scope exists from a test in this package.
Two deviations from the reviewer's prescription, both measured:
- The helper lives in role_test.go, not beside newGitRepo in
git_repo_template_test.go as prescribed. All three identical sites are in
role_test.go, and that file's own
TestNewGitRepo_UsesRepoLocalHooksPathDespiteGlobalConfig (:105) has a
deliberately different preamble - no USERPROFILE, and GIT_CONFIG_GLOBAL
pointed at a writable fixture so it can write a global config - so it must
not adopt the helper. Placing the helper there would leave a non-adopting
neighbour in the helper's own file, manufacturing the drift the nit targets.
- The doc comment scopes the NOSYSTEM claim to ScrubRoutingAndSuppression
rather than "the scrub". ScrubRouting (keepSuppression=true) retains the
suppression trio - routing.go:121 short-circuits the isConfigSuppression
exemption only when keepSuppression is false - as bare_parent_fallback_test.go:175
documents. Measured both arms: ScrubRoutingAndSuppression drops
NOSYSTEM/GLOBAL/SYSTEM and keeps HOME/USERPROFILE/XDG_CONFIG_HOME;
ScrubRouting keeps all three.
Behaviour-preserving and non-vacuous: cmd/bd/doctor is 885P/4F/15S, the same
4-name pre-existing FAIL set as the pre-refactor head; neutering the helper
body reds exactly 5 cells (both targets plus absent/nonrepository/default_global)
while repository/inline/invalid stay green.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Gas City Merge Queue <noreply@gascity.local>
* fix(exec): match Windows environment key identity (#5618)
Centralize os/exec-compatible environment-key comparison and use it for credential, metrics, Git-hook, trace, and repro subprocess filters. Preserve exact Unix semantics and Unicode near-collisions.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(worktree): scrub inherited Git routing state
Establish CWD as the worktree repository boundary before discovery can consume inherited Git routing. Fence the startup config probe, clear routing in-process before root pre-run discovery, and retain command-owned subprocess scrubbing as defense in depth without changing PID or signal semantics.
Fixes#5531
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* refactor(worktree): explain owned filtering and remove an unused shim
Document why filtering the fresh routing slice in place is safe and call
the shared routing-key classifier directly from tests. Retain the two
forwarders used by production worktree subprocess/removal paths.
Review: https://github.com/gastownhall/beads/pull/5623#pullrequestreview-5098421671
Bead: saa-cgh.23
Agent-Signature: unknown-model/unknown-reasoning
* fix(config): isolate identity and tracked-file Git probes from routing
Reuse the worktree routing owner for GetIdentity and isGitTracked so
explicit cwd/path selection is not displaced by inherited repository,
index or injected config state. Preserve identity precedence and the
tracked-secret refusal contract, with real target/decoy regressions.
Follow-up: https://github.com/gastownhall/beads/issues/6222
Dependency: https://github.com/gastownhall/beads/pull/5623
Reported-by: bee-ghosttrack
Bead: saa-cgh.93
Agent-Signature: unknown-model/unknown-reasoning
* test(execenv): exercise every environment operation under both host rules
Thread the host choice through narrow private helpers behind the existing
exported functions. Keep one normalization owner and retain native wrapper
tests; the additional table covers both host branches for equality, prefix
matching, last-wins lookup, filtering and input preservation.
Review: https://github.com/gastownhall/beads/pull/5672#pullrequestreview-5096948965
Bead: saa-cgh.78
Agent-Signature: unknown-model/unknown-reasoning
* docs(worktree): explain startup Git environment scope (saa-cgh.23)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(execenv): exercise exported host policy wiring (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): share subprocess key identity for Git routing (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): preserve CRLF when appending project rules (saa-cgh.96)
Reported by bee-ghosttrack in gastownhall/beads#6343.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): isolate tracked-file guard from Git routing (saa-cgh.98)
Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6356.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): isolate role commands from Git routing (saa-cgh.99)
Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6357.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): pin detector edge cases and clarify append behavior (saa-cgh.96)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): preserve line endings in Git exclude appends (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): share append byte composition (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(env): exercise shared key helpers on native Windows (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): clarify exclude fixture path variable (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(gitignore): explain append aliasing and trailing CR completion (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitenv): share key parsing and normalize routing membership once (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): refuse exclude writes after read errors (saa-cgh.110)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(config): explain role command routing policy (saa-cgh.99)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): retain legitimate inherited tracking context (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): use shared composition for exclude rules (saa-cgh.111)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): isolate trusted global configuration fixture (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): omit the empty exclude leading separator (saa-cgh.112)
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(hooks): isolate role cleanup in the selected repository (saa-cgh.109.4)
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
* fix(hooks): reset only common local role configuration (saa-cgh.109.10)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): scope hooks-path cleanup to selected common config (saa-cgh.109.11)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(hooks): explain conservative tracked-file guard (saa-cgh.98)
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
* refactor(git): resolve hooks paths in an explicit read-only context (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): bind exclude writers to the selected Git directory (saa-cgh.109.16)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Bind init hook operations to the selected repository (saa-cgh.109.17)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Give the hooks tail fixture an explicit remote context (saa-cgh.109.17)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): canonicalize the hooks fixture repository root (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): make worktree role preservation independent (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* 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
* Clarify hooks resolver ownership and preserve work-tree diagnostics (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
* Report selected config read failures during hook reset (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Explain restoration of absent routing variables in selected exclude tests (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): keep successful config stdout separate from diagnostics (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): complete selected hook options and alias handling (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): keep standalone operations in one selected Git context (saa-cgh.120.4)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Assert standalone hook diagnostics through the CLI stderr contract (saa-cgh.120.4)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): isolate output mode and accept repository path aliases (saa-cgh.120.4)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks,config): clear the out-of-repo hooks path, close the fail-open secret guard
Maintainer adoption fixes for the three majors raised by the #6463 review.
1. `bd hooks install --beads` configures <effective .beads>/hooks, which
BEADS_DIR or a .beads/redirect can place outside the repository, but the
cleanup predicate (doctor.IsBeadsManagedHooksPath) matched only the two
repo-relative forms. Uninstall therefore deleted the hook files and left
core.hooksPath pointing at the emptied directory: .git/hooks stays shadowed,
every hook is silently disabled, and beads-managed config is still installed
-- the exact failure the GH#4440 contract at hooks.go:1505 exists to stop.
`bd doctor --fix` shares the predicate, so nothing repaired it either.
At base the same command wrote files to FindBeadsDir()/hooks but configured
<mainRepoRoot>/.beads/hooks, a value the predicate does match, so the config
was always removable. Making the write target consistent was the right fix;
it just left the cleanup predicate behind. The regressing slice is
post-uninstall removability.
The predicate now takes the resolved storage hooks directory explicitly, and
uninstall, `bd doctor --fix` and CheckHooksPath all resolve it through one
new helper (doctor.BeadsManagedStorageHooksDir -> beads.FindBeadsDir), which
is the same resolution install itself performs. Deliberately not
ResolveBeadsDirForRepo: that is repo-anchored and blind to BEADS_DIR, i.e.
half the finding's population. The new arm is gated on a resolved storage
directory so it can never reach a third-party hooksPath.
The `beads` subtest flips from "outside-storage predicate remains
conservative" to asserting core.hooksPath is absent after uninstall; the
doctor side gains TestFixHooksPath_ClearsDanglingOutOfRepoStorageHooks and
five predicate table rows, including the negatives that pin the gating.
2. internal/config.isGitTracked gained `cmd.Env = gitenv.ScrubRouting(...)` with
no inherited fallback. Its only caller is fail-open by construction -- a
probe that cannot answer means "untracked" and the secret write proceeds.
Probed directly with real git: in a bare-repo-plus-external-work-tree layout
the scrubbed probe exits 128 while the inherited one exits 0, so scrubbing
alone made `bd config set ai.api_key` write the secret into a git-tracked
config.yaml that base refused -- a hardening that moved a guard toward
exposure. It now uses the two-probe shape this same range already applies in
isGitTrackedFileWithEnv (scrubbed first, inherited fallback, either index
tracking the file refuses the write).
3. cmd/bd/config.go's "All role commands ignore inherited Git routing" is a
false universal: the readers that decide maintainer-vs-contributor
(internal/routing, beads.RepoContext.Role, doctor/role.go, config_show.go)
are unscrubbed, so GIT_CONFIG_COUNT/KEY/VALUE still flips the role. Narrowed
to what is true -- bd config's own role read and write -- and it now names
the uncovered reader plane instead of claiming coverage over it.
The reader-scrub arm is deliberately not taken here: #6461's published head
already hardens all four reader files (verified at refs/pull/6461/head), so
duplicating it would rewrite four files an open sibling PR is already
changing. No sibling head is an ancestor of this one, so whichever leaf
merges first must carry the reader legs.
Also fixed, non-gating and nearby:
- install/uninstall act on the selected config-scrubbed hooks path while every
status and execution reader (bd hooks list, bd doctor, runChainedHook) still
resolves through the inherited context -- and git itself honors the inherited
core.hooksPath. When the two disagree, a warning now names both paths instead
of reporting a bare success that `bd hooks list` will contradict. The
inherited path was already computed, so this costs no extra subprocess.
- the `rev-parse --absolute-git-dir` failure now carries git's stderr, as
loadGitContext does for the same class of failure.
Second review iteration: the three majors above were validated fixed by both
lanes, leaving one minor and two nits, none of them merge gates. The minor is
accepted with its slice pinned; the rest is bookkeeping.
- The cleanup predicate recognizes what install would configure *right now*
(doctor.BeadsManagedStorageHooksDir -> beads.FindBeadsDir), not the value
install actually wrote, and every FindBeadsDir arm reads live inputs
(BEADS_DIR, redirect contents, storage existence, process cwd). When those
drift between install and cleanup the value becomes unclearable again. Closing
it needs install to record what it wrote (a local beads.hooksPath key) and the
predicate to match the record -- new persisted surface, deliberately not added
in an adoption fixup after the review converged. Filed as bd-s76jm. The slice
is now pinned rather than silent, by two tests that must flip when bd-s76jm
lands and that pair with the existing opposite-polarity pins:
TestFixHooksPath_LeavesDanglingStorageHooksWhenStorageIsGone (whole storage
deleted -- the trigger CheckHooksPath's own docstring names for GH#4440) and
TestStandaloneBeadsUninstallLeavesHooksPathWhenResolutionDrifts (BEADS_DIR set
at install, absent at uninstall: the hook files are deleted and
core.hooksPath survives). Predicate-level, `storage hooks with no storage
resolved` -> false already pinned it.
Not taken instead: widening the predicate by path shape. The arm is gated on a
resolved storage directory precisely so it cannot reach a third-party
hooksPath, and two table rows pin that.
- cmd/bd/config.go's narrowed comment scoped its guarantee to "bd config's own
... read and write" while listing `bd config show` as an unscrubbed exception
-- and `bd config show` is a bd config read (config_show.go:336), so the
scoping clause contradicted its own exception list. It now names the four
subcommands that really are scrubbed. Note that is get/set/set-many/unset:
config.go:903 is `bd config set-many`, so the reviewer's suggested
"get/set/unset" wording would have under-named the set.
The four items this commit previously called "tracked follow-ups" carried no
bead ids, which made them declines that would evaporate at merge. Now filed:
- bd-ewdt8: the GH#4440 uninstall regression suite still exercises the
production-dead uninstallHooks/resetHooksPathIfBeadsManaged rather than the
shipped hooksUninstallCmd route. Tabling those cases over both entry points is
a test-only refactor across nine call sites; the shipped route does now carry a
real hooksPath-clearance assertion (item 1).
- bd-ez09k: exposing GitDir on git.HooksContext to drop the extra rev-parse is
declined on risk, not cost (loadGitContext's absolute git dir is anchored on an
already symlink-resolved workDir, while `rev-parse --absolute-git-dir` runs
from the raw cwd, so substituting it changes the provenance of the pinned
GIT_DIR inside the very resolver under review, for a finding with no gate
impact); and `isRoleGitRepo`'s doubled probe (init_proxied_server.go) is
untouched because all four open sibling PRs rewrite that file (32-57
insertions each).
- bd-16d58: `bd init` still installs beads hooks through the legacy
installHooksWithOptions (init.go:2072, beadsHooks=true), which writes files to
FindBeadsDir()/hooks while configuring <repoRoot>/.beads/hooks. Both values are
now clearable, but that route's install/config mismatch remains. Corrected
scope: `bd config apply` is not in this population -- config_apply.go:202
passes beadsHooks=false, so it takes the common-git-dir branch and configures
no hooksPath at all. bd-s76jm blocks it: making this route configure an
out-of-repo value without the recorded-value fix would trade a
hooks-never-run bug for an unclearable-core.hooksPath one.
Validation (env -u BEADS_DIR, private TMPDIR):
- internal/config: full package green.
- cmd/bd/doctor: full package run at the reviewed head and with this fixset
produce an identical 7-test failure set, all environment-driven (reachable
Dolt server, global beads.role=maintainer, ambient dolt.host/dolt.user).
- cmd/bd: the full package exceeds go test's 10m default at the reviewed head
too, aborting before it reaches any hooks test (pr.yml:973 documents this and
uses -timeout=30m). Instead, all 51 tests in the four files that touch the
changed symbols pass under CI's flags: -tags gms_pure_go -race -short.
- go vet clean for linux, CGO_ENABLED=0, and GOOS=windows CGO_ENABLED=0 over
cmd/bd/..., internal/config/... and internal/git/... -- the two new
unconstrained cmd/bd test files still compile in the no-cgo lanes.
- Mutation proofs, each reddening only its own pin while every incumbent stays
green: removing the predicate's storage arm reds exactly
TestIsBeadsManagedHooksPath/out-of-repo_storage_hooks,
TestFixHooksPath_ClearsDanglingOutOfRepoStorageHooks and
TestStandaloneHookCommandsUseSelectedContext/beads; removing isGitTracked's
inherited fallback reds the new external-work-tree test with
`refusal = <nil>`, the fail-open write itself, while the three pre-existing
routing cases stay green; suppressing the divergence warning reds only
TestStandaloneHooksWarnOnEffectivePathDivergence.
Second-iteration validation (same flags):
- cmd/bd/doctor -run 'TestFixHooksPath|TestCheckHooksPath|TestIsBeadsManagedHooksPath':
29/29 === RUN green, counted rather than read off a bare `ok`.
- cmd/bd, the five hooks-context tests: 16/16 === RUN green, including the
incumbent .../beads arm that asserts the value IS cleared without drift. That
arm and the new drift test differ by one setup line and assert opposite
outcomes, which is what makes the new pin non-vacuous; each new test also
asserts its own precondition (no storage resolves) so it cannot pass for the
wrong reason.
- gofmt, git diff --check, go build, and go vet clean for linux, CGO_ENABLED=0
and GOOS=windows CGO_ENABLED=0 over cmd/bd/... -- the added doctor import in
cmd/bd/hooks_worktree_test.go compiles in the no-cgo lanes.
- cmd/bd/config.go's delta is comment-only, so no behavior and no generated CLI
docs are affected.
Pre-approval CI repair: main advanced 11 commits after the review loop, and
the merged tree (this head merged with main) reds two tests that are green on
each side alone. Base-parity proves it: internal/storage/domain/git is 31/31 at
main alone and 33/33 at the reviewed head alone, but 5 FAIL merged. GitHub
builds refs/pull/6463/merge, so this is the tree CI will actually test.
Both reds are the same two-way collision between this PR's role-read hardening
and #6477 ("preserve config read errors instead of treating them as absent"):
- This PR's TestInitGitRepositoryUsesSelectedDirectory/captured_home asserted
`require.NoError` on a generic `beads.role` read whose HOME holds a broken
.gitconfig, with the comment "The existing reader maps Git exit errors to
absence." #6477 deliberately deleted exactly that premise, so the broken
config now surfaces as a real error (exit 128). HOME is not a routing key, so
the changed HOME is still visible to the generic reader -- which is what the
subtest exists to prove. The assertion flips to `require.Error`; `found` and
the empty value still hold, and the selected-constructor half is untouched.
- #6477's TestConfig_ReadFailuresAreNotMissing/invalid_routing_boolean poisons
GIT_CONFIG_NOSYSTEM and read `beads.role`. gitenv.IsRoutingKeyForOS treats any
GIT_CONFIG* key as routing (routing.go:61, a prefix rule, not the explicit
map), so this PR's role-read scrub strips the poison and the read succeeds --
#6477's row is obsoleted by design for the one key this PR hardens, and its
tail BeadsRole assertion with it. The row is retargeted to test.marker, a key
that still inherits routing, which preserves #6477's contract (a routing-env
read failure must surface as an error, exit 128 with a diagnostic) on the same
mechanism. Its role-read leg now asserts the hardened outcome positively, so
the boundary between the two contracts is pinned rather than dropped. The two
untouched rows (malformed repo config, invalid key) never depended on routing
env and stayed green throughout.
Repair validation, on the merged tree, env -u BEADS_DIR and a private TMPDIR
outside the worktree:
- internal/storage/domain/git: 45/45 === RUN PASS, 0 FAIL, 0 SKIP.
- Non-vacuity: dropping the GIT_CONFIG_NOSYSTEM poison reds the retargeted row,
so it still exercises the routing mechanism rather than passing trivially.
- cmd/bd blast radius (188 selectors from every cmd/bd test file either side
changed): the failing-name set is identical to main's under the same selector
and host -- 16 names both sides, zero new -- while RUN rises 393 -> 529 and
PASS 357 -> 493, so all +136 added executions pass.
- cmd/bd/doctor full package: identical 6-name failure set at main alone and
here; RUN 876 -> 896 and PASS 855 -> 875. All six are host-environmental
(global beads.role=maintainer, a live Dolt server on 127.0.0.1:3307).
- internal/config 398/398, scripts 98 RUN/0 FAIL (including #6482's rewritten
check_doc_freshness_test.go), gitenv+execenv+githooksenv+gittraceenv 64 RUN,
internal/git+gitignore 68/68, storage/domain/fs 84/84, dolt credentials 34/34,
metrics 58/58, drift packages (beads, query, timeparsing, issueops, schema)
1559 RUN/0 FAIL.
- scripts/check-doc-freshness.sh passes on the merged tree, which clears #6482's
new duplicate-marker failure mode against the DOCS rows this head touches
(cmd/bd/main.go, cmd/bd/config.go, cmd/bd/*.go).
- go build ./... exit 0; go vet exit 0 over all 20 changed packages for linux,
CGO_ENABLED=0 -tags gms_pure_go, and GOOS=windows CGO_ENABLED=0.
- BD_LINT_NEW_FROM_MERGE_BASE=511849496 make ci-pr-lint: gofmt clean,
golangci-lint 0 issues, golangci-lint (windows) 0 issues. This is the gate a
never-pushed maintainer fixup otherwise evades entirely.
The base merge is a separate commit below this one so the maintainer fixup stays
a single commit; its tree was verified identical to an independently computed
git merge-tree of the reviewed head and main.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* build(bazel): restore the internal/utils debug dep the merge dropped
Merge-queue inference repair for PR #6463 (stop reason ci_repairable).
The three Bazel lanes were red on this PR and green on main -- eight
consecutive successful bazel.yml runs on main, including the tip this branch
merged. The cause is the merge commit 86defb414, not the PR's own change: main
carries "//internal/debug" in internal/utils' go_library deps (added by #6907's
BUILD sync), and this branch's copy of internal/utils/BUILD.bazel still dates
from #6798. The merge kept the branch side and discarded main's newer content,
so the dep row was lost while internal/utils/id_parser.go -- which is on main
and imports internal/debug -- still needs it.
Regenerated with the repository's own `make bazel-sync`; the result is
byte-identical to origin/main's version of the file, and a second sync is a
no-op, so this restores exactly what the merge dropped and nothing else.
Proven by counterfactual: with the row removed, `bazel build
//internal/utils:all` fails with "GoCompilePkg ... compilepkg: missing strict
dependencies" -- the CI failure class -- and with it restored the same command
exits 0 (390 actions). `go build ./...` is clean and `go test ./internal/utils/`
passes.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
bd list, bd ready and bd search all take --has-metadata-key. bd count did
not, so counting the rows that merely carry a key meant listing them and
measuring the page. This is the last metadata-filter parity gap between
count and the listings.
The storage layer already carries the filter: types.IssueFilter has
HasMetadataKey and sqlbuild.AppendMetadataClauses consumes it. What was
missing is the role field, the builder wiring, the CLI flag and the HTTP
contract, so this is one change rather than a stack.
Parsing matches list_input.go and ready_input.go, including the key
validation. BuildCountFilter now passes the key to ValidateMetadataFilters
instead of the empty string it passed before, which makes the role's
existing refusal reachable from the count surface; failReadErr already
classifies that error as a 400 on has_metadata_key.
apigen types are regenerated from the spec via go:generate, not hand
edited. The pinned CLI docs are untouched.
Fixes#6160
Co-authored-by: postoso <postoso@users.noreply.github.com>
Co-authored-by: Gas City Adopt-PR <noreply@example.com>
* fix(compact): report active database size (#5619)
Measure legacy admin compact --dolt reporting through ActiveDatabaseSizer so sibling databases cannot distort reclaimed-space numbers. Omit unavailable advisory measurements without blocking GC.
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* docs(compact): explain the legacy size field names
Keep the existing compact JSON schema distinct from the newer GC helper.
The active external-GC target is addressed by the separate issue6313 leaf.
* fix(compact): select the authoritative local active GC directory
Ask the active storage instance for its optional external-GC directory
capability. Reuse the authority captured at store open, and refuse stale,
unsupported or invalid local targets rather than guessing from a root,
general CLI path or advisory size. Preserve archive-level fallback behavior.
Add native owned-process target and no-launch regressions plus instance
authority tests; retain the parent active-size and legacy JSON contracts.
Fixes#6313
* fix(compact): resolve GC capability through storage decorators
Use the existing storage unwrapping boundary so external GC sees the captured
active database behind the root command's dependency, telemetry and hook
decorators. Cover owned, shared and unsupported stores through the real chain,
and describe the active database in compact help.
Refs gastownhall/beads#6313
Agent: unknown-model/unknown-reasoning
* fix(compact): preserve external GC refusal diagnostics (#6313)
Route all four new target refusals through the standard error/hint formatter
and assert their stderr schema, message, hint and exit status. Preserve the
relative-path refusal and unavailable dry-run target omission. Update the
requested compact and flatten help mirrors without regenerating other docs.
Addresses the diagnostics and documentation review on PR #6327. Existing
PR #5668 ancestry and mandatory parent-first sequencing remain unchanged.
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* docs(compact): align flag help with active GC target (saa-cgh.94)
Authored by /root/cgh86_review; closes the independent root review help finding.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs: retain release-pinned CLI references (saa-cgh.94)
Preserve corrected live compact/flatten help while generated references continue to match docs/cli-docs.pin v1.2.2. Fix the exact six-line hosted docs-policy failure without changing pin authority.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(compact): classify cancellation before the GC authority refusal
Maintainer review fixes for #6327, review iteration 1. Non-gating findings
only: the synthesis and the quality scorecard both returned approve with no
blocker and no major finding.
Taken:
- Error Handling & Resilience (minor, both lanes). runCompactDolt formatted a
cancelled or expired context as the permanent "cannot select a local
database" refusal plus its four-cause hint, and in --dry-run turned it into a
hard exit-1. Classify context.Canceled/DeadlineExceeded ahead of the
ErrUnsupported arm and report the interruption instead. The ctx probe stays
in ExternalGCPath: it is the only cancellation checkpoint before the
uninterruptible external `dolt gc`, so the finding's other arm (drop the
probe) would trade a misleading message for launching a multi-minute GC on an
interrupted command.
- Change Impact / Blast Radius (minor). Document why
resolveLocalActiveDatabaseDir keeps the cfg.AutoStart conjunct, and make the
CLI hint name the remedy (`bd config set dolt.auto-start true`) instead of
only the condition. The offered code arm is declined: AutoStart rides
resolveAutoStart's own exclusions (forced false for ServerModeExternal and
under BEADS_TEST_MODE=1), so dropping it widens GC authority - a behavior
change, not a cleanup.
- Release Safety (minor). Add the three new test files to the gazelle explicit
go_test srcs lists so this PR's assertions are visible under `bazel test`.
Verified with `bazel run //:gazelle -- --mode=diff`: gazelle requests none of
the three, so the rows match its own output. The two rows it still wants are
pre-existing base drift in unrelated files and are left alone.
- Test Evidence Quality (nit). The two "unsupported ... through decorators"
rows were measured vacuous for the decorator claim. Pin the refusal's origin
through ErrUnsupported.Backend ("external" = the active store refused,
"active store" = the interface assertion missed) and pin the opposite
polarity on the size-only/locator-only rows. Residual recorded on the test:
the dry-run decorator row still cannot discriminate, because its benign
preview is identical for both origins.
Declined, and carried to the human-approval summary:
- Debuggability & Operability (minor, gate impact none). Reusing the `bd gc`
companions adds production output in an iteration no further review pass
grades, and the alternative arm would assert the refs are left in place
"deliberately", which nothing in the change establishes.
- Resource Lifecycle & Cleanup (nit, Required fix: none). exec.CommandContext
would kill a mid-flight `dolt gc`; that is a data-safety question for the GC
path rather than a cleanup.
Validation: `go build ./...` and `go vet` on cmd/bd + internal/storage{,/dolt}
clean; scripts/ci/pr-lint.sh against the pinned base green (gofmt,
golangci-lint 0 issues, windows cross-lint 0 issues), proved non-vacuous by a
misspell planted on an added line; 66 PASS / 0 FAIL / 0 SKIP over the covering
cmd/bd selectors. Both new pins are mutation-proved: removing the
classification arm reds exactly the three new cancellation rows and nothing
else, and dropping storage.UnwrapStore now reds three decorator rows where it
previously reddened two. internal/storage/dolt/store.go is comment-only.
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Gas City Merge Queue <merge-queue@gascity.local>
* fix(doltremote): treat s3:// as a native Dolt remote scheme
s3:// URLs previously survived Normalize only by falling through, and the
SCP heuristic treated any "@" in a URL as an SCP-style git remote, so an
s3 URL with "@" in its path or query string would be rewritten into a
bogus git+ssh remote. Add s3:// to NativeSchemes and anchor SCP detection
to inputs without a "://" scheme that match a user@host:path grammar.
* test(doltremote): pin the s3:// entry and the dotless host:pa@th case
Follow-up to the #5948 review. Deleting "s3://" from NativeSchemes made
no test fail, so TestNativeSchemesContainsEachNativeScheme now asserts
every entry the list holds; removing the s3:// line fails its s3://
subtest.
The base change also flipped a fourth behavior its description did not
list: a dotless pre-colon token whose only "@" sits after the colon
("host:pa@th", "alias:repo@v1") used to classify as SCP-style on the
bare strings.Contains(url, "@") check and normalize to
git+ssh://host/pa@th. It now classifies false and passes through
Normalize unchanged. Both inputs are pinned as rows in
TestIsSCPStyleGitURLRejectsNonSCPInputs; against origin/main's
remote.go they fail.
Normalize's doc comment now lists s3:// with the other native schemes.
* build(bazel): add go_test target for internal/doltremote
The PR adds remote_test.go and remote_invariant_test.go to a package whose
BUILD.bazel (added on main by #6798) declares only a go_library. Generated by
bazel run //:gazelle; no hand-written lines.
* fix(doltremote): guard FromGitURL's SCP split, cross-reference the SCP grammars
Maintainer review fixes for the four non-gating findings in the iteration-1
synthesis (0 blockers, 0 majors; quality scorecard 986/approve). The PR's own
fix is unchanged.
Contract fidelity, the one gate-impact-minor finding: FromGitURL is exported and
cmd/bd's gitURLToDoltRemote calls it directly, bypassing Normalize's
classification. Its first-colon split still rebuilt s3://bucket/team@prod/db
into git+ssh://s3///bucket/team@prod/db, the exact string this PR removes from
Normalize. That split now obeys the same "://" rule as isSCPStyleGitURL.
This takes the finding's second offered arm over its first. Gating on
isSCPStyleGitURL(url) instead changes 17 of 31 inputs across the package's own
corpus, against 9 for the "://" guard; the 8 extra are the SCP hosts that
predicate deliberately declines to classify - IDN hosts, non-ASCII userinfo and
dotless aliases - which FromGitURL converts correctly today.
TestFromGitURLStillConvertsSCPForms pins them, and mutating to the rejected arm
reds exactly those three rows while the new regression pin still passes.
NativeSchemes: the finding's "add az:// and oci:// for consistency" arm is
declined and the documentation arm taken instead. The PR body scopes this change
to s3:// and defers az:// to #6227 explicitly; #6227 is open, and it pairs
NativeSchemes with dolt.IsBackupURL - the site where the gap actually changes
behavior - so adding the entry here would have overridden a tracked contributor
decision while closing only half the bug. oci:// is in neither authority's
native list. The list's doc comment now records that narrowing, points at
remotecache.remoteSchemes as the fuller authority, and states that membership is
inert: every entry contains "://", so isSCPStyleGitURL rejects it and
Normalize's closing "return url" returns the same bytes listed or not. Dropping
gs:// reds one census leaf and no behavioral test, which measures that claim
rather than asserting it. The new FromGitURL table covers az:// and oci://
precisely because the guard is keyed on "://" and not on list membership.
Duplicate SCP grammar: scpStyleGitURLPattern's first alternative is
byte-identical to remotecache.gitSSHPattern, and the whole pattern is a superset
by exactly the user-less dotted-host form - the form on which the two already
disagree in production. Both regexes now cross-reference each other and the
divergence is pinned from each side. Exporting a shared matcher was the other
offered arm; it would have widened remotecache.IsRemoteURL's accept set, a
behavior change in a second package for a non-gating finding.
normalizeRemoteURL's doc comment restated Normalize's rules and had drifted
twice: it never gained s3://, and it named gitURLToDoltRemote as the converter
when the body calls doltremote.Normalize directly. Collapsed it to a reference
so the surface cannot drift again.
Codex's prescribed remedy for the hollow NativeSchemes census subtest is
declined, as the synthesis directs: asserting Normalize(scheme+"bucket/x") per
scheme passes against an empty list, for the same inertness reason above. The
subtest's comment, which claimed to protect a fast path it cannot observe, is
corrected instead.
go test ./internal/doltremote/ ./internal/remotecache/ green; cmd/bd named
selector 56 pass, 0 fail, 0 skip; go build ./..., go vet and gofmt clean; bazel
test passes on both packages; gazelle and go_srcs.py --check report no BUILD
drift.
---------
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(dolt): red — Make git-protocol CLI/SQL routing and Pull's silent-staleness failure mode observable (refs be-9i0yq.2)
Adds TestPushPullLogSQLRouteForFileRemote and
TestPushPullLogCLIRouteForGitProtocolRemote, asserting Push/Pull log which
route (CLI vs SQL) they took. Neither asserted log substring exists anywhere
in store.go today (confirmed via grep) and pushToRemote/pullTransportReporting
currently make zero log calls, so these assertions would fail under current
code.
Live RED verification (running the suite and observing an actual failure) is
blocked in this sandbox: the Dolt SQL server is unavailable due to a known,
already-escalated Docker/containerd content-store corruption issue (mayor
escalation gm-wisp-aa7x7w), so skipIfNoDolt(t) skips both tests before
reaching their assertions rather than failing them. Substituted: static
compile and vet checks both clean, plus a manual trace confirming zero
existing route-logging output for these functions.
* feat(dolt): green — log push/pull CLI-vs-SQL route decisions (refs be-9i0yq.2)
pushToRemote and pullTransportReporting each pick between a dolt CLI
subprocess and an in-process SQL call across several routing gates
(git-protocol, credentials, cloud-auth, local-remote for push), but which
route a given call actually took was only recoverable by reading source.
Add logRouteDecision, called at each CLI return point and once for the
shared SQL fallback in both functions, so `dolt push route: CLI|SQL
(remote=...)` and the pull equivalent are always in the log.
Verified via `go build`/`go vet` (clean) and a scratch unit test asserting
logRouteDecision's exact output against all four RED-test substring checks
(deleted before commit, not part of this changeset). Live RED/GREEN
execution of route_logging_test.go itself still SKIPs in this sandbox
(Dolt SQL server unavailable via Docker), so the hard gate is substituted
per the same transparency already recorded on the RED step: build+vet
clean, scratch-verified helper output, and a full internal/storage/dolt
regression run showing zero new failures beyond the known pre-existing
TestWispSeesCustomTypeRegisteredInTransaction port-conflict.
# guard-ack:bd-build-migrates-store
* test(dolt): fix CLI-route logging test's self-skip construction defect (refs be-9i0yq.2, review be-j7eon)
TestPushPullLogCLIRouteForGitProtocolRemote used plain New(), which in this
harness resolves to a client of the shared containerized test server
(testmain_test.go) rather than a store with its own local .dolt directory.
CLIDir() and hasCLIDatabase() were therefore always empty/false, so the test
always hit its own skip branch and never exercised CLI routing at all.
Move it into a new integration-tagged file and give it its own local
dolt sql-server via startLocalDoltServer, the same arrangement
TestGitRemoteEmbeddedPushPull uses, so the store has a real on-disk
CLI-accessible database. Confirmed the test now runs (not skips) and
passes, asserting the CLI-route log lines it always meant to check.
TestPushPullLogSQLRouteForFileRemote is untouched and keeps its original
build classification (no integration tag) since it works correctly as-is
against the shared test server.
* chore: release gate PASS for be-j4oer (git-protocol route logging + pull-staleness observability)
Review: be-5u36o (PASS). Deploy bead: be-j4oer.
* fix(dolt): route the push/pull route line through the gated debug sink
logRouteDecision used log.Printf, which is unconditional stderr with the
stdlib timestamp prefix. Unlike the three other log.Printf calls in this file
-- all warnings on exceptional paths -- this one fires on every push and every
pull, so it would have put a line in front of every user on every operation,
including under --quiet. debug.Logf is the gated sink for exactly this and was
already imported; under BD_DEBUG or -v the line stays as discoverable as it
was. Note debug.Logf does not append a newline, so the format string carries
one.
Both route-logging tests captured the process-global log writer to observe it.
They now use a shared captureRouteLog helper that enables the debug sink and
captures os.Stderr, which also removes the log.SetOutput mutation the review
flagged as a hazard next to this package's seven t.Parallel files. The helper
and both call sites carry an explicit must-not-become-parallel note, since it
still touches two process globals (os.Stderr and debug's verbose flag). The
t.Fatalf calls moved out of the captured closure: t.Fatalf runs Goexit, which
would have skipped the os.Stderr restore and left the pipe installed.
Red/green against a live dolt-sql-server: with log.Printf restored the SQL
route test FAILs with an empty capture, because the log package holds the
os.Stderr it captured at init and never sees the swap; with debug.Logf it
PASSes in 5.13s. The test therefore gates the sink rather than passing either
way. (refs be-j4oer)
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-j4oer-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 route_logging_test.go + //internal/debug dep (make bazel-sync)
Generated by `make bazel-sync` (bazel run //:gazelle) at the adopted head.
Base landed internal/storage/dolt/BUILD.bazel and the advisory Bazel lane
(.github/workflows/bazel.yml, #6881) after this PR was written, so the PR
adds an untagged test file to a package whose go_test srcs are an exhaustive
enumeration (207 enumerated == 207 untagged on disk at base; the 15 unlisted
files are all //go:build integration).
Without this, `bazel test` fake-greens ("Executed 1 out of 1 test: 1 test
passes" while test.log says "no tests to run") and two steps of the Bazel
workflow red: the Go-test-equivalence check (a test go test runs that Bazel
did not) and the BUILD-files-in-sync check.
route_logging_integration_test.go is correctly left unenumerated: it carries
//go:build integration, matching base parity for all 15 such files.
* review(dolt): scope the route-log doc comment and harden captureRouteLog cleanup
Maintainer review fixups for PR #5955 (iteration 1). Both are non-gating
minor/nit items from the review synthesis; no blocker or major was filed.
logRouteDecision's doc comment claimed "This fires on every push and every
pull". It does not: the federation peer plane makes the same CLI-vs-SQL
decision at six sites in federation.go (pushRefToPeer :43,:51,
pullFromPeer :108,:119, Fetch :174,:183) and logs nothing, so a debugger
following the new lines could read peer silence as "no peer transfer
happened". Scope the comment to the main-remote plane and name the
uninstrumented sibling. Instrumenting the peer plane itself is deliberately
left as a follow-up rather than widening this PR's blast radius.
The same comment said "three remaining log.Printf calls in this file"; there
are five (store.go:1333, 3824, 4178, 4237, 4727), all still exceptional-path
warnings, so the argument holds and only the count was wrong. Dropped the
numeral rather than correcting it, since it rots on every unrelated edit.
captureRouteLog restored the process-global os.Stderr inline after fn()
returned. A future fn that panics or reaches t.Fatalf (runtime.Goexit) would
skip that restore and leave os.Stderr pointed at a pipe nobody drains,
silently swallowing every later test's output in the package. Register the
restore via t.Cleanup as well, keeping the inline drain for the happy path.
Comment-only in store.go; no behaviour change and no signature change, so
BUILD.bazel needs no regeneration. Verified: gofmt clean, go build and
go vet clean under both the untagged and integration tag sets, and
go test -tags integration -run TestPushPullLog ./internal/storage/dolt/
gives 2 RUN / 2 PASS / 0 FAIL / 0 SKIP.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore(bazel): enumerate route_logging_integration_test.go for the merge-target gazelle convention
The base advance since this PR was adopted changed the root BUILD.bazel
gazelle directive from
# gazelle:build_tags gms_pure_go
to
# gazelle:build_tags gms_pure_go,integration
(the bazel integration-tag lane work, #6916 and siblings). Under the old
directive gazelle deliberately omitted //go:build integration files from
go_test srcs -- at the adopted base internal/storage/dolt enumerated 207
of 222 on-disk test files, the 15 omissions all integration-tagged -- which
is why the earlier bazel fixup (c79777b) correctly listed only
route_logging_test.go and why a134bf45's "BUILD.bazel needs no
regeneration" was true when written. Both remain true at that base; this
commit is a consequence of the base moving, not a correction of either.
At the merge target the convention is inverted: internal/storage/dolt
enumerates 226 of 226 on-disk test files including all 16 integration-tagged
ones, and `make bazel-sync` on origin/main alone rewrites nothing. Merging
this PR as-is therefore leaves route_logging_integration_test.go as the only
unenumerated test file in the package.
Measured on the merged tree (merge-tree of origin/main e1b2e79 with the
adopted head, materialized in a scratch worktree), running bazel.yml's
"BUILD files in sync" step verbatim -- `make bazel-sync-check`,
`make bazel-sync`, `git status --porcelain --untracked-files=all` -- yields
exactly one drift row, `M internal/storage/dolt/BUILD.bazel`, whose diff is
the single line added here. That step exits 1 on any drift, and pr.yml's
ci-gate lists BAZEL, BAZEL_TEST, BAZEL_PURE, BAZEL_EMBEDDED,
BAZEL_DOLTSERVER, BAZEL_PROXIED and BAZEL_SERVER_STORAGE in
CI_GATE_REQUIRED, so the drift would fail a required context rather than an
advisory lane (scripts' TestBazelWorkflowIsAdvisory no longer exists at the
merge target).
The added line is byte-identical to gazelle's own output at the merge
target, in gazelle's sort position. No Go source, no build tag and no
dependency changed, so the go_test deps list is untouched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(dolt): prove bd create rolls back fully on label-event failure (ga-xcq1ph)
ga-xcq1ph reported that, under real Dolt write contention, `bd create` with
multiple labels printed an error naming a generated issue ID ("failed to
record label event ... context canceled / transaction has already been
committed or rolled back") and that ID never persisted. The open question was
whether this is silent partial persistence or a fully-rolled-back transaction
whose error text happens to mention the doomed ID.
TestCreateIssueRollsBackFullyOnLabelEventFailure deterministically injects
the exact failure shape (a label's "Added label" event insert returning
context.Canceled) into a real Dolt transaction, without racing a wall-clock
timeout against a live contention window, then rolls back exactly as
DoltStore.withWriteTx does on any callback error. It confirms the issue, its
first label, and its events all fail to persist -- and, sabotaged locally to
commit instead of rollback, the same test correctly fails, proving the
assertions are not vacuous.
Combined with reading the call chain (cmd/bd/create.go -> ops.Create ->
issueOperations.Create -> withRetryTx -> withWriteTx), this rules out silent
data loss: withRetryTx's error classifiers (isDoltAutocommitRollbackError /
isSerializationError / isRetryableError) never match context.Canceled, so the
failure surfaces once as a real error with exit code 1, nothing printed as
"created". No production code changes -- this closes a real gap in coverage
(no existing test exercised a mid-transaction failure during PersistLabels)
without changing any behavior.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(dolt): reproduce sql.ErrTxDone from a real mid-tx context cancel (ga-xcq1ph)
Addresses PR review feedback from bee-ghosttrack (2026-09-03,
MERGE-AFTER-FIXES verdict):
1. Reword the existing test's doc comment: it "mirrors" withWriteTx's
rollback behavior by hand, it does not exercise the wrapper itself.
2. Add TestCreateIssueRollsBackFullyOnContextCancelMidTransaction. The
existing test's injected context.Canceled never reaches the real
transaction, so it can't reach the state where partial persistence
would actually be conceivable: database/sql's own background
awaitDone goroutine tearing the transaction down on its own after a
real context cancellation, racing the caller's own Rollback(). That
race is what produced the original report's second error --
sql.ErrTxDone ("transaction has already been committed or rolled
back") -- and it's a materially different state than a manually
rolled-back, still-alive transaction.
The new test cancels a real, BeginTx-scoped context mid-transaction,
polls for sql.ErrTxDone to confirm the background rollback actually
completed, confirms the follow-up Rollback() call reproduces the
original error text verbatim, and re-queries on a fresh connection
(store.db, not the dead tx) to prove this state also rolls back
cleanly with no partial persistence.
Verified locally against a throwaway native dolt sql-server (this
machine has no Docker for the repo's testcontainer harness): both
tests pass, and disabling the new test's cancel trigger makes it fail
on the expected assertion -- confirming it isn't vacuous.
* chore(dolt): bazel srcs for create_rollback_test.go + correct its withWriteTx citations
Maintainer fixup for PR #5989 (fork branch; contributor commits untouched).
Two parts.
1. internal/storage/dolt/BUILD.bazel, generated by 'bazel run //:gazelle'.
The PR adds an untagged test file; the package's go_test srcs list is
enumerated exhaustively (226 entries before this change, 227 after, which
is every *_test.go on disk in the package at this base), so without this
the new tests are invisible to Bazel. Commit 6da2a4347 (#6881) added
.github/workflows/bazel.yml, whose tools/bazel/equivalence.py step fails on
any Go test that 'go test' runs and Bazel did not, and whose
'make bazel-sync' step fails on BUILD drift. Fork PRs run that lane.
2. create_rollback_test.go, comments only -- review iteration 1's one minor
and one nit, both non-gating (synthesis and scorecard both approve).
- Three comments cited store.go:1195 as the home of
errors.Join(err, tx.Rollback()). That line sits in withRetryTx's backoff
configuration; the join is in commitWriteTx, which withWriteTx delegates
to. Now cited by symbol rather than line number, so the citation cannot
drift again.
- The comments described the hand-rolled BeginTx + manual tx.Rollback() as
"exactly what withWriteTx does". Narrowed to say which half is mirrored
and which is not: commitWriteTx installs three transaction-scoped
activations before invoking the callback
(scopeEventsJournalTransaction, scopeVersionedHistoryTransaction,
issueops.ScopeBlockedRecheckTransaction) and runs a post-commit blocked
recheck on the success path. An unregistered tx journals nothing
(journalEnabled defaults to false for a tx absent from the scope map), so
the comments now record that adding a bd_events_journal or issue_versions
cleanliness assertion to this shape, or moving the injection point
downstream of those seams, would pass vacuously. Driving the real wrapper
is left out deliberately in test 2, whose subject is database/sql tearing
the transaction down independently of any wrapper.
Part 2 changes no code: comments only, no production or test behavior change.
Verified at this tree (rebased onto cda2407115): gofmt clean; git diff --check
clean; go vet ./internal/storage/dolt/ exit 0, and again under CGO_ENABLED=0
and GOOS=windows CGO_ENABLED=0; the BUILD.bazel line reproduced by deleting it
and re-running 'make bazel-sync', which restored the file to the byte-identical
blob e5f4157bbd with no other drift in the tree; and both tests pass against a
live Dolt server -- 2 PASS / 0 FAIL / 0 SKIP, ok ... 20.869s.
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
* test(dolt): red — flaky: TestCrossProject_* fail with 'schema init: context deadline exceeded' under host load (refs be-696w)
* feat: green — flaky: TestCrossProject_* fail with 'schema init: context deadline exceeded' under host load (refs be-696w)
* docs(dolt): state the package-wide cost of raising testTimeout
Review #5999: "this isn't a two-test change ... please say that in the
constant's comment."
Measured on this branch: testContext is called from 125 files in the
package, and testTimeout is multiplied at 13 5*testTimeout sites — all
dropCtx database-drop cleanups, in initschema_pool_poison_test.go,
schema_version_test.go, schema_skew_test.go, remote_migrate_gate_test.go
and smart_remote_migrate_gate_test.go. 45s to 90s takes those from 225s to
450s, so a genuinely hung drop reports in 7.5 minutes rather than 3.75.
States that as the accepted trade rather than leaving it implicit, and
names the alternative (give schema init its own bound) so a future reader
lowering this constant back knows what to do instead.
Comment-only; no behavior change. TestSchemaInitTimeoutHasLoadHeadroom
still passes, vet clean.
Refs be-1nl2h.
* test(dolt): maintainer adoption fixes for #5999
Bazel: list schema_init_timeout_test.go in the dolt go_test srcs, so
`bazel test //internal/storage/dolt:dolt_test` actually runs the PR's
regression guard. The srcs list is enumerated explicitly and was
exhaustive for untagged tests at the base, so without this line bazel
reports PASSED while selecting none of the PR's tests.
Review fixes (attempt 1 — synthesis minor + nit, both non-gating):
- dolt_test.go: the testTimeout cost disclosure stated hard counts (125
caller files, 13 `5*testTimeout` sites, 5 named holder files) that
were exactly right at the contributor's merge base and went stale
across the ~210-commit base advance. Measured at this head they are
133 / 16 / 7 — every count wrong in the understating direction, i.e.
the disclosure undersold the exact cost it exists to make visible.
The two unnamed holder files (shared_store_migrate_gate_test.go,
smart_gate_data_behind_test.go) account for exactly the +3 and carry
the same dropCtx shape, so only the enumeration was stale, not the
characterization. Replaced the literals with the grep that
reproduces them rather than re-pinning numbers that already decayed
once. The derived arithmetic (225s->450s, 3.75->7.5 min) is
base-independent and is left unchanged.
- schema_init_timeout_test.go: cite the sizing rule so the 90s floor is
derivable rather than folkloric. The caller's budget must cover cold
server start, the Ping, the schema-init retry wrapper's full
serverRetryMaxElapsed (30s) and one migration pass — and that wrapper
cannot absorb its own exhaustion, because
initSchemaOnDBWithRetryAndGateBootstrapHeal composes its backoff with
backoff.WithContext on the caller's context. Same sizing rule
initschema_multiprocess_test.go documents for its own ctx.
Both review edits are comment-only; no code, test or assertion changed.
Declined the nit's optional rename of TestSchemaInitTimeoutHasLoadHeadroom:
the stamped 2-arm mutation proof and the banked CI green both identify
that test by name, so renaming it would invalidate the only executed
by-name evidence this PR has, for a naming preference the reviewer
itself marked optional.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* ci(bazel): gate the Bazel lane alongside the legacy jobs (D1)
pr.yml now calls bazel.yml (workflow_call) as its `bazel` job, and its
CI Gate / Required requires the call's aggregate (BAZEL) plus each gated
lane's result (BAZEL_TEST, BAZEL_PURE, BAZEL_EMBEDDED, BAZEL_DOLTSERVER).
No legacy job is removed: PR Core, build-artifacts, the pure-Go/js-wasm
check, domain+uow, contract corpus and pr-risk.yml's embedded tier stay
required (D2 is separate).
- bazel.yml drops its own pull_request/merge_group triggers, so a PR runs
the lane once; push to main, workflow_dispatch and workflow_call stay.
- Every lane records job.status in an always() last step and exports it
as a workflow_call output named after the job, next to the rbe job's
rbe-mode / rbe-enabled.
- .github/scripts/bazel-gate.sh reads the call's rbe-mode/rbe-enabled and
never re-derives the variable/fork/secret condition: mode skip allows
every Bazel id to skip, local only the remote-only BAZEL_EMBEDDED,
remote none; a missing or inconsistent mode fails the gate.
- bazel-integration runs in the PR call but stays advisory (its legacy
counterparts in main.yml run only on push to main): no gate id, and the
gate script excuses the aggregate failure only when that lane reported
failure or cancelled in remote mode; the gated lanes are still checked
on their own ids.
- Callers (pr.yml, nightly.yml) pass exactly the four RBE secrets that
bazel.yml now declares, never `secrets: inherit`.
- Inside pr.yml's run the Bazel bd artifact is bazel-ci-build-artifacts,
so it cannot collide with build-artifacts' ci-build-artifacts upload.
- bazel-autofix.yml now triggers on workflow "PR": the bazel-sync-patch
artifact is uploaded inside the PR run, and "Bazel" runs are no longer
PR events. Its security model is unchanged (base-branch checkout only,
artifact read from the triggering run id, data-only patch).
- Policy tests (review D1 F3/F4/F7):
- TestBazelLaneIsGatedAlongsideLegacy: every bazel.yml job is the rbe
job, a gated lane (bazelLaneGateIDs) or an advisory lane with a
reason; gate ids, env expressions and outputs are derived from that
map; no re-derivation in the gate step or script.
- TestBazelGateSimulation runs pr.yml's actual gate step over mode in
{remote, local, skip} (pull_request and merge_group): the script's
skips equal the ids whose job `if:` is false, and for each lane that
should run, it alone skipped, failed or cancelled turns the gate red
whatever the aggregate says; advisory, aggregate and invalid-mode
cases too.
- TestBazelArtifactNamesUniqueInCallerRuns: no artifact name collides
within a pr.yml or nightly.yml run, following local workflow calls.
- Autofix: workflow_run on "PR", which must upload bazel-sync-patch
itself or through an unconditional local call.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): keep integration out of the PR call; pin the call's inputs (D1 review v2)
- N1: bazel.yml gains a string workflow_call input `integration`
(default "on"); bazel-integration runs only when remote and
`inputs.integration != 'off'`. A string, not a boolean: on push and
dispatch the input is null, and null == false would silently stop the
lane on main. pr.yml passes integration: "off" (main.yml's integration
jobs, its legacy counterpart, run only on push to main). The gate no
longer reads bazel-integration and bazel-gate.sh no longer excuses an
aggregate failure: BAZEL is the call's result, red on a missing or
inconsistent rbe mode.
- N3: pr.yml's call passes exactly build-artifact-name and
integration: "off" (no rbe or other override).
- N4: bazel.yml's concurrency group never uses github.workflow (the
caller's name in a call) and differs from each caller's group for every
event, so the call cannot deadlock against pr.yml.
- N5: no caller of bazel.yml (pr.yml, nightly.yml) may have a
pull_request_target or workflow_run trigger.
- Simulation: lanes' run modes are evaluated with pr.yml's call inputs;
advisory lanes must not run in the PR call, gated lanes must run when
remote.
- engdocs: runbook for main BUILD drift, a farm outage or the RBE cert
expiry (~2027-09-27): fix main / renew, or unset RBE_WEST_WORKERS.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record the enforced required-gates ruleset and PR Risk's renamed gate
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): gate the proxied-server and server-Dolt storage lanes
bazel-proxied and bazel-server-storage (remote-only, #6940) join the
gated lanes like bazel-embedded: pr.yml's ci-gate requires
BAZEL_PROXIED and BAZEL_SERVER_STORAGE, each read from the lane's
job.status output (always() recorder step, workflow_call output named
after the job). Both run in pr.yml's call (no integration switch).
bazel-gate.sh allows them to skip in mode local (forks, Dependabot:
pr-risk.yml's legacy tiers cover those PRs) and in mode skip, never in
mode remote. The gate simulation derives this from the jobs' ifs, so
each lane skipped, failed or cancelled in remote mode turns the gate
red. Jobs are renamed "proxied-server tier" / "server-Dolt storage tier"
(shown as "Bazel / ..." under pr.yml's call).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Extends #6719's post-commit blocked-state recheck (gastownhall/beads#6716) to
every write runner #6719 left uncovered:
- the proxied (uow) write path: every proxied CLI write, bd batch when
proxied, and bd serve;
- DoltStore.RunInTransaction. It also settles when the regular SQL commit
lands and only the Dolt commit after it fails (ErrCommitIndeterminate);
- the raw-transaction wisp update, close and delete writers;
- both arms of RemoveDependencyWithOptions;
- the domain/db recomputes that bypassed issueops.
The recording shapes are shared issueops Note* helpers. A failed recheck is
reported through issueops.ReportBlockedRecheckFailure (the
bd.db.blocked_recheck_dropped counter plus a warning) and never returned.
Regression tests fail on main and pass here: a deterministic proxied uow
race in six shapes, RunInTransaction and concurrent wisp-close races,
sqlmock phase tests for the indeterminate commit, and a proxied CLI fan-in
test that runs concurrent `bd close` processes and then checks `bd ready`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(beads): make an explicit BEADS_DIR authoritative during discovery
FindBeadsDir ignored a BEADS_DIR that did not hold project files yet
(missing, empty, or uninitialized) and walked up from the current
directory instead. PersistentPreRun then rebound BEADS_DIR to whatever
ancestor workspace the walk found, so:
- `bd init` refused with "already initialized" because of the parent
workspace instead of initializing the named directory;
- data commands (`bd list`, `bd create`, ...) read and wrote the
parent's store.
FindBeadsDir now returns "" for such a BEADS_DIR, matching
FindDatabasePath, which already refused to fall back. Commands that
create a workspace (import/setup default path, bootstrap's
fresh-clone synthesis) target the named directory via the new
beads.ExplicitBeadsDir helper instead of CWD. Behaviour with BEADS_DIR
unset is unchanged.
Tests: FindBeadsDir unit cases (missing/empty/non-project BEADS_DIR,
initialized BEADS_DIR, unset BEADS_DIR still walks up), and a bd
subprocess regression in embedded and proxied-server modes (init under
an initialized parent, list refuses, create lands in the new store).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): note that BEADS_DIR at a project root now errors
Review follow-up for the explicit-BEADS_DIR fix: call out the behaviour
change for BEADS_DIR pointing at a project root (or a not-yet-created
.beads), which previously worked only because discovery walked up.
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>
bd show --watch was refused in proxied-server mode (proxy.watch.unsupported). The direct and proxied routes now share one watch loop (2s poll, redraw on id:status:updated_at change, SIGINT/SIGTERM stop); the proxied route opens a short read per render/poll. A missing id now exits 1 on both routes, and failed polls keep the last render quietly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server-mode workspace with an empty .beads/dolt and no .local_version was refused as a legacy workspace, blocking every command including bd init. An empty directory holds no legacy data, so the guard now admits it (server mode only); bd init writes the marker and an existing workspace in that state self-heals on its next command. Refs #5682.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bd types and create validation now both resolve custom types through issueops.ComposeCustomTypes in every mode (direct, server, proxied). Server-mode bd types now includes config.yaml types, proxied config set storage-class accepts DB types, and bd types lists the system types (message, molecule, gate, event); JSON gains additive system_types. Custom-type read errors now fail instead of being swallowed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(dbproxy): retire the proxy when its Dolt backend exits cleanly
DoltServer supervised `dolt sql-server` with cmd.Wait inside an
errgroup, and Running read the errgroup context. errgroup cancels that
context only for a non-nil result, so a backend that shut down
gracefully (dolt exits 0 on SIGTERM) was reported as running forever.
The proxy's backend health watcher never fired: the proxy stayed up and
adoptable in front of a dead store. With --proxied-server-idle-timeout 0
(the setting Gas City uses) it never went away; `bd dolt status` said
"running" and every command, `bd ping` included, failed until
`bd dolt stop`.
The supervising goroutine now reports a clean exit as errBackendExited,
so Running flips on any backend exit and Stop treats it as benign. This
follows the existing proxied lifecycle contract (child death retires
the owned proxy; the next bd invocation starts a fresh proxy/backend
pair) rather than adding in-proxy restarts: spawn, adoption, stop
epochs and identity already live in the on-demand start path, and a
second restart loop inside the proxy would duplicate that and could
mask a crash-looping backend.
`bd dolt status` no longer headlines a proxy whose managed backend is
gone as "running"; it says the proxy is up but not serving and points
at `bd dolt stop` (for proxies from an older bd). The JSON payload is
unchanged. `bd ping` already verifies by running SELECT 1 through the
proxy, so after this fix a successful ping reflects a live pair.
Tests: DoltServer Running goes false after SIGTERM (clean exit) and
SIGKILL, and Stop succeeds; managed-local lane test that SIGTERMs the
backend with idle timeout 0 and requires the proxy to retire and
`bd ping --json` to succeed on a fresh pair; status render case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(dolt status): report running=false for a proxy over a dead managed backend
Review follow-up: the JSON running field now means "serving" (a live proxy
and, on a managed topology, a live dolt behind it), so scripts that key off
running alone are not fooled by a stranded proxy left by an older bd.
proxy_pid/proxy_port and backend_* are unchanged. Adds the PR link to the
CHANGELOG entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): resolve merge markers left by the origin/main merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(prime): describe the memory split instead of prohibiting MEMORY.md
The memory guidance predates harness-native auto memory, whose index file
is also named MEMORY.md and is machine-local rather than the multi-account
fragmentation case the line was written against. As written it tells agents
to file per-operator content in the shared, replicated store - the one place
it does not belong.
Rewrite the four renderings of that sentence to describe the split the two
stores actually have: durable project facts in `bd remember`, per-operator
preferences in the harness's own memory. The fragmentation warning stays,
pointed at the case where it is true.
Refs #5169
Executed-By: pc
* fix(prime): bring the codex template in line, add CHANGELOG entry
Review on #6111 found a fifth rendering of the prohibition:
internal/templates/agents/defaults/beads-section-codex.md:19 says
"do not create ad hoc memory files" without the literal MEMORY.md, so the
grep that scoped the first commit missed it. It ships through bd init for
the codex harness, the same re-introduction path the minimal template was
included for. Reword it to the same split.
Add the CHANGELOG entry under Unreleased / Changed, matching #6011.
Refs #5169
Executed-By: mac
* fix(prime): pin the memory-guidance invariant, drop the storage claim
Maintainer review fixes for the adoption of #6111, iteration 1. Both items are
non-gating (scorecard 981/approve, no blocker or major); they are taken because
the rebased branch needs a maintainer push either way.
Test Evidence Quality (minor): nothing asserted that the four renderings had
stopped prohibiting the harness's own MEMORY.md. The only pin on these bodies
was a presence check for `bd remember`, which passed identically before and
after the rewording, so re-introducing the prohibition at any one site would
have left every test green. Added negative assertions to
TestRenderSectionMinimal and TestCodexSectionBody, plus
TestPrimeMemoryGuidanceDoesNotProhibitHarnessMemory covering both the CLI and
MCP renderings. Asserting the absence of the old prohibition, rather than
pinning the new prose, keeps the guard valid under any future rewording.
The review prescribed `!strings.Contains(body, "MEMORY.md")` at every site. That
is vacuous for the Codex body, which spelled its prohibition "do not create ad
hoc memory files" and never named the file (0 occurrences at ae1a493e0), so that
site asserts both spellings.
Measured, not assumed: restoring all three rendered surfaces to their
upstream-base blobs reds exactly the new assertions -- templates 31 PASS /
2 FAIL, the Codex failure on "ad hoc memory files" and not on MEMORY.md, and
both subtests of the prime pin -- while every incumbent stays green. That same
revert was fully green before this commit.
Debuggability (nit): the full rendering ended "they aren't project knowledge and
beads doesn't store them", which states a capability (`bd remember` will in fact
persist any string handed to it) rather than the intended policy, and was the
odd one out among the four surfaces. Reworded to "so keep them out of beads"
rather than the suggested "so don't put them here": in the rendered text "here"
has no antecedent, and the nearest location named is the harness's own memory,
which would invert the sentence.
Validation: gofmt clean, go build ./... exit 0, go vet clean on both packages,
golangci-lint 2.10.1 reports 0 issues, internal/templates/agents 33P/0F/0S,
prime run-set green.
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>
Proxied bd sql misclassified WITH [RECURSIVE] ... SELECT as a write and silently returned no rows; CALL result sets were dropped on both paths. Classify statements with the dolthub/vitess parser (internal/storage/sqlclass: Read/Write/Mixed); Mixed commits and renders any rows, so no path silently drops a result set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(integration): let SubprocessRunner reuse a prebuilt test binary
BEADS_TEST_SUBPROCESS_BINARY hands SubprocessRunner an already-built test
binary of the package instead of running `go test -c`, which no Bazel
action can do offline (it needs the module source tree and module cache).
A Bazel target passes the running go_test itself: the helper tests
(TestHelperSchemaInit, TestHelperMultiStore) live in the same package.
Unset, behavior is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(dolt): keep a lane's REQUIRE switch out of the leak-probe child
TestSuiteFixtureLeakFailsOwningSuite re-runs the suite with
BEADS_TEST_SKIP=dolt on purpose. When the parent runs under
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 (a fail-closed server lane), the child
inherited it and TestMain exited FATAL before the leak sweep the test
checks. Clear it in the child like the other suite-scoped variables.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(bazel): proxied-server and server-Dolt storage tiers (D6d, D6e)
PR Risk's "Test (Proxied Dolt Cmd N/15)" (also main.yml's) and "Test
(Server Dolt Conformance)" / "Test (Server Dolt Full Suite N/16)" as
Bazel variants against local dolt sql-servers (internal/testutil local
backend, pinned dolt from the test wrapper), fail-closed like the
dolt-server lane:
- //cmd/bd:bd_proxied_test: 15 shards; shard k runs the job's
proxied-test-shard.sh k+1 15 through go_test_manifest_shard.sh over the
race bd_test, non-race bd_for_tests as the subprocess bd,
BEADS_TEST_PROXIED_SERVER=1, GOMAXPROCS=4. Tag dolt-server-proxied,
--config=doltserver-proxied (the doltserver lane's build).
- //internal/storage/dolt:dolt_server_{conformance,full}_test over
dolt_race_off (go_test_race_off of dolt_test: the jobs' binary is not
race); the full suite runs server-storage-test-shard.sh k+1 16 with
BEADS_TEST_ENV_RUN_DOLT=1 and hands SubprocessRunner its own binary.
Tag dolt-server-integration, --config=doltserver-integration, whose
build flags are exactly --config=integration's, so the tier shares that
lane's compile (race-off deps land where bd_for_tests already is)
instead of compiling the tagged graph a third time.
- dolt_test gains //internal/storage/schema:migrations as data (the
PR4107/migration replay tests read ../schema/migrations).
- test_env.sh: BEADS_TEST_GIT_IDENTITY=1 writes the jobs' global git
identity ("Configure Git"); the git-remote tests commit in fresh repos.
- Both tags join the taxonomy and bazelPRCoreExcludedTags, so prcore/ci
and integration exclude them.
Per-shard names and statuses equal a replay of the jobs' commands
(container backend) for all 32 jobs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the proxied and server storage tiers remotely (advisory)
bazel-doltserver gains a second, remote-only step, `bazel test //...
--config=doltserver-proxied` (15 shards of ~5-10 min with a busy dolt
sql-server each do not fit a GitHub-hosted runner; forks and rbe=off keep
the local lane unchanged). bazel-integration gains `bazel test //...
--config=doltserver-integration`, which shares its build flags, so the
server storage tier compiles nothing the integration step has not. Both
steps write their own BEP, run check_testcases.py on it, run even when the
job's first test step failed, and upload logs on failure.
Policy (TestBazelDoltServerTiersMirrorPRRisk): each variant runs its jobs'
shard script with their shard total and has script + manifest in data;
the conformance variant passes the job's flags; the jobs' race/non-race
binaries and switches (BEADS_TEST_PROXIED_SERVER, BEADS_TEST_ENV_RUN_DOLT)
match; doltserver-integration's tags and race equal --config=integration's;
the steps are pinned to their jobs. checkDoltServerRules now holds all
three dolt-server lane tags to the local-backend, fail-closed,
remote-capable rules.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the proxied and server storage tiers in jobs of their own
Review of D6d/e: as steps of bazel-doltserver and bazel-integration the
tiers inherited those jobs' gating (a caller switching the integration
lane off would drop PR Risk's PR-time server tier; a gate requiring the
dolt-server lane would silently require the proxied tier too) and
lengthened their critical paths.
bazel-proxied (--config=doltserver-proxied, 15 shards) and
bazel-server-storage (--config=doltserver-integration: conformance + 16
shards) are remote-only jobs that need only rbe, each with its own BEP,
check_testcases.py step and log upload, 25-minute test step inside a
30-minute job. bazel-doltserver and bazel-integration are back to their
previous content, including the dolt-server step's 80-minute timeout for
local runs. The server tier shares bazel-integration's compiles through
the remote cache (same build flags).
The proxied tier mirrors PR Risk's race bd-cmd-test; main.yml's twin
job runs build-artifacts' non-race one, so Bazel is the stricter of the
two. Comments now say so, and the policy test pins main.yml's build so a
change there is noticed. Policy: the new jobs are pinned (command,
config, remote-only if, BEP + testcase steps, timeouts, log upload), and
no tier step may run in bazel-integration or bazel-doltserver.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
pr.yml and pr-risk.yml both reported a check run named "CI Gate / Required".
GitHub resolves required checks (and pr-preflight its rollup) latest-per-name,
so a red gate in one workflow could be masked by a later green one in the
other. Rename PR Risk's aggregate to "PR Risk Gate / Required" so both can be
required independently.
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* BDP bead-graph plan: seven-round converged design (v7, SOUND)
The plan for implementing BDP natively in this repo, driven through seven
adversarial review rounds at max effort. Headlines:
- Pinned to BDP aee075f5 (the owned-Links rulings); spec-first enforced.
- v0 Scope serves NATIVE beads/links only. The Issue/Dependency projection
was withdrawn on proven counterexamples (rounds 3-5): no read-side
mechanism can satisfy BDP's revision and identity laws over a store
permitting timestamp ties, stale imports, arbitrary SQL, and identity
resurrection. The counterexample record and §2b conflict inventory are
preserved as the C-lane requirements list.
- §2b: fifteen-row inventory of where BDP and the current stack disagree.
- C lane sketched: funnel (C1 compat-shim-over-graph-storage → C3 cutover)
vs observe (C2 storage-level trigger feed), all claims as verification
tasks.
- Native design: graph model + graphops trait, GraphReadSource resolution
honoring the tree's decorator/telemetry discipline, persisted Type
Descriptor store with installation lifecycle, allocation/tombstone
ledger, replication participation matrix, provable P-1..P3 exits.
- Twelve P-1 decisions enumerated for operator ruling.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan: the storage interfaces, concretely (operator request)
Member-by-member attachment: Storage unchanged (GraphCapable as separate
optional interface on DoltStore); no decorator forwarding (targeted-peel
resolution, telemetry re-wrapped); the snapshot lease as the one new
storage primitive (request-scoped transaction lifetime vs per-call
withReadTx, pool/timeout design named); normal migration series; serve
role-source entry with non-capable fallback; backend/ additive+gated;
issueops/journal/sync untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan: storage-interfaces round-8 fixes
UOW lease cannot ride RunTxRead (it closes its unit of work on return) —
OpenSnapshot owns a direct NewUOW, Close rolls back; telemetry wrapper
does not promote inner methods — resolver inspects through it and
explicitly re-wraps; capability contract closed (graphops.Store = read
surface for v0, ErrGraphUnsupported vs operational failure, in-tree-only
exposure); bd serve gets an optional graph field + conditional route
seam, not a mandatory role-table entry, with absent/broken/uninitialized
kept distinct; ScopeResolver named the one snapshot owner with detached
bounded close (cancelled-context rollback burns the connection);
conformance description corrected (RunUnsupportedContract proves
refusals; GraphCapable becomes a completeness-guard root if opened).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v8: round-9 reconciliation
Resolver signatures unified on the error contract everywhere;
graphops.Store defined (v0 alias of GraphReadSource, package ownership
stated, UOW-to-Scope adaptation named); decision 12 kept open with the
uninitialized state explicitly represented under either branch; serve
assembly names both source-appropriate resolvers; header reflects the
nine-round record.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v8: round-10 reconciliation — resolver pair named everywhere; package ownership cycle-free
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v8: resolvers to neutral graphsource package — the actual cycle-free layout
uow already imports storage, so the provider-arm resolver cannot live in
package storage. Both resolvers move to internal/storage/graphsource, a
separate assembly package importing storage+uow+graphops, consumed only
by composition roots; GraphCapable stays in storage (leafward import of
graphops). Signatures fully qualified.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v8: align the remaining resolver sketch (package clause + qualified types)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v9: ruling tranche 1 — terminology, charter, withdrawal, S1, Scope URL, authority model
- Terminology block: 'graph beads / graph links / the graph store' replace
'native' (which reads as the existing implementation inside this repo);
'the bead graph' names ruling 1's union concept. Swept throughout.
- Ruling 1 (charter): core; amendment follows working bits; scope = the
bead graph expands to non-work-tracking information (wisps the example).
- Ruling 5: projection withdrawal ratified (wisps included).
- Ruling 2: substrate S1.
- Ruling 7a: Scope URL mirrors BDP's pinned startup contract.
- Ruling 9 (corrected model): the authority is the graph store as reached
through the NORMALIZED STORAGE ABSTRACTION, whichever provider realizes
it — not bd serve, not Dolt. Marker, serialized history, non-authority
refusal, and the snapshot lease are contract obligations proven by the
graph conformance suite; CLI verbs and the BDP handler are both clients.
Consequence: the graph capability is part of the PUBLIC backend/
contract from P1 (flips the in-tree-only hedge); §4 reframed with Dolt
as reference realization.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v10: ruling tranche 2 — restore, lifecycle commands, ledger, journal, wisps, listener
All twelve P-1 decisions are now ruled (one spelling open):
- 11 restore vs identity: layered — restorable append-only ledger with
provider-declared survival; Scope-URL + epoch rotation when preservation
cannot be guaranteed (spec: identity-losing restore = different Scope).
- 12 (replaces empty-at-birth): store/Scope/client — bd init initializes
the graph store against the interfaces; bd serve mints the Scope on
first serve under a configured URL and serves it honestly empty; a
client-wiring command (spelling TBD) makes the CLI a BDP client of a
designated server. New §4 'Lifecycle commands'.
- 3 ledger: append-only allocation record; ID test is a keyed O(1)/O(log n)
lookup as a contract obligation.
- 8 journal/changefeed, 6 wisps (C-lane visibility), 7b listener (same
middleware path; v0 view = whole Scope per bearer token): ratified.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v11: close P-1 — client wiring is a bd init target that reroutes above the storage abstraction
bd init --bdp-server <url> joins --server/--shared-server/--proxied-server/
--team-server/--backend as an init target; unlike those (which select the
provider/topology BELOW the normalized storage interfaces) it reroutes
ABOVE them, at the CLI: graph verbs become a BDP client of the designated
server. Config bdp.client store|server (explicit mode) + bdp.server;
env/credentials/precedence mirror dolt.mode. All twelve P-1 decisions
are now ruled.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Plan v12: bd bdp-serve as the isolated bootstrap path; related workstreams (W-arch, W1, W2, W3)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* W-arch: graph architecture/design + detailed CLI and storage-interface spec
Two companion writeups to the plan (operator request):
- BDP_GRAPH_ARCHITECTURE.md: the shape — packages, imports, roles, a read
end to end, where each ruling lands — and three corrections to the
plan's §4 after reading the tree's role machinery: accessors on
storage.Storage (house rule; promoted through decorators by interface
embedding; breaking-change-with-changelog as Memories() was) replace
GraphCapable + the graphsource resolver; one-role-call-one-transaction
replaces the snapshot lease for P1 (cross-request continuation stays
P2's ADR); accessors carry the layers, so no peel-and-rewrap policy.
- BDP_GRAPH_CLI_AND_STORAGE_SPEC.md: the diff — bd init graph bootstrap,
bd init --bdp-server (config/metadata/env/precedence), bd bdp-serve
flags and behavior, bd graph restore/promote, reserved verbs and the
three-route accessor fork; Storage accessors, the graphops public leaf,
bodies per leg, migrations, decorators, backend/ aliases, conformance
contracts and gates, bdpapi + DTO generation; what does not change; open
implementation questions.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* W-arch v2: answer the three-reviewer council; six ruling amendments proposed (pending)
Architecture v2: mechanism corrections separated from ruling amendments;
six roles (Reader, DescriptorReader, TypeInstaller, IdentityReader,
ScopeBootstrapper, AuthorityRotator); DBTX-shaped shared bodies so the UOW
leg (bd serve's primary path) shares one body; replicated Scope row +
clone-local dolt-ignored authority half asserted inside every read
transaction; BDP rows mounted inside internal/httpapi behind route();
bd bdp serve as a thin strict command; bd bdp namespace; laws in graphops;
no backend/ aliases.
CLI/storage spec v2: config.yaml single source for bdp.*; BEADS_BDP_TOKEN_FILE
(no env token); credentials keyed by origin+scope path; identity state table;
promote CAS + fencing by expectation; bd bdp restore branching on
LedgerDurability; ledger export/import lane; full DDL with utf8mb4_bin
collation, Scope-relative paths, LONGBLOB canonical JSON; three censuses and
every embedding surface; conformance cases the council named; bts migration
coupling; Part C2 (merge funnel, federation, bd sql) replaces v1's
'does not change' claims.
Plan v13: superseded-mechanism banner on §4, amended lifecycle spellings,
and a PENDING 'Amendments proposed by W-arch v2' block under §9 (A1–A6 plus
the DML enforcement boundary and the replication/merge ADR).
* W-arch v3: answer council round 2; plan v14 reopens P-1 for amendments A1-A8
Round 2 (Gemini/Codex/Claude on v2) disproved v2's A5 premise with a live
Dolt probe: DOLT_BACKUP restore carries the working set, so a dolt-ignored
authority table survives restore. v3: the clone-local authority half is a
gitignored .beads/graph-authority.local.json carrying a ledger high-water
mark, asserted in every transaction (clone/pull arrive without it; a
restore keeps it but rewinds the ledger -> ErrStateRewound). Append-only
graph_ledger_events with one global sequence; graph_allocations derived;
bd bdp ledger snapshot|apply continuity lane. A7: promotion fenced at the
remote (CAS + push, non-fast-forward fails) with bdp.authority_heartbeat.
A8: constraint #1 scoped to behavior; out-of-tree backends stub six
accessors. Also: BeadGraph* accessor names (GraphCounter clash); Admin
role; OwnedLinks grouped by Type URL (the pinned schema's shape); opaque
Cursor from P1; expectation on descriptor reads/installs; bd bdp serve
inherits errServeReadonly; CommandPath-keyed root policy; --dev-local-test
removed; BDP_SCOPE_URL honored via BindEnv; no token key in config;
bd backup restore marks unverified; merge entry-point inventory corrected;
bts coupling stated as a release-parity gate; provenance columns; LIMIT
bound+1; statement counts pinned; wire artifact in future tense.
Plan v14: status reopens P-1; section 9 block A1-A8 + two decisions;
section 7 superseded-names note; section 8 W-arch bullet.
* W-arch v4: answer council round 3 — store-owned witness, per-topology fencing, hash-chained ledger; plan v15
Round 3 converged on the authority mechanism. v4: the authority witness is
STORE-OWNED (the accessor loads it from .beads/graph-authority.local.json
under an advisory lock; no request type carries authority fields — a
caller-supplied expectation was forgeable from replicated rows); the file is
bound to a workspace key (hostname + real path, not the shared project id),
written under an exclusive lock with monotone read-modify-write and
directory fsync, and only once .beads/.gitignore carries the entry (all
three doctor lists). The ledger is hash-chained (prev_hash/hash) with
mint/install/promote/rotate/allocate/tombstone/refuse_url events; the
witness records the head {seq, hash} so a restore or a different history is
refused by exact-prefix identity. A7 fencing per topology: shared SQL server
-> dolt-ignored graph_authority_lease (the leases/bd-lrgn1 precedent,
ephemeral heartbeats); remote-backed embedded -> Mint/Promote are fetch ->
compare -> CAS -> DOLT_COMMIT -> push with non-fast-forward reset, heartbeat
compares (authority_id, epoch) and fails closed after a grace, P3 writes
push-on-commit; no remote -> CAS alone. A8 presented as two options, not
pre-empted. A6: bdp.scope_url in tracked config.yaml; bdp.client/server/
insecure_http in untracked config.local.yaml via bd bdp client (config.yaml
is git-tracked by default). bd serve never refuses on account of the graph
(legacy up, rows absent on non-authority clones); bd init bootstraps only on
an unminted store or the authority workspace and is silent otherwise;
CommandPath-keyed policy authoritative at every leaf-name call site (list
may coincide); five statements per read with LIMIT remaining+1; validator
singleflight; tree corrections (14 files, ReadyClaimer CHANGELOG precedent,
-0.0 attribution, facade census file, provider-arm assembly).
Plan v15: operative lifecycle items 2-3 rewritten as amended (pending),
backup/restore matrix row, W2 bullet, section 9 block refreshed to v4.
* W-arch v5: answer council round 4 — fences by hazard on the serving leg, sequence counter, two-phase transitions; plan v16
Round 4 (Gemini/Codex/Claude on v4) converged on the authority mechanism.
v5 on the tree's precedents: a single-row graph_ledger_seq counter (the
journal's bd_events_seq shape; Dolt's FOR UPDATE is a no-op); fences
composed by hazard rather than storage mode — a shared database gets the
dolt-ignored lease that every mutation must UPDATE with one affected row
(a takeover is a serialization loser), a configured remote gets DOLT_FETCH
-> ancestor check (DOLT_MERGE_BASE) -> scoped commit (DOLT_ADD graph tables,
never -Am) -> DOLT_PUSH with a typed non-fast-forward classifier and reset
to the recorded pre-op HEAD; both when both; embedded no-remote not
promotable in place. Every serving workspace is a SQL-server workspace, so
the serving leg is the UOW provider and the fences live there (doltSQLProvider
gains beadsDir). Only bd bdp serve mints (tracked Scope URL); bd serve
converts every graph failure into rows-absent + notice. No ledger event
before mint: the built-in catalog is installed inside the Mint transaction;
bd init installs nothing. Two-phase transitions (pending record, recovery on
load) for mint/promote/rotate/ledger-apply; LedgerApply and restore carry
their own recovery predicate. Installation key (per-installation id under
the user config dir + canonical path) replaces the hostname. Graph-state
version = per-table DOLT_HASHOF_TABLE hashes (DOLT_HASHOF_DB moves on every
heartbeat); ErrStateChanged returned without validating in the held tx,
validated under singleflight by the accessor. config.local.yaml/witness/lock
in all three doctor lists; bd config set bdp.scope_url refused once minted;
BDP_SCOPE_URL read first. Lease table via doltIgnorePatterns + main-series
+ ignored-series (0055/ignored 0012 shape). update event kind; provenance on
allocations; per-method statement budgets; tree corrections from round 4.
Plan v16: witness wording in the section 4 banner, config split in the
lifecycle banner, mint trigger in lifecycle item 2, ruling 11 spelling,
section 9 block refreshed to v5.
* W-arch v6: answer council round 5 (Codex, Gemini); propose A9 simplification; plan v17
Lease predicate now carries the holder installation key, a per-process
nonce, the epoch, and an unexpired expires_at by database time; an expired
claim is never renewed. Every replicated graph mutation (mint, promote,
rotate, install, ledger apply, seeds, P3 writes) runs through one provider
primitive on hazard R: fetch -> ancestor check -> record remote graph roots
-> fenced transaction -> scoped commit (new RunTxScopedResult; the UOW commit
hardcodes -Am today) -> push classified by a typed lift of sync.go's
pushRacePattern; on a race every remote graph root is compared (any graph
delta fails closed; issue-plane-only divergence keeps the commit as
ErrSyncRequired; other failures keep it unpublished). Undo is soft reset +
per-table DOLT_CHECKOUT when HEAD is still the op commit (verified against
Dolt 2.1.8), DOLT_REVERT otherwise — never a hard reset. Transitions are
multi-phase (begun/local_committed/published/config_written) with resume-or-
undo recovery. Installation id created O_EXCL 0600 in the directory
UserConfigYamlPath chooses. v0 serves BDP only from SQL-server workspaces
(registered backends' store arm has no fence; deferred behind a
GraphPublication capability). bd bdp serve mints via a staged startup
(exclusive gates through a temporary source, then shared). config set/
set-many/unset refuse bdp.scope_url once a witness is held (file check);
rotate refused under an overriding BDP_SCOPE_URL. LedgerApply restores
anti-reuse history only (reserved allocations; counter set). Graph-state
version = ordered per-table hashes of the eight replicated tables
(DOLT_HASHOF_TABLE verified to exist); one singleflight coordinator per
provider; descriptor cache keyed by the descriptors table hash. A8's
method-set reasoning corrected (required methods promote through
interface-embedding wrappers; optional interfaces do not). A9 proposed:
v0 authority requires a shared database; hazard R deferred.
Plan v17: A7/A8 refreshed, A9 added, lifecycle item 2 notes registered
backends and the staged mint.
* W-arch v7: fold the Claude reviewer's probe-backed round 5 — fence cell, counter nonce, ledger-head comparisons; plan v18
Probed on Dolt 2.1.8: concurrent transactions merge cell by cell, so a lease
UPDATE fences a takeover only when both rewrite the same cell with different
values, and two 'next = next + 1' increments from the same value both commit
with one increment landing. v7: every lease write (grant, steal, expiry
reclaim, renewal, per-mutation fence) rewrites a random 'fence' cell and
predicates on the value it read; the ledger counter writes a random
allocation nonce ('next' is reserved; column is next_seq); the events PK is
the second guard (it converges on byte-identical rows, which the nonce
prevents). Push-race classification and the heartbeat compare the remote
ledger head via AS OF 'origin/main', never the (authority_id, epoch) tuple
(a VM-image twin shares it). No configured remote => not promotable in
place on every topology (a copied data directory under a second sql-server
is a different, unobservable database). Lease holder is the workspace
(installation key); admin verbs other than restore/ledger apply take the
shared gate and rely on the lease so they run beside a live server; plain
bd serve never runs transition recovery. Installation id: user_config_path.go
resolver, BEADS_INSTALLATION_ID_FILE, per-OS-user and ephemeral-home
residuals. Fresh-remote and ref-spelling rules; timedProvider getter;
domain/fs gitignore writer; check D warns without a base ref.
* W-arch v8: fold council round 6 — self-regrant, A9 arbiter, gate model, undo unstage step, ref spelling; plan v19
Round 6 (Gemini/Codex/Claude on v7): the Claude reviewer's live Dolt 2.1.8
probes CONFIRM the fence cell (1213 on the versioned and ephemeral paths,
read-then-mutate, and disjoint-column takeovers) and the counter nonce
(byte-identical events conflict). v8 closes the residuals: an expired lease
still naming this workspace self-regrants (renewal and mutation extend
expires_at; reads carry no expiry term; promotion only when holder or epoch
differ); the lease row Mint creates is the sole proof of 'minted here' and
in-place Promote requires it (A9's arbiter; clones promote only with
--rotate-url); promote/rotate/install take the shared gate, restore/ledger
apply the exclusive gate, stated identically everywhere; staged bd bdp
serve bypasses the generic pre-run gate and takes exclusive only when there
is no Scope row; transition recovery is by evidence (durable op id in the
ledger event; begun-with-committed-op detected; local-committed on a shared
DB finalizes; remote classified pre-head / contains op / foreign); Advance
is a descendant-aware compare-and-advance; the undo unstages before the
per-table checkout (a bare checkout after a soft reset reverts nothing,
probed) and restores the ignored lease row; push races compare the remote
ledger head (ORDER BY seq DESC LIMIT 1 — MAX(seq),hash errors under
ONLY_FULL_GROUP_BY) AND the graph tables' diff, against the workspace's
witness; the ref is remotes/<remote>/<branch>; the classifier lifts all of
isPushRaceErr; DOLT_HASHOF_TABLE('<name>') x 8 with a stated encoding;
renewal-interval bound on fenced transactions; A9 cut sheet; doctor-list
membership per list; tree corrections (uow_factory forwards beadsDir; no
example backend package; jira stub is a flat implementer; config unset
gains an explicit guard call; config.local.yaml merge wording).
* W-arch v9: fold council round 7 — honest A9 arbiter, read-path expiry, op_id column, phased undo, one staged sequence; plan v20
Round 7 (Gemini, Codex; Claude probes pending): a dolt-ignored lease row is
NOT proof of 'minted here' — DOLT_BACKUP restore and a directory copy carry
the working set, and Dolt's @@server_uuid is per machine (probed: identical
for a same-machine copy). v9: in-place promotion is self-regrant (the lease
names this workspace) or an operator --steal (an assertion of 'same
database', in the class of force-push); a foreign holder's expiry alone never
grants a takeover; promote --rotate-url is the bootstrap that creates the
lease row for clones, copies, and restores; physical database copies are the
stated operator-managed hazard; the lease row is bound to scope_url and
authority_id. Protected reads self-regrant ephemerally first and require an
unexpired lease inside the read; request deadline below the remaining lease
interval. op_id becomes an indexed, hash-covered ledger column; the SQL-free
manager asks an evidence provider; no-remote recovery executes config_intent
before finalizing; undo is phased (undo_started/versioned_undone/
lease_restored), pauses renewal, and restores the lease only on the reset
path and only if it still names this workspace; Advance runs a
provider-supplied prefix/ancestry verifier under the file lock; one
normative staged-startup sequence with an explicit shared release before
exclusive; every fenced transaction carries a deadline below TTL/3 with
jittered, serialized renewal; types install is uniformly exclusive;
hazard-R recovery reuses the delta classifier and the watcher recognizes a
pending local op; A9 topology matrix keeps the default-branch rule;
transaction-bound capabilities (StateVersioner, GraphPublication,
LeaseClaim) move to internal/storage/graphcap. Plan v20 mirrors A1/A7/A9.
* W-arch v9: op_id on the public LedgerEvent sketch
* W-arch v10: fold council round 8 — one lease predicate, read path never writes the lease, A9 propagated, transition lock held; plan v21; held for rulings
Round 8 (Gemini/Codex/Claude on v9): the residuals were text-level. v10:
one lease predicate everywhere (a self-held lease CASes regardless of
expiry; a foreign holder is replaced only by --steal; no row -> --rotate-url;
every 'expired or --steal' and 'lease Mint created here' formulation
removed, including the plan's unexpired-expires_at term); protected reads
SELECT first and require an unexpired lease inside the transaction, never
write it (the serving leg's watcher renews; a near-expiry read fails closed;
a CLI read on its own expired lease regrants once, ephemerally, before a
fresh read tx — probe-backed ordering); BDP rows carry their own per-row
deadline below TTL/3 (the shared route() deadline of 60s exceeds the TTL);
types install exclusive in every section and the TTL/3 deadline scoped to
the shared-gate context; the file lock is held from Begin through
Finalize/Abandon and recovery acquires it first; LedgerApply's crash
evidence is the manifest (imported op_ids are never rewritten); recovery
keyed on 'hazard R in force' (any remote under A9 takes the local path)
with the delta-classifier precedence incl. issue-plane-only; the undo
restores the lease on either path under the same-holder guard with a fresh
fence (a revert restores the Scope epoch and would orphan the lease —
probed); one staged-startup sequence everywhere; A9 propagated to A5's
bracket, the embedded leg, and 'CLI-only'; concurrent mint under one
tracked URL settled by the ADR (interim: earlier mint wins); ephemeral-home
services pin BEADS_INSTALLATION_ID_FILE; rotate beside a live server exits
3; graphcap references; INDEX (op_id); ledger snapshot shared;
commandNeedsExclusiveGate learns the new verbs; depguard allowlist gains
uow/graphcap; UnstageTables; dolt_log AS OF for the remote pre-head; shared
staging sweep stated; matching-head restore is not a rewind; metadata.
* Materialize rulings A1–A7 and A9 (2026-09-07); re-pin BDP to bdp#18 merge 0b7d86e7; plan v22, W-arch v11
Operator rulings taken one decision at a time on 2026-09-07:
A1 store-asserted witness replaces the snapshot lease (ruling 9); A2 BDP
rows inside httpapi, only the strict serve mints, bd serve never refuses,
intra-Scope references Scope-relative and a new base URL is a rotation
(7b/12); A3 the root flag --graph-mode link|dependency replaces the bd bdp
prefix (the mode names the graph by its edge kind; bd link creates the
selected graph's edge; policy keyed on mode + command path);
link-graph.route replaces bdp.client; A4 public graphops + BeadGraph*
accessors; A5 witness file + hash-chained ledger + ledger lane +
LedgerDurability (retained versions to the History lane); A6 config
placement (tracked scope_url, local per-workspace keys, file tokens); A7
the shared-database fence (fence cell); A9 v0 authority requires a shared
database, remote half of A7 deferred to the write-profile ADR.
Also folded: bdp#18 (attribution, two statuses) merged and re-pinned in §0,
attribution row restored in §2b; sjarmak's accepted inputs (typed incident
index; the two §2 plane statements); migration slots start at 0068 (0067 is
versioned-beads Phase 1) with a CLAIMED.md registration at P0; History's
store_epoch vs the graph authority epoch stated as distinct. A8 and the two
decisions remain pending.
* A2: record the remount-is-rotation statement in the architecture row
* Materialize A8 (option A, 2026-09-07): constraint #1 scoped to behavior; out-of-tree backends take the declared source break; plan v23, W-arch v12
* Materialize ruling 13 (D1, A+B, 2026-09-07): out-of-role DML out of contract; validator with ledger accounting; session-gated triggers on the eight replicated tables; plan v24, W-arch v13
* Materialize ruling 14 (D2, option B, 2026-09-07): replication/merge ADR gates P1 with a four-law charter; P0 open; plan v25, W-arch v14
* Docs: clear four stale proposed/pending markers left after rulings 13–14 (arch §2b heading; plan matrix header, wisps row, §8 W-arch bullet, ruling 11 spelling note)
* Docs: record the P0 results — 40 pinned scenarios, generator decision (Part D.3), verification rows (i)-(iii) answered with their rules; fence census over dolt_schemas queued for ruling (Part D.7)
* Docs (P0 council 2026-09-07): Link endpoints symmetric (external-source Links are in the pinned fixtures), pins variable-width, error home recorded, canonical-form and UTF-8 hashing rules stated
* Docs (P0 council): P0 wire wording, JCS interop caveat, conformsTo sorted in the descriptor canonical form
* Docs: migration slots 0069 and later (0068 claimed by versioned-beads Phase 2 attribution_status; CLAIMED.md row c53ef8810)
* Docs: P0 implementation notes from council 11's fold (Scope-URL law split, WHATWG origin model, symmetric endpoints, ledger bounds, descriptor canonical form, strict wire decoding); P0 exit met
* Docs: name the graph plane's epoch columns authority_epoch at P1 to keep them distinct from the History lane's store_epoch
* Docs: record the bdp#1 rulings of 2026-09-08 — wildcard ownership entry (B2/B4) and complete-or-refuse historical reads (History lane)
* Docs: wildcard ownership as implemented at P0 — reserved-key sum, max reading, present-only groups, pinned-wire tripwire
* Docs: OW1 ruled A — the wildcard max bounds the whole owned set; explicit max never exceeds it
* Docs: bdp#21 admission law in B4 — round-trip rule refuses at admission; ledger framing exempt
* Docs: B4 — CheckBeadRecord enforces both owned-set bounds at acceptance; P1's LIMIT covers the whole-set bound only
* Docs: A10 solo topology (ruled B), Part D.7 fence census (ruled A), authority_epoch confirmed — 2026-09-08
* engdocs: properties are opaque — references inside properties are data, never edges (bdp#1 item 5 as amended, ruled 2026-09-08)
* docs: align graph design with current BDP and versioned beads (#6154)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
* docs: wire graph alignment exits and clarify pinned sources (#6154)
Preserve historical P0 results, assign current-wire and serving gates, and clarify selected-profile pins and future storage delta review. Fold adjudicated source and History precision corrections without changing the ruled graph plane or adding runtime claims.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
* Align graph architecture with ruled solo topology (#6154)
Carry A10 into the architecture and embedded-leg summaries, reconcile minting and registry references, and record merged Read/RU dependencies alongside the published TX draft and Jim's dated checks. Preserve the formal change-request hold and phase-specific implementation/evidence gates.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
* Reconcile solo authority mechanisms and remaining graph review references
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
* docs: complete A10 solo authority consistency sweep
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
* docs: close approved graph review follow-up nits
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
* docs: reconcile graph adoption and remaining phase gates (#6154)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Donna Box
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Add beads-pm-kit to the orchestration section: ten PM skills for running
a Beads board (split, estimate, take, loop, fleet, pm-loop, report,
forecast, audit, handoff), installable with
`npx skills add cuongbphv/beads-pm-kit`. The entry is sized to match its
neighbours in the section.
* fix(dolt): publish the blocked-state recheck after its transaction commits
Post-merge review of #6719 (landed 511849496..1ed5b3330) raised two majors
against the post-commit blocked-state recheck. Both are fixed here.
1. Publication ordering. recheckBlockedAfterCommit minted its Dolt commit
with doltAddAndCommitInTx while its own recompute transaction was still
open. That helper's doc block declares the ordering a live
production-observed lost-update hazard (LatentLabsSpace/NEXUS#92):
DOLT_ADD stages the whole table from the session's BEGIN-time root, so
the minted commit writes every concurrently committed row in the staged
tables back to its BEGIN-time value. The recheck is the worst possible
adopter, because it runs precisely and only when concurrent unblocking
writes are racing on issues. It now mirrors
runIssueOperationTxWithMessage: the recompute runs alone inside
withRetryTx, its IssueRowsChanged verdict is captured by plain
assignment, and doltAddAndCommitPostTx publishes after the SQL
transaction has committed, against the post-merge root. A failed
trailing commit is accounted like that path's — post_tx_commit_dropped
plus a log line — and not as a recheck failure, because the flag repair
itself is committed and durable, so telling an operator the rows may be
stale and prescribing `bd recompute-blocked` would be false.
2. Test evidence. The wiring from a committed public write to the
post-commit recheck had no regression pin on either tier: deleting both
Dolt runner tails left the whole TestCloseRecheckBlocked suite green,
because those tests either call recheckBlockedAfterCommit themselves or
take the pending set out of the transaction before the runner can.
TestCloseRecheckBlocked_RunnerTailRechecksACommittedWrite now drives the
race through withRetryTx and withWriteTx, one arm each (they carry
separate tail calls), and asserts the dependent settles with no help
from the test; each arm reads the dependent's flag inside the write's own
transaction first, so a collapsed race window fails loudly instead of
passing vacuously. TestEmbeddedBlockedRecheckSettlesWhatTheWriteRecorded
does the same for withConn's tail on the serialized embedded tier,
leaving the pending set in the transaction for the store to take.
That embedded pin needed a second pass: its first form asserted on
types.Issue.IsBlocked, which GetIssue never hydrates — is_blocked is not
in sqlbuild.IssueBaseColumns — so the assertion could not fail and the
arm survived deleting the tail. It now reads the stored flag through
embeddedIsBlocked. The pre-existing "graph ends settled" assertion in
the sibling test had the same defect and is fixed the same way, with its
comment corrected to say what it actually pins (the in-transaction
recompute, since each write there takes its own pending set).
The ordering itself cannot be pinned behaviorally — the hazard needs a
writer that commits inside the recheck's own transaction window, and no
seam exposes it — so it gets a structural guard in the shape the journal-
and version-scope completeness guards already use, with liveness anchors so
a rename cannot turn it into a tautology. Restoring the in-tx ordering
leaves every behavioral test in the package green and reds only that guard,
which is why it is here.
Mutation evidence for both pins, re-measured for this push. Deleting all
three runner tails (both Dolt, plus embedded withConn) reds exactly the two
new tests — both arms of the Dolt one at close_recheck_blocked_test.go:240,
and the embedded one at blocked_recheck_internal_test.go:180 — and nothing
else in either package. Restoring the in-tx publication ordering reds only
TestPostCommitRecheckPublishesOutsideItsTransaction.
The non-gating disclosure corrections the same review raised ride the next
commit. The rest — a recheck-scope completeness test, noteBlockedRecheck on
the sibling in-transaction recomputes, and routing
RemoveDependencyWithOptions through withRetryTx — stay out of this PR and
are tracked as beads.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(blocked-recheck): correct the residue claim and the out-of-scope list
Three non-gating items from the same post-merge review of #6719, all
disclosure rather than behavior.
blocked_recheck.go's package doc claimed the writes it does not record can
at worst leave a dependent "flagged ready while blocked". A sibling comment
two files away refutes that universal: addDependencyInTx documents that
parent-child adds are not monotonic, because adding an already-closed child
can satisfy an any-children waits-for gate. So an add of a still-open child
racing the close of that child strands the waiter in the other direction —
flagged blocked while ready and hidden from `bd ready`, which is the #6716
shape the recheck exists to fix, reached through `bd dep add` or
`bd create --parent`. The doc now states both directions. Recording the add
paths is the code fix, and it stays tracked separately.
The CHANGELOG's list of writes that still need the `bd doctor` /
`bd recompute-blocked` repair named `bd batch`, `bd cook`, `bd mol squash`,
`bd mol burn`, `bd duplicates --merge` and the wisp writes, but not the
proxied-server route: under `--proxied-server` the ordinary single verbs are
served by the uow provider (`bd close` reaches runCloseProxiedServer and its
BatchCloser), and no uow write is scoped. A proxied-mode operator reading
that list would have concluded their plain `bd close` races were fixed. The
code doc already disclosed this correctly; only the user-facing text did not.
closeIssueInTx hand-concatenated its recheck label instead of calling
statusChangeRecheckLabel, which exists so that a close through update and a
close through CloseIssue mint the same message. The helper returns the
identical string for the closed status, so no recheck commit message moves —
close_recheck_blocked_test.go:129 and :242 still assert the same text and
still pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* build(bazel): add the recheck publication guard to the dolt_test srcs
The post-merge review of #6719 found that this PR's own new test file,
internal/storage/dolt/blocked_recheck_publication_test.go, never reached
the go_test(name = "dolt_test") target. That target uses a gazelle-managed
explicit srcs list -- it names close_recheck_blocked_test.go and
journal_scope_completeness_test.go -- and the new file was missing from it,
so `bazel test` silently skipped the only pin on the ordering half of the
finding-1 fix.
Nothing caught it. The package's go_srcs filegroup is a glob(["**/*.go"]),
and `make bazel-sync-check` (tools/bazel/go_srcs.py --check) plus
scripts/bazel_policy_test.go only ever compare those glob filegroups, never
a go_test srcs list, so the sync check stays green while the target drops
the file. The glob filegroup sitting next to the explicit list is a decoy:
`bazel query 'kind("source file", deps(...))'` also reports the file as
present through it, and only `labels(srcs, //internal/storage/dolt:dolt_test)`
distinguishes the two -- that query returns the file with this line and
returns nothing without it.
Generated with `bazel run //:gazelle` and reduced to this PR's own file.
The same run also wants to touch twelve other BUILD.bazel files and to add
cli_mirror_ref_test.go to this same list; all of that drift reproduces
byte-identically from this branch's base commit with no part of this PR
applied, so it belongs to whoever landed those files, not here.
//internal/storage/dolt:dolt_test builds with the entry added, so the file
needs no new dep -- journalscan was already in the target's deps.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* ci(bazel): decide the RBE execution mode once, in an rbe job
Dependabot PRs are same-repo (fork=false) but receive no Actions secrets,
so the per-job vars/fork conditions sent them down the remote path with
no executor: every lane ran locally on the 2-vCPU Blacksmith runner and
the remote-only embedded tier timed out (review D1 F1). The conditions
were also repeated in every job and re-read at different times (F5/F6).
A new first job, rbe, decides the mode from four booleans (the
RBE_WEST_WORKERS var, rbe input, fork, and whether RBE_WEST_EXECUTOR is
non-empty) and outputs mode=remote|local|skip plus enabled. Every lane
needs it and takes runs-on, if and the setup-bazel env from its outputs
alone; remote-only bazel-embedded skips unless remote, local-capable
lanes run on ubuntu-latest for forks, rbe=off and secret-less runs.
Same-repo runs still skip while the var is unset. The outputs are also
workflow_call outputs (rbe-enabled, rbe-mode) for a future gate.
Policy tests: every lane needs rbe and uses the pinned expressions; no
value outside the decision step mentions the var, inputs.rbe or fork;
the one extra secret reference is pinned to the emptiness test in the
decision step's env; and the step script is run for same-repo, push,
Dependabot, fork, rbe=off, var-unset and mixed-case scenarios.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): add the advisory bazel-integration job
Runs `bazel test //... --config=integration` (#6916, main.yml's
integration jobs) as its own job in bazel.yml: remote-only like
bazel-embedded (skipped unless the rbe job chose remote), 30-minute test
step inside a 40-minute job, BEP plus check_testcases.py, test logs on
failure. A separate job keeps ci's and integration's shared
bazel-testlogs apart (review-integration F3). No equivalence step:
equivalence.py's default mode is the --config=ci selection, and its job
mode needs the integration jobs' go test -json, which no run here has.
check_testcases.py gains --not-go LABEL for a tested non-Go target
(//tools/bazel:dolt_version_test, a plain sh_test the integration tag
filter keeps); an exemption for a target the BEP does not list fails.
Policy test pins the job's command (no extra filter, selector or remote
config), the count step, the log upload, its remote-only if, and that no
other job runs --config=integration (nor this one --config=ci or
equivalence.py); the .bazelrc tag filter stays pinned by
checkBazelrcIntegrationLane.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): auto-push `make bazel-sync` fixes to PR branches
bazel.yml's BUILD sync step now writes the BUILD.bazel / MODULE.bazel /
MODULE.bazel.lock part of its drift as the bazel-sync-patch artifact
(scripts/ci/bazel-sync-patch.sh) and still fails. The new bazel-autofix.yml
workflow_run job (on "Bazel" and "PR") applies it with
scripts/bazel-autofix-push.sh: a sync commit on same-repo PR branches, an
idempotent apply-recipe comment on fork PRs.
Same security model as docs-autofix: the write-permission side never checks
out or runs PR code, extracts only the two expected regular files, and
refuses any patch naming a path outside an anchored allowlist (no hidden or
`..` segments, nothing under third_party/) or carrying a mode change,
symlink, rename or binary hunk; `git apply --index` and a post-apply check
back that up. Reuses the DOCS_AUTOFIX_TOKEN secret for the push.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): add bazel_autofix_push_test.go to scripts_test
`make bazel-sync` output, produced by scripts/ci/bazel-sync-patch.sh and
applied with scripts/bazel-autofix-push.sh as an end-to-end exercise of the
new autofix path.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): harden the bazel and docs autofix push scripts
Addresses the security review of the autofix pipeline, identically in
scripts/bazel-autofix-push.sh and scripts/docs-autofix-push.sh (the
security-critical functions are now shared verbatim):
- validate_patch refuses ANY "rename "/"copy " header (the legacy
"rename old/new" form slipped past and, on docs-autofix, pushed a
scripts.sh -> docs/cli-reference/x.md rename), checks every "index "
line whatever its ids, takes creations/deletions/renames from
`git apply --summary`, and reads names from `--numstat -z` (which
names only the NEW path of a rename; the old comment was wrong).
- docs-autofix gains the post-apply staged re-check and a --check mode.
- The patch is applied to an index in a bare clone (read-tree +
apply --cached + commit-tree): the PR tree never touches the disk.
All git calls run with core.hooksPath=/dev/null, GIT_LFS_SKIP_SMUDGE=1.
- Push is leased: --force-with-lease=refs/heads/$HEAD_BRANCH:$HEAD_SHA.
- The PR must target this repo, and the head branch must be neither
protected nor under a ruleset per the GitHub API (fail closed), on top
of the name list.
- Only a marker comment written by github-actions[bot] is ever edited.
- bazel-autofix only pushes files in packages the PR changed
(merge-base..head, computed from fetched refs), MODULE files only when
go.mod/go.sum/MODULE changed; base-branch drift is left alone and
listed, and a patch with nothing attributable gets a comment only.
Tests cover each reviewer attack for both scripts (--check and the full
flow against a local bare remote and fake gh), the staged check alone
with the validator disabled, spoofed comments, protection/ruleset/API
errors, the lease, main drift, and symlinked PR trees.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): trigger bazel-autofix on Bazel only; share job-level concurrency
- bazel-autofix.yml triggers only on "Bazel": pr.yml never calls
bazel.yml, so "PR" runs never carry the artifact, and their completions
cancelled real fixes through the workflow-level group. The policy test
now requires the triggering workflow to run on pull_request and upload
the consumed artifact instead of asserting the false claim.
- Both autofix workflows use one job-level concurrency group per head
branch (autofix-<head repo>-<head branch>) without cancel-in-progress:
skipped runs take no part, and the two bots queue instead of racing.
- Base checkouts use persist-credentials: false; docs-autofix extracts
only cli-docs-freshness.patch, as a regular file, outside the workspace.
- Policy tests for the trigger, concurrency scope, checkout, and the
scripts' shared guards (rename/index checks, comment author, lease,
protection lookup, index-only apply, hook-free git).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): tighten autofix attribution, circuit breaker and PR selection
Re-review follow-ups for the bazel and docs autofix push scripts:
- Root package: paths outside any Bazel package (docs/, .github/,
README.md, ...) no longer count as changing //:. Only root-level Go and
build inputs (*.go, *.s, *.c, *.h, *.bzl, go.mod, go.sum, BUILD.bazel,
MODULE.bazel*) make root BUILD.bazel drift the PR's, so main's root
drift is not pushed onto a docs-only PR.
- Circuit breaker: the head subject is read from the fetched commit (no
API), a failed read counts as non-convergent, and the check runs only
once the PR's own staged fix is non-empty. A bot head whose remaining
drift is main's now gets the "files this PR did not change" comment
instead of a wrong "did not converge" one. Same in docs-autofix.
- PR selection: several open PRs can share one head branch. bazel picks
the one whose number matches the artifact metadata (among PRs already
matching head repo/branch/base repo; head sha still verified); without
a unique match both scripts skip instead of taking .[0].
- The privileged clone fetches only the head (and, for bazel, base)
branch into an init'ed bare partial repo instead of cloning every
branch.
- docs-autofix job gets timeout-minutes: 10 (it shares a non-cancelling
concurrency group with bazel-autofix).
Tests: docs-only/README/workflow/Makefile PRs with root drift get no push,
a root Go change gets root BUILD.bazel; breaker cases (bot head with own
vs main drift, unreadable subject) for both scripts; PR selection by
metadata and ambiguity; HEAD_SHA 40-hex guard; staged-check mode arm; a
--summary-only validator copy; both workflows' download steps run as
written against a fake gh (run-scoped artifact listing, only the named
files extracted, symlinked entries refused); timeout asserted for both
jobs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): bazel-autofix requires bash 4; skip its tests on macOS bash 3.2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(ci): skip every autofix script test on bash < 4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): sync internal/utils BUILD with main
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(configfile): green — neutralize ambient BEADS_DOLT_SERVER_PORT in TestEnvVarOverrides fallback subtest (refs be-k5jdp)
* docs(release-gates): PASS 7/7 — be-c8kgv (ambient BEADS_DOLT_SERVER_PORT leak into BEADS_DOLT_PORT fallback subtest)
Independently re-verified review bead be-3fspd's evidence: package-level
52 PASS/0 FAIL/0 SKIP, target subtest green, gofmt/vet clean, 0 divergence
from origin/main, zero-conflict merge-tree simulation.
* test(configfile): neutralize the ambient vars the remaining TestEnvVarOverrides subtests inherit
Review finding 1 (blocking) on PR #6221: the sibling subtest "invalid port
env var falls through to config" has the same ambient-leak bug this PR is
titled after. It sets BEADS_DOLT_SERVER_PORT="not-a-number", so
GetDoltServerPort fails the Atoi and falls through to os.Getenv("BEADS_DOLT_PORT")
(configfile.go:514) — which the subtest never pins, so it reads the ambient
value instead of the config value it asserts.
Reproduced on this head, not on main:
BEADS_DOLT_PORT=28231 go test ./internal/configfile/... -run TestEnvVarOverrides
--- FAIL: TestEnvVarOverrides/invalid_port_env_var_falls_through_to_config
configfile_test.go:1080: GetDoltServerPort() = 28231, want 3308
Two more subtests in the same function have the identical shape: "database
default" and "database config value" both assert the config/default path of
GetDoltDatabase without pinning BEADS_DOLT_SERVER_DATABASE, which outranks
both (configfile.go:561).
BEADS_DOLT_SERVER_DATABASE=ambient_db go test ./internal/configfile/... \
-run TestEnvVarOverrides
--- FAIL: TestEnvVarOverrides/database_default
configfile_test.go:1121: GetDoltDatabase() = "ambient_db", want "beads"
--- FAIL: TestEnvVarOverrides/database_config_value
configfile_test.go:1128: GetDoltDatabase() = "ambient_db", want mydb
All three take the same one-line fix as the subtest already fixed here, so
they are folded in rather than deferred to another round trip. With all three
ambient vars set at once, TestEnvVarOverrides is 9/9 PASS.
Refs be-sf0uk, be-s0af7.
* docs(release-gates): scope the be-c8kgv diff accounting to the source commit
Review finding 2 (nit) on PR #6221: the gate record described the PR as
"Smallest possible diff (1 file, +1/-0)", and criteria 3c and 7 cited
`git diff --stat origin/main...797d4a9e0` — a different SHA from the PR head.
The per-criterion numbers were accurate for the commit the gate actually
evaluated, so they are kept and scoped explicitly to `797d4a9e0` rather than
rewritten. The Disposition no longer claims that accounting for the PR as a
whole, and the now-obsolete "correctly deferred" note on be-s0af7 records that
the reviewer overruled the deferral.
Adds a review-response addendum carrying the current file/line accounting and
the red/green evidence for both findings.
Refs be-sf0uk.
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-c8kgv-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(lint): suppress two darwin-only gosec findings and cross-lint the darwin build in CI
scripts/ci/pr-lint.sh lints natively on the ubuntu runner plus one
GOOS=windows CGO_ENABLED=0 cross-lint, so files behind //go:build darwin
(and the !windows && !linux fallbacks) were never linted in CI. Linting the
darwin build reports two gosec findings that are clean on linux:
- internal/config/permissions_open_nonlinux.go: G304 on os.Open(path). The
file comment already explains why it is safe (fixBeadsDirPermissions
re-checks descriptor identity before chmod); it just had no directive.
- internal/utils/path_case_darwin.go: G103 on unsafe.Pointer. A directive
existed but sat on the first line of a multi-line unix.Syscall call,
while gosec reports the argument line four lines down, so it never
covered the finding. It now sits on its own line above the statement,
the placement cmd/bd/nocow_linux.go already uses.
Add a GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 cross-lint block to
pr-lint.sh mirroring the windows block (same flags, same lane scoping,
skipped when the native target already matches), and update the three
places that described the wrapper as two passes: engdocs/LINTING.md,
engdocs/CI_CLEANUP_PLAN.md and the comment in main.yml.
The darwin pass is compile-only on the Linux runner: no macOS runner, no
change to the pr-lint platform column. Like the windows pass it is
CGO_ENABLED=0, so darwin+cgo code stays outside its reach.
* docs(linting): bump the Last reviewed marker alongside the pr-lint change
cmd/bd/list_proxied_integration_test.go skipped
ready_parent_tree_excludes_blocked_descendants and
tree_relates_to_does_not_nest_or_drop_epics (the GH#3936 regression) with
a TODO saying `bd dep add` had no usesProxiedServer() dispatch and failed
with "storage is nil" under proxied mode. That dispatch exists now
(cmd/bd/dep.go routes `dep add` to runDepAddProxiedServer), so the skips
only hid coverage.
Port both subtests from their embedded twins in list_embedded_test.go
unchanged apart from the proxied helpers (bdProxiedCreate, bdProxiedDep,
bdProxiedList). Same assertions, same flags, same failure messages.
Run under BEADS_TEST_PROXIED_SERVER=1 against the shared Dolt container:
both subtests pass (0.60s / 0.44s), whole TestProxiedServerList passes.
* fix: green — Fix: differential-regression CI budget is under the suite's own passing wall time (5 spurious reds/day) (refs be-3r5pr)
* docs(release-gates): PASS 7/7 — be-kqg23 (differential-regression CI budget fix)
Deploy bead be-23wcp, source commit 3afba49b69.
All 7 criteria raw PASS, no waivers. 62 pre-existing make-test FAILs
attributed to tracked bead be-9ogs6 via 4-part proof. Criterion 3c
(CI-config-diff live-run): PR #6271's own "Differential Regression"
job ran green under the new 40m/45m budget. PR #6271 open against
gastownhall/beads (contributor-only rig — no merge-request routed).
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-kqg23-gate.md
Tracked our internal gc-management/beads-rig release-gate checklist and
should never have been committed to this upstream branch -- it's process
residue from our deploy tooling, not part of the change itself.
Per maintainer bee-ghosttrack's request during review of PR #6571. The
root cause (our deploy tooling auto-committing this file) is already fixed
as of gm-qatxl1; this branch predates that fix, so this commit is cleanup
only -- no other content on this branch is touched.
Ref: be-lk7o3
bd list --help claimed an unconditional default of 50 for --limit, but
gatherListInput (cmd/bd/list_input.go) resolves effectiveLimit through
a switch: an explicit --limit wins, then --all is unlimited, then a
configured list.limit applies, then piped stdout (not a terminal) is
unlimited (GH#4094, #4158), then agent mode (BD_AGENT_MODE=1 or
CLAUDE_CODE set) at a terminal is 20, and only then 50. Neither the
piped nor the agent-mode arm was documented, so a script piping
bd list --json | ... or an agent at an interactive terminal could not
tell its actual limit from --help alone.
Reworded the --limit usage string to state those arms in the switch's
order, each with its precondition: an explicit --limit always wins
(so --all --limit 5 is 5, and 0 means unlimited); otherwise --all is
unlimited; otherwise a configured list.limit applies; otherwise
unlimited when piped, else 20 in agent mode at a terminal, else 50.
Added TestListLimitHelpDescribesPipedBehavior, which pins the usage
string verbatim (a substring check would accept a clause scoped wider
than its arm) and, with list.limit configured to 7, checks that
--all --limit 5 resolves to 5, --all to 0, and piped output to 7.
The flag keeps registering workapi.DefaultListLimit, so cobra still
appends "(default 50)" to the line: the registered value is never
consumed at runtime (list_input.go overwrites it with
config.GetInt("list.limit") when the flag is unset), but
internal/httpapi/apigen/types.gen.go documents it as the value the
flag registers, so changing it is out of scope here.
Fixesgastownhall/beads#6069
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(hooks): use host key identity when filtering child environments
Use execenv for the chained-hook guard and export Git routing filters.
Keep their existing per-consumer denylist and valueless GIT_CONFIG prefix
behavior while matching Windows os/exec key identity. Preserve the input
slice and exercise mixed case, Unicode, malformed keys and value handling.
The worktree-removal site from issue6198 remains owned by PR5623. This
stack depends on PR5672 and must not close6198 before both parents land.
* test(hooks): exercise both host key policies through actual filters (saa-cgh.89)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(hooks): share environment entry parsing and clarify serial seam (saa-cgh.89)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* build(bazel): list hook_env_test.go in cmd/bd go_test srcs
The PR's new cmd/bd/hook_env_test.go is untagged but absent from the
gazelle-managed go_test srcs list, so its two pins are invisible to
`bazel test //cmd/bd:bd_test`.
Both review lanes held this at minor on the grounds that untagged srcs
drift is tolerated in this package: three untagged test files
(config_leaked_secret_test.go, init_git_bootstrap_routing_test.go,
init_role_environment_test.go) are likewise unlisted at this PR's base.
That precedent is gone at the merge target. At origin/main 147047e15 the
census is 23 omissions, all 23 //go:build-gated, zero untagged -- main
landed all three rows -- so this file would be the merge target's only
untagged omission.
Two advisory steps in .github/workflows/bazel.yml (absent at this base,
present at the merge target) act on that: `Go test equivalence`
(tools/bazel/equivalence.py, which fails on any Go test `go test` runs
and Bazel did not, including "missing target"; neither new test name is
in equivalence_allowlist.txt) and the `make bazel-sync` drift check. The
job's `if` includes head.repo.fork == true, so it always runs for this
fork PR.
Generated by `bazel run //:gazelle`, which is what the drift step
compares the tree against. Gazelle also emitted the three base-owned
cmd/bd rows and an internal/notion change; all four are already present
at the merge target and were reverted so they merge from main's side.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* build(bazel): sync scripts go_test srcs (adopted base debt, not this PR's change)
scripts/upgrade_smoke_loop_test.go is untagged and absent from the
gazelle-managed go_test srcs in scripts/BUILD.bazel, which reds the
advisory Bazel lane two ways: `Go test equivalence` reports
`TestUpgradeSmokeMultiVersionDispatch` as a test `go test` runs and Bazel
did not, and the `BUILD files in sync` step's own `make bazel-sync` adds
the row and then fails on the drift.
This is NOT introduced by this PR, which touches zero files under
scripts/. The gap is identical at this PR's base fc2351a51c and at HEAD,
and the Bazel lane already fails on main's own pushes at fc2351a51c,
147047e15, 90f8e42f1 and 8c889c1f2 for this same reason -- it currently
reds for every PR in the repo. Carried here because main is unprotected,
so the pre-approval CI gate takes the strict path in which any failing
run blocks, with no base-preexisting bypass.
Generated by `bazel run //:gazelle`; the local drift is byte-identical to
the drift CI reported (9345584 -> 5dfc23e). Kept as its own commit so the
contributor's hook-env work stays separable from adopted base debt.
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(test): keep TestDoltServer_StartStop_UnixSocket's socket path short
t.TempDir() nests the test's name, which alone pushes the socket path past
the 104-byte sun_path guard under any TMPDIR longer than /tmp: the Bazel test
wrapper's per-process TMPDIR (114 bytes) and macOS's /var/folders/... both
silently skipped the test that main.yml's integration job runs. Put the
socket in a short os.MkdirTemp directory instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(testutil): let SubprocessRunner build with a declared go command
SubprocessRunner.Build ran `go` from PATH. Under Bazel there is no Go
toolchain on PATH, so //internal/testutil/integration's
TestBuildErrorIsMaskedByChmod failed there. BEADS_TEST_GO_BINARY, resolved
like any other runfile, now names the go command; unset, it is still `go`.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(bazel): integration-tag lane, --config=integration
main.yml's "Main Linux integration packages (N/6)" and "cmd/bd (N/8)" jobs
(and nightly's Full Test Suite) run every package with
-race -tags=integration,gms_pure_go, no -short and BEADS_TEST_SKIP=dolt.
Bazel never built the 55 `//go:build integration` files: gazelle drops a
file whose constraint names a tag it does not know.
- Root `gazelle:build_tags gms_pure_go,integration`: gazelle now lists the
integration files in srcs and their imports in deps, and generates
//internal/testutil/integration (integration files only). rules_go filters
those files out of every other build, so --config=ci runs what it ran.
- --config=integration sets the tag for the whole build, like `go test
-tags`, plus the jobs' race, BEADS_TEST_SKIP=dolt, -test.parallel=4 and a
1200s/19m timeout pair (rbe-west's action limit; the jobs pass 30m). The
same variants as PR core stay out (requires-docker, embedded, manual), so
`bazel test //... --config=integration` runs the union of the 14 shards.
A per-target gotags variant would not save the compile (gotags transitions
the whole dep graph) and would need a second, duplicated target per package
plus a tag to drop the plain one from this lane.
- //internal/testutil/integration:integration_test gets the pinned SDK's go
for SubprocessRunner's `go test -c`.
- TestBazelIntegrationLaneMatchesMainWorkflow pins test:integration to
main.yml's tags/race/BEADS_TEST_SKIP and gazelle's build_tags to a superset
of the tags; bazel.yml's `make bazel-sync` diff already fails when a file
gains the integration tag without a BUILD sync.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): sync scripts BUILD for upgrade_smoke_loop_test.go
make bazel-sync on current main adds the test file #6398 added.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): derive the integration lane's tag exclusions from PR core's
After main added the dolt-server tag, test:integration's filter still
selected those targets, and 5 of them fail under BEADS_TEST_SKIP=dolt. The
filter now excludes dolt-server, and the policy test no longer pins one
string: bazelPRCoreExcludedTags (kept equal to the taxonomy entries that say
"excluded from --config=prcore/ci") is the list both lanes check, the
integration lane minus the tags it runs. Every --test_tag_filters in the
lane or a config expanding it must exclude them, and no -test.short,
-test.skip, -test.run or --test_filter may reach it.
New tag integration-only for //internal/testutil/fixtures:fixtures_test and
//internal/testutil/integration:integration_test, whose tests are all
`//go:build integration`: --config=prcore/ci excludes them instead of
running two empty targets; --config=integration runs them. The .bazelrc
notes that ci and integration share bazel-testlogs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(bazel): note shared testlogs and dolt_test's subprocess build
bazel.yml's equivalence step reads bazel-testlogs, which --config=integration
shares with --config=ci, so a job running both lanes must check each right
after its own run. //internal/storage/dolt:dolt_test's SubprocessRunner tests
need a real `go test -c` with a module cache; they stay skipped under the
lane's BEADS_TEST_SKIP=dolt, so the target gets no go SDK data.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An implementation of the mail.delegate seam that gives any beads repo a
working bd mail. aweb is an open-source communication layer for agents:
durable mail and chat, wake-up events, local (team) or global
(cross-organization, federated) identities, signed and verified senders;
self-hostable or hosted. Guide and recording:
https://aweb.ai/docs/beads-mail/
Co-authored-by: Juan Reyero <juan@thestarmaps.com>
* feat(ids): say when a partial ID resolved to something else
ResolvePartialID tries an exact match first and only then falls back to
leading-prefix abbreviation (a3f8 -> a3f8e9). Ambiguity is already handled
well: two or more candidates return ErrAmbiguousID naming all of them. But a
*sole* abbreviation match was returned silently, so a caller could act on an
issue it never named with nothing to indicate the substitution.
The case that motivates it: a hierarchical child is a valid leading-prefix
match for its own parent's ID, because "." is a legal ID character and the
prefix test has no boundary. So once a parent ID is vacated — renamed away, or
deleted — `bd show <parent-id>` returns the child, exit 0, no signal. With
exactly one descendant it is silent; with two or more the existing ambiguity
error catches it. The silent case is the dangerous one.
Rather than narrow resolution (e.g. requiring a boundary so a child stops
abbreviating its parent), which changes semantics and risks breaking
legitimate abbreviations, this announces the substitution and leaves the
documented abbreviation UX alone.
Emitted from the resolver, not from individual commands: ResolvePartialID has
64 non-test call sites, so a per-command notice would be applied
inconsistently. One emission point covers all of them, and it sits at the only
return that hands back an issue the caller did not name.
stderr, never stdout, so --json payloads and piped output are byte-for-byte
unchanged. Gated on --quiet and BD_NO_PARTIAL_ID_NOTICE, following the
BD_NO_DEP_TYPE_WARNING precedent in cmd/bd/dep.go. Deliberately not gated on
stderr being a terminal, which is where it departs from that precedent: the
callers most exposed to acting on the wrong issue are scripts, hooks and
agents, and those are exactly the non-TTY ones.
Tests: the gate matrix (quiet, env opt-out, identical/empty resolution), the
message text, and end-to-end resolution over a small in-package fake store —
the existing resolver tests need a live Dolt server and self-skip without one,
so they cannot pin this in CI. Verified the end-to-end test fails without the
emission.
Co-Authored-By: Claude <noreply@anthropic.com>
* docs(changelog): link the partial-ID notice entry to its PR
Matches the surrounding entries, which each cite the PR or issue they came
from. No code change.
Co-Authored-By: Claude <noreply@anthropic.com>
* test(ids): cover the second silent return; disclose the notice's breadth
Review follow-up on #6302.
MAJOR — CHANGELOG understated the scope. The notice fires on every
leading-prefix abbreviation, not only the vacated-parent shape, so the ordinary
documented a3f8 -> bd-a3f8e9 path emits a line too, once per resolved argument.
The entry now says so, and says why the breadth is deliberate: a .-boundary
rule would fix parent/child and leave bd-x.1 -> bd-x.11 just as silent.
MINOR — an emission planted at the in-loop exact-hash return survived the
suite. The suggested repro (prefix-less a3f8e9 -> bd-a3f8e9) does not reach
that return: resolution has TWO fast paths, one on the raw input and one on the
prefix-normalized input, and the normalized one catches that case first. The
in-loop return is reached only CROSS-PREFIX, where the issue's real prefix is
an allowed one other than the configured default, so both fast paths miss and
the search loop matches on hash alone.
TestResolvePartialIDSilentOnCrossPrefixExactHashMatch covers it (configured
prefix bd, allowed hq, store holds hq-a3f8e9, input a3f8e9) and was verified to
fail with that mutant planted and pass without it. The prefix-less case is kept
as its own test, since it pins the normalized fast path staying silent.
TestResolvePartialIDNotifiesOnOrdinaryAbbreviation pins the breadth the
CHANGELOG now discloses.
Also: captureStderr restores os.Stderr from a defer so a panicking test cannot
swallow later tests' output, and closes the read end.
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix(config): name the native config environment source in errors
Identify APPDATA on Windows, HOME on Darwin/iOS, home on Plan9, and the
selected XDG_CONFIG_HOME or HOME source on other Unix hosts. Only error
labels change; the standard-library resolver and path precedence remain
the same, and the original wrapped error is retained.
Fixes#6314
Reported-by: bee-ghosttrack
Bead: saa-cgh.95
Agent-Signature: unknown-model/unknown-reasoning
* test(config): exercise native source diagnostics on the required platforms
Select the diagnostic parent and its two XDG states through one Bash3.2
driver in the existing three-host preflight matrix. Bind the declared OS
to Bash and the setup-selected Go host/target, retain child process status,
and reject missing, duplicate, unexpected, failed or skipped execution.
Preserve existing platform steps, job identity and required gate mapping.
Use the existing YAML workflow helpers to pin the new placement.
Follow-up: https://github.com/gastownhall/beads/issues/6314
Bead: saa-cgh.95
Agent-Signature: unknown-model/unknown-reasoning
* fix(config): keep native diagnostics with candidate builder (saa-cgh.95)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(make): quote build output paths (#5620)
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* test(make): scope fake Go PATH to the native build proof
Restore the prior PATH in finally so later install scenarios do not inherit
the fake compiler. Check that the YAML-extracted here-string begins with its
shebang at byte zero; YAML's common block indentation is already removed.
Refs gastownhall/beads#5667
Agent: unknown-model/unknown-reasoning
* test(make): confine fake compiler environment to the build proof (saa-cgh.80)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(make): use built candidate path in smoke targets (saa-cgh.97)
Reported by bee-ghosttrack in gastownhall/beads#6340.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(make): use shared build output for install (saa-cgh.97)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
---------
Co-authored-by: Bee <bee@ghosttrack.com>
* fix(defer): undefer clears a stray defer_until when status isn't deferred (ga-bq3w5)
`bd undefer` gated entirely on issue.Status == StatusDeferred. But the
ready-work query hides any issue whose defer_until is in the future
regardless of status, so `bd update <id> --status open --defer <date>`
(an explicit --status wins over --defer's own status=deferred default)
leaves status=open with a live defer_until: permanently invisible to
`bd ready`, with no command able to clear it. `bd undefer` refused with a
technically-true, practically-misleading "is not deferred (status: open)"
and never touched the timestamp actually doing the hiding.
Gate on defer_until instead of status alone: only flip status to open
when the issue really was deferred (mirrors the guard GH#3233 already
gave `bd update --defer=""`), but always clear a stray defer_until so
the issue can return to `bd ready`.
Adds a regression test reproducing the exact shape (status=open + future
defer_until via a single `bd update --status open --defer ...` call).
Confirmed it fails against the pre-fix code and passes with the fix.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(defer): mirror the undefer defer_until fix to the proxied-server route (ga-bq3w5)
PR review (bee-ghosttrack, round 1): the previous fix only patched the
embedded backend (undefer.go). runUndeferProxiedServer, used by
proxied-server/beads-team-server installs, still gated solely on
status == deferred and still overwrote status unconditionally — the
exact bug survives on that route, and CI treats it as first-class (15
green Proxied Dolt Cmd shards).
Mirror the same gate/write shape into defer_proxied_server.go: only
refuse when status isn't deferred AND there's no defer_until to clear;
only flip status to open when the issue really was deferred.
Also closes the reviewer's MINOR finding: the existing "open" fixture
can't distinguish the conditional status write from an unconditional
one (writing status=open to an already-open issue is a no-op). Adds
an in_progress case to both the embedded and the new proxied test —
confirmed by mutation that it fails against the unconditional-write
code and passes with the fix.
Shortens the undefer.go rationale comment and documents the
clear-without-clobbering behavior in the command's Long description,
per the reviewer's non-blocking nits.
Verified: go build/vet clean; gofmt clean; golangci-lint (native) 0
issues; BEADS_TEST_EMBEDDED_DOLT=1 go test -run TestEmbeddedUndefer
all 5 subtests PASS. The new proxied-server subtest could not be
executed in this sandbox (no Docker available for the shared Dolt
container), but go vet confirms it compiles and type-checks, and it
mirrors the embedded test byte-for-byte in structure. The windows
cross-lint step in `make ci-pr-lint` fails in this sandbox on files
untouched by this diff (confirmed byte-identical to origin/main) —
a pre-existing local environment gap, not a regression.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* test(feat): red — Make BEADS_MEM_PROFILE / BEADS_MEM_STATS work for the send-metrics child (currently silently inert) (refs be-wwy2.2)
* feat: green — Make BEADS_MEM_PROFILE / BEADS_MEM_STATS work for the send-metrics child (currently silently inert) (refs be-wwy2.2)
* fix(metrics): keep the flusher child's mem diagnostics off the parent's path
Maintainer review fixup for #6507 (adopt-pr review iteration 1).
Change Impact / Blast Radius (major). flusherChildEnv hands the detached
`bd send-metrics` child the parent's environment verbatim apart from the
endpoint and the flusher marker, so BEADS_MEM_PROFILE / BEADS_MEM_STATS
arrived holding the same absolute paths the parent had just resolved. The
spawn runs on main()'s post-ExecuteC tail (ExecuteC -> CloseAndFlush ->
MaybeSpawnFlusher), i.e. after PersistentPostRunE already wrote them, so
before this commit the child's trivial profile silently replaced the profile
of the command the user actually asked about -- no error, no size or format
anomaly. Error exits were worse: CheckReadonly and the pre-run gates call
CloseAndFlush while PersistentPostRunE never runs, leaving the child's file as
the only one written. This was PR-introduced rather than base behavior: before
the PR the child inherited the vars and ignored them.
Fixed by memDiagnosticsDest(), which suffixes the resolved destination with
".send-metrics" when BD_IS_FLUSHER=1. flusherChildEnv sets that marker only on
the spawned child, so a human running `bd send-metrics` directly still gets
the plain path. The suffix is applied after the flag/env fallback so both
knobs and both sources follow one rule. This is the synthesis's option (a);
option (b) (scrubbing the mem vars in flusherChildEnv) was explicitly not
taken, because it would reinstate exactly the inertness be-wwy2.2 removes.
Contract & Interface Fidelity (minor). --mem-profile is registered on
rootCmd.PersistentFlags(), so the hidden send-metrics command inherits it and
prints it in --help, but the call site hardcoded "" -- the flag was parsed and
then discarded, leaving the advertised half of the PR's own premise in the
same "accepted but silently inert" state it exists to remove, one line below
the fix. It now passes memProfilePath exactly as PersistentPostRunE does, and
the false "there is no --mem-profile flag on this hidden command" claim is
removed from both comments that carried it (send_metrics.go and
writeMemDiagnostics's own doc comment).
Tests: two new subtests, each mutation-proved to red on its own while the
other six stay green.
- "flusher child writes beside the parent's files instead of over them"
seeds the parent's two files, runs the child with BD_IS_FLUSHER=1, and
asserts the parent's bytes survive and the child's own diagnostics are
still produced at the suffixed paths. Reverting memDiagnosticsDest to
`return dest` reds it alone, with the parent's profile replaced by a real
gzip stream -- the finding's exact damage.
- "--mem-profile flag is honored, not just the env var" drives the flag with
no BEADS_MEM_PROFILE set, so only the flag can produce the file.
Restoring writeMemDiagnostics("") reds it alone.
Validation: gofmt clean, `go build ./cmd/bd`, `go vet ./cmd/bd`, and
`go test ./cmd/bd -run TestSendMetricsHonorsMemDiagnostics -count=1 -v`
(7/7 subtests, 15.0s).
Not taken, per the synthesis's explicit "do not block this PR": moving
writeMemDiagnostics next to CloseAndFlush so error exits are covered, and
warning to stderr when os.Create fails. Both are verbatim pre-existing
carry-overs whose remedies change behavior for every bd subcommand rather
than this one, so they stay follow-ups instead of riding a scoped fixup.
Contributor commits are preserved. --mem-profile's help text is unchanged, so
no CLI-docs regeneration is implied, and BEADS_MEM_* appears in no other Go
file, test, or doc in the tree.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* ci(bazel): add send_metrics_diagnostics_test.go to cmd/bd go_test srcs
The adopted branch adds cmd/bd/send_metrics_diagnostics_test.go, but the
go_test rule in cmd/bd/BUILD.bazel enumerates srcs explicitly, so Bazel
never compiled or ran this PR's own test. The advisory Bazel lane caught
it two ways on f4d6ad26a:
tests go test runs that Bazel did not (1):
cmd/bd TestSendMetricsHonorsMemDiagnostics
EQUIVALENCE: FAIL (unexplained divergence; fix the BUILD tags/targets
or add a justified allowlist entry)
and `make bazel-sync-check` printed this exact one-line diff. That lane
arrived in the 70-commit base advance this branch was refreshed onto
(#6898, #6896), well after the contributor wrote the test, so the gap is
an adoption artifact rather than a contributor miss. All 104 Bazel test
targets passed -- the only defect was that our test was invisible.
Generated with `bazel run //:gazelle` plus `tools/bazel/go_srcs.py`, not
by hand; the result is byte-identical to the patch CI printed, blob
7796339..2ed253f. `bazel mod tidy` is a no-op here (no go.mod change).
Validation on this commit:
- python3 tools/bazel/go_srcs.py --check -> rc=0
- bazel query 'labels(srcs, //cmd/bd:bd_test)' -> now lists the file
- bazel build //cmd/bd:bd_test -> rc=0, compiles and links
- bazel test //cmd/bd:bd_test --test_filter=TestSendMetricsHonorsMemDiagnostics
--test_arg=-test.v -> 1/1 target PASSED, and the shard log shows the
parent plus all 7 subtests "=== RUN" / "--- PASS", i.e. the test Bazel
previously never ran now actually executes.
BUILD metadata only; no production or test code changes.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(smoke): clear multi-version dispatch state in child runs (saa-cgh.108)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(smoke): copy the shared candidate helper when present (saa-cgh.108)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(smoke): observe child arguments after Bash startup (saa-cgh.108)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(smoke): retain child output in dispatch failures (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): allowlist prime args and exec os.Executable() in runBdPrime
The agent lifecycle hooks re-execute the bd binary to run `bd prime`
without re-entrant store initialization. runBdPrime built that exec from
os.Args[0] plus a variadic argument list, which static analysis flags as
a command taint surface: nothing structurally prevents a future caller
from passing arbitrary strings into the subprocess.
Harden the seam explicitly:
- validatePrimeArgs refuses anything outside the closed set of hook
flags (only --memories-only is ever passed today) before the
subprocess is built, so a caller can never steer the re-exec.
- resolve the executable with os.Executable() instead of os.Args[0],
so the target binary comes from the kernel's view of this process
rather than from argv.
No behavior change for the two real callers (codex-hook, cursor-hook),
which pass only the allowlisted flag or nothing.
Addresses the Snyk Code static-analysis finding on cmd/bd/agent_hook.go
line 26 as hardening.
* test(hooks): stub the re-exec seam and name the rejected argument
Review follow-up to 3435a5755 (round 1, non-blocking). Two test
robustness fixes:
- primeExecutable becomes an injectable seam (var primeExecutable =
os.Executable). The reject test now overrides it and asserts the
resolver never runs for rejected args, so a future reorder that drops
validatePrimeArgs fails the test instead of live-exec'ing the test
binary into a self-exec chain. No test path can reach
exec.CommandContext anymore, and the resolver error path gains
coverage of its own.
- The rejection tests assert the offender ("--config") rather than the
generic substring, so loosening the allowlist for one flag can no
longer mask another.
Also refreshes the PR-facing wording: os.Executable() is a small,
deliberate behavior delta over os.Args[0] (running binary instead of
per-call PATH lookup), noted in the PR description.
* docs(hooks): keep the nosec invariant text true through the seam
Review round 2, nit 5: the #nosec comment still named os.Executable
directly, but the value now arrives one hop indirect through
primeExecutable. Reword the invariant ("exe comes from primeExecutable,
which is os.Executable in production") so the annotation stays accurate.
Comment-only.
* review: pin the prime re-exec target and harden its resolver
Maintainer review fixes for iteration 1 (adopt-pr #6414).
major (Test Evidence Quality): no test reached the exec construction, so
the change's central claim -- that the *resolved* executable is the exec
target -- was unpinned; a mutant that kept the primeExecutable() call and
exec'd os.Args[0] passed all four new tests. Split the construction out of
the I/O as primeCommand(ctx, args...) (*exec.Cmd, error) and assert
cmd.Path and the full cmd.Args against a stubbed resolver. The sentinel
contains a path separator on purpose: exec.Command only skips LookPath for
names that do, so a bare name would leave cmd.Path host-PATH-dependent.
Verified by mutation -- reverting the exec target to os.Args[0] reds only
the new pin and leaves the original four green.
minor (Architectural Consistency): primeExecutable took one of the three
hardening steps doctor/fix's getBdBinary pairs. Give the production
resolver that precedent's shape -- EvalSymlinks (tolerating failure), a
*.test / .test. base-name refusal so an unstubbed test call fails loudly
instead of fork-bombing, and a validated PATH fallback -- and pin the
refusal the way doctor/fix's own suites pin ErrTestBinary. The residual
resolution trade-off, which the PATH fallback does not cover, is now
stated at the declaration instead of left implicit.
nit (Contract & Interface Fidelity): the #nosec named G702, which is not
the subprocess rule. Name G204 and say plainly that .golangci.yml excludes
it repo-wide, so no reader mistakes the annotation for what keeps lint
green.
Iteration 2 -- prose only, no behaviour change:
minor (Debuggability & Operability): the trade-off paragraph added above
documented a mechanism that does not exist. It said os.Executable "pins
/proc/self/exe", so a bd replaced in place by an ordinary
`go install ./cmd/bd` resolves to a "(deleted)" path the PATH fallback
does not cover, and credited inode pinning for PATH-independence. On Linux
os.Executable ends TrimSuffix(path, " (deleted)")
(os/executable_procfs.go), so no "(deleted)" path ever reaches the
resolver. Measured both cases with a live probe against a running binary:
replaced in place, EvalSymlinks SUCCEEDS and the re-exec runs the
replacement, so the documented breakage does not occur; deleted without
being replaced, EvalSymlinks fails, the tolerated-failure branch keeps the
stale path, and the fallback correctly never runs because os.Executable
returned no error. Re-scope the paragraph to that second case, which is
the real residual gap, and credit PATH-independence to the path containing
a separator -- exec.Command calls LookPath only when
filepath.Base(name) == name.
nit (Test Evidence Quality) declined, recorded so it is not re-litigated:
deleting the EvalSymlinks block leaves the prime selector green, so that
arm is unpinned while the other two red exactly one test each. Pinning it
needs a second production seam var for os.Executable -- the resolver reads
the real one, and under `go test` the .test refusal fires before the
EvalSymlinks result is observable -- which is more machinery than a
best-effort step whose failure is tolerated by design warrants. getBdBinary
has the identical gap, so this is an unclosed class rather than a
regression from this change.
* ci(bazel): make the prime re-exec hardening green on the Bazel lane
This PR was opened against a base that had no Bazel lane. The lane landed in
the base advance since (`.github/workflows/bazel.yml`, generated BUILD files,
and #6871's test-binary work), and it reds this PR in two independent ways.
Both are fixed here; neither is reachable from the PR's original base.
1. `cmd/bd/BUILD.bazel` did not exist at the old base, so gazelle never saw
the new `cmd/bd/agent_hook_test.go` and it is absent from `go_test(bd_test)`
srcs. `make bazel-sync` adds exactly the one line committed here, which is
what bazel.yml's "BUILD files in sync" step checks with `git status`. Of the
24 `cmd/bd/*_test.go` files absent from that list, the other 23 are excluded
by a `//go:build` tag; `agent_hook_test.go` is the only untagged one, and a
whole-tree gazelle run produces no other drift.
2. With the test file declared, `TestResolvePrimeExecutableRefusesTestBinary`
then fails under Bazel: rules_go links the binary as `bd_test`, so the
`.test` name checks never fire and `resolvePrimeExecutable` hands back the
test binary instead of refusing it. This is not just a test artifact — it is
the fork-bomb the refusal exists to prevent, live on the new lane.
`getBdBinary` (cmd/bd/doctor/fix/common.go), the precedent this resolver
deliberately restates, hit the same problem and #6871 (`ae1a493e0`) fixed it
by short-circuiting on `testing.Testing()` before the name checks. This
restates that answer, so the resolver stays arm-for-arm faithful to the
precedent it mirrors; the name checks are kept for `go test -c` binaries run
outside the harness, exactly as upstream keeps them.
Verified: `make bazel-sync` clean; `bazel test //cmd/bd:bd_test` (PR selector)
7/7 PASS where it was 1 FAIL before; `go test ./cmd/bd/` selector 17/17 PASS;
gofmt, `go build ./cmd/...`, `go vet ./cmd/bd/`, and a CGO_ENABLED=0
GOOS=windows vet all clean.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* test(bazel): dolt-server lane for the storage domain + uow job
--config=doltserver runs pr.yml's "Test (storage domain + uow)" job as
remote-executable Bazel tests: each dolt-server target runs an existing
go_test binary with BEADS_TEST_DOLT_SERVER=local, so every Dolt server
is a `dolt sql-server` child of the test process, started from the
pinned dolt the test wrapper already ships. No docker, no
no-remote-exec, and BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 fails a target
whose server cannot start, so cached results are trustworthy.
- db_dolt_test, uow_dolt_test (8 shards), tracker_dolt_test,
fix_dolt_test (4 shards, BEADS_FIX_REQUIRE_DOLT=1); GOMAXPROCS=4 like
the job's runner.
- no -short twins of domain, domain/fs, domain/git and
tracker/conformance, so the lane alone runs every package of the job.
- tag `dolt-server` in the taxonomy; test:prcore (and so test:ci)
excludes it. The requires-docker variants stay as the A/B control.
Remote (default instance, --nocache_test_results): 9/9 PASS in 113 s
wall; longest shard 111 s (uow). Per-test statuses, subtests included,
equal the job's go test -json on the same tree: 0 differences.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): contract corpus on the dolt-server lane
protocol_dolt_test runs protocol_test as pr.yml's "Contract corpus" job
does (non-race via protocol_race_off, BEADS_PROTOCOL_REQUIRE_DOLT=1) with
the local dolt sql-server backend, in 8 shards, so the corpus golden,
determinism and conformance tests run on remote workers and cannot skip.
Remote: 8 shards, longest 53 s. 153 tests (151 PASS / 2 SKIP, subtests
included) equal the job's go test -json: 0 differences.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the dolt-server lane in place of the docker lane
bazel.yml's container-lane job becomes bazel-doltserver: `bazel test
//... --config=doltserver`, whose targets start their own dolt
sql-servers and so execute on the remote workers (locally for forks and
rbe=off) instead of against the runner's docker daemon. The docker lane
stays reachable as the A/B control: workflow_dispatch dolt-lane=docker
runs --config=docker in the same job, with the image pull that only it
needs. Still advisory; runner, rbe-west gate and secret handling are
unchanged. Policy test and TESTING.md follow.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): reap processes left in a test's private root on exit
A Bazel test timeout signals the test's process group, which misses the
detached bd db-proxy-child processes (Setsid) and the dolt sql-servers they
start. A proxy that died without its idle timeout left its server orphaned on
a persistent remote worker. test_env.sh's EXIT trap now kills every process of
the current user whose command line names the action's private mktemp root
(pkill -f, two passes; a /proc scan when pkill is absent) before removing it.
The root is unique per action and never in the wrapper's own argv; cleanup
still cannot change the test's exit status.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): fail closed on every dolt-server target, checked per rule
The no-short twins (domain, domain/fs, domain/git, tracker/conformance) now
pin BEADS_TEST_DOLT_SERVER=local and BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 like
the lane's other targets, so a Dolt-server test added to those packages fails
instead of skipping into a cached pass.
TestBazelDoltJobMirrorsContainerJobs checked the env with a file-wide
substring search, so a docker variant in the same BUILD file covered for a
dolt-server target that lost it. It now parses each rule tagged dolt-server
and requires both variables, BEADS_FIX_REQUIRE_DOLT on fix_dolt_test,
BEADS_PROTOCOL_REQUIRE_DOLT on protocol_dolt_test, and no no-remote-exec.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(test): find the module root only when the concurrency test builds its binary
TestConcurrencyMultiProcess looked up go.mod before checking
BEADS_TEST_EMBEDDED_TEST_BINARY, so a pre-built binary run outside a
checkout (Bazel's runfiles hold no go.mod) failed before using it. Only
the fallback go test -c build needs the module root.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): job-mode equivalence reports TestEmbedded tests Bazel ran extra
The extra-test check always ignored ^TestEmbedded names, the --config=ci
lane's implicit skip, so a job comparison of the embedded tier could not
see a Bazel variant running more TestEmbedded* tests than the CI job.
Apply the skip only outside --job.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(bazel): embedded-Dolt tier variants and --config=embedded
PR Risk's embedded tier as embedded-tagged variants over the existing
race test binaries (no second compile):
- //cmd/bd:bd_embedded_test (20 shards) and
//internal/storage/embeddeddolt:embeddeddolt_embedded_test (5 shards)
run the jobs' own shard scripts through go_test_manifest_shard.sh, which
maps Bazel shard k to the script's shard k+1 of n and stops the binary
from sharding again. Each Bazel shard runs exactly the tests of the CI
job with the same number (same discovery, committed manifest and hash
fallback, binary flags). A plain -test.run ^TestEmbedded would not: nine
TestEmbedded* functions outside *_embedded_test.go run in no CI job.
- embeddeddolt_conformance_core_test / _audit_test pass the conformance
jobs' exact selectors and -test.timeout=30m.
- cmd shards use the race //cmd/bd:bd as BEADS_TEST_BD_BINARY, like the
jobs' /tmp/bd-embedded-test.
test:embedded: race, tag filter embedded, build_tests_only, the jobs'
-test.parallel (4) and no -short/BEADS_TEST_SKIP; eternal is capped at
1200s, rbe-west's maximum action timeout.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the embedded-Dolt tier in bazel.yml
New advisory job bazel-embedded (same runner, rbe-west gate and secret
handling as the other Bazel jobs) runs bazel test //... --config=embedded.
It is a job of its own so the tier's long race shards stay off
bazel-test's critical path and budget; it compiles nothing bazel-test does
not.
TestBazelEmbeddedJobMirrorsEmbeddedTier ties the config and variants to
pr-risk.yml: race builds, shard totals and scripts, BEADS_TEST_EMBEDDED_DOLT,
the race subprocess bd, the conformance selectors, and no -short.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(bazel): sync BUILD files after rebase onto main
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): Go timeouts below Bazel's 1200s cap for embedded variants
rbe-west caps actions at 1200s, so the eternal embedded variants are killed
there, and rules_go's wrapper ignores that SIGTERM: a hang ended as a bare
TIMEOUT without the goroutine dump the pr-risk.yml jobs rely on. The cmd
shards (job: -test.timeout=20m) and conformance core/audit (job: 30m) now
pass -test.timeout=19m, a documented deviation, so Go's timeout fires first.
Storage shards keep the job's 15m, which already does.
Correct the .bazelrc and BUILD comments that claimed the variants keep "the
jobs' own" timeouts, and state each target's effective limit. The policy
test now pins the 19m on the cmd shards and in place of the conformance
jobs' 30m (and flags a change of the jobs' value).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): fail bazel-embedded on targets or shards that ran no tests
The embedded variants inherit silent passes from PR Risk's shard scripts:
a shard the manifest assigns nothing exits 0 ("no tests assigned"), and a
manifest missing from the runfiles falls back to hash assignment, so every
shard still passes but no longer runs its job's tests.
- tools/bazel/check_testcases.py reads the run's BEP and fails if any tested
target's test.xml, or any shard's, is missing or lists no top-level test
(reusing equivalence.py's BEP and testlogs helpers). bazel-embedded writes
a BEP and runs it after the tests; test logs now upload on any failure.
- The policy test requires each manifest-sharded variant's data to hold its
shard script and the script's default manifest, and pins the new step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run bazel-embedded only with remote execution
Fork PRs and rbe=off dispatches ran the embedded-Dolt tier locally: 27 race
test processes (~7-10k test-seconds) plus the race compile of cmd/bd on one
GitHub-hosted runner, est. an hour or more per fork PR against the pool
whose job cap this track exists to relieve, while pr-risk.yml's embedded
jobs already run those tests for forks. bazel-embedded now runs only when
rbe-west is on (RBE_WEST_WORKERS, same repo, rbe != off); its job and step
timeouts shrink to the remote budget (60/50 min).
The policy test pins this job's if and keeps every other job on the shared
fork / rbe=off rule.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(testutil): local dolt sql-server backend behind the Dolt test server API
Add a second backend to internal/testutil behind the unchanged container
API (EnsureDoltContainerForTestMain, RequireDoltContainer,
StartIsolatedDoltContainer[Handle], NewContainerProvider,
RestartSharedDoltContainer, DoltContainerCrashed, IsolatedDoltContainer
Stop/Start/CurrentPort/Exec): the test process spawns `dolt sql-server`
from the pinned dolt CLI instead of a dolthub/dolt-sql-server container.
- BEADS_TEST_DOLT_SERVER=local|container selects it; unset keeps plain
`go test` on the container (no behavior change) and makes `bazel test`
use the local backend. Other values fail instead of guessing.
- The CLI (BEADS_TEST_DOLT_BINARY, else PATH) must be the image's version.
- Provisioned like testcontainers' dolt module: root@% (DOLT_ROOT_HOST=%),
database beads_test, user test/test. Clean env, TZ=UTC, GOMAXPROCS=4,
own dolt global config with metrics and the version check disabled.
- Loopback port picked here (dolt rejects -P 0), never 3307, retried when
another process wins the port; readiness requires the server's own
"Server ready" line plus a bounded ping, so a foreign listener on a
contested port cannot pass for it.
- State lives under the TMPDIR captured at package init, outside every
PinSuiteTempRoot root, so suite leak sweeps never see it. The server
stays in the test's process group (bazel's group kill reaps it) with
Pdeathsig on Linux.
- BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 now also makes every TestMain that
only warned about an unavailable server exit 1
(DoltUnavailableForTestMain), plus the shared proxied harness.
- dolt_benchmark_purge_test finds .dolt_dropped_databases relative to
Exec's working directory (the data dir in both backends).
- TestDoltServerFingerprint checks each available backend against one
checked-in fingerprint (users, grants, databases, server variables);
local-backend tests cover the bind-race retry, 3307, crash detection,
Stop/Start, Exec cwd, state outside the suite root, and teardown.
- Bazel: the requires-docker variants pin BEADS_TEST_DOLT_SERVER=container
so the docker lane stays the container A/B control; the test wrapper's
dolt global config disables metrics and the version check.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(testutil): select the local Dolt test server only when asked for
Under Bazel an unset BEADS_TEST_DOLT_SERVER used to mean the local
backend, so every non-ci `bazel test` started servers for Dolt suites no
lane runs with one (//internal/storage/dolt:dolt_test went from a 16 s
skip to a timeout). Unset now means container everywhere: in a Bazel
action without docker that is the pre-existing warn+skip, and only a
target's env or --test_env=BEADS_TEST_DOLT_SERVER=local starts local
servers. Plain `go test` is unchanged.
The docker variants keep their container pin: a rule env beats
--test_env, so a local-backend invocation cannot flip the docker lane.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(testutil): harden the local Dolt test server's host footprint
- DOLT_DISABLE_EVENT_FLUSH=1 for every dolt the backend runs (and in the
Bazel test wrapper): the metrics/versioncheck keys stop network calls
but not the detached `dolt send-metrics` child each command forks on
exit, which re-created the version probe's removed HOME (one leaked
bdt-doltver-* per test process) and raced terminate's RemoveAll.
- Every bdt-dolt-*/bdt-doltver-* root records its owner PID, and the
first use of the backend in a process removes this user's roots whose
owner is dead (the SweepDeadSuiteRoots rule; a copy, since doltserver's
tests import testutil). A panicking, timed-out or killed test binary,
or a package whose TestMain never terminates the singleton, no longer
leaks a 40-100 MB state dir per run.
- secure_file_priv is the state root's sfp/ directory, set through a
per-launch --config file (dolt ignores other flags with --config): a
local server runs as the test user on the host with a passwordless
root@%, so LOAD_FILE / INTO OUTFILE must not reach the user's files.
The fingerprint treats that path as the container's "".
- Fingerprint: character_set_server, collation_server,
max_allowed_packet, transaction_isolation, lower_case_table_names,
lower_case_file_system (compared on Linux only: APFS reports ON),
wait_timeout, innodb_lock_wait_timeout.
- The local backend's own tests skip off Linux (no Pdeathsig, so a
killed test binary would orphan servers on the macOS runners) unless
BEADS_TEST_DOLT_SERVER=local asks for them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci: compare the container and local Dolt test servers in the domain+uow job
TestDoltServerFingerprint's container half never ran in CI: only the
test-domain-uow job has both the pulled image and the pinned dolt CLI,
and it never ran ./internal/testutil. Run the fingerprint there (with
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 so the container half cannot skip)
so an image bump that drifts the container side fails in the PR.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Post-merge review of #6675 (landed 53ce8b545..73702cc73) left one gating
major: the server-backed delete role bypasses withVersionedHistoryTables.
#6675 made every fixed-list DOLT_ADD path in internal/storage/dolt append the
versioned-history tables, and said so in the helper's own doc comment ("Every
fixed-list DOLT_ADD path in this package routes through here"). Two paths did
not: deleter.Delete and sweeper.Sweep loop their hand-listed sweptTables
directly.
For the deleter that is a durability hole, not an inconsistency. A delete is a
version-completeness exemption for the row it REMOVES, never for its
transaction: DeleteInTx calls RewriteDeletedReferencesInTx, which updates every
surviving neighbor that cites a deleted id through UpdateIssueInTx -- the
minting entry point -- and commitWriteTx has scoped that transaction for
minting. So a delete of a cited bead mints issue_versions and store_epoch rows
inside a transaction that then stages only sweptTables and issues its own
DOLT_COMMIT: the rows sit in the working set, outside the commit that describes
them, unreplicated and liable to be swept into whatever unrelated commit stages
next. For the two append-only tables that loss is the unrecoverable kind
#6675's own hazard comment names.
Both loops now route through s.withVersionedHistoryTables(sweptTables). Sweep
mints nothing today (SweepInTx deletes through DeleteIssuesInTx, which rewrites
no neighbor), so that half is the funnel's consistency half: it shares the
table list and the minting-scoped withWriteTx with the deleter.
Coverage, so the funnel comment is enforced rather than asserted:
- TestEveryDoltAddStagesVersionedHistoryTables (new): every function in the
package that passes a DOLT_ADD statement must route its staged set through
withVersionedHistoryTables or MarkVersionedHistoryDirty, or carry an
exemption reason. commitWorkingSet is the one exemption -- it stages the
dolt_status-derived dirty set, so a dirty version table is already in it by
construction. Same shape as TestEveryRawTxVersionScopeIsScopedOrExempt,
including the exemption staleness check and the non-vacuity fatal.
- TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit (new): drives the
minting delete path no test drove -- a neighbor citing the deleted id, Force
to orphan it -- and requires dolt_status clean for issue_versions, store_epoch
and issues afterwards. History is enabled AFTER the fixture rows exist so the
delete's own transaction takes the first mint and seeds the epoch singleton,
which is what makes the store_epoch assertion load-bearing here.
Mutation evidence:
- Revert deleter.go's funnel call: the guard fails naming deleter.Delete ALONE,
and the new contract case fails on issue_versions and store_epoch and NOT on
issues -- the delete's commit happened, only the version rows were left
behind. TestDualWriteVersionRowsRideTheMutationsDoltCommit stays green, so the
new case covers an arm no incumbent covered.
- Revert sweeper.go's funnel call: the guard fails naming sweeper.Sweep alone
and both contract cases stay green. That asymmetry is why the sweeper's
coverage is the structural guard and not a behavioral pin.
Also adds store_epoch to TestDualWriteVersionRowsRideTheMutationsDoltCommit's
dolt_status loop -- the review's other in-file minor: the table whose loss the
change calls unrecoverable was the one table that test did not assert clean --
and names the delete/sweep planes in doltAddAndCommitInTx's HAZARD surface
list, whose widened-staged-set paragraph this change makes true of them too.
Deliberately not here: store_epoch.bumped_at is still DATETIME(0) after 0069
widened the paired version timestamps (non-gating minor, zero Go writers
today). 0069 has landed and is frozen, so the code arm is a new migration slot;
filed as bd-sor0q against the phase that gives bumped_at its first writer.
No CHANGELOG entry: SetVersionedHistoryEnabled still has no non-test caller, so
there is no user-visible behavior change -- the same reason #6675 itself added
none.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* feat(backup): run opted-in auto-backup on a managed-local proxied server
#6584 routed the five `bd backup` verbs over the proxied provider on
managed-local, and #6694 made `bd backup status` admit the remaining gap:
the proxied arm of PersistentPostRunE never called runPostRunAutoBackup,
so backup.enabled=true was inert on every proxied workspace. Close it.
The proxied arm now calls the auto-backup hook before it closes the
provider, under the direct arm's maintenance gate (strict --readonly,
`bd serve`, a migration freeze) plus previews. maybeAutoBackup picks a
backend for the command: the direct store as before, or the proxied
provider's RunNonTx seam, which `bd backup sync` already uses.
The proxied backend is honored exactly where `bd backup sync` is: the
"backup sync" capability row's rule for this workspace's topology, so
managed-local only. Auto-backup registers a server-side backup remote,
which on a server bd does not own is global to every client; an implicit
trigger must not get further than the explicit verb. It never opens a
provider of its own: a command that opened none (`bd dolt stop`) or
closed it (restore) backs nothing up rather than relaunching the server.
The default stays OFF, as on every server-mode workspace.
The register/sync-to-a-local-dir sequence that DoltStore and
EmbeddedDoltStore each carried a copy of moves to
versioncontrolops.BackupToDir (and HEAD lookup to CurrentCommit), so the
proxied backend reuses it instead of adding a third copy.
Tests: TestManagedLocalProxiedAutoBackup (default off, opt-in writes a
restorable backup, change detection, `bd dolt stop` stays quiescent,
restore round trip with issue-set equality; fails against origin/main);
TestManagedLocalProxiedBackupRestoreRefusedWhileAttached pins the restore
design (refused while another bd client holds the workspace, serving
child untouched, succeeds once it detaches); unit tests for the backend
locality gate, the post-run wiring, the status note and BackupToDir.
Both managed-local tests, and the existing round trip, are added to the
proxied-local smoke lane's compiled-in list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(backup): serialize auto-backup and bd backup sync with a workspace backup lock
Review follow-up on #6879. Auto-backup and an explicit bd backup sync
both run under the command's SHARED workspace gate, so nothing stopped
them overlapping, and auto-backup's remove -> add -> sync on one fixed
remote name races a concurrent copy of itself.
A per-workspace flock (.beads/backup.lock, already gitignored by
*.lock) now serializes them in every mode. Auto-backup takes it
non-blocking and skips when held (the throttle is left alone, so a
later command retries). bd backup sync waits up to exclusiveGateWait -
the bound restore's exclusive gate acquisition uses - then fails with
"another backup is running for this workspace" before touching the
store. Restore needs no part in it: its exclusive workspace gate
already excludes every command that could hold the lock.
Tests: lock semantics (refusal while held, bounded wait, release),
auto-backup skipping while held and running once released, and sync
failing loudly without reaching the store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(bazel): require exclude read-permission coverage in test:prcore
pr.yml's PR Core step sets BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1 so
TestAddExcludePatternsRefusesReadErrors fails, rather than skips, on a root
or non-POSIX executor. test:prcore now sets it too, and a policy test keeps
the two in step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(bazel): compare Bazel runs with one CI job's go test results
equivalence.py --job takes a job's `go test -json` as the complete expected
set, so a Bazel selection can be shown to replace that job: every top-level
test the job ran must run under Bazel, no other test in those packages may,
and nothing the job passed may be skipped. --bep is repeatable (a job can map
to --config=ci plus --config=docker), and go_test_variant.sh sh_tests count,
since their go_test binary writes the same test.xml. In job mode a test seen
in several targets keeps its best status: the prcore run skips what the
docker variant exists to run.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): docker-lane variant for internal/tracker
pr.yml's "Test (storage domain + uow)" job runs ./internal/tracker/... with
-race and without -short or BEADS_TEST_SKIP=dolt, so tracker's TestMain
starts the shared dolt container and all 112 top-level tests run. Under
--config=prcore they skip. tracker_docker_test reruns tracker_test that way
in the docker lane, and tracker's TestMain now fails instead of skipping when
BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 and the container does not start.
The job's other packages (storage/domain, domain/fs, domain/git,
tracker/conformance) consult neither testing.Short nor the dolt skip, and
pass identically under --config=ci.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): publish the Bazel-built bd as a ci-build-artifacts artifact
pr.yml's build-artifacts job uploads ci-build-artifacts (bd-linux-gms-pure,
SHA256SUMS, build-manifest.txt), which PR Core, the domain+uow job and both
package gates download and check with `sha256sum -c`. The Bazel lane now
uploads the same name and layout from //cmd/bd:bd_for_tests, the non-race
gms_pure_go cgo bd its own tests exec (//cmd/bd:bd is race-built under
--config=ci); test:ci downloads it under --remote_download_minimal. No
consumer is repointed yet.
A rules_go binary has no vcs.* or CGO_ENABLED build settings: `bd version`
shows no commit, and scripts/verify-cgo.sh would pass it vacuously. No
consumer of this artifact reads either; the manifest records the commit.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): pure-Go and js/wasm lane for pr.yml's boundary job
pr.yml's "Check pure-Go and js/wasm boundaries (CGO_ENABLED=0)" job builds
bd and three test binaries with CGO off, runs a 16-name -short cmd/bd subset,
and runs the js/wasm hook refusal test under node with an exact count guard.
bazel.yml's new bazel-pure job does the same with Bazel binaries:
- --config=pure (--@rules_go//go/config:pure, -test.short) builds //cmd/bd:bd,
bd_test, embeddeddolt_test and tracker_test, and runs bd_test unsharded
with the job's -run selector (policy-tested to stay equal to pr.yml's).
- --config=js-wasm builds //internal/hooks:hooks_test for js/wasm
(--use_target_platform_for_tests satisfies the test toolchain; nothing is
tested by Bazel under it); the Go SDK's go_js_wasm_exec runs it under node
with pr.yml's selector and count guard, verbatim.
rules_go compiles every declared dep, and gazelle's deps ignore the cgo
constraint of beads' embedded-Dolt files, so a pure build compiled dolt's
store/nbs and failed in github.com/dolthub/gozstd (cgo only; go build never
imports it with CGO_ENABLED=0). third_party/patches/gozstd_nocgo.patch adds
panicking !cgo stubs for the API dolt uses.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): run prcore tests with -test.parallel=4 like pr-core.sh
pr-core.sh runs go test -parallel 4. test:prcore passed no -test.parallel,
so Go defaulted to GOMAXPROCS: the executor's core count (192 on a farm
worker) instead of a runner's 4, which let dozens of t.Parallel bd
subprocesses run at once. A policy test keeps the value equal to
pr-core.sh's GO_TEST_PARALLEL default.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): -test.parallel=4 in the pure lane
pr.yml's pure-Go job passes no -parallel, so go test uses GOMAXPROCS, 4 on
ubuntu-latest; under Bazel the default would be the executor's core count.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): run the contract corpus non-race in the docker lane
pr.yml's Contract corpus job runs go test ./cmd/bd/protocol without -race,
but --config=docker races every target. protocol_docker_test now runs
:protocol_race_off, protocol_test built through a race=false transition
(tools/bazel/race.bzl), so no second go_test rule has to track gazelle's
srcs. Tagged manual so other lanes do not build it; the extra non-race work
is protocol_test's link plus ~100 test-only libraries.
The docker lane also mirrors the jobs' concurrency now: they pass no -p or
-parallel, so go test uses GOMAXPROCS, 4 on ubuntu-latest, for both; the
lane runs at most 4 test processes (so at most 4 dolt containers start at
once) with -test.parallel=4. It writes -test.v test.xml like test:ci, for
equivalence.py.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): run the docker lane in bazel.yml
New advisory job bazel-docker runs `bazel test //... --config=docker` on
ubuntu-latest after pre-pulling the dolt image like pr.yml's container jobs.
The requires-docker variants (domain/db, uow, tracker, doctor/fix,
protocol) run on the runner against its docker daemon (no-remote-exec);
their builds use remote execution when setup-bazel configured it. With
bazel-test's --config=ci this covers "Test (storage domain + uow)" and
"Contract corpus". The lane name is one env var, so a hermetic dolt-server
lane can replace it.
Policy tests now cover every bazel.yml job: an exact job list, timeouts, no
continue-on-error, pinned actions (setup-node added), one setup-bazel step
per job as the only secret reader, cache saves only in bazel-test, plus
job-specific mirrors of pr.yml (the docker job's runner, image pull and
lane; a requires-docker target in each container-backed package).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(bazel): build the non-race contract corpus in bd_for_tests' configuration
go_test_race_off only set race=false, while rules_go's go_transition (as
used by //cmd/bd:bd_for_tests, race = "off") also records the overridden
value in original_race. The two non-race configurations differed, so the
docker lane (and --config=ci, which builds protocol_docker_test through
//...) compiled the whole dolt graph twice without race. Record
original_race the same way: aquery GoCompilePkg for
deps(protocol_docker_test) under race drops from ~2630 actions in two
configurations to 1359 in one.
Fix the BUILD comment: manual does not keep protocol_race_off out of other
lanes' builds; protocol_docker_test pulls it in.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): job-mode equivalence fails on any target's failure or missing test.xml
In --job mode a test seen in several targets keeps its best status, so a
failure in one variant was hidden when another target passed the test, and
a go_test_variant.sh sh_test without a test.xml was skipped silently. List
every failed test per target and every target in the job's packages whose
test.xml is missing, and fail on either.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): gate pure-lane contamination, never cache docker-lane results
- gozstd_nocgo.patch: the stubs' package init panics, so a pure binary
that links gozstd (which CGO_ENABLED=0 go build rejects at compile time)
fails at startup. bazel-pure starts every pure artifact (bd version, and
embeddeddolt_test/tracker_test with -test.run=^$; bd_test runs its
subset) so contamination fails the lane.
- test:docker --nocache_test_results: the requires-docker variants depend on
host state no action key covers, like the container jobs' -count=1.
build:remote-exec --noremote_upload_local_results in the committed rc, so
local runs cannot seed the shared cache with host-dependent results.
- The artifact packaging moves to scripts/ci/package-bazel-bd.sh, which
sources .buildflags itself; sourcing it in bazel.yml exempted the whole
workflow from the build-tag scan.
- bazel-pure and bazel-docker use bazel-test's runs-on (Blacksmith when
remote execution is possible); the policy test pins it for every job.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): put the pure and docker lanes behind the rbe-west gate
Apply bazel-test's rbe-west setup-bazel env (RBE_WEST_EXECUTOR, instance
oss, RBE_WEST_WORKERS) and its job if to bazel-pure and bazel-docker, so
same-repo runs of all three lanes skip together until the variable is set
and forks and rbe=off dispatches still run locally. The policy test pins
runs-on, if and the setup-bazel env for every bazel.yml job.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): run the js/wasm hook test with a minimal environment
wasm_exec.js caps argv+env size, and the Blacksmith runner's environment
exceeds it ("total length of command line and environment variables
exceeds limit").
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than
An orchestrator's wisp retention step deletes every closed row in the
wisps table older than N hours, except a closed wisp that an
open/hooked/in_progress wisp depends on through parent-child, tracks or
blocks. `bd purge` could not express that: it selected the ephemeral
TIER (so closed --no-history beads, which live in the wisps table, were
left behind), it deleted a closed molecule root whose step was still
open, and it floored --older-than hours to whole days (36h swept rows
24h old). All three land together so `bd purge --wisps-plane
--older-than 168h --force` covers that step.
Live-dependent protection (issueops.SweepRequest.ProtectLiveDependents,
SweepSkips.LiveDependent): a candidate is held back when a live row
depends on it through a SweepLiveDependentEdgeTypes edge (parent-child,
tracks, blocks), read from both dependency tables. "Live" is the same
not-done set the reference scan uses, custom statuses included, so it
is a superset of open/hooked/in_progress. `bd purge` always asks for it
(no opt-out: removing live work's root is `bd delete`'s job); `bd prune`
does not. Reported as live_dependent_skipped in --json.
Wisps-plane selector (issueops.SweepWispsPlane, `--wisps-plane`): the
candidates are every closed row in the wisps TABLE, whatever its
ephemeral/no_history/wisp_type values, via a new single-plane search
(issueops.SearchWispsPlaneInTx) that the store backends call directly
and the unit-of-work provider reaches through
IssueUseCase.SearchWispsPlane, so embedded, server and proxied share one
body. It reaches durable-tier (no-history) rows, so it carries the
durable tier's require-a-filter gate.
--older-than (purge and prune): day values keep their meaning (7, 7d,
2w); anything else is a Go duration taken exactly (36h, 168h, 90m).
Tests: three new Sweeper contract cases (wisps plane clears the whole
table, wisps plane requires a filter, protects live dependents) run on
dolt, embeddeddolt and the uow provider; workapi unit tests; a CLI
retention scenario run in embedded, shared proxied and managed-local
proxied modes (fails against origin/main); TestParseOlderThan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(uow): classify IssueUseCase.SearchWispsPlane as a read in the notifying parity partition
TestRecordingIssueUseCaseCoversItsSurface requires every IssueUseCase
method to be either wrapped by the notifying decorator or exempted with
the reason it fires no hook. SearchWispsPlane reads state and changes
none, like SearchIssues beside it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(purge): refuse out-of-range --older-than; add --limit for bounded drains; cross-plane protection test
Review follow-ups on #6883.
--older-than: a day count past what a time.Duration holds (213504d,
30501w) used to wrap silently — 213504d became 25m26s, which on a
destructive command selected almost every closed row. It is now refused
as out of range; ParseDuration already refused oversized h/m/s values.
--limit N (issueops.SweepRequest.Limit, SweepResult.Remaining): one
purge deletes at most N rows, oldest closed_at first (then id), after
every protection, and reports the rest. --json adds remaining and
has_more when --limit is given. At ~15ms/row on the proxied path a
single unbounded sweep of a large backlog can outlive a caller's
deadline, roll back, and never clear; a bounded loop cannot. Negative
limits are ErrValidation at the role and refused at the CLI.
Tests: TestParseOlderThan out-of-range rows; contract cases
LimitTakesTheOldestClosedFirst and ProtectsLiveDependentsAcrossPlanes
(a live issues-table bead depending on a closed wisp via parent-child,
tracks and blocks keeps it) on dolt, embeddeddolt and uow; workapi
units for the ordering and the negative-limit refusal; the CLI
retention scenario now drains with --limit 1 and checks the overflow
refusal. CHANGELOG notes that sub-day Nh values used to round UP to a
day (12h is now taken exactly) and lists the protection under Changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci(bazel): add advisory Bazel workflow and setup-bazel action
Add .github/workflows/bazel.yml, a side-by-side lane that runs
`bazel test //... --config=ci` (PR Core parity) on pull_request,
merge_group, push to main and workflow_dispatch. It is advisory: not in
ci-gate's CI_GATE_REQUIRED.
.github/actions/setup-bazel installs a sha256-pinned Bazelisk (Bazel from
.bazelversion), restores the runner cache (--disk_cache and
--repository_cache only), and writes a CI bazelrc outside the workspace
and outside the cached directory. Remote execution is enabled only when
BAZEL_REMOTE_EXECUTOR, RBE_TLS_CERT and RBE_TLS_KEY are all set (base64
PEM cert/key; optional RBE_TLS_CA, RBE_INSTANCE); none set (fork PRs, or
workflow_dispatch rbe=off) runs locally; a partial set fails. The endpoint
and its bare host are masked. The rc logic lives in write-bazelrc.sh so it
is testable offline.
The runner cache is saved only by push-to-main runs under a run-unique key
and restored by prefix, so it never freezes at its first save and PRs do
not churn the quota. The job also reports the tier (T1/T2/local) and
wall time in the step summary, runs tools/bazel/critpath.py against the
profile, and checks BUILD drift with make bazel-sync-check plus
make bazel-sync and a clean git status.
tools/bazel/critpath.py reports the critical path as the sum of the
chained "critical path component" events rather than the longest one (a
cold race build: 395s over 75 components, where the single-component
version printed 69s and a false scheduling gap), lists the longest
members and Bazel's processes: cache line, and checks a report-only
budget (warning annotation, exit 0) unless --enforce is given.
scripts/ci_workflow_test.go covers the new lane: not wired into any gate,
every action SHA-pinned to the repo's released SHAs, no monolithic
actions/cache, no unbounded apt-get, the cache topology, secrets only
reaching setup-bazel, --profile after `test`, and the rc writer's
none/partial/full/invalid-PEM/secret-dir-in-workspace behaviour.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): check go test / Bazel test equivalence in the Bazel lane
tools/bazel/equivalence.py compares the Go tests `bazel test //...
--config=ci` ran with the ones pr.yml's go test lanes run, so a tag
filter, a stray manual tag, a package without a go_test target, or a
shard that runs zero tests cannot shrink the Bazel lane while it stays
green:
- package set: every package `go list -race -tags gms_pure_go` reports
with test files has a go_test target (bazel query);
- test-name set: every top-level TestXxx in the files go list selects
(minus ^TestEmbedded, as PR Core skips) appears as a testcase in the
test.xml of a go_test target this invocation tested (from the BEP);
runtime skips count as run. Tests Bazel ran that go test would not
are divergences too.
Expected differences go in tools/bazel/equivalence_allowlist.txt, one
justified line each (empty today); unused entries are reported.
Results go to the step summary; the full listing with --details.
.bazelrc test:ci now sets GO_TEST_WRAP_TESTV=1 (rules_go lists passing
tests in test.xml only under -test.v) and downloads test.xml despite
--remote_download_minimal.
The Bazel workflow runs the check after the critical-path report, and
nightly.yml calls the workflow (suite "bazel", and on schedule) with the
full listing.
Verified locally against a remote --config=ci run: 103 packages and
8843 tests on both sides. Tagging //internal/gitignore:gitignore_test
manual keeps `bazel test` green but fails the check, listing its two
tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(fs): run RepoContextAndRole from its own git repo
The test relied on its working directory being inside a git checkout to
make BEADS_DIR external to the CWD repo. Under Bazel the working
directory is the runfiles tree, not a git repository, so RepoContext
failed with "not a git repository" and the test skipped itself.
Create a second temporary repo and chdir into it instead; go test keeps
passing and Bazel now runs the assertions.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): fail equivalence on tests Bazel skips but go test passes
The equivalence docstring claimed runtime skips count as run because go
test skips them the same way. It does not: against PR Core's go test
-json on the same commit, 11 tests passed under go test and skipped
under Bazel while the check printed ok with an empty allowlist.
- equivalence.py --go-test-json compares per-test status with the
Bazel test.xml: passed under go test and skipped under Bazel is a
divergence; other status differences are listed, not failed. The
in-job (PR) run cannot see skip divergences and says so.
- The allowlist gains a `skip` kind (`<pkg> <test> skip # why`, the
justification still mandatory) and lists the 10 intentional skips:
cmd/bd TestGOMODCACHENotUnderTestHome and TestZZStdioNotLeaked, and
the scripts policy tests that walk the source checkout. The eleventh,
fs TestContextRepository_RepoContextAndRole, is fixed in the test.
- scripts/ci/pr-core.sh writes `go test -json` to
BEADS_PR_CORE_GO_TEST_JSON when set (same flags otherwise).
- nightly.yml runs that in a new job, uploads the JSON, and calls
bazel.yml with go-test-json-artifact, which downloads it and passes
--go-test-json to the equivalence step.
Verified on a remote `bazel test //... --config=ci` run: ok with the
allowlist; a TEST_SRCDIR-only t.Skip injected into
internal/gitignore TestAppendLines fails the check (and passes the
name-only in-job check, as documented).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): freeze the runner cache per lock, mask key material, tighten policy
Runner cache: every push to main saved ~2.3 GB (repository cache, disk
cache, Bazelisk) under a run-unique key, on a repo already over its
Actions cache quota. The cache now holds only the repository cache and
Bazelisk, whose content is fixed by .bazelversion and MODULE.bazel.lock:
exact key bazel-repo-v2-<os>-<hash>, restore falls back to the previous
lock's entry, and only a push to main that missed the key saves. No
--disk_cache in either mode (remote runs have the remote cache; local
runs never used it). About 2 GB per lock change.
Credentials:
- write-bazelrc.sh masks every non-armor line of each decoded PEM
(cert, key, CA). GitHub only masks the base64 value as stored. The CA
used to be decoded inside the rc redirect, so its mask commands would
have gone into the rc; it is decoded first now.
- The CI rc sets build:remote-exec --noremote_upload_local_results, so
CI never writes locally executed (PR-code) results into the shared
action cache. Developer rcs keep Bazel's default.
- RBE_INSTANCE stays optional; an empty one is a ::warning.
- bazel.yml's header states the accepted risk: same-repo PR code runs
with the RBE client certificate (as in gascity); forks never get it;
what is in place and what is pending a human decision.
Policy tests (each proved with a scratch mutation that now fails):
triggers must be exactly pull_request, merge_group, push,
workflow_dispatch and workflow_call (no pull_request_target); secrets
may appear only in the setup-bazel step's env, not in workflow or job
env, run, with or if; no continue-on-error anywhere in bazel.yml or
setup-bazel; the cache-save if is matched exactly; the critical-path
and equivalence steps must end with the bare script call and the test
step with exit "$rc", with no exit 0, || true, || :, ; true, set +e or
trap.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(ci): record the same-repo RBE decision in bazel.yml
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): bazel wrapper version check; keep go-test prose out of the build-tag scan
The wrapper prepends --bazelrc, so 'bazel --version' reached the server
as an unknown startup option; ask bazelisk directly. check-build-tags
matched 'go test' in workflow prose and step names.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(ci): run the RBE lane on Blacksmith runners; mask the executor's IPs
GitHub-hosted runners are refused by the remote-execution edge; the
Blacksmith pool (as in gascity) is admitted and does not count against
GitHub's concurrent-job cap. Forks and rbe=off keep ubuntu-latest.
Bazel prints the resolved executor address in connection errors, so mask
every address the endpoint host resolves to.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ci(bazel): target rbe-west (instance oss) behind RBE_WEST_WORKERS
The original edge does not admit CI runners. Mirror gascity: remote
execution uses secrets.RBE_WEST_EXECUTOR and instance oss when the repo
variable RBE_WEST_WORKERS is true; same-repo runs are skipped until then
instead of failing, while forks and rbe=off still run locally.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(doctor): detect test binaries with testing.Testing(), not the file name
getBdBinary refuses to return a test binary as "bd" so fix tests cannot
fork-bomb by re-running themselves. The guard matched only the `go test`
naming (<pkg>.test). Bazel names test binaries <target>_test, so under
`bazel test` every fix that shells out to bd re-ran the whole fix_test suite,
recursively (~60 levels), until the 300s timeout.
testing.Testing() is true for any binary linked as a test by `go test` or
rules_go (both set testing.testBinary=1), whatever its name. The name check
stays as a fallback. bd already links package testing, so the product binary
gains no dependency. Behavior under `go test` is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): tag taxonomy, docker lane, and green //scripts targets (slice B5)
`bazel test //... --config=ci` is now fully green, locally and with
--config=remote-exec.
- scripts_test declares what it reads and runs: this package's own tree
(:scripts_files), .github/** (//:workflow_files, widened from the
workflows), and .buildflags/.test-skip for scripts/test.sh. The complexity
diff test builds a one-commit git fixture instead of git-archiving the
real checkout's HEAD. Under Bazel it skips the whole-repo testing.Short()
scan (it would pass vacuously over the runfiles) and the two release
formula tests (.beads is in .bazelignore). Tagged host-tools +
no-remote-exec: it runs the host's git/python3/coreutils and some subtests
skip without git.
- prlintmake_test resolves fmt-check.sh through bazeltest.CallerDir and
declares it; it needs only bash (gofmt is shimmed), so it stays untagged
and runs remotely.
- //cmd/bd/doctor/fix:fix_docker_test reruns the fix_test binary (no second
compile, tools/bazel/go_test_variant.sh) with BEADS_FIX_REQUIRE_DOLT=1, like
pr.yml's container-backed doctor/fix job. Tagged requires-docker +
no-remote-exec; `--config=docker` selects it (race, no -short, no
BEADS_TEST_SKIP=dolt). fix_test itself stays untagged: under prcore it
skips the Dolt-backed tests exactly as pr-core's `go test` does.
- scripts/bazel_policy_test.go: every BUILD `tags` value must be in the
taxonomy, be named in the comment above its rule, and host-bound tags must
come with no-remote-exec; test:prcore must exclude requires-docker,
embedded and manual.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bd): reset git's cwd cache in TestContextRoutesNameOneWorkspaceTheSameWay
The test chdirs into a fresh git repo but reset only beads' caches. git
caches the cwd's repository context process-wide, so when an earlier test in
the same process had resolved it from a non-repo directory (for example
TestCollectMetadataEntriesNoBeadsDir), GetMainRepoRoot kept answering "not a
git repository". Test order hid it under `go test ./cmd/bd`; Bazel sharding
reorders tests and exposed it. Reproduces with plain go test:
go test -run '^(TestCollectMetadataEntriesNoBeadsDir|TestContextRoutesNameOneWorkspaceTheSameWay)$' ./cmd/bd
The cache is reset on entry only. Resetting it again in cleanup changes what
later tests inherit, and TestCreateRemoteRepoSkipsLocalDatabaseGuard (which
never resets it) then fails under the unsharded go test order.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): shard bd_test and embeddeddolt_test; keep test re-execs shard-free (slice B6)
- //cmd/bd:bd_test shard_count = 16, //internal/storage/embeddeddolt:
embeddeddolt_test shard_count = 8. Remote -race under --config=ci: bd_test
max shard 61-82s (unsharded 252-264s), embeddeddolt max shard 84-122s
(unsharded 207-377s). The embeddeddolt max is a single test
(TestWithPeerAuth, ~93s), so more shards would not lower it. Every shard
runs tests (bd 161-172 top-level tests each, embeddeddolt 15-20).
protocol (4s), legacysqlite (4s) and dbproxy/server (22s) stay unsharded.
- Tests that re-exec their own binary now pass bazeltest.ShardFreeEnv
(a no-op under go test), so a helper child does not inherit
TEST_SHARD_INDEX/TEST_TOTAL_SHARDS/TEST_SHARD_STATUS_FILE and filter away
the one test it was asked to run: dolt suite_leak_linux, dbproxy
force_stop_linux, workspacegate (3 helpers), metrics spawn_reap, bd
worktree_remove, conformance role_bundle, linear synclock (windows).
scripts/test_script_test.go (child env built from scratch) and
repro-dolt-prod-timeouts (copies the binary, never runs it) need nothing.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): keep sharded bd_test off ~/.beads and keep its stdio leak guard
Two things sharding //cmd/bd:bd_test exposed:
- config.Initialize walks up from the test's cwd for .beads/config.yaml and,
under BEADS_TEST_IGNORE_REPO_CONFIG, stops at the module root (go.mod).
The runfiles tree had no go.mod, so the walk left it; with the output base
under $HOME it loaded the developer's ~/.beads/config.yaml (here
dolt.shared-server: true) and two embedded-mode autocommit tests failed
locally, though not on remote workers. bd_test now declares //:go.mod, so
the walk stops at the runfiles root as it stops at the checkout under go
test. Unsharded runs hid this: an earlier test re-initialized config first.
- TestZZStdioNotLeaked skipped in every shard, because the baseline test is
always in shard 1 and the guard in another. Without a baseline it now
checks the descriptors instead (a leaked capture leaves a pipe where fd 1
or 2 was). Under go test the baseline is always captured, so nothing
changes there.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(bazel): sync BUILD files with test files added on main
Gazelle picks up cmd/bd and internal/notion tests that landed on main after
the last sync (make bazel-sync).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(discovery): add BEADS_CEILING_DIRECTORIES; bound bazel tests' walks
bd finds its workspace by walking up from the working directory for .beads
and .beads/config.yaml. Under `bazel test` the working directory is in the
runfiles tree under the output base, usually below the developer's HOME, so
the walks left the sandbox: tests read the developer's ~/.beads/config.yaml
(results depended on it) and wrote into ~/.beads (interactions.jsonl from the
audit log, .local_version from version tracking).
BEADS_CEILING_DIRECTORIES takes git's GIT_CEILING_DIRECTORIES form (a PATH-
style list of absolute directories): a search starting inside a ceiling never
examines the ceiling or anything above it; the start itself is always
examined. Unset, nothing changes. Honored by every upward .beads/config
search: beads.AncestorDirWalk (all FindBeadsDir walks), config.Initialize
(the go.mod and config.yaml walks, and the worktree-fallback git probe, whose
routing scrub drops GIT_CEILING_DIRECTORIES), findProjectBeadsDir, the legacy
upgrade guard, the --db beads-dir walk, store reopen and findBeadsRepoRoot.
The migration-freeze marker walk is left alone on purpose: it is a write
safety gate, and BD_MIGRATION_FREEZE_FILE is already its explicit override.
tools/bazel/test_env.sh sets BEADS_CEILING_DIRECTORIES and
GIT_CEILING_DIRECTORIES to the runfiles root, TEST_TMPDIR and its own temp
root. It does not fail on an ancestor .beads: a live ~/.beads above the
output base is normal on a developer machine. bd_test no longer needs
//:go.mod as a walk stop.
Canary check: with an invalid-YAML .beads above a scratch --output_base,
compact, issueops, validation and bd_test pass under --config=ci and nothing
is written there; the previous wrapper fails on it and writes
interactions.jsonl into it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bd): check for leaked stdio after m.Run in every process
TestZZStdioNotLeaked only sees the tests that ran before it in the same
process. Under Bazel's 16-way sharding that is ~1/16 of bd_test: the baseline
test is in shard 1, the guard in another shard, and leaks in the other shards
were never checked.
TestMain now compares os.Stdout/os.Stderr after m.Run with the streams from
before it (runTestsAndSweep, so every shard and every go test run) and fails
the process on a leak. The one allowed change is the framework's own
os.Stderr = os.Stdout under -json. TestZZStdioNotLeaked stays for its go test
report and skips when it has no baseline; the descriptor fallback added for
sharding is gone.
Verified: a test that leaks os.Stdout fails `go test -run` for it alone, with
and without -json; a clean -json run passes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): keep host-tools results out of the remote cache; tighten tag policy
- //scripts:scripts_test (host-tools, no-remote-exec) ran locally but its
result was still uploaded to the remote cache and served to other clients,
though the action key does not cover the host's git/python3/bash. It is now
also tagged no-remote-cache (neither read nor uploaded). Checked: after a
--config=remote-exec run and `bazel clean`, a rerun without the disk cache
executes the test again instead of taking a remote cache hit.
- Under Bazel a missing git or bash now fails those tests instead of
skipping (the host-tools tag promises them); under go test they still skip.
- Tag policy: host-tools requires no-remote-exec and no-remote-cache;
`tags = [...] + X` is rejected as non-literal; every --test_tag_filters set
by test:prcore or a config that expands it (test:ci, transitively) must
exclude requires-docker/embedded/manual, not only the first prcore line.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): run go_test variants from their package directory
rules_go gives a go_test GO_TEST_RUN_FROM_BAZEL=1 (and its `env`) through
RunEnvironmentInfo; an sh_test that reruns the binary gets neither, so the
binary skipped its chdir into the package directory and ran from the
runfiles root. go_test_variant.sh now exports GO_TEST_RUN_FROM_BAZEL=1, and
its header says the variant target must repeat the go_test's `env`.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): docker-lane variants for domain/db, uow and protocol
--config=docker only ran doctor/fix. pr.yml's container jobs also run
internal/storage/domain/... + uow/... (race, no -short, Dolt image pulled)
and cmd/bd/protocol (BEADS_PROTOCOL_REQUIRE_DOLT=1). Under --config=ci those
container suites skip (BEADS_TEST_SKIP=dolt), so without variants their
coverage would vanish if Bazel replaced those jobs.
- testutil: BEADS_TEST_REQUIRE_DOLT_CONTAINER=1 makes RequireDoltContainer
and StartIsolatedDoltContainer(Handle) fail instead of skip when the Dolt
container is unavailable (the generic form of BEADS_FIX_REQUIRE_DOLT).
- db_docker_test, uow_docker_test (4 shards) and protocol_docker_test
(8 shards, BEADS_PROTOCOL_REQUIRE_DOLT=1) rerun the go_test binaries via
go_test_variant.sh, repeating their `env`; tagged requires-docker +
no-remote-exec. The other domain/tracker packages have no container tests
and already run under --config=ci.
`bazel test //... --config=docker --test_arg=-test.v`: 4/4 PASS; db 908
PASS / 0 SKIP, uow 985 PASS / 32 SKIP (conformance capabilities the backend
does not implement, as under go test), protocol 151 PASS / 2 SKIP (tracked
known gaps). With --test_env=BEADS_TEST_SKIP=dolt, db_docker_test fails.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: shard-free env for the embeddeddolt concurrency helper; 2m bd init timeout
- concurrency_test re-execs its test binary with -test.run=^TestHelperProcess$
inside the now-sharded embeddeddolt_test; pass bazeltest.ShardFreeEnv so a
child cannot inherit TEST_SHARD_* and filter its one test away (it is
gated by BEADS_TEST_EMBEDDED_DOLT=1, so dark today).
- initBeadsWorkspace / runBDStdout (TestClose_UpdatesLastTouched and the
gemini prime hook tests) allowed 30s per bd subprocess. A -race bd on a
loaded host exceeded that for a single `bd init` (killed at 30.18s in 1 of
3 sharded remote runs; the whole test otherwise passes in ~21s), so allow
2 minutes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bd): give TestCreateRemoteRepoSkipsLocalDatabaseGuard its own git state
The test chdirs into a fresh non-repo temp dir but used whatever git/beads
cwd caches earlier tests left. When an earlier test had reset git's cache and
a later one refilled it from the package directory, workspace discovery in
the test returned the checkout's .beads (from a git worktree: the MAIN
checkout's live .beads via the worktree fallback) and `bd create` tried to
open it, so it failed with "could not verify workspace identity" instead of
the expected downstream error. It passed only on stale state (a cache
pointing at a deleted temp repo).
It now resets the git and beads caches after its chdir and again in cleanup,
so it neither depends on nor leaks cwd state. With that fixed,
TestContextRoutesNameOneWorkspaceTheSameWay also resets git's cache in
cleanup. Reproduced with the context-test cleanup reset in place, running
every cmd/bd test declared up to this one (the failing go test order); now
passes there, alone, with the two context tests, and under -shuffle seeds
1-5 (other pre-existing order dependencies show up under shuffle; this test
is not among them).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): re-sync BUILD files with main
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): pin BD_MIGRATION_FREEZE_FILE in test_env
The freeze-marker ancestor walk is intentionally not ceiling-bounded; an
explicit BD_MIGRATION_FREEZE_FILE replaces the walk, so a MIGRATION-FREEZE
above the output base can no longer change test results.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(scripts): give the complexity diff fixture a Go package
complexity.sh expands "${analyzer_paths[@]}" under set -u; with an empty
fixture tree that is an unbound-variable error on bash 3.2 (macOS runners).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
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
* fix(gitignore): preserve CRLF when appending project rules (saa-cgh.96)
Reported by bee-ghosttrack in gastownhall/beads#6343.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): pin detector edge cases and clarify append behavior (saa-cgh.96)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): preserve line endings in Git exclude appends (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): clarify exclude fixture path variable (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): refuse exclude writes after read errors (saa-cgh.110)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): share append byte composition (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(gitignore): explain append aliasing and trailing CR completion (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): use shared composition for exclude rules (saa-cgh.111)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): omit the empty exclude leading separator (saa-cgh.112)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): bind exclude writers to the selected Git directory (saa-cgh.109.16)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): isolate tracked-file guard from Git routing (saa-cgh.98)
Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6356.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): retain legitimate inherited tracking context (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): isolate trusted global configuration fixture (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(hooks): explain conservative tracked-file guard (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(git): resolve hooks paths in an explicit read-only context (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Bind init hook operations to the selected repository (saa-cgh.109.17)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Give the hooks tail fixture an explicit remote context (saa-cgh.109.17)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): canonicalize the hooks fixture repository root (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): complete selected hook options and alias handling (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Clarify hooks resolver ownership and preserve work-tree diagnostics (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Explain restoration of absent routing variables in selected exclude tests (saa-cgh.120)
Agent-Signature: Codex-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
* Identify the Git index behind tracked-hook refusals (saa-cgh.120.13)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(review): repair work-tree-less hook install and the fail-open secret guard
Maintainer adoption-review fixes for #6457 (iterations 1 and 2).
Blocking:
- cmd/bd, internal/git: `bd init` in a repository with no work tree stopped
installing hooks and printed "Failed to resolve git hooks".
git.ResolveHooksContext requires a work tree and deliberately errors without
one, so routing the selected-init path through it lost a capability base had
via beads.FindBeadsDir(). Add git.ResolveWorkTreelessHooksContext as the
explicit counterpart (empty RepoRoot/MainRepoRoot, relative core.hooksPath
anchored to the common directory) and fall back to it, so the install keeps
the selected, scrubbed context rather than the inherited one. It keys on "the
common directory resolved but the work tree did not", so it covers a bare
repository and a cwd inside a repository's own .git alike, and still refuses
non-repositories and directories inside a work tree. The `bare` and
`git_dir_cwd` rows in the hooks table test pin both shapes and assert the
install lands in the selected storage and configures the selected repository.
- internal/config: isGitTracked scrubbed Git routing with no fallback, so in a
checkout reachable only through legitimate GIT_DIR/GIT_WORK_TREE routing the
probe found no repository at all, the guard concluded "untracked", and
`bd config set <secret-key>` wrote the credential into a git-tracked
config.yaml where base refused. Give it the same two-probe shape as
hooks.gitTrackedFileContextWithEnv, with a legitimate-routing test.
- internal/config, internal/gitenv, docs: state the GIT_CEILING_DIRECTORIES
widening plainly rather than pairing it with a containment clause that is
false at every live call site. `-C`/cmd.Dir fixes where discovery starts, not
where it stops, so with the ceiling scrubbed the walk can reach a containing
repository above cwd; all three gitDirsForRepo call sites pass the process
working directory, which need not be a repository root. This mirrors the
wording init_proxied_server.go already had, so the tree no longer holds
contradictory statements about the same primitive.
- cmd/bd/config.go: the policy comment claimed all role commands ignore
inherited Git routing. Name the scrubbed paths without asserting a closed set
-- `bd config set/get/unset/set-many beads.role`, and the proxied-init role
tail, which goes through domain.GitUseCase.BeadsRole/SetBeadsRole and is
scrubbed on both of that repository's constructor arms -- and say that a path
which does not scrub still goes through the inherited environment: such readers
include internal/routing.roleFromGitConfig, RepoContext.Role,
doctor.CheckBeadsRole, `bd config show` and init.getBeadsRole; such writers
include init.setBeadsRole, `bd init --contributor` and `bd hooks --uninstall`.
The earlier wording framed the exception as role *resolution* only, which reads
as isolating the write plane when it is not isolated; a quantifier over "every
other" reader and writer goes stale in the opposite direction, since set-many
and the proxied-init tail are scrubbed, so neither list is exhaustive here.
Non-blocking:
- Scope the worktrees.md paragraph to the one startup probe that is scrubbed.
- Replace normalizeWorktreeGitEnvKey's ToUpper fold with execenv.KeyEqualForOS
so one subprocess key identity survives the PR.
- Compare beads.role against domain.BeadsRoleConfigKey with strings.ToLower
rather than strings.EqualFold, matching execenv.keyIdentityForWindows and
git's ASCII-only key folding, and pin it with Beads.Role/BEADS.ROLE rows
through GetConfig/SetConfig.
- Share the HooksContext workDir anchoring and symlink/case normalization
between both resolvers, so no producer of that type emits a spelling the
others do not.
- Branch the tracked-hook remediation hint on the proof label, so the inherited
case points at the routing rather than at `git rm --cached`.
- Restore the hook-status gate on the pure-JJ alias hint (base parity).
- Note that the boolean tracked-file wrappers are test-only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(review): reconcile the beads.role scrub with base #6477 on the refreshed base
Refreshing onto main 511849496 pulled in cf683435e (#6477), which makes
domain/git GetConfig propagate Git's exit error instead of mapping every
*exec.ExitError to absence. That collides with this stack's beads.role scrub in
both directions, and neither lane's CI could see it: the PR lane builds against
a base where #6477's test does not exist, and main's lane never has the PR.
Only the merged tree fails (each half passes on its own side alone).
The test half is taken byte-identically from stack parent #6464, which already
pushed this resolution against the same base commit (head 0fe936944). Both PRs
target main with every parent still open, so a divergent-but-equivalent fix here
would collide in the same file when the stack lands; copying theirs means the two
auto-merge. Re-validated and re-mutation-proven here rather than assumed:
- TestConfig_ReadFailuresAreNotMissing drops its "invalid_routing_boolean" row,
whose poisoned GIT_CONFIG_NOSYSTEM can no longer reach git for beads.role
(IsRoutingKeyForOS scrubs the whole GIT_CONFIG* prefix for that key), and gains
TestConfig_BeadsRoleScrubsInheritedRoutingEnv, which pins both halves: the role
key ignores the poison, and a key outside the scrub (user.name) still surfaces
it as exit 128 rather than as an absent key. #6477's read-failure contract for
beads.role itself is untouched, still proved by malformed_config through the
repository's own config file.
- TestInitGitRepositoryUsesSelectedDirectory/captured_home asserted
require.NoError with the comment "The existing reader maps Git exit errors to
absence" -- the premise #6477 deleted. It now requires the exit-128 error,
which is itself the proof that the generic constructor read the *current*
caller environment: only that environment can see the planted .gitconfig.
Mutation proofs at this head: deleting the beads.role carve-out reds
TestConfig_BeadsRoleScrubsInheritedRoutingEnv; reverting #6477's classification
reds both that test and captured_home. So neither retargeted fixture is vacuous.
Also silence two gosec G702 findings that only appear with this branch present.
Unscoped `make ci-pr-lint` at CI's v2.10.1 pin scores 0 on the old base and 0 on
current main, 1 on the pre-refresh adopted head (cmd/bd/worktree.go:22) and 2 on
the refreshed head (+ cmd/bd/hooks.go:1823). pr.yml scopes golangci-lint to the
PR's own diff so it can never report them, but main.yml deliberately sweeps the
whole tree, so they would red main's Lint job on the first push after merge.
Production reachability is identical on all three trees, so this is taint
widening rather than a new call path. Both sinks run a fixed "git" binary with
constant subcommands, matching the justification at init_stealth.go:84.
cmd/bd/worktree.go is the only file this adds beyond the branch's own 50; #6464
does not touch it, so the annotation cannot collide with the parent either.
---------
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>
* fix(exec): match Windows environment key identity (#5618)
Centralize os/exec-compatible environment-key comparison and use it for credential, metrics, Git-hook, trace, and repro subprocess filters. Preserve exact Unix semantics and Unicode near-collisions.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(worktree): scrub inherited Git routing state
Establish CWD as the worktree repository boundary before discovery can consume inherited Git routing. Fence the startup config probe, clear routing in-process before root pre-run discovery, and retain command-owned subprocess scrubbing as defense in depth without changing PID or signal semantics.
Fixes#5531
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* refactor(worktree): explain owned filtering and remove an unused shim
Document why filtering the fresh routing slice in place is safe and call
the shared routing-key classifier directly from tests. Retain the two
forwarders used by production worktree subprocess/removal paths.
Review: https://github.com/gastownhall/beads/pull/5623#pullrequestreview-5098421671
Bead: saa-cgh.23
Agent-Signature: unknown-model/unknown-reasoning
* fix(config): isolate identity and tracked-file Git probes from routing
Reuse the worktree routing owner for GetIdentity and isGitTracked so
explicit cwd/path selection is not displaced by inherited repository,
index or injected config state. Preserve identity precedence and the
tracked-secret refusal contract, with real target/decoy regressions.
Follow-up: https://github.com/gastownhall/beads/issues/6222
Dependency: https://github.com/gastownhall/beads/pull/5623
Reported-by: bee-ghosttrack
Bead: saa-cgh.93
Agent-Signature: unknown-model/unknown-reasoning
* test(execenv): exercise every environment operation under both host rules
Thread the host choice through narrow private helpers behind the existing
exported functions. Keep one normalization owner and retain native wrapper
tests; the additional table covers both host branches for equality, prefix
matching, last-wins lookup, filtering and input preservation.
Review: https://github.com/gastownhall/beads/pull/5672#pullrequestreview-5096948965
Bead: saa-cgh.78
Agent-Signature: unknown-model/unknown-reasoning
* docs(worktree): explain startup Git environment scope (saa-cgh.23)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(execenv): exercise exported host policy wiring (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): share subprocess key identity for Git routing (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(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(config): isolate role readers from inherited Git routing (saa-cgh.109.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(doctor): isolate role lookups from inherited Git routing (saa-cgh.109.2)
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(doctor): isolate explicit-path worktree fallback from Git routing (saa-cgh.109.6)
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
* test(beads): cover common-directory role routing (saa-cgh.109.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): explain system config routing flags (saa-cgh.109.6)
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(beads): scope stable worktree probes to selected path (saa-cgh.109.13)
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
* Clarify selected discovery probes and cover separate routing vectors (saa-cgh.120)
Agent-Signature: Codex-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
* Observe inline Git configuration directly in linked-worktree fixture (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(beads): select explicit directory discovery context (GH#6384) (saa-cgh.120.6)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitenv): retain explicit Git config suppression (saa-cgh.120.7)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(config): pin identity under null config suppression (saa-cgh.120.7)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitenv): keep role authority off inherited config suppression
Maintainer review fixes for PR #6461 (adopt-pr iterations 1-2). Addresses the
three major findings raised against the contributor branch, plus the major,
three minors and nit that iteration 2 raised against the first fixup; each fix
is pinned by a test that was mutation-proved against the pre-fix source.
F1 (major, security) — the leaf exempts GIT_CONFIG_GLOBAL=/dev/null,
GIT_CONFIG_SYSTEM=/dev/null and GIT_CONFIG_NOSYSTEM from ScrubRouting. Null
suppression cannot redirect a read, but it can blind one, and DetectUserRole
answers a missed read with detectFromURL, whose no-remote and SSH arms both
return Maintainer. Reproduced on this branch: a global beads.role=contributor
with GIT_CONFIG_GLOBAL=/dev/null resolved to maintainer, where the leaf's
parent fb7a93ad4 scrubbed the entry and read contributor.
Taken the synthesis's alternative arm (a): keep the exemption where the value
has no authority, drop it where it does. New ScrubRoutingAndSuppression
applies at every beads.role reader — internal/routing, doctor/role.go,
config_show.go, RepoContext.Role, bd config get/set/unset/set-many, and the
domain adapter's key-specific arms (see A1: iteration 1 claimed that last site
and did not actually reach it). Arm (b), making roleFromGitConfig's miss
non-permissive, was declined: "no beads.role and no remote implies maintainer"
is documented base behavior for local projects, so closing it there would
reclassify every such user rather than the blinded slice this PR introduced.
F2 (major, blast radius) — the stack hardened every role reader and left four
writer/reader sites fully inherited, a divergence that did not exist at base:
an inherited GIT_DIR sends setBeadsRole's write to another repository while
the scrubbed readers look at the one the user is standing in. All four now
share the same boundary (init.go's getBeadsRole/setBeadsRole,
init_contributor.go, hooks.go's uninstall --get/--unset pair).
The required fix also asked for cmd.Dir = repoRoot on the init.go pair. Still
not taken, but not on the grounds iteration 1 recorded (see A2). What holds is
the measurement against the vector the fix targets: with GIT_DIR, GIT_WORK_TREE
and GIT_COMMON_DIR gone, no production path chdirs away from the invocation
directory — `grep -rn 'os\.Chdir' --include='*.go'` over production cmd/bd
returns nothing and `bd init` takes no path argument — so threading a repoRoot
through both signatures and their eight call sites buys no behavior change
against a redirect.
F3 (major, security) — this PR converted internal/config's isGitTracked probe
from inherited to scrub-only. The guard is fail-open by construction, so in a
legitimately routed checkout (bare repo.git, GIT_DIR/GIT_WORK_TREE exported,
no in-tree .git) the probe stopped answering and `bd config set
linear.api_key` would have written the credential into a tracked file.
Restored the two-probe shape sibling #6464 applied to the structural twin:
scrubbed probe first, inherited second, either "tracked" refuses.
F5 (minor) — disclose that scrubbing GIT_CEILING_DIRECTORIES widens upward
discovery rather than bounding it, in the worktree comment and the docs
paragraph that asserted only the narrowing effect. F2's fix extends that
trade-off to two more sites, so the disclosure is now load-bearing.
F7 (minor) — renamed isConfigSuppression to isConfigSuppressionControl and
documented why the NOSYSTEM arm is deliberately value-blind. Took the
rename/document arm rather than restricting the arm to git-true values, which
would have contradicted the PR's own pinned table.
F10 (nit) — pinned both suppression tables in the windows-latest required
list; verified each name matches the gate's grep exactly once.
--- Iteration 2 ---
The first fixup's F1 census named a site it did not reach, and its cmd.Dir
rationale named a mechanism that does not hold. Both are corrected here.
A1 (major, security) — the domain adapter's key-specific arm was guarded by
`key == "beads.role" && r.env == nil`, which is dead on the only production
role path: runInitProxiedServerTail rebinds the use case to
NewInitGitRepository whenever t.workDir != "" (its sole construction site
passes cwd), and that constructor captures ScrubRouting(os.Environ()) —
non-nil, suppression retained. The nil-env constructor has no
BeadsRole/SetBeadsRole caller, so the arm could only fire from tests, while
`bd init` under an inherited GIT_CONFIG_GLOBAL=/dev/null still missed a global
role, took hasRole=false, and persisted beads.role=maintainer into
repository-local config, where it outranks the global value for every later
read in a clean environment. Iteration 1 therefore left F1's escalation not
just alive but durable, on the one path the fix was supposed to close.
Fixed by keying the strict scrub on the config key alone and applying it to
whichever environment the repository already carries (roleAuthorityEnv). That
preserves capture semantics — NewInitGitRepository keeps its captured HOME,
the property git_test.go's captured_home case pins — and removes only the
suppression entries. Codex's alternative of rebuilding the constructor's whole
env was declined: it moves every key for no gain on this finding.
A2 (minor, contract fidelity) — iteration 1 justified declining cmd.Dir with
"repository selection is left to the working directory — the one input the
scrub keeps". That is false, and false in the file a future reader consults
before deciding whether to bound the pair: GIT_CEILING_DIRECTORIES is a routing
key too, so the scrub removes a bound rather than installing one. Measured from
a non-repository directory nested under a repository: `git config beads.role
<value>` fails "not in a git directory" while a ceiling below that repository is
inherited, and writes that repository's local config once the ceiling is
scrubbed. The decline itself stands, since the measurement behind it was made
against the GIT_DIR vector; getBeadsRole now records selection as the working
directory *or a containing ancestor*, which is also what makes
clearWorktreeGitRoutingEnv's existing cross-reference to "init's role probe"
true.
A3 (minor, consistency) — `bd config unset beads.role` and `bd config set-many
beads.role=` were the two spellings of that mutation still on ScrubRouting, in
the same file as the two that moved. Both measured inert: `git config <key>
<value>` and `--unset <key>` target the repository-local file, which the
suppression variables cannot select. Moved for parity rather than annotated,
because a divergence inside one file is how the next one starts.
Test evidence (minor) — the writer pair's two subtests both pass on the
redirect alone, so downgrading getBeadsRole back to ScrubRouting left them
green even though suppression is the load-bearing half at those sites
(init.go treats a getBeadsRole miss as permission to write a default role).
Added a global_null blinding subtest with the same unblinded fixture guard.
A4 (nit) — doctor/role.go's isGitRepo was the last probe in that file on the
suppression-retaining scrub, and it gates the "beads.role not configured"
warning. rev-parse is config-sensitive through safe.directory, which lives in
global config, so a retained GIT_CONFIG_GLOBAL=/dev/null can downgrade that
warning to "N/A (not a git repository)". Moved onto the same boundary as its
two siblings. As the finding records, the safe.directory precondition was not
reproduced end to end; the change is uniformity within the file.
Tests. Every pin reds only on its own defect:
- routing: reverting to ScrubRouting reds only the blinded-read subtest; the
unblinded fixture guard and the PR's inject-vector table stay green.
- gitenv: keeping suppression reds 10 of 16 new subtests, none of the PR's.
- cmd/bd: restoring the inherited env reds both redirect subtests and names
both halves ("the write did not land where bd is standing" / "an inherited
GIT_DIR captured the write"), while the PR's own role roundtrip stays green
— it followed the same redirect on both sides, so it never saw this.
- config: the two arms are proved separately. Scrub-only reds only the
legitimate-routing subtest; inherited-only reds only the poisoned-routing
subtest, so the new fallback cannot be read as a way around the scrub.
- domain/git (A1): restoring the r.env == nil provenance guard reds
global_null only; unblinded stays green, and no other test in the package
moves — which is the same measurement that confirms the arm had no coverage
before this iteration.
Deferred to follow-up, recorded for the approval summary: F4 (delete
isRoleGitRepo and resolve the dead else-if), F6 (user.name degrading to
hostname, which needs the PR's own subtest re-pointed), F8 (execenv fold
divergence), F9 and F11 (GetIdentity hostname degradation under inherited
suppression). F9's mechanism is confirmed — identity supplied only via
GIT_CONFIG_COUNT is lost when GIT_CONFIG_* is stripped, git reports "Please
tell me who you are", while GIT_AUTHOR_*/GIT_COMMITTER_* survive — but its
"leave artifact commits on the inherited environment" arm would re-open the
GIT_DIR redirect this PR's tail swap closed, and the non-regressing arm
(re-injecting inline identity pre-scrub) is a design change with no observed
victim in this repo.
Validation (iteration 2): internal/{gitenv,routing,storage/domain/git} full
packages green; cmd/bd/doctor full package run; targeted cmd/bd run over the
role, config and init blast radius green at 54 tests; go build ./... clean; go
vet plus CGO_ENABLED=0 and GOOS=windows CGO_ENABLED=0 vet clean on every
changed package. Remaining local reds are base-parity, each matching the
recorded cause: cmd/bd/doctor's seven (the launcher's global
beads.role=maintainer short-circuits CheckBeadsRole before isGitRepo is
reached, plus Dolt server availability) and
TestInitContributorSetsBeadsRoleContributor ("--contributor requires
interactive prompts", this session's stdin is not a TTY).
--- Iteration 3 ---
Iteration 3 reviewed 0220eed32 and approved it: claude filed no findings,
codex's six fix validations all came back correct, synthesis recorded
Decision: approve, and the scorecard scored 881/1000 with Required Changes:
None. The residual was two minors and a nit, none of them merge gates. All
three are taken here because they are comment-and-constant scope, so nothing
in the approved behavior moves.
B1 (minor, blast radius; codex filed it as major, demoted at synthesis) — the
isGitRepo() gate that decides whether the role pair runs is still fully
inherited while the pair it guards is now strict, so from a non-repository
directory with an inherited GIT_DIR the gate opens, the scrubbed read misses,
and the safety-net write fails "not in a git directory". Recorded at the
GH#2950 safety net rather than restructured, for the three reasons the
demotion rests on. The achievable outcome is base parity: sync_git.go is
byte-identical at base and the pair was inherited there too, so a GIT_DIR
holder already reached Maintainer before this PR — more directly, by pointing
at a repository whose beads.role is maintainer. The failure is not silent:
init prints "Warning: failed to set beads.role" unless --quiet, and every
later detection prints "beads.role not configured (GH#2950)" with two Fix
lines. And the prescribed roleRepoAvailable() gate provably does not close it:
all five gate sites are bare `if isGitRepo()` with no else, so a strict gate
answers false in exactly the described band, nothing is written, the role
stays unset, and detection still falls to detectFromURL. The optional
hardening is therefore declined rather than deferred — it would delete a
warning and change no role — and the comment says so, so the next reader does
not mistake a gate change for closing the fail-open path.
B2 (minor, contract fidelity) — the getBeadsRole rationale iteration 2 wrote
to close A2 introduced a new overstatement in its closing sentence: "bd init
takes no path argument — the residual is upward discovery from an unintended
cwd, not a redirect". `bd -C <dir>` is a redirect and takes no path argument.
Verified in tree rather than from the finding: applyChangeDirSelection
(main.go) resolves the target's .beads dir and sets BEADS_DIR with no chdir,
it runs from the root PersistentPreRunE ahead of every init-related early
return in that hook, and init honors BEADS_DIR for workspace selection — so
`bd -C other init` acts on other/.beads while the pair reads and writes
beads.role in the invocation repository. init.go's own "PersistentPreRun
doesn't run for init command" note is about the later skipsStoreInit return,
not about -C, which is what made this vector easy to miss twice. Reachability
is bounded: -C requires an existing beads project at the target, so the
pairing arises on re-init rather than first init. Comment narrowed to name the
residual; threading init's resolved project root through the pair is the
stronger arm and stays out of scope as a behavior change.
B3 (nit, architectural consistency) — the adapter selected the role-authority
boundary on a bare "beads.role" literal while the use case passed the
unexported beadsRoleConfigKey, two spellings of one contract the compiler
could not couple. Exported it as domain.BeadsRoleConfigKey and compared
against it at both adapter arms; no new import edge, since package git already
imports domain. Mutation-proved rather than asserted: replacing the
comparison with the case-variant "Beads.Role" the finding names reds
TestInitGitRepositoryRoleIgnoresInheritedConfigSuppression/global_null alone
while unblinded stays green, so the drift the nit describes is caught by an
existing pin. The comparison is still exact, not case-folded: git config names
are case-insensitive, so a caller hand-writing a variant spelling would bypass
roleAuthorityEnv, but folding widens which keys take the strict environment
and no production caller passes anything but the const — a behavior change the
nit did not ask for.
Validation (iteration 3): go build ./... clean; go vet plus CGO_ENABLED=0 and
GOOS=windows CGO_ENABLED=0 vet clean on cmd/bd, cmd/bd/doctor,
internal/storage/domain, internal/storage/domain/git and internal/gitenv;
internal/storage/domain/... full packages green (domain, db, fs, git); targeted
cmd/bd role run green at 19 subtests with no skips
(TestBeadsRoleCommandsIgnoreInheritedGitRouting and
TestBeadsRoleWriterIgnoresInheritedGitRouting, including the suppression
subtest added in iteration 2); gofmt and git diff --check clean. Full cmd/bd is
still not run locally: it times out at base as well. The iteration-1 deferrals
are unchanged and still owed follow-up bead ids at finalize (F4, F6/F11, F8,
F9).
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* feat(storage): carry the git data ref of a git-backed Dolt remote
Dolt lets a git-backed remote keep its data on a ref other than
refs/dolt/data (the git_ref remote parameter, --ref on dolt remote add,
dolt clone, DOLT_REMOTE, and DOLT_CLONE). The storage layer never passed
it through, so a host that only accepts pushes under refs/heads/, or one
repository holding several databases on refs such as
refs/dolt/units/<key>, could not be used. Part of #6261; the commands
and the config key follow in a stacked PR.
- storage.RemoteInfo gains Ref (empty = refs/dolt/data);
RemoteRefsMatch, EffectiveGitDataRef, and GitRefFromParamsJSON give
every package one reading of it, pinned against dolt's constants.
- RemoteStore.AddRemoteWithRef on both stores, and CreateRemoteWithRef
on the proxied-server remote use case, pass a non-empty ref as
DOLT_REMOTE's --ref. AddRemote is unchanged; UpdateRemote keeps the
ref through replacement and restore.
- versioncontrolops.DoltCloneWithRef and dolt.BootstrapFromRemoteWithDBRef
pass the ref to DOLT_CLONE and to the dolt clone argv.
- ListRemotes reads the ref back from dolt_remotes.params (git_ref) in
both remote repositories; PersistedRemotes reads it from
repo_state.json. Malformed params is an error, never a silent default.
- The server-mode CLI mirror is compared on URL and ref and
re-materialized with dolt remote add --ref when the ref differs. Where
the CLI is proxied to the running server: the check reads the server's
own repo_state.json when the listing is empty, the cold-start fallback
re-adds a ref remote over SQL (which accepts --ref) so the server knows
it, and a throwaway probe remote proves --ref works before an existing
mirror remote is removed; probe remotes left by runs no longer alive
are swept before any change to the mirror. For a server this bd does
not own, the route stops and names the DOLT_REMOTE call to run
against that server through bd sql, as one shell-quoted word.
- A ref is checked for a space, an ASCII control character, DEL, and a
leading dash before it becomes a dolt argument; no other ref-name rule
applies at this layer.
- Tests carry both ref shapes; the embedded-engine test proves add, list,
push, and clone on the real engine; sqlmock tests cover the route
decider and the cold-start re-add at the store seam; the dolt-CLI tests
skip without a dolt binary.
* fix(storage): make both git_ref readers fail closed; pin the edges (#6521 review)
Maintainer review fixup for PR #6521. The review found no blocker or major;
this is the non-gating minor/nit set plus the test pins the synthesis named as
the residual defects.
- One reader for git_ref. storage.GitRefFromParams is now the single decoder
for both planes (the SQL params column through GitRefFromParamsJSON, and
repo_state.json through doltutil.PersistedRemotes), and a git_ref that is
present but not a string is an error naming the remote instead of silently
the default ref. Reading it as the default is how a mirror pinned to a custom
ref would be kept on refs/dolt/data -- the wrong-ref push this PR closes,
reached from the opposite direction.
- CreateRemoteWithRef checks the ref against what the dolt argv boundary will
accept, so the recordable ref set is no longer wider than the routable one
and a bad ref is refused at add time rather than diagnosed at push time.
UpdateRemote deliberately does not re-check: it carries and restores refs
that are already recorded and must stay able to put one back.
- BootstrapFromRemoteWithDBRef validates the ref before the already-exists
early return, so the same --ref is accepted or refused the same way on a
fresh host and on a bootstrapped one.
- sweepLeftoverProbes warns when it cannot remove another run's leftover probe
remote, following PersistedRemoteInfos' precedent: the remote stays visible
in `bd remote list` until some run succeeds, and nothing ever said why.
- EnsureCLIRemote's doc comment records that escalating a state-file read error
is intentional for default-ref remotes too, and
TestCLIMirrorUnreadableStateIsAnError now pins the ref == "" direction that a
later "helpful" relaxation would gate away. The suggested URL-match
short-circuit is deliberately NOT applied: when the state file is unreadable
currentRef is unknown, so returning nil on a URL match alone would route a
push onto whatever ref the mirror is secretly pinned to.
- AddCLIRemote's doc comment records that it is kept deliberately as the
default-ref spelling now that EnsureCLIRemote uses AddCLIRemoteWithRef.
Not applied: widening probeCLIRemoteRef to `ref != "" || currentRef != ""` and
probing the restore shape. On a proxied server that turns a working custom-ref
-> default-ref transition into a hard failure (the target add is plain and
succeeds today, while probing the restore shape would be refused), and in the
one window that survives calibration -- a non-proxied plain-add failure from
disk/lock contention -- a capability probe predicts nothing about it.
Each new pin was mutation-proved: reverting the fix it guards reds that pin,
and only that pin.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julian@gastownhall.dev>
* 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(init): isolate role configuration from inherited Git routing (saa-cgh.109.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): use the selected origin in contributor setup (saa-cgh.109.7)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): isolate Git writes in planning repositories (saa-cgh.109.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): retain inherited planning commit author (saa-cgh.109.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): align embedded role gates with selected Git context (saa-cgh.109.12)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): scope embedded artifact Git operations to selected directory (saa-cgh.109.15)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover selected optional artifacts and explain refused commits (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Honor role-probe cancellation and exercise actual fork planning (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): warn when automatic contributor role write fails (saa-cgh.109.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover successful nonquiet contributor role writes (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Assert the automatic contributor setup banner alongside warnings (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(init): read persisted role routing from the store (saa-cgh.120)
Agent-Signature: Codex-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
* fix(gitignore): preserve CRLF when appending project rules (saa-cgh.96)
Reported by bee-ghosttrack in gastownhall/beads#6343.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): pin detector edge cases and clarify append behavior (saa-cgh.96)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): preserve line endings in Git exclude appends (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): clarify exclude fixture path variable (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): refuse exclude writes after read errors (saa-cgh.110)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): share append byte composition (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(gitignore): explain append aliasing and trailing CR completion (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): use shared composition for exclude rules (saa-cgh.111)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): omit the empty exclude leading separator (saa-cgh.112)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): bind exclude writers to the selected Git directory (saa-cgh.109.16)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Explain restoration of absent routing variables in selected exclude tests (saa-cgh.120)
Agent-Signature: Codex-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): write embedded excludes in the selected project (saa-cgh.120.11)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): scrub the fork auto-detect gate; scope the startup-scrub claims
Maintainer review fixup for PR #6462 (adoption review iterations 1-2).
Gating major — hardened startup probe with an unhardened twin
------------------------------------------------------------
config.gitDirsForRepo (internal/config/config.go:419-424) is scrubbed by this
stack, but its byte-identical database-path twin
beads.worktreeFallbackBeadsDirForRepo (internal/beads/beads.go:1054-1058) runs
the same `git -C <repoPath> rev-parse --git-dir --git-common-dir` for the same
purpose and is not. Two claims added in this range asserted the boundary was
universal:
- docs/reference/worktrees.md:15 "Startup Git discovery probes for every `bd`
command scrub inherited Git routing variables" (false universal)
- cmd/bd/worktree_cmd.go:712 "Startup config discovery applies the same
boundary to its one pre-hook Git probe" (false singular)
Both are narrowed here to name only the plane that is actually scrubbed, and to
state that the `.beads` database-discovery probes still honor inherited routing.
The review offered a code arm (scrub beads.gitOutput,
beads.worktreeFallbackBeadsDirForRepo, and internal/git/gitdir.go:32) as the
alternative. That arm is DECLINED for this leaf, measured rather than assumed:
- Open sibling PR #6461 already carries it. At refs/pull/6461/head,
internal/beads/beads.go:293 routes gitOutput through
gitOutputEnv(gitenv.ScrubRouting(os.Environ())) and :1069 sets
cmd.Env = gitenv.ScrubRouting(os.Environ()) in the ResolveBeadsDirForRepo
twin, with internal/beads/{beads,context}_test.go coverage. Our head has
zero gitenv references under internal/beads (grep control).
- internal/git/gitdir.go is restructured wholesale by open sibling PR #6464
(loadGitContext/ResolveHooksContext), which documents "Routing variables are
honored, not filtered" as a deliberate choice.
- internal/beads/ and internal/git/ are not among this PR's 47 files, so the
code arm would rewrite two functions an open, non-ancestor sibling is
already rewriting in files this PR does not otherwise touch.
The twin is filed as bd-p4che with the failure scenario, the three unhardened
sites, the required decoy test, and the #6461 merge-order note, so the work is
tracked whether or not #6461 lands.
Minor — fork auto-detect gate left on inherited routing
------------------------------------------------------
cmd/bd/init.go:2002 gated the fork auto-detect block on the unscrubbed
isGitRepo() while the same single hunk hardened three setupForkExcludeAt(cwd, …)
call sites around it, and five sibling role gates in this PR already use the
scrubbed isInitRoleGitRepo(ctx). Under the invalid inherited GIT_DIR this PR's
own matrix uses, that gate returns false in a real fork clone and silently
suppresses the whole block — prompt, non-interactive auto-configure, and the
hardened writer at :2007/:2019. Switched to isInitRoleGitRepo(ctx) (same argv,
plus the scrub).
Pinned by a new fork_auto_invalid row in
TestEmbeddedInitSelectedExcludeRouting: it drops --setup-exclude so the exclude
write is reachable only through the gate, adds an upstream remote so the
already-scrubbed detectForkSetup reports a fork, and keeps --role=maintainer so
autoConfigureForkContributor stays an early return and the gate is the only path
that can add the pattern. The row carries the same fixture guard the sibling
role test uses, asserting the inherited probe really is refused.
Mutation-proved: with the gate reverted to isGitRepo() and the row in place,
only fork_auto_invalid fails ("selected exclude = "# owned project
exclude\nkeep-me/\n"; want ... "**/RECOVERY*.md"") while all six incumbent
subtests stay green — so the row adds coverage rather than duplicating an
existing fixture.
Not taken (non-gating, recorded so the next pass grades the call rather than
re-filing it)
----------------------------------------------------------------------------
- per-key `beads.role` scrub inside the generic accessor
(internal/storage/domain/git/git.go:110,133): the constructor contract it
straddles is owned by the parent legs; #6464 also edits this file.
- splitting gitenv.routingKeys into redirect vs fence sets
(internal/gitenv/routing.go): the class was filed on the parent PRs and the
set is shared by the whole family; changing it here would fork a primitive
five open branches consume.
- deleting the three zero-caller wrappers in cmd/bd/init_stealth.go:
cmd/bd/init_stealth.go is concurrently rewritten by open sibling #6461,
which does not carry this leg's setupStealthModeAt/setupGitExcludeAt split
(base 566c84ba8 greps 0 for those names; this head greps 5), so deleting
them here would conflict that rewrite.
Correction (iteration 2): the earlier reason for this bullet — "the file is
byte-identical across the open siblings at this head" — does not reproduce
and is withdrawn. git diff --name-only HEAD refs/adopt/pr6461 --
cmd/bd/init_stealth.go is NON-empty precisely because this PR created the
...At split; byte-identity with a sibling is only obtainable for siblings
that already carry this leg (empty against refs/adopt-pr-probe/6464). The
decision stands on the concurrent-rewrite reason above.
- nit, non-git `bd init` note (cmd/bd/init.go): no code change is owed on the
merits, which is its own reason rather than the execenv one it previously
borrowed. commitEmbeddedInitArtifacts (cmd/bd/init.go:3477-3483)
re-establishes the dropped repo gate as its own SCRUBBED
`rev-parse --git-dir` probe via initArtifactGitCommand (:3537-3541); only
the added stderr line is new.
- nit, unexporting execenv.KeyHasPrefixForOS: internal/execenv/execenv.go is
byte-identical to both siblings resolvable at this head
(refs/adopt/pr6461 and refs/adopt-pr-probe/6464 both diff empty), so
unexporting it here would fork a file they share.
Correction (iteration 2): the earlier "across all four open siblings"
quantifier overstated what is measurable — iteration 1's other two probe
refs no longer exist in this worktree, so the claim is scoped to two.
Iteration 2 (non-gating cleanup; no code, test, or behavior change)
------------------------------------------------------------------
The iteration-2 review found zero blockers and zero majors in this fixup's
delta and the quality scorecard decided approve. All three of its items were
documentation or record-keeping and are discharged here:
- Contract fidelity nit: the narrowed worktrees.md sentence had fixed WHICH
PLANE scrubs but kept the original's unconditional frequency ("on every
`bd` command"), while the probe its appositive names —
worktreeFallbackConfigPath — runs only under
`primaryConfigPath == "" && beadsEnvConfigPath == ""`
(internal/config/config.go:183). Reworded to separate the two: the scrub is
unconditional FOR THAT PROBE, and the probe itself is a fallback that runs
only when nothing earlier in startup already resolved a config path, with
an ancestor .beads/config.yaml or an explicit BEADS_DIR as the
short-circuits. Stated as a general condition plus examples rather than
swapping one unconditional claim for another. The review's suggested
wording cited internal/config/config.go:183; the line number is dropped
because no file under docs/reference cites Go line numbers (6 Go-path
mentions across that tree, none with :NNN) and a line citation in a doc
rots. The file reference is kept so the claim stays checkable.
- Release-safety minor: bd-p4che's required-fix section now also names the
two PROSE sites that assert the unhardened state (this worktrees.md
paragraph and clearWorktreeGitRoutingEnv's doc comment), with a
drift-proof `git grep "still honor inherited routing"` anchor, because its
close-out instruction previously named only the three code sites. If #6461
merges first, it adds the byte-for-byte pre-image of this paragraph at the
same location, so this fixup's hunk applies CLEANLY and would leave the
falsified wording behind silently; nothing in CI pins the file (absent from
scripts/check_doc_freshness_test.go). Only that merge order is silent, and
the direction is safe either way since stale wording under-claims
protection.
- Debuggability nit: the two "Not taken" bullets above are corrected, see the
inline "Correction (iteration 2)" notes.
Validation
----------
- git diff --check clean; go build + go vet ./cmd/bd ./internal/config green.
- 25 blast-radius cmd/bd tests green with BEADS_TEST_EMBEDDED_DOLT=1 and
BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1 (exclude/stealth writers, fork
auto-detect, init-role and worktree routing), incl.
TestEmbeddedInitSelectedExcludeRouting 7/7. The one skip
(TestInitPromptNonGitRepo) is the pre-existing "Dolt test server not
running" opt-in.
- An initial run showed 21 reds at 0.00s from a concurrent session sweeping
the shared /tmp/beads-bd-tests-* root; all pass under an isolated TMPDIR.
- Iteration 2 touches one Markdown file and no Go source, so the code
validation above still stands at this tree: git diff --name-only for the
iteration-2 delta is docs/reference/worktrees.md alone. git diff --check
clean. worktrees.md is not in scripts/check_doc_freshness_test.go's
freshnessDocuments and is named by no workflow, Makefile target, or test,
so no gate covers it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(git): reconcile role-config tests with the preserved read-error contract
Base advanced 11 commits during finalize and #6477 ("preserve config read
errors instead of treating them as absent", cf683435e) landed in the one
package this PR co-edits, internal/storage/domain/git. The rebase was clean
and no production code conflicts, but the two changes falsify each other's
test expectations in opposite directions:
- #6477's invalid_routing_boolean row injects GIT_CONFIG_NOSYSTEM to force a
beads.role read failure. This PR scrubs routing for beads.role, and
gitenv.IsRoutingKeyForOS classifies every GIT_CONFIG* key as routing, so the
injector can no longer reach that read. Retarget the row to test.marker so it
still proves a routing-induced failure is surfaced rather than swallowed, and
narrow the BeadsRole propagation assertion to malformed_config, which breaks
the repository's own config and is therefore immune to the scrub. Add a
positive pin that beads.role now resolves as absent without error under the
same poison.
- This PR's captured_home asserted NoError on the strength of "the existing
reader maps Git exit errors to absence", which is exactly the contract #6477
removed. Expect the error instead, matching the adjacent assertion that the
inherited writer fails on the same broken HOME.
#6477's guarantee is unchanged: the merged GetConfig keeps its classification
block and still uses cmd.Output(), which is what populates exitErr.Stderr.
Only this one injector for this one key stopped producing a failure.
internal/storage/domain/git 45/45 pass; removing the scrub from GetConfig makes
the new pin fail, so it is non-vacuous. cmd/bd blast radius 28/28 pass with
BEADS_TEST_EMBEDDED_DOLT=1, covering all six base-added init/temp-root tests.
---------
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>
* fix(notion): keep notion.token out of the Dolt database (#6676)
notion.token was missing from YamlOnlyKeys, so `bd config set
notion.token` (the command `bd notion status` recommends) wrote the
token to the Dolt config table, whose contents `bd dolt push` sends to
the remote. The git-tracked-config guard never fired for it either,
because checkSecretGitTracked only considers yaml-only keys.
- Add notion.token to YamlOnlyKeys, next to github.token, gitlab.token,
jira.api_token and ado.pat, so `bd config set` writes it to
config.yaml and refuses a git-tracked config.yaml.
- Map notion.token to NOTION_TOKEN in secretKeyEnvVarHints so that
refusal suggests the variable bd actually reads, not BD_NOTION_TOKEN.
- notion.ResolveAuth now reads config.yaml first, then the database,
then NOTION_TOKEN. The database read is kept only so a token stored
by an older bd keeps authenticating after an upgrade.
- resolveNotionAuth's no-store fallback goes through ResolveAuth, so a
config.yaml token is found even when no store is open.
- The proxied `bd serve` settings integration test used notion.token as
its credential-bearing key and read it back with `bd config get`,
which now reads config.yaml; it uses notes.api_token instead.
- The DB-backed-secret guard test used notion.token as its example of a
non-yaml secret key; it uses custom.api_token instead.
- Docs list notion.token with the other yaml-only secrets, and the
quickstart leads with NOTION_TOKEN because `bd init` in a git repo
leaves config.yaml tracked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(config,notion): delete leaked secret rows on unset; name the legacy auth source
Maintainer review fixes for #6724 (GH#6676).
Finding 1 (major, PR-introduced): moving notion.token into YamlOnlyKeys made
`bd config unset notion.token` return before the store, so a workspace that had
already leaked the token into the pushed config table lost its only bd-side
remover — exactly the population the PR exists to protect. configUnsetCmd now
best-effort deletes the database row for yaml-only SECRET keys and reports which
copies it removed. It is keyed on IsYamlOnlyKey+IsSecretKey rather than on
notion.token, so it closes the gap for the whole class; measured, that is at
least ado.pat, github.token, gitlab.token, jira.api_token, linear.api_key,
linear.oauth_client_secret and notion.token, plus whatever the prefix rules
(`ai.`, `sync.`, `federation.`, ...) admit. Non-secret yaml-only keys are gated
out before the store is opened, so an ordinary `bd config unset routing.mode`
still costs no database open. It reads before deleting because DeleteConfig
reports no miss, so the common never-leaked workspace stays silent instead of
announcing a removal that did not happen.
Finding 2 (major, pre-existing class): internal/notion/auth.go asserted "It must
never be written to the database" as an unqualified invariant while
PUT /v0/beads/config/notion.token still writes that row with no refusal. Scoped
the comment to the CLI door and named the HTTP/dashboard door as the known
remaining hole. Closing that door is deliberately NOT attempted here: it is a
cross-tracker change at workapi.ValidateSettingWrite/SetSetting on a
pre-existing surface, and belongs where every tracker credential gets the rule
at once.
Finding 3 (minor): the config.yaml token and the legacy row both reported
`config_token`, collapsing the safe case with the leaked one. Added
AuthSourceDatabaseLegacy plus a `bd notion status` rotation warning — the only
signal that gives the CHANGELOG's rotation advice an addressee.
Finding 4 (minor): pinned the end-to-end shape `bd config set` actually writes.
The finding cited internal/config/config.go:653 (setNestedKey), which is
SaveConfigValue's writer and not on this path — SetYamlConfig routes through
updateYamlKey/updateNestedYamlKey — but its conclusion held: the written shape
is nested. The new test drives the real writer rather than a second fixture, and
both its assertions were proven live by mutation (breaking the config.yaml read
trips the round-trip; forcing the flat fallback trips the non-vacuity guard,
while the round-trip alone still passed, which is why that guard exists).
Finding 5 (nit): both "not configured" errors led with `bd config set
notion.token`, which the new git-tracked refusal rejects in the default
post-`bd init` layout. They now lead with `export NOTION_TOKEN`, matching the
quickstart's ordering.
Also corrected the CHANGELOG, which still claimed unset clears config.yaml only.
Validation: ./internal/notion and ./internal/config green under `env -u
BEADS_DIR`. The cmd/bd notion/config tests are green except
TestConfigValidateReadOnlyIsHermetic and
TestGetNotionConfigReadsDBPathWhenStoreUnset, which fail identically at the PR
head with these fixes stashed (A/B in this same worktree) — ambient, not
introduced here.
--- Iteration 2 review fixes (one major, three minors, one nit) ---
Finding 1 (major, introduced by the iteration-1 fixup above): the cleanup
reached the store through openWorkspaceConfig -> ensureDirectMode ->
ensureStoreActive, which is open-OR-CREATE. So `bd config unset <yaml-only
secret>` in a workspace holding only .beads/config.yaml created a 2.1 MB
embedded Dolt database and flipped it out of db-less mode for every later
command -- from a command whose contract is "edit a YAML file", silently and
with exit 0. It also contradicted configCommandCanRunWithoutStore, which
classifies this exact invocation as runnable with no store precisely when
beads.FindDatabasePath() is empty. unsetLeakedSecretRow now returns early
rather than reach an open-OR-CREATE store in a workspace that has no database to
reach. The proxied route is exempt rather than gated --
proxiedWorkspaceConfig reaches an already-connected provider and creates
nothing, and a server-mode workspace legitimately has no local database
directory for FindDatabasePath to find, so gating it on the local path would
silently disable the cleanup exactly where the row is most replicated. Iteration 3 finishes
that thought: the same is true of the DIRECT server-mode route, which this gate
still skipped.
Finding 2 (minor): the remover ran only if the YAML unset succeeded first,
which skipped it for the population it exists for -- no config.yaml, or a shape
UnsetYamlConfig refuses. Base deleted the row there and the fixup did not, while
`bd notion status` names this very command as the remover. The cleanup now runs
either way, and a failed YAML unset carries the row's fate in its error instead
of telling the user to run `bd init` while a credential sits in the pushed
table.
Finding 3 (minor): a failed DELETE of a row the read had found was rendered as
"Could not check the database ..." under a JSON key asserting unreachability --
the one outcome that is certain, reported as the inconclusive one.
removeStoredSecretRow now returns the found bit alongside the error, and the
delete-failure case gets its own message and its own JSON keys
(database_row_present / database_delete_failed), carrying the rotation warning.
Finding 4 (minor): nothing pinned the command -> cleanup wiring; deleting the
call left every test green. The yaml-only branch is now runConfigUnsetYamlOnly
and four new tests drive configUnsetCmd itself against a recording settings
surface: the row is read, deleted and reported; a non-secret yaml-only key
touches the config plane zero times; --json carries the new keys; and .beads/ is
byte-unchanged (config.yaml aside) after unsetting a secret with no database
present.
Finding 5 (nit): CHANGELOG and docs/reference/configuration.md described the
dual removal unconditionally. Both now say the database half is best effort and
name the cases where it is skipped or refused.
Every new pin proven by mutation, one at a time, each failing only with its fix
removed: dropping the FindDatabasePath gate takes the no-database test into
embeddeddolt.OpenSQL (it really does provision); re-gating the cleanup behind
the YAML unset leaves the row undeleted and unmentioned; replacing the command's
cleanup call with a zero value drops the report and the --json field; returning
false for `present` on a failed delete puts database_unreachable back.
Complexity ledger flat by construction: worst_changed stays
showConfigYAMLOverrides at cyclomatic 17 / cognitive 29, which this PR does not
touch and which measures identically at the base blob. The extracted
runConfigUnsetYamlOnly is 6/9 and the three report helpers are at most 5/2.
Iteration 2 validation: ./internal/notion and ./internal/config green under
`env -u BEADS_DIR`; all nine cmd/bd leaked-secret/notion-auth tests green, one
-run per invocation (a batched regex shares rootCmd and produces false reds);
the CGO_ENABLED=0 gms_pure_go cmd/bd test binary still compiles (the new test
file is untagged, so it carries its own tree-snapshot helper rather than the
cgo-tagged twin); scripts/check-doc-flags.sh and `go test -tags=gms_pure_go
./test/docsync` pass for the docs edit.
--- Iteration 3 review fixes (two minors, both on the gate itself) ---
Finding 1 (minor, introduced by the iteration-2 gate above): "not proxied and no
local database directory" over-fires. findDatabaseInBeadsDir answers on
metadata.json plus embeddeddolt/ and dolt/, and it skips the stat for server mode
only when metadata.json is present -- so a metadata-less server workspace, whose
host comes from config.yaml or BEADS_DOLT_SERVER_HOST (main.go, GH#3545, the
shape gc provisions on every `gc-beads-bd start`), reports "" while its row sits
on the shared server, replicated to every remote it pushed to. The skip was not
buying anything there either: PersistentPreRun has already CONNECTED that
workspace's store, and ensureStoreActive early-returns on an active store without
opening or creating anything. For notion.token this was a narrow regression of a
base capability -- at base that key was not yaml-only, so `bd config unset
notion.token` took the database branch and deleted the row. The seven
pre-existing yaml-only secrets never had a remover at base, so for them the skip
withheld only new coverage, which is what holds this at minor. The gate is now
mayProvisionDatabase, which asks about the store before the disk; each arm that
returns false is a route where the database is already open -- proxied, or a
store already active and tracked, which is provably non-provisioning because it
is ensureStoreActive's own no-op arm.
Finding 2 (minor): neither arm of that gate had a behavioral test. Deleting the
!usesProxiedServer() clause left all four command-level tests green, and it is
the only thing keeping the cleanup alive for proxied workspaces, which have no
local database directory by construction -- the clause a later simplification is
most likely to read as redundant was the one clause nothing defended.
TestConfigUnsetCleansTheRowWithNoLocalDatabaseDirectory now pins both arms as the
mirror of TestConfigUnsetDoesNotProvisionADatabase: "no local database directory"
is the state all three share, so the route to the database is the only thing that
distinguishes them.
Both arms mutation-proved, one at a time, each red on exactly one subtest while
the four pre-existing command-level tests stayed green under both mutations:
deleting the active-store arm reproduces the finding verbatim (GetSetting calls =
[], UnsetSetting calls = [] for a connected server workspace, exit 0); deleting
the !usesProxiedServer() arm leaves the proxied workspace's row never looked for.
That second half -- the pre-existing suite staying green -- is the claim Finding 2
rests on, and only a run under the mutation can state it.
The CHANGELOG's "skipped where there is no database to hold a row" and the
matching sentence in docs/reference/configuration.md asserted exactly what the
gate got wrong; both now say it is skipped only where reaching the row would mean
creating a database, and that a server-mode or proxied workspace whose database
is simply not on local disk still gets the cleanup.
Complexity ledger still flat: worst_changed stays showConfigYAMLOverrides at
cyclomatic 17 / cognitive 29 (untouched, identical at the base blob), and
extracting the gate took unsetLeakedSecretRow from 6/5 to 5/4 with
mayProvisionDatabase at 4/3.
Iteration 3 validation: gofmt clean, `go build ./cmd/bd/`, `go vet ./cmd/bd/` and
`git diff --check` clean; the six leaked-secret/notion-auth tests and the four
command-level tests all green against the real fix, one -run per invocation under
a private TMPDIR (a batched regex shares rootCmd and produces false reds; a
sibling suite's sweep deletes shared temp roots mid-run); the CGO_ENABLED=0
gms_pure_go cmd/bd test binary still compiles; scripts/check-doc-flags.sh,
scripts/check-doc-freshness.sh and `go test -tags=gms_pure_go ./test/docsync`
pass for the docs edit (no new links, anchors or headings, so the render check
does not apply).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(bazel): run every test against a hermetic, pinned dolt CLI (slice B4)
Tests that shell out to dolt ran whatever /usr/local/bin/dolt the executor
had, a version outside the action key, and skipped (a vacuous, cacheable
PASS) on an executor without one.
- tools/bazel/dolt.bzl: dolt_release repository rule fetching the upstream
release pinned to scripts/ci/install-dolt.sh (2.2.0), sha256 for
linux/darwin amd64/arm64; MODULE.bazel declares one repo per platform and
//tools/bazel:dolt selects the one for the execution platform.
- //tools/bazel:test_env (the --run_under wrapper) carries the pinned dolt
as data. Bazel merges the run_under runfiles into every test's runfiles, so
every test action declares dolt as an input; test_env.sh puts it first on
PATH, exports BEADS_TEST_DOLT_BINARY, and fails the test if it is missing.
DOLT_ROOT_PATH identity seeding stays in test_env.sh.
- testutil.requireDoltBinaryPresent fails instead of skipping under Bazel.
- TestPinnedDoltCLIMatchesContainerImage also checks tools/bazel/dolt.bzl.
scripts_test declares the pin files and resolves the repo root through
bazeltest, so the three dolt pin tests now pass under bazel test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): declare the Go source dolt_test's scope guards scan
TestEveryRawTxJournalScopeIsScopedOrExempt, TestEveryRawTxVersionScopeIsScopedOrExempt,
TestTxMintingWrappersScopeVersionedHistory and TestHelperSubprocessSentinelsAreComplete
parse internal/storage/dolt and internal/storage/issueops at test time; under
bazel test that source was not in the runfiles, so all four failed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): tie hermetic dolt download to its version; skip on unpinned platforms
- Key DOLT_SHA256 by version and pass canonical_id=url, so bumping
DOLT_VERSION without new digests fails instead of silently reusing the
previous release from the sha256-keyed repository cache.
- //tools/bazel:dolt_version_test runs the hermetic dolt and checks it
reports DOLT_VERSION.
- Unpinned platforms (e.g. windows) resolve to an incompatible target, so
bazel build //... skips the wrapper there instead of failing analysis.
- test_env.sh also unsets BEADS_DOLT_BIN so it cannot bypass the pin.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
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(init): isolate role configuration from inherited Git routing (saa-cgh.109.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): use the selected origin in contributor setup (saa-cgh.109.7)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): isolate Git writes in planning repositories (saa-cgh.109.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): retain inherited planning commit author (saa-cgh.109.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): align embedded role gates with selected Git context (saa-cgh.109.12)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): scope embedded artifact Git operations to selected directory (saa-cgh.109.15)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover selected optional artifacts and explain refused commits (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Honor role-probe cancellation and exercise actual fork planning (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): warn when automatic contributor role write fails (saa-cgh.109.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover successful nonquiet contributor role writes (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Assert the automatic contributor setup banner alongside warnings (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(init): read persisted role routing from the store (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Bind early embedded Git bootstrap to the selected project (saa-cgh.120.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Create the owned separate-storage parent in the bootstrap fixture (saa-cgh.120.9)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init,gitenv,config): maintainer fixup for #6459
Review iteration 1, blocking:
- cmd/bd/init_stealth.go: scope the fork exclude writer the way this PR
scoped the fork detector. detectForkSetup now scrubs inherited Git
routing, but resolveGitExcludePath still ran `git rev-parse
--git-common-dir` with no Dir and no Env, so with GIT_DIR inherited
toward another repository bd detected the fork in the selected repo and
then appended `.beads/`, `**/RECOVERY*.md` and `**/SESSION*.md` to the
*inherited* repository's .git/info/exclude - automatically, with no
prompt, in non-interactive mode. At base the two halves agreed (both saw
the inherited repo, found no upstream, wrote nothing), so the PR is what
creates the disagreement. Scrubbing the probe is the whole remedy: no
cmd/bd caller chdirs, so `repoPath == ""` already means the selected
project directory once inherited routing is gone. The new test asserts
both halves - the selected repo is written, the inherited one is
byte-unchanged - and reverting the scrub reds it while every existing
exclude test stays green.
- cmd/bd/config.go: the new comment claimed "All role commands ignore
inherited Git routing". Only bd config's own role paths were hardened -
routing.DetectUserRole, `bd config show`, `bd doctor` and `bd hooks
uninstall` still resolve beads.role through the inherited environment,
and beads.RepoContext.Role pins GIT_DIR/GIT_WORK_TREE last-wins but still
inherits GIT_CONFIG_*. So `bd config get beads.role` and `bd config show`
can disagree in one shell, and `bd config unset beads.role` and `bd hooks
uninstall` can target different repositories. Narrow the comment to the
command set it covers; widening the boundary to the deciders is a
separate, permissions-adjacent change. The same root cause is filed on
#6460 and #6464, where it is broader - fix it once, on whichever merges
first.
Review iteration 1, non-blocking:
- docs/reference/worktrees.md: the new prose claimed startup Git discovery
probes for every bd command scrub inherited routing. Only internal/config's
gitDirsForRepo does; internal/git's process-cached context does not. Narrow
the sentence to config discovery and name both sides.
- internal/gitenv/routing.go: say in the contract comment why
GIT_CEILING_DIRECTORIES is a routing key even though it narrows rather
than redirects, and disclose that removing it widens the upward search.
Pin the membership with a ceiling entry in the existing scrub table.
- cmd/bd/worktree_cmd.go: route the removal pass's key identity through
execenv.KeyIdentityForOS instead of the last hand-rolled fold. ToUpper is
the opposite direction from the shared primitive and provably
non-equivalent: on Windows it collapsed GıT_OPTIONAL_LOCKS (U+0131) onto
GIT_OPTIONAL_LOCKS and stripped an unrelated variable that
gitenv.ScrubRoutingForOS, one line earlier, keeps.
Validation: go build ./..., go vet, CGO_ENABLED=0 vet and
GOOS=windows CGO_ENABLED=0 vet all clean; internal/gitenv green; cmd/bd
filtered run green except TestGetNotionConfigReadsDBPathWhenStoreUnset and
TestConfigValidateReadOnlyIsHermetic, which fail identically at the
unmodified head. All three new pins mutation-proved.
Review iteration 2, non-blocking:
- internal/config/worktree_config_test.go, cmd/bd/init_git_bootstrap_routing_test.go:
finish the conditional half of iteration 1's GIT_CEILING_DIRECTORIES item.
That item offered "drop the key" or "keep it and say so - and if kept, add
a legitimate-ceiling case to the two cited tests". The docs arm was taken
but only one of the two tests got a case, and the half left unpinned is the
widening the new contract comment now promises. Both new cases set a
*legitimate* ceiling - an operator fencing off an ancestor - and assert the
scrub widens past it: startup config discovery still resolves the main
repository's shared config, and `bd init`'s bootstrap probe still resolves
the containing repository. Each carries a control that fails the test if the
ceiling did not bite, so neither can pass vacuously. Dropping
GIT_CEILING_DIRECTORIES from routingKeys reds both new pins while
TestWorktreeFallbackConfigPathIgnoresInheritedGitRouting and
TestSetupForkExcludeIgnoresInheritedGitRouting stay green, so they cover an
arm the poisoned-routing pins do not.
The review prescribed this assertion in the inverted direction ("a
fenced-off ancestor does not suppress the fresh git init"). Measured
against git 2.43.0: a ceiling at a repository root does fence off a probe
run from a subdirectory, so scrubbing it makes the ancestor visible and the
fresh `git init` is suppressed. The tests pin the measured direction.
- cmd/bd/init_stealth.go: the scrub makes resolveGitExcludePath's "not a git
repository" newly reachable from `bd init --setup-exclude` exactly where the
cause is interesting, but the probe's error was discarded. Thread git's own
reason through, reusing firstNonEmptyLine from sync_git.go, which already
exists for this failure shape. exec.ExitError.Error() is only "exit status
128", so a bare %w would have added nothing readable. The "not a git
repository" prefix is load-bearing - setupStealthMode matches it with
strings.Contains to treat this as a skip - and is preserved. Rendered:
Warning: failed to configure git exclude: not a git repository (inherited
Git routing is ignored here): fatal: not a git repository (or any of the
parent directories): .git
Validation (iteration 2): gofmt clean; go build ./...; go vet, CGO_ENABLED=0
go vet and GOOS=windows CGO_ENABLED=0 go vet clean on cmd/bd and
internal/config. Both new pins green and mutation-proved as described; the
nine existing cmd/bd exclude/routing/fold pins, the internal/config
worktree-fallback set, and the internal/gitenv and internal/execenv suites all
stay green. No production behavior change beyond the error text.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Julian Knutsen <julian@example.com>
* test(doctor): pin probe ordering and scope the recording-matcher claim
Review round 2 nits 2-3 (optional, taken):
- The first-candidate test now uses two candidates: the first probe
errors and the scan continues, the second wins — so it pins probe
ordering and return preference instead of being a single-candidate
happy path, and it asserts ExpectationsWereMet.
- newRecordingMock's comment no longer claims to record every query the
code issues: sqlmock can reject an unexpected query before the matcher
runs, and the probe's err == nil path swallows that error. The
assertions therefore pair DeepEqual on the recording with
ExpectationsWereMet, and the comment now says exactly that.
Test-only; no production change.
* test(doctor): scope the recording-matcher claim and make the skip observable
Maintainer review fixup for PR #6412 (iteration 1). The scorecard approved
(986/1000, Required Changes: none); both non-gating items below land in this
adoption's own file, and the adopted head cannot merge as-is (CONFLICTING /
DIRTY, two conflicts against main incl. an add/add on this very file), so the
fixup costs no extra push.
1. minor (codex + claude) — newRecordingMock's comment presented
DeepEqual-on-the-recording + ExpectationsWereMet as a completeness
backstop. Verified against the dependency source: in ordered mode
sqlmock's query() skips fulfilled expectations and, finding no unfulfilled
ExpectedQuery, returns "all expectations were already fulfilled" before it
reaches c.queryMatcher.Match (go-sqlmock v1.5.2 sqlmock_go18.go:198-241),
so a trailing surplus query is never recorded; ExpectationsWereMet
(sqlmock.go:187-196) reports only unfulfilled expectations, never surplus
calls. The comment now claims only mid-sequence drift and names the gap.
Comment-only, as both lanes prescribed: v1.5.2 has no clean trailing
sentinel, since a never-matching extra expectation fails
ExpectationsWereMet unconditionally.
2. nit (codex + claude) — PrefersFirstProbeableCandidate made "beads" the
winner, but "beads" is configfile.DefaultDoltDatabase, which the sole
production caller always passes as skipDB (metadata.go:232), so it is
filtered at metadata.go:262 and can never win in production. The winner is
now "project-db". The optional arm (pass the production skipDB) is taken,
and wired so it is not inert: "beads" is a SHOW DATABASES row with no
expectation registered, so the recorded query list is positive proof the
filter fired.
Declined here, by both lanes' own instruction: the fix-half probe lacks the
beads_global exclusion its cmd/bd/doctor twin carries (dolt.go:683-685,
GH#6599). Pre-existing, zero production lines in this adoption; it belongs in
a follow-up, not this test-only diff.
Validation, CI-pinned flags for this lane (scripts/ci_workflow_test.go:261):
- go test -tags gms_pure_go -race -count=1 ./cmd/bd/doctor/fix/ -> ok, 227.6s
- -run TestProbeForCorrectDoltDatabase -v -> 3 tests / 5 subtests, all PASS
- mutation A, skipDB argument reverted to "": reds ONLY
PrefersFirstProbeableCandidate, with the surplus probe recorded first
("SHOW DATABASES", "...FROM `beads`.issues...", stale-db, project-db) —
the new argument and row are load-bearing, not decoration.
- mutation B, backtick-doubling dropped from the base escape helper
(doltutil.QuoteIdentifierUnvalidated): reds QuotesIdentifier +
EscapesHostileNames, PrefersFirstProbeableCandidate stays green — the
rebase lane's orthogonality table still holds after the fixture edit.
Test-only; no production change.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(bazel): isolate the bazel test environment like pr-core's go test
Every `bazel test` process now runs under //tools/bazel:test_env (wired with
`test --run_under`), a wrapper that mirrors scripts/ci/lib/test-env.sh: a
private HOME/USERPROFILE, XDG_CONFIG_HOME, DOLT_ROOT_PATH and empty
GIT_CONFIG_GLOBAL, GIT_CONFIG_NOSYSTEM, BEADS_TEST_IGNORE_REPO_CONFIG, and
the same scrub of workspace/Dolt-server variables. Everything lives in one
fresh mktemp directory under /tmp that is removed when the test exits, so
TMPDIR (t.TempDir) stays short enough for unix sockets and is never shared
between concurrent runs.
This replaces `--test_env=HOME` (the client's HOME string entered the action
key and was shipped to remote workers, where it does not exist: the
embeddeddolt suite panicked on "stat /home/ubuntu") and the shared
`--test_tmpdir=/tmp/bbt`. No host path or client env enters the action key.
bd_test (~10 min under -race -short) and embeddeddolt_test (~6 min) get
size = "large" / timeout = "long" instead of Bazel's 300 s default; pr-core
gives go test -timeout=30m. rules_shell (already in the module graph) becomes
a direct dep for sh_binary. MODULE.bazel.lock records the pybind11 extension
that building these test targets evaluates, so `make bazel-sync` is stable.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): inject the bd binary into subprocess tests (slice B3)
Tests that exec bd used to `go build` it themselves, which cannot work under
`bazel test` (no Go toolchain or module tree in the sandbox or on a remote
worker): 135 cmd/bd subtests failed with "go build failed", and protocol,
doctor and uow failed the same way.
- //cmd/bd:bd_for_tests: a go_binary named bd, race = "off" (the non-race
gms_pure_go binary these tests build today, even under --config=prcore).
- bd_test, protocol_test, doctor_test and uow_test declare it as data and set
BEADS_TEST_BD_BINARY to its $(rlocationpath).
- bazeltest.PrebuiltBD is the one resolver: under Bazel it resolves the
rlocationpath through runfiles (via the new bazeltest.RunfileEnv) and
requires it; under plain go test it keeps today's semantics (absolute form
of BEADS_TEST_BD_BINARY, or "" so the caller builds bd).
- cmd/bd's findPrebuiltBDBinary delegates to it, and the sites that read the
variable by hand (init_embedded, shared_server_integration, cli_fast,
migrate front door) now go through findPrebuiltBDBinary; uow calls it
directly.
- Raw `go build` sites that never honored the variable (protocol, doctor
dolt_e2e, test/conformance e2e, internal/beads integration TestMain) use
it only under Bazel, so go test is unchanged; protocol and doctor fail
instead of skipping when the injection is miswired. tests/regression is
left alone (it builds candidate and baseline binaries on purpose).
- The read-only canary still forces a source build under go test; under
Bazel the injected binary is already built from this tree.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): declare what cmd/bd and doctor tests read under bazel
With bd injected, the remaining //cmd/bd:bd_test and //cmd/bd/doctor failures
under `bazel test` were inputs the tests read from the checkout without
declaring them (they were hidden behind the go-build failures before):
- source-scanning guards (capability registry, events-journal construction,
serve database source) parse cmd/bd, cmd/bd/doctor, cmd/bd/doctor/fix and
internal/storage/embeddeddolt/cmd: those packages get go_srcs filegroups
(tools/bazel/go_srcs.py) declared as data; serve_test resolves its package
dir with bazeltest.CallerDir.
- .githooks (managed-section parity) and examples/formulas/primitives are
declared through //:bd_test_files.
- the gofmt preflight tests exec gofmt: under Bazel they use the Go SDK's,
declared as data and named by BEADS_TEST_GOFMT (bazeltest.RunfileEnv).
- TestGOMODCACHENotUnderTestHome guards in-test `go build`, which does not
happen under Bazel, so it skips there.
- doctor's TestCheckDeletionsManifest_LegacyFile only passed because the
process cwd happened to be inside a git checkout; its fixture is now a git
repo and the check runs in it.
go test behavior is unchanged except that the deletions-manifest test no
longer depends on the caller's cwd.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(bazel): give test_env a dolt identity; never fail on cleanup
beads_test_env_enter sets a dolt user.name/user.email in the fresh
DOLT_ROOT_PATH; test_env.sh created it empty, so tests that shell out to
dolt (remotecache, storage/dolt) failed with 'Author identity unknown'.
Write config_global.json directly (no dolt exec per test).
Also keep rm -rf in the EXIT trap from overriding the test's exit status
when a leftover child is still writing to the tmp root.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): re-sync BUILD files with main
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(doctor): report stealth exclude read failures (saa-cgh.118)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(doctor): retain leak detail when exclude cannot be read (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(doctor): run the stealth privacy repair even when the exclude is unreadable
Maintainer review fixes for PR #6427 (adopt-pr iteration 1).
This PR makes addProjectPatternsToGitExclude go from always-nil to
sometimes-error, which newly activates the `err == nil` gate in
applyFixList's stealth branch and skips removeBeadsProjectGitignoreSection
— the privacy half of the repair, which never needed the exclude file at
all. On an unreadable .git/info/exclude, `bd doctor --fix` therefore left
Dolt and credential patterns in a committed .gitignore. The two halves are
independent, so join their errors instead of gating one on the other, the
way `bd init --stealth` already runs both (init.go:1098-1109).
With --fix able to complete the privacy half again, restore the leak
headline and `Fix: "Run: bd doctor --fix"` on checkProjectExcludeStealth's
new read-error branch — but only when the tracked .gitignore is actually
leaked. A read error with a clean .gitignore keeps the bare "Unable to
read" message and no Fix, because --fix genuinely cannot repair that.
Also, for AppendLines' no-lines fast path, return bytes.Clone(content)
rather than aliasing the caller's slice. The branch cannot simply be
dropped: the unterminated-final-line completion runs before the loop, so
dropping it turns "last\r" into "last\r\n" and reds the package's own
"no lines" case.
Follow-up filed as bd-ltf9k for the three same-class appenders still on the
raw-LF idiom (worktree_cmd.go addToGitignore, doctor EnsureGitignoreForBeadsDir,
fs.WriteBeadsGitignore) — minor, no behavior change for LF files.
Validation: go test ./internal/gitignore/ and a blast-radius ./cmd/bd/ run
(20 top-level tests, 41 with subtests) green; CGO=0 and GOOS=windows go vet
clean on both touched packages. Each half of the fix is mutation-proven:
restoring the `err == nil` gate reds the new applyFixList test while leaving
the diagnostic boundaries green, and dropping the headline/Fix reds only the
`directory` case, not `directory_clean`.
Iteration 2 — report the newly reachable path instead of going silent.
Running both halves means --fix can now delete the leaked section while the
exclude write fails, leaving the project-root patterns ignored by neither
plane, and applyFixList said nothing about either outcome: it discarded the
`removed` bool that its init.go sibling prints and reported only the exclude
error. Print that same confirmation when the section was removed, and, when
the exclude half failed and the remove half did not, name the patterns that
are now ignored by neither .git/info/exclude nor the tracked .gitignore. The
warning is gated on removeErr == nil because that is the only state in which
its claim is true — if the remove also failed, the leaked section may still
be covering them.
Pin the reporting half too. The regression test asserted only .gitignore
bytes, so dropping excludeErr from the join passed it while --fix printed
"✓ Fixed" and "Fix summary: 1 fixed, 0 errors" for a repair whose exclude
half had failed. It now captures applyFixList's stdout and pins the surfaced
failure alongside both new lines; each of the three is mutation-proven to red
its own assertion and no other.
Declined, and tracked as bd-x0vk1: giving checkProjectExcludeStealth's
read-error branch a standing Fix. Measured rather than argued — it reds
`directory_clean` alone, which is the leak-only scoping both review lanes
ratified, and since fixable checks are selected by
`Status == warning && Fix != ""` (doctor_fix.go:24,61) it would also pull the
no-leak population into --fix, which would then attempt a repair that is a
guaranteed no-op on the tracked .gitignore and a guaranteed failure on the
unreadable exclude. The read fault itself stays diagnosable through Detail.
Validation (iteration 2): the same blast-radius ./cmd/bd/ run and
./internal/gitignore/ green, CGO=0 and GOOS=windows go vet clean on both
touched packages.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* refactor(git): resolve hooks paths in an explicit read-only context (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): canonicalize the hooks fixture repository root (saa-cgh.109.17.1)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* Clarify hooks resolver ownership and preserve work-tree diagnostics (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(git): own resolver diagnostic locale (saa-cgh.120)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): preserve legacy context error diagnostics (saa-cgh.120)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* review(git): pin the hooks-context caveats raised in review
Maintainer review fixup for #6436 (iteration 1; no blocker or major
findings survived synthesis, scorecard approve 907/850).
- HooksContext: document that MainRepoRoot inherits GetMainRepoRoot's
definition, so for a worktree of a bare repository it names the bare
repository's parent rather than a repository, and pin that inherited
value with a bare_worktree subtest. Deriving it differently was the
other offered arm, but it would break base parity on the value, which
is what keeps the finding non-gating in the first place.
- routing_environment: assert the whole HooksContext instead of RepoRoot
alone. A split-source implementation that resolved the repository-level
paths from workDir while taking the work tree from the routed
environment satisfied the old assertion while reporting two different
repositories in one context.
- gitContext.gitDir -> gitDirRaw, with the anchoring hazard recorded at
the field. GetGitDir still returns Git's raw spelling, so the legacy
contract and its three production callers are unchanged; storing the
anchored value was the other offered arm and would have changed them.
- Use errors.As for the *exec.ExitError stderr enrichment.
- Record the struct-returning shape/name rationale and the pending first
in-repo caller on ResolveHooksContext.
Declined, with reasons at the site: renaming ResolveHooksContext to a
...From spelling (#6440 is open and already calls it in production at
eight sites), and replacing the empty-env arm's []string{} (it is the
only assertion covering the documented "including an empty one" clause,
and repository-local scope outranks system scope for core.hooksPath, so
the arm is host-independent as written).
Validation: internal/git 19/19 subtests RUN+PASS, full package green,
go build ./..., go vet, golangci-lint 0 issues. Mutation proofs: the
rejected bare-check arm reds only bare_worktree; the split-source arm
reds routing_environment with RepoRoot still correct; disabling the
errors.As branch reds bare with "resolve Git working tree: exit status
128".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(store-factory): honor shared-server mode in prime's store resolution
newDoltStoreFromConfig and its read-only sibling
openNonMutatingStoreFromConfig checked only cfg.IsDoltServerMode(),
which deliberately does not read dolt.shared-server from config.yaml
(to avoid a circular import with the doltserver package). A workspace
with config.yaml tracked but metadata.json gitignored as machine-local
state — the common shape of a linked git worktree — left
configfile.Load returning (nil, nil), so both paths silently fell
through to the embedded backend and created a phantom database named
"beads" instead of reaching the real shared server.
cmd/bd/main.go's own top-level command resolution already compensates
for this exact gap (GH#3817), but bd prime resolves its store through
a separate path (formatMemoriesForPrime -> ensureStoreActiveForPrime
-> ensureStoreActiveWithContext -> newDoltStoreFromConfig) that never
got the same fix. Centralized the compensation into
effectiveServerMode so the two internal paths and main.go's own
resolution cannot drift from each other again.
Fixes#6551.
* fix(store-factory): route read-only shared mode
* fix(store-factory): reach the !cgo twins and scope shared-server per workspace
Maintainer review fixes for PR #6589 (GH#6551). Addresses the three majors in
the review synthesis, plus the two non-gating items, and corrects two false
claims in the PR's own new prose.
1. major — the !cgo twins kept the unfixed gate, and "centralizing the check
here keeps them from drifting again" was structurally false.
effectiveServerMode sat behind //go:build cgo, so store_factory_nocgo.go's
own copies of newDoltStoreFromConfig / newReadOnlyStoreFromConfig could not
call it: the released CGO_ENABLED=0 binaries (.goreleaser.yml ships three)
still ignored shared-server in the exact GH#6551 shape, and there the
fallthrough is the "reinstall with embedded support" refusal rather than a
phantom database — actively misleading, in the one build where a shared
server is the only usable backend. Moved the helper to a new untagged file,
store_factory_server_mode.go, and called it at all four sites. The
centralization claim is now true rather than reworded, and the new file's
header records why it must stay untagged.
2. major — TestPrimeCfgNilHonorsSharedServer was vacuous. Two separate causes,
both fixed:
- the beads dir had no files at all, so hasBeadsProjectFiles was false,
FindBeadsDir() returned "" and ensureStoreActiveWithContext refused with
ErrNoBeadsDatabase before the factory was reached. It now gets the
config.yaml the reported shape actually has, which is simultaneously
discoverable and still metadata.json-less.
- it exported BEADS_DOLT_SHARED_SERVER=1, which the OLD gate already
honored, so the A/B stayed green on unfixed code even after the first
fix. The env var is now deliberately empty: the config.yaml layer is the
whole of the base gap. Renamed to TestPrimeHonorsSharedServerConfigYaml,
because the "cfg == nil" mechanism the old name asserts does not happen at
this call site — normalizeLoadedConfig substitutes DefaultConfig() before
the gate, so the gate's `cfg != nil` conjunct never short-circuited here.
The same false mechanism is corrected in TestEffectiveServerMode's comment.
Also added the positive assertion the test lacked: it now requires the
captured output to name the port it pinned, so a refusal before store
resolution can no longer pass. Confirmed by A/B against the reverted gate.
3. major — cross-workspace opens resolved activation from the launcher's
process-global config, contradicting the invariant three lines above the
gate. doltserver.IsSharedServerMode() reads process-global state, but
routed.go:214, create.go:408 and init_contributor.go:330 pass a foreign
beadsDir, so a launcher enabling shared-server in its own config.yaml could
retarget a workspace that explicitly asked for embedded — a connect failure
or a same-named database holding someone else's rows.
effectiveServerMode now takes beadsDir and resolves the yaml layer against
it via config.WorkspaceYamlValueStrictWithLocal (config.yaml only in the
first iteration; see item 4 below). The env arm stays machine-global
(configfile.IsDoltServerMode already honors it above an explicit dolt_mode,
so that is base-equivalent), and the process-wide merge is still consulted
when the target declares no dolt_mode of its own — which preserves both the
GH#6551 headline fix and base behavior, since IsDoltServerMode falls through
to config.yaml only when c.DoltMode == "". Purely workspace-scoping the read
as prescribed would have dropped the user-global layer, which viper merges,
and regressed the fix it was meant to protect.
Shared-server mode still wins over a stale metadata.json dolt_mode=embedded
for the bound workspace (main.go:1710 / shouldUseExternalDoltStatus,
GH#2946); TestEffectiveServerModeResolvesYamlPerWorkspace pins both halves
of that pair, and each half was mutation-proved to fail independently.
Non-gating, taken because they were adjacent:
- TestEffectiveServerMode's false-case assertions are now hermetic
(config.ResetForTesting + HOME/BEADS_DIR scoping), matching its sibling.
- the new assertion no longer matches on internal/storage/dolt's connection
prose; it uses errors.Is(err, syscall.ECONNREFUSED) and the port the test
itself pins, both owned outside the package this PR does not own.
Required by fix 1 rather than optional: routing the !cgo factories through
effectiveServerMode makes them consult ambient config, which reds the two
pre-existing TestNocgoNew*FromConfig flag-suggestion tests on any machine with
dolt.shared-server enabled. Both now isolate those signals first, verified by
running them with BEADS_DOLT_SHARED_SERVER=1.
Tests: TestNocgoFactoriesHonorSharedServer is new and is the missing behavioral
half of fix 1 — the cgo-tagged tests cannot observe the !cgo twins and the
pure-Go CI job only checks compilation. Each of its two arms was proved by
reverting one !cgo call site at a time.
Validated: gofmt, git diff --check, go build and go vet under both CGO_ENABLED
settings, and every touched test individually in both lanes under a private
temp root (the shared /tmp suite-root sweeper races sibling agent sessions; see
the pre-review CI note).
Iteration 2 of the maintainer review found one new major, introduced by fix 3
itself, plus four non-gating items. All five are addressed here.
4. major -- the workspace-scoped read dropped the config.local.yaml layer, so
the four factories resolved dolt.shared-server differently from main.go,
bootstrap, doctor and migrate-dolt-mode: the same resolver-divergence class
GH#6551 is an instance of, newly introduced by scoping the read. Initialize
merges .beads/config.local.yaml LAST (the file-loading block at the end of
Initialize), i.e. at the
highest priority, and it is the documented place for machine-specific
settings that must not be committed (docs/reference/configuration.md).
dolt.shared-server is exactly that kind of state while .beads/config.yaml is
git-tracked, so "the repo tracks it, this machine opts out" is the ordinary
use of the escape hatch -- this repo is itself that shape. The divergence ran
both ways and the enabling direction was the silent one: config.yaml false
(what `bd dolt shared-server off` persists) plus a local true fell through to
embeddeddolt.Open and re-created the GH#6551 phantom database with no error.
Added config.WorkspaceYamlValueStrictWithLocal beside WorkspaceYamlValueStrict
so the layering lives in the package that owns it, and pointed the helper at
it. Each layer keeps the strict contract -- absent file or absent key falls
through, unreadable/unparseable/non-scalar is an error -- which matches
Initialize, since it fails outright on a config.local.yaml it cannot merge.
config.local.yaml's name is now a config constant used by both readers, so
the merged and workspace-scoped paths cannot drift onto different files.
TestEffectiveServerModeHonorsWorkspaceLocalYaml pins both directions and uses
the merged config.GetBool as its oracle, so the assertion cannot drift from
the layer order it pins; reverting to the config.yaml-only reader fails both
arms independently. The config package's own contract test additionally pins
the order, the fallthrough when the local file is silent on the key, and the
error on a malformed local file; inverting the two layers fails it.
The prescription asked for cast.ToBool parsing. Used strconv.ParseBool
instead: spf13/cast is an indirect dependency, ParseBool is exactly what
cast.ToBool calls for a string (so "1"/"t"/"T"/"TRUE" resolve here as they do
everywhere else, which was the point), and it matches migrationSharedTopology,
the in-tree precedent for parsing this key from this reader. An unparseable
value is viper's false too, and now says so.
Corrected the parity claim the finding named: for the bound workspace these
are the same two files the process-wide merge reads, which is true only now.
Non-gating items from iteration 2, taken because the iteration was already
forced and all four live in code this fixup owns:
- the read-only factory's positive discriminator was a near-tautology: the
pinned port was "1", OR'd with errors.Is(ECONNREFUSED), so the string half
matched any errno, timestamp or port containing that digit and held up
wherever the dial error was not ECONNREFUSED. Pinned 59998 instead, five
distinctive digits like the prime sibling. Verified both halves now fire
independently, so neither is carrying the other.
- the new !cgo behavioral pin ran in no CI lane: the pure-Go cmd/bd test step is
a name allowlist and omitted it, so the exact single-call-site regression this
commit mutation-simulated would have passed every job. Added the three Nocgo
test names to that -run group in both pr.yml and main.yml. The three pass
under -tags gms_pure_go, CGO_ENABLED=0, -short in 0.4s with no server, and
reverting store_factory_nocgo.go's first call site now reds that lane --
failing only the mutated arm, so per-site discrimination is preserved. (This
also retires the "the pure-Go CI job only checks compilation" note above: that
job does run a named subset, and now it runs these.)
- the unreadable-config.yaml arm degraded silently and its comment claimed the
opposite: it said the configfile.Load error path "refuses to degrade to the
embedded default", but returning false IS the degrade to embedded here. Kept
the conservative false (main.go degrades identically on the same corrupt
input, so it is parity, and a target whose own config is unreadable must not
be retargeted by the LAUNCHER's config), added a debug.Logf so the discarded
parse error is recoverable, and corrected the comment to describe what the
code does.
- TestNocgoFactoriesHonorSharedServer's discriminator was negative-only, the
one-sidedness class this commit fixed twice elsewhere: any future pre-gate
refusal would have passed it without the shared-server arm running. Added the
positive half the siblings use, against its own distinctive pinned port.
Iteration 2 validation: gofmt, git diff --check, go build ./... and go vet under
both CGO_ENABLED settings, the full internal/config suite, the cmd/bd
store-factory and prime shared-server tests (including the 30s flagship binary
test), and the exact pure-Go CI step command with the widened allowlist. Every
fix above was mutation-proved, each arm separately.
Iteration 3 of the maintainer review returned approve with no blocker or major
finding: one minor and five nits. All but one are addressed here, amended into
this same fixup rather than stacked.
5. minor -- the layered reader honored a lone config.local.yaml, so the fixed
divergence survived at the edge of the fix. Initialize hangs its local merge
off the project config.yaml it actually found (primaryConfigPath, assigned
only where an os.Stat on a config.yaml succeeded), so a .beads holding
config.local.yaml ALONE is never merged: config.GetBool answers from defaults
while the four patched factories answered from the local file. Same
resolver-divergence class as item 4, one-directional instead of two, and loud
(a split-brain connect failure) rather than a phantom database.
Took the "require the pair" arm rather than only narrowing the prose. A
reader whose entire contract is "resolve the way Initialize's merged reader
does" should satisfy that contract instead of documenting where it does not,
and the permissive read left it the single resolver in the tree that honors a
file nothing else reads -- the divergence pointed the other way. Two lines in
WorkspaceYamlValueStrictWithLocal; a stat error other than not-exist drops the
layer too, matching Initialize, whose own probes for a project config.yaml
fail the same way, and the tracked read then surfaces that error instead of
swallowing it.
Added the missing table arm (local only, no tracked config.yaml) and mutation-
proved the guard in both directions: neutralizing it reds that arm alone, with
the divergent ("true", true) answer, while all seven incumbent arms stay green;
always dropping the local layer reds the two override arms and the malformed-
local arm while the new one stays green. The guard fires on exactly the
population it was written for.
Both parity claims now state Initialize's condition as well as its order
(store_factory_server_mode.go, yaml_config.go).
Nits, taken because amending this fixup costs nothing extra:
- the !cgo test's own comment still told the reader the pure-Go job "only checks
that the package compiles" -- in the commit that allowlisted that test by name
in both workflows. It reads as license to drop the name, which would retire
exactly the coverage iteration 2 bought. It now says the job runs this test by
name in pr.yml and main.yml, and that the test name and both allowlists must
move together.
- three new doc comments cited loadConfigFiles, which does not exist; the merge
is inline at the end of Initialize. All three now cite Initialize, as does
item 4 of this message.
- the new constants' justification claimed they keep the merged reader and the
workspace-scoped reader from drifting onto different files, but only the local
path was switched -- Initialize still spells config.yaml literally everywhere
it probes for one. Narrowed the comment to what the constants actually bind,
rather than rewriting config-path literals this PR has no other reason to move.
- the three pinned "nothing listens here" ports (59997/59998/59999) sat inside
the kernel's ephemeral range (32768-60999 here and on the GitHub runners).
That only became load-bearing because the two discriminator fixes worked: the
assertions now mean "we dialed THIS port and were refused", so a process that
bound :0 and landed there would answer the dial and red a correct
implementation. Moved all three to 19997/19998/19999. Each move is proved live
by the assertion that names its constant -- the prime test still finds its port
in the captured output.
Declined: switching migrationSharedTopology (migrate_dolt_mode.go:1238) to the
layered reader. Both lanes graded it optional and explicitly non-regressing --
migrate has always read config.yaml only -- and it is a production behavior
change to `bd migrate dolt-mode` that no further review pass would see, on an
iteration that is otherwise approve. It belongs with the five other unlayered
IsDoltServerMode resolvers iteration 2 recorded (where.go:143,
context_cmd.go:140, doctor/database.go:311, doctor/shared_store.go:45,
doctor/server.go:73) as follow-up.
Iteration 3 validation: gofmt, git diff --check, go vet in the default,
CGO_ENABLED=0/gms_pure_go and GOOS=windows modes, the full internal/config
suite, the five cmd/bd resolver and call-site tests including the 33s prime
binary test at its new port, the migrate-dolt-mode topology test, and the exact
pure-Go CI step command (ok, 0.44s).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(bazel): add internal/testutil/bazeltest runfiles helpers
Repository-path resolution for tests that works identically under plain
go test (package cwd, full checkout), bazel test locally, and remote
execution (declared runfiles only):
- IsBazel, RepoRoot (BEADS_TEST_REPO_ROOT, then the runfiles workspace
root, then a go.mod walk), OverrideRoot (drop-in condition for existing
helpers; empty under plain go test), CallerDir
- Runfile for $(rlocationpath) values, GOROOT for type-checking tests
- ShardFreeEnv for helpers that re-exec a test binary
Every helper reduces to the pre-Bazel behavior under go test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): declare source/data reads for 14 scan-guard targets
Source-scanning and repo-file tests read files their Bazel targets never
declared, so they failed under `bazel test` (and could not run on remote
workers at all). Declare narrow inputs as `data` and resolve paths through
bazeltest where the test located the tree via runtime.Caller:
- tools/bazel/go_srcs.py (run by `make bazel-sync` after gazelle) keeps a
managed `go_srcs` filegroup in the packages whose Go source tests scan,
plus `//internal/storage:tree_go_srcs` for the storage-tree walk. Bazel
globs stop at package boundaries, so the aggregate needs one filegroup
per package; the script keeps it in sync and gazelle-stable.
- Hand-written narrow inputs: //internal/storage/schema:migrations,
//:docsync_files, //plugins/beads:plugin_files, and exports of
.gitattributes, .claude-plugin/marketplace.json, cmd/bd list.go and
ready.go, testutil/testdoltcommon.go, scripts README.md and the release
catalog, each visible only to its consumer.
- runtime.Caller-based roots in backend, backend/conformance,
internal/storage, internal/formula and test/docsync now go through
bazeltest.CallerDir / OverrideRoot; relative-path tests need data only.
- integrations/ leaves .bazelignore (it is still gazelle-excluded) so the
docsync link check can declare integrations/beads-mcp/PYPI.md.
Under --config=prcore every target reports the same PASS/SKIP/FAIL test
set as `go test -race -short` for its package, locally and remotely.
Plain `go test` behavior is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): guard generated go_srcs and harden bazeltest root override
- tools/bazel/go_srcs.py: add --check (print diff, exit 1 on stale blocks);
new `make bazel-sync-check` target runs it.
- scripts/bazel_policy_test.go: under go test, assert every tree_go_srcs
(//internal/storage) lists exactly the BUILD.bazel packages below its
root, run go_srcs.py --check, and forbid BUILD files under docs/ and
engdocs/ (they would cut subtrees out of //:docsync_files).
- bazeltest: honor BEADS_TEST_REPO_ROOT only when it holds go.mod
(RepoRoot fails loudly otherwise); drop the unused GOROOT() helper,
whose compiled-in branch could never fire under rules_go.
- scripts/ci/lib/test-env.sh: unset BEADS_TEST_REPO_ROOT.
- Document the hand-listed out-of-tree link targets in //:docsync_files.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* build(bazel): re-sync BUILD files with main
Regenerated with make bazel-sync after commits that landed while the
scaffold PR was in CI (new internal/execenv, gitenv, gitignore packages
and new sources/deps).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): declare init_safety_help.go for docsync
TestInitSafetyCLIHelpCoversReCloneGotchas (#6431) reads
cmd/bd/init_safety_help.go; export it to //test/docsync only.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#6719 moved BeginTx and the versioned-history scope out of withWriteTx
into commitWriteTx, while #6675 added a guard that requires
withWriteTx itself to call BeginTx. Both landed, leaving main red on
TestTxMintingWrappersScopeVersionedHistory. Guard the function that now
opens and scopes the transaction (verified: dropping its version scope
fails the test again).
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(docs): red — Docs: init-safety re-clone playbook must say damaged stores go OUTSIDE data_dir and a fresh clone needs bd migrate schema (refs be-wv0d0)
* feat: green — Docs: init-safety re-clone playbook must say damaged stores go OUTSIDE data_dir and a fresh clone needs bd migrate schema (refs be-wv0d0)
- docs/recovery/init-safety.md: new re-clone-gotchas section covering both
live gotchas from ga-vrq5pu (damaged/set-aside stores must move OUTSIDE
data_dir; a fresh clone needs `bd migrate schema` for dolt-ignored
clone-local tables), with cross-reference pointers from the two existing
bd bootstrap mentions and a pointer (not a duplication) to bd doctor
--fix's automated corrupt-manifest convention. Freshness markers bumped.
- cmd/bd/init_safety_help.go: RECOVERY section of the init-safety Long help
gets a brief RE-CLONE GOTCHAS addendum with both symptom signatures and
the fix command.
- test/docsync/init_safety_recovery_test.go: retargeted
TestInitSafetyCLIReferenceCoversReCloneGotchas (written during RED) to
TestInitSafetyCLIHelpCoversReCloneGotchas, asserting on
cmd/bd/init_safety_help.go's Long field instead of the generated
docs/cli-reference/init-safety.md. That generated page is pinned to a
released bd (docs/cli-docs.pin = v1.2.2, built in a detached worktree per
scripts/resolve-docs-bd.sh) and does not pick up a Long-field edit at
HEAD until a maintainer bumps the pin at the next release — confirmed
empirically (`git show v1.2.2:cmd/bd/init_safety_help.go` still points at
the deprecated docs/RECOVERY.md path, and a full
./scripts/generate-cli-docs.sh run here produced zero diff to the
committed docs/cli-reference/). CI's own drift gate
(scripts/check-cli-docs-drift.sh) is blame-scoped for exactly this
reason. The original RED test was asserting on an artifact this PR
cannot legitimately change without fighting that pin.
* fix(docs): address review feedback on init-safety re-clone playbook
Three fixes per bee-ghosttrack's REQUEST-CHANGES on PR #6431:
- Correct Gotcha 1's "The fix" paragraph: bd doctor --fix's
corrupt-manifest repair renames the whole data_dir directory to a
sibling .<ts>.corrupt.backup path, not a backup nested inside the
database's own directory. Verified against
cmd/bd/doctor/fix/database_integrity.go and
cmd/bd/doctor/tracked_runtime.go.
- Replace the hardcoded "Schema already at v64" literal with
version-agnostic "Schema already at v<N>" in the doc and CLI help
text, and narrow the docsync test assertion to the prefix "schema
already at v" so it survives future version bumps instead of
rotting again.
- Drop the dead GitHub-issue-style link around ga-vrq5pu (a Gas City
bead id, not a GitHub issue) — keep it as plain text.
Ref: be-hobyw
* review: correct re-clone gotchas and tighten their guards (PR #6431 iters 1-2)
Maintainer review fixup for the adopted PR. This is a docs-only PR whose
entire deliverable is factual accuracy, so every finding here is about a
claim the doc makes rather than about code behaviour.
=== Iteration 1 ===
[major] Gotcha 1's "The fix" paragraph misattributed the automated repair
and pointed an operator mid-crash-loop at a path that cannot run. Verified
first-hand in the worktree:
- internal/doltserver/manifest_recovery.go:231-235 renames
<data_dir>/<db>/.dolt -> <db>/.dolt.<ts>.corrupt.backup, i.e. IN PLACE,
not the whole data_dir to a sibling as the doc claimed. It also only
fires behind nomsDirLooksCorrupt, whose own comment is "recovery only
fires when we can prove there is nothing the user would want to keep"
(:94-100) - so it never touches the superseded-but-populated store the
gotcha is about.
- The whole-data_dir -> sibling rename is a different fix:
cmd/bd/doctor/fix/database_integrity.go:35,43-45 over
getDatabasePath(beadsDir) (validation.go:15-21).
- That fix opens with serverModeIntegrityRecoveryGuard, which refuses
outright in Dolt server mode (:79-96).
Rewritten to state all three facts and to tell the reader plainly that the
move is theirs to make by hand. Kept the correct headline sentence. The
paragraph deliberately does not assert anything about where the in-place
backup lands under the legacy single-database layout (data_dir/.dolt), the
one premise the review left unproven - the wording is scoped to the standard
<data_dir>/<db>/ layout instead of minting a fresh unverified claim.
[minor] Gotcha 2's mechanism sentence ("bd's ordinary open does not recreate
them") is false for embedded mode: newStore -> initSchema (store.go:285,470)
calls schema.MigrateUp (:574), and migrationWorkNeeded returns true whenever
!ignoredSource.atLatest (schema.go:866-867) - and ignored_schema_migrations
is itself in doltIgnorePatterns, so a fresh clone always qualifies. Replaced
the universal with the actual condition. The replacement list of opens that
do NOT self-heal was itself wrong on its first item; see iteration 2 below.
The prescribed remedy was already correct and is unchanged.
[minor] The doc's prose Freshness source list gained cmd/bd/init_safety_help.go
but the enforcing DOCS array did not. Added to both scripts/check-doc-freshness.sh
and the pinned row in scripts/check_doc_freshness_test.go - a coupled pair:
editing only the script reds the pinned test with "Freshness source does not
name cmd/bd/init_safety_help.go" (verified by running exactly that mutation).
[nit] The docsync guard for the headline rule was two independent whole-file
substring checks. Scoped it to Gotcha 1's own section and matched the advice
as a phrase, and pinned both ends of the help text's #re-clone-gotchas
cross-reference, which neither markdown link checker can see because it lives
in a Go string. Five mutation legs, each reddening only its own assertion:
inverting the advice, moving the phrase outside the section, renaming the
heading, breaking the help anchor, and removing the Gotcha 1 heading. The
inversion leg is the one that matters - the file still contained "outside"
(2x) and "data_dir" (13x), so the old form stayed green on inverted advice.
[nit] Bumped Last reviewed: to the revision date.
=== Iteration 2 ===
Both lanes verified all five iteration-1 fixes. Three prose findings remained,
none a merge gate (scorecard: approve, Required Changes: none). All three are
the same defect class - a sentence that quantifies over a set the author did
not census - so each is fixed by removing the quantifier rather than by
restating it more carefully.
[minor] Gotcha 2's replacement enumeration was false on its first item: a
server, shared or proxied open DOES replay the clone-local series in this
doc's own scenario. Re-derived at head, both lanes independently:
- internal/storage/uow/dolt_sql_provider.go:267-287 calls
MigrateUpWithLock UNCONDITIONALLY on the non-team-server, non-preview
arm; p.readOnly is consulted only after a RemoteMigrateGateError comes
back (:288-296), so it cannot suppress the pass.
- The gate cannot refuse a main-current clone: PendingVersions is
mainSource.pendingVersions only (schema.go:525-527) and the gate
early-returns nil on len(pending)==0 (remote_migrate_gate.go:731-737),
so the ignored series is invisible to it.
- migrationWorkNeeded is true whenever !ignoredSource.atLatest
(schema.go:866-869), so the locked pass runs the full MigrateUp
including ignoredSource.migrate (schema.go:822). DoltStore.initSchema
reaches the same call on the writable-open path (dolt/store.go:3076).
So the positive clause is widened to any writable open (embedded, server or
proxied), and the negative clause is rewritten as a tautology plus an open
list: the open that hit the error was not self-healing, and the kinds that
skip or only verify "include" read-only/preview opens, team-server opens
(verifyTeamServerSchema only checks - dolt_sql_provider.go:342-371), the
preview-attach arm, and gate-refused opens. Each named arm was verified
individually; the list deliberately does not claim to be exhaustive, which
is what the previous wording got wrong. Nothing in docsync can enforce this
paragraph, so an open list is also the honest shape.
[minor] Gotcha 1's data_dir locator omitted the mode that overrides both
knobs it names. ResolveDoltDir checks IsSharedServerMode() FIRST and returns
SharedDoltDir() before it ever reaches projectDoltDirPath
(doltserver.go:316-330); the knobs are BEADS_DOLT_SHARED_SERVER=1|true or the
dolt.shared-server config key (:117-122), and the directory is
~/.beads/shared-server/dolt/, overridable via BEADS_SHARED_SERVER_DIR
(:248-257, :275-285). Added as its own paragraph rather than growing the
parenthetical, with the reason it matters most there: one shared data_dir
holds every project's database, so a single stray subdirectory crash-loops
the server for all of them.
[nit] "neither of bd doctor --fix's TWO Dolt-database repairs" made a numeric
claim the sentence does not need, and the count is wrong:
cmd/bd/doctor/fix/repo_fingerprint.go:135-161 os.RemoveAll's
cfg.DatabasePath(beadsDir) behind an interactive "This will DELETE %s. [y/N]",
and cleanCruftBeadsDirFiles (artifacts.go:238) can remove a .beads
subdirectory too when a redirect is expected. Dropping the word "two" would
have left "neither", which is itself a two-quantifier, so the count is
removed instead: "no bd doctor --fix repair performs this move here. The two
that come closest are:" - now a statement about the two bullets that follow,
not a census of the repairs. The operative universal survives the census
(the move-performing rename sites are only database_integrity.go:46,54; the
others delete or rename in place), so the reader's action is unchanged.
Validation (iteration 2): go test -tags=gms_pure_go ./test/docsync (8 tests,
green, zero skips, both InitSafety tests among them); go test -tags=integration
-count=1 -run Freshness ./scripts (33 pass, 1 Windows-only skip);
./scripts/check-doc-freshness.sh PASS with docs/recovery/init-safety.md at 0
days old and all five of its Freshness sources resolving; git diff --check
clean. Prose-only: no code, test or freshness-pair file changed this
iteration.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* build(bazel): add side-by-side Bazel scaffold (module + gazelle)
Add a Bzlmod Bazel build alongside the Go toolchain. `go build` and
`go test` are unchanged; nothing in CI invokes Bazel yet.
- MODULE.bazel: rules_go 0.63.0, gazelle 0.53.0, Go SDK 1.26.7 (matches
the go.mod toolchain directive), go_deps from go.mod.
- ICU policy (engdocs/ICU-POLICY.md): a go-mysql-server gazelle_override
selects the pure-Go regex backend and excludes regex_cgo.go, and
.bazelrc builds with --@rules_go//go/config:tags=gms_pure_go, so no
target depends on go-icu-regex or links libicu.
- third_party/patches: three module_override patches for dolt deps that
ship WORKSPACE-era BUILD files, adapted from the gascity project.
- .bazelrc: prcore/ci test configs (inert for now; they match pr-core's
test selection, not yet its environment isolation) and a generic
remote-exec config with a bounded remote timeout. Executor endpoints and
TLS credentials come only from a gitignored .bazelrc.local/user.bazelrc
or a CI rc outside the workspace.
- .bazelversion pins Bazel 9.2.0; .bazelignore skips separate modules,
non-Go trees, nested agent worktrees (.claude, .worktrees) and local
data/output dirs (.beads, .dolt, dist, .runtime, tmp), so a primary
checkout neither builds nor gazelle-rewrites nested worktree copies.
- Gazelle-generated BUILD.bazel files for every Go package.
- Makefile: `make bazel-sync` (gazelle + bazel mod tidy).
- .gitignore: bazel-* output symlinks and machine-local rc files.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(bazel): policy tests for the Bazel configuration
Add scripts/bazel_policy_test.go, plain Go tests that run under both
`go test ./scripts` and `bazel test //scripts:scripts_test`:
- MODULE.bazel go_sdk.download version equals the go.mod toolchain.
- ICU policy: .bazelrc sets gms_pure_go for build, the go-mysql-server
gazelle_override excludes regex_cgo.go, and the root BUILD.bazel
carries `# gazelle:build_tags gms_pure_go`.
- .bazelversion pins an exact Bazel release.
- .bazelrc.local and user.bazelrc are gitignored (parsed from .gitignore
and cross-checked with git check-ignore when in a checkout).
- No remote-execution endpoints or credentials in committed bazelrc-like
files, Markdown docs or .github/**: remote/BES/TLS flags
(--remote_executor, --remote_cache, --bes_backend, --remote_header,
--tls_client_certificate, ...) with a literal value, with or without a
URL scheme, and non-loopback gRPC URLs in rc/.github files. Placeholders,
$VARIABLES, and loopback are allowed; Markdown gRPC URLs (OTel exporter
docs) are not flagged. Skipped outside a git checkout, e.g. in the Bazel
sandbox.
Each check is a pure function also exercised against fixtures that break
the invariant. The files the tests read are declared as data via
//:bazel_policy_files so they resolve from runfiles under Bazel.
scripts/check-build-tags.sh now treats Bazel invocations as governed by
.bazelrc: the shell command segment that invokes Bazel (split on &&, ||,
;, |, $( and backticks) is exempt from the per-line `go` tag check, while
a bare `go` in another segment of the same line is still flagged. When
any scanned file invokes Bazel (or .bazelrc exists) .bazelrc must set
--@rules_go//go/config:tags=gms_pure_go for build.
scripts/check_build_tags_test.go covers both in a temp repository.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(scripts): split bazel lines in pure bash so check-build-tags works with BSD sed
BSD sed (macOS) does not expand \n in s/// replacements, so the segment
split never happened and the Bazel-exemption tests failed on macos-latest.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(scripts): skip check-build-tags tests when bash lacks mapfile
macOS runners use /bin/bash 3.2, which has no mapfile; check-build-tags.sh
has always required bash >= 4, so the new tests are skipped there.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Accept uutils coreutils timeout in generated hooks
The generated hook selects a timeout helper only when its --version
banner starts with "timeout (GNU coreutils) ". uutils coreutils reports
"timeout (uutils coreutils) " with the same command line and the same
exit 124 on expiry, so hosts that ship it (Ubuntu 25.10+, NixOS with
uutils-coreutils-noprefix) silently fell through to the Perl alarm, or
to the unbounded direct run when Perl is absent. Follow-up from #5522,
tracked in #5541.
- Widen the identity allowlist to uutils; the match stays by banner so
Windows timeout.exe is still never probed (#5503).
- Add a backend-selection case using the GNU stub with the uutils
banner: fails on the old shim (selects gtimeout), passes with the
widening.
- Regenerate the managed sections in the tracked .githooks/* so
TestTrackedManagedHookSectionsMatchGenerator stays green.
- Update the hook-timeout passages in docs/reference/git-integration.md
and troubleshooting.md, which described the probe as GNU-only.
Verified on NixOS with uutils 0.10.0 as /run/current-system/sw/bin/timeout:
with Perl removed from PATH and a bd that hangs, the old shim runs
"without timeout" for the full duration; the new shim expires at
BEADS_HOOK_TIMEOUT and continues.
Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of Tomasz Feliksik
* Regenerate tracked .githooks managed sections with make githooks-regen
TestTrackedManagedHookSectionsMatchGenerator holds the managed section in
each tracked .githooks/* byte-equal to the cmd/bd/hooks.go generator, but
nothing regenerated them: after a generator change a contributor had to
splice the new section in by hand, and the failure only dumped both
texts. The v1.2.0 bump reddened main this way (ce20a64bb), and #6561 shipped
its first revision with the five hooks stale.
- BD_UPDATE_GOLDEN=1 makes the test rewrite the section in place, keeping
everything around the markers (the project's own hook logic) untouched.
Same switch the package's events golden already uses.
- `make githooks-regen` wraps it, next to `corpus-regen`.
- The drift failure now names that command.
- The exactly-one-section check runs before any rewrite.
Verified: drifting one byte inside .githooks/pre-push fails the test with
the hint; `make githooks-regen` restores the file to the same blob SHA;
the test is green again.
Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of Tomasz Feliksik
* Check the tracked hook shims against real timeout implementations
The Go tests pin the shim's helper selection with scripted stand-ins, so
they can only encode what the author believes each real `timeout` does.
That is where the last two defects lived: uutils prints a banner the
allowlist did not know (#5541), and busybox — which #5541 suggests
adding — exits 143 on expiry rather than 124, so allowlisting it would
turn every deadline into a failed hook and a blocked push.
checks.nix adds a flake check that runs the tracked .githooks/* managed
sections (held equal to the generator by
TestTrackedManagedHookSectionsMatchGenerator) against the binaries
themselves: GNU coreutils, uutils, busybox and toybox `timeout`, each
with and without perl, under dash, bash and busybox ash, for all five
hooks — 150 cases. Expectations come from a model of the contract (the
allowlist as data), so widening it is one line here and the binaries
either agree or they do not.
A fake bd on the shim's restricted PATH blocks on a held-open fifo until
a helper kills it, records the signal and re-raises it, so each case
asserts the backend that ran (TERM from timeout, ALRM from perl's alarm)
and not merely that the shim finished. No clock: a helper that fails to
kill the fake trips the harness's own `timeout 10`. Every case asserts
exit 0, since anything else blocks the user's push. Reading .githooks/*
instead of building bd keeps it at ~1 s and off the Go build's critical
path; CI's test-nix job runs it after its existing help-text smoke test.
Mutation-checked: restoring main's GNU-only sections fails all 30 uutils
cases (15 unbounded, 15 on the perl backend); allowlisting busybox with
a loosened probe fails all 30 busybox cases with hook exit 143.
Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of Tomasz Feliksik
* Run the hook-timeout check under the gtimeout candidate name too
The shim probes `timeout` and then `gtimeout`, but the matrix only ever
put a binary named `timeout` on PATH, so the second candidate was never
run against a real implementation. Whether a helper is accepted under
that name depends on what its banner does with argv[0].
Measured: the uutils multicall dispatches on the argv[0] SUFFIX
(src/bin/coreutils.rs, `binary_as_util.ends_with(util)`) and then prints
the canonical utility name — invoked as gtimeout it reports
"timeout (uutils coreutils) 0.8.0" (this flake's nixos-25.11 pin; 0.11.0
identical), which the allowlist accepts. busybox and toybox know no
gtimeout applet and fail the probe outright, rejected as before. GNU is
immune by construction: Homebrew's gtimeout is a separate binary whose
banner is the fixed "timeout (GNU coreutils) 9.11"; nixpkgs' coreutils
is a single-binary multicall that refuses a foreign name ("unknown
program 'gtimeout'"), so it gets no variant here.
Each multicall is now also installed on a case PATH as `gtimeout` ALONE
(`installs`, derived from `implementations`; `backendFor` stays keyed on
the implementation, so the model's claim is "uutils is allowlisted
whatever it is called"). 240 cases on Linux, 80 on darwin (no busybox or
toybox there, and no busybox-ash shell). The shadowed
`out=` inside run_case is `case_out` now: it only survived because every
case is a backgrounded subshell, and a de-backgrounded case would have
died on the final `touch "$out"`.
Mutation-checked: installing the variant as `xtimeout` (a name the shim
never probes) fails exactly the 30 uutils-as-gtimeout cases — 15 with
nothing killing the fake bd, 15 on the perl backend (ALRM) instead of
coreutils; restored, 240 of 240 pass. The busybox/toybox variants cannot
distinguish (their expectation is rejection either way); their weight is
that the probe does not blow up on a foreign name.
* Run the flake checks on main too, by nix flake check; docs wording
pr-risk.yml's test-nix job ran the hook-timeout check on PRs only; the
byte-identical job in main.yml never got the step, so post-merge main
never ran it. Both jobs now run `nix flake check -L`: no hardcoded
`x86_64-linux` (the step beside it, `nix run .#default`, was already
system-agnostic), and a check added to checks.nix runs without a
workflow edit. checks.aarch64-darwin and .x86_64-darwin evaluate.
Measured on ubuntu-latest with a cold Nix store (fork run 35700791032,
this tree, 240 cases): `nix flake check -L` 3.6 s including substitution
of uutils, busybox, toybox, dash and perl; 0.08 s warm — beside the
4 min 9 s the existing `nix run .#default` step spends building bd in
the same job. The 10-minute timeout is not in question.
git-integration.md: on Git for Windows the preferred deadline backend is
"a coreutils timeout (GNU or uutils)", not GNU alone, since both now
qualify. troubleshooting.md: reflow a ragged paragraph.
* review: close the duplicated contracts around the uutils timeout accept
Maintainer review fixes for #6561. No change to the shim's behavior or to the
generated/tracked hook sections.
- cmd/bd/hooks_timeout_process_test.go: the uutils fixture was built with
strings.Replace, which returns its input unchanged when the pattern is
absent, so a later edit to the GNU stub's banner would silently degenerate
the uutils case into a second copy of the GNU one — still green, no longer
testing the new accept. Hoist the derivation and fail loudly when the banner
no longer matches.
- cmd/bd/hooks_timeout_process_test.go: findHookProcessGNUTimeout held a second,
un-widened copy of the identity allowlist, so on exactly the hosts this PR
exists for (uutils timeout, no gtimeout) the only Go test that drives a real
timeout binary skipped with a reason the fix had just made false. Widen the
probe's case, rename it findHookProcessCoreutilsTimeout, and reword the skip
and the subtest. Measured against stub PATHs: uutils goes rc=1 -> rc=0, GNU
stays rc=0, a busybox banner stays rc=1.
- cmd/bd/init_hooks_test.go: TestGenerateHookSection_Timeout asserted only the
GNU alternative, so deleting the new uutils one from the generator left the
structural contract green (verified: it passes under that mutation before
this change, and reports "section missing uutils coreutils identity check"
after). Add the companion assertion.
- cmd/bd/init_hooks_test.go, Makefile: the regen arm rewrites tracked source
files, so give it its own BD_UPDATE_HOOKS_GOLDEN rather than the package's
shared BD_UPDATE_GOLDEN — an unscoped `BD_UPDATE_GOLDEN=1 go test ./cmd/bd/`
used to turn genuine hook drift into a silent working-tree rewrite that
reported PASS.
- cmd/bd/init_hooks_test.go: locate the managed section by marker prefix
instead of the versioned marker line. Tracked hooks drift both from generator
content and from the release version stamp; the exact-line lookup made the
second class fatal ("tracked hook missing ...") before the regen arm was
reachable, so `make githooks-regen` failed at exactly the moment a release
engineer reaches for it. The versioned markers are still verified — they are
part of the byte compare.
- checks.nix: the `rc -eq 124` safety-net verdict discarded both $case_out and
the already-captured $signal, so the one failure mode that is intermittent
and not locally reproducible was also the only one with no diagnostics.
Report them like the `rc -ne 0` branch below it.
- docs/reference/troubleshooting.md, docs/reference/git-integration.md: mirror
the coreutils wording across both docs this PR touches, and generalize the
re-install guidance in both. Managed sections are never reported Outdated
(getHookVersion returns IsShim for them and computeHookStatuses gates on
!IsShim), so nothing tells an existing install it is stale; the sentence was
still scoped to the older name-only check (#5503).
- CHANGELOG.md: add the [Unreleased] entry for #5541, worded to the actual
scope — with Perl installed the shim still reached the Perl alarm arm, so the
lost deadline bit uutils hosts without Perl — say that existing installs must
run `bd hooks install` once, and drop the claim that stock NixOS ships uutils
(this PR's own checks.nix takes GNU from pkgs.coreutils).
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(list): expose comment bodies and mark the omission in bd list --json (be-73x)
`bd list --json` reported comment_count and carried no comment text and no sign
that any was missing. The consequence is not a missing field: a content search
over a listing answers with a well-formed, NON-EMPTY result set whose matching
rows are absent, and nothing about that answer invites a second look. An empty
result invites suspicion; eight rows do not.
Two halves, and the second is the one that fixes what was actually reported:
1. --include-comments on `bd list` populates each row's comments with the
full bodies, the list twin of `bd show --include-comments`. Opt-in: it
costs one query per row that has comments.
2. Every row with a nonzero comment_count whose bodies were NOT hydrated now
carries comments_omitted=true, by default, with no flag. A flag nobody
knows to pass does not fix a silent hole; a marker on the row does.
The bodies ride on types.Issue.Comments, which already carried the `comments`
key for export/import and was simply never populated on this path, so the only
new field is the marker.
Hydration is one shared body (workapi.HydrateListComments) called from BOTH
issueops.Reader.List implementations, the store-backed and the unit-of-work
one. Those are separate bodies that have answered one contract method
differently before; it runs in the page epilogue beside FinishPageAt, after the
trim, so a page never pays for rows it is about to drop.
The source parameter is a CONSTRUCTOR rather than a source, and that is
load-bearing. Building the unit-of-work comment source eagerly made a
capability only the opt-in path uses into a requirement every caller had to
satisfy, and turned `GET /v0/beads/issues` into a 500 on a provider without a
comment use case — on requests that had asked for no comments. A count-only
listing now constructs nothing, pinned by a test that fails if the constructor
is called.
Tests pin each implementation separately rather than duplicating: unit tests
over a fake source, an embedded-dolt test over the real CLI on the direct
route, and a proxied-server test over the real CLI on the unit-of-work route.
Sabotage-controlled three ways — no-op the shared body and all three suites go
red; unwire either reader alone and only that reader's CLI test fails, which is
what proves neither integration test is redundant.
Not addressed, deliberately: gt-mfp5 (bd comment does not advance updated_at,
the orthogonal recency axis) and be-ozp (bd ready --json carries no marker; it
does not route through Reader.Ready).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XK4B7N2CrgfKGEQvDTPM4D
Executed-By: beadsrig/polecats/dag
* fix(list): do not read a skipped comment count as proof of no comments (be-73x)
Codex review of the parent commit, correctly.
`IncludeComments: true` combined with `SkipCounts: true` returned a page with
no comment bodies at all — no error, no marker, nothing — while
`IncludeComments` documents a guarantee to populate them. The hydration loop
skipped any row whose CommentCount was zero as an optimisation, and SkipCounts
zeroes every count: `issueops.ListRequest.SkipCounts` says in its own doc that
a zero then means UNKNOWN rather than none.
That is this bead's own failure mode reintroduced one layer down by the fix for
it: a silent, well-formed, empty answer to a request that asked for content.
I had considered the interaction and resolved it wrongly, in a comment reading
"the count is authoritative here because the JSON route never sets SkipCounts".
True of today's CLI callers, and not a property of the contract — issueops
.ListRequest is a PUBLIC request type and permits both fields at once. A
comment saying "X cannot happen because of how callers behave today" on a
public type is a bug with a justification attached, and worse than no comment,
because it tells the next reader the case was checked.
countsKnown is now a parameter rather than an assumption; call sites pass
!req.SkipCounts.
countsKnown true a zero count proves a row has nothing; skip its query.
countsKnown false query every row, because nothing proves otherwise, and
mark no row omitted, because comments_omitted asserts a
nonzero count the page cannot support.
The second half is the mirror defect on the marker path — the same conflation,
the other direction — which the review did not name.
No behaviour change on any current CLI path: the JSON route never sets
SkipCounts, so it passes countsKnown true, and the text route asks for no
comments and marked nothing before either. Verified: `bd list --json` output
identical, and text output identical with and without the flag.
Regression tests HonorsIncludeWhenCountsAreSkipped and
MarksNothingWhenCountsAreSkipped. Sabotage-controlled: restoring the
count-authoritative skip fails the first with "issued 0 comment reads, want 2".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XK4B7N2CrgfKGEQvDTPM4D
Executed-By: beadsrig/polecats/dag
* fix(list): resolve the comment plane by residence, not by the row's flags (be-73x)
Maintainer review fixup for #6473, iteration 1. Both review lanes reached the
same major independently and the synthesizer re-verified it against the tree.
The new list hydration derived the comment table from the row's own
Ephemeral/NoHistory flags - issueops.IsWisp's rule, which is right for routing a
record being WRITTEN and wrong on a read. `bd import` pins a `no_history` record
to the DURABLE table while preserving the flag on the row, because clearing it
would change the content hash and break export->import->export byte-identity,
and every clone materializes its database by importing JSONL. So a promoted
no-history bead that has been through a round-trip is a durable row whose flags
say wisp:
bd list --json --include-comments read wisp_comments, found nothing, and
returned comment_count=N beside an empty
`comments`, with no marker and no error
bd comment, bd show write and read that same row's comments on
the issues plane, by found-table
That is be-73x's own failure mode reintroduced under the flag whose contract is
"gets them or gets an error", and a cross-role divergence: `bd list` and
`bd show` disagreed about one row. The mirror case is real too - an import
record whose `wisp_plane` key pins it to the wisps table with neither flag set
reads back as durable - so no flag-based rule gets both directions right.
The plane now comes from the seam that knows it. HydrateListComments takes a
CommentPlanes lookup instead of inferring; the unit-of-work reader answers it
from the wisps TABLE (IssueUseCase.GetWispsByIDs, the call edgeReader.ReadEdges
already makes for the same question), once per page, inside the page's own read
transaction. The store-backed seam passes SourceRoutesCommentPlanes because its
source routes ids itself (DoltStore.GetIssueComments picks the table from
isActiveWisp) and would buy a lookup for an argument it ignores. isWispPlane is
deleted: nothing on this path infers a plane any more. A nil lookup is an error
rather than a silent "durable", so a third seam has to answer the question
rather than inherit the default this bug was.
A MISSING WISPS TABLE STAYS "NO WISPS" rather than a failed listing, classified
through the same two helpers the counts query that produced the page uses
(dberrors.MissingTableName + sqlbuild.OptionalWispTable). Any other failure of
the lookup fails the call: a guessed plane answers with the wrong table's
contents and nothing in the response shows it.
Tests. The unit table now asserts residence AGAINST the flags, with each row's
comments present only on the plane it lives on, so a wrong-table read shows up
as missing TEXT and not merely as a wrong flag in a recorded call. Restoring the
flag inference reds exactly the two rows where flags and table disagree
(durable-carrying-no_history, wisp-table-carrying-no-flags) and leaves the two
agreeing rows green. The old `override_wins_over_flags` case is gone:
WispPlaneOverride is `json:"-"` and set only by import, in memory, so no scanned
row can carry it and that branch was unreachable on this path - which is what
made the suite look sufficient (Codex's separate minor, folded in here as the
same root cause). New seam-level tests drive the real uow Reader.List over both
shapes, and pin that a listing without the flag resolves no planes at all, that
a missing wisps table is tolerated, and that any other lookup failure
propagates; emptying the residence answer reds the wisp-row leg.
Also from the review, non-gating:
- types.IssueWithCounts.CommentsOmitted and the OpenAPI property stated the
marker rule unconditionally on a type Reader.Ready and the claim response also
return, neither of which calls the epilogue. Both now scope the rule to the
List surfaces and cite be-ozp, which is where the parent commit deliberately
left the ready surfaces. (`bd ready --json` does not route through
Reader.Ready; GET /v0/beads/ready and ClaimNextResponse.claimed do.)
- GET /v0/beads/issues gained no `include_comments` parameter, so its
description now says so and points at the detail read, in the idiom the
`revision` paragraph above it already uses.
- One internal/httpapi list test for the new wire field: the marker present for
a commented row, absent for an uncommented one. It was asserted only by the
spec file; the detail twin has get_issue_test.go. Neutering
markCommentsOmitted reds it.
Validation: go build ./...; go vet over the changed packages and again with
CGO_ENABLED=0; make api-check clean, so the spec edits oblige no regeneration;
go test ./internal/workapi/... ./issueops/... ./internal/types/;
TestBothReaderImplementationsAgreeOnTheListEpilogue plus the new plane tests in
./internal/storage/uow/; BEADS_TEST_PROXIED_SERVER=1
TestProxiedServerListComments 3 PASS and BEADS_TEST_EMBEDDED_DOLT=1
TestEmbeddedListComments 4 PASS.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(feat): red — dep add stores a cross-store target as a bare external ref, then readers drop it (from:gm-ri3xl0) (refs be-gmdx5)
* feat: green — dep add stores a cross-store target as a bare external ref, then readers drop it (from:gm-ri3xl0) (refs be-gmdx5)
* chore: release gate PASS for dep-add-external-ref (be-fghsd)
* fix(dep): keep the bare cross-prefix dep target, refuse only type:id
Review of #6571. The previous commit closed both bug shapes by requiring
any target that failed local/routed resolution to be a well-formed
external: ref. That over-reached: only one of the two shapes was
malformed.
A bare, differently-prefixed target is first-class by this codebase's own
definition. issueops.IsExternalDepTarget says a target "whose id prefix
names ANOTHER REPOSITORY" belongs in depends_on_external alongside
external: refs, and calls that the single rule every backend must
classify by; db.pickDepTargetColumn restates it. It is the multi-rig
"add now, route later" shape, and the ExtractPrefix fallbacks in
validateBulkDepEdges and dep remove still address such an edge. Refusing
it in dep add meant refusing to create an edge the store holds and dep
remove can still delete.
The type:id misparse stays refused, and by a sharper test than a prefix
comparison: no bd ID contains ":", and the external: shape is already
handled above, so anything else containing ":" is malformed regardless of
prefix. The error now names the flag form that would have worked.
Adds a test pinning dep add's accept decision to IsExternalDepTarget, so
the CLI and the storage classification cannot drift apart again.
* chore: drop the release-gate record from the PR
Review of #6571. The reviewer is right that a 111-line record of our
deployment ritual is not something a bd user gets anything from, and the
"but the directory already exists upstream" defence does not survive
checking who put it there: 45 of the 47 commits touching release-gates/
on main are ours. That is not a repo convention, it is us.
The gate record itself is not lost — it stays in this branch's history at
0e8d7e2a4386 and on the deploy bead. Dropping only this PR's file; the
existing 31 are a separate conversation we should have on our side rather
than settle by unilateral deletion here.
* fix(dep): apply the target refusal at every dep add site, and get its suggested command right
Maintainer review fixes for #6571.
The PR extracted resolveUnresolvedDepTarget to centralize the dep add target
decision, but installed it at one of four decision sites. The be-gmdx5 silent
mangle — a "type:id" positional arg stored verbatim as a bogus external ref with
the type dropped — survived on `dep add --file` (validateBulkDepEdges kept a
byte-equivalent copy of the replaced ladder) and, more sharply, on both proxied
paths, where the identical invocation was refused in direct mode and stored in
proxied mode. Nothing below the CLI backstops it: addDependencyEdgeInTx
classifies by ExtractPrefix alone and validates no target shape.
Split the resolution-free half of the decision into refuseMalformedDepTarget so
all sites share it: validateBulkDepEdges now routes through
resolveUnresolvedDepTarget (per-line message unchanged), and the two proxied
paths — which deliberately resolve no IDs — call the shape refusal directly.
The refusal's suggested command was also backwards for the one reversing
spelling. parseDepSpec sets SwapDirection for the literal "blocks:" only, so
`--deps blocks:B` on A stores "B depends on A"; the suggested
`bd dep add A B --type blocks` stored the opposite, handing the user a reversed
bd ready/bd blocked gate. Emit the swapped operands for "blocks:" and keep the
natural order for the depends-on/blocked-by aliases, which are compared before
canonicalDependencyType and do not swap.
Also gate the "`bd create --deps` <type>:<id> syntax" diagnosis on the token
before the ":" being a type --type would accept, so an unrelated colon-bearing
typo ("https://example.com/x") gets the generic refusal instead of a confidently
wrong cause and a --type the next validation rejects.
Review iteration 2 closed the enumeration at the fifth surface and the last
coverage gap:
- runDepBlocksProxiedServer — the `bd dep <blocker> --blocks <blocked>` alias
the dep help documents as "equivalent to: bd dep add <blocked-id>
<blocker-id>" — reached the edge builder from raw args with no shape check,
so the same invocation stayed refused in direct mode and stored in proxied
mode. It now mirrors the dep add proxied site, with the operands inverted
(the blocker is the target), and the helper's doc comment names all five
sites instead of claiming four.
- refuseMalformedDepTarget TrimSpaces both halves like parseDepSpec, so
pasting an accepted `--deps "blocks : bd-2"` spec into dep add still gets the
actionable translation rather than the generic refusal.
Tests: blocks:/depends-on: direction rows with an omit-guard on the wrong
operand order, a non-type-prefix row for the gated diagnosis, a whitespace row
for the trimmed diagnosis, call-site refusal pins on all three proxied paths,
and a call-site pin for direct `--file` (validateBulkDepEdges) driven by a stub
store, which replaces the previous coverage-by-construction argument on the one
converted site with the worst regression history. Each new pin was
mutation-proved to red only for its own site.
Refs be-gmdx5, be-fghsd
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
bd compact --days N replayed the preserved commits in commit-date order.
Dolt does not require dates to be monotonic along the parent chain, so a
child dated before its parent was cherry-picked first and conflicted on
any shared row (#6516).
Log now also surfaces dolt_log.commit_order (CommitInfo.CommitOrder), and
both compact paths (embedded/server and proxied-server) share a new
planCompaction helper that sorts the recent commits by commit_order
ascending. Old/recent partition, initialHash and boundaryHash selection
are unchanged (still date-based).
Adds unit tests for the planner and an embedded-Dolt regression test that
reproduces the issue (child dated 20 min before its parent).
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* test(metrics): red — bound the all-fresh-backlog prune walk (refs be-wwy2.3)
Rework prune_test.go for the bounded-incremental-heap design:
- TestPruneQueueCapsYoungPileWhenTTLMadeNoProgress now asserts a bounded
ReadDir call count via a countingReader, instead of dropped==0.
- New TestPruneQueueConvergesAcrossRepeatedCalls pins eventual convergence
to <= maxFiles across repeated budget-limited calls.
- TestPruneQueueDoesNotCapOnPartialListing reworked for incremental eviction:
a recordingReader captures the examined prefix so the test can assert the
examined chunk's own eviction stood (54 dropped/146 survivors) while the
never-examined remainder is untouched.
- New TestQueueMinHeapNeverExceedsCapacity and TestQueueMinHeapCapacityZero
pin the not-yet-implemented queueMinHeap type's invariants directly.
go test ./internal/metrics/... fails to compile (undefined: queueMinHeap),
confirming RED.
* feat: green — Bound the all-fresh-backlog prune walk so a truncated pass can still apply partial caps (Factor B residual) (refs be-wwy2.3)
* docs(metrics): scope the prune's cap guarantees to what the bounded walk delivers
Maintainer review fixup for #6515 (adopted as bd-98nuy), iteration 1.
Majors:
- flusher.go's call-site comment still documented the design this PR deleted
("finishes its listing when stopping would leave the queue unbounded" and
"the prune's cap-unlink pass runs after the budget check"). Both clauses are
now false: the break is unconditional and evictions happen inline inside the
budget-checked region. Rewritten to the post-change story, keeping the one
still-true clause (eventkit's own flush prologue is the un-budgeted half).
- PruneQueue's "converges to the caps across repeated calls" is false when one
budget examines no more than maxFiles entries: eviction requires pushing more
than maxFiles live entries (or maxBytes worth), so on the bd-ulfod-class
spool (~165 stats/s, ~5k entries per 30s budget) no call evicts anything and
pruneTTL is the only bound. Disclosed explicitly instead of papered over,
with why the bounded-overrun alternative was not taken: walking past the
expired budget to maxFiles+pruneChunkSize examined entries reinstates the
overrun this lane removed (~10k stats, 2x the advertised bound) and still
would not make convergence unconditional -- where the count cap binds first
it yields only pruneChunkSize evictions per call, well under what one
flushInterval of the documented emission rate adds. Scaling the caps down to
the examined prefix stays forbidden: it would delete entries a full pass
keeps. New TestPruneQueueCapProgressNeedsMoreExaminedThanMaxFiles pins both
sides of that boundary.
Minors (nearby, doc/test only):
- The retention-ordering claims overclaimed. queueMinHeap's "the entries the
heap holds are exactly the maxFiles-newest (within maxBytes) of everything
examined" is false once the byte cap evicts: a later small entry can fit
after a larger, newer one was dropped, so the held set is a superset of a
global pass's survivors, never a subset. Restated as the one-directional
guarantee, and the constant/summary prose now scopes oldest-first to the
examined prefix (prefix order being the filesystem's, not chronological).
The cap values themselves remain global.
- TestPruneQueueCapsYoungPileWhenTTLMadeNoProgress asserted only that the
budget was honored -- already pinned by TestPruneQueueStopsOnExpiredContext
-- so it stayed green with evict() stubbed to a no-op, under exactly the
cap-skip livelock it is named for. Now asserts the 54 evictions the one
budgeted chunk makes, plus the resulting directory count.
- Recorded that per-pass progress is best-effort rather than exactly
pruneChunkSize-maxFiles: evictions unlink underneath the same in-flight
getdents cookie the walk iterates, which ext4 htree may skip or repeat.
Iteration 2 (non-gating cleanups; docs and tests only):
- prune.go's "the newest entry a pass examined is never evicted (it can never
be the oldest entry the heap holds)" was a fresh false universal minted by
iteration 1's own fixup: evict() pops while live.Len() > 0, so once every
older entry has been popped the newest IS the oldest held and is popped too
(A(-10m, 30B) + N(-1m, 200B) at maxBytes=100 => dropped=2). Restated as the
direction the min-heap actually guarantees: evictions always take the oldest
entry held, so the newest examined is never dropped in favor of an older
entry held alongside it, and it is evicted only once every older entry has
been popped and a cap still binds -- its own size alone over maxBytes, or a
maxFiles of 0 -- in which case a full pass over the same examined set drops
it as well, so the one-directional guarantee is unaffected. (The reviewed
wording named only the byte cap; maxFiles=0 reaches the same path, so the
correction covers both caps.)
- TestQueueMinHeapNeverExceedsCapacity / TestQueueMinHeapCapacityZero were
tautological: each body popped until h.Len() <= maxFiles and then asserted
h.Len() <= maxFiles, which the loop's own exit condition entails, so neither
could red on a broken Pop. They now assert that every pop hands back the
OLDEST entry held -- the contract evict() consumes, since it unlinks the path
the pop RETURNS -- plus the survivor set by identity (the maxFiles newest),
with the push order permuted (stride 97, coprime with 200) so the heap has to
reorder rather than receive its input pre-sorted.
Mutation-proved per arm: e := old[n-1] -> e := old[0] in queueMinHeap.Pop now
reds TestQueueMinHeapNeverExceedsCapacity ("popped q0188.evtq while the heap
still holds q0188.evtq"), where both tests previously stayed green. Measured:
the survivor-identity assertion ALONE stays green under that same mutation --
a Pop that returns the wrong entry still shrinks the heap by one and still
leaves the correct survivors -- so the returned-entry assertion is the
load-bearing pin. Both are kept.
- flusher.go: "the prune's own overrun is now at most one chunk of stats" also
owes that chunk's own cap-eviction unlinks, which applying the caps inline
moved into the budgeted region. Stated.
- Renamed TestPruneQueueDoesNotCapOnPartialListing to
TestPruneQueueCapsOnlyTheExaminedPrefixOnPartialListing: this PR inverted the
test to assert the examined prefix IS capped (54/540), so the name became its
own negation. The name was accurate at the base (073556c79 asserted (0,0)),
i.e. the mismatch is PR-created. The old name appears in the PR
description's Testing list.
Not taken, with the measurement, so it is not re-litigated as an oversight:
- The inert regime emits no log line (flusher.go logs only when dropped > 0,
and the accepted regime has dropped == 0 by construction). Reporting entries
examined / which cap was reached requires PruneQueue's return contract to
change, which this PR's description explicitly advertises as untouched and
which ripples to the pruneQueueFn seam's test stub; the cheap call-site
variant (an else-if on pruneCtx.Err()) cannot be pinned at all, because
RunSendMetrics builds that deadline internally from flushTimeout, leaving a
test no seam to expire it. Shipping an untested new production branch in a
telemetry child was the worse trade against a non-gating minor, so this is
carried as a follow-up instead.
No production behavior change in either iteration. All assertions
mutation-proved: a no-op evict() reds the two progress pins, a prefix-scaled
cap reds the inert pin, and a wrong-entry Pop reds the heap-contract pin.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(exec): match Windows environment key identity (#5618)
Centralize os/exec-compatible environment-key comparison and use it for credential, metrics, Git-hook, trace, and repro subprocess filters. Preserve exact Unix semantics and Unicode near-collisions.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(worktree): scrub inherited Git routing state
Establish CWD as the worktree repository boundary before discovery can consume inherited Git routing. Fence the startup config probe, clear routing in-process before root pre-run discovery, and retain command-owned subprocess scrubbing as defense in depth without changing PID or signal semantics.
Fixes#5531
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* refactor(worktree): explain owned filtering and remove an unused shim
Document why filtering the fresh routing slice in place is safe and call
the shared routing-key classifier directly from tests. Retain the two
forwarders used by production worktree subprocess/removal paths.
Review: https://github.com/gastownhall/beads/pull/5623#pullrequestreview-5098421671
Bead: saa-cgh.23
Agent-Signature: unknown-model/unknown-reasoning
* fix(config): isolate identity and tracked-file Git probes from routing
Reuse the worktree routing owner for GetIdentity and isGitTracked so
explicit cwd/path selection is not displaced by inherited repository,
index or injected config state. Preserve identity precedence and the
tracked-secret refusal contract, with real target/decoy regressions.
Follow-up: https://github.com/gastownhall/beads/issues/6222
Dependency: https://github.com/gastownhall/beads/pull/5623
Reported-by: bee-ghosttrack
Bead: saa-cgh.93
Agent-Signature: unknown-model/unknown-reasoning
* test(execenv): exercise every environment operation under both host rules
Thread the host choice through narrow private helpers behind the existing
exported functions. Keep one normalization owner and retain native wrapper
tests; the additional table covers both host branches for equality, prefix
matching, last-wins lookup, filtering and input preservation.
Review: https://github.com/gastownhall/beads/pull/5672#pullrequestreview-5096948965
Bead: saa-cgh.78
Agent-Signature: unknown-model/unknown-reasoning
* docs(worktree): explain startup Git environment scope (saa-cgh.23)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(execenv): exercise exported host policy wiring (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): share subprocess key identity for Git routing (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): isolate tracked-file guard from Git routing (saa-cgh.98)
Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6356.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): isolate role commands from Git routing (saa-cgh.99)
Follow-up to bee-ghosttrack's review of gastownhall/beads#6322; refs #6357.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(env): exercise shared key helpers on native Windows (saa-cgh.78)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitenv): share key parsing and normalize routing membership once (saa-cgh.93)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(config): explain role command routing policy (saa-cgh.99)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): retain legitimate inherited tracking context (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): isolate trusted global configuration fixture (saa-cgh.98)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): isolate role cleanup in the selected repository (saa-cgh.109.4)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): reset only common local role configuration (saa-cgh.109.10)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): scope hooks-path cleanup to selected common config (saa-cgh.109.11)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): make worktree role preservation independent (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Report selected config read failures during hook reset (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(hooks): keep successful config stdout separate from diagnostics (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): pin role writes to fresh common context (GH#6384) (saa-cgh.120.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config): retain Git diagnostics from role writes (saa-cgh.120.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(config): assert the actual Git lock diagnostic (saa-cgh.120.3)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(config,hooks): restore the inherited-tracking fallback in the secret guard
Maintainer review fixes for PR #6454 (adopt-pr iteration 1). The scorecard
approved at 913/1000 with no blocker or major surviving synthesis; these are
the non-gating findings that were cheap to close while the fixup was open.
Finding 1 (minor, security) is the only in-range regression in the report. The
range switched internal/config.isGitTracked from the inherited environment to
gitenv.ScrubRouting only, so a config.yaml tracked solely through legitimate
routing -- a bare repository whose work tree is named by GIT_DIR/GIT_WORK_TREE
-- reported untracked, and a secret-key write that upstream-base refused was
silently allowed. Restores the scrubbed-then-inherited union the same stack
already gave cmd/bd.isGitTrackedFile.
Finding 4 (nit) composes with it rather than conflicting, so both land as one
change: the inherited probe now runs only when the scrubbed probe failed for a
configuration reason. git's exit codes discriminate exactly -- 0 tracked, 1
repository reached but path untracked (final), 128 no reachable repository --
so the ordinary untracked-hook miss no longer spawns a second `git ls-files`
while the bare-work-tree fallback is preserved.
Finding 2 (minor). scrubWorktreeRemovalGitEnvForOS keyed its stricter
no-optional-locks policy on strings.ToUpper while the rest of the PR uses
execenv key identity. The two disagree in both directions on Windows:
GIT_OPTIONAL_LOCKS with a dotted capital I (U+0130) survived the scrub although
Git honors it, and GIT_OPTIONAL_LOCK with a long s (U+017F) was dropped
although os/exec keeps it distinct. normalizeWorktreeGitEnvKey is deleted in
favour of execenv.KeyEqualForOS. Base applied ToUpper on all platforms, so this
is a consistency fix in newly rewritten code, not a regression.
Finding 5 (nit). The comment above resetHooksPathIfBeadsManaged's probe
asserted that repoRoot and commonDir share the cached Git context. Probed
false: with cwd A and GIT_DIR=B/.git, `git rev-parse --git-common-dir
--show-toplevel` prints B/.git and A. Restated as intent.
Finding 3 (scrubGitHookEnv is a fifth, strictly weaker routing scrubber) is
deliberately not taken here: cmd/bd/export_auto.go is untouched by this range,
so the hazard is byte-identical at base, and the synthesis scoped it to a
follow-up bead rather than growing this stack.
Each fix is mutation-proved. Reverting isGitTracked reds only the new
TestSecretGitTrackingHonorsInheritedBareWorkTree -- including "refusal = <nil>",
the actual security consequence -- while the incumbent decoy test stays green,
so the pin adds coverage rather than duplicating it. Restoring ToUpper reds
only the new Windows row, showing both directions at once.
TestGuardHookWritePathHonorsInheritedRepository gains a fixture guard asserting
its scrubbed probe fails for a configuration reason rather than exit 1, so a
future fixture change cannot silently make the fallback unreachable.
scrubWorktreeRemovalGitEnvForOS had no test at all before this.
Green locally: ./internal/config, ./internal/execenv, ./internal/gitenv,
./internal/githooksenv, ./internal/gittraceenv, ./internal/metrics, ./scripts,
./internal/beads (the GIT_CONFIG_GLOBAL blast radius neither reviewer ran), and
a blast-radius cmd/bd run over the hooks, worktree, role and uninstall suites.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Bee <bee@ghosttrack.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(dolt): verify shared cloud auth fixture without a time limit (saa-cgh.107)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(dolt): require cloud routing server in the opted-in full suite (saa-cgh.107)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(dolt): count successfully registered cloud auth cases (saa-cgh.107)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test: describe current shared cloud-auth shard fixture (saa-cgh.119)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
Post-merge review of #6740 (landed range c25059ada..730fb9867) found one
major: the machine-readable `failed[].error` field that PR added carried a
DIFFERENT string for the identical refusal depending on whether the caller
was on the embedded or the proxied-server route — the exact class of route
drift the close rewire exists to remove, shipped in the same commit that
states the principle in a comment. No test pinned the text, so CI was blind
to it.
Two causes, both on the proxied route:
1. The harvest loop copied `pre.errors[i]` — closeProxiedRefusal's DECORATED
display line — straight into the JSON field, so a blocked id gained
" (use --force to override)" that the direct route deliberately keeps out
of the same field. Fixed by carrying the typed error in a parallel
per-argument slot (`failureErrors`), mirroring the direct route's split,
and reading that slot in the new closeProxiedFailures.
2. Stripping the decoration was not sufficient: a refusal reaching this route
has also been wrapped by the layers it passed through, so the undecorated
typed error still read
close x-1: db: IssueSQLRepository.CloseChecked x-1: cannot close blocked …
against the direct route's
cannot close blocked issue: x-1 is blocked by [x-2]
closeProxiedTypedRefusal unwraps to the sentence the engine actually wrote
for the refusal classes the CLI already names by sentinel. Anything else
keeps its whole chain, where the wrapping is the only thing that says where
an unexpected failure came from.
Tests: the split and the unwrap are pinned in an untagged file so they run in
the CGO_ENABLED=0 lane too, and the shared assertion is applied by BOTH
integration suites — a new direct-route twin of
close_partial_failure_json_names_the_failed_ids, which also gives the default
route its first pin on reportCloseFailures' jsonOut branch. Every pin was
mutation-proved: reading the display line reds the three decorated classes
while the undecorated open-children control stays green; converging by
stripping the hint from stderr instead reds the human-line half; recording the
decorated line on the direct route reds the twin.
Scope: this is the only entry under the review's Required Changes. The five
non-gating minors (single-id --json report, closeCmd.Long paragraph, text-mode
per-id reprint, the `claimed` JSON type, the CHANGELOG not-found parenthetical)
are deliberately left for separate follow-ups.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(feat): red — Fix: bd bootstrap can also silently create an empty server-mode database (same root cause as be-5up5) (refs be-cy41)
* feat: green — Fix: bd bootstrap can also silently create an empty server-mode database (same root cause as be-5up5) (refs be-cy41)
* chore: release gate PASS for be-44rad-bootstrap-missing-server-db
* fix(bootstrap): unverifiable server probe is unknown, not existing (review of #6503)
Addresses the three MAJOR points from bee-ghosttrack's review at 49fc8fb5.
MAJOR 1 — a fresh clone whose server is unreachable no longer ends in
"nothing to do". The Err arm in existingBootstrapDBPlan now requires
hasLocalShadowDir: a populated shadow directory is local evidence the
database really does live here, so a down server means "live DB we cannot
see". Without that evidence the identical error describes a fresh clone
ahead of its first sync, which must stay eligible for sync.remote,
refs/dolt/data, .beads/backup/ and issues.jsonl. An unverifiable probe is
UNKNOWN, never "exists".
MAJOR 2 — probeBootstrapServerDB takes retryTransient, passed as
hasLocalShadowDir. The 10/20/40s transient-restart budget was written for a
database known to exist locally that vanishes across a managed restart; a
fresh clone is not watching a database disappear, so it pays one round-trip
instead of 70s.
MAJOR 3 — the refusal moves to plan time. refuseServerModeInitPlan runs in
detectBootstrapAction, so Action="refuse" reaches --dry-run and --json,
printBootstrapPlan never advertises "will create fresh database" for a plan
that cannot run, and executeBootstrapPlan returns the refusal before
confirmPrompt. The plan-time probe result is threaded through the new
serverDBProbe rather than re-dialed. The executeInitAction guard stays as
belt-and-braces for callers that bypass detectBootstrapAction, but probes
once with retryTransient=false.
Landed as one commit rather than three: MAJOR 1 without MAJOR 3 is exactly
the hole the review names — with the Err arm falling through and no
plan-time refusal, an unreachable server reaches CreateIfMissing: true.
Splitting them would publish that state as an intermediate commit.
MINOR 4 — citations now point at PR #5791 as open and unmerged instead of
presenting be-5up5 / initGuardMissingServerDBMessage as landed on main.
Tests (all new, cmd/bd/bootstrap_test.go):
TestDetectBootstrapAction_FreshCloneUnreachableServerStillSyncs
TestDetectBootstrapAction_FreshCloneReachableAbsentSkipsTransientBackoff
TestDetectBootstrapAction_ShadowDirUnreachableServerStillReportsNone
TestDetectBootstrapAction_ExistingProjectMissingServerDBRefusesAtPlanTime
TestExecuteBootstrapPlan_RefuseErrsWithoutPrompting
The first two are the review's two probes, adjusted to the fix and renamed
into the file's existing convention; the third pins the shadow-dir case the
review flagged as main's correct behavior.
refs be-ms3ev, be-cy41
* chore: remove leaked internal release-gate doc from PR branch
release-gates/be-44rad-bootstrap-missing-server-db-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(bootstrap): don't let a server-side name match mask sync.remote recovery
Maintainer review fixes for #6503. The PR unlocked the server-mode existence
probe for workspaces carrying a ProjectID, which fixed the negative arm (a
fresh clone behind a dead server stays eligible for recovery) but also
widened the POSITIVE arm, which no test covered.
MAJOR — widened Exists arm masks recovery. A shadow-dir-less workspace now
reaches the probe, and a reachable server merely holding a database of the
configured NAME settled the plan as Action="none"/HasExisting=true, so a
configured sync.remote was never consulted. Nothing checks that the server's
database is this project's, and at the base commit such a workspace never
probed at all and always fell through to sync.remote. The pre-existing guard
against exactly this masking defers only when .beads/ is absent — but
.beads/metadata.json is committed and is the very file supplying the
ProjectID that unlocks the probe, so it is true for the common clone shape.
A stale same-named database, including one left by the bug this PR fixes,
therefore suppressed the recovery clone.
Fix: thread the local-evidence signal out of the probe (serverDBProbe.
LocalEvidence) and defer an Exists verdict reached on the name alone through
the existing deferredExistingPlan path. sync.remote / refs/dolt/data / local
files get their turn and the name match survives as the fallback verdict, so
the PR's own "no local shadow dir still live-checks existing" behavior is
preserved where nothing else matches.
Also, non-gating:
- Set Blocked for Action=="refuse". The Blocked field documents the file's
compatibility rule ("blocked" is what scripts switch on), and a refusal was
the one no-database outcome reporting "blocked" absent. No exit code
changes: a real run reaches executeBootstrapPlan and errors, and --dry-run
is contractually exit 0 either way. Clearing SyncRemote on Blocked plans
keeps that field's own "empty on a Blocked plan" contract true, since a
refusal can be reached with a forge remote already recorded.
- Rewrite the Blocked rationale comment and the long-help bullet, which still
promised unconditional creation. Only cmd/bd/bootstrap.go changes:
docs/CLI_REFERENCE.md and docs/cli-reference/ are generated from the release
tag pinned in docs/cli-docs.pin, so hand-mirroring the bullet there is
permanent drift against its own regeneration (and forfeits
check-cli-docs-drift.sh's inherited-drift pass, which requires the PR to
leave those files untouched). The published text lands at the next pin bump.
- Scope the "local evidence" claim to locally-managed server mode: in shared
server mode the shadow dir is ~/.beads/shared-server/dolt/, one directory
for every database on the machine. The behavior is pre-existing on main;
only the PR's new prose overstated it, so the comment is corrected rather
than the check narrowed.
- Reword the refusal's recovery block so every route is followable from the
refused state: bd backup restore is Dolt-native and needs an initialized
database, so it silently routed the operator back through bd init — the
unguarded door this refusal exists to keep shut.
- Cover the refuse plan's machine-readable surface (Blocked, marshalled JSON,
no ANSI, no sync_remote) and printBootstrapPlan's refuse arm, which no test
reached. Each new assertion was mutation-proved against the code it pins.
- Pin the other half of the new settle gate: an Exists verdict backed by a
populated local shadow directory must still settle immediately, because
deferring it re-clones over a database that already exists (GH#5037's
Error 1007). Only the Err arm of that gate was covered, so a regression
narrowed to Exists verdicts stayed green suite-wide; it now fails while the
three incumbent shadow-dir tests still pass.
- Document why printBootstrapPlan's refuse arm prints to stdout while the
"none"+Blocked arm prints to stderr. Both review lanes read the asymmetry as
a possible oversight, and it is now test-pinned via captureStdout. Comment
only: moving the arm to stderr would carry the one-line Reason off stdout,
where that pin deliberately guarantees it, and a real refuse run already
exits non-zero through executeBootstrapPlan, so this is not the #5743
false-success class the stderr sibling guards against.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(gitignore): preserve CRLF when appending project rules (saa-cgh.96)
Reported by bee-ghosttrack in gastownhall/beads#6343.
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): pin detector edge cases and clarify append behavior (saa-cgh.96)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): preserve line endings in Git exclude appends (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): share append byte composition (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(gitignore): clarify exclude fixture path variable (saa-cgh.104)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(gitignore): explain append aliasing and trailing CR completion (saa-cgh.105)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): refuse exclude writes after read errors (saa-cgh.110)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* refactor(gitignore): use shared composition for exclude rules (saa-cgh.111)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(gitignore): omit the empty exclude leading separator (saa-cgh.112)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): refuse unreadable global ignore files (saa-cgh.115)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): own global ignore fixture working directory (saa-cgh.115)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): preserve line endings in global ignore appends (saa-cgh.116)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(init): cover dangling global ignore symlinks (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* Use a literal CRLF fixture for global ignore composition (saa-cgh.120)
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* refactor(init): retire the unused global-ignore writer (saa-cgh.120.5)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(dolt): honor dolt.auto-commit=batch/off on the proxied-server write path (#4995)
In proxied-server mode every write minted a Dolt history commit whatever
dolt.auto-commit said. Two causes:
- cmd/bd/main.go never applied issueOpsContext(rootCtx) in the
proxiedServerMode branch of the root pre-run, so the context carried no
deferred-commit marker.
- internal/storage/uow/doltserver_tx.go: doltServerTx.Commit ignored
issueops.VersionCommitDeferred(ctx) and ran CALL DOLT_COMMIT('-Am', ?)
whenever a message was supplied.
Apply issueOpsContext to rootCtx in the proxied setup, and have
doltServerTx.Commit blank its message under a deferred context so the existing
plain-COMMIT branch persists the write to the working set without advancing
Dolt history. dolt.auto-commit=on is unchanged.
This commit alone strands batch/off writes in the working set; the explicit
flush point (`bd dolt commit`) follows in the later commits of this series.
(Originally recorded as "witness: salvage uncommitted work (ocb-ani)"; the
change itself is unmodified.)
* test(uow,cmd/bd): add regression tests for proxied dolt.auto-commit batch/off (#4995)
Add focused regression tests verifying that proxied dolt.auto-commit batch/off
defer Dolt version commits:
- cmd/bd: TestIssueOpsContextDefersByModeInProxiedServerMode verifies that
issueOpsContext defers version commits in proxied-server mode when
dolt.auto-commit is batch or off.
- internal/storage/uow: TestDoltServerTxCommitDefersDoltCommitUnderDeferredContext
and TestDoltServerTxRunTxWithDeferredContextSkipsDoltCommit verify that
doltServerTx.Commit blanks the commit message under a deferred context,
bypassing DOLT_COMMIT and status checks, and executing plain COMMIT to
persist writes into the working set without advancing Dolt history.
* fix(dolt): add the proxied flush point dolt.auto-commit=batch/off defers to (#4995)
The deferral half of this PR makes dolt.auto-commit=batch/off actually take
effect on the proxied-server write path. On its own that turns batch/off into
"never commit": proxied mode returns from the root pre-run before newDoltStore
runs, so getStore() is nil and `bd dolt commit` has no store to commit
through. Writes pile up in the sql-server working set where `dolt log`,
`dolt push` and backups never see them.
Add the missing half. cmd/bd/dolt_commit_proxied_server.go is the proxied dual
of `bd dolt commit`: it takes the uow.MaintenanceProvider route (RunNonTx) and
runs CALL DOLT_COMMIT('-Am', ?) on a pinned connection, gated on
issueops.HasPendingChanges. It deliberately does not go through
doltServerTx.Commit, which blanks its own message under the deferred context;
routing the flush through the deferral it exists to discharge would make the
flush a no-op. doltCommitCmd dispatches to it on usesProxiedServer(); the
message is built before the branch so both routes name the same default, and
the "Committed." / "Nothing to commit." contract is unchanged.
--dolt-auto-commit's help no longer claims proxied-server routes are
unaffected: it names the proxied flush point and keeps the SIGTERM/SIGHUP
flush marked embedded-only. docs/reference/configuration.md says the same.
`bd vc commit`'s proxied refusal now points at `bd dolt commit`.
Tests:
- cmd/bd/dolt_commit_proxied_integration_test.go: three batch writes leave
dolt_log unchanged and stay readable, `bd dolt commit` advances it by
exactly one, a second `bd dolt commit` reports "Nothing to commit." with
dolt_log unchanged, and one write under --dolt-auto-commit on advances it
by one. On the PR's original base it failed at the `bd dolt commit` step
with "no store available". On current main the front door refuses the
command before that code is reached, so this test is only green together
with the next commit, which moves `dolt commit` to supported in the proxy
capability registry.
- TestIssueOpsContextDefersByModeInProxiedServerMode renamed to
TestIssueOpsContextDefersByModePolicyTable and the proxiedServerMode
assignment dropped: issueOpsContext branches only on writesCommitNow(),
never on the storage mode, so the old name over-promised.
- doltserver_tx_test.go: "bd: update bd-4995" -> "bd: update GH#4995", which
no longer reads as a bead id.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(proxy): move `dolt commit` from refused to supported in the capability registry
Main's proxy capability registry (added by #6269, 24a9da6cc) declares
`dolt commit` direct-only: it has a "proxy.dolt_commit.unsupported" refusal
in proxyMaintenanceRefusals (cmd/bd/proxy_capability.go) and is classed
HistoryDirectOnly in historyCapabilityMatrix (cmd/bd/history_capability.go).
The front door therefore refuses `bd dolt commit` in proxied-server mode
before dispatch, so the proxied dual added earlier in this series is
unreachable, and dolt.auto-commit=batch/off has no way to flush.
the history/VC front-door contract, and neither the registry, its tests nor
the docs explain why `dolt commit` was listed. Nothing on main implemented
`dolt commit` for the proxied route at the time, which is consistent with the
entry being a statement of what existed rather than a design decision.
This flips a capability main had declared unsupported, deliberately: the
proxied route now has an implementation (runDoltCommitProxiedServer), and
batch/off need it as their flush point (GH#4995).
Declared the same way as the other proxied-supported command,
`dolt remote remove`: HistoryProxySupported in the history matrix, and no row
in proxyMaintenanceRefusals.
Tests follow: history_capability_test.go moves `dolt commit` from the
direct-only assertions and refusal contract to the proxy-supported ones
(including the nested front-door pass-through), and
history_remote_frontdoor_matrix_test.go drops the refusal row and adds a
`dolt commit` pass-through check to TestHistoryRemoteSupportedFrontDoorParity.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(proxy): exempt explicit commit points from the proxied deferral (#4995)
Maintainer review fixup for PR #6499, adopt-pr iterations 1-2.
Major (Contract & Interface Fidelity). The deferral is applied once, to
rootCtx, so it blanketed BOTH commit classes the direct route distinguishes by
which wrapper a verb picks: policy-honoring writes (transactHonoringAutoCommit,
per-verb issueOpsContext) and explicit commit points (transact, which passes
the caller's message whatever the policy says). Under dolt.auto-commit=batch a
proxied `bd batch -m "release batch"` therefore persisted the rows, discarded
the message and minted nothing, while the identical command and config on the
direct route committed it — and batch_proxied_server.go's own contract comment
rejects exactly that ("would persist these writes while silently bypassing
Dolt history"), as does batch.go's "the contract is the same on both backends".
issueops.WithImmediateVersionCommit clears the marker and cmd/bd's
explicitCommitPointContext applies it in the duals whose direct twin calls
transact. Scope is the intersection of the transact call sites with
proxyPermittedPaths: batch, mol bond/pour/squash, mol wisp create, and the
WISP half of mol burn (cook and migrate issues also call transact but are
refused in proxied mode, so they have no dual to exempt). The review sized the
radius at batch + 4 mol verbs; mol wisp create is the same class — its direct
twin reaches cloneSubgraph's transact through spawnMoleculeWithOptions — so it
is exempted with them.
Membership is per commit site, not per command (iteration 2). `bd mol burn` is
two classes on the direct route: wisps go through burnWisps -> transact, while
persistent molecules go through deleteBatch -> issueOpsContext ->
dolt/deleter.go, which returns before DOLT_COMMIT when the context defers.
Exempting the whole command minted one Dolt commit per persistent molecule
under batch/off — on a destructive verb, where the identical direct-route
command defers them all to `bd dolt commit`. runMolBurnProxiedServer now
applies the exemption to the wisp RunTxResult only, and the flag help,
configuration.md and the helper's own radius comment say so.
Minors:
- The flush passes '--author' like DoltStorage.CommitAll, so the one commit
batch mode keeps is attributed to the bd actor rather than the SQL session
user (without it dolt_log reads `root <root@localhost>`).
- runDoltCommitProxiedServer calls the shared runProxiedNonTx instead of
re-implementing its provider checks, so `bd --json dolt commit` keeps the
JSON error envelope; `dolt commit`'s RunE no longer re-wraps an
already-reported failure, and runProxiedNonTx's message gains the provider
%T the open-coded version had.
- The flag help and configuration.md drop two false claims: that the deferral
covers "every write" in proxied mode (the bd serve plane over the same
provider never touches rootCtx, so daemon writes still commit per write) and
that the SIGTERM/SIGHUP flush is "embedded-only" (flushBatchCommitOnShutdown
gates on an open store, which direct SQL-server mode has; only proxied mode
lacks one). Both surfaces now name the explicit-commit-point exemption.
- Both user-facing enumerations of that exemption are now derived from the
explicitCommitPointContext call sites rather than restated (iteration 2):
they had omitted mol wisp create, listed mol burn wholesale, and implied a
message-less `bd batch` defers when batch.go synthesizes a default message
and the dual exempts unconditionally, so every proxied batch commits.
- doltserver_tx.go's ephemeral-form comment names its second entry point —
RunTx/RunTxResult under a deferred context — where its
ONLY-dolt_ignored-state rationale stops applying.
Not done: regenerating docs/CLI_REFERENCE.md. Its --dolt-auto-commit drift is
base-preexisting, and the generated CLI docs are built from the release tag
pinned in docs/cli-docs.pin, not from this source, so touching them converts
the drift gate's inherited-drift warn-pass into a failure.
Tests. The uow blanking table gains the immediate-commit arm (tagless, so it
runs in every lane); the proxied integration test gains an explicit-batch-commit
step with a deferred plain create as its control, plus the flush attribution
assertions. Mutation-proved: reverting explicitCommitPointContext to a no-op
reds the new step (dolt_log 80 -> 80, no commit minted), and dropping
'--author' reds the attribution assertion with committer=root.
Iteration 2 adds the WIRING pin those left open — the mechanism was covered,
but deleting `ctx = explicitCommitPointContext(ctx)` from a dual was green in
every lane, which is why the mol burn over-application above was invisible.
dolt_autocommit_exemption_wiring_test.go is tagless and needs no server: a
uow.UnitOfWorkProvider that records the context RunTxResult hands NewUOW and
then refuses observes exactly the context each dual gives its transaction.
Mutation-proved per arm: neutering the exemption at batch/bond/squash reds
those three rows and only those; dropping it from the wisp RunTxResult reds
the wisp arm alone; and restoring the command-wide reassignment reds the
persistent arm alone, reproducing the defect this iteration fixes.
Validation: go build ./..., go vet (cgo and CGO_ENABLED=0), gofmt clean;
internal/storage/issueops; internal/storage/uow -run TestDoltServerTx; the
cmd/bd registry / history / policy / batch / mol / wisp / errors battery; and
the gated real-server lane BEADS_TEST_PROXIED_SERVER=1 green for both
TestProxiedServerBatchDefersThenDoltCommitAdvancesHeadOnce (41s) and
TestProxiedServerMolBurn (33s, all four subtests including the mixed
wisp+persistent burn this iteration changed).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(feat): red — Phase 0: conformance suite (history, expectedRevision R16.1, epochs R20) - gastownhall/beads#6133 (refs be-hs42e.1)
* feat: green — Phase 0 conformance suite (history, R16.1, R20 epochs) (refs be-hs42e.1)
Implements the 32 in-process RunXxx contract cases from be-hs42e.1 §4
(gastownhall/beads#6133): expectedRevision CAS + refusal (R16/R17, 10 cases),
the cross-record-invariant boundary (R16.1, 7 cases), and retention/epoch
semantics (R20, 15 cases). All hooks nil in every backend's fixture kit per
architecture §12 — ships disabled by default, zero behavior change.
Also fixes a role-tier coverage-gate false positive: role_bundle_test.go's
TestRoleContractCasesCoverEveryContractCase matched any Run*(t, ctx,
XxxFixture) function in the package with no scoping, incorrectly sweeping in
these new history-semantics functions. Scoped via roleTierFixtureNames()
(reflection over RoleContractBundle's field types) so only functions whose
Fixture type is an actual bundle field count as role-tier cases.
* feat: green — Review: Phase 0: conformance suite (history, expectedRevision R16.1, epochs R20) - gastownhall/beads#6133 (refs be-zv3ob)
Wire the 32 new R16/R16.1/R20 role-contract entrypoints (expected_revision,
cross_record_invariant, retention, epoch) into all three storage legs so
TestEveryLegWiresEveryRoleContract passes on dolt, embeddeddolt, and uow —
fixing the round-1 review's blocking finding (gastownhall/beads#6133).
Each new per-leg _test.go file follows the existing wiring convention (one
TestXxxContract per role, one t.Run per case, calling conformance.RunXxx)
with the same all-nil Phase 0 fixtures used everywhere else this phase, so
every case skips by name until Phase 3 gives it a non-nil hook.
Also corrects a stale comment in versioned_history_wiring_test.go that
argued against per-leg wiring files exactly like the ones this commit adds.
No other behavior change: wiring only, no new dependency, no scope beyond
the reviewer's named blocking issue.
* chore: release gate PASS for Phase 0 conformance suite (be-e0w8y)
Review: be-g8mp3 (PASS). Deploy bead: be-e0w8y.
Refs be-e0w8y, be-g8mp3, be-hs42e.1, be-zv3ob.
* feat: green — Review round 2: Phase 0 conformance suite (bounds assertion, RetentionAnswer fields) - gastownhall/beads#6147 (refs be-ekp0w)
Fix bee-ghosttrack's round-2 MERGE-AFTER-FIXES review on PR #6147
(comment 5504085482):
- RunAHoldPreventsRemovalAndReportsInRetainedBounds now asserts BOTH
refusal (ErrRetentionHeld) AND that the held Address shows up
positively in the reported RetainedWindow bounds, not merely inferred
from the absence of a Gone restriction (R20-h).
- RetentionAnswer gains Attribution *ChangeAttribution and Epoch *int.
RunForcingAHeldRemovalRecordsWhoWhenWhy now asserts real attribution
content (R20-h2) instead of accepting it only as a parameter.
RunEpochBumpVoidsOnlyAddressesOfVersionsNoLongerServed now asserts
Restriction=GoneReorganization AND the current epoch is named (R20-n).
Reviewer-sanctioned, taken in the same pass:
- RetentionFixture gains a Mint hook (analogous to
EpochFixture.MintUnderEpoch); every retention case that needs a real,
resolvable Address now mints one instead of relying on the retired
"fabricated address defaults to Live" convention. The one exception,
RunAStoreWithNoLineageKnowledgeAnswersUnknownNotGone, keeps the old
fabricated-address helper on purpose: Unknown specifically means an
Address no store ever minted.
- RunStoreInvariantTransactionScopesExactlyTheSpanningRecords adds a
post-refusal read-back via CountHistoryForSubject, pinning that a
refused cross-record batch is atomic (leaves no trace on either
record), as an inline nil-check rather than a t.Skip.
- Refusal's doc comment now states the fixture kit is the translation
boundary between whatever shape a real backend ships and the one
shape this suite asserts against — not a mandate banning a native
typed-error refusal shape at the backend level.
- Package doc comment in expected_revision_contract.go records four
reviewer-named deferrals verbatim (unretained/disclosure-gating as a
future authorization axis rather than a sixth Restriction state;
invariant-declaration discoverability; lease TTL self-expiry; R20-j
durability-across-restart) and notes the "_attribution" patch-key
convention as canonical for Phase 3 hook docs.
§4a's choice-vs-transcription table (this file's package doc comment)
already marks choices 2 and 3 DIED as of this round; no separate
callout-row table exists elsewhere in the repo.
No other behavior change: all touched Run* entrypoints still skip by
name under Phase 0's all-nil fixtures on every leg (confirmed via
TestVersionedHistoryPhase0RunsInFullSkipMode and
TestEveryLegWiresEveryRoleContract), no new dependency, no scope beyond
the reviewer's named findings.
* feat: green — Review round 3: Phase 0 conformance suite (nil-hook logging, retained-bounds assertion, stale comment) - gastownhall/beads#6147 (refs be-gw08e)
bee-ghosttrack round-2 review (2026-09-03T01:03Z, MERGE-AFTER-FIXES):
- cross_record_invariant_contract.go:158,178 — log which half of the
atomicity read-back goes unverified when CountHistoryForSubject is nil,
matching the file's existing skip-by-name convention (:327-328).
- retention_epoch_contract.go:511 — RunAHoldPreventsRemovalAndReportsInRetainedBounds
asserted both RetainedWindow bounds equal the held Address, on the
assumption nothing else was ever minted in this store. That assumption
doesn't hold: IssuePrefix is a static per-package string
(internal/storage/uow/retention_epoch_contract_test.go:17), not
randomized per run, so a persistent backend's second run would fail
this for the wrong reason. Weakened to at-least-one-bound.
- retention_epoch_contract.go:60-61 — fixed a stale "those two cases
still use" comment; retentionAddress's own doc comment already names
RunAStoreWithNoLineageKnowledgeAnswersUnknownNotGone as sole caller.
PR body's choice-vs-transcription callout table updated separately
(ten -> eight rows; the R20-h2 and R20-baseline rows described choices
this same review round already marked DIED in source).
* test(feat): red — Implement Phase 2 dual-write history behind flag - gastownhall/beads#6135 (refs be-0uifx)
* feat: green — Implement Phase 2 dual-write history behind flag - gastownhall/beads#6135 (refs be-0uifx)
* test(issueops): red — Phase 2 dual-write: re-seat builder/be-0uifx onto the merged base + add attribution_status (§16.4) — preempt the known review bounce (refs be-v33pa)
* fix(issueops): green — Phase 2 dual-write: re-seat builder/be-0uifx onto the merged base + add attribution_status (§16.4) — preempt the known review bounce (refs be-v33pa)
Migration 0068 step 6 only (VARCHAR(20) NOT NULL on issue_versions);
RecordVersionInTx derives it from the actor string it already receives
via attributionStatusForActor (non-empty -> supplied, empty ->
undetermined; not_supplied/imported are schema-valid but unreached by
any of the 7 current call sites). CLI-bundle direct-DDL override added
per dolthub/dolt#11345. Two pre-existing raw-SQL issue_versions
fixtures updated for the new NOT NULL column.
* chore(release-gates): add be-764ey deploy gate record (Phase 2 dual-write)
Factory release gate for be-764ey / gastownhall/beads#6135, PR #6358
(supersedes draft #6354). 7/7 PASS, no waivers — independent full-suite
run (97 packages ok, 0 FAIL, 0 SKIP), gofmt/vet clean, two pre-existing
non-blocking lint/policy findings attributed to be-2l6n8/be-xzg59.
* chore(ci): no-op commit to retrigger checks — code identical to 4179638; the macOS lane failed on runner disk I/O errors (see PR #6358 discussion)
* fix(history): attribution_status is claimed|unknown (BDP-aligned); document ordinals as local and the flag as single-writer-only
Per donnabox's review on #6358 items 1-3: align issue_versions.attribution_status to bdp#18's carried-attribution vocabulary (claimed | unknown), drop the unreachable not_supplied and the provenance-not-assertion imported; state that current_revision/revision are local ordinals and version_id is the only durable address; document VersionedHistoryConfigurer as single-writer-only until 0068 steps 1-3 land.
* fix(history): durable_state is LONGBLOB holding the RFC 8785 canonical form
Per donnabox's review on #6358 item 4: Dolt's JSON type renormalizes numbers, so a JSON column cannot keep the verbatim-bytes promise (R5.1) or back a content-derived token. Migration 0068 step 7 retypes issue_versions.durable_state to LONGBLOB (guarded PREPARE, CLI-bundle override extended), RecordVersionInTx stores the JCS canonical bytes of the marshalled issue so sha256(stored) is a stable token, and the all-migrations shape test pins longblob.
* build(nix): bump vendorHash for github.com/gowebpki/jcs v1.0.1
The JCS canonicalizer added on this branch changes go.sum, so the
fixed-output go-modules derivation hash moves.
Recomputed on the rebase onto main at 71c4cd08b. The merged module graph
is main's v1.3.0 dependency and toolchain bumps (#6047) plus this
branch's gowebpki/jcs v1.0.1, so neither side's pre-rebase hash applies:
main's was computed without jcs, and this branch's was computed against
the older dependency set. The value here was extracted from nix's own
hash-mismatch report and then verified by a clean nix build .#default.
* style(history): marshaled, not marshalled (misspell lint)
* fix(history): mint a version on every accepted issue-plane mutation, last in the transaction, on every leg
Per the write-path inventory on #6135 (donnabox's item 5 on #6358): the seam was reached from 3 of 57 journaled entry points. Close, reopen, claim, unclaim/release, lease reclaim, defer wake, label add/remove, promote and persistence moves now mint; update's label/parent patches and batch-create edges are applied before the mint so durable_state carries them; dependency add/remove mint at the lowest helper on all legs (uow and legacy verbs included) with the editor's duplicate call removed. version_completeness_test.go pins the set.
* docs(history): issue-plane write-path inventory with Phase 2 dispositions
The table donnabox asked for on #6358 (item 5), derived from the code rather than the design's count, with the dispositions that changed after a14f48b17 and the caveats that remain.
* docs(history): write-path doc: the seam has 27 call sites after a14f48b17, not "exactly six"
The sentence "is reached from exactly six call sites" described the tree at
321a79278 in the present tense, in a doc whose header already says those
rows changed after the completeness fix. It now scopes the six to that
commit and points at a new section listing the 27 sites (18 in issueops,
9 in domain/db) verified with grep over non-test files at d484b809d, with
the enclosing function for each. The "29 sites" figure quoted in the PR
thread was an over-count; 27 is the measured number.
The unchanged-re-import caveat now records that the journal seam sits in
the same position: RecordEventInTx(EventCreate) at create.go:207 runs on
every accepted upsert (only the events-table write behind the isNew gate
at create.go:171 is skipped), so a field-level no-op gate belongs in front
of both seams, not the version seam alone.
Doc only; no Go change.
* fix(history): seed store_epoch once per store, state the fail-closed canonicalization policy, and say single writer means one at a time
From bee-ghosttrack's round-1 review of #6358.
- store_epoch (nit): RecordVersionInTx ran INSERT IGNORE INTO store_epoch
on every mint, putting one shared row (id = 1) into every write
transaction's footprint. It now reads first and seeds only when the row
is absent, so the seed happens once per store. Same result, one fewer
write per versioned mutation.
- canonicalDurableState (MINOR-4): the comment now states the two
properties a hand-rolled canonicalizer would get wrong -- jcs.Transform
normalizes away encoding/json's HTML escaping, so the token is a function
of content, not of Go's escaping policy; and a snapshot that cannot be
canonicalized deliberately fails the mutation. Duplicate keys in an
issue's metadata (a json.RawMessage, reachable via bd sql or a hand-
written JSONL import) make the seam return an error with the flag on.
Fail-closed is the policy for now; normalizing first, or finding such rows
with bd doctor, is gastownhall/beads#6379 item 3.
- Single writer (MINOR-5): the constraint in version_history.go,
storage.go and the 0068 header now says one writer AT A TIME per store,
not merely one clone -- MAX(revision)+1 is not a safe allocator for two
concurrent transactions in one store either, and no contract case runs
concurrent writers. gastownhall/beads#6379 item 4.
- RecordVersionInTx doc (nit): IsWisp is Ephemeral || NoHistory, so a
promoted no-history bead is also never versioned; stated as what
no-history means rather than as an FR-8 wisp rule.
No behaviour change beyond the one fewer INSERT. Gates: gofmt, go build,
go vet, golangci-lint v2.10.1 (0 issues), issueops, the five embedded-Dolt
version suites, scripts/check-migration-hygiene.sh.
* docs(history): restate the write-path doc at this head; keep the 321a79278 inventory under a dated heading
bee-ghosttrack's MINOR-2 on #6358: the table and notes were written in
the present tense against 321a79278, so as merged the doc said close was
OUT OF CONTRACT and that no completeness test existed, beside the code
that ships both.
The doc now has two parts. "Dispositions at this head" carries a table of
every row whose disposition changed after a14f48b17 (rows 13-23, 25, 27,
34) with the mechanism and line for each, the counts at this head (21
VERSIONED, 13 OUT OF CONTRACT, 5 no-op gates), the deferred items, the
seam call sites, and notes that are true now. "As found at 321a79278" keeps
the original table and notes verbatim as the record of what the review
found, with a sentence saying which rows it no longer describes.
Also: row 13 now says wisp or promoted no-history bead (nit); the flag-off
sentence says behaviourally a no-op at the seam but not literally zero
added work (nit); the flag-on prerequisites point at gastownhall/beads#6379.
* test(history): a call passing mintVersion=false is not a minting edge (reviewer MINOR-1)
The versioned-history guard's fixpoint treated "textually calls
RecordVersionInTx, directly or transitively" as the mint predicate, so a
call to a helper with mintVersion=false still counted as a minting edge.
Reviewer Probe 2 on #6358 showed the consequence: deleting ExecuteUpdate's
own final `if changedAny { RecordVersionInTx(...) }` block left the whole
issueops package green, because the fixpoint credited ExecuteUpdate with
the mints of the very constituents it had told not to mint.
journalscan now records each function's parameter names and each call's
reduced argument list (bare identifier or literal per argument), and
exposes CallsOnlyWithLiteralFalse(fns, f, callee, gate): true only when
every call f makes to callee passes the predeclared false for callee's
parameter named gate. A call passing true, a variable, the caller's own
parameter, or too few arguments keeps its edge, as does a callee without
the parameter. Existing callers (IdentCalls, SelCalls, Fixpoint) are
unchanged; the resolve closure is merely lifted to a package function.
versionMintEdges drops the switched-off edges, and a new
TestCompositeMutationsCarryTheirOwnMint pins that ExecuteUpdate,
applyLabelPatch and applyParentPatch each call the seam themselves and
that none of their remaining edges reaches it.
Verified: full issueops package green on the unmodified tree. Probe 2
(delete ExecuteUpdate's final mint block) now fails
TestCompositeMutationsCarryTheirOwnMint, TestEveryVersionedEntryPointMints
and TestEveryBeadMutatorMintsOrIsExempt, all naming ExecuteUpdate; the
same probe against the previous guard stays green. Probe 1 (delete the
close mint) still fails TestEveryVersionedEntryPointMints and
TestEveryBeadMutatorMintsOrIsExempt naming CloseIssueInTx,
CloseIssueWithoutEventInTx, CloseIssueCheckedInTx and ExecuteClose. The
exemption tables are untouched.
* test(history): pin the uow leg's 1+N+M create divergence as a red-when-fixed test (reviewer MINOR-3)
TestDualWriteContract's Mutate closure creates an issue with no labels and
no dependencies, so its "exactly one version row per accepted mutation"
case cannot see what a fuller create does on the uow leg:
domain.IssueUseCase.CreateIssue inserts the row and then persists each
label and each edge through its own repository (domain/db label.go,
dependency.go), and every one of those writes reaches
issueops.RecordVersionInTx on its own. The direct legs mint exactly one
row for the same shape (CreateIssuesInTxWithContext mints once per issue
after the creation-time edges land).
TestUOWCreateWithLabelAndEdgeMintsPerRepositoryWrite_KnownDivergence
creates an issue through the uow leg with exactly one label and one
blocks edge and asserts the MEASURED count of issue_versions rows:
3 (1 issue + 1 label + 1 edge), matching the 1+N+M prediction. It also
checks the label and edge actually landed, and that the bare-shape target
seeded through the same leg holds exactly 1 row, so the two extra rows
are attributable to the label and the edge. A t.Log line and the doc
comment name the follow-up as gastownhall/beads#<FOLLOWUP-ISSUE> (to be
substituted before push) and state that the test is expected to FLIP to
1 when it lands.
The provider boot + flag enablement is lifted out of
newUOWDualWriteFixture into newUOWVersionedHistoryProvider so the new
test shares it; the existing contract cases and the fixture closures are
unchanged. Runs on the same backend and skips as its neighbours (a real
dolt sql-server, gated by testutil.RequireDoltBinary; no extra env
needed).
Verified: go test -count=1 -run 'TestDualWrite|TestUOWCreateWithLabelAndEdge' ./internal/storage/uow/ passes.
* test(history): pin canonicalDurableState to the RFC 8785 vectors, key order, HTML escapes and duplicate keys
TestCanonicalDurableStateIsJCS covered only number forms. It is now
table-driven over:
- the ten RFC 8785 test vectors that ship with github.com/gowebpki/jcs
v1.0.1 (Apache-2.0), copied verbatim to
internal/storage/issueops/testdata/jcs/{input,expected} with a README.md
recording their provenance (upstream's "output" directory is named
"expected" here because the repository's .gitignore drops any output/
tree); the count is pinned so an emptied directory cannot pass as a
vacuous table;
- a unicode/astral key-ordering case: {"b":1,"a":2,"é":3,"A":4,"😀":5}
canonicalizes to {"A":4,"a":2,"b":1,"é":3,"😀":5} (UTF-16 code-unit
order, so the astral key sorts after "é");
- an HTML-escape case: a string value <a>&"'</a> comes out as
"<a>&\"'</a>" with no <-style escaping, plus a companion subtest
proving plain json.Marshal DOES emit </& so the normalization
is demonstrably jcs.Transform's work;
- a fixed-point check, canonical(canonical(x)) == canonical(x), for every
table case;
- a duplicate-key input {"k":1,"k":2}, which must fail with an error
containing "Duplicate key" rather than store whichever value wins.
The existing number-form assertions are kept as they were.
Verified: go test -count=1 -run 'CanonicalDurableState' ./internal/storage/issueops/ passes (16 subtests).
* ci: no-op retrigger after a known flake in internal/metrics
Run 34173415291 on 0645e7827 failed only TestStartDetachedReapsExitedChild
("child pid became a zombie; startDetached did not reap"), the residual
child-process reap race tracked as beads be-w5rdt; #5933's fix is already
on this branch. Nothing in this PR touches internal/metrics. Empty commit
to re-run CI, since the PR author cannot re-run jobs in this repository.
* ci: no-op retrigger after a package-level timeout in the differential regression lane
Run 34174581104 on d81157b7d: 124 of 125 checks green; "Differential
Regression (v0.49.6 baseline)" panicked with "test timed out after 20m0s"
in the middle of TestRapidLabelAddRemoveStability, after the earlier
scenarios in the same package ran at several times their d484b809d
durations (TestListAllOverridesLimitWithLabel 87.9s; the whole lane took
11m0s on d484b809d). The regression suite never enables versioned history,
so nothing in this PR is on its path. Empty commit to re-run CI.
* docs(history): drop the stale head sha from the current-part heading; cite the seam by function, not line (bee round 2)
* test(history): make the mintVersion=false guard's claims exact (shadowed false, ambiguous names, method constituents)
Three reviewer nits on the versioned-history completeness guard
(gastownhall/beads#6358), each closing a gap between what the guard
claimed and what it checked. Detection is only ever strengthened.
Shadowed false. CallsOnlyWithLiteralFalse matched the NAME false, and
Go lets a local, a parameter or a package-level declaration take that
name, so a shadow read as a switch-off. journalscan now reads a false
or true as the predeclared identifier only when the parser's per-file
resolution (ParsePackage's mode 0, now pinned) attaches no declaration
to it AND no file of the package declares the name at package level
(per-file resolution cannot see the cross-file case; ParsePackage folds
each file's package scope in). Any shadow reduces to "", an unknown
expression, so the edge stays live. TestFalseIsNotShadowedInIssueops
independently walks every declaration position in issueops (test files
included) and fails on any true/false, so the reading is exact there,
not merely conservative.
Ambiguous names. Resolution is name-based, so a literal-false call to a
name shared by a gated function and an ungated one dropped the
fixpoint's edge to both. Resolve's semantics are unchanged;
TestLiteralFalseCalleesResolveUnambiguously requires every callee of a
mintVersion=false call to resolve to one function or to only functions
that declare the gate, naming the ambiguous name otherwise.
Method constituents. TestCompositeMutationsCarryTheirOwnMint looked up
mints[callee] by bare name while the fixpoint keys methods Recv.Name,
so that half only bit for free functions. The check now resolves each
live edge through the scanner's own Resolve (exported for this, with a
stable order); TestCompositeCheckSeesMethodConstituents proves it on a
synthetic package whose constituent is a method.
Reviewer probes re-run: deleting the close mint, deleting
ExecuteUpdate's final mint block, and flipping its
moveIssuePersistenceInTx call to mintVersion=true each still fail the
guard.
* chore: remove leaked internal release-gate docs from PR branch
release-gates/be-764ey-gate.md
release-gates/be-e0w8y-phase0-conformance-suite-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
* test(feat): red — Widen issue_versions.change_at to DATETIME(6) before any store accumulates real history (refs be-hs42e.8)
* feat: green — Widen issue_versions.change_at to DATETIME(6) before any store accumulates real history (refs be-hs42e.8)
* test(schema): fix TestMigration0067...ThroughDoltCLI for the 0068 DATETIME(6) widen (reviewer MAJOR, round 1)
Mayor-specified remediation (b): assert the column type the full
migration chain now produces, not the schema as of 0067 alone.
TestMigration0067AddsVersionedBeadsSchemaThroughDoltCLI already runs
AllMigrationsSQL() (the whole bundle through 0068) and already tracks
two other 0068-introduced shape changes on this same table
(durable_state -> LONGBLOB, attribution_status NOT NULL) rather than
pinning the pre-0068 shape, so change_at/removed_at follow the same
existing pattern: datetime -> datetime(6).
Asserting AS-OF-0067 instead would mean forking the test to stop the
bundle at slot 0067, which would also have to unwind those two other
already-adapted assertions -- contradicting the test's own documented
intent to check the current cumulative shape.
refs be-hs42e.8 / be-ebl4t (review round 1)
* fix(history): scope, stage and forward dual-write versioned history (review rounds 1-2)
Maintainer fixup for the three majors in the #6675 review. All three are
incompleteness in the activation half of this PR's own contract: the seam
mints correctly, but the store half never turns minting on everywhere, never
publishes what it minted, and cannot be turned on at all through the shipped
provider chain. The flag is off in every build, so none of this regresses
today -- which is why it is cheap to fix here instead of being inherited by
the phase that flips it.
1. Scope versioned history where the journal already is.
RecordVersionInTx no-ops unless ScopeVersionedHistoryTransaction bound the
transaction. Two issues-plane sites were unscoped: runDoltTransaction --
the whole doltTransaction mutator surface, reached from bd create, batch
create/import, bd graph apply, merge_slot and the CLI transact wrappers --
and the non-wisp arm of DoltStore.RemoveDependencyWithOptions. Unscoped
means the mutation commits and no version row exists, so the next scoped
mutation mints revision 1 and the history claims the update is the
creation.
version_scope_completeness_test.go is the structural twin of the journal's
guard, in two arms because one cannot see both shapes: the raw-tx scan
(mutator set computed from issueops source, 8 wisp-plane exemptions with
reasons) plus a wrapper arm for the callback-taking transaction runners the
direct scan cannot reach. Deleting runDoltTransaction's scope fails only
the second arm -- measured -- which is why both exist.
2. Stage what a mint writes. issue_versions and store_epoch replicate: they
are deliberately not dolt_ignore'd, and the single-writer constraint this
feature documents is a statement about merging them between clones, which
only means anything for a table that replicates. So every mint has to reach
its operation's DOLT_COMMIT, or the rows sit dirty in the working set --
unreplicated, and swept into whatever unrelated commit stages next.
issueops.VersionedHistoryStagedTables is the one list; the fixed-list
DOLT_ADD paths and both DirtyTableTracker paths consult it, keyed off
activation so no call site has to remember. The decision is recorded in
0068's header, since 0067 is frozen and said nothing.
The uow/serve and embedded -Am paths already stage the whole working set
and are untouched. bd-2y9ke is not widened: every addition is gated on
activation, so no flag-off commit changes shape.
3. Forward the configurer through externaldeps.uowProvider, the outermost
provider on both real chains. Activation type-asserts the outermost value,
so without this the assertion fails exactly where it matters and the inner
forwarder is unreachable -- silently, because the compiler cannot see a
missing optional-interface method. The assertion block now lists the
interface and a table-driven test covers both configurers through the
wrapper.
The new contract case drives a flag-on mutation through RunInTransaction (not
the already-scoped withWriteTx arm) and asserts dolt_status is clean for
issue_versions afterwards, so it is red against 1 and 2 independently.
Also: correct the stale "three guarded PREPARE blocks" count in the 0068
CLI-bundle override comment (four blocks, three steps -- step 8 has one per
column), and record the deferred per-mint round-trip cost against #6379.
Round 2 (comment-only; both findings are against this commit, both non-gating
-- the iteration-2 synthesis and scorecard are approve with no required
changes):
- doltAddAndCommitInTx's NEXUS#92 HAZARD header enumerated the in-tx planes
the lost-update still reaches but predates the staged-set widening this
commit added at that same site. issues was already exposed there and
self-heals -- the next mutation of the bead rewrites the reverted row --
while issue_versions and store_epoch are append-only, so a row reverted to
its BEGIN-time value is simply gone. Named in the header so the activation
phase inherits a written hazard instead of discovering it.
- MarkVersionedHistoryDirty's "cannot disagree" claim is absolute where the
code is not: scope time and stage time are two Load()s of the same atomic,
not one value threaded through, so the invariant holds only while activation
does not flip mid-operation. Unreachable in production (no non-test setter
caller; activation is wiring-time), so the comment states the dependency and
names the latch-the-flag remedy for whenever that stops being true.
* fix(schema): move the change_at/removed_at DATETIME(6) widen out of frozen 0068 into new migration 0069
0068 landed on main (#6650) with steps 6 and 7 only, so check C of
scripts/check-migration-hygiene.sh now treats it as frozen: clones built
from main have applied it and recorded its content hash. This branch still
appended step 8 (the change_at/removed_at DATETIME(6) widen) to both 0068
files, which forked the fresh-bundle 0068 hash from the applied one and
turned `Check migration hygiene` (and so `CI Gate / Required`) red.
Per the review:
- restore 0068_add_attribution_status.{up,down}.sql byte-identical to main;
- add 0069_widen_issue_versions_datetime_precision.{up,down}.sql carrying
the DATETIME_PRECISION-guarded PREPARE blocks as written, plus the step-8
reverse; the DOLT PLANE paragraph moves into 0069's header;
- split cliMigration0068AddAttributionStatus back to main's two-ALTER form
and add cliMigration0069WidenIssueVersionsDatetimePrecision with its own
case in cliCompatibleMigrationSQL;
- retarget the datetime-precision tests at 0069
(migration_0068_datetime_precision_test.go ->
migration_0069_datetime_precision_test.go), which also drops the stale
"0069 and 0070 are already spoken for" pointer from round 1.
Two follow-throughs the move needs beyond that list:
- TestLatestVersionIncludesMigration0068 hardcodes 68, so it is superseded
by TestLatestVersionIncludesMigration0069, the same way #6650 retired the
0067 pin when 0068 arrived;
- TestAllMigrationsSQLUsesDirectDDLForKnownCLIIncompatibilities gains 0069's
direct-DDL and guard-variable anchors, as 0066-0068 each have.
The 0069 header no longer rests on "this migration and the table's first
writer ship in the same build" (the writer is already on main, behind the
versioned-history flag). Widening is lossless whatever the table holds,
which is the claim it makes instead. The down file records that narrowing
rounds sub-second values half-up (measured on dolt 2.3.3: .750000 reads
back as the next second).
refs be-mu248 / be-hs42e.8 (gastownhall/beads#6675 review 5328477668)
* test(schema): pin 0069 on the raw-SQL path existing stores take
Round 1 of the review noted that the widen was pinned as bytes only on the
path existing stores take: every live test in internal/storage/schema goes
through the CLI-bundle override, so deleting the guarded blocks from the
.up.sql turned only the byte pin red. With the widen now in its own
migration, that path matters more than before. A store that applied main's
0068 is at precision 0, and 0069's DATETIME_PRECISION-guarded PREPARE blocks
are the only thing that moves it to DATETIME(6).
TestMigration0069WidensPrecisionZeroStoreAsRawSQL (integration tag, beside
the 0067 replay test) turns the reviewer's manual probe into a test, run
through the same runMigrationSQL executor as the pr4107 replay harness:
- the raw down narrows both columns to datetime;
- the raw up re-widens both to datetime(6), and a whole-second row written
at precision 0 reads back unchanged, which is the up header's
"widening is lossless" claim;
- a second raw up is a clean no-op;
- a .750000 insert then reads back intact.
Mutants, each red: removing the change_at guarded block from the up file
fails this test (and TestCLIBundleMatchesRuntimeCommittedSchema), and
making the down's guards never fire fails it at the post-down check.
refs be-mu248 / be-hs42e.8 (gastownhall/beads#6675, review round 1 note 1)
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(list): never recurse forever on a cyclic tree in bd list --tree
printPrettyTree walked childrenMap with no notion of the path it was on, so a
cycle in the map made bd list allocate until the host swapped (GH#5887).
Track the ancestors on the current root-to-node path; a child already on the
path is printed once with a muted "(cycle: shown above; run bd dep cycles)"
marker and not descended. A node under two different parents still renders
under both. Output on acyclic input is unchanged.
Tests cover the exact rendered shape of a cycle, a diamond that must not be
reported as one, and a rooted parent-child cycle through the public
buildIssueTreeWithDeps path. They use a bounded, deadline-based stdout capture
so a regression fails in seconds and leaves os.Stdout restored.
Fixes#5887
* fix(list): state the capture helper's limits; keep the cycle marker next to its use
* test(list): give captureBoundedStdout its own doc comment
* fix(list): stop the tree cycle marker promising a detector that ignores it
The new marker read "(cycle: shown above; run bd dep cycles)" and its doc
comment said it "names the command that reports the cycle itself". It does
not. childrenMap is built from parent-child edges alone (list_tree.go:54),
so every cycle this marker can fire on is a parent-child cycle, and that is
exactly the class `bd dep cycles` is pinned to skip: it routes through
DetectCycleReportInTx/DetectCyclesInTx into AppendBlockingGraphInTx, whose
type filter admits blocks and conditional-blocks only and which DetectCycles
uses deliberately (issueops/cycles.go:88-93,111). The repo pins the exclusion
with a test that builds the same A <-> B parent-child cycle and asserts the
detector returns empty (ready_helpers_test.go:503-520). bd doctor applies the
same filter (doctor/integrity.go:352), so no command reports this class.
Following the pointer therefore yields an affirmative "No dependency cycles
detected" for the very store that just rendered the marker.
The marker now names the edge class instead of a command, and the comment
records what the marker means -- an ancestor of this line, not dep tree's
whole-walk "already displayed" -- so the two renderers' diverging
conventions are written down where the new one is defined.
Also covers the --deps arm. All three tests on the branch run with dr == nil,
so the documented "a marked line carries no annotations" contract held only
by construction: moving the onPath check below dr.annotationsFor would have
reddened nothing. The new case renders a rooted cycle whose ancestor carries
a non-hierarchy edge (parent-child never annotates, so without one the
assertion would be vacuous) and asserts one marker, no annotation row beneath
it, and exactly one annotation row overall. Mutation-proved: calling
dr.annotationsFor inside the marker arm reds only the new test; the other
three stay green.
No behaviour change beyond the marker string. gofmt, go vet ./cmd/bd and
go build ./cmd/... clean; the cycle tests plus base's
TestListDisplayPrettyListHonorsSort and the list/tree suite pass.
The PR body's quote of the old marker was corrected in place with an
attributed maintainer note; the contributor's commit messages are untouched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(storage): cascade wisp deletes into wisp_dependencies
DeleteWispFromDependenciesInTx and DeleteWispsFromDependenciesInTx only
cleaned the dependencies table, never wisp_dependencies — even though
DeleteCascadeTables(isWisp=true) declares wisp_dependencies as part of
the wisp deletion set. On stores whose wisp_dependencies table lacks the
migration-0047 FK constraints (like a live production store observed
with only the ck_wisp_dep_one_target CHECK), every wisp deletion
orphaned that wisp's wisp_dependencies rows on both sides, and reaper
scans flagged the leftovers as dangling_parent_ref anomalies that
recurred after each cleanup (~100+ rows/hour under a busy daemon).
Remove the deleted wisp's wisp_dependencies edges as child (issue_id)
and as parent (depends_on_wisp_id) in both the single and batch delete
paths. Two targeted DELETEs per direction rather than one OR query, so
each hits its own index — the ff-tqm pattern; a single OR across both
columns previously caused Dolt i/o timeouts.
Adds TestWispDeleteCascade_CleansUpWispDependencies to the standalone-
server integration harness (the existing wisp_gc_test.go coverage
requires a Docker testcontainer and silently skips without one). The
test drops the fresh-bootstrap FKs first so it exercises the delete
path's own cascade, matching the production schema; it fails without
this fix and covers the single-delete path the Docker tests omit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fixup(review): pin over-deletion and correct two cascade comments
Maintainer review fixes for PR #6563. No production behavior change.
The new subtests asserted only that the deleted wisp's wisp_dependencies
rows were gone, so an unguarded "DELETE FROM wisp_dependencies" with no
WHERE passed both of them — verified by mutating both helpers and
watching the test stay green. Each subtest now also creates an edge
between two wisps it never deletes (a bystander pair for the single
delete, an out-of-batch pair for the IN (...) form) and asserts that
edge survives. Under the same mutation the test now fails three times
with expected-vs-got. This also replaces the comment that claimed the
surviving wisps' edge set was checked, which it was not: every edge the
subtest created involved the deleted wisp.
dropWispDependencyFKs attributed the FK constraints to migration 0047.
They come from 0021, which creates all three inline in CREATE TABLE;
0058 re-adds two when healing a legacy split store, and 0047's ADD
CONSTRAINT statements are gated on that same legacy path, so neither
runs on the fresh bootstrap this harness uses.
wispAuxCascadeTables exists so the cascade set cannot drift between the
two delete paths, so note there why wisp_dependencies is handled in
issueops instead: its rows are journaled as dependency removals.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(prime): honor -C for the local PRIME.md tier, git probes, divergence reminder, and redirect notice (#5509)
`bd -C <dir> prime` silently primed the process cwd. -C is implemented as
setenv BEADS_DIR (no chdir), so the store and memories already followed the
target, but four workspace-relative reads in prime did not: the
first-priority .beads/PRIME.md lookup, the AGENTS.md/CLAUDE.md divergence
reminder, the git probes (upstream, remotes) behind the default template's
git-authority wording, and the template's redirect notice all resolved
against the cwd. On the no-PRIME.md path the output for `bd -C repo-b prime`
was byte-identical to priming the cwd repo.
Add primeWorkspaceDir(), which returns the absolute -C target when set and ""
(cwd) otherwise, and resolve all four against it: readCustomPrimeContent
takes the workspace dir as a parameter, the reminder takes the same
workspace, a new primeGitCmd helper runs isEphemeralBranch and
primeHasGitRemote in the -C target (falling back to GitCmdCWD without -C,
as before), and primeRedirectInfo asks internal/beads about the -C target
through a new GetRedirectInfoFrom(dir). GetRedirectInfo() delegates to the
same core for the cwd, so redirect detection without -C is unchanged. The
clone-local PRIME.md tier is rebased onto the -C target rather than dropped,
so a redirect clone with its own .beads/PRIME.md yields the clone-local file
under -C exactly as `cd <dir> && bd prime` does. The workspace is
deliberately the -C directory itself, not the parent of the resolved beads
dir, which may have followed .beads/redirect or walked up from a
subdirectory.
Env-only BEADS_DIR redirects are unchanged: without -C the cwd-local
PRIME.md still wins (clone-specific customization, GH#876), guarded by
TestReadCustomPrimeContent_EnvRedirectStillLocalFirst.
Tests: unit coverage for primeWorkspaceDir (absolute, relative, unset),
the -C target and redirect-clone PRIME.md tiers, the env-only redirect, the
divergence-reminder workspace (redirect and subdirectory cases), and
GetRedirectInfoFrom against GetRedirectInfo in both directions plus the
non-git walk-up, plus three end-to-end runs (cgo build tag, shared
once-per-process bd binary): the issue's two-repo PRIME.md repro, a
no-PRIME.md pair where `bd -C repo-b prime` from repo-a must equal
`cd repo-b && bd prime` byte for byte while differing from the cwd's own
prime (repo-a has a remote and upstream, repo-b has neither and carries
divergent AGENTS.md/CLAUDE.md), and a plain-repo/redirect-clone pair where
the redirect notice must follow -C in both directions.
Fixes#5509
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(prime): canonicalize the -C repo root and document the shared probes
Maintainer review fixes for #6550 (adopt-pr review iteration 1). Nothing here
was a merge gate: the scorecard approved at 962/1000 with no required changes.
No behavior change on Linux/macOS.
- internal/beads: canonicalize the repo root inside repoLocalBeadsDir, the
helper both locators share. findLocalBdsDirInRepoFrom handed it raw
`git rev-parse --show-toplevel` output while the cwd twin passes
git.GetRepoRoot()'s already-normalized value, so on Windows (`C:/...`, msys
`/c/...`) the repo-local tier missed and resolution fell through to the
walk-up locator - the fallback bd-wayc3 exists to beat. Canonicalizing stays
below the "" guard on purpose: utils.CanonicalizePath("") resolves to the
process cwd. TestRepoLocalBeadsDirCanonicalizesRepoRoot pins both halves and
reds on either mutation (drop the canonicalization; move it above the guard).
- internal/beads: document that GetRedirectInfoFrom's fallback drops the
worktree-local redirect probe and GetWorktreeFallbackBeadsDir, not only
BEADS_DIR.
- cmd/bd/prime.go: NOTE that primeHasGitRemote and primeGitCmd have a consumer
outside prime (isBackupAutoEnabled), which inherits the -C directory choice.
- CHANGELOG: add the Unreleased/Fixed entry for #5509 and disclose that
`bd -C dir <any command>` now decides auto-backup enablement from the -C
target's git remote rather than the launch directory's.
- cmd/bd/prime_embedded_test.go: record why the three -C repros carry the
TestEmbedded prefix (fast lanes -skip it, embedded-test-shard.sh discovers
shard members by it) and that they need no embedded Dolt.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Julian Knutsen <julian@knutsen.dev>
* fix(dolt): recheck dependents' blocked state after a close commits (be-cmn)
A close recomputes its dependents' is_blocked inside its own transaction,
against that transaction's start snapshot. Two concurrent closes of sibling
blockers each see the other blocker still open, so neither writes the shared
dependent's row; both commit without a conflicting cell, and the dependent
stays is_blocked=1 and hidden from `bd ready` until `bd recompute-blocked`.
The in-transaction close and status-change paths now record the dependents
they recomputed (never the closed issue itself) in a transaction-scoped note,
the same shape as the events-journal scope. The store's write-transaction
runners take that note once the transaction has committed and, only when it
is non-empty, run one more short retried transaction that recomputes exactly
those ids on a fresh snapshot. The recheck runs after the retry loop around
the write, so a recheck failure is reported as "write committed;
blocked-state recheck failed" and never replays a write that already landed.
When the recheck changes an issues row it mints a Dolt commit naming the
closed issue, so the corrected flag reaches history like the close's own
rows instead of sitting dirty in the working set. A close with no dependents
records nothing and issues no extra SQL.
This covers every DoltStore write path, including the lifecycle and batch
closers the CLI uses, and the embedded store's withConn. The RunInTransaction
path (doltTransaction.CloseIssue) keeps its pinned-connection commit and is
not scoped; nothing on the CLI's close or update path reaches a close
through it.
Fixes#6716
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dolt): recheck blocked state after dependency removals and deletes too (be-cmn)
Only a close and an update to an inactive status recorded a post-commit
blocked recheck. A dependency removal and the three delete paths run the
same in-transaction recompute, can likewise only unblock a dependent, and
so reproduce gastownhall/beads#6716 when they commit last: a `bd close A`
overlapping a `bd dep remove C B` (or a delete of B) leaves C blocked on
every committed snapshot with no recheck to settle it.
Generalize the recording so each unblocking write records the dependents
it recomputed: noteBlockedRecheck now takes a human label for the recheck
commit message and an explicit exclusion set. A close or status update
excludes its own row (a concurrent writer conflicts on it rather than
racing past it); a delete excludes the rows that no longer exist; a
dependency removal excludes nothing, because its dependent is exactly the
row that needs rechecking. Labels stay bounded: a bulk delete of more
than three ids is named by count. The close path's commit message,
"bd: recheck blocked after close of <id>", is unchanged, and a close
through update mints the same message as a close through CloseIssue.
The server tier gains the close-versus-dependency-removal race and a
check that a delete records the deleted row's dependents; the embedded
tier pins the recording contract for a close, a removal and a delete on a
real engine; the issueops unit test pins deduplication, exclusion and the
labels.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dolt): name a committed write's recheck failure with a sentinel (be-cmn)
A recheck failure reaches the caller as an error from the same store call
that just committed its write, indistinguishable from a write that never
landed. Add issueops.ErrBlockedRecheckFailed and wrap both stores' recheck
failures with it, keeping the underlying cause reachable through a second
%w, so a caller can errors.Is a committed-but-unrechecked write apart from
an uncommitted one. The stale flag it leaves is the one bd doctor and
bd recompute-blocked already repair. The CLI's exit-code treatment is a
separate follow-up; this is the storage layer only.
Correct the embedded store's comment, which claimed two withConn callers
in one process overlap as two server sessions do. They do not: commitConn
opens a fresh OpenSQL handle per transaction and OpenSQL waits, with no
elapsed-time limit, for the engine, so a second handle blocks until the
first is cleaned up. Embedded transactions serialize and the skew of
gastownhall/beads#6716 cannot occur there; the recheck stays so the
embedded store honors the same contract as the server store and runs
after the first handle's cleanup, so it cannot deadlock on itself.
Document that the recheck scope is keyed by the DBTX interface value: a
write records into it only when the very *sql.Tx the store scoped reaches
it, and a future DBTX wrapper would silently record nothing, the same
shape as the events-journal scope.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(issueops): state the blocked recheck's scope precisely (be-cmn)
The recorded writes are the ones that take a blocker away, not writes
that "can only unblock": removing the one closed child of an
any-children gate blocks its waiter, and the recheck, being a full
recompute, settles that too. Name the writes that add a blocker (reopen,
dependency add, parent-child add) as recomputing the same way without a
recheck, so the remaining gap is written down where the mechanism is.
The exclude list filters one call's ids only; say so, and that a stale
pending id for a row a later write deleted is a harmless no-op.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dolt): keep a failed blocked recheck out of the caller, and scope the coverage claim
Maintainer fixup for the adoption review of #6719 (fixesgastownhall/beads#6716).
Three review majors, plus the cheap non-gating cleanups that sit next to them.
The contributor's commits are left exactly as authored.
1. A post-commit recheck failure no longer reaches the caller of a committed
write. ErrBlockedRecheckFailed had no consumer, so every store-facing
caller — CLI, HTTP, the batch closers — still read it as "the write did
not land" and would retry an applied mutation: the double-apply inversion
internal/storage/dolt/issue_operations_tx.go documents. The stores now
wrap the failure with the sentinel and log it. What it leaves behind is
the stale is_blocked flag `bd doctor` and `bd recompute-blocked` already
repair, i.e. the state every write had before the recheck existed. This
also removes #6723 as a prerequisite for shipping.
2. The recheck runs on issueops.BlockedRecheckContext: detached from the
caller's cancellation — the write it repairs has already committed, so a
CLI deadline, a disconnected HTTP client or shutdown must not skip the
repair and leave exactly the stale flag #6716 is about — with its own
ceiling, and marked so a recheck cannot start another. Termination
previously rested only on RecomputeIsBlockedInTxWithResult never
recording, an invariant nothing enforced.
3. The coverage claim is scoped where it was false. Recording only becomes a
recheck on a transaction one of the two store write runners scoped, and
`bd batch` reaches neither: it dispatches close, `update status=closed`
and `dep remove` onto storage.Transaction when local (cmd/bd/batch.go:177)
and onto uow.RunTxResult when proxied (cmd/bd/batch_proxied_server.go:41).
5531d0592's message ("This covers every DoltStore write path … nothing on
the CLI's close or update path reaches a close through it") and the PR
description said otherwise. The CHANGELOG, blocked_recheck.go's doc
comment and the PR description now scope the claim and name the uncovered
routes: uow/domain-db, RunInTransaction (`bd batch`, `bd cook`,
`bd mol squash`, `bd mol burn`), the legacy RemoveDependencyWithOptions
(`bd duplicates --merge`), and the wisp writers.
Also non-gating: the recheck's Dolt commit message is bounded (it names up to
three writes and counts the rest), and a write that contributed no id is no
longer named in it. New tests pin the recheck context, the bounded message,
and the store seam the wrapper's unit test could not reach: a close whose
recheck transaction fails still returns nil and stays durable, and the failure
the withConn/commitConn path produces carries ErrBlockedRecheckFailed.
Second review iteration: the scorecard required no changes, and all four
findings were non-gating (one minor, three nits). Each indicted text this
fixup itself introduced rather than the contributor's, so they are fixed here
instead of deferred.
4. A dropped recheck is now counted, not only logged. Swallowing the failure
in 1 made that log line the only signal a dependent is stale, while the
convention it was modelled on — post_tx_commit_dropped, for the same
"post-tx step failed, the write is durable" situation — is a counter *and*
a line. bd.db.blocked_recheck_dropped is registered beside it and bumped
on the Dolt side, and both stores' warnings now name the rows left
unrechecked and point at `bd recompute-blocked`; an operator reading one
line previously could not tell which issues needed it. The sentence is
shared from issueops next to the sentinel, which also retires the
near-duplicate doc comment the two stores carried.
5. The bounded commit message keeps the names it retained: past the limit it
appends "and N more" instead of collapsing to a bare count, so the commit
that is the only record of which write triggered a repair no longer
discards the labels kept for exactly that purpose. N counts the unnamed
writes, which also removes a skew — Sources deduplicates and SourceCount
does not, so two equal-sized bulk deletes rendered one label and took the
count-only form at two writes, not at "more than three" as documented.
6. The CHANGELOG's wisp clause now matches the doc comment and the PR
description: closes, updates, deletes and demote-to-wisp. An update to an
inactive status also takes a blocker away, and the narrower list
under-counted the uncovered routes on the surface users actually read.
7. The Dolt tier's swallow is pinned. Every other test in
close_recheck_blocked_test.go calls recheckBlockedAfterCommit directly, so
nothing crossed either runner's tail on the tier #6716 was reported on —
restoring `return s.recheckBlockedAfterCommit(...)` turned nothing red.
TestCloseRecheckBlocked_FailureKeepsTheWrite runs a close through
withRetryTx and through withWriteTx with the recheck forced to fail
(marking the store closed inside fn, the analog of the embedded test's
readOnly flip) and asserts nil plus durability.
Gates, this iteration: gofmt clean; go build ./internal/storage/... and
go vet on issueops, dolt and embeddeddolt clean;
go test ./internal/storage/issueops/ ok;
go test -tags gms_pure_go ./internal/storage/embeddeddolt/ -run BlockedRecheck
ok (9s, real engine); go test ./internal/storage/dolt/ -run CloseRecheckBlocked
ok (27s, dolt testcontainer). Iteration 1 additionally ran the full embedded
package (98s) and the dolt subset
'RunInTransaction|BatchCloser|IsBlocked_|CloseRecheck|LifecycleCloseReopen'
(156s). Every new assertion was proved non-vacuous by mutating the change it
pins — reverting CommitMessage to the count-only form, counting all writes
rather than the unnamed ones, dropping the ids and the repair pointer from the
warning, unbounding that id list, and restoring the propagation on each runner
tail — six mutations, each reddening only the assertions that defend it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(feat): red — check-doc-freshness.sh: fail when a file has more than one 'Last reviewed:' marker line (refs be-g7tqg)
* feat: green — check-doc-freshness.sh: fail when a file has more than one 'Last reviewed:' marker line (refs be-g7tqg)
* test(schema): red — pin aux row id digest to DATE_FORMAT rendering (be-qpotl)
Update the frozen digest column expectations (schema.expectCommentsSelect,
dolt.derivedIDDigestColumns) from CAST(x AS CHAR) to
DATE_FORMAT(x, '%Y-%m-%d %H:%i:%s'), matching issueops.AuxTimeLayout
explicitly instead of relying on CAST's engine-default rendering, which
today happens to match but isn't a pinned contract.
Adds TestAuxTimeDateFormatMatchesGoRendering, pinning that DATE_FORMAT and
issueops.FormatAuxTime render identically for a fixed instant against a real
stored DATETIME(0) column.
Also fixes assertTableIDsContentDerived's field count: it counted commas in
the columns string, which over-counts once a column expression itself
contains one (DATE_FORMAT's format-string argument does). Derives the count
from rows.Columns() instead, which is robust to that and was needed to get
this test file to a clean, genuine pass/fail signal.
RED: the schema package's TestRekeyAuxRowTable* tests now fail against
production code, which still issues the old CAST(x AS CHAR) text — expected;
rekeyAuxRowTable (internal/storage/schema/aux_row_id_backfill.go) is not yet
touched.
* feat: green — Pin aux-rekey digest datetime rendering: DATE_FORMAT instead of bare CAST(x AS CHAR) (refs be-qpotl)
Two-part fix, both required for the RED tests to pass:
1. auxRekeyTables: replace all 4 CAST(x AS CHAR) occurrences with
DATE_FORMAT(x, '%Y-%m-%d %H:%i:%s'), pinning the SQL-side datetime
rendering to match issueops.AuxTimeLayout/FormatAuxTime explicitly
instead of relying on CAST's engine-default rendering.
2. rekeyAuxRowTable: fix nFields := strings.Count(t.columns, ",") + 1,
the same naive comma-counting bug the test helper had. Every one of
the 4 DATE_FORMAT substitutions introduces one internal comma, which
the old count over-counted as an extra top-level field. Now derives
the field count from rows.Columns() instead, matching the fix already
applied to assertTableIDsContentDerived in
internal/storage/dolt/derived_id_insert_test.go.
No other files touched; rowid.Digest/rowid.New and which columns
participate in the digest are unchanged.
* fix(issueops,dolt): re-anchor AuxTimeLayout doc to DATE_FORMAT and co-assert CAST
Maintainer review fixup for #6649. Both items are minor/non-gating findings from
the review (synthesis and scorecard both decided approve); they are taken here
because each is a nearby, cheap, low-risk edit.
internal/storage/issueops/derivedid.go: AuxTimeLayout's doc comment still
anchored the frozen layout to "exactly as Dolt renders CAST(created_at AS CHAR)"
— the engine-default dependency this PR exists to remove — so the two halves of
one frozen contract cited different SQL expressions. The statement was true, but
it re-planted the abandoned anchor on the one Go-side constant the derivation
actually hangs on, inviting a future maintainer to re-pin against CAST. Re-anchor
it to DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s'), cross-reference
TestAuxTimeDateFormatMatchesGoRendering the way the schema-side comment now does,
and demote CAST to a historical aside.
internal/storage/dolt/derived_id_insert_test.go: the new test's doc comment cited
DATE_FORMAT/CAST equivalence as the reason the change is safe, but the assertion
only covered DATE_FORMAT == FormatAuxTime. Project CAST(created_at AS CHAR)
alongside it and assert both against goRendered — one extra column, and it
settles the reviewer's zero-date residual empirically rather than by a
reachability argument. The equivalence is deliberately not load-bearing: the Go
layout remains the anchor, so a future Dolt change to either expression turns
this test red instead of silently forking the id space.
Validated against a real dolt-sql-server (not skipped):
TestAuxTimeDateFormatMatchesGoRendering and
TestInsertTimeIDsMatchBackfillDerivation both PASS; mutating the co-asserted
projection to a date-only rendering fails the new assertion alone, proving it is
not vacuous. internal/storage/schema rekey/drift sqlmock tests and
internal/storage/issueops stay green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(issueops): exempt DeleteWispAuxRowsInTx from the version-mint guard
Base repair, not part of this PR's subject. main is red at 566c84ba8:
TestEveryBeadMutatorMintsOrIsExempt fails with
exported function "DeleteWispAuxRowsInTx" writes a work-bead table but
mints no version ... and is not exempted
This is a semantic collision between two independently-green commits:
#6627 (3ba08dba1, 20:58Z) added the exported wisp aux-row cascade helper
and registered it in journalExemptions, and #6650 (da6263374, 21:48Z)
added the structural version-mint detector that now flags it. Neither
PR's own CI could see the other.
The exemption is forced by the existing convention rather than a new
ruling: DeleteWispAuxRowsInTx is called one line after the already-exempt
DeleteWispFromDependenciesInTx in deleteIssueRowInTx, does the same
delete-family cleanup of subordinate rows owned by a wisp that is being
deleted, and has no surviving row to version. The delete itself is
journalled by RecordDeleteInTx in the same transaction.
Carried here because every PR rebased onto current main inherits the red.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(dolt): config.yaml pool-deadline rung reaches library consumers
BEADS_DOLT_POOL_READ_TIMEOUT / dolt.pool-read-timeout's config.yaml rung
resolves through config.GetString, which reads a package-global viper
populated only by cmd/bd's config.Initialize(). A process linking beads
as a library never initializes it, so the rung always returned "" and
the project's configured pool deadlines were silently ignored — the
process ran the 10s default whatever config.yaml said. On a loaded
shared server an ordinary multi-dependent close already outlives 10s,
and a deadline kill mid-close leaves a half-applied transition.
When the global-viper read comes back empty, fall back to a direct read
of <beadsDir>/config.yaml via config.GetStringFromDir — the same
fallback dolt.auto-start carries in this file for this exact hole, added
in its comment's words as "a config.yaml fallback for library consumers
that never call config.Initialize()". The pool-timeout keys were added
later without it.
Ladder unchanged otherwise: caller override > env > global viper
(cmd/bd) > config.yaml direct read > 10s default. Test pins the three
cases: file populates with no env and no global viper, env wins over
file, and no file leaves the deadlines unset for buildServerDSN's
default.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018kXkQNGZt8wHm83FvRTASW
* review: carry max-conns through the same config.yaml fallback; fold tests into the ladder
Addresses all four review nits: (1) dolt.max-conns had the identical
library-consumer hole in the same block — it now shares the hoisted
poolCfg fallback (red-proved: reverting it fails the new subtest with
MaxOpenConns = 0, want 25); (2) the no-global-viper premise is asserted
so the dir-fallback subtest fails loudly instead of passing vacuously;
(3) the hoisted comment carries the user-level-outranks-project clause
for a non-CWD beadsDir, matching dolt.auto-start; (4) the subtests move
into open_test.go's TestApplyResolvedConfig ladder and the separate
file is gone. go build/vet clean; TestApplyResolvedConfig ok, also
with -race.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DZdGTuCEXtMi1ksowvjDVn
---------
Co-authored-by: Cherub Kumar <5449665+ckumar1@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(git): preserve config read errors instead of treating them as absent (saa-cgh.120.20)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(git): preserve config read errors instead of treating them as absent (saa-cgh.120.20)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(git): assert config failures without English diagnostics (saa-cgh.120.20)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* fix(init): ignore beads store at OS temp root
* fix(discovery): centralize temp-root walk ceiling
* fix(discovery): guard the empty boundary sentinel in the migrated walks
Maintainer review fixup for #6641.
FindAllDatabases canonicalized findGitRoot()'s "not in a git repo"
sentinel. CanonicalizePath("") resolves to the current working
directory, so the `dir == gitRoot` break fired on the walk's first
iteration and discovery stopped at the CWD instead of walking upward -
an exported-API regression for every non-git caller. Guard the
canonicalization the way findDatabaseInTree already does.
findParentConfig hit the same mechanism one file away: an unset HOME
makes os.UserHomeDir fail, and canonicalizing the resulting "" turned
"don't search above $HOME" into "stop at the CWD".
Also record the two AncestorDirWalk semantics the migration changed but
did not document: the temp-root ceiling ends the walk rather than
skipping the temp root (so ancestors above it are unreachable from
below, which matters when TMPDIR points inside a project), and the walk
yields the filesystem root, which most of the replaced hand-rolled loops
did not. Both are now pinned by tests so they cannot flip silently.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* The newsletter dropped every commit made before the hour it ran
`--since` takes an APPROXIDATE, so the bare date this built did not mean the
start of that day -- it meant that day at the CURRENT TIME OF DAY. Measured
on a live tree at 17:02 local:
git log --since=2026-09-10 -> 0 commits
git log --since=2026-09-10T00:00:00 -> 60 commits
Sixty commits dropped, silently, in a script whose output is published. The
same invocation answered differently depending on the hour it ran.
The half-fix is a trap, and it is the one the town-wide description leads to.
The finding has been circulated as "--since is a traversal cutoff"; that is
true and it is not this bug. Swapping in --since-as-filter while keeping the
bare date keeps the whole defect, because approxidate applies to the VALUE
regardless of which flag reads it:
git log --since-as-filter=2026-09-10 -> 0 commits
git log --since-as-filter=2026-09-10T00:00:00 -> 60 commits
So both are fixed here: a full timestamp for the approxidate, and
--since-as-filter (git 2.37+) for the cutoff, with a comment saying not to
simplify either back.
FOUR copies, not the three named, in two versions drifted 184 lines apart --
beads/{mayor,refinery} and gastown/{mayor,refinery}. The defective block was
byte-identical in both (md5 6fdd32e6 over lines 156-160). All four working
trees are patched; the 184-line drift is left alone, because converging them
is a decision nobody has made.
Verified through the patched code rather than by exit code: exec'ing the new
get_commits_since for 2026-09-10 returns 60 where the old form returns 0.
igr-9qdx
Executed-By: mayor
* fix(newsletter): fail loudly when git is too old for --since-as-filter
--since-as-filter needs git 2.37 (2022-06). On anything older `git log`
exits 129 with `error: unknown option 'since-as-filter=...'` on stderr,
stdout is empty, and get_commits_since returned [] — reproducing the
silent-and-shorter newsletter this change exists to fix, with a new cause.
Check the return code and raise with the version floor named. An empty
stdout on a zero exit is still a legitimate "no commits in range".
Verified against a shim that rejects the flag the way git < 2.37 does:
with the guard, RuntimeError naming the floor; with it reverted, 0 commits
and no error; on real git 2.43, 40 commits, unchanged.
* docs(newsletter): record the new git >= 2.37 floor
--since-as-filter puts the script's first hard git-version floor on the release
path (beads-release.formula.toml:866/:870 -> release-complete), but nothing
outside get_commits_since()'s docstring said so. On an older runner the release
step aborts and the operator has to trace the cause into a function body.
Add it to the module docstring alongside its existing requirement sections, and
to the README Setup section. No silent fallback to plain --since -- that
reinstates the truncation this PR exists to remove.
Placement is deliberate: the prose does NOT go in the `# /// script` PEP 723
block. That fence is parsed as TOML, so a comment line there is a hard launcher
failure, measured on uv 0.9.5:
# /// script
# requires-python = ">=3.10"
# Requires git >= 2.37 for --since-as-filter
# ///
$ uv run probe.py
error: TOML parse error at line 3, column 10 ... key with no value
exit 2
The docstring already carries the Usage / Environment Variables / Configuration
File sections, so Requirements belongs beside them. After the edit
`uv run scripts/generate-newsletter.py --help` exits 0, and the error string
quoted in the README is byte-identical to the f-string it documents.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Route CheckBehindDrift through CurrentVersion so a fresh database is checked through the information_schema existence probe before querying schema_migrations.
Keep the existing *sql.DB API and add one focused regression test for the missing-table path.
Rebased onto upstream/main a690b0a8c (was authored against 64a136d5, conductor-verified worktree HEAD 70eeaebb).
* fix(timeparsing): add unambiguous "min" minute unit to compact durations
--defer/--due use the compact duration parser, whose smallest unit was
one hour. "+30m" silently parsed as 30 months (rc 0, no warning), so a row
meant to return in half an hour became ready again years later, while
"+30min" was rejected outright.
Add "min" as a new minute spelling alongside h/d/w/m/y. Bare "m" keeps
meaning months, so existing callers are unchanged; redefining or refusing
bare "m" is a semantics change left for maintainer sign-off.
Fixes#6609
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(query): resolve the "min" minutes unit as "N ago" in bd query
The widened compact-duration grammar reached the `bd query` plane through
the evaluator's ungated fallback arm: `isDurationSuffix` classifies a
single rune, so `30min` lexed as TokenIdent, skipped `parseDurationAgo`,
and resolved through `ParseRelativeTime` as 30 minutes in the *future* --
the opposite direction from `created > 30m` (30 months ago) and from the
command's own documented contract at cmd/bd/query.go:66.
Recognize multi-rune duration suffixes in `readNumberOrDuration` so
`30min` lexes as TokenDuration and resolves to 30 minutes ago. Plural,
uppercase, and identifier-continuation spellings (`30mins`, `30MIN`,
`30min-window`) keep their existing identifier classification.
Maintainer review fixups for PR #6629, review iteration 1:
- pin the query-plane semantics with EvaluateAt tests against a fixed now
- make the months assertion in TestParseTimeFlag_MinutesVsMonths
two-sided, so it can no longer stay green if "m" regressed to years
- mention +30min in the ParseRelativeTime error examples
Maintainer review fixups for PR #6629, review iteration 2 (non-gating):
- bind the query lexer's unit set to the shared timeparsing grammar with
a cross-package test. ParseCompactDuration is the oracle, so a unit
added to that grammar but missed in durationWords/isDurationSuffix now
fails loudly instead of silently resolving as a future offset -- the
class this fixup previously closed only for "min". Verified by adding
"sec" to the shared pattern alone: the test discovers and fails it with
no test edit.
- pin that a duration token on a non-time field (label=1min) is still
filtered as a literal string, since parseTimeValue is the only consumer
of ValueType.
- list min/m/y in the bd query duration help, so "m" reads as months
right next to "min". The generated CLI docs are release-pinned
(docs/cli-docs.pin v1.2.2, built from the tag rather than the working
tree), so they are deliberately not regenerated here;
./scripts/generate-cli-docs.sh --check reports them fresh.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(cmd/bd): share fresh-workspace environment isolation (saa-cgh.120.22)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* test(cmd/bd): restore mode globals after isolation regression (saa-cgh.120.22)
Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
* docs(test): scope environment restoration claim to BEADS_DIR
Address the wording nit in PR #6519 review 5189902686 without widening the helper.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* chore(deps): bump the beads-mcp-python group across 1 directory with 5 updates
Bumps the beads-mcp-python group with 5 updates in the /integrations/beads-mcp directory:
| Package | From | To |
| --- | --- | --- |
| [fastmcp](https://github.com/PrefectHQ/fastmcp) | `3.4.7` | `4.0.5` |
| [pydantic](https://github.com/pydantic/pydantic) | `2.13.4` | `2.13.5` |
| [build](https://github.com/pypa/build) | `1.6.0` | `1.6.1` |
| [ruff](https://github.com/astral-sh/ruff) | `0.16.5` | `0.16.8` |
| [types-requests](https://github.com/python/typeshed) | `2.33.0.20260712` | `2.33.0.20260906` |
Updates `fastmcp` from 3.4.7 to 4.0.5
- [Release notes](https://github.com/PrefectHQ/fastmcp/releases)
- [Changelog](https://github.com/PrefectHQ/fastmcp/blob/main/docs/changelog.mdx)
- [Commits](https://github.com/PrefectHQ/fastmcp/compare/v3.4.7...v4.0.5)
Updates `pydantic` from 2.13.4 to 2.13.5
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/v2.13.5/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.13.4...v2.13.5)
Updates `build` from 1.6.0 to 1.6.1
- [Release notes](https://github.com/pypa/build/releases)
- [Changelog](https://github.com/pypa/build/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pypa/build/compare/1.6.0...1.6.1)
Updates `ruff` from 0.16.5 to 0.16.8
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.16.5...0.16.8)
Updates `types-requests` from 2.33.0.20260712 to 2.33.0.20260906
- [Commits](https://github.com/python/typeshed/commits)
---
updated-dependencies:
- dependency-name: build
dependency-version: 1.6.0
dependency-type: direct:development
update-type: version-update:semver-minor
dependency-group: beads-mcp-python
- dependency-name: fastmcp
dependency-version: 4.0.3
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: beads-mcp-python
- dependency-name: pydantic
dependency-version: 2.13.5
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: beads-mcp-python
- dependency-name: ruff
dependency-version: 0.16.6
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: beads-mcp-python
- dependency-name: types-requests
dependency-version: 2.33.0.20260906
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: beads-mcp-python
...
Signed-off-by: dependabot[bot] <support@github.com>
* docs(beads-mcp): point README at `fastmcp dev inspector`
fastmcp 4.0.5 turns `dev` into a command group (`apps`, `inspector`) rather
than a leaf that takes a server path, so the README's documented onboarding
command now fails:
$ uv run fastmcp dev src/beads_mcp/server.py
Unknown command "src/beads_mcp/server.py". Available commands: inspector, apps.
`fastmcp dev inspector` takes the server spec as its positional argument, so
that is the 4.x spelling of the same command. No CI lane executes the fastmcp
CLI (`scripts/ci/package-mcp.sh` runs uv sync/ruff/mypy/pytest/build only), so
a fully green Package Gate (MCP) cannot catch this.
Maintainer fixup applied during PR adoption review.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(hooks): export from linked worktree
* fix(hooks): scope the worktree export retarget and share it with the importer
Maintainer review fixups for #6717 (fixes#6680).
Blocker — the pre-commit export retarget was unconditional.
preCommitExportPath rewrote the destination whenever hookWorkTreeRoot() was
non-empty, but that is true for *every* hook invocation (it returns
filepath.Dir(GIT_DIR) for a plain repo too, pinned by export_auto_test.go's
"plain repo" case). Any topology whose discovered beads dir is not
<repoRoot>/.beads — a .beads/redirect to a shared out-of-repo store, a
BEADS_DIR override, a beads dir above the repo root — silently stopped
refreshing its real JSONL and instead got a brand-new in-repo dump that,
being inside the worktree, passed gitAddFile's GH#3311 guard and was staged
into the user's commit.
worktreeJSONLDir now retargets only when the hook belongs to a *linked*
worktree and the discovered beads dir lives inside the primary checkout —
exactly the cross-worktree write #6680 reported. Everything else keeps the
discovered directory and pre-#6680 behavior. The destination mirrors the
beads dir's path *relative to the primary checkout*: a store renamed at the
top level or nested under one (a relative .beads/redirect to tools/store)
lands at the path the committing worktree actually tracks, rather than at a
collapsed leaf no commit has ever contained. A lexical result that would
escape the worktree, and a store that *is* the checkout root, both decline.
Major — only the writer had moved. syncImportJSONLPath still imported
<primary>/.beads/issues.jsonl while the hook wrote <worktree>/..., so a
git pull in a linked worktree could import a JSONL the hook never updates.
Both hook lanes now go through one resolver, hookJSONLDir. The non-hook
auto-export lane (maybeAutoExport and its export-state.json key) is
deliberately left alone and documented: it has no GIT_DIR to resolve a
worktree from, and changing it means resolving the worktree from cwd for
every bd command — a product decision, not a hook fix.
Major — moving that reader made the importer's own subprocess harmful.
`bd import` ran with BD_GIT_HOOK cleared, so its PersistentPostRun
auto-export re-resolved the destination from beads.FindBeadsDir() and wrote
<primary>/.beads/issues.jsonl. That was content-neutral while both halves
of the sync path read the primary's copy; with the source moved to the
worktree, a post-merge in a linked worktree writes one branch's issue state
over another checkout's tracked file — #6680's second symptom, out of the
fix for its first. No import path consults BD_GIT_HOOK (its only consumers
are auto-export, auto-backup, the first-run metrics notice and terminal
color), so the comment justifying the clear was false in exactly the way
this commit already proved the export-side comment was. Both subprocesses
now share hookSubprocessEnv.
Also:
- create the destination directory before exporting; atomicfile does not
create parents, so a retargeted or nested export.path warned on every
commit and wrote nothing.
- run isExportFileStagedForDeletion from the nearest existing ancestor so a
missing directory can no longer make exec fail and silently drop the
GH#3838 `git rm` guard.
- hookSubprocessEnv (was preCommitExportEnv) forces BD_GIT_HOOK=1 rather
than being an identity copy that assumes the caller set it, and now
serves both hook subprocesses.
- record that keeping BD_GIT_HOOK also suppresses the subprocess
auto-backup, and correct the comments that claimed the suppressed export
could stage the primary's JSONL (gitAddFile's guard stops it) and that
the redirect case was unreachable.
- scope the hookLinkedWorktreePrimaryRoot comment to <root>/.git layouts.
It is deliberately narrower than internal/beads' probe, which also serves
bare-repo-backed worktrees: mirroring a tracked path needs a primary
checkout and a bare repository has none, so #6680 stays unfixed for that
layout and the comment now says so instead of claiming parity.
- log the resolver's inputs and verdict, so a "keep beadsDir" outcome is
observable under BD_DEBUG rather than indistinguishable from the hook not
running at all.
- document the sync lane's JSONL ownership decision, which this commit
makes but did not state: the source file follows the committing worktree
while the store it feeds stays the primary checkout's shared one, so a
linked worktree on a feature branch can introduce that branch's rows
there. Forward-only — the import never deletes and rewrites a row only
when updated_at is strictly newer, a guard auto-import paths cannot
switch off.
- name, in worktreeJSONLDir, which lane actually reaches the mirrored
non-.beads topologies. preCommitHasStagedBeadsFiles still gates the
export lane on a hardcoded ".beads" pathspec (byte-identical to base), so
a renamed or nested store normally stages nothing it matches and the
mirror is reached by the sync lane; the comment is a correctness bound,
not "nested stores now auto-export on every commit".
- name the one case the gating does not catch: a <primary>/.beads that is
itself a symlink out of the repository. pathInsideDir resolves symlinks
on the parent only, so it still compares as inside the primary and gets
retargeted. The supported .beads/redirect mechanism is unaffected;
closing the hand-rolled `ln -s` case means resolving beadsDir before both
the gating and the lexical Rel, which also moves the mixed-symlink-form
case they currently decline.
- keep this file's fixture helper out of the //go:build cgo namespace.
writeFile lives in explicit_db_nodb_test.go, which the pure-Go
(CGO_ENABLED=0) and native-Windows lanes exclude, so referencing it from
this unconstrained file failed to compile the whole cmd/bd test binary
there. Use a local writeFileForWorktreeTest, matching the suffixed naming
the rest of this file already uses for the same collision reason.
Tests: a gating matrix over the redirect / BEADS_DIR / already-inside /
renamed / nested / checkout-root topologies; a real `git worktree add`
fixture driving hookJSONLDir; and a wiring test that stands a stub `bd` on
PATH and drives both call sites — asserting the pre-commit export writes
and stages the worktree's JSONL while the primary's copy stays
byte-identical, and that the post-merge import reads the worktree's copy
with BD_GIT_HOOK=1. Reverting either call site to the discovered beads dir
— the whole user-visible fix, which the earlier helper-only tests let pass
— fails there.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(import): seed issue_prefix from config.yaml before the batch guard needs it
NewBatchContext (via ReadConfigPrefix) unconditionally requires an
issue_prefix row in the database's own config table before creating
any issue. bd init writes that row via SetConfig, but a database an
external tool provisioned directly (e.g. an orchestrator that created
the Dolt database via SQL and pointed config.yaml at it without ever
calling bd init) never gets one. Every bd import then failed with
"issue_prefix config is missing", even though config.yaml carried the
prefix and bd where/bd context resolved it correctly.
bd import already had logic to sync config.yaml's prefix into that
table, but only after a successful import — useless when the import
itself can't start without the row. This moves an equivalent, guarded
sync (only fires when the table is empty, never overwrites an existing
prefix) before the import attempt, reading config.yaml directly via
GetStringFromDir rather than the global config singleton, since that
singleton isn't guaranteed to be initialized this early in the import
path.
Added a regression test that reproduces the exact failure with stock
bd (bd init --server, then delete the config-table row and write
config.yaml by hand — no orchestrator involved) and confirms it now
imports successfully.
* fix(import): address review — proxied-mode parity, --global exclusion, GetString
Three issues from @bee-ghosttrack's review of ffb32fb:
1. Proxied-server mode had the identical bug: importer.go's ImportBatch ran
CreateIssuesInTxWithResult (-> NewBatchContext -> ReadConfigPrefix) before
its own SyncIssuePrefix reconciliation, in the same transaction. Seeds the
prefix before create there too, when the table is empty.
2. --global was not excluded from either sync (import.go's existing
post-import sync and this fix's new pre-import seed, plus the proxied
path's SyncIssuePrefix source). config.yaml is per-project; the shared
global store's own prefix must win in --global mode (selectCreateIDPrefix
already established this for `bd create`), or a project's local prefix
silently overwrites the shared database with two dolt commits.
3. GetStringFromDir's rationale didn't hold: config.Initialize() has already
run by main.go's init() and prepareSelectedCommandContext, and
GetStringFromDir skips the config.local.yaml overlay GetString honors —
disagreeing with the sync 40 lines below it. Switched to GetString,
matching import.go:415 and import_proxied_server.go's existing usage.
Smaller fixes: TrimSpace + validatePrefix on the seeded value (a failed
validation now warns instead of writing an invalid prefix); SetConfig/Commit
failures now warn to stderr instead of being silently swallowed.
Test changes:
- Added TestImporterUOW/SeedsPrefixBeforeCreateNeedsIt, exercising the
proxied-mode fix directly at the unit-of-work layer (no CLI/container
overhead) by clearing config-table issue_prefix and confirming
ImportBatch still creates issues. Revert-mutant confirmed: fails with
the identical "issue_prefix config is missing" without the fix.
- Rewrote the E2E test with this repo's server-mode conventions:
skipIfNoDolt, uniqueTestDBName + dropTestDatabase, explicit --server-port
— no longer leaks a database on the shared test server.
- Added TestCLI_Import_GlobalModeIgnoresProjectConfigYAMLPrefix (separate
file, cgo-only build tag, using the shared-server harness from
global_identity_integration_test.go): confirms a --global import does not
adopt a project's config.yaml prefix. Revert-mutant confirmed: without the
--global guards, the shared global store's prefix is overwritten by the
local project's ("global" -> "localproj").
go build ./... clean; go vet ./cmd/bd/... (both with and without -tags
"cgo integration") clean; gofmt -l clean on all touched files.
* fix(import): commit the seeded prefix on an empty batch; one resolved prefix
Maintainer review fixup for PR #6624 (iterations 1-2). Addresses the two major
findings and the nearby minors/nits.
MAJOR — the proxied seed was discarded on a batch that landed no rows.
The seed wrote issue_prefix but left ImportBatchResult.PrefixSynced false, so
importBatchCommitMessage produced "" for a batch with Created == 0 and no
memories, RunTxResultWithin skipped uw.Commit on the empty message, and the
deferred closeAttempt ROLLED BACK the seeded row. `bd import` reported success,
the prefix never landed, and a re-run dedup'd again — the state never
converged. Reachable against a missing-prefix database whenever every input row
is dropped by the in-transaction stale guard or the CLI's title dedup. The seed
now reports itself through PrefixSynced, restoring the "the prefix sync runs
even when the batch is otherwise empty" contract (be-llaf) that
import_proxied_server.go's comment promises; the field's doc says so too.
MAJOR — that arm had no coverage in any lane that runs.
TestImporterUOW/SeedsPrefixEvenWhenEveryRowIsRejected pins it: empty stored
prefix + SyncIssuePrefix set + every row stale-rejected => the prefix is
committed, under the sync message, with history moving exactly one entry. It
fails on the pre-fixup tree on all four assertions. The existing
SeedsPrefixBeforeCreateNeedsIt cannot catch this (Created == 1 carries the
commit) and PrefixSyncAloneCommitsUnderTheSyncMessage runs with a non-empty
stored prefix, so its seed never fires. Both are tag-free and container-free,
so unlike the classic-path e2e they execute in ordinary lanes.
Minors and nits:
- Seed errors are returned, not warned. A SetConfig failure here is a
precondition failure for the very next statement: swallowing it surfaced as
the "issue_prefix config is missing" error this seed exists to prevent, and
hid serialization failures from RunTxResult's retry classifier. Drops the
os import.
- Classic path resolves ONE prefix for both its writers (importSyncPrefix;
iteration 2 below extends the same resolver to the proxied path). The
seed used a TrimSpace'd + validatePrefix'd value while the post-import sync
used the raw one, so (a) a prefix the seed refused still reached the database
through the sync, bypassing the guard this PR adds, and (b) a padded
`issue-prefix: " bd"` made the two disagree and the sync overwrote the
trimmed value. TestImportSyncPrefix pins the resolver with no store and no
container; each arm mutation-proved independently. Side effect: the flagged
worst_changed function drops from cyclo 25/cognitive 43 to 22/34.
- Warnings name the whole effect on both paths: an invalid issue-prefix
disables the sync as well as the seed, which base did not do.
- The --global isolation test anchors what its "before" value IS, so the
after == before comparison cannot go vacuous. The anchor is
doltserver.GlobalIssuePrefix, NOT the --prefix passed to init: --prefix names
the project's prefix and `bd init --global` always writes the constant
(init.go), which an unanchored equality had been hiding.
- Comments record two boundaries the diff left unstated: the classic seed
commits before an import that may fail (deferring it is not an option — the
post-import CommitWithConfig is gated on dbPrefix != syncPrefix, which a seed
makes false, so the row would stay uncommitted because store.Commit excludes
config (GH#2455), and a dirty internal config key blocks the next pull); and
a --global import against a global database missing its own
config.issue_prefix stays unseedable by design.
Iteration 2 — three non-gating findings (both majors above stayed fixed; the
fresh synthesis and quality scorecard both say approve):
- The classic seed now runs BEFORE the memory writes. CommitWithConfig is
DOLT_COMMIT -Am, so it stages everything dirty at that instant: with the seed
below the memory loop, a `bd import` carrying memories against a
missing-prefix database whose issue phase then failed left those kv.memory.*
rows PERMANENTLY COMMITTED, under a message asserting the commit is the
prefix seed — where at base the failure left the whole working set for the
operator to discard. Seeding first restores "the only thing this commit can
carry is the prefix". Pure statement reorder: the seed reads only issues,
syncPrefix and the config table, and the ordering is now recorded as
load-bearing at the block so a later edit does not undo it.
- The proxied path CALLS importSyncPrefix() instead of restating its four rules
inline. The two copies were identical rule for rule — same globalFlag guard,
same TrimSpace, same validatePrefix, byte-identical warning — but only the
classic copy was pinned, so the underscore-key fallback ReadConfigPrefix
honors, or hyphen normalization, could have reintroduced ACROSS import modes
exactly the divergence the bullet above closed within one mode. One
implementation now, so TestImportSyncPrefix's six rows govern both routes.
Drops the os, strings and config imports from import_proxied_server.go.
- The uow subtests no longer lean on suite order.
SeedsPrefixEvenWhenEveryRowIsRejected snapshots the sync-message history
count before the batch and asserts +1: the old `n != 0` form could not fail
in a full-suite run, because PrefixSyncAloneCommitsUnderTheSyncMessage has
already committed under that message by then. Mutation-proved — routing an
all-rejected batch to a "0 issues from ..." message reds only the new
assertion ("moved 1 -> 1"), and the 1 in that output is precisely the count
that would have satisfied the old form. SeedsPrefixBeforeCreateNeedsIt also
restores issue_prefix the way its two neighbours do, instead of leaving the
fixture to be restored by the code under test.
The PR description's stale "GetStringFromDir / config.GetString returned empty
in this exact spot" claim and its "single-file production change" scope claim
were corrected on GitHub, and the CI-lane reality for each added test is now
recorded there.
Validation (iteration 1): gofmt clean; go build ./...; go vet on cmd/bd,
internal/storage/uow and issueops; full internal/storage/uow package green
(570s, under a private temp root); focused cmd/bd import tests,
TestImportSyncPrefix, TestEmbeddedImport/prefix_sync{,_no_config_key} and the
--global isolation e2e all green.
Validation (iteration 2): gofmt and `git diff --check` clean; go build
./cmd/... ./internal/storage/uow/...; go vet on cmd/bd and
internal/storage/uow; full TestImporterUOW green in subtest order (9/9) plus
the mutation A/B above; TestImportSyncPrefix green (6/6). Two reds in the wider
`go test -run Import ./cmd/bd` are environmental on this box and reproduce
identically with the fix set stashed: TestCLI_Import_GlobalModeIgnoresProjectConfigYAMLPrefix
dies inside `bd init` because the cloned remote is one schema version behind
this build (v66 -> v67), and TestImportBlockedDuringMigrationFreeze cannot
start its server (port 3307 busy).
---------
Co-authored-by: ilasic <ilasic@reversinglabs.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(feat): red — Phase 0: conformance suite (history, expectedRevision R16.1, epochs R20) - gastownhall/beads#6133 (refs be-hs42e.1)
* feat: green — Phase 0 conformance suite (history, R16.1, R20 epochs) (refs be-hs42e.1)
Implements the 32 in-process RunXxx contract cases from be-hs42e.1 §4
(gastownhall/beads#6133): expectedRevision CAS + refusal (R16/R17, 10 cases),
the cross-record-invariant boundary (R16.1, 7 cases), and retention/epoch
semantics (R20, 15 cases). All hooks nil in every backend's fixture kit per
architecture §12 — ships disabled by default, zero behavior change.
Also fixes a role-tier coverage-gate false positive: role_bundle_test.go's
TestRoleContractCasesCoverEveryContractCase matched any Run*(t, ctx,
XxxFixture) function in the package with no scoping, incorrectly sweeping in
these new history-semantics functions. Scoped via roleTierFixtureNames()
(reflection over RoleContractBundle's field types) so only functions whose
Fixture type is an actual bundle field count as role-tier cases.
* feat: green — Review: Phase 0: conformance suite (history, expectedRevision R16.1, epochs R20) - gastownhall/beads#6133 (refs be-zv3ob)
Wire the 32 new R16/R16.1/R20 role-contract entrypoints (expected_revision,
cross_record_invariant, retention, epoch) into all three storage legs so
TestEveryLegWiresEveryRoleContract passes on dolt, embeddeddolt, and uow —
fixing the round-1 review's blocking finding (gastownhall/beads#6133).
Each new per-leg _test.go file follows the existing wiring convention (one
TestXxxContract per role, one t.Run per case, calling conformance.RunXxx)
with the same all-nil Phase 0 fixtures used everywhere else this phase, so
every case skips by name until Phase 3 gives it a non-nil hook.
Also corrects a stale comment in versioned_history_wiring_test.go that
argued against per-leg wiring files exactly like the ones this commit adds.
No other behavior change: wiring only, no new dependency, no scope beyond
the reviewer's named blocking issue.
* chore: release gate PASS for Phase 0 conformance suite (be-e0w8y)
Review: be-g8mp3 (PASS). Deploy bead: be-e0w8y.
Refs be-e0w8y, be-g8mp3, be-hs42e.1, be-zv3ob.
* feat: green — Review round 2: Phase 0 conformance suite (bounds assertion, RetentionAnswer fields) - gastownhall/beads#6147 (refs be-ekp0w)
Fix bee-ghosttrack's round-2 MERGE-AFTER-FIXES review on PR #6147
(comment 5504085482):
- RunAHoldPreventsRemovalAndReportsInRetainedBounds now asserts BOTH
refusal (ErrRetentionHeld) AND that the held Address shows up
positively in the reported RetainedWindow bounds, not merely inferred
from the absence of a Gone restriction (R20-h).
- RetentionAnswer gains Attribution *ChangeAttribution and Epoch *int.
RunForcingAHeldRemovalRecordsWhoWhenWhy now asserts real attribution
content (R20-h2) instead of accepting it only as a parameter.
RunEpochBumpVoidsOnlyAddressesOfVersionsNoLongerServed now asserts
Restriction=GoneReorganization AND the current epoch is named (R20-n).
Reviewer-sanctioned, taken in the same pass:
- RetentionFixture gains a Mint hook (analogous to
EpochFixture.MintUnderEpoch); every retention case that needs a real,
resolvable Address now mints one instead of relying on the retired
"fabricated address defaults to Live" convention. The one exception,
RunAStoreWithNoLineageKnowledgeAnswersUnknownNotGone, keeps the old
fabricated-address helper on purpose: Unknown specifically means an
Address no store ever minted.
- RunStoreInvariantTransactionScopesExactlyTheSpanningRecords adds a
post-refusal read-back via CountHistoryForSubject, pinning that a
refused cross-record batch is atomic (leaves no trace on either
record), as an inline nil-check rather than a t.Skip.
- Refusal's doc comment now states the fixture kit is the translation
boundary between whatever shape a real backend ships and the one
shape this suite asserts against — not a mandate banning a native
typed-error refusal shape at the backend level.
- Package doc comment in expected_revision_contract.go records four
reviewer-named deferrals verbatim (unretained/disclosure-gating as a
future authorization axis rather than a sixth Restriction state;
invariant-declaration discoverability; lease TTL self-expiry; R20-j
durability-across-restart) and notes the "_attribution" patch-key
convention as canonical for Phase 3 hook docs.
§4a's choice-vs-transcription table (this file's package doc comment)
already marks choices 2 and 3 DIED as of this round; no separate
callout-row table exists elsewhere in the repo.
No other behavior change: all touched Run* entrypoints still skip by
name under Phase 0's all-nil fixtures on every leg (confirmed via
TestVersionedHistoryPhase0RunsInFullSkipMode and
TestEveryLegWiresEveryRoleContract), no new dependency, no scope beyond
the reviewer's named findings.
* feat: green — Review round 3: Phase 0 conformance suite (nil-hook logging, retained-bounds assertion, stale comment) - gastownhall/beads#6147 (refs be-gw08e)
bee-ghosttrack round-2 review (2026-09-03T01:03Z, MERGE-AFTER-FIXES):
- cross_record_invariant_contract.go:158,178 — log which half of the
atomicity read-back goes unverified when CountHistoryForSubject is nil,
matching the file's existing skip-by-name convention (:327-328).
- retention_epoch_contract.go:511 — RunAHoldPreventsRemovalAndReportsInRetainedBounds
asserted both RetainedWindow bounds equal the held Address, on the
assumption nothing else was ever minted in this store. That assumption
doesn't hold: IssuePrefix is a static per-package string
(internal/storage/uow/retention_epoch_contract_test.go:17), not
randomized per run, so a persistent backend's second run would fail
this for the wrong reason. Weakened to at-least-one-bound.
- retention_epoch_contract.go:60-61 — fixed a stale "those two cases
still use" comment; retentionAddress's own doc comment already names
RunAStoreWithNoLineageKnowledgeAnswersUnknownNotGone as sole caller.
PR body's choice-vs-transcription callout table updated separately
(ten -> eight rows; the R20-h2 and R20-baseline rows described choices
this same review round already marked DIED in source).
* test(feat): red — Implement Phase 2 dual-write history behind flag - gastownhall/beads#6135 (refs be-0uifx)
* feat: green — Implement Phase 2 dual-write history behind flag - gastownhall/beads#6135 (refs be-0uifx)
* test(issueops): red — Phase 2 dual-write: re-seat builder/be-0uifx onto the merged base + add attribution_status (§16.4) — preempt the known review bounce (refs be-v33pa)
* fix(issueops): green — Phase 2 dual-write: re-seat builder/be-0uifx onto the merged base + add attribution_status (§16.4) — preempt the known review bounce (refs be-v33pa)
Migration 0068 step 6 only (VARCHAR(20) NOT NULL on issue_versions);
RecordVersionInTx derives it from the actor string it already receives
via attributionStatusForActor (non-empty -> supplied, empty ->
undetermined; not_supplied/imported are schema-valid but unreached by
any of the 7 current call sites). CLI-bundle direct-DDL override added
per dolthub/dolt#11345. Two pre-existing raw-SQL issue_versions
fixtures updated for the new NOT NULL column.
* chore(release-gates): add be-764ey deploy gate record (Phase 2 dual-write)
Factory release gate for be-764ey / gastownhall/beads#6135, PR #6358
(supersedes draft #6354). 7/7 PASS, no waivers — independent full-suite
run (97 packages ok, 0 FAIL, 0 SKIP), gofmt/vet clean, two pre-existing
non-blocking lint/policy findings attributed to be-2l6n8/be-xzg59.
* chore(ci): no-op commit to retrigger checks — code identical to 4179638; the macOS lane failed on runner disk I/O errors (see PR #6358 discussion)
* fix(history): attribution_status is claimed|unknown (BDP-aligned); document ordinals as local and the flag as single-writer-only
Per donnabox's review on #6358 items 1-3: align issue_versions.attribution_status to bdp#18's carried-attribution vocabulary (claimed | unknown), drop the unreachable not_supplied and the provenance-not-assertion imported; state that current_revision/revision are local ordinals and version_id is the only durable address; document VersionedHistoryConfigurer as single-writer-only until 0068 steps 1-3 land.
* fix(history): durable_state is LONGBLOB holding the RFC 8785 canonical form
Per donnabox's review on #6358 item 4: Dolt's JSON type renormalizes numbers, so a JSON column cannot keep the verbatim-bytes promise (R5.1) or back a content-derived token. Migration 0068 step 7 retypes issue_versions.durable_state to LONGBLOB (guarded PREPARE, CLI-bundle override extended), RecordVersionInTx stores the JCS canonical bytes of the marshalled issue so sha256(stored) is a stable token, and the all-migrations shape test pins longblob.
* build(nix): bump vendorHash for github.com/gowebpki/jcs v1.0.1
The JCS canonicalizer added on this branch changes go.sum, so the
fixed-output go-modules derivation hash moves.
Recomputed on the rebase onto main at 71c4cd08b. The merged module graph
is main's v1.3.0 dependency and toolchain bumps (#6047) plus this
branch's gowebpki/jcs v1.0.1, so neither side's pre-rebase hash applies:
main's was computed without jcs, and this branch's was computed against
the older dependency set. The value here was extracted from nix's own
hash-mismatch report and then verified by a clean nix build .#default.
* style(history): marshaled, not marshalled (misspell lint)
* fix(history): mint a version on every accepted issue-plane mutation, last in the transaction, on every leg
Per the write-path inventory on #6135 (donnabox's item 5 on #6358): the seam was reached from 3 of 57 journaled entry points. Close, reopen, claim, unclaim/release, lease reclaim, defer wake, label add/remove, promote and persistence moves now mint; update's label/parent patches and batch-create edges are applied before the mint so durable_state carries them; dependency add/remove mint at the lowest helper on all legs (uow and legacy verbs included) with the editor's duplicate call removed. version_completeness_test.go pins the set.
* docs(history): issue-plane write-path inventory with Phase 2 dispositions
The table donnabox asked for on #6358 (item 5), derived from the code rather than the design's count, with the dispositions that changed after a14f48b17 and the caveats that remain.
* docs(history): write-path doc: the seam has 27 call sites after a14f48b17, not "exactly six"
The sentence "is reached from exactly six call sites" described the tree at
321a79278 in the present tense, in a doc whose header already says those
rows changed after the completeness fix. It now scopes the six to that
commit and points at a new section listing the 27 sites (18 in issueops,
9 in domain/db) verified with grep over non-test files at d484b809d, with
the enclosing function for each. The "29 sites" figure quoted in the PR
thread was an over-count; 27 is the measured number.
The unchanged-re-import caveat now records that the journal seam sits in
the same position: RecordEventInTx(EventCreate) at create.go:207 runs on
every accepted upsert (only the events-table write behind the isNew gate
at create.go:171 is skipped), so a field-level no-op gate belongs in front
of both seams, not the version seam alone.
Doc only; no Go change.
* fix(history): seed store_epoch once per store, state the fail-closed canonicalization policy, and say single writer means one at a time
From bee-ghosttrack's round-1 review of #6358.
- store_epoch (nit): RecordVersionInTx ran INSERT IGNORE INTO store_epoch
on every mint, putting one shared row (id = 1) into every write
transaction's footprint. It now reads first and seeds only when the row
is absent, so the seed happens once per store. Same result, one fewer
write per versioned mutation.
- canonicalDurableState (MINOR-4): the comment now states the two
properties a hand-rolled canonicalizer would get wrong -- jcs.Transform
normalizes away encoding/json's HTML escaping, so the token is a function
of content, not of Go's escaping policy; and a snapshot that cannot be
canonicalized deliberately fails the mutation. Duplicate keys in an
issue's metadata (a json.RawMessage, reachable via bd sql or a hand-
written JSONL import) make the seam return an error with the flag on.
Fail-closed is the policy for now; normalizing first, or finding such rows
with bd doctor, is gastownhall/beads#6379 item 3.
- Single writer (MINOR-5): the constraint in version_history.go,
storage.go and the 0068 header now says one writer AT A TIME per store,
not merely one clone -- MAX(revision)+1 is not a safe allocator for two
concurrent transactions in one store either, and no contract case runs
concurrent writers. gastownhall/beads#6379 item 4.
- RecordVersionInTx doc (nit): IsWisp is Ephemeral || NoHistory, so a
promoted no-history bead is also never versioned; stated as what
no-history means rather than as an FR-8 wisp rule.
No behaviour change beyond the one fewer INSERT. Gates: gofmt, go build,
go vet, golangci-lint v2.10.1 (0 issues), issueops, the five embedded-Dolt
version suites, scripts/check-migration-hygiene.sh.
* docs(history): restate the write-path doc at this head; keep the 321a79278 inventory under a dated heading
bee-ghosttrack's MINOR-2 on #6358: the table and notes were written in
the present tense against 321a79278, so as merged the doc said close was
OUT OF CONTRACT and that no completeness test existed, beside the code
that ships both.
The doc now has two parts. "Dispositions at this head" carries a table of
every row whose disposition changed after a14f48b17 (rows 13-23, 25, 27,
34) with the mechanism and line for each, the counts at this head (21
VERSIONED, 13 OUT OF CONTRACT, 5 no-op gates), the deferred items, the
seam call sites, and notes that are true now. "As found at 321a79278" keeps
the original table and notes verbatim as the record of what the review
found, with a sentence saying which rows it no longer describes.
Also: row 13 now says wisp or promoted no-history bead (nit); the flag-off
sentence says behaviourally a no-op at the seam but not literally zero
added work (nit); the flag-on prerequisites point at gastownhall/beads#6379.
* test(history): a call passing mintVersion=false is not a minting edge (reviewer MINOR-1)
The versioned-history guard's fixpoint treated "textually calls
RecordVersionInTx, directly or transitively" as the mint predicate, so a
call to a helper with mintVersion=false still counted as a minting edge.
Reviewer Probe 2 on #6358 showed the consequence: deleting ExecuteUpdate's
own final `if changedAny { RecordVersionInTx(...) }` block left the whole
issueops package green, because the fixpoint credited ExecuteUpdate with
the mints of the very constituents it had told not to mint.
journalscan now records each function's parameter names and each call's
reduced argument list (bare identifier or literal per argument), and
exposes CallsOnlyWithLiteralFalse(fns, f, callee, gate): true only when
every call f makes to callee passes the predeclared false for callee's
parameter named gate. A call passing true, a variable, the caller's own
parameter, or too few arguments keeps its edge, as does a callee without
the parameter. Existing callers (IdentCalls, SelCalls, Fixpoint) are
unchanged; the resolve closure is merely lifted to a package function.
versionMintEdges drops the switched-off edges, and a new
TestCompositeMutationsCarryTheirOwnMint pins that ExecuteUpdate,
applyLabelPatch and applyParentPatch each call the seam themselves and
that none of their remaining edges reaches it.
Verified: full issueops package green on the unmodified tree. Probe 2
(delete ExecuteUpdate's final mint block) now fails
TestCompositeMutationsCarryTheirOwnMint, TestEveryVersionedEntryPointMints
and TestEveryBeadMutatorMintsOrIsExempt, all naming ExecuteUpdate; the
same probe against the previous guard stays green. Probe 1 (delete the
close mint) still fails TestEveryVersionedEntryPointMints and
TestEveryBeadMutatorMintsOrIsExempt naming CloseIssueInTx,
CloseIssueWithoutEventInTx, CloseIssueCheckedInTx and ExecuteClose. The
exemption tables are untouched.
* test(history): pin the uow leg's 1+N+M create divergence as a red-when-fixed test (reviewer MINOR-3)
TestDualWriteContract's Mutate closure creates an issue with no labels and
no dependencies, so its "exactly one version row per accepted mutation"
case cannot see what a fuller create does on the uow leg:
domain.IssueUseCase.CreateIssue inserts the row and then persists each
label and each edge through its own repository (domain/db label.go,
dependency.go), and every one of those writes reaches
issueops.RecordVersionInTx on its own. The direct legs mint exactly one
row for the same shape (CreateIssuesInTxWithContext mints once per issue
after the creation-time edges land).
TestUOWCreateWithLabelAndEdgeMintsPerRepositoryWrite_KnownDivergence
creates an issue through the uow leg with exactly one label and one
blocks edge and asserts the MEASURED count of issue_versions rows:
3 (1 issue + 1 label + 1 edge), matching the 1+N+M prediction. It also
checks the label and edge actually landed, and that the bare-shape target
seeded through the same leg holds exactly 1 row, so the two extra rows
are attributable to the label and the edge. A t.Log line and the doc
comment name the follow-up as gastownhall/beads#<FOLLOWUP-ISSUE> (to be
substituted before push) and state that the test is expected to FLIP to
1 when it lands.
The provider boot + flag enablement is lifted out of
newUOWDualWriteFixture into newUOWVersionedHistoryProvider so the new
test shares it; the existing contract cases and the fixture closures are
unchanged. Runs on the same backend and skips as its neighbours (a real
dolt sql-server, gated by testutil.RequireDoltBinary; no extra env
needed).
Verified: go test -count=1 -run 'TestDualWrite|TestUOWCreateWithLabelAndEdge' ./internal/storage/uow/ passes.
* test(history): pin canonicalDurableState to the RFC 8785 vectors, key order, HTML escapes and duplicate keys
TestCanonicalDurableStateIsJCS covered only number forms. It is now
table-driven over:
- the ten RFC 8785 test vectors that ship with github.com/gowebpki/jcs
v1.0.1 (Apache-2.0), copied verbatim to
internal/storage/issueops/testdata/jcs/{input,expected} with a README.md
recording their provenance (upstream's "output" directory is named
"expected" here because the repository's .gitignore drops any output/
tree); the count is pinned so an emptied directory cannot pass as a
vacuous table;
- a unicode/astral key-ordering case: {"b":1,"a":2,"é":3,"A":4,"😀":5}
canonicalizes to {"A":4,"a":2,"b":1,"é":3,"😀":5} (UTF-16 code-unit
order, so the astral key sorts after "é");
- an HTML-escape case: a string value <a>&"'</a> comes out as
"<a>&\"'</a>" with no <-style escaping, plus a companion subtest
proving plain json.Marshal DOES emit </& so the normalization
is demonstrably jcs.Transform's work;
- a fixed-point check, canonical(canonical(x)) == canonical(x), for every
table case;
- a duplicate-key input {"k":1,"k":2}, which must fail with an error
containing "Duplicate key" rather than store whichever value wins.
The existing number-form assertions are kept as they were.
Verified: go test -count=1 -run 'CanonicalDurableState' ./internal/storage/issueops/ passes (16 subtests).
* ci: no-op retrigger after a known flake in internal/metrics
Run 34173415291 on 0645e7827 failed only TestStartDetachedReapsExitedChild
("child pid became a zombie; startDetached did not reap"), the residual
child-process reap race tracked as beads be-w5rdt; #5933's fix is already
on this branch. Nothing in this PR touches internal/metrics. Empty commit
to re-run CI, since the PR author cannot re-run jobs in this repository.
* ci: no-op retrigger after a package-level timeout in the differential regression lane
Run 34174581104 on d81157b7d: 124 of 125 checks green; "Differential
Regression (v0.49.6 baseline)" panicked with "test timed out after 20m0s"
in the middle of TestRapidLabelAddRemoveStability, after the earlier
scenarios in the same package ran at several times their d484b809d
durations (TestListAllOverridesLimitWithLabel 87.9s; the whole lane took
11m0s on d484b809d). The regression suite never enables versioned history,
so nothing in this PR is on its path. Empty commit to re-run CI.
* docs(history): drop the stale head sha from the current-part heading; cite the seam by function, not line (bee round 2)
* test(history): make the mintVersion=false guard's claims exact (shadowed false, ambiguous names, method constituents)
Three reviewer nits on the versioned-history completeness guard
(gastownhall/beads#6358), each closing a gap between what the guard
claimed and what it checked. Detection is only ever strengthened.
Shadowed false. CallsOnlyWithLiteralFalse matched the NAME false, and
Go lets a local, a parameter or a package-level declaration take that
name, so a shadow read as a switch-off. journalscan now reads a false
or true as the predeclared identifier only when the parser's per-file
resolution (ParsePackage's mode 0, now pinned) attaches no declaration
to it AND no file of the package declares the name at package level
(per-file resolution cannot see the cross-file case; ParsePackage folds
each file's package scope in). Any shadow reduces to "", an unknown
expression, so the edge stays live. TestFalseIsNotShadowedInIssueops
independently walks every declaration position in issueops (test files
included) and fails on any true/false, so the reading is exact there,
not merely conservative.
Ambiguous names. Resolution is name-based, so a literal-false call to a
name shared by a gated function and an ungated one dropped the
fixpoint's edge to both. Resolve's semantics are unchanged;
TestLiteralFalseCalleesResolveUnambiguously requires every callee of a
mintVersion=false call to resolve to one function or to only functions
that declare the gate, naming the ambiguous name otherwise.
Method constituents. TestCompositeMutationsCarryTheirOwnMint looked up
mints[callee] by bare name while the fixpoint keys methods Recv.Name,
so that half only bit for free functions. The check now resolves each
live edge through the scanner's own Resolve (exported for this, with a
stable order); TestCompositeCheckSeesMethodConstituents proves it on a
synthetic package whose constituent is a method.
Reviewer probes re-run: deleting the close mint, deleting
ExecuteUpdate's final mint block, and flipping its
moveIssuePersistenceInTx call to mintVersion=true each still fail the
guard.
* chore: remove leaked internal release-gate docs from PR branch
release-gates/be-764ey-gate.md
release-gates/be-e0w8y-phase0-conformance-suite-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
* test(feat): red — same-type dep re-add double-journals (refs be-58eip)
Adds bd_events_journal assertions to the existing SameTypeReAddIsIdempotent
and RemoveIsIdempotent conformance cases, across all three DependencyEditor
backends (dolt, embeddeddolt, uow). The journal has no deduplication of its
own, so a same-type re-add that gates on TYPE alone (never the stored
metadata VALUE) journals a dep_add that never happened — RED on all three
legs today. The remove side already holds (confirmatory pin).
Refs gastownhall/beads#5898, #6358.
* fix(feat): green — same-type dep re-add is a true no-op when metadata is unchanged (refs be-58eip)
addDependencyInTx (embedded/proxied-server legs) and the uow leg's
DependencySQLRepository.Insert both gated the same-type re-add branch on
TYPE equality alone, so a duplicate add with identical metadata still
rewrote the metadata column and journaled a dep_add via
RecordDepEventInTx even though nothing changed. Both now also compare the
existing stored metadata against the requested value: identical metadata
returns immediately with no write and no journal entry, and only a genuine
metadata change still updates the row and journals the replacement edge.
Makes RunDependencyEditorSameTypeReAddIsIdempotent green on all three
DependencyEditor backends (dolt, embeddeddolt, uow); full contract suites
and TestEventsJournal_UOWDependencySnapshotsFollowBlockedState (a real
metadata change must still journal) remain green.
Refs gastownhall/beads#5898, #6358.
* test(feat): red — same-type dep re-add with changed metadata leaves it unminted (refs be-ejoty, #5898 leg 2)
Round-1 review on be-58eip found leg 2 of #5898 comment 5561794917
unimplemented, not merely untested: a same-type dependency re-add whose
metadata actually changed is a real durable-state mutation of the source
issue, so it must mint exactly one version — but neither backend's
same-type branch called the mint seam, and no test in the suite
constructed the changed-metadata case (RunDependencyEditorSameTypeReAddIsIdempotent
reuses one identical request for both calls, so existingMetadata==metadata
on every run).
Adds RunDependencyEditorSameTypeReAddWithChangedMetadataMintsOneVersion,
driven through fixture.AddDependency (the role's own DependencyEdge
carries no metadata field). Reads issue_versions directly via a new
SetVersionedHistoryEnabled fixture hook rather than CountHistory/dolt_log:
AddDependency writes through the backend's raw store path, and on at
least one backend only the role's own transaction wrapper issues the
version-control commit CountHistory observes.
Currently red: the production same-type branches update the row and
journal the replacement edge, then return without minting.
* fix(feat): green — same-type dep re-add mints one version when metadata actually changed (refs be-ejoty, #5898 leg 2)
Completes #5898 comment 5561794917's leg 2. A same-type re-add that
changes metadata is a real durable-state mutation of the source issue,
so it mints on the same terms as a genuinely new edge — only a
change-free re-add (identical type and metadata) mints nothing.
addDependencyInTx's same-type branch (dolt/embeddeddolt shared path)
now calls the existing mintDependencyVersion seam after journaling the
replacement edge. dependencySQLRepositoryImpl.Insert (uow/domain
backend) now calls issueops.RecordVersionInTx at the equivalent point.
Without this, any caller that sets non-default dep.Metadata (e.g.
types.NewWaitsForDependency's gate JSON, used by graph-plan apply and
batch_apply.go) re-adding the same (issue,target,type) pair with a
different gate value would silently rewrite it with zero version-history
trail.
* fix(deps): canonicalize both sides of the change-free re-add gate
Maintainer review fixup for #6650.
The change-free re-add gate compared the caller's raw metadata string
against bytes read back out of a native JSON column. Dolt renormalizes
what it stores -- spacing, key order, number form -- so a semantically
identical re-add was misclassified as "changed": it journaled a false
dep_add replacement entry (the #5898 R3 defect this PR exists to
remove) and, new versus base, minted a version row on a path base never
minted on. The no-op held only for metadata already in Dolt-normal
form, which is not the form hand-authored or struct-marshaled metadata
arrives in.
Both gate sites now compare through issueops.DependencyMetadataEqual
(RFC 8785 / JCS), falling back to a byte compare when either side does
not parse. The widened SELECTs also scan metadata via sql.NullString
and read SQL-NULL as "{}", so a row carrying an explicit NULL -- the
column is nullable -- stays idempotent instead of hard-failing with
"converting NULL to string is unsupported" on a path base handled fine.
RunDependencyEditorSameTypeReAddWithIdenticalMetadataIsANoOp covers the
boundary the four-leg matrix never exercised, identical NON-EMPTY
metadata, in two sub-cases: the compact spelling the caller already
sent, and the same fields with their keys reordered. Wired on all three
backends. Red before this commit on both write planes -- embedded dolt
fails both sub-cases, because the renormalization happens on storage
and breaks even byte-identical caller input, and the uow/serve-mode
plane fails ReorderedKeys. Unit pins for the comparison rule and for
the NULL scan live in issueops/dependencies_test.go, and the serve-mode
scan has its own sqlmock twin in
domain/db/dependency_null_metadata_test.go, so reverting either plane's
scan has something red to catch it rather than only one of the two.
Every production and conformance hunk here is byte-identical to stacked
successor #6693, which implements the same repair, so folding it in
leaves that PR a clean drop rather than a conflict to adjudicate.
Addresses review findings 1 (major), 2 and 3 (minor), plus the
iteration-2 test-evidence minor: the NULL repair landed on two planes
but was pinned on one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* docs: add beady-eye to community tools
* docs: add beady-eye to community tools
* docs: add beady-eye to community tools
* docs: add beady-eye to community tools
* docs: add beady-eye to community tools
* docs: add beady-eye to community tools
A shared container exit was failing every later tracker test, and a local dolt that never listened failed its uow open the same way.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(doctor,doltserver): escape SHOW DATABASES identifiers at raw-interpolation sites
Three call sites interpolated a SHOW DATABASES-derived name into SQL without
doubling backticks, so a database name containing a backtick could break out
of the identifier quoting:
- cmd/bd/doctor/dolt.go probeForCorrectDatabase (issues probe)
- internal/doltserver/doltserver.go flush routine (dolt_status probe and USE)
Extract each query into a small helper (issuesProbeQuery, doltStatusQuery,
useDatabaseStatement) that applies the same escape already used by
inspectServerMetadataDatabases, and unit-test them without a live Dolt server.
Fixes#6434
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(doctor): escape the bd doctor --fix probe via a shared doltutil helper
Maintainer review fixes for PR #6638 (review iterations 1 and 2).
The review's one major (Change Impact / Blast Radius) is that the PR
escapes three of four identical SHOW DATABASES interpolation sites.
probeForCorrectDoltDatabase (cmd/bd/doctor/fix/metadata.go) is a
near-line-for-line clone of the probeForCorrectDatabase this PR fixed --
same enumeration, same system-DB skip map, same testdb_/doctest_/
doctortest_ prefix filter, byte-identical query string -- and the two are
the check and fix halves of one GH#2160 wrong-database repair. So after
this PR "bd doctor" detects a backticked database and emits
"Fix: Run 'bd doctor --fix' to set dolt_database=X", while "bd doctor
--fix" reaches the still-raw twin, whose SELECT errors, yielding
correctDB == "" and a bare return nil: no fix, no error, no output. The
PR turned a consistent double failure into a repair tool that tells the
user to run a command that silently does nothing.
Take the review's preferred single remedy, which also closes the
Architectural Consistency minor: land one exported
doltutil.QuoteIdentifier and route every site through it.
internal/storage/doltutil was already imported by the affected packages
(cmd/bd/doctor, cmd/bd/doctor/fix, internal/doltserver), so only cmd/bd
gains an import edge.
- new doltutil.QuoteIdentifier, returning the backtick-quoted form so
quoting and escaping cannot be applied separately; unit-tested for
plain, empty, embedded/leading backtick, and backtick-only names
- route all five hand-inlined backtick-doubling copies through it: the
three builders this PR added, the pre-existing DROP DATABASE in
cmd/bd/dolt_clean_databases.go, and inspectServerMetadataDatabases.
Non-test inline copies go from five to one -- the helper itself
- drop the surviving //nolint:gosec rationale "dbName from SHOW
DATABASES, not user input" at fix/metadata.go, which documented as
safe exactly the premise this PR exists to refute
- pin the call site, not only the builder: a sqlmock test asserts
probeForCorrectDoltDatabase issues the escaped query. Reverting the
escape fails it with probeForCorrectDoltDatabase() = "", the silent
no-op described above, while the plain-name case stays green
Left raw deliberately, as both review lanes concluded: doltserver.go's
CREATE DATABASE takes the constant GlobalDatabaseName, and the raw USE in
internal/testutil takes test-controlled names.
Review iteration 2 found no blocker or major. Its one minor is that the
consolidation re-created the ambiguity it removed, one level up: the repo
already exported a QuoteIdentifier in internal/storage/domain/db with the
opposite contract -- allowlist-based, returns an error, rejects anything
outside validIdentifier -- whose docstring claimed to be "the one place
this repository's identifiers are quoted", a sentence the new helper
falsified while staking a competing near-universal claim of its own.
- rename doltutil.QuoteIdentifier to QuoteIdentifierUnvalidated, and have
both docstrings state their input class and cross-reference the other:
db.QuoteIdentifier for bd-minted names that must satisfy the allowlist
before the database or table is addressed, the doltutil helper for
server-reported names bd does not control. The escape-over-reject
behavior does not change -- rejecting a SHOW DATABASES name would skip
the candidate, which is the defect this PR exists to fix. The new name
also keeps Quote, so callers do not re-wrap an already-quoted result
- scope the helper's "every identifier that is not a compile-time constant
or already validated" rule to non-test code: internal/testutil still
interpolates raw, on test-controlled names, and has no non-test importer
- pin dropStaleDatabases (cmd/bd/dolt_clean_databases.go), the one
destructive statement in the set. versioncontrolops.DBConn is already a
parameter there, so a recording fake needs no server and no sqlmock, and
the test is tagless where the sibling file is cgo-gated. Reverting that
call site to raw interpolation fails it with
"DROP DATABASE `evil`; DROP TABLE x`" -- the injected statement escaping
the identifier -- while the plain-name statement stays byte-identical
The remaining unpinned site, inspectServerMetadataDatabases, opens its own
*sql.DB inside openServerCatalogDB, so pinning it needs a production seam
rather than a test. It was already correctly escaped before this PR and is
unchanged by it; left as reviewer-noted follow-up, as is nolintlint, which
.golangci.yml still disables.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(doctor): don't flag shared-server global database as phantom
checkPhantomDatabases flagged any beads_*/*_beads database other than the
primary one, so a shared-server workspace's own global_dolt_database
(beads_global) was reported as a phantom on every run. Skip
GetGlobalDoltDatabase() alongside the configured database.
Fixes#6599
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(doctor): resolve the shared-server global DB without the init stamp
Maintainer review round 1 on PR #6634 (2 majors, 1 minor).
Major 1 - the skip arm only reached workspaces stamped by `bd init`.
GetGlobalDoltDatabase() is a raw field read with no default, and
cmd/bd/init.go:1705 is its only writer, gated on shared-server mode, with no
back-fill anywhere in the tree. Existing checkouts - initialized before the
field existed, or initialized per-project and later attached to a shared
server - still had globalDB == "" and kept reporting beads_global as a
phantom: exactly GH#6599, with a suggested remedy ("restart the server") that
can never clear a deliberately created database. resolveGlobalDoltDatabase()
now falls back to doltserver.GlobalDatabaseName when shared-server mode is
active. The fallback stays mode-gated rather than unconditional so a stray
beads_global on an *unstamped* per-project workspace is still reported;
_GlobalDBNoStampPerProject pins that arm. The stamp is read ahead of the mode
gate, so a workspace stamped under shared-server mode keeps skipping
beads_global after that mode is turned off. That is deliberate rather than an
oversight: cmd/bd/init.go:1705 writes the same constant the fallback returns, so
stamp and fallback can only diverge on a hand-edited metadata.json.
Major 2 - TestCheckPhantomDatabases_GlobalDBNotPhantom asserted aggregate
StatusOK without sweeping first, and the shared test container is bootstrapped
with a beads_test database. Reproduced before the fix: `go test -run
'TestCheckPhantomDatabases_GlobalDBNotPhantom$' ./cmd/bd/doctor/` failed
deterministically with "1 phantom database(s) detected: beads_test". It was
green in package runs only because _OK precedes it in source order and sweeps.
It now sweeps like _OK/_NilConfig and asserts containment on beads_global,
which no sibling database can perturb.
Minor - probeForCorrectDatabase, the adjacent exit of the same fix, could still
return beads_global as "the correct database" for a project whose own database
is missing. It reuses the same resolver for its skip map.
Evidence: with the contributor's dolt.go grafted back under the new tests,
_GlobalDBNoStamp fails with "1 phantom database(s) detected: beads_global" and
_SkipsGlobalDB fails with probeForCorrectDatabase returning "beads_global", so
both new pins discriminate rather than pass vacuously. All 9 phantom/probe
tests pass in the package run, under `-run` isolation, and with `-shuffle=on`;
the full ./cmd/bd/doctor failure set is identical to the contributor HEAD
(7 pre-existing env-sensitive reds).
Review round 2 found no gating issues. It did note that every pin above is in
a //go:build cgo file that skips without a reachable Dolt container, so the
resolver had no coverage in the CGO_ENABLED=0 lane. TestResolveGlobalDoltDatabase
in the tagless dolt_test.go now pins all four arms - stamp precedence, the
unstamped and nil-config fallbacks, and the per-project empty resolution - with
no server and no skip (0.00s). Mutation-proved both ways: the contributor's
stamp-only read reddens exactly the two fallback arms, and moving the mode gate
ahead of the stamp read reddens exactly the stamp arm.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* test(feat): red — bd migrate schema advances schema_migrations before refusing an identity mismatch (refs be-0gfcs)
validateWorkspaceIdentity runs after the shared pre-run has already opened
the store and let the smart gate auto-apply a pending schema migration.
The refusal (exit 1, mismatch message) is correct but arrives too late:
schema_migrations has already advanced. New embedded-mode CLI integration
test reproduces this by regressing schema_migrations one version and
corrupting _project_id, then asserting the cursor is unchanged after a
refused `bd migrate schema` -- it currently is not.
* feat: green — bd migrate schema applies migrations BEFORE the workspace identity check refuses — the guard cannot prevent what it is guarding against (refs be-0gfcs)
* test(feat): red — Review: bd migrate schema applies migrations BEFORE the workspace identity check refuses — the guard cannot prevent what it is guarding against (refs be-3bt2e)
* feat: green — Review: bd migrate schema applies migrations BEFORE the workspace identity check refuses — the guard cannot prevent what it is guarding against (refs be-3bt2e)
* fix(main): render typed open errors from the identity gate's refusal arm
Maintainer review fixup for PR #6674 (adopt-pr iteration 1). Synthesis decision
is request_changes with two majors and several non-gating minors.
MAJOR 1 (fixed) — the gate's `default:` arm refused with a bare HandleError, so
every typed open error the PREVIEW hits was reported as this gate's generic
wrapper. That is two regressions against base, where the same classes surfaced
from the real open and were rendered properly:
(a) `bd --json` exited 1 with unstructured stderr and NO JSON body — a machine
contract break for every JSON consumer;
(b) the appended `BEADS_SKIP_IDENTITY_CHECK=1` hint is actively wrong for those
classes, since skipping the gate leaves the real open failing identically.
It matters most for schema skew: the preview runs CheckForwardDrift, so the
recurring stale-binary class (#4135/#4137) now fails the preview first, and
SchemaSkewError.UserMessage()'s actionable rebuild block was being replaced by a
generic line plus a dead-end hint. handleFreshCloneError, RemoteMigrateGateError
and the server-mode projectIdentityMismatchError refusal were bypassed the same
way.
The arm now mirrors the real-open arm — handleFreshCloneError, then
renderTypedOpenError — before falling back to HandleErrorRespectJSON, so --json
callers still get a structured body, and the override hint now lives only on the
generic arm and says what it actually does. Extracted as
refuseUnverifiablePreviewOpen so both halves are testable without standing up a
forward-drifted workspace.
Pinned by TestRefuseUnverifiablePreviewOpenRendersTypedErrors: a skew keeps its
own UX and does NOT advertise the override; a skew under --json emits a
schema_skew body with current/required/delta; a preview-specific error keeps the
generic message, keeps the override hint, and still emits a JSON body. Proven
non-vacuous — restoring the pre-fix shape (typed renderers bypassed) fails it.
Note the two arms write their JSON to different streams (handleSchemaSkewJSON to
stderr, HandleErrorRespectJSON to stdout); that split is pre-existing and the
test documents rather than changes it.
MAJOR 2 (deliberately not fixed here; filed with a measurement as mc-wbso0) —
the gate is unscoped, and server mode already had the pre-migration identity
guarantee (dolt/store.go:2030-2062 runs verifyProjectIdentity before initSchema
at :2067). The reviewer offered scoping OR, explicitly, "keep the gate
unconditional, fix Finding 1, and file the duplicate-open cost as a tracked
follow-up with a measurement — not to leave both unaddressed". Taking the
sanctioned alternative, because scoping carries two caveats neither reviewer
priced (server-mode verification is itself conditional on
`!cfg.CreateIfMissing || dbFacts.alreadyExisted`; gateway server mode is
deliberately excluded from identity enforcement) and it changes hot-path startup
behavior for every write command — not a change to guess at mid-adoption.
Measured rather than asserted, on a healthy embedded workspace (ambient beads env
unset, 2 warmup runs discarded, 8 runs of `bd config set` each way):
WITH gate median 0.329s (mean 0.332, 0.317-0.362)
WITHOUT gate median 0.290s (mean 0.292, 0.277-0.314)
=> +39ms, +14% of un-gated startup, spreads non-overlapping.
That number is in mc-wbso0 along with both caveats.
Also took one non-gating minor while in the file: the refusal test saved the
`store` global but never zeroed it, so its closing `store != nil` assertion could
pass or fail on a leftover from an earlier test. `store = nil` added.
Validation: git diff --check clean; gofmt clean; go build ./... clean;
go vet ./cmd/bd/ clean; golangci-lint v2.10.1 (pr.yml's pin) 0 issues; the gate's
full test surface under CI's own flags (-tags gms_pure_go -race -short) 13 PASS
0 FAIL 0 SKIP, with no shared-TMPDIR sweep damage.
ITERATION 2 — synthesis and scorecard both `approve`, `Required Changes: None`,
four minors. Took all four; none is a merge gate, and the fixup commit already
exists so none of them costs an extra push.
1. The doc comment on refuseUnverifiablePreviewOpen overstated its own coverage:
it named four typed classes as "rendered exactly as the real-open arm renders
them", but only schema skew can actually arrive typed from a preview. Verified
each claim before rewriting the comment rather than trusting the review:
handleFreshCloneError matches a post-migration string (`main_errors.go`) a
non-mutating preview never produces, and both CheckRemoteMigrateGate* call
sites (`embeddeddolt/store.go:442`, `dolt/store.go:3073`) are on mutating
opens, never openReadOnly. projectIdentityMismatchError is a plain fmt.Errorf
with no typed wrapper, so it falls to the generic arm and picks up its prefix
— which matches base, where it reached the operator inside the real arm's
"failed to open database: %v" wrapper. The comment now says that, names the
other two calls as defensive-for-symmetry with the reason each cannot fire,
and flags that handleFreshCloneError ignores jsonOutput, so making it
reachable would break the --json guarantee this fix established.
2. Pinned the preview→skew WIRE, not just the renderer.
TestRefuseUnverifiablePreviewOpenRendersTypedErrors hand-builds a
SchemaSkewError, so it could stay green while a change to the preview's drift
check moved skew back onto the generic arm — the durability gap that mattered
most, since the wire is this fix's whole premise. New
TestIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace bootstraps a real
embedded workspace, stages one schema_migrations row above the binary's
latest, and drives rootCmd.PersistentPreRunE end to end, asserting the skew UX
arrives and the generic identity wrapper does not. Reuses the package's
existing withEmbeddedMigrateSQL helper. Counterfactual run: restoring the
pre-fix bare-HandleError arm reds it on exactly the three regression
assertions, printing the original bug verbatim (generic wrapper swallowing the
rebuild block, plus the dead-end BEADS_SKIP_IDENTITY_CHECK hint) at a real
measured v68-vs-v67 drift.
3. Re-filed the MAJOR 2 tracking artifact as bd-ocmut in the beads rig store and
closed mc-wbso0 as superseded. The body was complete and correct; only the
routing was wrong — the finding is about beads repo code (cmd/bd), and
beads-code PR follow-ups are triaged from the beads rig store, not
maintainer-city. Also added a maintainer-notes section to the PR body carrying
the deferral, the +39ms measurement and the bd-ocmut pointer, so the condition
the deferral rests on is discoverable in-band rather than only out-of-band.
4. isBootstrapPreviewErr breadth is now explicitly on the deferral list below; it
had been dropped from it without acknowledgment, which is how a checklist item
vanishes at finalize.
Tracked remainder, deliberately deferred (all non-gating across both iterations):
- isBootstrapPreviewErr is still bare errors.Is(err, os.ErrNotExist), so it
accepts any ENOENT-wrapped dial failure, not just "no database directory";
its table test pins only a fabricated negative. Message-contract weakening,
not a safety hole, and no in-tree backend registers.
- a non-nil fake for TestValidateWorkspaceIdentity_NonexistentDir
- the nil-guard precondition on validateWorkspaceIdentity's doc comment
- the embedded-tier-only reproduction pins now noted in the PR body
Validation (iteration 2): gofmt clean; go build ./... clean; go vet ./cmd/bd/
clean; CGO_ENABLED=0 go vet -tags gms_pure_go ./cmd/bd/ clean (the new file is
cgo-tagged, so the no-cgo lane must still compile); golangci-lint v2.10.1
(pr.yml's pin) 0 issues; git diff --check clean. Gate surface run per-test to
avoid shared-rootCmd batch false-reds: 13 PASS 0 FAIL under CI's own flags (-tags
gms_pure_go -race -short), and the 3 embedded-tier tests all PASS with
BEADS_TEST_EMBEDDED_DOLT=1 (new pin 5.3s, fresh-workspace 4.0s, migrate-order
25.2s) — no silent skips.
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(init): validate a supplied destroy-token even when interactive
CheckRemoteSafety only compared --destroy-token for non-interactive
callers. handleRemoteSafetyDecision only shows the typed-confirmation
prompt when no token was supplied. An interactive
`bd init --discard-remote --destroy-token=WRONG` therefore satisfied
neither guard and discarded remote Dolt history with no confirmation.
Validate any non-empty token regardless of interactivity; an absent
token still defers to the TTY prompt. Adds guard-matrix cases for the
interactive wrong-token, token-without-expected, matching-token and
no-token paths.
Fixes#6480
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* review: distinguish a wrong destroy-token from a missing one
Maintainer fixup for the #6639 review (iteration 1: no blockers, no
majors, scorecard approve). Takes the three non-gating minors and the nit
that live in the file this PR already changes.
1. Debuggability (claude+codex, minor). Making CheckRemoteSafety validate
a supplied token newly routes interactive callers into
refusalMessageTokenMissing(), whose text is written for the
non-interactive path: it says "requires an explicit destroy-token in
non-interactive mode" and advises "re-run interactively ... and confirm
at the prompt". That advice cannot work for them -- the prompt at
init.go:3139 is gated on destroyToken == "" -- so a user who typo'd a
token re-runs into the identical exit 12 forever.
A reword could only make the one string vaguer, so token PRESENCE is
now carried into the decision: refusalMessageTokenMismatch() for a
supplied-but-wrong token (reachable in both modes; its remedy is to fix
the token or drop the flag to be prompted), and the existing message,
byte-for-byte unchanged, for the no-token case. That case is now
reachable only non-interactively, so its "non-interactive mode" framing
and its prompt advice are both exactly true again -- and
docs/recovery/init-safety.md:96, which reproduces that text under
`init-token-missing`, stays accurate. Reason splits to
destroy-token-missing / destroy-token-mismatch (grep: no consumer; the
only Reason any caller reads is "authorized-divergence").
2. Contract fidelity (claude+codex, minor). The three doc comments that
now state the opposite of the code -- ActionRequireDestroyToken,
IsInteractive, and ExitDestroyTokenMissing's "all three sources" -- are
updated to the token-presence rule, matching the correct inline comment
this PR added at the change site. This file is the ADR-0002 chokepoint,
so its comments are the contract future flags are read against.
3. Test evidence (codex, minor). handleRemoteSafetyDecision had zero test
references repo-wide while the bug was the composition of the decision
with the prompt gate. TestHandleRemoteSafetyDecision_RefusalSeam pins
the refusal half: a refusal aborts with its exit code, never reaches
the prompt, and leaves the cross-checkpoint *confirmed latch alone.
The token-ABSENT prompt arm is deliberately NOT pinned: it is gated on
term.IsTerminal(os.Stdin), false under `go test`, so asserting "no
prompt" there would pass no matter what the token gate said. That half
needs a PTY or a TTY-detection seam; left as follow-up rather than
landing a vacuous pin for a coverage finding.
4. Nit: the token-without-expected matrix case is annotated defensive /
unreachable from current callers, so a later reader does not cite it as
live-path evidence.
Every new pin was proven non-vacuous by mutation, each hitting only its
own arm: forcing the selector back to the conflated message reddens the
three token-supplied cases and leaves no-token green; dropping
ActionRequireDestroyToken from the seam's case label reddens only the
exit-12 subtest; removing "drop --destroy-token" from the new message
reddens the remedy assertion.
Out of scope, deliberately: no change to docs/recovery/init-safety.md
(the string it documents is unchanged and its scenario still accurate; a
wrong-token symptom entry is follow-up), and no attempt at the
pre-existing asymmetry between the remote and local re-init guards.
Validation: go vet ./cmd/bd clean; the full init_safety_test.go suite
green at head (16 pass, 1 pre-existing unconditional skip).
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Authenticated server-mode remotes route through the Dolt CLI, but the subprocess only received DOLT_REMOTE_USER in its environment. Dolt requires the username as --user and otherwise authenticates as root.
Insert --user after the transfer subcommand for fetch, pull, and push while keeping the password environment-only. Add regression coverage for authenticated and credential-free commands.
Refs #5080
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Raphael Sobik
deleteIssueRowInTx, behind Transaction.DeleteIssue (bd mol burn) and
DeleteResolvedSetInTx, removed only the wisps row and the dependencies
edges, so on stores lacking the wisp aux FKs every deleted wisp orphaned
its wisp_labels, wisp_events, wisp_comments and wisp_child_counters rows.
#5343 fixed only the DoltStore wisp GC paths.
Move the aux table list and delete into issueops.DeleteWispAuxRowsInTx,
call it from deleteIssueRowInTx, and have the DoltStore paths use the same
helper so the table set cannot drift.
Forward-fix only: cleaning existing orphans needs a batched backfill and
is left to a follow-up. Sibling of #6563 (wisp_dependencies).
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(close): fail partial batch closes
Fixes#6648
* review: exit nonzero on proxied partial close, update tests and changelog
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* review: print close failure summary only for multi-id batches
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* review: machine-readable close failures, and adjudicate --claim-next
Maintainer fixup for the two major findings on #6740 (Beads #6648).
1. --claim-next x partial failure (major). --claim-next rides inside the
batch transaction and fires whenever something LANDED, so a mixed batch
claimed a fresh issue and then exited 1, with nothing in the diff, the
CHANGELOG or the tests saying so.
Adjudicated as "the claim stands and the report names it", not "the claim
is suppressed". Suppressing it at cmd/bd -- the site the review named --
cannot un-claim anything: ExecuteCloseBatch (and the uow provider's twin)
commit the claim alongside the survivors before the CLI ever sees a
refusal, so gating the report would only leave an issue assigned to the
actor with nothing on stdout or stderr saying so. Strictly worse than
announcing it. The claim is now named in the text summary and in the JSON
failure payload, so a caller that exits on the nonzero status can still
see what it owns.
The review's "unbounded claim leak -- another ready issue on every
attempt" does not hold, and the new test pins why: on a retry the survivor
is already closed, so `landed` is 0 and an empty batch earns no claim
(close_batch.go:146, uow/batch_closer.go:71). The leak is bounded at the
one claim the first run earned. The defect that remains -- a durable claim
the caller is never told about -- is what this fixes.
2. --json partial failure carried no machine-readable signal (major). The new
exit 1 left stdout as the success-shaped array of CLOSED issues and put
only human refusal prose on stderr, so a JSON consumer could not learn
WHICH ids failed without scraping it -- the exact fragility #6648 was filed
about, left in place for the callers most likely to batch. Both routes now
report through one reportCloseFailures helper modelled on bd update's
reportUpdateFailures: a compact {"error","failed":[{"id","error"}]} line on
stderr, stdout keeping the closed-issues array. That also removes the
summary hand-rolled twice with two denominators (the architectural nit).
Also taken, all non-gating and adjacent to the above:
- CHANGELOG narrowed to the refusals it actually covers, noting that an
UNRESOLVABLE id still aborts the direct route before any close runs while
the proxied route refuses it per-argument (the route-parity overclaim).
- Tests for the three deliberately-chosen behaviours that had no pin: the
--json partial failure (proxied), the --claim-next interaction above
(embedded, both failure channels), and the single-id summary suppression
that commit 97151ab8e exists solely to add -- asserted in
TestParityCloseNothingSettledExits1, which checked stdout but not stderr.
Contributor commits preserved; behaviour of the original fix is unchanged on
every route it already covered. Single-id stderr stays byte-identical.
Validated: go build ./..., go vet ./cmd/bd/..., TestParityClose family,
cmd/bd/protocol, TestEmbeddedClose close/claim-next subtests
(BEADS_TEST_EMBEDDED_DOLT=1), TestProxiedServerClose partial-failure subtests
(BEADS_TEST_PROXIED_SERVER=1), TestMultiIDUpdatePartialFailure.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Apply requested sort and reverse direction to tree roots and sibling groups while preserving dependency precedence.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of mhawthorne
TestNewTokenFileAuthRefusesAnUnusableFile/missing asserted the substring
"no such file", which is Unix-only wording; on native Windows the OS
reports "The system cannot find the file specified." and the test fails.
readTokenFile already wraps the open error with %w, so assert
errors.Is(err, fs.ErrNotExist) for that case and leave the other cases'
message checks alone.
Fixes#6543
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
`bd dep tree --format Mermaid` fell through silently to the plain-text
renderer because the mermaid check was a raw string comparison while the
json check two lines earlier already folds case. Extract the check into
isMermaidTreeFormat and use strings.EqualFold, matching json.
Refs #6339
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(embeddeddolt): shape lenient gate warnings (#6660)
Render decision-specific gate guidance for adopt, adopt-fast-forward, and fork-skew warnings while retaining the generic coordination block for decisionless refusals.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Rongjun GENG
* fix(embeddeddolt): terminate lenient gate warnings; pin composed output
Maintainer review fixups for #6662.
- Restore the trailing newline the const-extraction dropped from the two
non-data-behind arms. lenientSharedGateGuidance used to be the last thing
in those format strings; moving it into the body (rendered first) left
openWorkingSetReconcile ending at " schema." and openReadOnlyCommand at
" Writes are blocked until the schema is reconciled.", so the command's
own output was glued onto the warning. Every sibling emitter, in embedded
and in server mode, terminates.
- Extract the arm rendering into a pure lenientGateWarning(intent, gateErr)
so the COMPOSED warning is assertable, and pin newline termination across
every intent x gate shape. Nothing pinned the composed text before: the
helper tests see only the body, and the composed assertions in
remote_sync_gate_test.go are BEADS_TEST_EMBEDDED_DOLT-gated and
Contains-only, which is why the defect above shipped green.
- Cover the fourth non-empty Decision, shared-no-remote (#5920), in the
helper's table test.
- Correct the rationale comment: the blunt bullets are measurably wrong on
data-behind, but on the smart decisions they are redundant with -- and,
for the bd migrate --force bullet, contradicted by -- the shaped body.
For adopt/adopt-ff the bd bootstrap bullet is what userBody prescribes,
so "measurably wrong" there invited a future editor to restore them.
- Reflow the first sentence of lenientSharedGateGuidance, authored to
continue the previous line back when it was appended, now that it always
starts its own.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
TestEnvVarOverrides/BEADS_DOLT_PORT_fallback_when_SERVER_PORT_not_set
assumed BEADS_DOLT_SERVER_PORT was ambiently unset, which is false on
every Gas City agent session (ambient value observed: 28231). Add an
explicit t.Setenv(..., "") clear before setting the lower-priority var,
mirroring the same fix already landed for internal/doltserver (ce39cbc14).
Also clears BEADS_DOLT_PORT in the sibling "invalid port env var falls
through to config" subtest: GetDoltServerPort() falls through to
BEADS_DOLT_PORT when BEADS_DOLT_SERVER_PORT fails to parse, so that
subtest had the same latent ambient-blind exposure even though it
wasn't the one observed failing.
Host/User/Database env-var subtests in the same function were audited
and left unchanged: each of GetDoltServerHost/User/Database checks
exactly one env var with no secondary fallback var, so there is no
second variable for an ambient value to leak through.
* test(feat): red — Fix bd history 8-char hash truncation causing misleading AS OF errors (refs be-95c0y)
* feat: green — Fix bd history 8-char hash truncation causing misleading AS OF errors (refs be-95c0y)
* test(feat): red — Review: Fix bd history 8-char hash truncation causing misleading AS OF errors (refs be-3phh0)
* feat: green — narrow truncated-hash heuristic to 16-31 chars so it stops
false-positiving on real short branch names (round 2, refs be-3phh0)
Round 1's ^[0-9a-v]{1,31}$ heuristic rejected any 1-31 char ref drawn from
Dolt's hash alphabet, including real short branch names spelled entirely in
[0-9a-v] (e.g. "main"). That broke the pre-existing
internal/storage/dolt/dolt_test.go:TestValidateRef "valid hash"/"valid
branch" subtests, which this diff does not touch.
Raising the floor to 16 chars keeps the heuristic well clear of "main"(4) and
"abc123def456"(12) while still catching the strongest signal case (up to 31
chars, one short of a full 32-char hash). The original 8-char truncation
example no longer gets the specific error and falls back to Dolt's generic
"branch not found" -- an accepted, disclosed tradeoff since FIX A (bd history
now prints the full hash) already removed the only first-party source of an
8-char truncated hash in this codebase.
* fix(issueops): drop the truncated-hash rejection from ValidateRef (be-i5s9b)
Review feedback on #6730: ValidateRef is not the --as-of validator. It is
the shared ref guard for AS OF, dolt_diff, the fast-forward path
(LocalAheadBehind, FastForwardAdopt), CommitExists and federation sync
status, so a shape heuristic there rejects well-formed refs for every
caller, not just --as-of. ^[0-9a-v]{16,31}$ made ordinary 16-character
branch names such as "productionmirror", "releasecandidate" and
"integrationtests" invalid for AS OF, dolt_diff and the fast-forward path,
and made CommitExists return false for the hash prefixes it is documented
to accept.
With bd history now printing the full hash, the heuristic had almost
nothing left to catch, so it is removed rather than moved. as_of.go is
back to its pre-PR content, which also makes ValidateRef's doc comment
accurate again. The --as-of flag help still says a full 32-character hash
is required.
The tests for the dropped heuristic are replaced by a contract test:
ValidateRef must accept well-formed refs spelled entirely in Dolt's hash
alphabet, including the three branch names above. Against the previous
head it fails on those three and on two hash prefixes.
* test(feat): red — Fix TestTempDirRootsBoundTheOrphanArm under a /var/tmp-rooted TMPDIR without widening the orphan arm (fixes gate-tracker be-35sef) (refs be-n9ile)
* feat: green — Fix TestTempDirRootsBoundTheOrphanArm under a /var/tmp-rooted TMPDIR without widening the orphan arm (fixes gate-tracker be-35sef) (refs be-n9ile)
* fix(doltserver): bound the sandbox-home carve-out so /var/tmp stays out of the sweep roots
Adoption review of PR #6729, iteration 1 (major: Change Impact / Blast
Radius; minors: Test Evidence Quality, Contract & Interface Fidelity).
Adding /var/tmp to fixedTempRoots was bounded by a comment, not by code.
The comment's premise -- the table is never unioned into tempDirRoots()'s
own output -- is true but does not carry its conclusion, because
os.TempDir() CAN BE /var/tmp: under a bare TMPDIR=/var/tmp, mktemp -d
puts test-env.sh's sandbox HOME directly under the shared root, so
isSandboxHome spared /var/tmp itself as a sweep root and the deleted-cwd
arm came into range of every other user's dolt sql-server there. At head
before this commit: tempDirRoots() = [/var/tmp /tmp] and
underAnyRoot("/var/tmp/some-other-users-production-server/.beads/dolt")
= true; at base both were [/tmp] / false. PR-introduced, not
base-preexisting.
Enforce the claim instead of asserting it (synthesis remedy (b)):
isCredibleTempRoot now lets a sandbox HOME rescue a root NESTED inside a
fixed temp location but never one of those locations itself
(isSharedTempRoot / sharedTempRoots). The bound is scoped to the
carve-out, so a bare TMPDIR=/var/tmp with a real HOME elsewhere is judged
exactly as it was at base -- this narrows nothing reachable on Linux. It
does additionally stop a bare TMPDIR=/var/folders from being credited on
darwin, because sharedTempRoots derives from the whole fixedTempRoots
table: that is the same class of widening, the generalization is
deliberate (a future row is bounded by default), and the realistic macOS
shape -- TMPDIR=/var/folders/xx/yy/T, nested -- is unaffected and pinned
by the new platform table. /tmp is the deliberate opt-out:
tempDirRoots() hardcodes it into the candidate list, so excluding it
widens nothing, and including it would re-break the CI shape the
carve-out exists for (TestTempDirRootsRejectsOverbroadTMPDIR/"sandbox
HOME under /tmp keeps /tmp").
The subtest that claimed to pin the bound was vacuous: it pointed TMPDIR
at a /var/tmp SUBdirectory, the one case where the sibling was out of
range at base too, so it passed against base sweep.go. Replaced with the
bare TMPDIR=/var/tmp case, and folded the subdirectory assertion into the
subtest above it under a name that does not overclaim. Counterfactual:
dropping just the isSharedTempRoot arm turns the new subtest red, and it
is the ONLY one of the 39 sweep tests/subtests that fails -- including
all three subtests this PR originally shipped.
Corrected the comment at fixedTempRoots so the bound names its mechanism
and the degenerate bare-TMPDIR case instead of stating a false absolute.
Iteration 2 (nits only; no behavior change): renamed the pin subtest from
"a bare /var/tmp TMPDIR is never credited as a root" to "a sandbox HOME
never rescues bare /var/tmp as a root". The old name asserted an
unconditional invariant the code does not provide -- with a real HOME
elsewhere, bare /var/tmp IS still credited, at head exactly as at base,
since isCredibleTempRoot has only ever rejected roots that are or contain
the home. The new name scopes the claim to the carve-out the subtest
actually exercises. Counterfactual re-run after the rename: the same
single subtest is the only red.
Coverage bound, measured rather than assumed: this fix covers a TMPDIR
rooted UNDER /var/tmp, not a bare TMPDIR=/var/tmp. test-env.sh builds its
sandbox HOME one level under $TMPDIR and never reassigns TMPDIR, so a
host whose TMPDIR is literally /var/tmp still fails
TestTempDirRootsBoundTheOrphanArm at this head -- as it does at base. That
shape is unfixed scope, not a regression; the harness-side fix is to have
test-env.sh export TMPDIR="$root".
Validation: gofmt, go vet, and the full internal/doltserver sweep set
green (TestSandboxHome*, TestTempDirRoots*, TestIsCredibleTempRoot,
TestSelectOrphan*, TestSelectServersUnderSuiteRoots,
TestCanonicalRootsForSweep). The three package reds (TestDefaultConfig*,
TestResolveServerMode_HostInferredExternal) are the known
BEADS_DIR/BEADS_DOLT_* env-bleed cluster: green here with those vars
unset, red at base too, outside this diff's surface.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Write the effective 30-second default into proxied-server sidecars while preserving the never and explicit-duration values, so readers can interpret the file without bd internals.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Rongjun GENG
* feat: green — fix 36 raw dolt.New(&Config{Path}) test sites in cmd/bd silently skip (refs be-0k0dv)
Converts all 36 raw dolt.New(ctx, &dolt.Config{Path: ...}) call sites in
cmd/bd test files to the newTestStore/newTestStoreWithPrefix/
newTestStoreIsolatedDB helpers, which set CreateIfMissing: true. Without
this, missing databases caused t.Skipf("Dolt server not available") even
though the real cause was a missing DB, not a missing server — silently
hiding real coverage since 63418ae54's CreateIfMissing migration.
- cmd/bd/mol_test.go: 31 sites (26 -> newTestStore, 5 -> newTestStoreWithPrefix)
- cmd/bd/contributor_routing_e2e_test.go: 3 sites -> newTestStoreIsolatedDB
- cmd/bd/update_metadata_test.go: 1 site -> newTestStoreWithPrefix
- cmd/bd/rename_prefix_repair_test.go: 1 site -> newTestStore
Removed now-unused dolt imports where no other dolt.* usage remained in
file (mol_test.go, update_metadata_test.go, rename_prefix_repair_test.go).
contributor_routing_e2e_test.go keeps its dolt import — still used by
initProjectStore/initPlanningStore and struct fields outside the 36
converted sites.
* fix(test): finish contributor_routing_e2e_test.go's conversion; stop dbPath lying
Maintainer adoption fixup for PR #6679 (adoption review iteration 1).
contributor_routing_e2e_test.go converted 3 of its 7 raw
dolt.New(&dolt.Config{Path}) sites, leaving 4 — so one file carried two
different failure contracts for the same condition, and the harness that
backs most of the file's tests was still on the broken one. Convert the
remaining 4 to newTestStoreIsolatedDB: initProjectStore ("proj-"),
initPlanningStore ("plan-"), and the override/external stores in
TestExplicitRepoOverride ("over-") and TestBEADS_DIRPrecedence ("ext-").
Each replaced SetConfig(ctx, "issue_prefix", X) is reproduced by the
helper's prefix argument, and the co-located defer store.Close() calls go
with the sites the helper's t.Cleanup now covers.
Effect: 9 routing tests stop silently skipping. Before, at the contributor
head, TestContributorRoutingDirect / TestExplicitRepoOverride /
TestBEADS_DIRPrecedence all reported
skipping: Dolt server not available: database "testdb_…" not found
against a live Dolt container. After, all 12 test functions in the file
PASS with 0 skips under -tags integration,gms_pure_go.
rename_prefix_repair_test.go: drop the unused global dbPath save/set/restore.
newTestStore's shared-branch path writes a metadata.json naming the shared
database with no branch qualifier while the live store sits on a per-test
branch, so setting the global to testDBPath planted the reopen-by-path
hazard the helper's own doc comment warns about. repairPrefixes takes the
store explicitly and never reopens by path, so the assignment was dead
weight pointing somewhere wrong; the comment now records why it is absent.
Remaining out of scope (tracked for follow-up): 10 raw sites in config_test.go,
sql_test.go, cli_coverage_show_test.go, rename_prefix_test.go, migrate_test.go,
and mol_ready_gated_test.go.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
--watch forces the pretty listing and returns into the watch loop before
the --format branch, so on the direct route `bd list --watch --format X`
printed the pretty listing and never mentioned the ignored template. The
proxied route already refused the combination in runListProxiedWatch.
The refusal now lives in gatherListInput, next to the existing --watch /
--brief refusal and ahead of the route split, so both routes give the same
usage error. The proxied-only guard is unreachable now and is removed, and
its integration test expects the shared message.
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>
* ci(proxied-cmd): green — give the proxied-shard job its own step timeout, refresh manifest (refs be-bruke)
The job-level timeout-minutes was the only backstop for the "Test
proxied-server cmd shard" step, and it counts the "Download binaries"
step too — so a slow download alone could exhaust the job budget and
kill an otherwise-healthy shard's test run with no way to tell the two
failure modes apart. Give the test step its own 16m timeout inside the
existing 30m job budget, and regenerate the bin-packed shard manifest
via scripts/ci/gen_proxied_shard_manifest.py so it stays in sync with
the current TestProxiedServer* set (0 drift, all 15 shards fallback:0).
* ci(proxied-cmd): mirror the shard timeouts onto the main lane, regen the manifest at the adoption base
Adoption review of #6689, iteration 1 — three minor findings, applied here
rather than deferred.
main.yml's `test-proxied-cmd` is the same job as pr-risk.yml's twin — same
proxied-test-shard.sh, same manifest, same total 15 — behind a
download/verify step inside a 20m budget with no step timeout, so the exact
ambiguous-timeout failure mode this PR removes from the PR lane survived on
the post-merge lane, which is where triage happens with nobody watching.
Mirror both edits (job 20m -> 30m, step 16m) and record the ordering at the
step, since it is not obvious from the site that 16m is deliberately below
the script's own -test.timeout=15m plus setup.
The manifest's only record of the cost proxy's two known blind spots lived
in a hand-written comment block the regeneration deleted:
TestProxiedServerListSortRetiresTheWalk seeds 1400 rows and walks the
listing three ways off a single init, and TestProxiedServerServeReadParity
is the CLI/HTTP read-parity oracle whose presence in this gate-required lane
is what makes the anti-drift claim enforced. Re-adding prose to a generated
file would just be deleted again, so it moves into the generator's emitted
header.
Base drift since authoring left the refreshed manifest one test stale —
#6584 added TestProxiedServerBackupRefusedOnExternalTopology, which
hash-distributed to shard 14 — so "0 drift, all 15 shards fallback:0" was
already false on the merge base. Benign (unlisted tests hash-distribute and
still run, and drift removed no name, so the strict parser's stale-entry
hard-fail was unreachable), but the stated deliverable did not hold.
Regenerated at the adoption base: 149 of 149 discovered tests listed,
fallback:0 on every shard, peak load unchanged at 39 estimated inits. That
figure is a point-in-time measurement, not an invariant: nothing in CI diffs
the committed manifest against a regeneration, so it re-drifts the moment
the next TestProxiedServer* lands. A freshness step
(`gen_proxied_shard_manifest.py 15 | diff - <manifest>`) on a lane already
triggered by .github/scripts/* would make it one; that is follow-up scope.
Verified: the generator reproduces the committed manifest byte-identically;
BEADS_TEST_SHARD_LIST_ONLY=1 across all 15 shards assigns all 149 discovered
TestProxiedServer* functions exactly once with no duplicates or orphans;
actionlint clean on both workflows.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(tracker): honor --create-only in push --dry-run preview (#6337)
Root cause: the sequential push loop in Engine.doPush short-circuits dry
runs before the real-run branch that gates updates on
`!opts.CreateOnly || forceIDs[id]`. The dry-run block had no CreateOnly
check, so every already-linked issue was previewed as "Would update" and
counted as Updated, while a real --create-only run skips it. The batch
path (collectBatchPushIssues) already filtered these correctly.
Fix: in the dry-run block, skip linked issues when CreateOnly is set and
the issue is not force-pushed, using the same rule as
collectBatchPushIssues. Dry-run and real run now report identical
created/updated/skipped counts.
Adds a pure-Go regression test on the UOW store fake (no Dolt server)
asserting the dry-run prints no update preview and that its stats match
a real --create-only run (Created 1, Updated 0, Skipped 1).
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(tracker): count each issue once when a batch pusher falls through to the sequential dry-run (#6712 review)
Root cause: a tracker that implements BatchPushTracker but not
BatchPushDryRunner (Linear) runs collectBatchPushIssues, adds its skip
count to stats, and then on --dry-run falls through to the sequential
loop. That loop iterated every local issue rather than the ones the
batch filter kept, so each issue the filter skipped (parent, type,
ShouldPush, conflict, and now create-only) was counted as Skipped a
second time. With 1 linked + 1 unlinked issue, `--dry-run --create-only`
reported Created:1 Updated:0 Skipped:2.
Fix: on that fall-through only, narrow the sequential loop to the
original (unformatted) issues whose IDs the batch filter kept. The
filter applies the same parent/type/ShouldPush/skipIDs/create-only
checks the loop does, so kept issues pass them again and nothing
else is dropped; the loop still emits every "Would create"/"Would
update" preview and the stored-push-hash skip. Originals are used
instead of pushIssues because those may be FormatDescription copies,
which would change the content hash the stored-hash skip compares.
Trackers with no BatchPush (Jira), Notion's BatchPushDryRun path, and
real batch pushes are unchanged.
Tests: a Linear-shaped fake (BatchPush, no BatchPushDryRun) pins one
outcome per issue for the create-only and ShouldPush fall-through
skips; a forced-linked --create-only case previews and counts as an
update like the real run; the real --create-only run is asserted to
fetch nothing. The CHANGELOG entry now names bd jira sync and bd
linear sync and notes Notion's batch dry-run was already correct.
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>
* docs(tracker): note keepBatchPushIssues' guard is defensive; name ShouldPush in the CHANGELOG (#6712 review)
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>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On a single-edge dep add (positional or --blocks), --no-cycle-check has
never skipped the per-edge cycle probe; it only suppresses the post-add
whole-graph warning. Only bulk --file adds trade the per-edge probe away.
The flag descriptions and the single-edge example said otherwise, as did
the purpose/pins notes on the Oracle A catalog scenario
dep_cycles_detected_via_no_cycle_check. Update all four to match what
the binary does. No behavior change.
Co-authored-by: postoso <postoso@users.noreply.github.com>
* fix(list): a typed --format beats a config json default (#6278)
The root pre-run promotes a config-file or env `json: true` into jsonOutput
unless the ROOT --format changed. bd list registers its own --format, which
shadows the root flag, so that check never saw it. `bd list --format
digraph` under `json: true` then took the JSON branch and printed the
listing instead of the graph.
gatherListInput now clears jsonOutput when the caller typed a non-json
--format and did not also pass --json. Flag precedence is unchanged:
explicit --json still beats --format, and --format json still turns JSON
on. Scoped to bd list rather than the global pre-run, because other
commands' local --format flags (export, graph, ...) mean different things.
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(list): stop citing help text that does not state the precedence
Maintainer review fixup for PR #6708 (adopt-pr iteration 1). Synthesis and the
quality scorecard both say approve with no blocker and no major finding and no
required changes; these are two of the three non-gating minors, taken because
both are text-only and sit in the material this PR adds.
- The fix-site comment and the CHANGELOG entry both ended "as the (flag's) help
says", pointing at a contract that does not exist: list's --format help is
"Output format: 'digraph' ..., 'dot' (Graphviz), or Go template" and root's is
"Output format (json). Alias for --json" -- neither states that an explicit
--json outranks --format. Dropped the false citation and named the conjunct
that actually preserves that precedence, rather than appending it to the
--format usage string: touching a Cobra help string implies a CLI-reference
docs regen, which is more blast radius than a minor readability finding earns.
- Left the shadowing hazard on the record at main.go:1104, the shared
config-precedence check that by construction cannot see a subcommand's local
--format. This is the finding's prescribed minimum; reconciling the check
itself (and bd dep tree's opposite precedence) is explicitly scoped to its own
PR.
Scope correction to the finding: the synthesis lists the commit message as a
third site carrying the false citation. It does not. The contributor's commit
message says "Flag precedence is unchanged: explicit --json still beats
--format" -- true, and it cites no help text. The PR body does not carry the
clause either (checked both). So the finding's real spread is the two sites
fixed here, and nothing is left for finalize to amend on the GitHub surface.
Deliberately not taken: the third minor, an end-to-end case in
list_embedded_test.go asserting the config-default half of the chain. It is
recommended rather than required, the unit matrix is already proven to fail on
base, and an embedded-gated test is not the cheap, nearby cleanup this step
allows opportunistically. It stays a non-gating follow-up.
Validation: git diff --check clean; gofmt clean; go build ./... clean;
go vet ./cmd/bd/ clean; golangci-lint v2.10.1 (pr.yml's pin) 0 issues;
TestListTypedFormatBeatsAConfigJSONDefault 4/4 and the TestGatherListInput*
family all PASS. Comment-and-prose only -- no behavior change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* fix(dolt): resolve show remotes from active root
* review: neutralize ambient shared-server env in show-remotes tests; document resolver limits
Maintainer review fixup for PR #6718 (iteration 1). Addresses the two minor
findings and both nits from the review synthesis; no blocker or major was found.
1. Test hermeticity (minor, PR-introduced). Routing resolveDoltShowRemotes
through doltserver.ResolvePhysicalRoots moved mode selection from the
caller's arguments into the environment, so the mode-independent
TestResolveDoltShowRemotes* tests began inheriting ambient
BEADS_DOLT_SHARED_SERVER. Reproduced here:
$ BEADS_DOLT_SHARED_SERVER=1 go test ./cmd/bd/ -run TestResolveDoltShowRemotes -count=1
--- FAIL: TestResolveDoltShowRemotesFromPersistedState
dolt_test.go:2021: resolveDoltShowRemotes = [], want origin
--- FAIL: TestResolveDoltShowRemotesCorruptStateWarns
dolt_test.go:2205: expected a warning naming repo_state.json, got: ""
Impossible at base: the old candidate list was built purely from the
embeddedDataDir/beadsDir/dbName parameters and read no environment at all
(a1bc167b5:cmd/bd/dolt.go:1908-1932). Fixed by neutralizing the variable in
withNilStoreForShow, the convention already used ~10x in this package
(bootstrap_test.go:57). The two shared-server tests set it to "1" themselves
after calling the helper, so they stay discriminating — their fixtures place
repo_state.json only under the shared root, so they can only pass if the
shared-server arm is actually taken. Now green clean, with =1, and with =true.
Measured, not assumed: only this axis leaks. BEADS_DOLT_SERVER_MODE=1,
BEADS_DOLT_DATA_DIR, and BEADS_SHARED_SERVER_DIR each leave all 7 tests
green. A wider `-run TestDolt` sweep surfaces 3 more reds under this variable
(TestDoltConfigGetters, TestDoltShowUsesExplicitDBFlagForNoDBCommand,
TestDoltShowUsesSelectedRepoConfigForNoDBCommand) — all three fail
identically with only cmd/bd/dolt.go and cmd/bd/dolt_test.go reverted to
a1bc167b5, so they are pre-existing and out of scope here.
2. Known resolver limits documented on resolveDoltShowRemotes (minor + nit,
both doc-level by the reviewers' own scoping):
- show/open parity does not hold when a workspace has no metadata.json.
ResolvePhysicalRoots decides mode by on-disk discovery, while main.go
additionally promotes a nil config to server mode from
BEADS_DOLT_SERVER_MODE=1 / config.yaml dolt.mode. Mirroring that rescue in
the resolver is the real fix but changes every caller, so it stays a
follow-up. Pre-existing property of the resolver, only newly reachable here.
- a remote-host server workspace has no local root, so show renders "(none)";
the comment records that this means "not locally knowable", not "no remotes
configured".
3. Roots[0] (nit): comment recording that every resolver branch returns exactly
one root today, and that Roots is a slice because other callers union several.
User-visible output changes introduced by this PR and not named in its commit
subject, recorded here per review: remote-host server mode now prints "(none)"
rather than probing beadsDir/dolt for another mode's stale remotes, and the
candidate precedence now checks root/<db> before the bare root.
Validation: gofmt clean, go vet ./cmd/bd/ clean, and
`go test ./cmd/bd/ -run TestResolveDoltShowRemotes -count=1` green under a clean
env, BEADS_DOLT_SHARED_SERVER=1, and BEADS_DOLT_SHARED_SERVER=true.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
TestPrepareSelectedCommandContext_RebindsTargetConfig and
_DoesNotMergeCallerConfigForUnsetKeys assert that a config.yaml actor is
rebound, but BEADS_ACTOR outranks config.yaml on purpose
(resolveConfiguredActor, the GH#4645 fix), and so does BD_ACTOR through
viper's BD-prefixed AutomaticEnv. Either one exported in a shell made the
assertion unsatisfiable. A new clearActorEnv helper blanks both, following
the t.Setenv("X", "") idiom these tests already use for the Dolt server env.
A full cmd/bd run with both variables set found a third:
TestCollectViperEntriesWithEnvOverride sets BD_ACTOR and expects it as the
reported source, but an exported BEADS_ACTOR wins. It now blanks
BEADS_ACTOR.
CI runners set neither variable, so all three only failed locally. No
product code changes.
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>
bd show on the direct/embedded path reported comment_count 0 for a wisp
that had comments. CountIssueComments in both the server-mode (dolt) and
embedded (embeddeddolt) stores hard-coded `FROM comments`, while
GetIssueComments routes an active wisp to `wisp_comments`. The workapi
store adapter relies on the store to self-route (it ignores isWisp for
every read), so the count and the rows it summarizes disagreed, and
comments_omitted was never set. The domain/UOW path already dispatched
CountCommentsForWisp correctly, as did the proxied SQL mega-query.
CountIssueComments now picks the table with issueops.IsActiveWispInTx
inside the same transaction, mirroring GetIssueCommentsInTx. The audit
conformance case that pinned the asymmetry (want 0) is flipped to assert
parity with GetIssueComments, and an embedded bd show --json regression
test mirrors the proxied show_wisp_comments_default_count_only case.
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>
Root cause: renderInfo called CheckGitHooks()/FormatHookWarnings()
unconditionally, so setting doctor.suppress.git-hooks=true silenced the
check in bd doctor but bd info kept printing "Git hooks not installed".
Fix: split the config-map half of the doctor suppress reader out as
doctor.SuppressedChecksFromConfig (the store-backed helper now delegates
to it, same semantics), and have both bd info paths (direct and
proxied-server) feed it the config map they already load. renderInfo
skips the hook warning when the git-hooks slug is suppressed. bd info
--json never carried the warning and is unchanged.
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>
Root cause: resolveViaPrefixRoutingWithAccess derived the bead prefix with
extractBeadPrefix, which cut the ID at its first "-", then required an exact
match against each route's prefix. A route whose prefix contains an interior
hyphen (e.g. "claude-os-") could therefore never match its own IDs
("claude-os-76l" extracted as "claude-"), so the lookup silently fell through
to the local store's "not found" with no [routing] line.
Fix: replace extractBeadPrefix with matchPrefixRoute, which selects the route
whose prefix (ending in "-") is the longest leading match for the ID. Routes
with single-hyphen prefixes resolve exactly as before, and route prefixes
without a trailing "-" still never match, as under the old extraction. This
is the only routes.jsonl resolver in the repo (internal/routing is
role-based repo routing and does not read routes.jsonl).
Precedence change: when both "hq-" and "hq-cv-" routes are configured,
"hq-cv-*" IDs now take the "hq-cv-" route instead of "hq-". Previously the
"hq-cv-" entry was dead config.
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(serve): retire idle SQL connections before Dolt
* ci: retrigger macOS checks
* fix(serve): refresh the sibling comments the 20s pool idle cap falsified
Maintainer review fixup for #6741. The review found no blocker and no major;
this is its one gate-impact minor (Architectural Consistency / Change Impact).
Comment-only, no behavior change.
Lowering servePoolLimits.ConnMaxIdleTime from 5m to 20s falsified the
"ConnMaxIdleTime (5m)" figure at the two sibling sites that reason about the
pool-drain/proxy-lifetime interaction. Both designs those comments defend get
STRONGER at 20s, so the decisions stand and only the figures were wrong -- with
one exception:
- cmd/bd/uow_factory.go is the load-bearing justification for
proxyIdle: proxy.IdleTimeoutNever. A pool that drops its last connection at
20s reaches zero clients well inside the proxy's 30s default, so the argument
holds harder than before; the figure now reads
"ConnMaxIdleTime (20s, servePoolLimits)".
- cmd/bd/serve_server_mode_integration_test.go was worse than a stale number:
it justified asserting on the spawned child's command line *because* the
failure "is otherwise only visible after five idle minutes, which no test can
wait for". At 20s that premise is false, so the comment argued against a test
that had become feasible. The command-line assertion stays -- observing the
failure directly still has to idle out the pool and then the proxy's own 30s
default, about a minute of dead time gated on two independent timers -- but
the stated reason is now one that survives the new constant.
Validation: gofmt clean on both files; git diff --check clean;
go vet ./cmd/bd/ with CGO_ENABLED=1, which type-checks the //go:build cgo
integration test file that holds the second comment.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(integration): red — Fix: SubprocessRunner.Build masks every build failure as a chmod ENOENT (refs be-4ecr4)
* feat(integration): green — Fix: SubprocessRunner.Build masks every build failure as a chmod ENOENT (refs be-4ecr4)
* fix(integration): stop orphaning the harness test's temp dir, pin the stdout half
Maintainer review fixups for PR #6715 (be-4ecr4), both minor:
- TestBuildErrorIsMaskedByChmod passes a synthetic *testing.T to Build, which
the framework never finalizes, so the Cleanup that its t.TempDir() registers
never ran and every execution orphaned a directory under $TMPDIR (measured:
one new /tmp entry per run). Remove the mkdtemp parent from the real t —
TempDir hands back <parent>/001, so deleting the binary's own directory would
leave the parent behind — guarded to a proper descendant of $TMPDIR so a
future layout change skips rather than deletes something we did not create.
- The PR makes two changes but pinned only one. Removing build.Stdout left all
three assertions satisfied, so the stdout capture could silently regress.
Assert on "[setup failed]", which `go test -c` demonstrably emits on stdout
in this scenario; the "stdout:" label would be a vacuous pin because it lives
in the format string and survives an unattached buffer. Verified by
counterfactual: dropping the wiring now reddens the test, and dropping the
early return still reddens it for the original masking reason.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(tracker): skip re-adding dependency edges that already exist on pull
createDependencies called AddDependency for every resolved tracker
relation on every pull, including edges already stored with the same
type. Each same-type re-add still runs the hierarchy and cycle checks,
rewrites the edge metadata to {}, records a dep_add journal event and
commits, so a steady-state full pull rewrites the whole imported graph.
Check the stored edge with the existing dependencyExists helper (already
used by the dry-run preview) and only call AddDependency for new edges.
Edges with a different stored type still go through AddDependency so
type conflicts are reported as before.
* test(tracker): observe the metadata loss and the redundant re-add in one run
Maintainer review fixups for #6734. The review found no blocker and no major;
this is the one minor both reviewers agreed was worth folding in, and it is
test-only -- internal/tracker/engine.go is untouched.
TestEngineCreateDependenciesSkipsExistingEdges asserted the spy call count
with t.Fatalf *before* the metadata check, so on base the test died on the
call-count line and never reached the assertion that pins the actual harm:
edge metadata blanked to {} by the same-type re-add. Assert metadata first,
with t.Errorf, so a single run observes both properties. Verified by grafting
base engine.go under this test file: it now fails on the metadata line and the
spy line, where before only the spy line printed.
The `len(depRecords) != 2` assertion cannot catch the re-add -- rows are keyed
by a deterministic depid, so the count is 2 with or without the skip (the
graft confirms it stays silent on base). Keep it for what it does cover, the
skip neither dropping the pre-existing edge nor double-writing the new one,
and re-point its comment at that. Also require the pre-existing row to be
present, so the metadata loop cannot pass vacuously when the row is absent.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(feat): red — Fix: tempDirRoots() omits GOTMPDIR, where Go 1.26+ roots t.TempDir() (be-35sef gate failure) (refs be-qeuzy)
* feat: green — Fix: tempDirRoots() omits GOTMPDIR, where Go 1.26+ roots t.TempDir() (be-35sef gate failure) (refs be-qeuzy)
* docs(doltserver): correct the GOTMPDIR doc comments (maintainer review fixup)
Adoption review of PR #6733 found the new doc comment's "a host whose go
tooling pins GOTMPDIR to a disk path" is false for the `go env -w` shape --
`go env -w GOTMPDIR` writes the go env config file, which cmd/go does not put
into the test binary's environment, so it reaches neither testing.T.TempDir nor
tempDirRoots(); both read the process environment. Measured on a `go env -w`
host: `go env GOTMPDIR` -> /data/tmp/go-tmp, but os.Getenv("GOTMPDIR") inside
`go test` -> "". A maintainer trusting the old wording would mis-diagnose the
next stranded deleted-cwd arm on such a box, where this change is a no-op.
- sweep.go, sweep_test.go: say a host that EXPORTS GOTMPDIR, and state that
`go env -w` alone does not reach either reader. The claim was asserted at
both sites; the review cited only sweep.go.
- sweep_test.go: note that only "GOTMPDIR outside TMPDIR is covered"
discriminates this change -- the unset and four drop cases are regression
guards on isCredibleTempRoot, not pins on the new root.
- testutil/suite_temp.go: "Go 1.24+" -> "Go 1.26+". Pre-existing and untouched
by this PR, but it contradicted the correct version this PR writes, about the
one mechanism this PR exists to handle. Verified across cached toolchains:
GOTMPDIR is absent from src/testing/testing.go through go1.25.9 and present
from go1.26.0.
Comment-only; no behavior change. os.Getenv remains the correct lookup
precisely because it mirrors testing.go's.
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(label): report a no-op label edit instead of claiming it (#5988)
`bd label remove <id> x` printed "✓ Removed label 'x' from <id>" (JSON
status "removed") for a label the issue never had, and `bd label add`
printed "✓ Added label" for one it already had, so a real edit could not
be told from a no-op.
Root cause: applyLabelEdit discarded the issueops.UpdateResult of each
lifecycle.Update, and reportLabelEdit printed the operation for every
(issue, label) pair unconditionally. The storage side was already right:
ApplyLabelPatch compares the target set with the existing one and writes
nothing (no label row, no event, no Dolt commit) when they are equal.
Fix: keep the result and derive a per-label outcome. For a single label,
UpdateResult.Changed answers it exactly. A multi-label edit that changed
something reads the issue's labels before the update (Reader.Get, only in
that case) to split the labels that moved from those that did not. A label
left as it was is now reported as "• Label 'x' was not on <id>" /
"• <id> already has label 'x'" (the "•" accent no-op glyph `bd provenance`
already uses), with JSON status "unchanged"; the other JSON fields and the
added/removed values for real edits are unchanged. Both the direct and the
proxied-server routes go through applyLabelEdit, so they report alike.
The exit code is deliberately still 0: a no-op edit is not an error, and
making it one would break idempotent callers (the reporter advises against
it too).
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>
* test(regression): mark BUG-70/71 fixed and assert the no-op output (#6742 review)
TestDiscovery_LabelRemoveNonexistentSilentSuccess and
TestDiscovery_LabelAddDuplicateReportsAdded only checked the exit code and
label count, so they kept flagging after the fix (a no-op still exits 0 by
design). They now assert the fixed output: no "Removed" / "Added" claim,
and the "was not on" / "already has label" line. They follow the
FIXED-and-kept-as-a-lock convention of TestDiscovery_LabelPatternFilterDeadCode.
Both fail against the unfixed label.go and pass with it. DISCOVERY.md
marks BUG-70 and BUG-71 as FIX PR / PR OPEN (#6742).
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>
* test(label): pin the divergent multi-issue label report (#6742 review)
Maintainer review fixups for PR #6742. No production behavior change.
Every subtest the PR added edits exactly one issue, so nothing pinned the
shape the diff actually rewrote: the old code hoisted labelDesc out of the id
loop and printed one identical line per issue, while the new code appends a
labelEditOutcome per issue derived from that issue's own UpdateResult.Changed.
label_edit_divergent_multi_issue covers it — two issues, the label on only one,
one `bd label add A B shared` — asserting the two JSON rows (added for one
issue_id, unchanged for the other) and the two text lines, each naming its own
id. Verified non-vacuous rather than just green: with the outcome hoisted back
out of the id loop (the first result reused for every id) this is the ONLY one
of the 28 subtests that fails — the four new no-op subtests and
label_edit_mixed_reports_each_label all still pass, which is exactly the
refactor hazard the review named.
applyLabelEdit now records what the multi-label pre-edit read cannot promise:
it is taken outside the write transaction, so per-label attribution is
best-effort under a concurrent edit. The stored labels, the JSON shape and the
exit code stay correct regardless, because ApplyLabelPatch recomputes the
target set from current.Labels inside the write; a single-label edit is immune
by construction. The BatchApplier shape already named above it closes the
window structurally.
The two reworked discovery tests no longer call themselves a "regression lock".
The file is `//go:build regression && discovery` and no CI lane passes the
discovery tag (regression.yml runs -tags=regression,gms_pure_go), so the CI
lock for this fix is TestEmbeddedLabel/TestProxiedServerLabel in cmd/bd, and
the comments now say so.
Validation: TestEmbeddedLabel 28/28 green under BEADS_TEST_EMBEDDED_DOLT=1
(57s), go vet -tags "regression discovery" ./tests/regression/... clean,
go vet ./cmd/bd/ clean, gofmt clean, git diff --check clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(gitlab): recognize work-item URLs on the configured self-hosted host (GH#6735)
IsExternalRef required the substring "gitlab" in the URL, so self-hosted
instances without it were treated as unlinked and sync created duplicate
issues. Also accept issue/work-item/milestone URLs whose host (and base
path) match the configured gitlab.url; unrelated hosts stay rejected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(gitlab): record the self-hosted ref fix and correct the BaseURL contract
Maintainer review fixups for #6736. The review found no blocker and no major;
these are its two gate-impact minors plus the two nearby nits. No behavior
change: the only non-comment edits are in the test.
- CHANGELOG had no entry for a user-visible change to which external refs the
GitLab tracker claims (6 of the 8 commits preceding the merge base touch it).
The bullet names GH#6735 and the two limits a reader actually needs: matching
is host-scoped, not project-scoped, and the host must be spelled the way
GitLab emits it in web_url.
- Client.BaseURL was documented as "https://gitlab.com/api/v4". That example was
already wrong before this PR -- buildURL appends DefaultAPIEndpoint itself, so
the documented form doubles the suffix -- but onConfiguredHost now makes the
web-root form load-bearing for ref identity, so a maintainer "fixing" a
construction site to match the comment would silently restore the duplicate
sync this PR fixes. WithEndpoint is that construction site: its doc said
"custom API endpoint" while assigning BaseURL. It has no production caller,
so both are doc-only corrections.
- onConfiguredHost now states the host-only match scope and the literal host
comparison. Both reviewers asked for these to be documented rather than
narrowed: keying the match on gitlab.project_path would drop self-hosted
recognition exactly where it is least likely to be configured, since that
key is optional and Init discards its load error.
- tracker_test: the milestone and shorthand rows are satisfied by the
pre-existing "milestones" substring and glShorthandPattern arms, so they pass
with onConfiguredHost deleted and overstated the table's coverage of the new
predicate. They are now grouped and labeled as regression pins for those arms,
and the two cases that do discriminate are added -- a scheme mismatch (claimed:
only the host is compared) and a non-default port (not claimed when the ref
omits it). Deleting `&& !t.onConfiguredHost(ref)` now fails 6 assertions, up
from 4.
Validation: gofmt, git diff --check, go vet ./internal/gitlab/,
golangci-lint ./internal/gitlab/... (0 issues), go test ./internal/gitlab/...
and go test ./cmd/bd/ -run 'GitLab|Gitlab', plus the counterfactual run above.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
claim.pools shipped with pool-aware claiming (#4843) and is described in
`bd config docs` (cmd/bd/config.go:78-88) and on `bd update --claim`, but
docs/reference/configuration.md never mentions it, so a reader of the
published configuration page cannot find the key or learn where its
value has to live.
Add a claim.pools row to the Project-Level Settings (Database) table and
a short "Claim Pools" subsection at the end of that section. Each
statement follows the code on main:
- The value is read only from the database config table
(ClaimPoolAliasesInTx -> GetConfigInTx, internal/storage/issueops/
claim.go:310-315, config_metadata.go:25-35; cmd/bd/show_unit_helpers.go:58,70).
A config.yaml value is listed by `bd config show` as (config.yaml) but
does not make an alias claimable.
- Entries are comma-split and whitespace-trimmed (ParseClaimPools,
claim.go:323-331); membership is an exact, case-sensitive string match
(claim.go:91, internal/validation/issue.go:217).
- A pool-assigned issue is claimed through the normal CAS, which grants
the normal lease (claim.go:91, :202).
- Real-actor and unlisted-alias assignees keep anti-steal protection.
- `bd assign` / `bd update --assignee` skip the reassign fence for a
pool-held in_progress issue (validation/issue.go:217; cmd/bd/assign.go:76,
cmd/bd/update.go:504).
- `bd ready --claim` claims only unassigned issues (claim.go:256).
- An expired lease is reclaimed to open with no assignee
(internal/storage/issueops/lease.go:759), not back to the pool alias.
Fixes#6607
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Preserve proxy.store.unrouted through create target opens, including dry-run parent lookup, and describe the target accurately for direct and automatic routing.
Add embedded CLI coverage for flat and enveloped JSON, text output, ordinary errors, and unchanged workspaces.
Fixes#6684
* fix(metadata): require a JSON object for --metadata on create and update (#6035)
Root cause: the four --metadata entry points (create and update, each in
its direct and proxied-server variant: create.go, create_input.go,
update.go, update_input.go) carried copies of the same check, json.Valid,
which accepts any JSON value. `bd create --metadata '"oops"'` therefore
stored a bare string (or an array, number or null) as the issue's
metadata. `bd update` with the same value was refused only late, by the
storage-layer merge, with an internal unmarshal error.
Fix: one shared readMetadataFlag helper resolves the value (inline or
@file.json) and requires a top-level JSON object, refusing a string,
number, boolean, array or null with "invalid --metadata: must be a JSON
object such as {"key":"value"}, got <kind>". The rule matches what the
storage merge already enforces for update (it unmarshals into a map and
rejects null), so `{}` stays accepted and null is now refused on create
too, where it used to be stored literally. The storage layer is not
changed.
Not changed: an object whose value is a string that looks like JSON
(`{"mykey":"{\"inner\":\"v\"}"}`, the nested case in the report) is
still accepted and stored as written. Metadata values are opaque, and
refusing such strings would be a design change, not a fix.
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>
* test(metadata): cover boolean and null in the end-to-end create/update case (#6743 review)
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(metadata): correct the null-behavior claims and the --metadata help text (#6743 review)
Maintainer review fixups for #6743. The review found no blocker and no major,
and the scorecard approved with no required changes; these are its minors and
nits.
- The helper doc comment and the CHANGELOG entry both said the new object rule
matches what the storage merge already enforced for update. That holds for a
string, number, boolean or array, and is false for null: json.Unmarshal of
the literal null into a map zeroes the map and returns no error, so
MergeMetadataJSON merged nothing and `bd update --metadata null` exited 0.
Refusing null is a real, if small, behavior change on update, so both
surfaces now say that instead of claiming a non-change.
- The --metadata help text on create and update advertised "JSON string", the
one input this change exists to refuse; both now read "JSON object". The
generated CLI docs are deliberately not regenerated alongside it:
docs/cli-docs.pin is v1.2.2, so generate-cli-docs.sh builds bd from that tag
rather than from the checkout, and the committed pages are refreshed at
release. Verified both ways -- with this edit alone, check-doc-flags.sh
Check 4 reports "PASS: generated CLI docs are fresh"; hand-editing
docs/cli-reference/create.md to the new string instead makes it report
"FAIL: docs/cli-reference is out of sync with live CLI help".
- The `object == nil` arm of the guard is load-bearing and read as redundant to
both reviewers, so it now says out loud that it is what catches null, and
names internal/httpapi/batch_apply.go as the source of the idiom. Keeping the
unmarshal rather than switching the guard to jsonKind preserves symmetry with
that plane; the synthesis offered either.
- jsonKind's "empty input" arm is unreachable from both callers, which sit
behind json.Valid. Documented as defensive rather than dropped, because
dropping it makes the byte index below panic for any future caller that has
not validated first.
- os.ReadFile's error is wrapped with %w, so callers of this newly shared
helper can still reach fs.ErrNotExist.
The PR body asserts the same null premise in two places (its `null` table row
and the "keeps update's existing rule" bullet) and overstates HTTP-plane
enforcement; those are corrected at finalize, since review iterations do not
touch GitHub.
No behavior change beyond the help string. `go test ./cmd/bd -run GH6035`
passes; gofmt, go vet, check-doc-flags.sh and check-doc-freshness.sh clean.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(dolt): stop telling bd init not to run bd init on an identity mismatch (#5558)
Root cause: GH#4637 Part A made newServerMode run verifyProjectIdentity for a
CreateIfMissing open whenever the database already existed on the server, so
the check is now reachable from inside bd init (a re-init whose metadata.json
already carries a project_id, against a server whose database of that name
belongs to another project). The refusal it returns was written only for
ordinary opens and ends in "Do NOT run 'bd init'", telling the user not to
run the command they are running, with no remedy that works from there.
Fix: extract the message into a pure projectIdentityMismatchError and pass
cfg.CreateIfMissing through verifyProjectIdentity. The init-time variant
names the database and points at remedies that apply to an init: re-run with
bd init --database <name> or --server-host/--server-port, or run
bd doctor --fix / bd bootstrap when metadata.json is the stale side. The
ordinary-open message is unchanged, and whether the check runs is unchanged.
A unit test pins both variants.
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(dolt): key the init wording on an explicit OpenedByInit, not CreateIfMissing (#6745 review)
CreateIfMissing does not identify bd init. The library API
(beads.OpenFromConfig, beads.OpenGated), bd doctor --fix and bd bootstrap
open with it too, so they were getting the init-time advice on an identity
mismatch, and doctor and bootstrap were told to run themselves.
- New dolt.Config.OpenedByInit, set only by bd init's open (init.go), now
selects the init wording. Whether the check runs is unchanged.
- The init advice no longer presents `bd init --database` as a sure fix:
checkExistingBeadsDataAt can refuse it as "already initialized" when
metadata.json names an existing server database. The message says to
follow init's own steps in that case, and names this project's server
first.
- TestCrossProject_IdentityCheck_ExistingDatabase_ForeignRejected now pins
the wiring through New. A CreateIfMissing-only open keeps the
ordinary-open advice, and an OpenedByInit open gets the init wording.
It needs a Dolt server, so it runs in CI.
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>
* docs(changelog): match the #5558 entry to the OpenedByInit wiring
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(dolt): align the init mismatch block, and narrow the #5558 repro
Maintainer review fixup for PR #6745 (adopt-pr iteration 1). Synthesis and
quality scorecard both say approve with no blocker or major findings; these
are the non-gating nits, taken because all three sit in the material this PR
exists to improve — the refusal message and the test that pins it.
- Both reviewers flagged that the init variant interpolates the database name
into the label column ("Database %q project ID:"), so the two ID values line
up only for a 7-character name. Give the database its own line and restore
the aligned pair the ordinary-open branch already uses. Rendered for a 5-,
9- and 30-character database name: both columns now line up in every case.
- Rendering also turned up a line the diff alone does not show: the
"already initialized" parenthetical was 84 columns in a block hand-wrapped
at ~78. Rewrapped; every line of both messages is now <= 79.
- The new test's subtest name ("create-if-missing") and doc comment still
stated the selector commit d48a83655 deliberately rejected, and that the
sibling assertion in cross_project_test.go now calls wrong. Re-keyed both
on Config.OpenedByInit.
- The CHANGELOG described the repro as plainly re-running `bd init` in an
initialized workspace. That shape is intercepted before the store open by
checkExistingBeadsData (cmd/bd/init.go:801-802, bypassed only by
--reinit-local/--force), so it is not the reachable one; the refusal is
reached when the open is redirected at another server or database. Restated
as the condition rather than an unreachable recipe. The PR body carries the
same wording and is left for the maintainer to amend at finalize.
Deliberately not taken: the synthesis's one minor (pin `OpenedByInit: true` at
cmd/bd/init.go:1382 with a cmd/bd assertion). The prescribed remedy — extract
the dolt.Config construction at cmd/bd/init.go:1372-1389 into a testable
builder — is a refactor of a literal that lives inside init's cobra RunE
closure over ~15 captured locals, in the file whose worst_changed function is
already the scorecard's complexity penalty (newServerMode, 51/101). That is
not the "nearby, cheap, low-risk" cleanup the contract allows opportunistically,
and the finding is non-gating. Worth a follow-up issue instead.
Validation: go build ./... clean; go vet ./internal/storage/dolt clean;
go test ./internal/storage/dolt -run
'TestProjectIdentityMismatchError_InitAdvice|TestCrossProject_IdentityCheck_ExistingDatabase_ForeignRejected|TestCrossProject_IdentityCheck_ExistingDatabase_MatchingSucceeds'
all PASS against a live Dolt container.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(query): apply bd list's piped-output limit policy to bd query (#6229)
Root cause: bd list resolves an unflagged --limit through a policy that
treats piped stdout as unlimited (GH#4094), but bd query read its --limit
flag straight through, so its default of workapi.DefaultQueryLimit (50)
applied to piped output too. `bd query '...' | consumer` silently dropped
every row past 50; the truncation hint did not fire either, because it only
prints when stderr is a terminal.
Fix: factor the unflagged tail of bd list's policy into unflaggedLimit /
resolveUnflaggedLimit in list_input.go and call it from both commands, so
they cannot drift. bd list's switch is unchanged in behavior; bd query's
change is a single localized branch in gatherQueryInput.
Precedence for bd query, mirroring bd list:
1. explicit --limit (including 0) wins
2. piped stdout -> 0 (unlimited)
3. agent mode on a terminal -> 20
4. otherwise the 50 default
bd list keeps its own --all and list.limit branches ahead of step 2; bd
query has neither (its --all means "include closed", and there is no
query.limit config key), so none was invented.
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>
* review: document the query path's absent defensive cap; unstale a reachability comment
Maintainer review fixes for PR #6744 (GH#6229). Both are comment-only; no
behavior changes.
issueops.QueryRequest.Limit now states that nothing backstops it. ListRequest
pairs its Limit with MaxRows, a circuit breaker for an oversized answer, and
neither knob that sets that one (--max-rows, BEADS_MAX_ROWS) is read anywhere
on the query path, so an unlimited query is unbounded in the plain sense. That
was already reachable via `--limit 0`; this PR makes a piped `bd query` reach
it without asking, which is what makes it worth writing down. Recording the
absence is the documented half of the reviewers' choice — threading a MaxRows
twin onto QueryRequest stays available as a follow-up.
unionCountsGoSideSortKeepsTheRightSubset's comment justified its case with
"DefaultQueryLimit means a limit is always set", which this PR falsified for
the CLI half: an unflagged piped `bd query '<expr>' --sort id` now arrives on
the IsGoSideSort path with Limit 0 and no bound. The HTTP surface still brings
a bound, because an absent `limit` parameter resolves to DefaultQueryLimit, so
the clause is requalified rather than dropped. The assertions were never
affected — they pass an explicit Limit: 5.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
* fix(config): stop `bd config unset` dropping the file's trailing newline
commentOutYamlKey rebuilds the document by joining its lines, and returns the
join directly. strings.Split on a string ending in "\n" yields a final empty
element, so any path that appends after it -- or rebuilds result without it --
loses the document's trailing newline. Every `bd config unset` therefore wrote a
no-newline-at-end-of-file change on top of the line it meant to comment out, in
a git-tracked file: a spurious line in someone's review, on a command whose
whole job is a two-line edit.
It happened even when the key was absent, i.e. when nothing was edited at all.
Measured on 3c30a28d0 before the fix:
key present, nested inHasNL=true outHasNL=false
key present, flat inHasNL=true outHasNL=false
key absent inHasNL=true outHasNL=false
no trailing newline in input inHasNL=false outHasNL=false
The rule is PRESERVE, not always-append: the last line above is correct and
stays correct -- a document that genuinely has no trailing newline does not
acquire one, so this cannot rewrite the end of a file that was already written
that way.
Found while rebasing #6125 onto this function; that PR works around it in its
own wrapper, and this fixes the primitive so the workaround can go away.
Tests: five cases through commentOutYamlKey (nested, flat, single-segment, key
absent, and the no-newline input), plus one through UnsetYamlConfig and the real
file, which is what `bd config unset` calls. Revert-probed -- every one fails
with the preservation removed. The existing internal/config suite passes
unchanged, so nothing encoded the old behaviour.
Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of voxist.executor
* fix(config): preserve the whole trailing newline run, not one newline
Self-review of the approved head found the fix short by one shape, and the
commit message above it naming the wrong mechanism. Both are corrected here
rather than by amending, so the range-diff against the reviewed commit stays
readable.
The mechanism is NOT "strings.Split yields a final empty element", and it is
not a collapsed run either. Measured directly:
in "x\n" tokens ["x"] join "x" short by 1
in "x\n\n" tokens ["x" ""] join "x\n" short by 1
in "x\n\n\n" tokens ["x" "" ""] join "x\n\n" short by 1
in "x\n\n\n\n" tokens ["x" "" "" ""] join "x\n\n\n" short by 1
in "x" tokens ["x"] join "x" short by 0
bufio.Scanner yields one empty token per blank line and drops only the final
terminator, so the join is always EXACTLY ONE newline short whenever the
content ends in "\n".
So the count was never the problem; the GUARD was. The approved head appends
"\n" under `strings.HasSuffix(content, "\n") && !strings.HasSuffix(out, "\n")`.
For a file ending "\n\n" the join ends "\n" -- the blank line's own newline --
so the second clause is already false and the one missing newline is never
restored:
in "…mode: server\n" out "…# mode: server\n" ok
in "…mode: server\n\n" out "…# mode: server\n" one short
in "…mode: server\n\n\n" out "…# mode: server\n\n" one short
in "…other: x\n\n" out "…other: x\n" one short, key absent
The last row is the same defect the PR exists to fix: `bd config unset` on a
key the file does not contain still rewrites the end of a git-tracked file.
The test could not see it. It asserted `strings.HasSuffix(out, "\n")`, which
is true of an output that lost a newline and still ends in one -- a check
that cannot fail for the shape it was meant to cover. It now compares the
trailing RUN, so it reports what the output actually is.
Fix: re-attach content's own trailing run, which does not depend on the
count. The rule stays PRESERVE, not always-append -- a document with no
trailing newline still acquires none, and that row stays in the table.
Tests: three new rows (ends in a blank line, two blank lines, and a blank
line with the key absent) plus the file-level test through UnsetYamlConfig
now written against a body that ends in a blank line. Revert-probed: with
the approved one-newline append, the four new rows fail and the original
four pass; with no preservation at all, everything fails. internal/config
passes unchanged otherwise.
Found while fixing the same class of bug one level up in #6125, whose
wrapper hit it as a hard refusal rather than a cosmetic loss.
Agent-Signature: claude-code-claude-opus-5-unknown-reasoning on behalf of voxist.executor
* fix(config): record the set-path gap and pin CRLF normalization
Review follow-ups from the maintainer adoption review of #6749. Both are
scope/documentation items; no behavior changes.
updateYamlKey's flat-key path has the same bufio.Scanner + strings.Join
shape commentOutYamlKey had, so `bd config set` still drops a terminated
document's trailing newline -- the same user-visible symptom this PR fixes
for unset, via the more commonly run verb. Measured at this HEAD: setting
issue_prefix on "issue_prefix: vp\ndolt.mode: server\n" returns a string
with no terminator, and the key-not-found branch is worse, emitting
"x\n\nnewkey: \"v\"" for "x\n". Left unfixed to keep the change aimed at
unset, but named in a TODO rather than left silent, so the invariant does
not read as file-wide. Only the flat path is affected: updateNestedYamlKey
re-marshals through yaml.Node and is already newline-faithful.
The new test file's header otherwise reads as a document-wide "an unset
does not rewrite bytes it did not mean to touch" guarantee, which CRLF
files break far more loudly than the missing terminator did -- ScanLines
strips the \r from every line, so an unset normalizes the whole document
to LF. The tail logic hides that at the one place a reader now looks,
because TrimRight on "\n" leaves the final \r behind and the re-attached
run is a bare "\n". Scoped the header to LF and pinned the current
normalization as known-and-accepted.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Maintainer review fixups for #6731. The review found no blocker and no major;
these are its two gate-impact minors plus two nearby nits.
- externaldeps.Store.ReadyCounter built a fresh store-backed counter, so the
documented storage.ReadyCounter.CountReady span stopped being emitted for
every text-mode `bd ready` in the cmd/bd chain (hooks -> externaldeps ->
telemetry -> store). PR-introduced: at base this decorator had no
ReadyCounter at all, so the embedded passthrough reached the instrumented
layer -- and this PR edits the very otel document that lists the span. The
accessor cannot simply recurse, because the exclusions live on this store, so
it now hands the finished counter to the inner store's WrapReadyCounter,
which telemetry already exported for exactly this case and had no caller for.
Pinned by TestExternalDepsReadyCounterSurvivesThisLayer, which fails with the
old body (verified by reverting it).
- CHANGELOG: GetReadyWorkWithCountsAndTotal is a new REQUIRED storage.Storage
method with no optional-interface fallback, so an out-of-tree `backends`
registrant stops compiling on upgrade. The entry names the method, the
contract an implementer owes, and why the compile-time posture is deliberate.
- The ready probe's facts now record each index as its column is appended.
Two conditional columns were read back through a mix of literals and a
computed `next`, so the two conventions disagreed inside one function and a
future column inserted above would silently mis-read a different fact.
Behavior-identical; the four excludeDeferred x wantCollision combinations are
covered by the embedded filter matrix.
- The combined family count wraps as `count ready work: issues+wisps:`, so it
is distinguishable from the issues-only retry beneath it, and
storereadycounter's package doc no longer claims only two importers.
Validation: go build ./...; go vet and go test on issueops, externaldeps,
telemetry; BEADS_TEST_EMBEDDED_DOLT=1 TestReadyWorkPageTotal,
TestReadyWorkPageTotalFilterMatrix, TestReadyWorkStatementBudget
(embeddeddolt) and TestEmbeddedReady (cmd/bd).
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* perf(issueops): answer a ready page and its total in one pass
`bd ready --json --limit 1` against a remote SQL store (~55 ms per round
trip) took 5.4 s and ~100 sequential round trips; `--limit 0` (557 rows)
took 3.8 s. Asking for one row was slower than asking for all of them. The
data is small, so the cost was purely statement count:
- a capped page re-ran the whole ready predicate in a SECOND transaction
(CountReadyWorkInTx, behind a second defer-wake sweep) just to print
"Showing 1 of 556";
- every leg re-probed the same facts: wisp_dependencies existence, wisps
emptiness, and the future-deferred-parent scan (2 probes + 4 child
queries), once per table family and again in the count pass.
This change:
- Adds a per-transaction probe (probeReadyWorkInTx): one statement of
EXISTS subqueries answers wisps-present, wisp_dependencies-exists,
future-deferred-parent-exists and (when sizing) issues/wisps ID collision;
the deferred-parent children are then read in one UNION ALL instead of
four queries. The facts and the rendered ID sets are shared by both
families. A missing-table error (pre-wisp database) falls back to the old
per-table probes, so their tolerance and error classification are
unchanged.
- Adds GetReadyWorkWithCountsAndTotalInTx and
DoltStorage.GetReadyWorkWithCountsAndTotal: the capped page's ID query
carries COUNT(*) OVER (), evaluated over the full predicate before LIMIT,
so the total costs no extra statement. The overlap count only runs when
the probe saw an ID in both tables. Window functions are supported by
every engine this code runs on (Dolt/go-mysql-server server and embedded,
MySQL 8, Postgres, SQLite >= 3.25). The externaldeps decorator overrides
the new method so its exclusions apply to page and total alike, and now
also overrides ReadyCounter() so the text-mode total honors the same
exclusions (it used to pass through to the inner store and count
externally blocked issues); telemetry instruments the new method.
- CountReadyWorkInTx (ReadyCounter role, text `bd ready`) uses the probe
and counts both families in one statement.
Whole-command statements for `bd ready --json`, counted from a local dolt
sql-server query log (13 of each are startup/config reads this change does
not touch):
store --limit 1 --limit 0
issues only 28 -> 18 20 -> 17
issues + wisps 34 -> 19 23 -> 18
issues + wisps + deferred epic 46 -> 20 29 -> 19
TestReadyWorkStatementBudget holds the per-transaction statement count at
or under today's budget on embedded Dolt. TestReadyWorkPageTotal and
TestReadyWorkPageTotalFilterMatrix check the page and total against
hand-written expected ready sets (wisps, deferred parent, blocked, ID
collision; sorts, label/assignee/priority/type/parent/deferred/exclude
filters) and every capped page against the unbounded listing's prefix.
stdout (plain and BD_JSON_ENVELOPE=1) and the stderr hint were
byte-identical before/after for every case above. The one intended output
change: with an external dependency present, the --json total (and the
text "of N") now excludes externally blocked issues, as the page already
did; before, the total counted them.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(ready): take the --json total in-band instead of a second count pass
`bd ready --json --limit N` listed a page, then - when the page came back
full - opened a second store call (ReadyCounter.CountReady: a new read
transaction plus its own defer-wake sweep) only to print "Showing N of M"
on stderr and the pagination total in the JSON envelope. On a remote store
(~55 ms per round trip) that pass is why `--limit 1` (5.4 s) was slower
than `--limit 0` (3.8 s).
The --json branch now calls GetReadyWorkWithCountsAndTotal, which returns
the page and the size of the whole ready set from the same transaction.
The total is the same identity the ReadyCounter role promises, taken over
the listing's own filter, so the hint text, the envelope's pagination and
the stdout JSON are identical except that the total now honors
external-dependency exclusions (the externaldeps decorator applies them to
page and total alike; the old second pass counted externally blocked
issues). The text-mode branch still asks the ReadyCounter role, which the
previous commit made cheaper and made apply the same exclusions, so text
and --json report one number.
The embedded CLI test now pins the exact "Showing 2 of N" hint and the
envelope's pagination total against an unbounded listing.
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(proxy): unsplit `bd ready --gated`, and stop policing a flag `bd list` lacks
Post-merge review of #6293 (landed as 6f8d15341) found two majors. Both are
incomplete-fix defects in that PR's own work, not regressions: each is a claim
the PR made that its code does not support.
1. `bd ready --gated` still inherited the max-rows refusal that `bd mol ready
--gated` was freed from. The two spellings are documented as the same
gate-resume scan, and on the proxied route they literally are one:
`runReadyProxiedGated` discards its `readyInput` and calls the same
`findGateReadyMolecules` as `runMolReadyGatedProxiedServer`. Neither threads
a row cap. But the new front door keys on `path == "ready"`, which fires for
every `bd ready` invocation, so with `BEADS_MAX_ROWS` exported only the
`mol` spelling worked. #6293 moved the refusal off the shared cobra leaf
name and onto the command; the arm is the level it actually belongs at.
Both refusal sites are exempted, because exempting one only moves the split:
`ready.go`'s in-RunE backstop calls `AssertProxyCapability` with an empty
command, so it always resolves the mode-wide refusal and cannot honor a
command-specific allow. `readyGatedArm` is the single predicate they share.
`--claim` stays refused, including `--claim --gated`. That pair is a usage
error (`gatherReadyInput`), not a gated run, so the mutating arm keeps its
refusal on every path into it and this exemption cannot reopen it.
2. `list`'s `ProxyCapRepo` row was flipped from `notApplicable()` to
`repoRefusal`, promising a typed refusal for `bd list --repo` — but `--repo`
is registered only on `createCmd` (create.go:940), so cobra rejects
`bd list --repo` as an unknown flag before any of this runs. The row, the
comment above `repoRefusal`, the CHANGELOG contract and the test that
"proved" it all described a command line that cannot exist. The policy table
is the audit source of truth this PR argues for; a row refusing a flag the
command does not have is worse than the N/A row it replaced.
Restored to `notApplicable()` and the CHANGELOG retargeted at
`bd create --repo`, which exists and is gated. `runListProxiedServer`'s
defensive branch goes back to the mode-wide assert: keyed on the `list` row
it would now resolve to "allowed" and let a repo override through, which is
the opposite of what the branch is for.
Tests: both fixes are pinned by tests that fail without them, checked by
reverting each guard in place.
- `bd ready --gated` under `BEADS_MAX_ROWS=5` joins the front-door allow matrix
against the real command tree, and the e2e allow matrix beside its `mol`
twin. `--claim` and `--claim --gated` are pinned as still-refused, so
widening the exemption to a bare `--gated` check does not pass.
- The RunE backstop gets its own unit pin rather than being left to the
env-gated proxied e2e lane; it asserts two-sidedly, since a guard that
swallowed the error would pass a "no refusal" check alone.
- `TestProxyCapabilityRowsNameFlagsTheCommandRegisters` is the drift guard the
review asked for: the existing one pins paths, which is why it could not see
a row naming a real command and a flag that does not exist. It runs both
directions — a refused/honored row must name a flag the command registers, an
N/A row must name one it does not.
- The two `list --repo` tests #6293 added both asserted the false premise, not
just the one the review named; both are retargeted at the reachable
`bd create --repo` site and at the corrected row.
Deliberately out of scope: the four non-gating minors and the nit from the same
review are left for separate follow-ups against main.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(changelog): record the `bd ready --gated` proxied row-cap fix
The behavior change in the previous commit is user-visible -- a command line
that exited 1 under a cap now runs -- so it gets its own [Unreleased] bullet
rather than riding along under #6293's entry, which describes the refusal as
it shipped.
Notes the ignored-cap consequence explicitly: `--gated` alongside a cap is now
dropped rather than refused, which is what the direct route has always done.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Post-merge review of #6584 (landed 7ccb961f7..c69dd3061).
Honoring the backup family on a managed-local proxied server made
`bd backup status` reachable on that topology for the first time — and it
rendered the embedded-mode footnote `(auto: no git remote)`. That reason was
never true there: `isBackupAutoEnabled` returns false because `usesSQLServer()`
short-circuits it, whether or not a remote exists. The same command's help then
told the operator to set `backup.enabled=true` to opt in, which on proxied
changes nothing — the proxied arm of `PersistentPostRunE` never calls
`runPostRunAutoBackup`, so an operator following bd's own instructions gets
silent no-backup.
The status note now comes from `backupAutoStatusNote`, which narrates the reason
the decision actually used: proxied-server first (and regardless of the config
source, since an explicit `backup.enabled=true` is inert there and a bare
`enabled=true` is the misleading half), then sql-server mode — the reason
`bd config get backup.enabled` already reports for the same condition — then the
unchanged embedded git-remote arms. The `backup` help stops advertising the
opt-in on proxied and points at explicit `bd backup sync`, which is honored on
the one proxied shape that reaches these surfaces.
Wiring an auto-backup hook through the new proxied routes is the other half of
the reviewer's fix and is deliberately not taken here: all three reviewers
classified the missing hook as a pre-existing gap #6584 did not claim. Only the
newly produced misinformation is corrected.
`TestBackupAutoStatusNote` pins all seven shapes against the value they are
printed beside; reverting the helper to the pre-fix ordering fails exactly the
three server-mode cases and leaves the four embedded ones green.
Post-merge review of #6658 (landed as 5b9e938b5) found two guidance defects
in the #6575 data-behind stop. The gate itself is correct; both are in the
remedy chain it prints.
1. The shared arm prescribed `bd migrate schema`, which cannot succeed in the
state that prints it. A data-behind refusal has a remote by construction —
behind-ness is read from `remotes/<name>/<branch>` — and the verb consent
(`sharedMigrateConsent`) has exactly one reader, inside `sharedNoRemoteGate`,
reachable only on the `!hasRemote` branch. So after the pull the retry routed
`smartAutoMigrate -> shared -> fallbackReasonSharedStore`, whose blunt body
prescribes the `bd migrate --force` the data-behind body explicitly says not
to use. The option, `dataBehindBody`, `AgentDirective`, `fallbackReasonNote`
and both `--global` retargets now name `bd migrate schema --force`, which
trips `forceOrEnvConsent` via `isForcedMigrate`.
Retargeting the command rather than widening the consent read is deliberate:
with a remote configured, #4259's cross-clone fork risk still demands the
designated-migrator confirmation, which is what `sharedNoRemoteGate`'s own
comment says the scoping is for.
2. The JSON payload's `docs` pointer stayed on the migrate-or-adopt anchor,
whose ordering rule says `bd dolt pull` is refused on every
pending-migration open — contradicting the `pull-first` option in the same
payload. The `IsDataBehind()` arm now points at a new "Clone behind the
remote" section, and the two living ordering rules (upgrading.md,
init-safety.md) record the exception.
Tests: the consent step is now checked by running it — the command is taken
from `Options()`, resolved through the same cobra lookup and predicates the
root pre-run uses, and fed to the real gate against a remote-backed shared
fixture, with the shipped bare verb as the counterfactual. Asserting the
option's wording is what let the dead command ship. `docs` is pinned in
`TestHandleRemoteMigrateGateJSON_DataBehind`.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(proxy): harden history and remote front doors
* fix(proxy): preserve ready claim and compact refusal contracts
* fix(proxy): validate ready claim row caps preprovider
* fix(proxy): key capability front door on command paths
Review fixes for the proxied-server capability front door.
Blocking: validateProxyCapabilitiesBeforeProvider keyed on cobra's leaf
Name(), and `bd ready` and `bd mol ready --gated` share the leaf name
"ready". The max-rows refusal written for the former also refused the
latter for anyone with BEADS_MAX_ROWS exported — a proxy-supported
command that has no --max-rows flag to refuse. Every branch and both
policy tables now key on proxyCommandPath (the path below the root),
with an explicit "mol ready" row saying so. The compact refusal moves
from "compact" to "admin compact" for the same reason: root `bd compact`
is a different command with its own proxied route, and its message now
names `bd admin compact --dolt` rather than a `compact --dolt` that the
root command has no flag for.
Blocking: the allow path had no coverage, and it is the direction that
needs it — a refusal that stops firing degrades to the older late
failure, but one that fires too widely breaks a working command at the
front door where nothing catches it. Added a real-command-tree allow
table (a parentless cobra command has no path and matches no rule, which
is how a synthetic test tree reports success for a refusal that never
fired), a drift guard that every table key names a command that exists,
and an e2e allow matrix running the proxy-supported set against a live
managed-local proxied project, once clean and once under
BEADS_MAX_ROWS=5. `bd ready` under that cap is in the same table as the
control: it must still refuse.
Row cap resolved once on the proxied claim path, via resolveMaxRowsQuiet
rather than by hoisting the claim early-return above resolveMaxRows. The
duplicate line is the malformed-BEADS_MAX_ROWS advisory, which is a side
effect of resolving; the front door now resolves silently and the
command body stays the sole warner, so the message appears exactly where
it did before the front door existed. Hoisting would have moved the
`--max-rows -1` usage rejection back behind provider construction and
regressed TestReadyClaimValidatesMaxRowsBeforeProvider, which this PR
added.
Also folded in, all in-theme:
- ProxyOutcomeNA asserts clean (it states the command lacks the flag,
which is nothing to refuse), and a rule carrying neither code nor
message falls back to a generic one instead of rendering as a bare
"Error: " with exit 1.
- The list/--repo row said notApplicable(); list_proxied_server.go
refuses it. A policy table that contradicts the command is worse than
a missing row.
- preflight binds --json to &jsonOutput like every other command's local
--json. commandJSONFlagChanged suppresses the config-driven default
whenever a local --json is set, so an unbound flag left
`bd preflight --json` with jsonOutput=false.
- Deleted the proxied no-op in doctor.go. "doctor" is in the refusal
table now, so the front door returns exit 1 before RunE ever runs.
CHANGELOG records that flip (exit 0 with a stderr note becomes exit 1
with proxy.doctor.unsupported) and that --json refusals are strict
JSON on stdout.
- Deleted the dead tail block in validateProxyMaintenanceBeforeProvider:
it could only run for a space-free path, which the table lookup above
it had already handled.
- TestHistoryDirectOnlyRefusalContract iterates its own expectation
table, so all 13 declared rows are asserted rather than 11.
- HandleProxyCapabilityError(nil) returns nil. Every AssertProxy* allow
path returns nil and this wraps that return value directly, so the
natural way to add the next rule -- a bare
`return HandleProxyCapabilityError(AssertProxy...(...))` with no
preceding `if` -- would have rendered an allowed capability as
"Error: <nil>" with exit 1. Latent today: all five nil-capable call
sites are guarded by conditions whose rules resolve to refused().
- The third front-door branch, the skipsStoreInit route into
validateProxyMaintenanceBeforeProvider, keys on proxyCommandPath like
the other two, and "doctor" joins the path list in
TestProxyFrontDoorBranchesUseRealCommandPaths so the drift guard
covers all three. It returns unconditionally, so a future
`bd <parent> doctor` matching on the leaf name would have taken nil
back from the now path-keyed validator and returned early past
guardLegacyNoStoreCommand and getDoltAutoCommitMode.
* test: make direct and proxied history ordering fixtures deterministic
Assign distinct fixture timestamps and assert the expected newest-first sequence so same-second writes cannot make SQL/proxy parity flaky.
Agent: Codex (unknown model, unknown reasoning)
* test(proxy): expect scoped admin compact refusal
Agent: Codex (unknown model, unknown reasoning)
* fix(proxy): restore typed refusals and settle the ready --claim contract
Maintainer review fixes for #6293.
Major: `bd list --repo` under --proxied-server was the one live refusal this
PR converted from a typed ProxyCapabilityError to a bare errors.New. The
pre-provider gate covers `create` only, so runListProxiedServer is list's sole
enforcement point: --json got prose on stderr instead of
{"code":"proxy.repo.unsupported",...,"mutates":false} on stdout, while the PR
simultaneously added a "list"/ProxyCapRepo policy row that no non-test call
site could reach. The call site is typed again and keyed on the command path,
which makes that row the single source of the message. list.go's wrapper now
passes an already-rendered exitError through instead of re-wrapping it, so the
typed refusal no longer picks up a trailing "Error: exit code 1".
Major: the front door's new --claim early return contradicted ready.go, which
is untouched and still refuses any positive cap "including on --claim" -- so
the bypass never let a claim through. It only moved the refusal after provider
setup and, with max_rows.go downgraded to HandleErrorRespectJSON, stripped the
stable code: `bd ready --max-rows 5 --json` answered proxy.max_rows.unsupported
while `bd ready --claim --max-rows 5 --json` answered a bare {"error":...}. One
refusal, two shapes, selected by an unrelated flag. Settled toward the
documented contract, and toward the pre-existing
TestReadyRefusesMaxRowsUnderProxiedServerOnClaim which already pinned it:
--claim is not exempt. The early return is gone and
rejectResolvedMaxRowsUnderProxiedServer is typed again, so the front door and
its backstop in ready.go render identically. The claim path keeps what it
gained -- a malformed or negative value is still rejected before any provider
work, resolved quietly so the advisory still prints exactly once. The three
comments that disagreed about this contract now agree.
Also folded in, all in-theme:
- The create/show proxied fallbacks are typed again and marked as the dead
defensive paths they are. Same downgrade, shadowed by the gate rather than
live, so nothing failed when the contract left them.
- compact.go's dead fallback carries the gate's corrected wording
("bd admin compact --dolt"), and the table comment no longer asserts the
message did not change in the same hunk that changed it.
- The "mol ready" row's comment says what the row is -- a documentation pin.
Path keying is the guard it was crediting itself for.
- Tests: the strict-JSON shape (code/mutates/exit) of the list --repo refusal,
claim-and-bulk parity plus the backstop for the max-rows refusal, and
preflight's --json binding in both directions -- including the config half
end-to-end, since flag.Value.Set never sets Changed and the config default
only lands inside refreshBoundCommandConfig.
- CHANGELOG: #5859 sits in exactly one section again (it is not an ancestor of
v1.3.0), plus an [Unreleased] entry for this PR's own user-visible deltas,
including the bd preflight json-config change.
---------
Co-authored-by: CI Bot <ci@beads.test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(config): make a dotted key round-trip through SetYamlConfigInDir (bd-zj95)
SetYamlConfigInDir writes dotted keys; GetStringFromDir reads them by splitting
on the dot and walking nested mappings; UnsetYamlConfig removes them. Those are
three directions of ONE round-trip property, and set/get was broken in two ways,
both reachable from ordinary files:
- An empty or comment-only config.yaml has no mapping node, so the nested
writer declined and the caller appended a literal 'dolt.host: ...' line — a
key whose NAME contains a dot. Nothing that splits on the dot can ever find
it.
- A file that already carried such a flat key had it updated in place, which
preserved the unreadable shape forever.
So a caller could write a value and immediately be unable to read it back. Two
consumers found it the hard way: bd's ownership handoff, whose commit write-set
refused itself on dolt.auto-start, and a Gas City managed city, whose
.beads/config.yaml is entirely flat dotted keys.
Six shipped call sites write a dotted key through this path, and every one of
them is a write into a .beads/config.yaml that may be empty or comment-only —
exactly the shape that produced the unreadable spelling:
cmd/bd/bootstrap.go:1108 sync.remote
cmd/bd/dolt.go:481 sync.remote
cmd/bd/init.go:3386, :3394 sync.remote
cmd/bd/migrate_dolt_mode.go:810 dolt.shared-server
cmd/bd/migrate_dolt_mode.go:1168 dolt.shared-server
An empty document now gets a mapping made for it, and a flat key of the name
being written is migrated to the nested form rather than updated in place. Only
the key being written is touched: a dotted key this call does not own belongs to
someone else and is left exactly as they wrote it.
Table test over nine file shapes — absent, empty, comment-only, flat, flat
commented, existing section, unrelated nested, unrelated flat, and mixed — each
asserting both that every key reads back and that no unreadable flat spelling
survives.
(cherry picked from commit cbe9bd6ca03416a76441e560bdec9fa67add99c5)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(config): unset a dotted key in the shape the writer produces
Writing a dotted key nested and then being unable to unset it is the same
round-trip break in the other direction. Set, get and unset are three directions
of ONE property, and all three have to agree on the shape: UnsetYamlConfig
comments out the line matching the key, and its pattern only ever matched a FLAT
'sync.remote:' line. Once the writer nests, an unset silently does nothing and
the value stays live — for sync.remote that means bd keeps a remote the operator
asked it to forget.
commentOutYamlKey now walks the nesting, tracking indentation per segment so a
key is commented only when it sits under its OWN parents rather than under some
other section sharing a leaf name. The flat spelling is still handled, because
files written by older bds carry it.
This is what closes the loop for the shipped unset paths — cmd/bd/config.go:578
('bd config unset'), cmd/bd/dolt.go:1761 and
cmd/bd/dolt_remote_proxied_server.go:34 — against the six writers the previous
commit nests: sync.remote at cmd/bd/bootstrap.go:1108, cmd/bd/dolt.go:481 and
cmd/bd/init.go:3386/:3394, and dolt.shared-server at
cmd/bd/migrate_dolt_mode.go:810/:1168.
TestFinalizeSyncedBootstrapWritesConfigFiles moves with it. It required a
literal 'sync.remote: ' line — a key whose name contains a dot, the one shape
GetStringFromDir and viper can never find, because both split on the dot and
walk nested mappings. That assertion passed for exactly as long as the value was
unreadable and failed the moment it became readable, so it now asserts what
bootstrap actually owes its caller: a remote that reads back.
(cherry picked from the internal/config half of commit
7f1ec4799a3e8af0a89b8f97c28ec30082fedbb7)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(cmd/bd): assert the sync.remote round trip, not a YAML spelling
Six cmd/bd test sites baked the flat spelling. They passed BECAUSE the bug was
present, and that is the part worth recording.
Viper finds a literal dotted key as well as a nested one; GetStringFromDir does
not, because it splits on the dot and walks mappings. So these tests exercised
config.yaml through ONE reader while the value was invisible to the other. They
were green for exactly as long as the value was unreadable, and
TestFinalizeSyncedBootstrapWritesConfigFiles failed on macOS and Linux CI the
moment it became readable. A test that only passes while a bug is live does not
merely fail to catch it — it defends it.
bootstrap_guard_test.go:84 seed
bootstrap_test.go:358, :410 seed
bootstrap_test.go:1330 assert (accepted 'sync.remote: ' OR
'sync-remote: ', neither readable)
dolt_worktree_remote_test.go:55 assert
init_remote_test.go:128 seed
All six now assert the round trip through GetStringFromDir, or the caller's own
observable, rather than any YAML text — flat or nested. Asserting the nested
spelling instead would have been the same mistake facing the other way.
The three seeds go through config.SetYamlConfigInDir, the real writer, via a
shared seedSyncRemote helper that asserts the read-back. A fixture can no longer
hand bd a config.yaml that bd itself would never have written.
These are the tests standing over the shipped writers this series fixes:
sync.remote at cmd/bd/bootstrap.go:1108, cmd/bd/dolt.go:481 and
cmd/bd/init.go:3386/:3394, and dolt.shared-server at
cmd/bd/migrate_dolt_mode.go:810/:1168.
(cherry picked from commit b0df00b59d2d68ee5fee313c05dc2300ad66fcef)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(config): close the dotted-key round trip the rest of the way
Review of the first three commits found the round trip still open in two
places, both reachable from ordinary files.
An empty or comment-only config.yaml parses to no YAML nodes at all, and
yaml.v3 keeps no trace of its text either — not even the comments. The
writer fabricated a mapping for that case and marshalled it, so the file
it wrote back was the new key and nothing else. `bd init` writes a
template that is comments and nothing else and then persists sync.remote
into it, so every remote-connected init shipped a config.yaml with its
whole documentation deleted. config.yaml is git-tracked: the operator
sees that as a committed diff they did not make. Append the rendered key
to the existing text instead, so nothing already in the file is parsed,
re-emitted or reformatted, and it survives byte for byte.
An unset comments the leaf out and leaves the section holding nothing —
`sync:` and no more. A null is not a mapping, so the next set refused it,
fell through to the flat writer, and put a literal `sync.remote:` back
into the file: the unreadable shape, re-created one command after being
fixed, with bd reporting success while GetStringFromDir saw nothing. A
section with no value under it has nothing to lose, so treat it as the
empty mapping it looks like.
Two shapes that are genuinely unwritable now say so instead of writing
the flat key and claiming success: a parent that already holds a value
(`sync: enabled`), and a file whose top level is not a mapping. Both
returned nil and produced a value no reader could see.
Unset also matched lines inside literal block scalars, so unsetting
sync.remote rewrote text the operator had written under a `notes: |`.
Skip a block scalar's body: it is data, not structure.
Finally, drop normalizeYamlKey and its empty keyAliases map. It has been
an identity function whose comment claimed it renamed keys.
* docs(changelog): record the dotted config key fix under Unreleased
It is the most user-visible fix on this branch and it was not in the
changelog, so it would not have reached the release notes or
`bd upgrade review`.
* fix(config): preserve existing flat dotted keys (GH#6594)
Keep literal dotted keys in their existing shape, align the direct reader with Viper precedence, and warn when both flat and nested spellings coexist.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Rongjun GENG
* fix(config): anchor the dotted unset walk to the key it was asked about
Review fixes for PR #6574 (maintainer iteration 1).
The new nested matcher in `commentOutYamlKey` anchored neither end of the
walk, so `bd config unset <dotted key>` commented out keys it does not own
and could leave the named target live while reporting success — the silent
divergence this PR exists to end. Two independent defects in one loop:
segment 0 matched at any indent, so a `dolt:` section under an unrelated
top-level key seeded the walk; and a key line merely deeper than the matched
parent was stepped over rather than ending the match, so an interposed
section was skipped instead of blocking descent. On
sync:
sub:
remote: keep
remote: target
unsetting `sync.remote` cut `sync.sub.remote` and left `sync.remote` live.
The walk now requires segment 0 at top level and every later segment to be a
direct child, treating any other key line as an opaque subtree to step over.
All four reviewer seeds are pinned in the unset table, which is generalized
to carry the key under test and the keys that must survive — the old table
could not express an over-match, since every case put the leaf one level
under a top-level parent.
Also, from the same review:
- Unset refuses, instead of degrading silently, on the two shapes a line
matcher cannot edit: a key inside a flow-style mapping (it no-opped with a
success exit, leaving the value live) and a key whose value is a block
scalar (the key line was commented and the body stayed behind, re-parsing
as a value of the parent). A key that is not set is still a no-op.
- Updating an existing flat dotted key rewrites that key's line instead of
marshaling the whole document back, which dropped blank separators,
re-indented nested blocks from two to four spaces and collapsed comment
alignment — a whole-file diff in a git-tracked config.yaml from a one-key
set. The line is swapped only when it is the entire entry, keeping the
key's own text and quoting; anything else falls back to the marshal, so a
quoted flat key still reads back.
- The two negative `init` guards assert a read-back rather than the absence
of the pre-PR spelling, which the writer no longer emits and which a real
regression would therefore have sailed past.
Refs: bd-zj95, GH#6594
Maintainer iteration 2 (both findings minor, non-gating; taken because each one
falsified something this commit itself asserts):
- The one-line rewrite kept every other line byte for byte but dropped the
trailing comment on the line it touched — a regression against the PR head,
whose node marshal carried LineComment through, in the branch whose whole
point is leaving a shared config.yaml alone. The note is re-appended from the
parsed comment matched back from the right of the line, so a `#` inside a
quoted value is not mistaken for its start. yaml.v3 hangs that comment on the
value node, not the key node as the review prescribed, except when the value
is empty; both are consulted and both are pinned. The existing pin seeded its
note on a bystander key and so could not see the loss; it is now on the key
under test.
- The unset refusal walked only the nested spelling, so a literal
`dolt.host: |` still had its key line commented out and its body orphaned at
the top level, leaving the whole file unparseable with a success exit — while
the changelog sentence this commit added says that case reports an error. One
lookup of the literal key closes the gap.
The gate's doc comment no longer claims to cover the class; it is two known
shapes, and it names the members still outside it.
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Rongjun GENG <rj.geng@gmail.com>
* test(tracker): add real proxy UOW conformance fixture (ga-p9iuv.25.1)
Agent-Signature: Codex (unknown-model; unknown-reasoning)
* test(tracker): harden proxy fixture evidence (ga-p9iuv.25.1)
Agent-Signature: Codex (unknown-model; unknown-reasoning)
* test(tracker): route conformance fetch through HTTP double
Agent-Signature: Codex (unknown-model; unknown-reasoning)
* fix(review): address adopt-pr review findings on the proxy conformance fixture
Gating major (synthesis Finding 1, option b): the suite certified
direct-vs-proxied parity while its two legs ran on divergent persisted
state. `seedTrackerConformance` seeded `Labels: ["old"]` through
`tracker.Store.CreateIssue`, which is not label-faithful across the
backends — the direct store persists `issue.Labels` via `PersistLabels`,
while the UOW store creates through `domain.CreateIssueParams{Issue:
issue}` with `Labels` unset and the domain create writes labels only
from `params.Labels`. Probed on both real backends: direct read back
["old"], proxied read back nil.
Drop the seed labels so both legs start identical, and document the
create-path blind spot in `run.go` and in the seed helper. The
production defect it exposes is pre-existing at base and is tracked in
bd-p0n1 with the required fix (pass `Labels` in `uowStore.CreateIssue`
plus engine-create normalization, since the domain label insert
hard-errors on an empty label that direct `PersistLabels` accepts).
Non-gating findings folded in:
- Finding 2: sort in the fake's `normalizedLabels` so it matches the
production `normalizedStringSlice` it mirrors; both real legs read
labels back ORDER BY label, so the divergence would have inverted the
fixture's authority on the first multi-label assertion.
- Finding 3: drop the `api_only_does_not_open_uow` open-count assertion
and the "prove ... does not initialize persistence" wording. Both
in-repo adopters supply synthetic API-only callbacks that never call
the opener, so the assertion could not fail. The subtest now routes
through `newSetup` like its siblings and is named for what it checks.
- Finding 4: assert the pulled dependency through `Snapshot.Dependencies`
and retire the parallel `DependencyExists` callback. One mechanism
instead of two, and it makes the field the dry-run and refusal
DeepEqual comparisons already carry load-bearing.
- Finding 5: add scoped `paths:` entries for this suite to the
proxied-local smoke lane, which matched none of these files and only
ran via manual dispatch. Keyed to the lane's own selector rather than
`internal/tracker/**` so unrelated tracker churn does not fire it.
Also assert `TestManagedLocalProxiedTrackerUOWConformance` is compiled
into the lane, so the trigger and the coverage stay honest together.
Validation: `go test ./internal/tracker/conformance ./internal/tracker`;
`TestDirectTrackerConformance` and
`TestManagedLocalProxiedTrackerUOWConformance` both green against real
embedded-Dolt and managed-local proxied backends.
Current review fixes (gcg-699284130204931139):
- Restore optional mutation-count assertions on the map-backed leg to catch
state-identical writes; compare both issue planes in all snapshots and
include tracker push-hash metadata on real backends.
- Add a normal-lane UOW update test for label trimming, deduplication,
sorting, omitted labels, and explicit empty-label replacement.
- Fully populate the fake wisp-only seed, remove unused open accounting,
isolate and decode the API-only response, and select the proxied lane
when either shared tracker seam changes.
Focused validation: tracker and conformance packages; both real backend
conformance suites (all six subtests each); make ci-pr-lint on Linux and
Windows. Overlay probes confirmed the unit test fails without normalization
and the no-mutation assertion fails for a state-identical write.
Full make test was run once: the two serve failures reproduce on base
71c4cd08b (the role-identity test under atomic coverage, and the server-start
test without an events-journal backend). The remaining stderr/configuration
failures pass on base and head after clearing inherited BD_OTEL_* and
BEADS_DOLT_SERVER_USER. These unrelated base/environment failures were not
changed in this review fixup.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen
* refactor(proxy): one capability registry, with a reason on every refusal
Proxied-server policy lived in three path tables (a maintenance refusal
map, a history classification map, a transform row list), each with its
own lookup and its own front-door validator, plus a flag matrix. Nothing
forced a new command to appear in any of them, so an unclassified
command sailed past the gate and died in the store factory with
`proxy server store should be uow provider`. That — not the table count
— was the root problem.
One table now (cmd/bd/capability_registry.go), and a test that fails
when a runnable command is missing from it. Adding a command is no
longer a place where policy can be forgotten: it is a build failure
until someone decides whether the proxied front door lets it through.
Every refusal carries a Reason: `design` where refusing is correct and
expected to stay (shared history, multi-repo routing, destructive admin,
storage-format surgery, strict --readonly), `unimplemented` where it is
a gap with a named owner. The reason renders in the refusal JSON,
additive to the frozen {code, error, mutates} contract, and is omitted
on refusals that report a runtime state rather than a policy so a
consumer keying on its presence is never told "" by mistake.
The registry also inventories the 57 untyped refusals commands raise
from their own RunE. Those rows are not enforced — converting them
changes observable output and belongs to the slice that owns each
family — but a source scan now keeps the inventory honest in both
directions.
The store-factory backstop is typed as `proxy.store.unrouted`, the
unreachable duplicate readonly refusal in main.go is gone (the proxied
branch above it already returns for the only config that reaches it),
and with it `backendSupportsStrictReadonly`, which had no other caller.
No outcome changes. Every code, message and exit status is identical,
which #6576's five-topology matrix proves: 90/90 cells unchanged
(HONORED 47, REFUSED_TYPED 24 = 4 design + 20 unimplemented, ERROR 12,
WRONG_ANSWER 4, DEGRADED 3), all five topologies exercised, no skips.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor(proxy): `migrate hooks` is an unimplemented refusal, not a design one
The registry filed `migrate hooks` under "storage-format and workspace
surgery against a store other clients may be holding open". That rationale
does not describe it: migrate_hooks.go plans and applies GIT HOOK FILE
migration through doctor.PlanHookMigration, on the local filesystem, and
opens no store at all. Left as it was, proxied-local — the default topology
since 1.3.0 — loses the command permanently, because `design` tells every
later slice the refusal is semantic and settled.
It is not settled, but it is also not free to lift, and the difference is
structural rather than semantic. `migrate hooks` appears on none of main.go's
store-init skip lists, so permitting it makes the root pre-run open the
proxied provider before RunE runs. Measured with the row flipped to
permitted, not reasoned about: on a managed-local workspace
`bd migrate hooks --dry-run` started the proxy AND its dolt child — both
pidfiles present — to print a hook plan for five missing hooks, and on a
workspace with an unreadable sidecar it exited 1 with "failed to open uow
provider: corrupt proxied-server sidecar ..." where it had cleanly refused
before. Trading a typed refusal for a provider-open error is not a lift.
So: Reason=unimplemented with a Tracking item that names the actual work —
put the command on the store-init skip list first, then permit it — which is
S7's, not this slice's. No outcome changes; the row still refuses with the
same code, message and exit status. The registry header now says that
permitting a path costs a provider open, since that is the fact this row
turns on and the one the completeness test cannot see.
Also leaves S7 an explicit instruction on the rows next door. `migrate
issues`, `migrate-personal` and `admin cleanup`/`admin reset` claim `design`
on a topology-blind rationale — "a store other clients may be holding open",
"destructive against a possibly-shared store" — that describes external and
team-server workspaces and does not describe managed-local, which is 1:1 and
bd-owned. They are not reclassified here: the table cannot yet express
"refused, except on managed-local", and narrowing them is semantic work
nobody has done. The comments now say that is why, so the next reader does
not mistake conservatism for a considered verdict.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(backup): route the backup family over proxied-server, refuse it by design off-host
A proxied-server workspace had no backup path at all: all five verbs — init,
sync, remove, status, restore — refused. Proxied has been the default topology
since 1.3.0, which made this the highest user-weight gap in the proxied-parity
plan.
The mechanism needed no proxy work. CALL DOLT_BACKUP(...) is ordinary SQL,
RunNonTx already hands out a raw pinned connection (the seam compact --dolt and
gc run on), the UOW DSN sets a connect timeout and no read deadline, and an
active connection keeps the idle reaper from arming — so a backup that takes
minutes is safe from both the driver and the 30s reaper. The work was use
cases, route files and policy rows, and the premise held.
The policy is the interesting half, and it is the first genuinely
topology-differentiated rule in the capability registry. A backup destination
is resolved by the SERVER: `file:///…` names a path on the machine running
dolt. On managed-local that machine and that user are bd's own, because bd
spawned the child. Anywhere else — an external host or socket, or a
beads-team-server database — the URL describes a filesystem bd cannot see, so
honoring the command would either fail at the point of use or, far worse,
report success having written the backup where the operator will never look.
Those shapes stay refused with Reason=design: no plumbing on this side gives bd
a path on somebody else's host.
Team-server is classified by OWNERSHIP, not transport. bts owns the store's
schema and identity whether bd reaches it over a port, a socket, or a child bd
started, and one client registering a server-side backup remote acts on every
client's data — the shape of the storm this command's own help text warns about.
Restore quiesces before it replaces. DOLT_BACKUP('restore') swaps the database
under the server, which is undefined with clients connected, so: the exclusive
workspace gate `bd backup restore` already takes excludes every other gated bd
command (including `bd serve`); this closes the provider the pre-run opened and
shuts the proxy and its dolt child down; it reopens a provider of its own to
run the restore as the only client; then it puts the topology down and reopens
once more to reconcile the project identity and the backup remote — which also
proves the restored database is serviceable. The final shutdown leaves the
workspace quiescent for the next command to relaunch lazily.
Registry rows gain a Topology map and honoredOn(), stated as "refuse, except
here" so a shape nobody thought about — a new transport, or the unknown a
corrupt sidecar produces — inherits the refusal rather than the exemption.
resolveProxiedTopology reads the shape from the workspace and reports unknown
rather than guessing.
`bd backup restore --json` now prints a result object on every topology; it
printed nothing before, which left a caller unable to tell a completed restore
from a skipped one. The four backup subcommands that lacked SilenceUsage/
SilenceErrors no longer follow their error message with "Error: exit code 1"
and a usage block.
Verified by round trip, not by exit codes: TestManagedLocalProxiedBackupRoundTrip
takes a backup on a live managed-local workspace, creates an issue after it,
restores, and asserts the pre-backup issue is back and the post-backup one is
gone, with both pidfiles absent afterwards.
TestProxiedServerBackupRefusedOnExternalTopology pins the typed design refusal
against the shared container and proves a refused command starts nothing and
writes nothing.
Flips four cells of #6576's matrix: `backup status` and `backup sync` go
REFUSED_TYPED/unimplemented -> HONORED and -> ERROR ("no backup destination
configured", the command's own error, same as every direct topology) on
proxied-local, and unimplemented -> design on proxied-external-tcp.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(backup): say why proxied backup is refused, and stop calling a cleanup failure a restore failure
Review follow-ups on the proxied backup slice. None of them changes which
commands are honored on which topology; what changes is what the refusal
CLAIMS, and what a restore says when only its teardown failed.
The refusal rationale was true of one destination scheme out of five. It said
"a backup destination is resolved on the server's filesystem, not this
client's" — which describes `file://` and nothing else. resolveDoltBackupURL
passes `https://`, `aws://` and `gs://` straight through, and `bd backup`'s
own help recommends DoltHub by name; for those the server pushes over the
network from its own environment and no filesystem of anybody's is involved.
An operator running `bd backup init https://doltremoteapi.dolthub.com/...` on
an external topology got a permanent verdict explained by a filesystem the
command never touches.
The refusal itself stands, on the reason that is true of every scheme: `CALL
DOLT_BACKUP('add', …)` registers the remote ON THE SERVER, where it is global
to every client connected to it, so one workspace's backup decision becomes
everyone's — the same shape as the auto-backup storm this command's help text
already warns about. The file:// locality problem is now stated as the second,
scheme-specific problem it is. The message keeps its frozen
"<path> is not supported in proxied-server mode" prefix and its
proxy.backup.unsupported code.
The remote-scheme case gets a Tracking item, the way `diff` got "1.4
candidate". The outcome is design; that particular CASE is an open question,
and a design label with no tracking reads as "never" to every later slice.
It is the same server-env credential question S4 has to answer for `dolt
push` on these same topologies. Recorded there too: restore-from-a-remote is
already half-broken in DIRECT mode, because validateBackupRestoreDir stats its
argument, so `bd backup restore https://...` fails everywhere today.
A restore that succeeded and then failed to shut the proxy down reported
"restore failed". The operator's data was back; they were told it was not,
and the obvious next move — run the restore again — was the wrong one.
withQuiescedProxiedProvider now returns teardown failures wrapped in
*proxiedTeardownError instead of flattening them into the operation's error,
and the message the caller renders is split into a function a test can hold
still, because the judgement it encodes (did the data come back) is the point.
Both call sites distinguish now; the second one's "did not reopen" wording was
also wrong for a teardown failure, since it had reopened.
Two smaller things while in here. The guard-rail comment on
newProxiedServerUOWProviderAdopting still said "only two callers legitimately
have no workspace identity to assert" — this slice added a third. That comment
is the register of identity-assertion bypasses, so it now names the third and
why, and says what to do about a fourth. And DirToFileURL was "file://" +
filepath.Abs with no scheme check: it would have turned a DoltHub URL into
file:///cwd/https:/doltremoteapi.dolthub.com/... , a valid-looking URL naming a
directory nobody asked for. Unreachable today, and every caller is a restore
path, which is exactly the capability the tracking item above describes.
CHANGELOG additionally discloses two direct-mode changes this slice makes that
were previously only visible in the diff: `bd backup restore --json` prints a
result object on EVERY topology where it used to print nothing, and the four
backup subcommands that gained SilenceUsage/SilenceErrors no longer follow a
failure with "Error: exit code 1" and a usage block, on every topology.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(backup): quiesce failed restore reopens and pin JSON output (bd-obos)
Preserve the primary constructor or operation error while reporting cleanup failures without a successful-restore marker. Exercise a real malformed-backup reopen failure and assert both pidfiles are removed; retain the successful round trip and assert its JSON result.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* refactor(proxy): one capability registry, with a reason on every refusal
Proxied-server policy lived in three path tables (a maintenance refusal
map, a history classification map, a transform row list), each with its
own lookup and its own front-door validator, plus a flag matrix. Nothing
forced a new command to appear in any of them, so an unclassified
command sailed past the gate and died in the store factory with
`proxy server store should be uow provider`. That — not the table count
— was the root problem.
One table now (cmd/bd/capability_registry.go), and a test that fails
when a runnable command is missing from it. Adding a command is no
longer a place where policy can be forgotten: it is a build failure
until someone decides whether the proxied front door lets it through.
Every refusal carries a Reason: `design` where refusing is correct and
expected to stay (shared history, multi-repo routing, destructive admin,
storage-format surgery, strict --readonly), `unimplemented` where it is
a gap with a named owner. The reason renders in the refusal JSON,
additive to the frozen {code, error, mutates} contract, and is omitted
on refusals that report a runtime state rather than a policy so a
consumer keying on its presence is never told "" by mistake.
The registry also inventories the 57 untyped refusals commands raise
from their own RunE. Those rows are not enforced — converting them
changes observable output and belongs to the slice that owns each
family — but a source scan now keeps the inventory honest in both
directions.
The store-factory backstop is typed as `proxy.store.unrouted`, the
unreachable duplicate readonly refusal in main.go is gone (the proxied
branch above it already returns for the only config that reaches it),
and with it `backendSupportsStrictReadonly`, which had no other caller.
No outcome changes. Every code, message and exit status is identical,
which #6576's five-topology matrix proves: 90/90 cells unchanged
(HONORED 47, REFUSED_TYPED 24 = 4 design + 20 unimplemented, ERROR 12,
WRONG_ANSWER 4, DEGRADED 3), all five topologies exercised, no skips.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor(proxy): `migrate hooks` is an unimplemented refusal, not a design one
The registry filed `migrate hooks` under "storage-format and workspace
surgery against a store other clients may be holding open". That rationale
does not describe it: migrate_hooks.go plans and applies GIT HOOK FILE
migration through doctor.PlanHookMigration, on the local filesystem, and
opens no store at all. Left as it was, proxied-local — the default topology
since 1.3.0 — loses the command permanently, because `design` tells every
later slice the refusal is semantic and settled.
It is not settled, but it is also not free to lift, and the difference is
structural rather than semantic. `migrate hooks` appears on none of main.go's
store-init skip lists, so permitting it makes the root pre-run open the
proxied provider before RunE runs. Measured with the row flipped to
permitted, not reasoned about: on a managed-local workspace
`bd migrate hooks --dry-run` started the proxy AND its dolt child — both
pidfiles present — to print a hook plan for five missing hooks, and on a
workspace with an unreadable sidecar it exited 1 with "failed to open uow
provider: corrupt proxied-server sidecar ..." where it had cleanly refused
before. Trading a typed refusal for a provider-open error is not a lift.
So: Reason=unimplemented with a Tracking item that names the actual work —
put the command on the store-init skip list first, then permit it — which is
S7's, not this slice's. No outcome changes; the row still refuses with the
same code, message and exit status. The registry header now says that
permitting a path costs a provider open, since that is the fact this row
turns on and the one the completeness test cannot see.
Also leaves S7 an explicit instruction on the rows next door. `migrate
issues`, `migrate-personal` and `admin cleanup`/`admin reset` claim `design`
on a topology-blind rationale — "a store other clients may be holding open",
"destructive against a possibly-shared store" — that describes external and
team-server workspaces and does not describe managed-local, which is 1:1 and
bd-owned. They are not reclassified here: the table cannot yet express
"refused, except on managed-local", and narrowing them is semantic work
nobody has done. The comments now say that is why, so the next reader does
not mistake conservatism for a considered verdict.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* test: cover direct and proxied workflow front doors
* test: run workflow parity coverage in CI (ga-p9iuv.14.2)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen
* fix(review): trigger the managed-local lane on its own test files
Maintainer fixup for adopt-pr review of #6303.
Synthesis/scorecard Finding 1 (minor, codex): the managed-local proxied
lane is the only place BEADS_TEST_PROXIED_LOCAL=1 is set, yet none of its
push/pull_request `paths:` patterns matched
cmd/bd/mol_frontdoor_managed_local_integration_test.go. The new parity
test could therefore only reach CI via merge_group:/workflow_dispatch: or
an unrelated path touch -- never on an edit to the file itself.
Add 'cmd/bd/*managed_local*' to both filters. Verified by re-deriving the
filters with GitHub's glob semantics (`*` does not cross `/`): the file
goes from unmatched to matched on both triggers, and the pattern matches
no other file in cmd/bd.
Also close the same gap for cmd/bd/proxied_outage_reconnect_integration_test.go,
which hosts TestManagedLocalProxiedOutageReconnectContract and was equally
unmatched. This is pre-existing (not introduced by #6303) and was not part
of the reported finding, but it is the identical defect in the identical
two lists: after this change every cmd/bd file defining a
TestManagedLocalProxied* test triggers the lane that runs it.
The lane's -test.list assertion is a subset check over a fixed name list,
so neither test needs to be added there.
Validated: actionlint clean, YAML parses, git diff --check clean, and the
before/after filter derivation above. No production or test code changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(test): reap dolt sql-servers leaked by killed test runs
A `go test -timeout` panic skips every t.Cleanup and TestMain defer, so a
test run killed that way left its `dolt sql-server` running forever. Two
gaps kept anything from ever noticing:
1. On darwin the deleted-cwd signal could not fire. macOS lsof prints the
bare path of a working directory that has been unlinked — no
" (deleted)" suffix, unlike Linux's /proc/<pid>/cwd — so readDarwinCwd
always reported deleted=false and selectOrphanTestServerPIDs' orphan arm
was dead code on this platform. It now stats the path and treats ENOENT
(and only ENOENT) as deletion, via a pure parseDarwinCwd that takes the
stat function so the classification is unit-testable.
2. Nothing ever looked at a DEAD run's temp root again. Each suite swept
only its own root, after its own m.Run() — the one moment a killed run
never reaches. New in internal/doltserver: WriteSuiteOwnerMarker claims a
root with the owning PID, and SweepDeadSuiteRoots globs a suite's prefix
at the START of the next run and reaps only roots whose recorded owner is
gone. An unclaimed root and a root whose owner is alive (a parallel
package, a second `go test`) are both left exactly as they are, so this
keeps SweepOrphanedTestServers' contract: never a shared temp dir, never
another suite's live server. decideSuiteRoot holds that judgment alone
and is table-tested; the liveness probe is build-tagged darwin/linux with
an always-alive stub elsewhere, making the helper a no-op there.
Wired into the cmd/bd and internal/storage/dolt TestMains, plus a new
TestMain for internal/storage/uow — the package that produced the observed
orphan and had no suite lifecycle at all. It pins TMPDIR under a suite root
so every t.TempDir() is sweepable, and newTestUOWProvider's cleanup now
reads the backend pid file before proxy.Shutdown and fails the test if that
server is still alive five seconds later, so a leak is visible where it is
caused rather than inferred later from a sweep.
Each wired TestMain reports a non-empty post-run sweep loudly, and fails the
run on it only under BEADS_TEST_FAIL_ON_LEAK=1 — opt-in so one flaky test
cannot redden a package for everyone. No workflow sets it yet.
Tests: go test ./internal/doltserver/ -run 'Sweep|Orphan|Suite' -count=1;
go test ./internal/storage/uow/ -run TestUOWDependencyEditorContract -count=1
-timeout 10m (real dolt); go test ./cmd/bd/ -run 'TestMain|TestVersion'
-count=1 -timeout 5m; go build ./...; go vet over the three packages;
gofmt -l . clean; golangci-lint (gosec + misspell) clean over the touched
packages. Verified on a live box: the orphan with the deleted cwd was
reaped, while the production server, an unclaimed suite root's server, and
an unrelated dolt server were all left running.
Refs: wy-j2zc8q
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1sjyiTjodNqNqEzEFbKAE
* fix(test): bound the sweep to temp roots and verify before killing
Round 2 on the leaked-test-server sweep, addressing an adversarial review of
2d9d656b5. Every finding was about the same thing: the first pass reached
further than its own doc comments claimed.
1. selectOrphanTestServerPIDs' deleted-cwd arm was root-independent, and the
darwin fix had just brought it to life on macOS. A PRODUCTION server is
spawned with cmd.Dir = <workspace>/.beads/dolt, so a developer who moved
that workspace — or whose external volume unmounted — would have their
live server reaped by any test run on the box. The arm now also requires
the deleted path to have been under a temp root (tempDirRoots: os.TempDir
plus /tmp, each in both its literal and symlink-resolved form, which is
what makes macOS's /var/folders vs /private/var/folders pair match). This
was a live hazard on linux too.
2. SweepDeadSuiteRoots promised it only touched marker-owned dead roots, but
reached SweepOrphanedTestServers, whose deleted-cwd arm spans the whole
box — at suite START, with sibling packages mid-run. It now uses a new
strictly root-scoped entry point, sweepServersUnderRoots, with the shared
SIGTERM/SIGKILL loop factored out as reapServerPIDs on each platform. The
end-of-run sweep in the TestMains still uses the broad one, which finding
1 has now bounded to temp dirs.
3. The uow cleanup's exit check blind-killed a bare PID. The server is not
this process's child, so its PID is reusable, and proxy.Shutdown
deliberately REFUSES to signal a record it cannot verify — killing that
very PID defeated the protection. It now keeps the whole pidfile record,
runs only when Shutdown returned an error (success already kills and
confirms), and gates both the liveness check and the kill on
procid.Verify / procid.Open with the recorded birth token. Timeout raised
to 30s, since Shutdown's own budget is 5s + 2s.
4. os.RemoveAll deletes the marker early, so a partial failure left an
unclaimed root that no later run could ever touch. Removal now does a
chmod u+w walk first (mirroring cmd/bd's forceRemoveAll, which exists
because that root doubles as an isolated $HOME full of read-only module
cache entries), and on a still-failing removal it rewrites the marker with
the same dead PID so the next run retries.
5. internal/storage/dolt created its root and ran the sweep above the
isHelperSubprocess early return: eight concurrent helpers each swept and
each claimed a root that os.Exit then abandoned. Moved below it; a helper
inherits the parent's live BEADS_TEST_CIRCUIT_DIR through the BEADS_
allowlist in integration.FilterEnv.
6. SweepDeadSuiteRoots globs a world-writable directory, so a planted root
with a dead-PID marker could aim it at a tree of someone else's choosing.
It now requires the root's uid to be os.Getuid() (unix-only file, accept-
all stub elsewhere, where the sweep is inert anyway).
7. The symlink leg of the selection test skips instead of failing where
os.Symlink is unprivileged. 8. "favour" -> "favor".
Tests: go test ./internal/doltserver/ -run 'Sweep|Orphan|Suite|Darwin'
-count=1 -v (49 cases, incl. new ones for a moved production workspace, an
unmounted volume, the observed orphan in both macOS path forms, the
root-scoped selection, canonicalRoots, tempDirRoots, the marker-restore path
and the read-only-directory removal); gofmt -l . clean; go vet over
doltserver, uow, cmd/bd and storage/dolt; GOOS=windows and GOOS=linux go vet
./internal/doltserver/; golangci-lint clean over all four trees;
scripts/check-build-tags.sh clean; go build ./...; go test -c for uow,
cmd/bd and storage/dolt. The three live dolt sql-servers on the box were
untouched throughout.
Refs: wy-j2zc8q
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1sjyiTjodNqNqEzEFbKAE
* fix(test): isolate helper circuit state, re-verify late exits, bound TMPDIR
Round 3, from the verification pass on efb7a1c39 (PASS-WITH-NITS).
1. internal/storage/dolt: moving the suite root below the isHelperSubprocess
return also took the per-helper circuit-breaker directory with it, so all
eight of TestMultiProcessSchemaInit's helpers would have inherited the
parent's BEADS_TEST_CIRCUIT_DIR and read-modify-written ONE file keyed
host:port:db, concurrently — a fresh flake risk in the exact test the move
was meant to protect. The helper branch now makes its own temp directory
and overrides the variable, as it effectively did before. No sweep and no
owner marker for helpers: they start no server, and a helper that leaves
through os.Exit would only abandon a marked root.
2. internal/storage/uow: requireBackendExited could observe the server alive
and then have it exit before procid.Open/Kill, which report a plain
"does not match token" that IsProcessGone does not match — so a server
that stopped a few milliseconds late was reported as one that survived
Shutdown entirely. Both failure paths now re-verify once and stay silent
when the process is gone; only a verifiably-live process is a t.Errorf. A
record with no birth token now logs the skip instead of returning
silently, so it cannot pass for a clean check.
3. internal/doltserver: tempDirRoots now drops roots too broad to be evidence
of anything. TMPDIR is an ordinary environment variable, so os.TempDir()
can hand back "/" or a home directory, and either would put every
workspace on the box back inside the deleted-cwd arm. isCredibleTempRoot
rejects the filesystem root, a relative path, and any directory that is or
contains $HOME, while /tmp, /private/tmp and /var/folders/… survive.
4. The identical SIGTERM/SIGKILL loop in sweep_darwin.go and sweep_linux.go
is now one reapServerPIDs in sweep_reap_unix.go, taking the platform's
identity probe as an isServer validator. It sits in a darwin||linux file
rather than the portable sweep.go because the signaling is POSIX; the
selection logic that decides which pids reach it stays platform-agnostic
in sweep.go.
Tests: go test ./internal/doltserver/ -run 'Sweep|Orphan|Suite|Darwin|TempDir'
-count=1 (53 cases; new TestTempDirRootsRejectsOverbroadTMPDIR drives
TMPDIR=/ and TMPDIR=$HOME through the real os.TempDir, and
TestIsCredibleTempRoot tables the predicate); gofmt -l . clean; go vet over
doltserver, uow, storage/dolt and cmd/bd; GOOS=windows and GOOS=linux go vet
./internal/doltserver/; golangci-lint clean over all four trees;
scripts/check-build-tags.sh clean; go build ./...; go test -c for uow,
cmd/bd and storage/dolt.
Refs: wy-j2zc8q
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1sjyiTjodNqNqEzEFbKAE
* fix(sweep): keep /tmp credible when HOME is a sandbox under it (wy-j2zc8q)
PR core went red on every Linux runner: TestTempDirRootsBoundTheOrphanArm
and TestTempDirRootsRejectsOverbroadTMPDIR reported tempDirRoots() empty.
Cause: scripts/ci/lib/test-env.sh exports HOME under a mktemp -d root in
/tmp, and isCredibleTempRoot rejected any root that CONTAINS the home —
so /tmp itself was thrown out and the deleted-cwd arm silently disabled on
exactly the boxes whose killed runs it exists to clean up after. macOS
never showed it: the sandbox home lands under /var/folders, and the
hardcoded /tmp survived.
The carve-out: a home living inside the fixed /tmp fallback is a SANDBOX
home that anchors no workspaces, so a root that merely contains it stays
credible. A root that IS the home is still dropped whatever the home looks
like, and the sandbox test is judged against the hardcoded /tmp, never
os.TempDir(), so TMPDIR=/home with HOME=/home/runner still reads as a real
home under an overbroad root.
Tests: the overbroad-TMPDIR test now pins HOME to a real-shaped
non-temp path (the ambient one is the sandbox on CI, where "a workspace
under HOME" and "a path under /tmp" are the same path), plus two new
subtests for the sandbox shape and a sandbox row set in the predicate
table. Reproduced the red and the fix on Linux in docker with
HOME=/tmp/beads-test-env-abc/home; also green with HOME=/home/runner and
/root, and on macOS.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEmu5ZSFoappn7s9yUQ3aF
* fix(test): stop leaking daemonized shared-server dolt from test fixtures (wy-j2zc8q)
Every uow fixture that provisions a shared-server workspace now registers
ONE cleanup, verifiedShutdownCleanup, which stops the proxy and its
`dolt sql-server` and — when proxy.Shutdown reports an error — asserts the
recorded backend pid is actually gone (procid birth-token gated) instead of
printing a t.Logf line into a passing test. Nine copies of the silent idiom
are gone; an AST guard fails the package if a fixture provisions a workspace
without the cleanup, or calls proxy.Shutdown by hand.
A reaped server now FAILS the suite that leaked it (ApplyLeakPolicy), with
BEADS_TEST_ALLOW_LEAK=1 as the triage-only downgrade. The previous default
warned on stderr and exited 0, which is how all three recurrences rode green
suites and were rediscovered from a dev box's process table.
The dead-run root sweep (owner marker + SweepDeadSuiteRoots) is extended to
the remaining packages that pin a suite temp root and start servers:
cmd/bd/doctor (cgo + !cgo), cmd/bd/doctor/fix (cgo + !cgo), internal/beads.
* test(uow): guard pairs shutdownOnInterrupt with verifiedShutdownCleanup, exempts validation-error fixtures (wy-j2zc8q)
Salvaged from the executor's worktree after the quiet-hours stop: rules A/B/C
over *testing.T functions, non-vacuity counters per rule.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWogqyZMByH2fYqUcafXvw
* fix(sweep): treat the per-user temp tree as a sandbox home root (wy-j2zc8q)
isSandboxHome whitelisted only /tmp, so on macOS a suite that pins HOME to a
t.TempDir() (cmd/bd/test_repo_beads_guard_test.go:128,
internal/beads/testmain_test.go:50) put HOME inside os.TempDir() itself
(/var/folders/xx/yy/T). isCredibleTempRoot then dropped os.TempDir() as "a
directory containing the user's home", tempDirRoots() collapsed to
[/tmp /private/tmp], and the deleted-cwd arm of SweepOrphanedTestServers was
inert on every Mac.
Judge sandbox-ness against a FIXED platform table (isUnderFixedTempRoots /
fixedTempRoots): /tmp everywhere, plus /var/folders on darwin,
canonicalRoots-expanded so /private/var/folders matches. TMPDIR still never
votes on its own credibility, so TMPDIR=/home with HOME=/home/runner keeps
reading as a real home under an overbroad root.
goos is a parameter, not a read of runtime.GOOS, so the darwin row is pinned
from Linux too.
Ran: go test -count=1 -run
'TestSandboxHomeUnderPerUserTempRoot|TestTempDirRoots|TestIsCredibleTempRoot|TestCanonicalRoots'
./internal/doltserver/ (ok); the pre-fix repro
HOME=$TMPDIR/fake-home-probe go test -run TestTempDirRootsBoundTheOrphanArm
now passes.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVJ7A7qWZYATyg2TsqggSA
* test(uow): exempt rule C by explicit name marker, not an error assertion (wy-j2zc8q)
The old rule-C exemption — "a function calling require.Error/ErrorContains
asserts the constructor rejected its arguments" — inferred intent from the
body, and TestNewExternalDoltServerUOWProvider_PreexistingDirtyDatabaseIsNotHealed
satisfied it by accident: it provisions a REAL external server, require.NoError
on the constructor, then asserts an error from a later query. Deleting BOTH
cleanup helpers from it left the guard green (mutation G).
Exempt only on an explicit, greppable name marker (_ValidationErrors), and
check the marker is not a lie: an exempted function must assert a rejection
(require.Error/ErrorContains) and must assert nothing succeeded (no
require.NoError/assert.NoError) — closing the rename-to-dodge path too. No
non-vacuity floor on the exemption count: if the marker stops matching, rule C
only gets stricter and the validation fixtures fail loudly.
Positive controls (both reverted):
- mutation G (drop both helpers from PreexistingDirty…) → FAIL:
"TestNewExternalDoltServerUOWProvider_PreexistingDirtyDatabaseIsNotHealed
provisions a shared-server workspace but never calls
verifiedShutdownCleanup(t, storeRootDir)"
- mutation G renamed to wear the marker → FAIL: "wears the
\"_ValidationErrors\" exemption but calls require.NoError/assert.NoError"
Ran: go test -count=1 ./internal/storage/uow/ -run
'TestEveryServerFixtureRegistersVerifiedCleanup' (ok; census: rule A paired 9,
rule C checked 8, exempted 2). go vet ./internal/storage/uow/ clean.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVJ7A7qWZYATyg2TsqggSA
* test(doctor): fail the doctor and fix suites on a swept leak (wy-j2zc8q)
ApplyLeakPolicy was wired into 4 of 7 TestMains; the three doctor-side suites
called SweepOrphanedTestServers and discarded its result, so a leaked dolt
sql-server there was reaped silently and the run still went green — the exact
blindness the policy exists to remove.
Four call sites across the three suites, in the pattern
cmd/bd/test_repo_beads_guard_test.go:52-54 and
internal/storage/uow/testmain_test.go:65-66 already use:
cmd/bd/doctor/testmain_nocgo_test.go -> "cmd/bd/doctor"
cmd/bd/doctor/dolt_e2e_test.go (cgo) -> "cmd/bd/doctor"
cmd/bd/doctor/fix/testmain_cgo_test.go -> "cmd/bd/doctor/fix"
cmd/bd/doctor/fix/testmain_nocgo_test.go -> "cmd/bd/doctor/fix"
Both build-tag variants compile.
Ran: go vet ./cmd/bd/doctor/... (0 issues); CGO_ENABLED=0 go vet
./cmd/bd/doctor/... (0 issues); go build ./... OK; go vet ./internal/doltserver/
./internal/storage/uow/ ./cmd/bd/doctor/... OK; gofmt -l internal cmd empty;
GOOS=linux go build ./... OK; GOOS=windows go build ./... OK.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVJ7A7qWZYATyg2TsqggSA
* fix(sweep): pin darwin's fixed temp roots to their resolved forms (wy-j2zc8q)
fixedTempRoots("darwin") listed {"/tmp", "/var/folders"} and left the
/private/… forms to canonicalRoots' filepath.EvalSymlinks, which reads the
HOST filesystem: it adds them on a Mac and nothing at all on Linux. The
platform table is a claim ABOUT darwin that TestSandboxHomeUnderPerUserTempRoot
deliberately judges from any platform, so ubuntu CI saw
isUnderFixedTempRoots("/private/var/folders/…/fake-home", "darwin") = false.
Spell the resolved forms out in the table instead — "/private/tmp" and
"/private/var/folders" — so the answer is host-independent. canonicalRoots
dedups, so on a Mac they are exactly what it would have added anyway, and the
darwin lsof cwd form now matches from any judging platform. Linux rows are
unchanged.
The subtest is also given a direct assertion on the table's contents: the
isUnderFixedTempRoots rows alone cannot catch a dropped literal when they run
on a Mac (EvalSymlinks puts it back), so the mutation that started this would
have passed locally forever.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MPryBr9EE2Px9crZ4NrTT
* test(bd): move the darwin sweep guard onto the leak-fails-the-suite contract (wy-j2zc8q)
TestRunTestsAndSweepReapsOrphanedServer predates ApplyLeakPolicy (097757b3e,
wy-s4zdj) and asserted the OLD policy: a swept orphan still exits 0. With the
policy in place it fails on macOS CI with runTestsAndSweep() = 1, want 0 —
the test was pinning exactly the behavior this PR removes.
Restate it as the two-case contract it is now: the existing case expects 1
(a swept leak fails an otherwise-passing suite), and a sibling sets
doltserver.AllowLeakEnv to "1" and expects 0. Both still assert the fake
server was actually reaped; the fake-dolt shape and the reap wait are
unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MPryBr9EE2Px9crZ4NrTT
* fix(sweep): report the leaked server's working directory, not just its PID (wy-j2zc8q)
Both leak lines named PIDs only:
Info: swept 1 orphaned test dolt sql-server process(es): [21881]
FAIL: cmd/bd leaked 1 dolt sql-server process(es) [21881]; swept them.
By the time anyone reads that, 21881 has been dead for minutes and identifies
nothing — so a package with hundreds of tests reported a leak with no way to
find which fixture caused it. The sweep already knew the answer: every
candidate carries the cwd it was serving (serverCandidate.cwd), and a leaked
test server's cwd is the .beads/dolt under the suite's temp tree, which Go
names after the test that made it (<root>/TestSomeName1234/001).
Thread it through. selectCandidatePIDs/selectOrphanTestServerPIDs become
selectServers/selectOrphanTestServers returning a new exported SweptServer
{PID, Cwd}, reapServerPIDs becomes reapServers over the same type, and
SweepOrphanedTestServers and ApplyLeakPolicy carry it end to end — every
existing call site is a pass-through from the one to the other, so they are
unchanged. SweptServer.String renders "<pid> cwd=<dir>", which is what the
two stderr lines now print:
Info: swept 1 ... process(es): [21881 cwd=/tmp/TestFoo123/001/.beads/dolt]
Tests: the darwin ps/lsof selection path now asserts whole SweptServers
(cwd included) rather than PIDs; TestSweptServerNamesItsDirectory pins the
rendering; TestApplyLeakPolicyNamesTheLeakingDirectory captures stderr and
pins the cwd in both the FAIL and the downgraded Warning line; and
TestReapServersReportsTheLeakedDirectory pins the Info line against a real
reaped process. sweep_other.go (non-unix) keeps the same shape.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MPryBr9EE2Px9crZ4NrTT
* fix(test): stop the shared dolt sql-server three init fixtures daemonize (wy-j2zc8q)
The leak the new guard catches. `bd init` in shared-server mode takes the
shouldInitSharedGlobalDB branch (cmd/bd/init.go:1417) and calls
doltserver.Start(sharedDir), which DAEMONIZES — cmd.Process.Release(), no
Wait, cmd.Dir = <sharedDir>/dolt (doltserver.go:1443-1446). Three cmd/bd
fixtures run that as a subprocess with BEADS_DOLT_SHARED_SERVER=1 and never
stop it, so the server outlives the `bd` that started it, the test that ran
it and the suite whose temp HOME it is serving:
cmd/bd/dolt_worktree_remote_test.go:34 (--prefix remote-sync)
cmd/bd/init_test.go:2096 (--prefix bare-fallback)
cmd/bd/init_test.go:2318 (--prefix bare-core)
Evidence: a full local `go test ./cmd/bd/` left
`dolt sql-server --config <suite root>/.beads/shared-server/dolt-server-config.yaml`
running with cwd /private/var/folders/…/beads-bd-tests-1850365081/.beads/
shared-server/dolt and databases beads_global + remote_sync — the remote-sync
prefix names the fixture. All three resolve the SAME $HOME/.beads/shared-server,
so only the last starter leaves a survivor; the process table names one while
three carry the defect.
stopSharedServerCleanup (new cmd/bd/shared_server_cleanup_test.go) is the one
cleanup they now register, before the first subprocess so the t.Fatalf paths
are covered: record the pid from doltserver.IsRunning BEFORE stopping (a clean
Stop deletes the pid file), capture its procid birth token, doltserver.Stop,
then assert the recorded process actually left — t.Errorf and a force-kill if
it did not. Birth-token gated throughout: the server is not this process's
child, so its PID is reusable the moment it exits. Same shape as
verifiedShutdownCleanup in internal/storage/uow (35faf60e5).
Verified both ways on the same two tests:
before: FAIL: cmd/bd leaked 1 dolt sql-server process(es)
[4217 cwd=/private/var/folders/…/beads-bd-tests-1902359010/.beads/shared-server/dolt]
after: no Info/FAIL leak line, no sql-server left under any suite root
The three assertion failures in those tests (dolt_worktree_remote_test.go
sync.remote, init_test.go DoltMode server/embedded) reproduce identically with
and without this commit — pre-existing, untouched here.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MPryBr9EE2Px9crZ4NrTT
* fix(test): stop the shared and proxied servers the init-metrics fixture daemonizes (wy-j2zc8q)
The post-run sweep on 164661ce4c named a fourth leaker on both CI runners:
`bd-metrics-home-*/.beads/shared-server/dolt`, TestInitMetricsEmittedPerDoltMode's
shared_server_via_flag case. That fixture runs `bd init --shared-server` with
HOME set only in the subprocess env, so the daemonized shared server lives
under a tree the in-process stopSharedServerCleanup never looks at. The same
table's proxied_server_via_flag case leaves a proxy plus its backend server
under <repo>/.beads/dolt with proxy.pid / proxy-child.pid records that no
dolt-server.pid cleanup can see.
- stopDoltServerCleanup(t, beadsDir): the existing verified stop, now with
an explicit beads directory; stopSharedServerCleanup keeps its signature.
- stopProxiedServerCleanup(t, proxyRoot): proxy.Shutdown (the verified stop
`bd dolt stop` performs) when either record exists.
- runBdInitForMetrics registers both before the subprocess runs, and the
shared case now passes BEADS_DOLT_SERVER_PORT=<free port> so it actually
starts a server on a box whose 3308 is already taken instead of silently
skipping the path (the previously unused extraEnv field carries it).
Probe: with the two registrations commented out the sweep reports both
servers (`swept 2 ... bd-metrics-home-*/.beads/shared-server/dolt ...
bd-metrics-repo-*/.beads/dolt`); with them in place the package is ok.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXZ9wbaFUnzRWcMj7iBxmq
* fix(test): scope suite leak attribution and verify cleanup (bd-154w)
Maintainer fixup for PR #6441, review attempts 1, 2, and 3.
Wire dbproxy/server into the marked suite-root lifecycle and verify the
standard fixture's backend shutdown before its directory is removed.
Capture synthetic leak-policy stderr, share the suite-root guard helper,
and document the manual repro harness's unconditional Kill/Wait cleanup.
Use SweepSuiteTestServers for every failure-producing post-run sweep,
including CGO, non-CGO, and integration callers. It delegates to the
existing strict root selector so a clean suite cannot reap another live
suite's deleted-cwd leak or fail in its place. Keep abandoned-run cleanup
separate through owner-checked SweepDeadSuiteRoots, and deprecate the
legacy global sweep for TestMain use without deleting contributor tests.
Pin and mark the integration suite's temporary root to retain detection.
Add a Linux process regression proving clean B preserves A's deleted-cwd
server and passes, then A reaps its own server and fails. Retain dead-owner
cleanup coverage and guard both integration temporary-directory APIs.
Pin the storage, CLI, and internal/beads suite roots before fixtures run,
with guards for both temporary-directory APIs. Preserve the storage helper
subprocess early return and the original parent for abandoned-root cleanup.
A Linux subprocess regression exercises the real storage TestMain: an
owned deleted-cwd fixture fails its suite while a foreign process survives.
Keep the CLI sandbox HOME beside fixtures so ~/.beads cannot become a
fixture ancestor and interfere with worktree repository discovery.
Keep integration server data owned but allocate its Unix socket in a short,
private directory with explicit cleanup. Exercise a data path exceeding
the Unix socket path budget while retaining the real SQL round trip.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Agent-Signature: Codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(dolt): contain `bd dolt start` on proxied workspaces; make `bd dolt status` truthful
`bd dolt start` knew nothing about proxied-server mode, and the default
proxied root IS `.beads/dolt` (internal/doltserver/physical_root.go:113-127).
With the proxy tree down it launched an unsupervised `dolt sql-server`
directly over that root; the next ordinary bd command then failed with
`invalid connection` because the relaunched proxy found a foreign server on
its port. With the tree up it adopted the proxy's own dolt child into bd's
classic PID/port records, leaving two managers for one process.
`bd dolt status` read the classic pidfile, which proxied mode never writes,
and reported "not running" against a healthy backend — the wrong answer that
sent operators to `bd dolt start` in the first place.
start is now a typed refusal (`proxy.dolt_start.conflict`): the proxy owns
its child's lifecycle, and an idle reaper means a "started" postcondition bd
could not honor beyond the idle window. status reads the proxy's own records
and reports the proxy and its backend separately, starting nothing.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(dolt): compare canonical proxied status roots (bd-y6iz)
Address PR #6577 review F3 by resolving both existing root paths before
comparison and checking resolution errors. Exercise the existing managed-local
topology test through a workspace symlink so Linux catches the macOS path
alias regression while preserving all process and lifecycle assertions.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Julian Knutsen
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(schema): stop the smart gate auto-migrating a data-behind clone
The smart migrate gate's first-mover verdict was computed from schema facts
alone: equal content hashes against the cached remote ref, equal max version,
and at-or-above the convergence floor. None of those say anything about where
the clone's branch sits relative to the ref the hashes came from, so a clone
that was level with the remote on SCHEMA but behind it in unpulled DATA commits
satisfied every precondition and was classified a safe first-mover.
It then migrated in place, minting local-only schema commits on a HEAD missing
the remote's data commits. When the pending batch moves a tracked table onto
the dolt_ignore plane (0062's events), every subsequent `bd dolt pull` refuses
to merge (#6368) and the clone can no longer fetch the very commits it was
already behind on. v1.3.0's upgrade audience is largely 1.1-era databases, which
is exactly the cohort reaching this state.
The decisive fact was already wired: routeSmartGate's remote-ahead branch
consults adopt.IsStrictAncestor (ahead == 0 && behind >= 1) via
routeAdoptFastForward, and both production call sites supply it. The
equal-version path simply never read it. Read it there too, before granting the
automatic migrate, and stop with a new data-behind fallback reason naming the
one-command remedy.
The predicate does the narrowing for free: a level clone (ahead 0, behind 0) and
a clone with unpushed local commits (ahead > 0) both read false and still
auto-migrate, so only a strictly-behind clone is refused. An inconclusive
ancestry read degrades to the blunt #4515 block rather than assuming level,
matching the file's contract that no fallback is less safe than the blunt gate.
Below-floor outcomes are untouched — the check sits inside the floor arm.
The stop reuses the existing blunt RemoteMigrateGateError with an empty
Decision, so there is no change to the JSON or agent contract. Both shipped
escape hatches still work unchanged: --force/BD_ALLOW_REMOTE_MIGRATE=1 are
consulted before the smart gate, and BD_SMART_GATE=0 still yields the blunt
block.
Two details the reason text has to get right. The "and the migrate proceeds on
its own" promise is suppressed on a shared store, where the first-mover arm
stays disabled regardless (#5920) and the retry still needs consent — promising
otherwise would loop the operator. And an unparseable BD_SMART_GATE value does
not outrank this reason: like shared-store, the stop stands whatever the env
says, and it is the only reason carrying a remedy the operator can act on now,
so burying it behind an env complaint would cost them the fix.
Regression test builds a genuinely data-behind clone against a real Dolt
server rather than stubbing the fact the bug is about: a source regressed one
migration below latest publishes C0 to a file:// remote, a real DOLT_CLONE
takes C0, the source makes a pure DATA commit C1 (no schema change, so both
stay at the same schema version) and pushes, and the clone runs DOLT_FETCH
only. The behind-ness is then measured, not assumed. The test also proves the
remedy loop self-heals: after the fast-forward the same gate call auto-migrates
the clone as a true first-mover, so the fix does not over-refuse.
Fixes#6575
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(schema): give the data-behind stop a working remedy, and widen it
Review follow-up on the #6575 fix. The stop was right; what it told the
operator to do was not reachable, and it protected the rarer half of the
cohort.
F1 (blocker): the refusal prescribed `bd dolt pull`, and `bd dolt pull` was
refused by it. Measured on a real data-behind embedded clone (ahead=0,
behind=1, clean working set) at the previous head: the pull exited 1 printing
"Run `bd dolt pull` first, then retry"; `bd sync` and `bd init --reinit-local`
exited 1 the same way; `bd bootstrap` reported "Database already exists …
Nothing to do." and exited 0; `bd migrate schema --force` then `bd dolt push`
left ahead=1 behind=1 with the push rejected non-fast-forward. The only thing
that moved the clone was BD_ALLOW_REMOTE_MIGRATE=1 — performing the migration
the stop exists to prevent. An embedded workspace has no external `dolt` binary
either, so that was a fence with no gate.
It is the #4566 deadlock one refusal over, so it takes #4566's shape of fix:
a lenient open for the command whose whole purpose is to clear the refused
precondition. Narrower than #4566's, though — the remote-sync open tolerates
ONE gate reason (RemoteMigrateGateError.IsDataBehind) and nothing else. A pull
cannot resolve a fork skew, a below-floor database, a shared-store consent
decision or an opted-out blunt block, so waving it through those would buy
nothing and hide them; the dirty-table and dependency-re-key refusals stay
fatal on this open too. Broadening the existing LenientOpen classification
instead would have granted all of that in one line.
Verified end to end on both shapes, exit codes real: `bd dolt pull` 0
(0,1 -> 0,0), retrying the refused write auto-migrates as a true first-mover,
`bd dolt push` 0. On a diverged clone the pull merges: 0 when it can, 1 with
"merge conflicts in config require operator resolution; merge aborted and
working set restored" when it cannot, and `bd dolt pull --strategy theirs`
then 0 — which is why the diverged guidance names it.
F2 (high): LocalIsStrictAncestorOf is ahead == 0 && behind >= 1, so a clone
with any local commit of its own read "not behind" and still auto-migrated.
Measured at the previous head with ahead=1, behind=1: "safe first-mover", and
the migration ran. bd auto-commits every write, so behind-AND-ahead is the
ORDINARY multi-machine state and the shape the fix protected was the narrower
one. It reaches the identical wedge — the migration lands on a history missing
the remote's commits either way — so the predicate is now behind >= 1 whatever
ahead is, read from LocalAheadBehind (the counts LocalIsStrictAncestorOf was
already computing and discarding). A level clone and a purely-ahead clone have
nothing to pull and still auto-migrate, verified through the CLI.
The remedy differs by shape even though the command does not, so the two stay
separate verdicts all the way out to the message, the agent directive and the
JSON: one is told its pull fast-forwards, the other that it merges and how to
resolve conflicts. An adopter that wires only the older callback keeps the
narrower (pre-widening) reading rather than losing the stop.
F3 (medium): with data-behind outranking fallbackReasonSharedStore, a shared
store's refusal rendered with neither "co-resident" nor "#5920" anywhere —
Options()' sharedRisk only ever decorated the adopt option. The #5920
consequence and the `bd migrate schema` consent step the retry needs there now
travel with this reason, on every surface.
F4 (medium): --json emitted only fallback_reason: "data-behind" while
observed/expected/options stayed the blunt default, whose option 1 is
["bd migrate --force", "bd dolt push"] — the bug followed by a push that is
guaranteed rejected while the clone is still behind — and whose option 2
no-ops. The pull-first remedy lived only in prose --json never emitted.
observed/expected now describe this stop, options is the single pull-first
option, and data_behind_shape says which pull to expect. decision stays absent
and fallback_reason unchanged, so the key agents match on does not move.
The blunt body is REPLACED for this reason rather than decorated: both of its
options were measured wrong here, and leaving them under a note saying "pull
first" is what sent the last round back into the wedge. Error() is deliberately
untouched — the headline stays the blunt #4259 line, and the body's first
sentence accounts for it.
Both escape hatches are unchanged and re-measured: `bd migrate --force` and
BD_ALLOW_REMOTE_MIGRATE=1 are still consulted before the smart gate (exit 0),
and BD_SMART_GATE=0 still yields the blunt gate unconditionally — including
for `bd dolt pull`, which is what opting out means. The two corrections from
the first round are preserved: the "proceeds on its own" promise is still
gated on !e.Shared, and the unparseable-BD_SMART_GATE carve-out still lets
data-behind outrank an env complaint (BD_SMART_GATE=maybe re-measured).
Tests cover both shapes at three levels. The schema routing table pins the
widened predicate, the shape split, the error degradation, the
IsStrictAncestor fallback, and every remedy surface including IsDataBehind's
narrowness; neutralizing the widening fails three of its subtests. The
real-Dolt regression test now runs both shapes over the same two-clone
file:// fixture, measuring ahead/behind rather than stubbing it and asserting
that the strict-ancestor relation is false exactly where the diverged shape
needs the widening. A new embedded test builds a genuinely data-behind
embedded store, proves OpenForRemoteSync gets through the refusal without
migrating, and proves BD_SMART_GATE=0 on the same fixture does NOT.
No S0 matrix cells flip. No matrix fixture configures a Dolt remote, so
routeSmartGate stays unreachable; the only `dolt pull` probes are the
proxied-mode typed refusals, which are classified in historyCapabilityMatrix
before any store opens and are untouched.
Refs #6575
Refs #6368
Refs #4566
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(schema): retarget the shared data-behind consent verb under --global
Self-review catch on the previous commit's own new text. The #5920 consent verb
the shared data-behind guidance names is TARGET-SCOPED: under --global the
refused open aimed at beads_global, so the project-scoped `bd migrate schema`
would consent the wrong database and leave the refusal in place. The existing
shared-no-remote arm already handles this (printGlobalDatabaseConsentHint and
the JSON retarget), and the new arm had to as well.
The JSON retarget could not simply reuse the Decision test: this stop reaches
the renderer through the default empty-Decision arm, keyed on the fallback
reason, so `e.Decision == "shared-no-remote"` misses it. The human body now
names the --global variant beside the project-scoped one, exactly as the
shared-no-remote body does. The pull itself is target-agnostic and is
deliberately NOT rewritten.
Refs #6575
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(schema): give the data-behind read path the pull remedy too
Round 2 fixed the write path and the agent payload, but left the two
lenient embedded opens rendering the blunt #4259 coordination block. Those
opens do not fail on this refusal - they warn and carry on - so the warning
IS the whole contract for `bd list`, `bd ready`, `bd show`
(openReadOnlyCommand) and `bd dolt commit` (openWorkingSetReconcile). Both
printed `gateErr` (Error(), the one-line summary) followed by the unchanged
sharedGuidance bullets, so on a data-behind clone the first thing bd said
was:
• designated migrator (only ONE machine): bd migrate --force && bd dolt push
• every other clone (another already migrated): bd bootstrap
Measured on a fast-forward clone at the previous head: that migrate lands
v67 on a history the clone is still behind on, and the `bd dolt push` after
it exits 1, rejected non-fast-forward - the #6575 state, reached by
following bd's own instruction, from the same clone whose write path says
in capitals not to run it. `bd bootstrap` no-ops against an existing
workspace. `bd list` is the first thing a 1.1-era upgrader runs and what
agents run constantly, so this was the most-read surface of the whole stop.
Both arms now branch on gateErr.IsDataBehind() and print
gateErr.UserMessage(), which is where the shape-branched pull-first body
already lives - the same thing server mode's warnLenientOpenRefusal has
printed all along. The intent framing is kept rather than replaced: the
command in hand is still succeeding against the old schema, which the
body (written for the fatal refusal) does not say. Refusals that are not
the data-behind stop keep the coordination bullets, which are right for
them; a second test pins that so the new body cannot swallow them.
Verified by running, not asserting - `bd list` and `bd dolt commit` on real
data-behind clones of both shapes, then `bd dolt pull` and a re-run, which
migrates.
Also fixes the agent payload contradicting itself. For data-behind,
AgentDirective calls `bd dolt pull` the single option, Options annotates it
`when: always, for this stop` and `risk: none - a pure fast-forward`, yet
human_decision_required stayed hard-coded true, so an agent keying on that
field stalled for approval of a step the same payload calls unconditional
and riskless - and the cost of that stall is reaching for
`bd migrate --force`. It is now false for exactly that arm. It stays true
when DataDiverged (the pull merges and can need conflict resolution and a
--strategy choice) and when Shared (the payload's second option needs an
operator who can confirm every co-resident client is upgraded, #5920);
getting either backwards would be worse than the contradiction. The `when`
string is deliberately unchanged for both shapes - the pull is the only way
forward either way; it is the risk, not the applicability, that diverging
changes.
Refs #6575
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Beads has had no intake labeling: 829 open issues and 388 open PRs carry no
kind/priority/status label, so the hourly PM triage patrol (Sarah, ADR-006),
which only fetches status/needs-triage items, has processed a single item
since 2026-07-17.
Adds the five gascity workflows with the bot login swapped to
gascityinc-sarah[bot]:
- triage-label: add status/needs-triage on issue/PR open, reopen, ready_for_review (skips drafts)
- remove-needs-triage: drop the inbox label when a non-status label is applied by anyone but the PM App
- request-needs-info / remove-needs-info / close-stale-needs: the needs-info / needs-repro lifecycle the triage framework emits
Existing open items are not relabeled by this change; a one-off backfill is a
separate, explicit step.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
The v1.3.0 forward-port renumbered main's add_wisps_current_revision from
ignored 0026 to 0027, because release/1.3.0's dep_rekey_dedup_marker shipped
inside the v1.3.0 tag at 0026 and can never move. That makes
TestDepRekeyMarkerIsLatestIgnored's "the marker is the latest ignored
migration" assertion false by design, not broken.
The fixture technique the canary guards is untouched by the renumber.
unrecordIgnoredVersionsFrom deletes cursor rows with version >= the marker, so
unrecording from 0026 drops the cursor below 26 and migrate re-applies the
whole tail: the marker comes back pending no matter how many versions sit
above it. The range delete is why later ignored migrations have to stay
re-runnable, and 0027 already guards its ALTER on INFORMATION_SCHEMA for
exactly that reason.
So assert the property the canary actually exists for -- the marker is still
inside the ignored series -- and rename it, since "IsLatestIgnored" now names
something the series deliberately does not do.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The forward-port merge produced a go.mod/go.sum that is a union of both
sides — release/1.3.0's kin-openapi/oapi-codegen/swag bumps plus main's
newer Dolt stack (dolt/go, go-mysql-server, vitess, eventsapi_schema) — so
neither branch's recorded vendorHash covered it and the nix-build gate
would have failed on either.
Regenerated and verified with nix (via the nixos/nix container, as
scripts/update-nix-vendorhash.sh does): the go-modules fixed-output
derivation now builds with no hash mismatch and `nix build` completes
beads-1.3.0 end to end.
Forward-ports the 38 commits that shipped on release/1.3.0 (tagged v1.3.0 at
f45b249ce) into main, as RELEASING.md mandates after a tag. None of them had
ever been forward-ported. Recorded as a merge so main becomes a superset of
the release branch and the lineage is in the history.
Migration ordinal collision (the reason this needed a human-shaped merge):
both branches independently claimed clone-local ignored slot 0026 under
different filenames, so git merged both in with no conflict and left the
series with two migrations at ordinal 26 — a single-integer cursor cannot
address that, and migrationSource.list() panics on it.
Main's ignored/0026_add_wisps_current_revision is renumbered to 0027.
Release's 0026_dep_rekey_dedup_marker is in the shipped v1.3.0 tag, so field
stores have already recorded it at 26 and it can never move; main's twin has
never shipped in any release, so it is the one that is free to move. 0027 was
unused in the ignored series (both sides topped out at 26).
This trips check-migration-hygiene.sh Check C (frozen migrations), which has
no exemption mechanism. That is expected and accepted: breaking the collision
requires a rename, and the ignored series' cursor table is itself dolt-ignored,
so its content hashes are clone-local and never participate in the cross-clone
ContentHashSkew comparison that Check C exists to protect. Main's 0067 body is
deliberately NOT edited for the same reason in reverse — it is main-plane and
its hash IS compared across clones.
Conflicts resolved:
CHANGELOG.md release's finalized [1.3.0] section kept
byte-identical; main's two unreleased
entries (#6023, #5859) moved up under
[Unreleased] where they belong
cmd/bd/init_safety.go union — release's added paragraph is
cmd/bd/init_safety_help.go accurate against the merged code (three
exit-12 sources, incl. init.go:3147)
internal/storage/uow/dolt_sql_provider.go
kept main's newProvider refactor AND
release's readOnly field/assertion;
newProvider gained readOnly: opts.readOnly
so release's read-through-refused-migration
behavior survives main's refactor
.github/workflows/main.yml single -timeout=30m per release's #6091
scripts/ci_workflow_test.go design (flag on the invocation, not in
matrix.test-flags); the shadowed 25m in
matrix.test-flags removed
scripts/migration-test/lib/versions.sh
union — main's darwin/arm64 corpus plus
release's v1.2.2 linux/amd64 entry
integrations/beads-mcp/uv.lock ruff 0.16.5 (release, newer); block is
internally consistent, uv lock --check ok
default.nix vendorHash left at main's value and is
KNOWN STALE — see below
Version stamp lands at 1.3.0 (main had been sitting at the previously-released
1.2.2, this project's between-releases pattern). check-versions.sh: 24/24.
Known follow-up: default.nix vendorHash. The merged go.mod/go.sum is a genuine
union (release's kin-openapi/oapi-codegen bumps + main's newer Dolt stack) and
matches neither side, so neither recorded hash is correct. It must be
regenerated with scripts/update-nix-vendorhash.sh. The repo's automatic fixer
(update-vendor-hash.yml) is dependabot-only and will not run on this PR.
* perf(storage): stop burning two wasted MySQL sessions per bd invocation (wy-s8ytnw)
Every bd store-open against a shared dolt sql-server cost two sessions that
did no work:
1. readAndDial's data-port probe (internal/storage/dbproxy/proxy/endpoint.go)
dialed the proxy data port and closed it to "prove" it accepts. The proxy's
handleConn dials the BACKEND for every accepted client connection before a
byte flows, so the zero-byte probe was a full backend MySQL session on every
invocation from a proxied clone — and it proved nothing the authenticated
control-port identity reply had not: ListenAndServe binds the data listener
before the control listener exists. Drop the probe; the identity reply is
the liveness proof. (Deferring the backend dial until the first client byte
was considered and rejected: MySQL is server-speaks-first, so a real client
waits for the greeting and would deadlock.)
2. The no-database init connection. On the proxied/server uow path
(openAndInitSchema) and the dolt.New server path (openServerConnection) bd
opened a second, database-less pool per store-open purely to probe
existence (SHOW DATABASES / the schema-init preparation) before opening
the real pool. Both sites now try the database-scoped connection FIRST —
keyed the way the Gateway case already is, not by deleting the probe: a
successful connect is the existence proof, so the steady-state open (every
open but the very first) costs one session. Any connect failure (1049
Unknown database, server down, bad credentials) falls through to the
historical no-database path, which still owns creation, the #5042
ownership signal that arms FreshBootstrapHeal, databaseNotFoundError, and
every existing error message. `created` is honestly false on the fast
path; the uow provider reuses the init pool (nothing in the migration path
mutates session state).
New test TestReadAndDialAdoptsWithoutDialingDataPort pins the probe removal;
it fails (1 accept) against the previous endpoint.go and passes now.
Why the live server still saw a bare CREATE DATABASE per open despite
openServerConnection's SHOW DATABASES guard (the question on wy-s8ytnw): that
guard is not on the proxied path at all — the CREATE came from the uow
schema-init preparation, already fixed upstream by #6022 (alreadyConverged);
the deployed binary (71e5ad700) predates it (wy-7sx6cj).
* fix(storage): cap the fast-path probe budget; correct the pool-reuse premise
Maintainer review fixes for PR #6122. All four are non-gating minors (plus
one nit) from the review synthesis; the quality scorecard's decision was
approve with no required changes.
- uow fast path no longer costs a second retry budget (finding 1). openDB's
30s transient-ping budget was spent twice against an unreachable server:
once on the fast-path probe, whose error was discarded, and again on the
fall-through open. Measured 0s + 19.8s where it was 19.8s twice; the
returned "uow: ping db: ..." text is unchanged. The probe is now a single
bounded ping, mirroring the sibling fast path in internal/storage/dolt,
and the historical open keeps the retry budget it owned at base. Nothing
is lost by not retrying here: the endpoint is already live when
openAndInitSchema runs (GetCreateDatabaseProxyServerEndpoint), so the
probe was never the thing waiting out a starting server.
- Replace the pool-reuse comment's false premise (finding 2). "Nothing in
the migration path mutates session state" is wrong: six shipped
migrations clear FOREIGN_KEY_CHECKS and restore it, and the guarded ones
leave user variables set. State the real invariant instead — one pinned
session per attempt, paired restores inside each script, pool closed on
every initSchema failure — and record the forward requirement in
migrations/README.md, where migration authors will meet it.
- Log why either fast path fell through (finding 3), matching lock.go's
alreadyConverged idiom, so a fast path that has quietly stopped firing is
visible under BD_DEBUG instead of silently costing the second session.
- Amend both stale empty-DSN premise comments (finding 5, nit):
selectProbeDatabase and alreadyConverged now describe both entry shapes.
Finding 4 (a server-gated assertion on open-path selection) is left as the
follow-up that the synthesis and the scorecard both marked optional.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: plato <plato@ghosttrack.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* refactor(import): retire the same-chunk regular<->wisp deferral (wy-y52syc)
wy-a648lq made the engine write an in-batch regular<->wisp edge under
SkipDependencyValidationErrors (every row of both planes is on the one tx
before PersistDependenciesWithOptionsResult), so the wy-4276q8 workaround in
the classic import is redundant. Removed: splitDepsByChunk's same-chunk
crossesBucket deferral, the wispByID map in partitionChunkedImportDeps, and
importIssuesCore's hasCrossBucketBatchEdge reroute of a small import onto the
chunked path. Also retired the dependency pass's single-plane split
(splitDepRowsByBucket), which existed for the same filter and whose comment
already named this bead. The plain later-chunk deferral is unchanged.
Tests: the unit test for the same-chunk case now asserts the edge rides
inline with no dependency pass; the small-batch test asserts one inline
transaction; the embedded MixedRegularWisp test asserts one mixed pass; the
resume-backfill drill is reshaped so a later-chunk cross-bucket related edge
still defers and is backfilled on re-run, while the same-chunk blocks edge is
durable after the crash.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JzJhoB3wAyxWDr5afcUskB
* test(import): retire the dependency-pass narrative in the mixed in-batch case
This PR inverted the routing for the two-row mixed regular/wisp fixture in
TestImportFromLocalJSONL. At base the small-path guard also required
`!hasCrossBucketBatchEdge(issues)`, so that batch took the chunked path and the
regular -> wisp edge really was wired by the single-plane dependency pass
(wy-4276q8). At HEAD the guard is `len(issues) <= importChunkSize` alone, so the
batch takes the small path and the edge rides inline in its rows' own
transaction.
The assertions were already the correct post-change invariant, but the subtest
name, the rationale comment, and the failure message still described the retired
mechanism — the same narrative sweep this PR performed in the two test files it
did touch. Prose only; assertions untouched. The comment now also records that
this case is the real-engine guard for the small inline path, so its mock-based
sibling (TestImportIssuesCoreSmallBatchCrossBucketEdgeStaysInline) is not
mistaken for engine coverage.
Maintainer review fixup for PR #6159. Refs wy-y52syc, wy-a648lq, wy-4276q8.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* docs: supersedes is a replacement link, not a version chain
Reword the DepSupersedes comment (internal/types/types.go), the
`bd supersede` help text, and the graph-links doc: `supersedes` marks an
old issue as replaced by a different issue. It is not a version relation
and does not imply a version chain. The behavior is unchanged.
Promised on #5898 (Q8, quad341 revision 4): a replacement link, not a
version-chain link. docs/CLI_REFERENCE.md is pinned to v1.2.2 and picks
this up at the next release bump (generate-cli-docs.sh --check passes).
Wyvern bead wy-h4xd6f.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PvjeDsoyDfjptvjKZWzcqA
* docs: finish the supersedes rewording pass in graph-links + dependencies
Maintainer review fixup for PR #6212.
The PR's new assertion "This is a replacement link, not a version relation"
left the rest of graph-links.md still telling the version-chain story, so
the page contradicted itself. Each residual line is byte-identical to base,
but the contradiction is new with this commit. Extends the same wording pass
to the sites that actually assert version semantics:
- frontmatter description: "supersedes chains" -> "supersedes (replacement)
links" (this is the rendered page description)
- the example comment "# View shows the chain" -> "# View shows the
replacement"
- "### Version History" -> "### Replacement History" and "# bd-rfc3 is now
the current version" -> "# bd-rfc3 is now the live issue"
- Best Practice 4 "Document supersedes chains - Note why version changed" ->
"Document replacements - Note why the issue was replaced"
The use-case list ("Design document versions", "Artifact versioning", "RFC
chains") and "Track document evolution" are deliberately left alone:
chained replacements legitimately model document evolution without the link
itself being a version relation.
Also rewords the sibling core-concepts table, docs/core-concepts/
dependencies.md:56, from "Replaced by a newer issue" to "Replaced by a
different issue" so both hand-written pages frame the edge the same way.
No in-repo reference targets the renamed #version-history anchor.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* test(conformance): pin the PLANE of the importer's cross-plane edge assertions (wy-dpzjid)
RunImporterWiresTheCrossPlaneEdgeBetweenItsRows documents that each
direction is asserted on its own table and column, but importerEdgeCount
sums BOTH dependency tables across all three target columns, so the case
passed with either edge written to the other plane's table or under the
wrong target column. Only the uow-tier test pinned placement.
Add assertImporterPlaneEdgeCount (one table, one column, in the idiom of
assertBatchApplyPlaneEdgeCount) and assert exactly one row in
wisp_dependencies.depends_on_issue_id for wisp->durable, exactly one in
dependencies.depends_on_wisp_id for durable->wisp, and zero in the other
plane's table each way. importerEdgeCount stays for the "dropped
everywhere" cases, where summing both planes is the right question.
Verified (darwin/arm64):
- go test ./internal/storage/uow -run TestImporterContract -count=1: ok
- Negative control: pointing the wisp->durable assertion at `dependencies`
fails with "dependencies.depends_on_issue_id rows ... = 0, want 1"
- BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/embeddeddolt
-run 'TestConformance/Audit/molecule-wisp-batch-iter': ok
- gofmt -l clean, go vet ./backend/conformance clean
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0173FRLuAy3NUjVvwFaLVj2r
* test(conformance): keep the summed edge guard beside the plane pins
Maintainer review fixup for PR #6218 (non-gating polish; the review
approved the PR as-is).
Review finding (minor, gate impact none): replacing the two summed
assertions with four plane-pinned ones narrowed observation from all six
table x column cells per edge to two — the expected cell and the
same-column mirror. Every single-write misroute still fails the positive
assertion, but a same-edge DUPLICATE landing under one of the four
unnamed cells regressed from caught (the old sum read 2 against want 1)
to silent, in the one case whose whole subject is edge placement.
Keep both belts instead of trading one for the other: the pinned cells
state WHERE the edge landed, the restored sum states that it landed
NOWHERE ELSE. Together they also make the helper's claim exact — total 1
with the expected cell at 1 leaves every remaining cell empty — so the
doc no longer overstates a single mirror-cell check as "the other plane
holds none".
Also (nit): give importerEdgeCount's doc the missing pointer to
assertImporterPlaneEdgeCount, mirroring the two-way cross-reference the
batch pair already sets (batch_apply_contract.go:2093-2113). That doc is
this package's navigation system, and a summed counter that names no
placement alternative is how the blind spot this PR fixes gets
reintroduced.
Validation on this tree: go test ./internal/storage/uow -run
TestImporterContract -count=1 -tags gms_pure_go — ok 21.0s, 9 subtests
green including WiresTheCrossPlaneEdgeBetweenItsRows, no skips. The
restored guards were proven live, not vacuous: flipping both wants to 2
fails with "edges ... = 1, want 2" from each, while the pinned
assertions stay silent, so the sum is an independent observation of the
four cells they cannot see. gofmt, go vet, go build clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* perf(issueops): batched is_blocked mark/unmark decide membership through the batch-scoped should-be-blocked union
The four batched templates (issues/wisps x mark/unmark) spelled out five
correlated EXISTS per outer row; the engine re-executed them per candidate
row — ~1.5–4.7 s per 200-id batch on committed data and unbounded over a
large uncommitted working set (>69 min observed on dolt 2.1.8 during a
proxied-server import, gastownhall/beads#6288).
They now decide membership through the same uncorrelated union the full
repair and the doctor count already use (shouldBeBlockedIDsUnionSQL,
bd-t9ypt), scoped to the batch: shouldBeBlockedIDsUnionScopedSQL(depTable,
scope) splices `AND d.issue_id IN (batch)` into every leg, and
expandBatchTemplate repeats the IN-list placeholders and bound ids for every
%s in the template (outer filter + 5 legs).
The waits-for leg wraps its dependency rows in a derived table BEFORE the
gate predicate is applied: flat, the planner pushed the gate's correlated
EXISTS ahead of the type filter and evaluated them against the whole overlay
per candidate row (436 s for zero rows); barriered, 0.01 s.
dolt 2.1.8, real 19k-issue db, one 200-id batch: committed 1.5–4.7 s → 0.04–0.08 s;
uncommitted overlay >24.6 min → 3–8 s (box load dependent).
Statement prefixes, the fixpoint loop, the updated_at self-assignment and
the error strings are unchanged. Proof: sqlmock issueops suite, container-
backed dolt Blocked|IsBlocked suite, golangci-lint clean, 8/8 mutants killed.
* test(issueops): pin expandBatchTemplate's percent budget at the fast tier
Maintainer review fixups for #6291. No production logic changes — one new
fast-tier test plus three comment corrections.
The batched mark/unmark templates reach the engine through
expandBatchTemplate, which decides how many IN-lists to splice by counting
"%s" textually. Nothing pinned that at the fast tier: the sqlmock
expectations in blocked_state_result_test.go match an unanchored statement
prefix and never call WithArgs, so they stay green against a miscounted
template, and a break surfaces only in the container-backed dolt suite.
go vet catches a stray percent only when it sits in the Sprintf format
literal. waitsForGateBlockedSQL is spliced in as an argument, so a future
LIKE 'x%' there is invisible to vet and to sqlmock both — verified by
counterfactual: injecting one leaves %s at 6 while total % goes to 7, vet
stays clean, the sqlmock suite stays green, and only the new
TestBatchedTemplatePercentBudget fires. The stray-percent guard, not the %s
count, is the assertion that bites.
Comment corrections, all pre-existing drift this change is the natural
moment to fix:
- dolt/store.go recomputeAllBlocked justified openLongTimeoutConn with "the
full pass's batched UPDATEs carry five correlated EXISTS subqueries each".
Wrong twice over: the full pass runs unbatched whole-table semi-join
UPDATEs (see recomputeIsBlockedCounting) and has used the decorrelated
union since bd-t9ypt. Load/deadline rationale kept verbatim.
- CountIsBlockedInconsistenciesInTx said detection and repair "share no
SQL"; countStaleIsBlockedSQL has built on shouldBeBlockedIDsUnionSQL
since bd-t9ypt, and this PR's own comment 60 lines above now says all
three consumers share the one definition.
- blocked_full_repair_test.go's header claimed the differential half
cross-checks the write path against the full repair on every leg. Both
sides now render from one builder, so it validates scope-splicing and the
waits-for barrier; per-leg semantics are pinned by the absolute fixture
expectations, now called out so they are not dropped as redundant.
Validation: issueops suite green; go vet clean; the container-backed dolt
blocked family green on the real engine, 27/27 PASS with zero skips,
including TestRecomputeAllIsBlocked_FullRepairAllLegsDifferential.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* perf(storage/db): batch the bulk IN-list readers at 200 ids; export narrows the wisp-plane reads
bd export on a 19,413-issue rig in proxied-server (UOW) mode took 264-287s.
The cmd layer is bulk, but uowExportSource.LoadExportRelations handed ALL
ids to the domain use cases, and the domain/db readers built ONE IN (...)
list per statement: 19,409 placeholders each for labels, wisp_labels,
wisp_comments rows and counts, dependencies counts and wisp_dependencies
counts, at 24-60s a statement (~240s of the run). Dolt is super-linear in
IN-list size, prepared or literal alike: on the same server the labels rows
took 31s as one statement and 0.80s as 98 batches of 200; a 200-id batch
is 3-7ms. The wisp readers were also handed every durable id (rows=0 back).
- internal/storage/domain/db/batching.go: forEachIDBatch at queryBatchSize
(200, mirroring issueops). commentSQLRepositoryImpl.CountsByIssueIDs /
ListByIssueIDs, labelSQLRepositoryImpl.ListByIssueIDs,
dependencySQLRepositoryImpl.ListByIssueIDs / CountsByIssueIDs and
issueSQLRepositoryImpl.GetByIDs loop over batches and merge; an id lands in
exactly one batch, so per-id groups and their ORDER BY survive. Error
strings are byte-identical; empty input still issues no statement. The
three hand-rolled loops (getLabelsFromTable, getDependencyRecordsFromTable,
fetchCountsByIDs) collapse onto the helper.
- cmd/bd/export_source.go: LoadExportRelations reads wisps-table membership
once (WispPlaneIDs, now batched through GetByIDs) and sends only wisp ids
to GetLabelsForWisps / GetCommentsForWisps / GetWispCommentCounts;
CountsByWispIDs keeps every id because its inbound leg counts wisp->durable
edges under the durable target. Membership that could not be read fails
OPEN to every id (wispReaderIDs), never to "no wisps".
- WispPlaneIDs now tolerates only a missing WISPS table
(dberrors.IsMissingTable), not any table-not-exist: its read joins leases,
and the blanket check reported a broken database as an empty wisp plane
(the issue_search.go missingOptionalWispTable lesson). Behavior change on
purpose: a rig missing leases now fails bd export with "failed to classify
wisp-plane rows" instead of silently exporting without markers.
Measured in the same clone against the same shared server, 19,433 rows:
stock 264s / 266s / 287s -> batched 16.9s / 17.8s. Stock-vs-batched byte
oracle: 19,363 of 19,433 records byte-identical; every differing record is
a live lease/heartbeat field or an updated_at inside the seven minutes
between the two runs.
Tests: internal/storage/domain/db TestBulkReadersBatch (a recording Runner
over the real Dolt suite: ceil(N/200) statements per leg, <=200 id
placeholders each, merge across batch boundaries, the Types filter's extra
placeholder, every reader routed to the wisp tables, GetByIDs, empty input),
cmd/bd TestWispPlaneSubset + TestWispReaderIDs, and the proxied export
integration fixture's wisp now carries a label and a comment that the --all
export must emit.
Follow-up (not here): fetchIssuesByIDs (SearchIssues Limit=0),
GetBlockingInfo and loadStatusByID still build one unbounded IN list, and
issue_delete.go's two GetByIDs(wisps) calls keep the blanket
IsTableNotExist.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RDjKMk7ubzrgpEDj2JRAbu
* perf(storage/db): batch fetchIssuesByIDs, GetBlockingInfo and loadStatusByID at 200 ids; delete tolerates only a missing wisps table (wy-sm01o2)
Follow-up to #6267 (wy-237yfi), whose own body names these three readers as
the residual unbounded IN lists in internal/storage/domain/db. Dolt's cost per
IN-list placeholder is super-linear, so one statement over N ids is far slower
than ceil(N/200) statements over 200 each.
- issue_search.go fetchIssuesByIDs: one SELECT per <=200-id batch, merged into
the same map. `ordered` is the scan order concatenated across batches and
hydration runs ONCE over the merged slice (hydrateIssues batches its own
relation reads since #6267), so callers get the same map and the same
hydration for one round trip per 200 ids instead of one 19k-placeholder
statement (export's SearchIssues with Limit=0 reaches it with ~19k ids).
The signature and the missing-wisp-table classification are unchanged.
- dependency.go GetBlockingInfo: both legs batch through forEachIDBatch and
their blockingRows are appended across batches; the merge that follows is
untouched. Each leg keys its result by a column the IN list constrains
(outbound issue_id, inbound the dependency target), and an id lands in
exactly one batch, so every row sharing a key comes from the same batch.
loadStatusByID batches its id list per table; the cross-plane duplicate-id
error is unchanged, because an id is still recorded under `issues` before
the `wisps` pass reaches it. GetBlockingInfoAcrossIssuesAndWisps needs no
change: it only calls GetBlockingInfo twice and merges the maps.
- issue_delete.go: previewDelete's and collectConnectedIssues' two
GetByIDs(UseWispsTable) calls read `FROM wisps LEFT JOIN leases`, so their
blanket dberrors.IsTableNotExist reported a rig missing `leases` as a rig
with no wisp plane (previewDelete listed live wisps under NotFound;
hydrateNeighbors returned them unhydrated). Both now tolerate only
dberrors.IsMissingTable(err, "wisps"), the fix#6267 applied to
WispPlaneIDs. The other IsTableNotExist sites in that file are left alone:
they guard reads whose FROM is the optional table itself
(wisp_dependencies via ListByIssueIDs(UseWispsTable)).
Tests: internal/storage/domain/db TestBulkReadersBatch gains FetchIssuesByIDs
(ceil(N/200) statements, <=200 placeholders, rows on both sides of a boundary
merged, and exactly ONE label hydration over the merged slice),
GetBlockingInfoOutbound, GetBlockingInfoInbound, LoadStatusByID (both planes,
one statement per batch each) and LoadStatusByIDDuplicateAcrossTables; the
empty-input subtest now covers all three readers issuing no statement.
internal/storage/domain/issue_delete_missing_table_test.go proves a missing
`leases` (or `wisp_labels`) is no longer swallowed at either GetByIDs(wisps)
site while a missing `wisps` table still is, with an unrelated-error control.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(storage/db): consume the aborted duplicate-plane run's statements inside its own subtest (wy-sm01o2)
Salvaged WIP from the quota-killed executor (session-limit at 00:19Z): the
duplicate-plane loadStatusByID call aborts mid-run, so reset the recorder
before it and assert its statements under the cap in place, rather than
leaving them to pollute the next subtest.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rrz4umA2L5QU8s9EmCBPw8
* docs(cmd/bd): correct the LoadExportRelations plane-partition doc block
The header still documented pre-PR full-set wisp reads ("both planes are
queried with the FULL ID set and merged"), which this PR made false for the
wisp side. That block is the load-bearing record of the plane-partition
invariant, so a future editor trusting it could "restore" full-set wisp reads
and silently undo the wy-237yfi fix.
- The first bullet now describes the partitioned reads: membership is read
from the wisps table itself (WispPlaneIDs) rather than inferred from row
flags, the durable plane is queried with the full id set, the wisp plane
only with that membership subset (wispReaderIDs), and unreadable membership
fails OPEN to the full list. The "row flags are NOT a substitute" rationale
is kept deliberately: it is *why* membership is read from the table at all.
- The IsTableNotExist sentence is extended, not replaced. It is still true of
the three single-table wisp-relation readers, which correctly keep the
blanket check; only the lease-joined membership probe (WispPlaneIDs) is
pinned to a missing `wisps` table. Replacing the sentence outright would
have introduced a new inaccuracy.
Maintainer review fixup for adopt-pr #6444. Documentation only: the tree is
AST-identical after stripping comments, so no behavior can change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* fix(metrics): stop failing the reap test on a transient zombie
startDetached (spawn.go) reaps asynchronously via `go func() { cmd.Wait() }()`,
which is correct: GH#5900's fix already reaps every child, just not
synchronously. Between a child's exit and that goroutine's waitpid, `ps`
briefly reports it as STAT=Z -- the normal kernel process-table lag, not
a leak.
The test's in-loop check faulted the instant it saw "Z" in ps output, so it
was failing on the transient window itself rather than on a child that
actually stays a zombie. Measured on clean main under 32 busy loops (40
probe runs): zombie observed 12/40, never-reaped 0/40, window 5.0-23.4ms --
wider than the loop's own 20ms poll spacing, so the false positive was
guaranteed to land sometimes. Reproduced at ~14% (13/90 failures) building
`go test -c ./internal/metrics` and running under nproc busy loops, matching
the exact failure text seen in CI.
Remove the in-loop check and stop binding its now-unused `st`. The
post-loop 3s-deadline assertion already covers the real regression: a
child that STAYS a zombie keeps `alive` true, so the loop spins to the
deadline and fails there instead. Verified that path still works by
temporarily swapping startDetached's Wait goroutine for the old
`cmd.Process.Release()` (pre-GH#5900) reap -- the test fails 3/3 with
"still present after 3s" -- then reverting.
Before: 13/90 failures under load. After: 0/90.
Agent-Signature: claude-code-claude-sonnet-5-unknown-reasoning on behalf of Jim Wordelman
* docs(release-gates): PASS 7/7 — be-3vzut (transient zombie flake in TestStartDetachedReapsExitedChild)
Independently re-verified review bead be-5gizx's evidence for the fix
built in be-kh65q (root-caused by investigator bead be-heifp's PR #6147
triage): full-suite make test re-run at the deploy SHA (6348 PASS/0
FAIL/2104 SKIP, all SKIPs pre-existing Dolt/embedded/proxied opt-in
gates), diff-owned test independently isolated and confirmed PASS,
regression-catch re-verified (3/3 fail on reintroduced bug, 0/90 under
load after fix vs 13/90 before), gofmt/vet clean, 0 divergence from
origin/main. Criterion 7 (ancestry scope) carries a bounded mayor
waiver (gm-wisp-9mtr84) — see the gate file for full reasoning.
Agent-Signature: claude-code-claude-sonnet-5-unknown-reasoning on behalf of Jim Wordelman
* docs(release-gates): record opened PR #6262 for be-3vzut
Agent-Signature: claude-code-claude-sonnet-5-unknown-reasoning on behalf of Jim Wordelman
* docs(metrics): reword reap-test doc comment to persistence framing
The function doc comment still asserted the absolute invariant this PR
repudiates -- "startDetached must reap it so `ps` never reports STAT Z
under this process" -- which contradicted the new in-loop comment and
invited a future maintainer to re-add the removed in-loop Z fatal,
reintroducing the flake. Reword to the persistence framing already used
by startDetached's own doc comment (spawn.go:210-211, "never left as Z
under this process") and state explicitly that a transient Z is the
normal reaped-child path.
Comment-only; no behavior change. Review fix for the sole actionable
finding in the #6262 review synthesis (minor, claude+gemini).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test(feat): red — Phase 1: additive schema + migration slot claim - gastownhall/beads#6134 (refs be-hs42e.2)
Failing tests for the versioned-beads Phase 1 schema (issue_versions,
store_epoch, issues.current_revision), written before the migration file
exists so MigrationSQL("0067_add_versioned_beads_schema.up.sql") and
LatestVersion()==67 both fail RED. Confirmed via
`go test ./internal/storage/schema/...` (pipefail set — the molecule's own
`$TEST_CMD | tee` template misreports success without it, since `tee`'s
exit code masks a failing pipeline stage).
* feat: green — Phase 1: additive schema + migration slot claim - gastownhall/beads#6134 (refs be-hs42e.2)
Adds migration 0067: issue_versions (per-issue version log), store_epoch
(store-global epoch singleton, empty until a later phase seeds it), and
issues.current_revision (BIGINT NOT NULL DEFAULT 1). Purely additive, no
DML/backfill, no PREPARE/EXECUTE wrapper (ADD/DROP COLUMN vanishes under
the CLI-bundle path on a pre-2.3 Dolt CLI — see cli_prepared_ddl.go).
Also corrects two wrong assumptions baked into the RED-step test:
- down.sql files are not part of the //go:embed'd FS (only
migrations/*.up.sql is), so MigrationSQL() can never read one for any
migration; switched to os.ReadFile, matching
TestMigration0035HandlesLegacyWispDependenciesShape's existing precedent.
- a plain TEXT column reports information_schema.columns.column_type as
"text" in this Dolt version, not "longtext" as assumed.
* test(feat): red — Review: Phase 1: additive schema + migration slot claim - gastownhall/beads#6134 (refs be-xrl84)
* feat: green — Review: Phase 1: additive schema + migration slot claim - gastownhall/beads#6134 (refs be-xrl84)
* docs(release-gates): PASS 7/7 — be-dy66n
Phase 1: additive schema + migration slot claim - gastownhall/beads#6134
(deploy bead be-4ka6t). 4 pre-existing, non-diff-owned failure/finding
classes encountered and attributed to their tracker beads (be-9ogs6,
be-irise, be-w4qbu, be-a0dxu) with clause-3 proof; zero diff-owned
failures. PR: gastownhall/beads#6304.
* fix(schema): 0067 mirrors current_revision onto wisps and guards its own raw-SQL replay (refs be-yi9vu, be-hs42e.2)
Both maintainer rulings on gastownhall/beads#6304.
1. current_revision on both planes. wisps gains
`current_revision BIGINT NOT NULL DEFAULT 1`, identical to issues.
The semantic asymmetry is kept and written down instead of hidden:
nothing in Phase 1, 2 or 3 reads or writes the wisps column —
versioning is an issues-plane contract. What it satisfies is a SHAPE
obligation. The two planes share column-list-shaped code paths, and
TestSchemaParityIssuesVsWisps enforces strict column-name parity with
no exemption list; wisps.row_lock (0054 + ignored/0013) is the
precedent for a column carried on both planes and meaningful on one.
wisps is dolt-ignored, so the main-plane ALTER never runs on a fresh
clone. Ships with the ignored-series twin ignored/0026, per check D of
scripts/check-migration-hygiene.sh (precedent ignored/0020 for 0060,
whose absence is how wisps.storage_class missed every fresh clone).
2. Raw-SQL idempotence for the ADD COLUMNs, and the Go-side guard
removed as redundant. internal/storage/dolt/pr4107_corruption_test.go
replays the frozen .up.sql bytes from 0046 onward straight through the
driver onto an already-migrated store, so nothing in
internal/storage/schema is in that path: every migration >= 0046 has
to be idempotent as raw SQL on its own, and execMigration0067Body
could never have covered it. schema.go is back at origin/main.
The guard is now an INFORMATION_SCHEMA-probed PREPARE per plane, the
0060/0066 shape. Dolt accepts no unprepared conditional DDL that would
do the same job — ADD COLUMN IF NOT EXISTS, DROP COLUMN IF EXISTS and
a top-level IF are all parse errors, and a stored procedure's body
needs a client-side DELIMITER that the CLI batch path requires and the
Go driver rejects, so one frozen file cannot satisfy both.
A PREPARE'd ADD COLUMN vanishes on the pre-2.3 CLI bundle path
(dolthub/dolt#11345), so it gets the same direct-DDL override
0060/0065/0066 use: cliMigration0067AddVersionedBeadsSchema, listed in
cliSubstituteAssumesWispTables because its wisps ALTER is unguarded.
New TestMigration0067ReplaysIdempotentlyAsRawSQLThroughPR4107Harness
proves it through that harness rather than a hand-written double-apply:
runMigrationSQLFilesFrom(..., "../schema/migrations", 46) twice, asserting
the columns stay single, a seeded current_revision survives (a
drop-and-re-add would pass a mere existence check while resetting rows),
and the tables are not recreated.
* review: pin 0067's wisps table-exists sub-guard and scope the rollback hazard
Maintainer review fixes for #6304 (Phase 1 versioned-beads schema). All three
are non-gating findings from the review synthesis; the scorecard approved with
no required changes.
- migration_0067_versioned_beads_test.go: pin the wisps arm's table-exists
sub-guard. It was neither executed nor string-pinned by any test — the
full-chain test seeds bounded at v46 and 0047's repair recreates wisps
before 0067's frozen text runs, so the arm never fires against an absent
wisps table anywhere in the suite. The pin is on the INFORMATION_SCHEMA
.TABLES probe rather than the suggested "TABLE_NAME = 'wisps'" literal:
that literal also matches the adjacent COLUMNS probe, so it stays green
after the sub-guard is dropped. Verified counterfactually — with the
table-exists arm removed, the TABLES pins fail and the literal still
matches.
- 0067_*.down.sql: the header claimed the pre-2.3 PREPARE hazard "never
reaches this file" because only migrations/*.up.sql is embedded. True of
the bundle, but a rollback file's consumer is a manual operator, and
`dolt sql -f` on a pre-2.3 CLI reports success while dropping both tables
and silently keeping both current_revision columns (dolthub/dolt#11345).
Scope the claim to the bundle and steer manual rollback to a server
connection or dolt >= 2.3. The Phase-1 "not a data-loss concern" sentence
is accurate and is left alone; Phase 2 (#6135) revisits it. Same scoping
applied to the identical claim in the test's down-side comment.
- initschema_0067_versioned_beads_replay_test.go: the doc comment cited
TestPR4107Migration0067ReplaysIdempotentlyAsRawSQL, which does not exist.
Corrected to TestMigration0067ReplaysIdempotentlyAsRawSQLThroughPR4107Harness.
Comment/test-only; no migration semantics change.
---------
Co-authored-by: quad341 <quad341@users.noreply.github.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
* docs(recovery): re-review init-safety playbooks; refresh the 90-day marker
The Last-reviewed marker crossed the 90-day freshness threshold on Sep 7,
turning 'Check doc flags freshness' (and with it PR Policy and the required
CI Gate) red for EVERY open PR — #6262 is merge-queued and UNSTABLE on
exactly this.
Reviewed against the declared freshness sources (init.go, init_safety.go,
init_safety_test.go, dolt.go), which changed materially since June
(notably the destructive-preflight replacement in #5310 and the
server-flag precedence work): the four playbooks' premises still hold —
--destroy-token/--reinit-local/--discard-remote all exist and are the
refusal remedies, the force-refusal-on-origin-history invariant is intact,
and the pk-fork-refused deep link from dolt.go:416 resolves. One drift
noted, not a correctness issue: the three init-* anchors are no longer
deep-linked from refusal messages post-#5310 (bd help init-safety links
the doc generically); a fuller playbook revalidation against the new
preflight wording is follow-up material, not a blocker.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs(recovery): correct the init-safety exit-code mapping under the renewed marker
Maintainer review fixup for #6411. The marker bump renews a 90-day freshness
warranty asserting the four playbooks' premises still hold; review found one
that does not, so fix it rather than reset the clock over it.
init-local-exists was headed `Exit code: 11 (ExitLocalExistsRefused)` but led
with the "Refusing to destroy N issues in non-interactive mode." symptom,
which returns 12 (ExitDestroyTokenMissing, cmd/bd/init.go:2712-2715). Exit
11's only non-test site is the interactive typed-confirm decline
(cmd/bd/init.go:2696) — the same split cmd/bd/protocol/exit_codes_init_test.go
already documents. The section's recovery (`bd init --reinit-local`) also
dead-ended: runInitReinitPreflight gates on reinitLocal alone, so the
non-interactive caller the symptom names re-triggers the identical exit-12
refusal.
- doc: head init-local-exists with both codes, lead with the true exit-11
interactive symptom, append --destroy-token to the non-interactive recovery,
and add the refusal as a second symptom under init-token-missing, whose
"Why this happens" attributed the token to --discard-remote alone.
- doc: scope the intro's "points here to a labeled anchor" claim to the
post-#5310 reality the marker commit itself disclosed (only pk-fork-refused
is still deep-linked).
- code: correct the ExitLocalExistsRefused and ExitDestroyTokenMissing
comments, which are where the doc inherited its mapping error from, and
widen the same --discard-remote-only framing in `bd help init-safety`.
- gate: add cmd/bd/dolt.go to check-doc-freshness.sh — the doc declares it a
freshness source but the script did not enforce it, so drift in the pk-fork
playbook's source never tripped the re-review duty.
Comment, doc, and help text only; no behavior change. Verified:
check-doc-freshness.sh PASSED 10/10 with the added source, go test ./scripts/,
the cmd/bd init-safety tests, and the cmd/bd/protocol exit-code contract tests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(ci): sync the doc-freshness test fixture with the init-safety source list
The maintainer review fixup for #6411 added `cmd/bd/dolt.go` to the
`docs/recovery/init-safety.md` entry of the DOCS array in
scripts/check-doc-freshness.sh (and to the doc's own `Freshness source:`
marker), but scripts/check_doc_freshness_test.go pins the same list in
`freshnessDocuments`, which it uses to build the fixture tree every
subtest runs the real script against. The fixture doc's marker line is
written from that pinned list, so the script -- correctly -- reported
`FAIL: Freshness source does not name cmd/bd/dolt.go` for every case.
That reds `.github/workflows/pr.yml`'s check-doc-freshness-platforms
matrix, which runs
`go test '-tags=integration,gms_pure_go' -count=1 -run '^TestDocFreshness' ./scripts`.
GitHub CI never saw it: the six workflows are green on the pushed head
94d76b5a4, which is the one-line marker bump alone, while the fixup that
edits the DOCS array has been local-only through the review loop.
Add `cmd/bd/dolt.go` to the pinned list so the mirror matches the script.
Validated in the adopted worktree:
- `go test '-tags=integration,gms_pure_go' -count=1 -run '^TestDocFreshness' ./scripts` -> ok
(fails without this commit; passes at 94d76b5a4, so the break is fixup-introduced)
- `./scripts/check-doc-freshness.sh` -> PASSED against the real tree
- `go build ./...`, `go vet ./cmd/bd/... ./scripts/...` -> clean
- `go test ./test/docsync` (Mintlify nav/link guard) -> ok
- `go test ./cmd/bd/protocol -run Exit` -> ok
- the 14 `cmd/bd/init_safety_test.go` tests -> ok
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* test(uow): red — pingWithRetry does not exist yet for openDB's boot-time ping
Adds TestPingWithRetryRecoversFromATransientBadConn (be-x49l6): a fake
pinger exercising three cases — transient error retries then recovers,
non-transient error fails without retrying, and an already-cancelled
context fails promptly. Fails to compile until pingWithRetry/pinger
are added to dolt_sql_provider.go.
* feat: green — Fix: unretried ping in uow openDB turns a transient Dolt connection drop into a hard CI failure (refs be-x49l6)
* refactor: drop what-comment on pingWithRetry (self-review, refs be-x49l6)
Self-review flagged it as restating the function's own signature/behavior
rather than explaining a non-obvious why; the pinger and
isTransientPingError comments stay since they carry rationale the code
doesn't otherwise convey.
* test(uow): red — a hung boot ping is not bounded per attempt
Adds the two behaviours review #6003 asked for, both failing:
- a_hung_ping_is_capped_per_attempt_and_retried: blockingPinger stalls
until its context is cancelled. backoff.Retry bounds only the gap
between attempts, so with the caller's context handed straight to
PingContext the call never returns at all. The subtest runs the call
off-goroutine so this reports as "never returned" instead of a
package timeout.
- connection-level_net_error_retries_then_recovers: a *net.OpError
(connection refused / reset / broken pipe) is currently classified
non-transient and fails the boot ping outright.
the_caller's_own_deadline_fails_without_retrying passes already and is
kept as the regression guard for the trap #6000 fell into: making
context.DeadlineExceeded retryable must not make the caller's own expiry
retryable too.
pingWithRetry takes attemptTimeout here but does not honour it yet, so
the red is behavioural rather than a compile error.
Refs be-g1i7n.
* fix(uow): bound each boot ping attempt and widen the transient classifier
Review #6003, point 1. backoff.Retry bounds the gap between attempts but
cannot interrupt one in flight, and the DSN sets a dial Timeout (5s) with
no ReadTimeout — so a server that accepts TCP and then stalls
mid-handshake blocked for the caller's entire context, which is the exact
scenario the PR summary claims to fix.
Each attempt now runs under its own context.WithTimeout
(pingAttemptTimeout, 10s — above the 5s dial timeout so a real dial
timeout still surfaces as itself), and context.DeadlineExceeded is
classified transient so the retry loop actually continues.
pingWithRetry checks the caller's context *before* classifying. That is
what keeps the retryable DeadlineExceeded from swallowing the caller's
own expiry — the inverse of the regression #6000 introduced by capping
each attempt and then treating the resulting DeadlineExceeded as
permanent. Covered from both sides:
a_hung_ping_is_capped_per_attempt_and_retried and
the_caller's_own_deadline_fails_without_retrying.
Review #6003, point 2. isTransientPingError stays separate from
internal/storage/dolt's isRetryableError, and now says why in full: that
one is a query-time classifier matching on error text, admitting
migration-lock, read-only and MySQL-1105 shapes a boot ping cannot be in
because nothing has executed on the connection yet. The coverage gap the
review named is closed on this side instead — *net.OpError is transient,
which is refused/reset/broken-pipe portably and by type rather than by
substring, with permanent DNS failures excluded so an unresolvable host
still fails fast instead of spending the whole budget.
Refs be-g1i7n.
* migration-test: port the historical-Dolt upgrade corpus to darwin/arm64
The harness was Linux/amd64-only, gated by an unconditional uname check.
Porting it turned out to need more than the linux-only STRICT_RELEASE_ASSETS
table: sourcing lib/versions.sh's associative arrays fails outright under
macOS's bundled bash 3.2 (no `declare -A` support), `realpath -e` and
`find -printf` are GNU-only, the release-binary version probe's sandboxed
PATH=/usr/bin:/bin has no `timeout` on macOS, and the v0.9.1 source build's
own scratch dir was never canonicalized against macOS's symlinked TMPDIR.
- lib/versions.sh: guard on bash >= 4 with an actionable message instead of
a cryptic mid-file parse error; add reviewed darwin|arm64 asset+checksum
entries for all 12 corpus versions (existence confirmed via `gh release
view`, checksums taken from each release's own checksums.txt — the same
provenance as the existing linux|amd64 rows, cross-checked byte-for-byte
against them).
- historical-dolt-upgrade-test.sh: accept linux/x86_64 or darwin/arm64
(still an explicit allowlist, not a generic passthrough); replace the two
`find -printf` uses with a portable per-entry describer (Linux keeps the
original find command unchanged) and a plain `-exec basename`.
- lib/binary.sh: add resolve_existing_path (realpath -e on Linux, plain
realpath elsewhere — verified to already require existence on macOS);
resolve `timeout` to an absolute path before entering the sandboxed probe
rather than widening its PATH; canonicalize the v0.9.1 build's scratch dir
immediately after mktemp; parameterize its GOOS/GOARCH/cache-path instead
of hardcoding linux/amd64.
Validated natively on darwin/arm64: syntax-checked under bash 5; the
existing legacy-bridge-test.sh smoke suite passes unchanged (including its
assertion that the sandboxed probe PATH stays exactly /usr/bin:/bin); real
end-to-end runs of run.sh (the actual CI entrypoint) pass for the embedded
Dolt lane (v1.1.2), the external server-Dolt lane against the pinned Dolt
runtime (v0.62.0 — production's current schema), and a classic-SQLite bridge
lane (v0.49.6). linux|amd64 behavior is unchanged (existing entries and
branches are untouched byte-for-byte; only new darwin-only branches added).
v0.9.1's own lane gets past every platform fix here and then hits an
unrelated, pre-existing bug: migrate-legacy-to-current.sh's bridge
comparison stringifies timestamps as local-time-with-offset on the old side
and UTC-Z on the candidate side, so it only happens to line up when the
runner's local timezone is UTC (true for CI, false here). Left unfixed as
out of scope for a platform-corpus change — noted for the reviewer.
Ref: ga-9sghx (Gas Town HQ)
* fix(ga-9sghx): address PR #6072 review feedback
bee-ghosttrack's review (CHANGES_REQUESTED) found resolve_existing_path's
non-Linux branch assumed BSD realpath, but Homebrew coreutils puts GNU
realpath on macOS PATH too — and GNU's flagless default silently accepts
a missing final path component, dropping the existence guarantee this
function promises callers. Add an explicit [ -e "$1" ] guard so it holds
regardless of which realpath resolves.
Also skip the v0.63.3 embedded-Dolt lane specifically on darwin/arm64:
that release's published darwin/arm64 binary was built without CGO and
can't open an embedded-Dolt store at all — an upstream release artifact
limitation, not fixable here. Skipping just that one version (with an
explicit, non-silent message) keeps ./run.sh from being permanently red
on a Mac; every other embedded-Dolt version is unaffected.
Verified: legacy-bridge-test.sh passes; --version v0.63.3 now exits via
the explicit skip instead of the CGO error; resolve_existing_path
unit-checked directly for both the existing-path and missing-path cases.
---------
Co-authored-by: Test <test@example.com>
The date sort fields already default to newest-first (created, updated,
closed in sqlbuild.SortDefs), so --sort updated --reverse returns
oldest-first. The flag help said only "Reverse sort order", which reads
as "give me newest first" and returns the opposite.
Help text only, on the three commands that share the flag. Sort behavior
is unchanged.
Co-authored-by: postoso <postoso@users.noreply.github.com>
`bd list --flat` disables the tree view; `bd ready --plain` does the same
thing under a different name. A user who learns the flag from bd list and
tries `bd ready --flat` gets "unknown flag: --flat" and exit 1, with
nothing in the error pointing at --plain.
Register --flat on ready and fold it into the existing plainFormat
choice in gatherReadyInput, which is the one place both routes parse the
command's flags, so the direct and proxied listings pick it up together.
--plain stays the canonical spelling and its behavior is unchanged.
Generated CLI docs are not regenerated: docs/cli-docs.pin builds them
from tag v1.1.0, not HEAD. ./scripts/check-cli-docs-drift.sh --base main
and ./scripts/check-doc-flags.sh both pass.
Co-authored-by: postoso <postoso@users.noreply.github.com>
doltserver.Start() writes .beads/dolt-server-config.yaml when the resolved
dolt binary supports auto_gc_behavior.archive_level. Its own doc comment
says the file "lives alongside the other gitignored server state files in
beadsDir", but the hyphenated name falls outside the "dolt-server." prefix
shared by the other five entries, so both GitignoreTemplate and
requiredPatterns missed it.
The file holds an absolute cfg_dir and a per-machine port, so committing it
breaks every other clone -- the same reason the template already gives for
'redirect'. It shows up as untracked in every consumer repo whose dolt
supports archive_level. This repo does not see it because its own root
.gitignore has a blanket .beads/* rule.
Add the pattern to requiredPatterns as well as the template: the template
only helps repos initialised after this change, while requiredPatterns is
what missingGitignorePatterns() iterates, so it is what lets bd doctor --fix
append the rule to an existing .beads/.gitignore.
Co-authored-by: Adam Spiers <ai@adamspiers.org>
printTruncationHint fed surrounding newlines through ui.RenderWarn.
lipgloss treats that as a block, pads the blank lines to the widest-line
width (alignTextHorizontal shortAmount = widestLine - lineWidth), and
drops the trailing newline (GH#5685). The next shell prompt then prints
on the same line as a run of spaces.
Keep the newlines outside RenderWarn so the hint is one colored line
with a real trailing newline. Tests construct an explicitly styled
lipgloss Style so the padded blank-line shape fails if the helper is
reverted.
Fixes#5685.
* fix(list): honor --status when combined with --ready (#5832)
`bd list --status X --ready` silently dropped --status and returned the
unfiltered ready set (typically open issues). BuildListFilter pinned
StatusOpen whenever ReadyFlag was set, and ReadyFilterFromIssueFilter
hard-coded the same pin, so a custom status or in_progress selector
never reached GetReadyWork.
--ready without --status still defaults to open. An explicit --status
is now the ready-work status selector, matching how other list filters
already compose with --ready. `--status all` remains the no-filter
spelling and keeps the open default.
* fix(list): status-aware --ready footer and honor-path contract docs (#5832)
The query intersection from the prior commit is unchanged. Round-1
review asked the ReadyFlag/Statuses contract comments and the text
footer to describe the honor path: default --ready is still open,
an explicit --status is named instead of "excludes in_progress".
bd create --file/-f is a batch-import route: it creates one issue per
H2 ("##") heading, and ### subsections attach fields to that issue.
The old Usage was "Create multiple issues from markdown file", which
never named those semantics or --body-file. Callers who wanted "one
issue, description loaded from a file" reached for the shortest flag
and got a silent bulk import instead -- reported by @seanmartinsmith
with a 3-section briefing file (## Problem / ## Context / ##
Acceptance Criteria) that became 3 issues instead of one.
gatherCreateInput already rejects a positional title combined with
--file. That is the reporter's literal repro, so this keeps the
rejection and adds a --body-file hint on the error they actually
see. The remaining trap -- --file used alone on a section-headed
file -- is unchanged, because bd cannot tell that apart from a
genuine batch file by content.
Tests: parseMarkdownFile reproduces the trap file; gatherCreateInput
locks in the title+--file rejection and --body-file hint; flag Usage
names the per-heading behavior. The existing TestCreateFromMarkdownFile
binary path already covers well-formed --file creates.
bd ready pins WorkFilter.Status to StatusOpen. BuildReadyWorkWhere treated
that pin as an exact match, so issues in a custom status with category
active never appeared — even though bd statuses --help, the ready_issues
view (migration 0025), and ClaimableSourceStatusesInTx all treat that
category as ready-eligible.
Widen the singular StatusOpen clause to the same predicate the view uses:
status = ? OR status IN (SELECT name FROM custom_statuses WHERE category = 'active')
Non-open singular statuses stay exact. Built-in open still matches. Custom
wip/done/frozen/unspecified statuses stay out, matching claim's GH-3570
anti-steal set.
Reported by Justin Clemens (@justin-candor).
Addresses #5831
CGO_ENABLED=0 doctor tests compiled no TestMain, so AutoStart left
detached sql-servers running after t.TempDir() cleanup. The cgo
TestMains already swept, but t.TempDir() (Go 1.24+ uses GOTMPDIR)
was not under the sweep root, and cwdDeleted never fired while the
live child still held the tree.
Pin GOTMPDIR/TMPDIR to a suite-owned root before m.Run() and sweep
that root on exit. Add a !cgo TestMain for cmd/bd/doctor and
cmd/bd/doctor/fix.
Fixes#5631
* fix(setup/claude): keep settings.json's trailing newline and skip no-op rewrites (#5693)
bd setup claude (and bd init, which calls it) marshalled the Claude settings
map with json.MarshalIndent and wrote it unconditionally. MarshalIndent emits
no trailing newline, so every run stripped the one Claude Code's own writes
leave behind, and re-wrote the file even when no hook changed. Because bd init
git-adds .claude/settings.json, that surfaced as a staged diff with no
semantic content.
The same marshal-then-write pattern appears at four call sites in claude.go:
installClaude's settings write and its settings.local.json migration, and
removeClaude's settings write and its settings.local.json cleanup. Fixing one
would have left the bug live in the other three, so both halves are now shared
helpers -- marshalSettings appends the newline, writeSettingsIfChanged compares
against the bytes already on disk and returns early when they match -- and all
four sites go through them.
Reported by @maphew.
* chore(setup/claude): use the repo spelling "marshaled" in the new comments
The misspell linter flags British "marshalled"; CI pins golangci-lint
v2.10.1 and runs it with --new-from-merge-base, so both new comment lines
are in scope. Comment text only, no behaviour change.
The optional JSONL interaction sidecar at .beads/interactions.jsonl is
gated behind audit.enabled (default false, internal/config/config.go:245)
with a BD_AUDIT_ENABLED env override (internal/audit/audit.go:67-72), but
the key is absent from docs/reference/configuration.md, so there is no
documented way to discover it outside `bd audit` help text.
Two changes, both on the same page:
- Add an `audit.enabled` row to the Tool-Level Settings table covering the
default, the env var, what enabling it does, the fact that both
`bd audit record` and `bd audit label` refuse to write while it is off
(both go through audit.AppendIfEnabled -- cmd/bd/audit.go:103 and :146),
and the fact that issue history is recorded in the database regardless.
- Add `audit.*` and `storage-class.*` to the list of namespaces routed to
config.yaml. Both are in config.IsYamlOnlyKey's prefix list
(internal/config/yaml_config.go:118) but were missing from the doc; the
list now matches that prefix list exactly.
Reported by @treystout in #5904.
ReadConfigPrefix gates on the database's config table row `issue_prefix`.
When that row is absent its error told the operator that, "if using
config.yaml, use key 'issue-prefix', not 'issue_prefix'" — but this gate
never consults config.yaml. The YAML value is read one line above the
error solely to populate a debug.Logf diagnostic; it is discarded, so
setting `issue-prefix` in config.yaml leaves the gate failing exactly as
before. Following the advice produces a tracked config field that changes
nothing and misleads the next reader.
Point the message at what actually writes the row — `bd init --prefix` or
`bd bootstrap`, both of which it already named — and say plainly that the
check reads the database's config table so the config.yaml key does not
satisfy it. No resolution behavior changes; this is the error text only.
Reported-by: @ncljesus
Closes#5916
RunSendMetrics advertises a 30s flushTimeout for the detached child, but
built that context only after PruneQueue had already run. The prune is
the expensive half on a backed-up queue -- os.ReadDir materializes and
name-sorts every dirent, then de.Info() stats each one -- so the half the
budget was meant to cover ran with no deadline at all. A machine that
accumulated a large ~/.beads/eventsData spool before the 7d/10k/64MiB cap
landed (#5660) therefore still gets long-lived children: the advertised
bound was decorative.
Give the prune a flushTimeout context at the top of RunSendMetrics, and
give the flush its own fresh one rather than the prune's remainder: a
shared budget would let a slow-but-successful prune hand the upload an
already-spent context, so the child would prune, upload nothing and exit
1 -- and a prune slow enough to do that is exactly what a backed-up spool
produces.
The prune now walks the directory in 64-entry chunks -- the idiom
hasQueuedEvents already uses here, and for the same reason -- checking
the budget once per chunk. TTL deletions made before the budget expires
stand. The oldest-first cap pass is skipped whenever the listing is
partial, whether the walk stopped on the deadline or on a non-EOF read
error: a cap is a decision over the whole queue, and a prefix cannot make
it (the os.ReadDir implementation failed closed here too).
One deliberate exception keeps the bound from disabling the drains it was
added to protect: a pass that has deleted nothing when its budget expires
finishes its listing. On a queue that is over the caps with nothing past
TTL -- the young oversized spool #5660's caps exist for -- stopping there
would apply neither drain, and since the next child reopens the directory
at offset 0 it would walk the same prefix and stop in the same place
forever. That pass can outrun flushTimeout; the walk is otherwise bounded.
Behavior on a healthy queue is unchanged; the existing prune tests pass
untouched apart from the new context argument.
Refs #5871
cmd.Start() + Process.Release() violated the os/exec contract (Wait is
required after a successful Start), leaving each exited send-metrics
child as a zombie for the parent's remaining lifetime. In shipped code
every flusher spawn sits in a process-exit tail, so that window is
typically milliseconds; any future long-lived caller would accumulate
zombies unboundedly. Wait in a background goroutine instead. A parent
that exits before Wait completes leaves the child to init, which reaps
it.
This addresses the missing wait/reap half of the reporter's hypothesis
in #5900. It does not explain or fix the live, CPU-consuming flusher
children and eventsData growth reported there, so the issue should stay
open.
Refs #5900
* fix(deps): bump dolt/go past upstream manifest-missing-chunk defense (#4070)
Pin github.com/dolthub/dolt/go to 796d074977417da931df65202a79e0a7f532a3db.
That hop includes:
- 23ccbf9442275166f168939277a5b4a348a63c9d — reject a file manifest
update that references a missing table file (the defense itself)
- 796d074977417da931df65202a79e0a7f532a3db — doc/test follow-up to the
defense commit (no production-semantics change)
A non-atomic backup sync can leave the backup manifest ahead of chunk
files; subsequent syncs then fail with "table file not found" and stay
broken. The upstream defense turns that silent corruption into a loud
failed sync. Beads' previous pin (a6690826d767, 2026-07-15) predates
both commits.
Minimal-churn pin: do not bump to today's dolt tip. go mod tidy did not
force a later version.
This is a mitigation, not a root-cause fix: backup file+manifest publish
remains non-atomic, and backups already in the manifest-ahead state are
not repaired by this change.
Mitigates #4070
* fix(nix): update vendorHash for the dolt/go bump
The go.mod/go.sum bump in this PR invalidates the pinned vendorHash, so
`nix build .#default` fails with a fixed-output hash mismatch. Update it to
the value CI computed:
specified: sha256-D+KDoLFJHpt9D9rCrtE3NMfL4fgK7UxpdKlCxp5yz5Y=
got: sha256-wDU1tw/4t2CetwQl4+zUhlDI70dSasLLI2Gy66ZyhQQ=
The repo documents this coupling in .github/dependabot.yml; the existing
"Update vendorHash for dependabot Go bumps" workflow only fires for
dependabot PRs, so a manual bump is needed here.
* docs: green — Annotate be-tqwx release-gate record with be-mv0ww correction note (do not rewrite verdict) (refs be-mv0ww.2)
* chore: retrigger CI on be-pyt0d gate (be-y9rxv)
PR Policy (wrapper timing) and Upgrade smoke (v1.2.2-rc.1 -> candidate)
failed at ~21:20:3xZ due to a transient proxy.golang.org outage during the
module-fetch phase (stream error: stream ID NNN; INTERNAL_ERROR), not a
defect in the reviewed diff -- root-caused by beads/investigator, see
be-y9rxv. No source changes; empty commit to get a clean CI run on the
same content.
* test(feat): red — Align dolt-sql-server test container version with host DOLT_VERSION pin (refs be-egcj2.3)
* feat: green — Align dolt-sql-server test container version with host DOLT_VERSION pin (refs be-egcj2.3)
* chore(ci): retrigger CI after transient golangci-lint schema-fetch timeout (refs be-fjj0i)
`bd list --wisp-type heartbeat` returns an empty listing for EVERY input, and
`bd list` exposes no flag that changes that.
ListRequest.WispType is a predicate, not a plane selector — its own doc says
so, and RunReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt pins
it. That contract is right and this does not touch it. The doc also names the
way out:
The combination that answers with rows is IncludeEphemeral (or
IncludeInfra) plus this, and it is lawful rather than refused.
`bd list` registers neither `--include-ephemeral` nor `--all-types`. So of the
two combinations the doc names, the CLI can express only IncludeInfra — which
admits the plane AND lifts the infra-type exclusions AND changes the template
treatment, three decisions a caller who wanted one classification did not ask
for. The narrow knob the doc names FIRST has no flag at all.
That is the whole defect: the API composes correctly, and the CLI is missing
the other half of the pair.
## What this does
1. Registers `--include-ephemeral` on `bd list`, wired to
`ListRequest.IncludeEphemeral` — the plane knob alone, off by default, so
the default listing is byte-identical.
2. Refuses `--wisp-type` when no plane is admitted, with the fix in the hint,
instead of printing an empty listing.
The refusal is at the CLI layer ONLY. At the API layer the combination stays
lawful and still composes to an empty page: that is the pinned contract, and a
programmatic caller composing filters may legitimately land on it. A human
typing `--wisp-type heartbeat` cannot have meant "prove to me that durable rows
carry no classification", so the CLI is where the guess is safe to make.
An explicit `--type` is deliberately left alone: an infra type routes to the
plane by itself, so the request may well be satisfiable, and this layer cannot
tell which types those are without loading the workspace's infra vocabulary.
Refusing there would reject lawful, answerable requests.
## Verification
--- PASS: TestListRegistersIncludeEphemeral
--- PASS: TestGatherListInput_WispTypeWithoutAPlaneIsRefused
--- PASS: TestGatherListInput_WispTypeWithAPlaneIsAccepted (3 subtests)
--- PASS: TestGatherListInput_IncludeEphemeralReachesTheRequest
The pair discriminates rather than being trivially green: a guard that refused
every `--wisp-type` would pass the refusal test and fail all three acceptance
subtests, one per route that admits the plane.
`ok github.com/steveyegge/beads/cmd/bd`, `ok
github.com/steveyegge/beads/internal/workapi`, `go build ./...` and `go vet`
clean. `internal/workapi/list.go` and the golden corpus are untouched.
docs/CLI_REFERENCE.md is not regenerated here: the docs pipeline builds from
the release tag in docs/cli-docs.pin (v1.2.2), not from this checkout, so the
new flag appears at the next release bump.
Claude-Session: https://claude.ai/code/session_01X1jMLQTSrCwtzFRS1xeUC6
TestProtocol_FieldsRoundTrip fails on any machine whose TZ differs from its
system zone:
roundtrip_test.go:99: field "due_at" = "2099-03-14T23:00:00Z", want prefix "2099-03-15"
roundtrip_test.go💯 field "defer_until" = "2099-01-14T23:00:00Z", want prefix "2099-01-15"
workspace.env() builds a WHITELIST environment for the bd child (PATH, HOME,
GIT_CONFIG_NOSYSTEM, BEADS_TEST_MODE, BD_DISABLE_METRICS, optionally
BEADS_DOLT_PORT and TMPDIR). TZ is not on it, so the child inherits none and its
time.Local falls back to /etc/localtime, while the TEST process uses its own TZ.
The assertion computes its expectation from the PARENT's time.Local:
dueLocal, _ := time.ParseInLocation("2006-01-02", "2099-03-15", time.Local)
assertFieldPrefix(t, issue, "due_at", dueLocal.UTC().Format("2006-01-02"))
and compares it to a value the CHILD produced, so the two disagree whenever the
zones differ. Reproduced on macOS with a Europe/Paris system zone and TZ=UTC:
the parent expects 2099-03-15, the child stores local midnight in Paris and the
UTC form is 2099-03-14T23:00:00Z.
Not a product defect — date-only input parsed as local midnight and stored as
UTC is the documented behavior, and both processes implement it correctly. They
simply disagree about which zone is local. CI does not see it because its
runners have TZ unset AND a UTC system zone, so both sides agree by accident.
Fixed by propagating TZ into the child env, so the two share one notion of
local. Verified on a Europe/Paris system zone: the test fails on main under
TZ=UTC and passes with this change under TZ=UTC, TZ=Europe/Paris and
TZ=America/Los_Angeles (the west-of-UTC case the assertion's comment calls out).
`SED_INPLACE="sed -i ''"` cannot carry an empty argument. After word-splitting,
the two quote characters survive as a literal two-character argument, so BSD sed
reads '' as the backup SUFFIX rather than as "no suffix" and writes
`default.nix''` beside the real file on every macOS run.
Reproduction (bash, macOS):
echo 'vendorHash = "old";' > default.nix
SED_INPLACE="sed -i ''"
$SED_INPLACE "s|old|new|" default.nix
ls
# default.nix default.nix''
The stray is not ignored by .gitignore and carries the placeholder
sha256-AAAA... hash the script sets in step 1, so a `git add -A` after running
the script commits a file whose vendorHash can never validate. I hit exactly
that on a resync.
Fixed by branching at the call site in a function, where an empty argument is
passed as a real argument instead of surviving word-splitting as text. Same
detection, same two call sites, no behavior change on GNU sed.
External (cross-project) dependency blockers are now enforced everywhere a bead's readiness or closability is decided: `bd ready` / `--claim`, `bd blocked`, `bd close` / done-status `bd update` (direct and proxied), `bd dep tree`, and served HTTP ready/claim. The policy is a storage-boundary decorator (`internal/storage/externaldeps`) applied on both the DoltStorage chain and the UOW provider, with full capability-forwarding parity, `Unwrap` at every level, and the backend's advisory defer-wake preserved on the claim path.
Review trail: maphew rounds 1–4 (Jul–Aug), bee rounds 1–4 (Sep 2): D1 recording-parity exemption, D2 ready-filter goldens, D3 UOW-level Unwrap for the proxied importer, D4 claim-path defer wake. Verified at head 3468d62f on a clean merge with current main; CI fully green at that head.
Fixes#4769.
The engine-level wiring (wy-a648lq, 85b07f9b) already fixes the proxied
path this branch's implementation targeted — this exact subtest passes
on pure main with none of the branch's uow/issueops changes, verified
before this retarget. What main still lacks is a proxied END-TO-END
regression pinning it: both edge directions on their own dependency
tables, no skip report, both rows on their own planes, exactly one dolt
commit per import, and re-import convergence with zero commits.
Claude-Session: https://claude.ai/code/session_01YKNb1XYab2R4h6Maxys3uR
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
TestImportChunkedRealStoreResumeConverges has been red on main since
e05000d64 (wy-sbgucn) added the resume fast path: the re-run after a
simulated crash at chunk 2 reports Created=7, and the test demanded 12.
The code side is right and the expectation was the stale side. Created is
len(ImportedIDs) — the rows THIS invocation wrote, after the pre-filter.
The resume fast path proves the crash's durable prefix a no-op (same
updated_at, same columns, every incoming label/comment/dependency already
stored) and drops those rows from the write set, reporting them as
Unchanged. That is the whole point of the fast path: counting them as
Created again would report rows the import never wrote, and would put the
real run out of step with --dry-run, which classifies the same rows
through the same pre-filter. "All 12 rows accounted for" is the sum, and
it is already what `bd import` prints — ImportData sets
result.Issues = Created + Unchanged.
So the test now asserts Created=7 + Unchanged=5 against the 5 durable
rows it already pins above, and states the chosen semantics in its
comment. Unchanged being nonzero is also what distinguishes the fast path
from the pre-wy-sbgucn behavior it replaced (which rewrote the prefix and
reported Created=12).
Test-only; no production behavior changes.
Co-authored-by: bronte <horsey@ghosttrack.com>
The env-gated embeddeddolt TestCreateIssues case still asserted the
pre-fix contract (skip-report the regular->wisp edge, persist nothing),
which CI's 'Test (Embedded Dolt Storage 5/5)' shard caught on PR #6126.
It now asserts what the engine promises since d75948c82: nothing is
skip-reported and the edge lands in dependencies.depends_on_wisp_id.
Run: BEADS_TEST_EMBEDDED_DOLT=1 go test ./internal/storage/embeddeddolt
-run 'TestCreateIssues/(wires_mixed|rejects_regular_to_wisp|rejects_wisp_to_regular)' rc=0.
Proxied-mode `bd import` (one ImportBatch -> uow/importer.go ->
issueops.CreateIssuesInTxWithResult with SkipDependencyValidationErrors)
still lost every regular<->wisp dependency edge whose both endpoints were
rows of the batch: the engine's in-memory per-batch plane filter
skip-reported it, and since a re-import upserts both rows unchanged the
edge could never be backfilled. The classic path only dodged the same
filter by deferring such edges to a single-plane pass (wy-4276q8).
The filter was never needed on a single-transaction batch. Every row of
BOTH planes is written on the one tx before PersistDependenciesWithOptions
runs, and that pass resolves each target on its own plane, so the edge is
writable. The plane rule is now a REFUSAL only: a strict batch
(BatchCreator's contract, CrossPlaneBatchEdgeError) is still refused
whole; a tolerant batch keeps the edge. doltTransaction.CreateIssues,
which writes the planes on two SQL sessions, already validates up front
and passes one plane per call, so no mixed batch on split sessions can
reach the engine.
- issueops/create.go: CreateIssuesInTxWithContext validates only when
!SkipDependencyValidationErrors; the filter shrinks to a validator.
FilterCreateIssuesMixedBucketDependencies (dead) is gone, and with it
the wy-4276q8 F6 case (a duplicate-ID target tripping the per-batch
filter).
- Contracts flipped to the corrected promise: conformance
RunImporterReportsTheCrossPlaneEdgeItDropped ->
RunImporterWiresTheCrossPlaneEdgeBetweenItsRows (both directions, both
tables, empty skip report); the wisp-batch audit's tolerant arm (b)
asserts the edge is wired; leg-waiver and uow wiring renamed.
- New TestImporterUOW/CrossPlaneInBatchEdgesAreWiredInTheOneCommit: the
proxied Importer wires wisp->durable (wisp_dependencies) and
durable->wisp (dependencies.depends_on_wisp_id) in ONE history entry
with no SkippedDependencies.
- Classic-path comments no longer claim the engine drops these edges;
its same-chunk deferral is now redundant and wy-y52syc retires it.
Both legs of main.yml's `test` matrix run every package in one `./...`
invocation with no `-timeout`, so they rode go test's DEFAULT 10m
per-package deadline. cmd/bd has outgrown it: scripts/test.sh already
documents the floor for local runs (~1090s of test time / ~18min wall for
cmd/bd, which is why TEST_TIMEOUT defaults to 25m there), and on
2026-09-01 main run 33497003321 failed twice with
`panic: test timed out after 10m0s` in cmd/bd AND, as collateral in the
same parallel coverage pass, internal/storage/uow — with DIFFERENT tests
only 1-12s in flight on each attempt (a package-wide crawl on the 2-core
coverage-instrumented runner, not a hang), while a rerun of the identical
tree passed.
Give both legs the repo's own 25m per-package deadline and keep it inside
one finite job budget (`timeout-minutes: 45`), the shape
test-embedded-conformance already documents: the go deadline fires first
and prints goroutine stacks, so a REAL hang stays diagnosable instead of
being cut off by a bare job kill.
The ubuntu leg's `matrix.test-flags` is dead config — its coverage step
hardcodes its own flags — so the ubuntu deadline goes on the gotestsum
line and the macOS one on `test-flags`, the only leg that reads it.
scripts/ci_workflow_test.go pins that macOS string exactly, so the
ratchet moves with it (adversarial review F1: without this the diff is a
deterministic red on main and on every PR).
Verified: go test -count=1 ./scripts rc=0 (the ci_workflow ratchet over
the patched main.yml); actionlint .github/workflows/main.yml rc=0.
bd import dropped every dependency edge joining a regular issue and a wisp
whenever both endpoints were in the import file: importIssuesChunked ran
issueops.FilterCreateIssuesMixedBucketDependencies over the whole file up
front, skip-reporting the edge, and a re-run could never backfill it. The
wy-9we0jf rollback drill lost all 22 such `blocks` edges among the rows it
imported (33 in the full export) — the only edges with both endpoints
present that did not round-trip.
The engine refuses such an edge only when both endpoints are created in the
same batch (regular rows and wisps commit on separate transactions, so the
target is invisible to the edge's existence check); a committed target on
the other plane is found. So the import now defers a cross-bucket edge whose
target is first written in the same chunk to the dependency pass, wires one
into an earlier chunk inline, writes the dependency pass in single-plane
transactions so no batch holds a cross-bucket edge's target, and routes a
small (single-transaction) import through the chunked path when it carries
such an edge.
Tests: mock tests pin the deferral, the single-plane pass and the small-path
routing; the embedded test that asserted the drop now asserts the edge is
wired; a new embedded test replays the drill shape (crash before the
dependency pass, re-run backfills); the jsonl subtest flips likewise.
Proxied-mode import (one ImportBatch) still drops these edges — follow-up.
The opus-adv pass on 37ecb53ed found by mutation that the lease-proof test
still passed with the `Assignee != ""` half of liveClaim dropped, and with
the heartbeat equality clause dropped. Two fixture rows close both: an
in_progress but unassigned local row holding a lease (its row is an orphan
the reconcile would drop) and a local lease differing only in heartbeat_at.
Fable review wy-03ne4j (BLOCKER) on e05000d64: dropping a provably-unchanged
tie row from the write set also skips RestoreLeaseOnImportInTx, the only
caller that reconciles the ephemeral lease row on import — but the proof
covered labels, comments and dependencies only. An in_progress snapshot
carrying a lease whose local lease row was absent, or differed, could be
reported Unchanged and never restore or replace it.
The proof now includes the lease axis (importLeaseAlreadyReconciled): a tie
row leaves the write set only when the rewrite's restore would upsert nothing
new — no incoming lease, no live claim, or a local lease already equal to the
snapshot's (expiry, heartbeat, granting node at the store's second
granularity) — and its reconcile would drop nothing (no local lease row, or a
live claim that keeps it). A missing row, a differing lease, a heartbeat the
write would stamp live, or an orphaned local lease all keep the row in the
write set, i.e. the pre-fast-path behavior. The rollback-drill resume is
unaffected: rows the interrupted run already wrote carry the snapshot's own
lease values, so they still prove.
Tests: TestFilterStaleImportIssuesResumeKeepsRowsNeedingLeaseReconciliation
(nine lease shapes, five retained / four proven) and the second-granularity
comparison; both fail against the pre-fix semantics (lease axis ignored:
write set [] vs the five rows).
A 30,740-issue `bd import` into a fresh dolt sql-server never converged
(wyvern rollback drill wy-9we0jf): two defects, one symptom.
1. The shared pool's 10s per-I/O ReadTimeout killed a chunk COMMIT whenever
the server paused — a stock server's auto_gc took 16.5s mid-import — and
every pause surfaced as "i/o timeout" then "write commit result
indeterminate". `bd import` now gets a 5m pool read-timeout FALLBACK
(dolt.Config.PoolReadTimeoutFallback, applied in buildServerDSN only when
neither the caller, BEADS_DOLT_POOL_READ_TIMEOUT nor dolt.pool-read-timeout
set one), so an operator's explicit setting still wins.
2. A re-run rewrote every row from chunk 1: the stale pre-filter kept tie rows
(same updated_at, same columns) in the write set so their aux data could
merge additively (bd-hj85c). Under any bounded wall clock each attempt
re-spent its whole budget reaching the same chunk — the drill's
"deterministic chunk 44" was a ~300s wrapper kill (rootCtx cancels only on
a signal, hence "context canceled"), not a stall. filterStaleImportIssues
now proves a tie row unchanged when every incoming label, comment and
dependency is already stored (bulk-loaded through the optional
importRelationLookup seam; typed opt-out errImportRelationsUnavailable)
and leaves it out of the write set, reported as Unchanged. A fresh import
pays nothing; a resume skips the committed prefix and converges.
Tests: resume fast path (proven row skipped, any missing aux row keeps the
row, opt-in/opt-out, read failure surfaces, result accounting) and the DSN
fallback precedence.
* ci: add advisory cyclomatic complexity reporting (bd-7g21)
Add a pinned gocyclo report, checked-in baseline, stable-key PR diff, and opt-in guard for shipped Go code. Run the report on every PR as a non-required artifact while maintainers measure signal quality; preserve existing complexity as grandfathered debt.
Agent-Signature: unknown-model/unknown-reasoning
* test(protocol): refresh dependency removal corpus
* fix(gate): route cross-rig bead checks (#5857)
Evaluate historical rig:bead gate targets through the current read-only prefix routing seam in direct and proxied-server modes. Preserve local bead gates, reject malformed cross-rig values, and cover the real two-store route with a Dolt integration test.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Klas Hesselman
* fix(gate): address cross-rig review feedback (#5857)
Preserve the original local not-found error when prefix routing is unavailable, document the user-visible behavior, and lock the proxied error contract with a regression test.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Klas Hesselman
Thanks for the report. This issue is the record a fix PR links to, so the more evidence here, the better. You can open a fix PR right away; no approval is needed first.
**Agentsfilling in this form:** answer each question only from evidence you have. If you cannot answer a question from the evidence, write exactly `NOT_ENOUGH_INFO` instead of guessing.
- type:checkboxes
id:checks
attributes:
label:Before you continue
options:
- label:I searched existing issues and did not find a duplicate.
required:true
- label:I reproduced this with stock `bd`, without an orchestrator or agent framework in the loop.
required:false
- type:textarea
id:summary
attributes:
label:Summary
description:What is broken, in one or two sentences.
validations:
required:true
- type:textarea
id:repro
attributes:
label:Steps to reproduce
description:Exact commands, starting from a fresh directory where possible.
render:shell
validations:
required:true
- type:textarea
id:expected
attributes:
label:Expected behavior
validations:
required:true
- type:textarea
id:actual
attributes:
label:Actual behavior
description:Include the full error output.
validations:
required:true
- type:input
id:version
attributes:
label:bd version
description:Output of `bd version`.
validations:
required:true
- type:dropdown
id:mode
attributes:
label:Storage mode
options:
- Embedded (default `bd init`)
- Server mode (`bd init --server`)
- Proxied server
- Not sure
validations:
required:true
- type:input
id:os
attributes:
label:Operating system
placeholder:"macOS 15.5 (arm64), Ubuntu 24.04, Windows 11, ..."
validations:
required:true
- type:textarea
id:impact
attributes:
label:Impact
description:Who is affected, how severe it is (data loss, blocked, workaround exists), and how often it happens.
validations:
required:true
- type:textarea
id:context
attributes:
label:Additional context
description:Logs, `bd doctor` output, root-cause notes, or a proposed fix.
description:Propose a change to bd, with the information needed to accept it.
title:"feat: "
body:
- type:markdown
attributes:
value:|
This form collects the context reviewers and future readers need for a change worth discussing. You can open your PR right after filing; no approval is needed first. Small, self-explanatory changes can skip the issue and go straight to a PR. Read the [project charter](https://github.com/gastownhall/beads/blob/main/engdocs/PROJECT_CHARTER.md) first — beads owns issue-tracking primitives, not orchestration policy or storage-engine behavior.
**Agentsfilling in this form:** answer each question only from evidence you have. If you cannot answer a question from the evidence, write exactly `NOT_ENOUGH_INFO` instead of guessing.
- type:checkboxes
id:checks
attributes:
label:Before you continue
options:
- label:I searched existing issues and pull requests and did not find a duplicate.
required:true
- type:textarea
id:motivation
attributes:
label:Motivation
description:The problem, and who has it. Describe the pain, not the implementation you prefer.
validations:
required:true
- type:textarea
id:proposal
attributes:
label:Proposed change
description:The behavior, command, flag, or API you want.
validations:
required:true
- type:textarea
id:impact
attributes:
label:Impact
description:Who is affected and how — users, agents, integrations, downstream consumers of the `--json` output.
validations:
required:true
- type:textarea
id:risk
attributes:
label:Risk and compatibility
description:Schema or migration changes, wire or `--json` output changes, behavior changes for existing workspaces, and how to roll back.
validations:
required:true
- type:textarea
id:verification
attributes:
label:Verification plan
description:How we will know it works end to end, beyond unit tests.
validations:
required:true
- type:textarea
id:alternatives
attributes:
label:Alternatives considered
description:Current workarounds, issue metadata, an integration or plugin, or other designs.
- type:dropdown
id:size
attributes:
label:Estimated size
options:
- XS (under 50 lines)
- S (under 200 lines)
- M (under 500 lines)
- L (under 1,000 lines)
- XL (more than 1,000 lines; likely needs splitting)
- Not sure
validations:
required:true
- type:dropdown
id:intent
attributes:
label:Intent
options:
- I am opening or will open a PR
- I'm reporting the need; someone else would implement it
validations:
required:true
- type:dropdown
id:ai
attributes:
label:AI assistance
description:Was an AI agent used to draft this issue?
options:
- "No"
- Yes,partly
- Yes,mostly
validations:
required:true
- type:checkboxes
id:accountability
attributes:
label:Accountability
options:
- label:A human has read this issue and stands behind it.
["$st"=5]|| no "ByteStream Read: gRPC status ${st:-missing}, want 5 (NOT_FOUND)"
echo"rbe-cache rrc probe: rbe-cache answers GetCapabilities, GetActionResult and ByteStream Read${rtt:+ ($rtt)}; this lane reads the remote repo contents cache" >&2
# Every command in this job (test, run //:gazelle, query) uses the
# executor; the committed .bazelrc holds the generic remote-exec tuning.
echo"build --config=remote-exec"
} >>"$rc"
if[[ -z "$instance"]];then
echo"::warning title=RBE_INSTANCE not set::remote execution uses the executor's default instance, whose action cache other repos on the farm may share; set RBE_INSTANCE to a beads-only instance"
fi
remote=true
echo"setup-bazel: remote execution enabled"
elif[["$set_fields" -ne 0]];then
echo"setup-bazel: remote execution is partially configured; BAZEL_REMOTE_EXECUTOR, RBE_TLS_CERT and RBE_TLS_KEY must be set together (or none, for local execution)" >&2
exit1
elif[["$fork_cache"==true]];then
# The remote repo contents cache, read-only, for the jobs that opt in
# (BAZEL_RRC_READ: only their configs are seeded), while rbe-cache
# answers and the probe's kill switch (fork_rrc_read) is on. With the
# startup flag set and the cache unreachable, every repository first
# fails a lookup (gascity engdocs/design/bazel-remote-repo-contents-cache.md,
# R6), so a closed or down rbe-cache gets no lines, and a notice says
# why. That holds at probe time only: after loading, Bazel fetches the
# files lazily, and losing rbe-cache then fails the command (R4). Both
# lines are key neutral, as for the trusted readers; fork-cache uploads
# nothing, and rbe-cache refuses every write.
rrc_read=false
if[["$rrc_reader" !=true]];then
why="not a remote repo contents cache reader (no BAZEL_RRC_READ)"
The canonical contributor instructions for this repository are in
[AGENTS.md](../AGENTS.md); area-specific rules are in the nested `AGENTS.md`
files listed in its routing table. Read those, not this file, for workflow,
build, test, and scope rules.
**beads** (command: `bd`) is a Dolt-powered issue tracker designed for AI-supervised coding workflows. Git integration is optional. We dogfood our own tool for all task tracking.
The rules most often missed in review:
**Key Features:**
- Dependency-aware issue tracking
- Auto-sync via Dolt-native replication
- AI-optimized CLI with JSON output
- Dolt server mode for background operations
- MCP server integration for Claude and other AI assistants
const requestAt = new Date(visibleRequest.created_at);
if (requestAt > cutoff) continue;
const authorReplied = comments.some(c =>
c.user?.login === issue.user?.login &&
new Date(c.created_at) > requestAt
);
if (authorReplied) continue;
await github.rest.issues.createComment({
owner:context.repo.owner,
repo:context.repo.repo,
issue_number:issue.number,
body:`Closing — this was marked \`${label}\` and a response was requested 14 or more days ago with no reply.\n\nIf this is still relevant, please reply with the requested details and we'll reopen.`,
msg:"do not write a filter here: take one back from a builder in internal/workapi, or pass the whole request to issueops.Reader. internal/httpapi may never name these types; cmd/bd denies them by default and lists the files that legitimately build their own, with the reason for each, in .golangci.yml - see issueops/reader.go"
- pattern:'^fmt\.Print(f|ln)?$'
pkg:'^fmt$'
# Keep the prefix in sync with the list/graph text exclusion below.
msg:"do not write list/graph output through process stdout: route format output through the command writer; mark an intentional non-format path locally"
- pattern:'^os\.Stdout$'
pkg:'^os$'
# Keep the prefix in sync with the list/graph text exclusion below.
msg:"do not write list/graph output through process stdout: route format output through the command writer; mark an intentional non-format path locally"
errcheck:
exclude-functions:
- (*database/sql.DB).Close
@ -327,10 +341,10 @@ linters:
exclusions:
rules:
# forbidigo holds TWO rules - the filter-construction guard and the
# label-plane guard - and the entries from here to the test exemption are
# their entire scope. This one keeps both off the rest of the tree; the
# settings block above says why.
# forbidigo holds four rules: filter construction, label-plane access,
# and the two process-stdout forms used by list/graph output. The entries
# from here to the test exemption define their scopes. This first one
# keeps every rule off the rest of the tree; the settings block says why.
#
# The previous version of this comment said there was exactly one rule and
# that a second "would need this widened or replaced". That came true, and
@ -343,6 +357,15 @@ linters:
- path-except:'^(internal/httpapi/|cmd/bd/)'
linters:
- forbidigo
# Process stdout is forbidden only across the list/graph file families.
# Existing non-format paths in those families carry local, reviewed
# exceptions; a new file or output site is denied by default. Scoping by
# the diagnostic text keeps the filter and label rules unchanged.
- path-except:'^cmd/bd/(list|graph).*\.go$'
# This prefix must match both fmt.Print and os.Stdout messages above.
text:'do not write list/graph output through process stdout'
linters:
- forbidigo
#
# THE LABEL-PLANE RULE IS NOW PACKAGE-WIDE ACROSS cmd/bd (ga-2ltro.12).
# It used to be narrowed by a `path-except` to cmd/bd/label.go, the one
@ -444,12 +467,28 @@ linters:
# tests: false` means forbidigo never analyzes a test file at all, so that
# entry asserts nothing either way and scoping it would be the churn this
Use [engdocs/TESTING.md](engdocs/TESTING.md) for the canonical commands,
test-design guidance, and PR-readiness gates.
## Non-Interactive Shell Commands
**ALWAYS use non-interactive flags** with file operations to avoid hanging on confirmation prompts.
Shell commands like `cp`, `mv`, and `rm` may be aliased to include `-i` (interactive) mode on some systems, causing the agent to hang indefinitely waiting for y/n input.
**Use these forms instead:**
```bash
# Force overwrite without prompting
cp -f source dest # NOT: cp source dest
mv -f source dest # NOT: mv source dest
rm -f file # NOT: rm file
# For recursive operations
rm -rf directory # NOT: rm -r directory
cp -rf source dest # NOT: cp -r source dest
```
**Other commands that may prompt:**
- `scp` - use `-o BatchMode=yes` for non-interactive
- `ssh` - use `-o BatchMode=yes` to fail instead of prompting
- `apt-get` - use `-y` flag
- `brew` - use `HOMEBREW_NO_AUTO_UPDATE=1` env var
## Landing the Plane (Session Completion)
**When ending a work session** (or when the user says "let's land the
plane"), you MUST complete ALL steps below. Work is NOT complete until
`git push` succeeds.
**MANDATORY WORKFLOW:**
1. **File issues for remaining work** - Create issues for anything that needs follow-up
2. **Run quality gates** (if code changed):
- `make ci-pr-lint` (required zero-finding formatting and lint wrapper)
- `make test` (and `make test-icu-path` only if you intentionally need the ICU regex path)
- `bd formula list` / `bd mol pour <name>` for structured workflows
### Sync
bd stores issue history in Dolt:
- Each write auto-commits to Dolt history
- Use `bd dolt push`/`bd dolt pull` for remote sync
- Do not treat `.beads/issues.jsonl` as the sync protocol
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/core-concepts/sync-concepts.md for details and anti-patterns.
### Important Rules
- ✅ Use bd for ALL task tracking
- ✅ Always use `--json` flag for programmatic use
- ✅ Link discovered work with `discovered-from` dependencies
- ✅ Check `bd ready` before asking "what should I work on?"
- ❌ Do NOT create markdown TODO lists
- ❌ Do NOT use external issue trackers
- ❌ Do NOT duplicate tracking systems
For more details, see README.md and https://github.com/gastownhall/beads/blob/main/docs/getting-started/quickstart.md.
## Agent Context Profiles
The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.
- **Conservative (default)**: Use `bd` for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
- **Minimal**: Keep tool instruction files as pointers to `bd prime`; use the same conservative git policy unless active instructions say otherwise.
- **Team-maintainer**: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.
## Session Completion
This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.
1. **File issues for remaining work** - Create beads for anything that needs follow-up
2. **Run the required lint contract when its code surface changed**:
`make ci-pr-lint`
3. **Update docs**: If you changed behavior, update README.md or other docs
4. **Commit**: With git hooks installed (`bd hooks install`), Dolt changes are auto-committed
### Commit Message Convention
When committing work for an issue, include the issue ID in parentheses at the end:
```bash
git commit -m "Fix auth validation bug (bd-abc)"
git commit -m "Add retry logic for database locks (bd-xyz)"
```
This enables `bd doctor` to detect **orphaned issues** - work that was committed but the issue wasn't closed. The doctor check cross-references open issues against git history to find these orphans.
For agent-prepared commits, also include the
`Agent-Signature:` trailer described in
[engdocs/AGENT_SIGNING.md](engdocs/AGENT_SIGNING.md). Use `unknown-model` or
`unknown-reasoning` when reliable runtime metadata is unavailable.
### Git Workflow
bd uses **Dolt** as its primary database. Changes are committed to Dolt history automatically (one Dolt commit per write command).
**Install git hooks** for commit integration and legacy fallback behavior:
```bash
bd hooks install
```
### Git Integration
**Dolt sync**: Dolt handles sync natively via `bd dolt push` / `bd dolt pull`. No export/import round-trip needed for normal sync.
**Protected branches**: Dolt stores data under `refs/dolt/data`, separate from standard Git refs. See [docs/reference/protected-branches.md](docs/reference/protected-branches.md).
**Git worktrees**: Work directly with Dolt — no special flags needed. See [docs/reference/advanced.md](docs/reference/advanced.md).
**Merge conflicts**: Rare with hash IDs. Dolt uses cell-level 3-way merge for conflict resolution.
## Git Workflow: PR by Default
Crew workers use a PR-based workflow. Beads is a dependency of a downstream consumer, so we
defer to the standard PR flow to keep changes reviewable.
- Work on a feature branch, push the branch, open a PR against `main`
- `gh pr create` is the normal path to land work
- Direct push to main is reserved for releases (tag + release commit) and
narrow operational fixes; prefer a PR when unsure
- When handling external contributor PRs, use fix-merge: checkout the PR
branch locally, fix/rebase onto main, merge via PR, then close the PR
### Maintainer PR Guidelines
Before triaging, reviewing, landing, closing, or otherwise maintaining PRs,
read [PR_MAINTAINER_GUIDELINES.md](PR_MAINTAINER_GUIDELINES.md). The
maintainer policy is to maximize community throughput: find useful contributor
value, absorb or transform it locally when practical, preserve attribution, and
use request-changes only as a last resort.
Sign agent-written GitHub comments and reviews using
**Before implementing any feature or fix, check for existing open PRs on the same topic:**
```bash
gh pr list --repo gastownhall/beads --state open --search "<topic keywords>" --json number,title,author,headRefName
```
**Contributor work gets priority.** If an external PR already exists:
1. **Review it first** — read the diff, understand the approach
2. **Build on their work, don't rewrite it** — checkout their branch, fix/adapt as needed
3. **Preserve their tests** — contributor tests are signal; keep them unless they're wrong
4. **Attribute properly** — use `Co-authored-by:` in commits, reference their PR number
5. **Never auto-close a contributor PR** by merging a rewrite — that discards their contribution silently
If you must rewrite (e.g., fundamentally different approach needed), explain why on the original PR and credit the contributor's design/tests in your commits.
Do not rely on auto-discovery of CONTRIBUTING.md; the preflight is the agent
gate for PR handling.
## Landing the Plane
See [AGENTS.md](AGENTS.md#landing-the-plane-session-completion) for the
**WARNING: DO NOT use `bd edit`** - it opens an interactive editor ($EDITOR) which AI agents cannot use. Use `bd update` with flags instead:
```bash
bd update <id> --description "new description"
bd update <id> --title "new title"
bd update <id> --design "design notes"
bd update <id> --notes "additional notes"
bd update <id> --acceptance "acceptance criteria"
```
**Read execution metadata before prose.** When enacting a bd issue, inspect the
structured metadata before using description or notes to choose execution mode,
delegation, model, reasoning level, or parallel group:
```bash
bd show <id> --json | jq '.[0] | {id,title,metadata,description,notes}'
```
The execution metadata keys are:
- `execution_agent_type`
- `execution_suggested_model`
- `execution_reasoning_effort`
- `execution_mode`
- `execution_parallel_group`
When these keys are present, treat them as the authoritative execution hints.
Use `description` for the work scope and `notes` for rationale or fallback
context. Parent/orchestrator agents must read these fields before spawning
subagents because a running subagent cannot change its model or reasoning effort
after launch.
**Use stdin for descriptions with special characters** (backticks, `!`, nested quotes):
```bash
# Pipe via stdin to avoid shell escaping issues
echo 'Description with `backticks` and "quotes"' | bd create "Title" --stdin
echo 'Updated description with $variables' | bd update <id> --description=-
# Or use --body-file for longer content
bd create "Title" --body-file=description.md
```
**GitHub body hygiene.** For GitHub PR, issue, comment, and review bodies,
write Markdown to a file and pass it with `gh ... --body-file`. Run
`scripts/gh-body-lint <body-file>` first to catch literal `\n` sequences and
non-linking `GH#123` references.
**Example agent session:**
```bash
# Make changes (each write auto-commits to Dolt)
bd create "Fix bug" -p 1
bd create "Add tests" -p 1
bd update bd-42 --claim
bd close bd-40 --reason "Completed"
# Push Dolt data to remote if configured
bd dolt push
# Now safe to end session
```
This installs:
- **pre-commit** — Commits pending Dolt changes
- **post-merge** — Runs chained hooks and a legacy JSONL import fallback only when no Dolt remote is configured
**Note:** Hooks are embedded in the bd binary and work for all bd users (not just source repo users).
## Common Development Tasks
### Visual Design System
When adding CLI output features, follow these design principles for consistent,
cognitively friendly visuals.
#### No Emoji-Style Icons
Do not use large colored emoji icons like red/orange/yellow/blue/white circles
for priorities or status. They cause cognitive overload and break visual
consistency.
Use small Unicode symbols with semantic colors applied via lipgloss:
- Status: `○ ◐ ● ✓ ❄`
- Priority: `P0`–`P4` label with color (no status glyph)
#### Status Icons
Use these symbols consistently across all commands:
```text
○ open - Available to work (white/default)
◐ in_progress - Currently being worked (yellow)
● blocked - Waiting on dependencies (red)
✓ closed - Completed (muted gray)
❄ deferred - Scheduled for later (blue/muted)
```
#### Priority Labels and Colors
Format priority as the P-label with color only (no status glyph — `●` is blocked status):
- `P0`: Red + bold (critical)
- `P1`: Orange (high)
- `P2`: Amber (elevated)
- `P3`–`P4`: Default text
#### Issue Type Colors
- `bug`: Red (problems need attention)
- `epic`: Purple (larger scope)
- Others: Default text
#### Design Principles
1. Small Unicode symbols only; avoid emoji blobs.
2. Semantic colors only for actionable items; do not color everything.
3. Closed items fade using muted gray.
4. Prefer icons over text labels for scanability.
5. Keep icons consistent across list, graph, show, and related commands.
6. Use tree connectors (`├──`, `└──`, `│`) for hierarchies.
7. Reduce cognitive noise; do not show `needs:1` when it is just the parent epic.
#### Semantic Styles
Use exported styles from `internal/ui/styles.go`:
```go
// Status styles
ui.StatusInProgressStyle // Yellow - active work
ui.StatusBlockedStyle // Red - needs attention
ui.StatusClosedStyle // Muted gray - done
// Priority styles
ui.PriorityP0Style // Red + bold
ui.PriorityP1Style // Orange
// Type styles
ui.TypeBugStyle // Red
ui.TypeEpicStyle // Purple
// General styles
ui.PassStyle, ui.WarnStyle, ui.FailStyle
ui.MutedStyle, ui.AccentStyle
ui.RenderMuted(text), ui.RenderAccent(text)
```
Example:
```go
switch issue.Status {
case types.StatusOpen:
icon = "○"
case types.StatusInProgress:
icon = ui.StatusInProgressStyle.Render("◐")
case types.StatusBlocked:
icon = ui.StatusBlockedStyle.Render("●")
case types.StatusClosed:
icon = ui.StatusClosedStyle.Render("✓")
}
```
### CLI Design Principles
**Minimize cognitive overload.** Every new command, flag, or option adds cognitive burden for users. Before adding anything:
1. **Recovery/fix operations → `bd doctor --fix`**: Don't create separate commands like `bd recover` or `bd repair`. Doctor already detects problems - let `--fix` handle remediation. This keeps all health-related operations in one discoverable place.
For git hook marker migration specifically: use `bd migrate hooks --dry-run` to preview operations, and `bd doctor --fix` for the standard apply path.
2. **Prefer flags on existing commands**: Before creating a new command, ask: "Can this be a flag on an existing command?" Example: `bd list --stale` instead of `bd stale`.
3. **Consolidate related operations**: Related operations should live together. Version control uses `bd vc {log,diff,commit}`, not separate top-level commands.
4. **Count the commands**: Run `bd --help` and count. If we're approaching 30+ commands, we have a discoverability problem. Consider subcommand grouping.
5. **New commands need strong justification**: A new command should represent a fundamentally different operation, not just a convenience wrapper.
### Adding a New Command
1. Create file in `cmd/bd/`
2. Add to root command in `cmd/bd/main.go`
3. Implement with Cobra framework
4. Add `--json` flag for agent use
5. Add tests in `cmd/bd/*_test.go`
6. Document in README.md
### Adding Storage Features
1. Add Dolt SQL schema changes in `internal/storage/dolt/`
2. Add migration if needed
3. Update `internal/types/types.go` if new types
4. Implement in `internal/storage/dolt/` (queries, issues, etc.)
5. Add tests
6. Update export/import in `cmd/bd/export.go` and `cmd/bd/import.go`
### Adding Examples
1. Create directory in `examples/`
2. Add README.md explaining the example
3. Include working code
4. Link from `examples/README.md`
5. Mention in main README.md
## Building
```bash
# Build and install bd to ~/.local/bin (the canonical location)
make install
# Verify installed binary
bd init --prefix test
bd create "Test issue" -p 1
bd ready
```
For testing commands, test design, and PR-readiness gates, use
[engdocs/TESTING.md](engdocs/TESTING.md).
> **WARNING**: Do NOT use `go build -o bd ./cmd/bd`, `go install ./cmd/bd`,
> or raw `go run ./cmd/bd ...`.
> These bypass the canonical build path, can create stale binaries in the
> working directory or `~/go/bin/`, and raw `go run` may miss the required
> `gms_pure_go` build tag. Always use `make install`, `./bd`, or
> `go run -tags gms_pure_go ./cmd/bd ...` when you explicitly need `go run`.
## Version Management
**IMPORTANT**: When the user asks to "bump the version" or mentions a new version number (e.g., "bump to 0.9.3"), use the version bump script:
```bash
# Preview changes (shows diff, doesn't commit)
./scripts/bump-version.sh 0.9.3
# Auto-commit the version bump
./scripts/bump-version.sh 0.9.3 --commit
git push origin main
```
**What it does:**
- Updates ALL version files (CLI, plugin, MCP server, docs) in one command
- Validates semantic versioning format
- Shows diff preview
- Verifies all versions match after update
- Creates standardized commit message
**User will typically say:**
- "Bump to 0.9.3"
- "Update version to 1.0.0"
- "Rev the project to 0.9.4"
- "Increment the version"
**You should:**
1. Run `./scripts/bump-version.sh <version> --commit`
2. Push to GitHub
3. Confirm all versions updated correctly
**Files updated automatically:**
- `cmd/bd/version.go` - CLI version
- `plugins/beads/.claude-plugin/plugin.json` - Claude plugin version
- `plugins/beads/.codex-plugin/plugin.json` - Codex plugin version
- `.claude-plugin/marketplace.json` - Claude marketplace version
- `integrations/beads-mcp/pyproject.toml` - MCP server version
- `README.md` - Documentation version
- `PLUGIN.md` - Version requirements
**Why this matters:** We had version mismatches (bd-66) when only `version.go` was updated. This script prevents that by updating all components atomically.
See `scripts/README.md` for more details.
## Release Process (Maintainers)
See [RELEASING.md](RELEASING.md) for the complete release process, including
the automated `./scripts/release.sh <version>` script and the manual,
step-by-step channel-by-channel instructions.
## Checking GitHub Issues and PRs
**IMPORTANT**: When asked to check GitHub issues or PRs, use command-line tools like `gh` instead of browser/playwright tools.
**Preferred approach:**
```bash
# List open issues with details
gh issue list --limit 30
# List open PRs
gh pr list --limit 30
# View specific issue
gh issue view 201
```
**Then provide an in-conversation summary** highlighting:
- Browser tools consume more tokens and are slower
- CLI summaries are easier to scan and discuss
- Keeps the conversation focused and efficient
- Better for quick triage and prioritization
**Do NOT use:** `browser_navigate`, `browser_snapshot`, or other playwright tools for GitHub PR/issue reviews unless specifically requested by the user.
## Telemetry
`bd` collects anonymous command-usage metrics. Each event is a `cli_command`
record carrying only the command name; each batch also carries the bd version
and OS platform, keyed by a machine-derived, HMAC-protected distinct ID. No
email, repo path, remote URL, issue content, or user-supplied strings are
collected. Events are written under `~/.beads/eventsData` and POSTed to
`https://gastownhall-eventsapi.com/mp/collect`.
Metrics are enabled by default (opt-out). The friendliest way to see or change
them is `bd metrics` (`bd metrics on` / `bd metrics off` / `bd metrics example`),
which takes effect on the next command with no restart. `BD_DISABLE_METRICS=1`
still works as a one-off, shell-scoped override. The cross-tool
[`DO_NOT_TRACK`](https://donottrack.sh/) standard is honored as a disable-only
opt-out: `DO_NOT_TRACK=1` opts out, while a falsey or empty value
(`DO_NOT_TRACK=0`, `false`, or unset-but-present) falls through to your saved
`bd metrics` preference instead of forcing metrics back on. `BD_DISABLE_METRICS`
is the bidirectional override and takes precedence when both are set.
## Questions?
- Check existing issues: `bd list`
- Look at recent commits: `git log --oneline -20`
- Read the docs: README.md, ADVANCED.md, docs/reference/configuration.md
- Create an issue if unsure: `bd create "Question: ..." -t task -p 2`
## Important Files
- **README.md** - Main documentation (keep this updated!)
- **ADVANCED.md** - Advanced features (rename, merge, compaction)
- **CONTRIBUTING.md** - Contribution guidelines
- **SECURITY.md** - Security policy
If you are using `bd` to track work in your own project, see the user docs:
[IDE and agent setup](docs/getting-started/ide-setup.md) and
If the build fails with a `vendorHash` mismatch, run `./scripts/update-nix-vendorhash.sh` to recompute and update `default.nix`, or update it manually with the `got:` hash from the error message and rebuild.
The `nix build` CI job (`.github/workflows/nix-build.yml`) runs on any PR that touches`go.mod`, `go.sum`, `default.nix`, `flake.nix`, or `flake.lock`, so dependabot bumps that invalidate `vendorHash` fail loudly instead of silently breaking Nix users on main. For dependabot Go-module bumps specifically, `.github/workflows/update-vendor-hash.yml` runs the same `update-nix-vendorhash.sh` script and pushes the hash bump back to the dependabot branch automatically (note: GitHub does not retrigger `pull_request` workflows for `GITHUB_TOKEN`-authored commits, so a maintainer may need to re-run `nix build .#default` once after the auto-fix push to mark the gate green).
On a PR, this is covered by PR Risk's required `test-nix` job (`.github/workflows/pr-risk.yml`), which runs `nix run .#default -- --help` plus `nix flake check -L` (an evaluation of every flake output; the flake has no test checks) on every PR touching`go.mod`, `go.sum`, `default.nix`, `flake.nix`, or `flake.lock` -- a superset of plain `nix build .#default`. `.github/workflows/nix-build.yml` dropped its own `pull_request` trigger as redundant (F7c, spec-f7.md §2.4) and now only runs `nix build .#default` on push to `main` and on `workflow_dispatch`, so dependabot bumps that invalidate `vendorHash` still fail loudly post-merge instead of silently breaking Nix users on main. For dependabot Go-module bumps specifically, `.github/workflows/update-vendor-hash.yml` runs the same `update-nix-vendorhash.sh` script and pushes the hash bump back to the dependabot branch automatically (note: GitHub does not retrigger `pull_request` workflows for `GITHUB_TOKEN`-authored commits, so a maintainer may need to re-run PR Risk's `test-nix` once after the auto-fix push to mark the gate green).
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
"build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:py_library.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude to avoid non-determinism.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n"
**Note:** Beads is a CLI tool you install once and use everywhere. You don't need to clone this repository into your project.
`bd init` creates or updates `AGENTS.md` by default so agents can discover the beads workflow, and also installs project Claude/Codex integrations unless you pass `--skip-agents` or `--stealth`. Use `bd setup --list` to see supported integrations, including `bd setup codex`, `bd setup factory`, `bd setup claude`, `bd setup mux`, `bd setup cursor`, and more. See [Agent and IDE setup](docs/getting-started/ide-setup.md).
`bd init` creates or updates `AGENTS.md` by default so agents can discover the beads workflow, and also installs the project Claude Code, Codex, and Cursor integrations unless you pass `--skip-agents` or `--stealth`. Use `bd setup --list` to see supported integrations, including `bd setup codex`, `bd setup factory`, `bd setup claude`, `bd setup mux`, `bd setup cursor`, and more. See [Agent and IDE setup](docs/getting-started/ide-setup.md).
Manual copy-paste is only for unsupported agents, existing projects where you cannot rerun `bd init`/`bd setup`, or custom instruction files. In those cases, run `bd onboard` and paste the printed snippet into the file your agent reads.
@ -53,7 +53,7 @@ This project uses bd (beads) for issue tracking.
- Run `bd prime` for workflow context and command guidance.
- Use `bd ready`, `bd show <id>`, `bd update <id> --claim`, and `bd close <id>`.
- Use `bd remember "insight"` for persistent project memory; do not create MEMORY.md files.
- Use `bd remember "insight"` for durable project facts; keep per-operator preferences in your harness's own memory.
- Do not use markdown TODO lists for task tracking.
```
@ -109,8 +109,8 @@ version: sync remote-backed databases with your current `bd`, back up with
`bd export --all`, upgrade the binary, then run `bd info --whats-new`,
`bd hooks install`, and `bd version`. If the upgrade crosses a schema
migration on a remote-backed database, exactly one designated clone runs
`bd migrate` and `bd dolt push`; other clones install the new binary
and run `bd bootstrap`. See the full
`bd migrate schema` and `bd dolt push`; other clones install the new
An embedding program that links beads as a library rather than running
`cmd/bd` registers this backend itself through the public
[`backend/http`](backend/http) package (`bdhttp.Register`), and can open a
workspace with a credential scoped to one caller via
`beads.OpenBestAvailableWith` — see that package's doc comment for the
multi-tenant case. This surface is EXPERIMENTAL: pin an exact beads version.
## 🌐 Community Tools
See [docs/community-tools.md](docs/community-tools.md) for a curated list of community-built UIs, extensions, and integrations—including terminal interfaces, web UIs, editor extensions, and native apps.
# Versioned Beads: issue-plane write paths and their Phase 2 disposition
This document has two parts. **Dispositions at this head** is the current inventory: every row whose disposition changed after the completeness fix a14f48b17 (merged as 5098ec85f), the seam's call sites at this head, and notes that are true now. **As found at 321a79278** is the review artifact this PR started from — the table donnabox's item 5 on #6358 asked for, derived before the completeness fix — kept verbatim under a dated heading because it is the record of what the review found. Wherever the two parts differ, the current part wins; a reader citing a row number should cite it from the current part.
## Dispositions at this head
Status after a14f48b17 (merged as 5098ec85f on `deploy/be-764ey-gate`): the table below was derived from the tree at 321a79278, before the completeness fix, and is kept as the record of what the review found. Since that commit the following rows changed disposition:
- Rows 17-23, 25 and 27 (close, reopen, claim, unclaim/release, lease reclaim, defer wake, label add/remove, promote, persistence move) are now **VERSIONED**: each mints once, after its row write and event, gated on a row actually changing.
- Rows 14-16 (legacy `AddDependency`/`RemoveDependency` verbs, the uow dependency repository, batch-apply structural adds) are now **VERSIONED** through the lowest-level helpers `addDependencyInTx`/`removeDependencyInTx` (mint gated on the row insert/delete); the publicops editor's own mint call was removed so no leg double-mints.
- Ordering: `ExecuteUpdate` mints once, after field, label, parent and persistence patches; batch create mints per issue after its creation-time edges are persisted, so the first version carries the outgoing edge set.
- `version_completeness_test.go` (46 must-mint entry points, exemption table with reasons, never-mints inverse guard) and `embeddeddolt/version_completeness_behaviour_test.go` pin the set at runtime.
The seam is `issueops.RecordVersionInTx` in internal/storage/issueops/version_history.go (line 87 at 321a79278; cite the function rather than a line at later heads, since comment edits move it), which sits beside the events-journal seam `issueops.RecordEventInTx` (journal.go:309). At 321a79278 it was reached from exactly six call sites: create.go:196, update.go:547, dependency_editor.go:181 and :272, and domain/db/issue.go:87/:102 (`Insert`) and :339 (`Update`); after a14f48b17 it is reached from 27 (18 in issueops, 9 in domain/db), listed in the section "Seam call sites after the completeness fix" below. Dispositions: **VERSIONED** = reaches `RecordVersionInTx` and mints an `issue_versions` row plus the `current_revision` bump; **NO-OP** = discarded before the seam (`DiscardNoopIssueUpdates`, the dependency editor's `eventWritten` gate, create's early returns, or the wisp exclusion); **OUT OF CONTRACT** = mutates an issue-plane row (issues, wisps, dependencies, labels, comments and wisp_* twins) without ever calling the seam. Paths are under `internal/storage/` unless they start with `cmd/`, `internal/compact/` or `backend/`. Checkout: /var/tmp/mayor-beads-phase2 @ deploy/be-764ey-gate; all line numbers are against commit 321a79278, the HEAD when this inventory was read (see the last note on drift).
### Rows whose disposition changed after a14f48b17
Row numbers are the historical table's. Line numbers in this table are against the Go tree at this head (unchanged since 5098ec85f).
| # | Path | Version seam at this head | Disposition | Mechanism |
|---|---|---|---|---|
| 13 | any of rows 1-8 whose target row is a wisp **or a promoted no-history bead** | no | NO-OP (a flagged issues-table create is stamped, not versioned) | The table that holds the row decides its plane, not its flags. A row in the wisps table mints and stamps nothing, whatever its flags say (FR-8). An update-shaped call on a flagged wisp returns on `IsWisp`, which is `Ephemeral \|\| NoHistory` (helpers.go:36-41). Every other wisps-table row is excluded by the seam's read of `participation_generation` from the issues table, which finds no row and returns: a flagged wisp's create-shaped call, and an unflagged row (bd mol squash's in-place flag clear, import's `wisp_plane` marker), which passes `IsWisp`. An issues-table row carrying `NoHistory` (a promoted no-history bead, bd-r9uce) is never versioned while it says so, because no-history means no history: an update-shaped call returns on `IsWisp`. A create-shaped call on such a row, with the flag on, still stamps `participation_generation` and mints nothing, so the row is not legacy once `bd update --persistent` repairs the flag in place. |
| 14 | dependencies.go:`addDependencyInTx` via `AddDependencyInTx` from the store verbs, `ApplyParentPatch`, `applyBatchRun.applyDepAdd` | yes | VERSIONED | mint moved into `addDependencyInTx` (`mintDependencyVersion`, dependencies.go:393), gated on the row insert rather than on `eventWritten`; the publicops editor's own mint call was removed so no leg double-mints |
| 15 | domain/db/dependency.go:`dependencySQLRepositoryImpl.Insert` (uow `AddDependencies`, create-time edges) | yes | VERSIONED | seam at dependency.go:228 and :240 after the insert |
| 16 | dependencies.go:`removeDependencyInTx` via `RemoveDependencyInTx` and domain/db/dependency.go:`Delete` | yes | VERSIONED | gated on the row delete; dependency.go:409 on the uow leg |
| 17 | close.go:`closeIssueInTx` (all close variants; `ExecuteCloseBatch` loops it; domain/db `Close`/`CloseChecked`) | yes | VERSIONED | close.go:394, after the row write and event, gated on the row changing |
| 19 | claim.go:`claimIssueInTx` and domain/db/issue.go:`Claim` | yes | VERSIONED | claim.go:239 and issue.go:551; `ExecuteUpdate`'s Claim flag passes `mintVersion=false` and mints once at its own end |
| 23 | labels.go:`addLabelInTx` / `removeLabelInTx` and domain/db/label.go:`Insert` / `Delete` | yes | VERSIONED | labels.go:190 and :239 gated on `RowsAffected() > 0`; label.go:91 and :130; `applyLabelPatch` (aggregate.go:360) mints only when called outside `ExecuteUpdate` |
| 25 | promote.go:`PromoteFromEphemeralInTx` | yes | VERSIONED | promote.go:141, after the label, dependency and comment copies |
| 27 | persistence.go:`moveIssuePersistenceInTx` | yes | VERSIONED | persistence.go:76 and :153; `ExecuteUpdate` passes `mintVersion=false` and mints once at its own end |
| 34 | batch_apply.go:`applyBatchRun` | yes, per item | VERSIONED | its create/update/close items reach rows 1/2, 5/6 and 17; its dep-add items reach `addDependencyInTx`, which now mints (row 14) |
Rows not listed keep the disposition shown in the historical table: rows 1-8 VERSIONED; rows 9-12 NO-OP gates inside them; rows 24, 26, 28-33 and 35-39 OUT OF CONTRACT; row 40 writes no issue-plane row; row 41 is Phase 3.
### Counts at this head
Of the 34 live issue-plane write paths (rows 1-8 and 14-39), **21 are VERSIONED** (rows 1-8, 14-23, 25, 27, 34) and **13 are OUT OF CONTRACT** (rows 24, 26, 28-33, 35-39); rows 9-13 are the no-op gates inside the versioned ones. The out-of-contract set is what the design puts out of contract: comments (not part of the snapshot), is_blocked flips, delete, rename and demote (Phase 3's deleted-Versioned-Bead guarantee), compaction bookkeeping and restore, migrations, merge-settle, doctor fixes and raw SQL.
### Still deferred
Still true and deliberately out of contract or deferred: an unchanged re-import of an existing row mints a version (create has no field-level no-op gate — and the journal seam sits in the same position: `RecordEventInTx(EventCreate)` at create.go:207 runs on every accepted upsert, only the events-table write behind the `isNew` gate at create.go:171 is skipped, so a no-op gate belongs in front of both seams, not the version seam alone); the uow leg mints per repository write, so a domain create with N labels and M edges yields 1+N+M versions where the direct legs yield one (each a distinct accepted state; follow-up); demote-to-wisp and delete/rename strand version rows because `issue_versions` has no FK to `issues` (Phase 3's deleted-Versioned-Bead guarantee); compaction bookkeeping, restore, migrations, merge-settle, doctor fixes and `bd sql` remain out of contract by design. The flag-off contract is behaviourally a no-op at the seam (`RecordVersionInTx` returns before any query) but not literally zero added work: labels.go's `RowsAffected` gate and the per-transaction `sync.Map` entry run with the flag off; the differential harness that would prove the stronger claim is not in this PR. The items that become live the first time the flag is on — the uow leg's 1+N+M, the re-import no-op gate on both seams, duplicate-key metadata, the single-writer allocator, and the `attribution_status` vocabulary being enforced only in Go — are tracked together in gastownhall/beads#6379.
### Seam call sites at this head
Verified with `grep -rn 'RecordVersionInTx(' internal/ --include='*.go'` over non-test files at d484b809d (the Go tree is unchanged between the merge of a14f48b17 as 5098ec85f and this note): **27 call sites** reach the seam, 18 on the direct legs in `issueops/` and 9 on the uow leg in `domain/db/`. The figure of 29 quoted in the PR thread was an over-count; this table is the correction. Line numbers are against that tree. The 46 "must-mint entry points" pinned by `version_completeness_test.go` are a different count by design: they are the public entry functions whose call graph must reach the seam, not the seam's own call sites.
Direct legs, `internal/storage/issueops/` (18):
| File:line | Function | Mutation |
|---|---|---|
| aggregate.go:360 | `applyLabelPatch` | label patch (mints only when used outside `ExecuteUpdate`, which passes `mintVersion=false`) |
- **What actually versions:** every accepted issue-plane mutation on every leg — create (singular, batch, import), update (and everything that reaches `updateIssueInTx`: metadata merge/delete/CAS, deleted-reference rewrite, compaction's content rewrite), dependency add and remove (editor, legacy verbs, uow repository, batch-apply), close, reopen, claim, unclaim/release, lease reclaim, defer wake, label add and remove, promote, persistence move. `version_completeness_test.go` pins 46 must-mint entry points with an exemption table (a reason per row) and an inverse never-mints guard; `embeddeddolt/version_completeness_behaviour_test.go` pins the runtime deltas.
- **Cross-leg symmetry on dependencies:** resolved. The dolt and embeddeddolt editors, the legacy store verbs and the uow repository all reach the seam through `addDependencyInTx` / `removeDependencyInTx`, gated on the row insert or delete.
- **Ordering inside a versioned call:** the mint is the last durable-state write. `ExecuteUpdate` mints once after its field, label, parent and persistence patches; batch create mints per issue after `PersistDependenciesWithOptionsResult`, so the first version carries the creation-time edge set.
- **Count vs design:** 21 VERSIONED, 13 OUT OF CONTRACT, 5 no-op gates (see Counts at this head). The design's "eighteen" is still not reconcilable item by item from this checkout.
- **Import upsert:** an unchanged re-import of an existing row still mints, and it also journals — `RecordEventInTx(EventCreate)` at create.go:207 runs on every accepted upsert — so the no-op gate belongs in front of both seams (gastownhall/beads#6379, item 2).
- **No FK from issue_versions to issues** (0067), so delete, rename and demote strand version rows under ids that no longer exist in `issues` — Phase 3 (gastownhall/beads#6379, item 6).
- **Non-canonicalizable snapshots fail the mutation** by policy: duplicate keys in an issue's `metadata` (a `json.RawMessage`) make `canonicalDurableState` return an error and abort the transaction with the flag on (gastownhall/beads#6379, item 3).
- **Single writer means one writer at a time per store,** not merely one clone: `MAX(revision)+1` is not a safe allocator for two concurrent transactions in one store either, and no contract case runs concurrent writers (gastownhall/beads#6379, item 4).
- **Exemption tables that name the seam:** journal_completeness_test.go `beadDMLExemptions` and row_lock_guard_test.go `funcNameExemptions` both list `RecordVersionInTx` as bookkeeping for an already-journaled mutation; unchanged.
## As found at 321a79278 (historical; superseded above wherever the two parts differ)
The table and notes below are the inventory as derived from the tree at 321a79278, the HEAD when it was read, and all line numbers in this part are against that commit. It is kept verbatim as the record of what the review found. Rows 13-23, 25, 27 and 34 are superseded by the current table above; the notes below that contradict the notes above are superseded too.
| 1 | issueops/create.go:`CreateIssueInTxWithResult` (`CreateIssueInTx`; execution.go:`ExecuteCreate`; dolt/issues.go:`createIssue`; dolt/transaction.go and embeddeddolt/transaction.go `CreateIssue`) | issues or wisps row via `InsertIssueIfNew` (ON DUPLICATE KEY UPDATE upsert) + labels + comments | yes | yes | VERSIONED | both seams run once after labels/comments persist (create.go:193-197); an existing-row upsert (`isNew=false`) still mints — create has no field-level no-op gate |
| 2 | domain/db/issue.go:`issueSQLRepositoryImpl.Insert` (`InsertBatch` loops it; domain `IssueUseCase.CreateIssue`/`CreateWisp` from uow/issue_operations.go, uow/batch_creator.go, uow/batch_applier.go) | issues or wisps via `issueops.InsertIssueStrictInTx` | yes | yes | VERSIONED | uow leg; `RecordVersionInTx` directly after `RecordEventInTx` in both branches (issue.go:84-87, 99-102) |
| 3 | issueops/create.go:`CreateIssuesInTxWithContext` / `CreateIssuesInTxWithResult` (create_batch.go:`ExecuteCreateBatch`; store `CreateIssuesWithFullOptions` on both direct legs) | row 1 per issue, then `PersistDependenciesWithOptionsResult` | yes (per issue, plus dep events) | yes (per issue) | VERSIONED | per-issue loop (create.go:309); creation-time edges are inserted AFTER each issue's version row, so they are neither in that row's `durable_state` nor versioned themselves |
| 4 | Import: uow/importer.go:`importer.ImportBatch`; embeddeddolt/store.go:`ImportJSONLData`; embeddeddolt/transaction.go:`CreateIssueImport`; cmd/bd/import_shared.go via `store.CreateIssuesWithFullOptions` | as row 3 | yes | yes | VERSIONED | import is not a separate write path — it funnels into rows 1/3; at 321a79278 rows get `attribution_status` supplied/undetermined and `imported` is only reserved (version_history.go:57-61); 56b2199d4, which landed mid-session, collapses the values to claimed/unknown with no `imported` at all |
| 5 | issueops/update.go:`updateIssueInTx` (`UpdateIssueInTx`, `UpdateIssueWithoutEventInTx`; execution.go:`ExecuteUpdate`; metadata.go:`writeMergedMetadataInTx` from `MergeMetadataInTx`/`DeleteMetadataInTx`/metadata_cas.go:`CompareAndSetMetadataKeyInTx`; delete_role.go:`RewriteDeletedReferencesInTx`; compaction's content rewrite via `store.UpdateIssue`) | UPDATE issues or wisps SET fields, row_lock | yes | yes | VERSIONED | seams at update.go:544-547, after `DiscardNoopIssueUpdates` (:391) and NOT inside `if recordEvent` — `UpdateIssueWithoutEventInTx` still versions |
| 6 | domain/db/issue.go:`issueSQLRepositoryImpl.Update` (domain `IssueUseCase.ApplyUpdate` from uow/issue_operations.go, uow/batch_applier.go) | UPDATE issues or wisps | yes | yes | VERSIONED | uow leg; same no-op gate (issue.go:212-219), seams at :336-339 |
| 7 | issueops/dependency_editor.go:`addDependencyEdgeInTx` (`ExecuteAddDependencies` from dolt/dependency_editor.go, embeddeddolt/dependency_editor.go) | INSERT dependencies or wisp_dependencies via `AddDependencyInTx` (+ is_blocked marks) | yes (`RecordDepEventInTx` inside `addDependencyInTx`) | yes, iff `eventWritten` | VERSIONED | versions the referencing (source) issue only when a row was recorded (dependency_editor.go:180-183) |
| 8 | issueops/dependency_editor.go:`ExecuteRemoveDependency` (from dolt/dependency_editor.go, embeddeddolt/dependency_editor.go) | DELETE dependencies or wisp_dependencies via `RemoveDependencyInTx` | yes | yes, iff `eventWritten` | VERSIONED | returns `Removed:false` before the seam when no row matched (:263-274) |
| 9 | update.go:`updateIssueInTx` / domain/db/issue.go:`Update` when `DiscardNoopIssueUpdates` leaves no field | nothing | no | no | NO-OP | returns before the UPDATE (update.go:391-397; issue.go:212-219) — the FR-2 contract case |
| 10 | dependency_editor.go:`addDependencyEdgeInTx` on a same-type re-add | UPDATE dependencies SET metadata (dependencies.go:274) | yes (dependencies.go:281) | no | NO-OP | `addDependencyInTx` returns `eventWritten=false` on the existing-edge branch, so the seam is skipped although metadata is rewritten and journaled |
| 11 | dependency_editor.go:`ExecuteRemoveDependency` on an absent edge | nothing | no | no | NO-OP | `removeDependencyInTx` reports `eventWritten=false`; editor returns at :267 |
| 12 | create.go:`CreateIssueInTxWithResult` on collision-skip, `ConflictSkip` or `RejectStaleUpserts` hit | nothing | no | no | NO-OP | early returns at create.go:126-128, 135-143 precede both seams |
| 13 | any of rows 1-8 whose target row is a wisp | as per row | yes | no | NO-OP | `RecordVersionInTx` returns nil on `IsWisp` (version_history.go:96, FR-8); wisps.current_revision stays at its default |
| 14 | dependencies.go:`addDependencyInTx` via `AddDependencyInTx` from the store verbs — dolt/dependencies.go:`addDependencyWithOptions`, dolt/transaction.go and embeddeddolt/transaction.go `AddDependencyWithOptions`, embeddeddolt/dependencies.go, dolt/wisps.go:`addWispDependency`, batch_apply.go:`applyBatchRun.applyDepAdd`, aggregate.go:`ApplyParentPatch` | INSERT dependencies or wisp_dependencies | yes | no | OUT OF CONTRACT | same DML as row 7 but no caller invokes `RecordVersionInTx`; only the publicops editor role versions |
| 15 | domain/db/dependency.go:`dependencySQLRepositoryImpl.Insert` (domain `DependencyUseCase.AddDependencies` from uow/dependency_editor.go and uow/batch_applier.go; `IssueUseCase` create-time edges, domain/issue.go:980,1041,1053) | INSERT dependencies or wisp_dependencies | yes | no | OUT OF CONTRACT | the uow leg's dependency add never reaches the seam — only `Insert`/`Update` in domain/db/issue.go do |
| 16 | dependencies.go:`removeDependencyInTx` via `RemoveDependencyInTx` from store verbs (dolt/dependencies.go and both transactions `RemoveDependencyWithOptions`, `ApplyParentPatch`) and domain/db/dependency.go:`Delete` (uow `RemoveDependencyBySource`) | DELETE dependencies or wisp_dependencies | yes (when EmitEvent) | no | OUT OF CONTRACT | as row 14 |
| 17 | close.go:`closeIssueInTx` (`CloseIssueInTx`, `CloseIssueWithoutEventInTx`, `CloseIssueCheckedInTx`; execution.go:`ExecuteClose`; close_batch.go:`ExecuteCloseBatch` loops `ExecuteClose`; domain/db `Close`/`CloseChecked`) | UPDATE issues or wisps SET status, closed_at, close_reason, closed_by_session, row_lock (close.go:340) | yes (EventClose, close.go:387, not gated by `recordEvent`) | no | OUT OF CONTRACT | direct UPDATE; never calls `RecordVersionInTx`, so a close is invisible to issue_versions |
| 18 | reopen.go:`reopenIssueInTx` (`ReopenIssueInTx`; execution.go:`ExecuteReopen`; domain/db `Reopen`) | UPDATE status/closed_at (reopen.go:64) | yes | no | OUT OF CONTRACT | as row 17 |
| 19 | claim.go:`ClaimIssueInTx` (public_claim.go:`ExecuteClaim`; `ClaimReadyIssueInTx` from claim_next.go:`ExecuteClaimNext`; `ExecuteUpdate`'s Claim flag) and domain/db/issue.go:`Claim` (uow) | UPDATE assignee/status/started_at (claim.go:115,124; issue.go:478,488) | yes | no | OUT OF CONTRACT | a claim-only request mints nothing; `ExecuteUpdate` versions only if other fields also change (execution.go: `ClaimIssueInTx` then `if len(updates) > 0`) |
| 20 | unclaim.go:`UnclaimIssueInTx` / `UnclaimIssueIfAssigneeInTx` via `finishUnclaimInTx`; release_role.go:`ReleaseIssueInTx` wraps them (domain/db `UnclaimIssue`/`ReleaseIssue`) | UPDATE assignee/status (unclaim.go:80,197) | yes | no | OUT OF CONTRACT | direct UPDATE |
| 21 | lease.go:`ReclaimExpiredLeasesInTx` (dolt/issues.go:473, embeddeddolt/issues.go:134, domain/db `ReclaimExpiredLeases`) | UPDATE issues assignee/status revert (lease.go:758) + DELETE leases | yes | no | OUT OF CONTRACT | `HeartbeatIssueInTx` writes only `leases` and is not an issue-record write |
| 22 | wake_defers.go:`wakeExpiredDefersInTable` (`WakeExpiredDefersInTx`; dolt/queries.go:63, embeddeddolt/queries.go:33, domain/db `WakeExpiredDefers`) | UPDATE status (wake_defers.go:116) | yes (actor `DeferWakeActor`) | no | OUT OF CONTRACT | scheduled status flip outside the seam |
| 23 | labels.go:`AddLabelInTx` / `RemoveLabelInTx` (dolt/labels.go, embeddeddolt/labels.go, both transactions, aggregate.go:`ApplyLabelPatch` from `ExecuteUpdate`) and domain/db/label.go:`Insert` / `Delete` (uow `LabelUseCase`) | INSERT IGNORE / DELETE labels or wisp_labels | yes (EventUpdate) | no | OUT OF CONTRACT | labels ARE in `durable_state` (get_issue.go:59 hydrates them) but a label change mints nothing; in `ExecuteUpdate` the label patch runs after `UpdateIssueInTx`'s mint, so a same-call field+label edit records the old label set |
| 24 | comments.go:`addIssueCommentInTx` (`AddIssueCommentInTx`, `ImportIssueCommentInTx`, commenter.go:`ExecuteAddComment`); dolt/transaction.go:`AddComment` / `ImportIssueComment` (`InsertDerivedEventReturningID` / `InsertDerivedComment`); domain/db/comment.go:`InsertRecord` (uow `CommentUseCase`); create.go:`PersistComments` | INSERT comments or wisp_comments (dolt tx `AddComment` writes an events-table comment row) | yes (`RecordCommentEventInTx`) | no | OUT OF CONTRACT | comments are not in `durable_state` either (`GetIssueInTx` joins labels, not comments) |
| 25 | promote.go:`PromoteFromEphemeralInTx` (dolt/ephemeral_routing.go:205, embeddeddolt/store.go:1003, domain/db `PromoteFromEphemeral`) | INSERT issues (+ label/dep/comment copies), DELETE wisps | yes | no | OUT OF CONTRACT | promoted row lands with current_revision default 1 and no version row |
| 26 | dolt/ephemeral_routing.go:`DoltStore.demoteToWispInTx` | `UpdateIssueWithoutEventInTx` (row 5), then raw aux copies + DELETE FROM issues (:303) | yes | yes (update half only) | OUT OF CONTRACT | mints a version row for an issue the same tx then deletes; issue_versions has no FK to issues (0067), so the row strands |
| 27 | persistence.go:`MoveIssuePersistenceInTx` (`ExecuteUpdate` persistence patch; domain/db `MovePersistence`) | `InsertIssueStrictInTx` into the target plane, copy aux, DELETE source (persistence.go:70,106) | yes (twice) | no | OUT OF CONTRACT | plane move bypasses both the create and update seams |
| 28 | delete.go:`deleteIssueRowInTx` / `DeleteIssuesInTx` / `DeleteResolvedSetInTx`; delete_role.go:`DeleteInTx`; sweep.go:`SweepInTx`; dolt/wisps.go:`deleteWisp` / `deleteWispBatchTx`; domain/db/issue.go:`Delete` / `DeleteByIDs` (+ label/dependency/events `DeleteAllForIDs`, domain/issue_delete.go) | DELETE issues or wisps + aux + leases | yes (`RecordDeleteInTx`) | no | OUT OF CONTRACT | no surviving row; the deleted-Versioned-Bead guarantee is Phase 3 (PR #6358); orphaned issue_versions rows remain. delete_role.go:`RewriteDeletedReferencesInTx` then goes through row 5, so neighbours DO mint versions |
| 29 | bulk_ops.go:`DeleteIssuesBySourceRepoInTx` (dolt/issues.go:946, embeddeddolt/store.go:987) | bulk DELETE issues WHERE source_repo = ? | yes (per id) | no | OUT OF CONTRACT | bulk path |
| 30 | bulk_ops.go:`UpdateIssueIDInTx` via `updateIssueIDInTx` / `updateWispIDInTx` (dolt/rename.go:14, embeddeddolt/store.go:995) | UPDATE issues SET id = ? + dependency rekey | yes (dep-remove, delete old, create new, dep-add via `recordRenameInJournal`) | no | OUT OF CONTRACT | history stays keyed to the old issue_id; the new id carries current_revision with no matching rows |
| 31 | compaction.go:`ApplyCompactionInTx` (dolt/compact.go:52, embeddeddolt/store.go:1179) | UPDATE issues SET compaction_level, compacted_at, compacted_at_commit, original_size, updated_at | no (`beadDMLExemptions`) | no | OUT OF CONTRACT | the content rewrite that precedes it (internal/compact/compactor.go:147, cmd/bd/compact.go:702 via `store.UpdateIssue`) IS row 5, so compaction mints exactly one version for the summary while its own columns land unversioned |
| 32 | compaction.go:`RestoreFromSnapshotInTx` (dolt/compact.go:82, embeddeddolt/store.go:1203) | UPDATE issues content from snapshot (compaction.go:173,181) | no | no | OUT OF CONTRACT | restore's CAS composition is Phase 3 (PR #6358) |
| 33 | blocked_state.go mark/unmark templates via `RecomputeIsBlocked*` / `MarkIsBlockedInTx`; dependencies.go:`markDirectBlockingDependencySourceInTx`; domain/db/dependency.go:`markDirectBlockedSource` | UPDATE issues or wisps SET is_blocked | yes, flips only (journal.go:`recordBlockedJournalChanges`, actorless) | no | OUT OF CONTRACT | derived state; is_blocked is not hydrated into `durable_state` |
| 34 | batch_apply.go:`applyBatchRun` (`ApplyBatch`; uow/batch_applier.go) | per item: create rows 1/2, update rows 5/6, close row 17, dep add rows 14/15 | per item | per item | OUT OF CONTRACT (mixed) | dep-add items call `AddDependencyInTx` / `DependencyUseCase.AddDependencies`, never the versioned editor |
| 35 | schema/cli_migrations.go:`cliMigration0053RepairRigWisps` (INSERT IGNORE INTO issues, UPDATE issues, DELETE FROM wisps); schema/migration_repairs.go and schema/wisp_dep_forward_repair.go (dependencies rewrites) | migration DML | no | no | OUT OF CONTRACT | 0067/0068 themselves are DDL only (ADD COLUMN ... DEFAULT 1; no row backfill) |
| 36 | versioncontrolops/automerge.go:`resolveIssuesFieldMerge` (UPDATE `issues`); versioncontrolops/mergesettle.go:`TryRepairFKCascadeViolations` (`fkCascadeRepairDeletes` on dependencies/labels/comments) | merge-settle rewrites and orphan deletes | no | no | OUT OF CONTRACT | raw connection during merge settlement |
| 37 | dolt/federation.go:`deleteExcludedIssues` (from `stageFilteredBranch`) | DELETE FROM issues WHERE ephemeral = 1 / issue_type = ? on the staging branch | no | no | OUT OF CONTRACT | raw conn on a filtered-push branch |
| 38 | cmd/bd/doctor/fix/validation.go:`OrphanedDependencies` / `ChildParentDependencies` / `CrossTableDuplicates` | `tx.Exec` DELETE FROM dependencies / issues | no | no | OUT OF CONTRACT | raw doctor fixes |
| 39 | cmd/bd/sql.go (`storage.RawDBAccessor.UnderlyingDB` then `db.ExecContext`); cmd/bd/sql_proxied_server.go via uow `RawSQLUseCase().Exec` to domain/db/raw_sql.go | arbitrary SQL | no | no | OUT OF CONTRACT | the proxied variant runs inside a uow tx with the version scope bound (uow/dolt_sql_provider.go:178) but raw SQL never calls the seam |
| 40 | issueops/bootstrap.go:`BootstrapInTx` (uow/bootstrapper.go, hook_bootstrapper.go) | config + metadata tables only (`SetConfigInTx`, `SetMetadataInTx`) | no | no | OUT OF CONTRACT (n/a) | writes no issue-plane row at all |
| 41 | PLANNED 18th: `fk_dep_issue_target` ON DELETE CASCADE (schema/cli_migrations.go:284,311; migrations 0041/0043) | DB-level cascade deleting dependencies rows when their target issues row is deleted; no Go call site | no | no | Phase 3 (planned) | PR #6358 body: "Phase 3 items by design: the `fk_dep_issue_target` cascade (the 18th path)"; today it fires silently underneath rows 28-29 |
### Notes as found at 321a79278
- **Count vs design.** Grouping by leaf mutation function, the code has **34 live issue-plane write paths** (rows 1-8 and 14-39; row 40 excluded because it writes no issue row; rows 9-13 are gates inside rows 1-8) plus the planned FK cascade — not eighteen. Of the 34, **8 are VERSIONED, 26 OUT OF CONTRACT**, and 5 NO-OP gates sit inside the versioned ones. The design's own list (be-hs42e.3) is not resolvable from this checkout or `bd show`; only PR #6358's "the 18th path" line was found, so the eighteen could not be reconciled item by item.
- **What actually versions:** create, update (and their uow twins in domain/db/issue.go) and the publicops dependency editor. Every other journaled mutation — close, reopen, claim, unclaim/release, lease reclaim, defer wake, labels, comments, promote, persistence move, delete, rename — reaches `RecordEventInTx` but never `RecordVersionInTx`, even though version_history.go:20-27 describes the seam as living "inside the same already-short-circuited functions that call RecordEventInTx". journal_completeness_test.go pins 57 `mutationEntryPoints` for the journal; the version seam is wired into 3 of them, and no equivalent completeness test exists for it.
- **Cross-leg asymmetry on dependencies:** the dolt and embeddeddolt DependencyEditor roles version (rows 7-8); the uow DependencyEditor role goes through domain/db dependency `Insert`/`Delete` and does not (rows 15-16). The legacy store verbs `AddDependency`/`RemoveDependency` do not on any leg (rows 14, 16).
- **Versioned only via a helper:**`MergeMetadataInTx`, `DeleteMetadataInTx`, `CompareAndSetMetadataKeyInTx`, `RewriteDeletedReferencesInTx`, compaction's content rewrite and `demoteToWispInTx` version solely because they call `UpdateIssueInTx` / `UpdateIssueWithoutEventInTx`.
- **Ordering inside a versioned call:** batch-create edges (row 3) and `ExecuteUpdate`'s label/parent patches (rows 23, 14) land after the mint, so the minted `durable_state` predates them.
- **Import upsert:** an unchanged re-import of an existing row (`isNew=false`, stale check not tripped) mints a version because create has no field-level no-op gate — unlike update's FR-2 behaviour (row 9).
- **No FK from issue_versions to issues** (migration 0067 creates the table without one), so delete, rename and demote (rows 26, 28, 30) strand version rows under ids that no longer exist in issues.
- **Exemption tables that name the seam:** journal_completeness_test.go `beadDMLExemptions` and row_lock_guard_test.go `funcNameExemptions` both list `RecordVersionInTx` as bookkeeping for an already-journaled mutation.
- **Drift during this session (2026-09-07 13:31-13:33):** the branch advanced to 56b2199d4 (`attribution_status` renamed to claimed|unknown, ordinals documented as local) and the working tree then carried further uncommitted edits by another agent — version_history.go (RFC 8785 canonical `durable_state` via `jcs`, with go.mod/go.sum), cli_migrations.go, the 0068 up/down SQL, three schema tests and an untracked version_history_durable_state_test.go. Neither adds or removes a `RecordVersionInTx` call site (the six above were re-verified against 321a79278 and the live tree) and no disposition changes; this inventory is against 321a79278 and does not cover them.
t.Fatalf("GuardedWrite(a) claiming alias %q was refused (Refusal=%+v), want Accepted: a per-record guard cannot see a joint violation",shared,first.Refusal)
t.Fatalf("GuardedWrite(b) claiming the SAME alias %q was refused (Refusal=%+v), want Accepted (R16.1-a: per-record CAS structurally cannot catch a cross-record conflict)",shared,second.Refusal)
t.Fatalf("CountHistoryForSubject(%s) before the refused batch: %v",spanning[1].ID,err)
}
}else{
t.Logf("this backend cannot observe history by subject (CountHistoryForSubject is nil): the before-batch history counts for %s and %s go uncaptured",spanning[0].ID,spanning[1].ID)
t.Fatalf("CountHistoryForSubject(%s) after the refused batch: %v",spanning[1].ID,err)
}
ifafterA!=beforeA||afterB!=beforeB{
t.Errorf("a refused batch left a trace: history count for %s went %d->%d, for %s went %d->%d; a refusal must be atomic — the whole batch takes no effect, not just the record that individually triggered it",spanning[0].ID,beforeA,afterA,spanning[1].ID,beforeB,afterB)
}
}else{
t.Logf("this backend cannot observe history by subject (CountHistoryForSubject is nil): the refused batch's atomicity (no partial trace left behind for %s or %s) goes unverified",spanning[0].ID,spanning[1].ID)
t.Fatalf("EnforceCrossRecordInvariant refused an unrelated, non-conflicting write (InvariantRefusal=%+v); the invariant transaction must scope exactly the spanning records, not more",independent.InvariantRefusal)
}
}
// RunInvariantRefusalNamesTheViolatedInvariant pins R16.1-c: a refused batch
// carries an InvariantRefusal naming the specific invariant that fired, not
t.Fatalf("MemoryKeyAliasWrite(b) claiming the SAME alias %q was refused (Refusal=%+v); alias uniqueness (#5877 R2) is a store invariant, so a per-record write cannot enforce it and must be Accepted here",alias,second.Refusal)
}
}
// RunMaximumEndpointMultiplicityIsAStoreInvariantNotACAS pins FR-02's second
// required subject: MaximumEndpointMultiplicity is a STORE invariant, not
// row-level CAS, so two edges independently claiming the same endpoint each
// succeed when checked one at a time through a per-record-shaped call.
t.Fatalf("GraphEdgeWrite(b) from the SAME endpoint %q was refused (Refusal=%+v); MaximumEndpointMultiplicity is a store invariant, so a per-record write cannot enforce it and must be Accepted here",from,second.Refusal)
t.Fatalf("GuardedWrite(b) under a held lease: %v",err)
}
if!first.Accepted||!second.Accepted{
t.Fatalf("holding an advisory lease changed a per-record GuardedWrite's own verdict (first.Accepted=%v second.Accepted=%v); the lease is observed by convention only and GuardedWrite must not consult it (FR-03)",first.Accepted,second.Accepted)
t.Fatalf("count bd_events_journal dep_add rows for %s: %v",source,err)
}
ifjournalCount!=2{
t.Errorf("bd_events_journal dep_add rows for %s = %d, want 2: the metadata-changed re-add must journal its own replacement-edge entry",source,journalCount)
}
varstoredMetadatastring
iferr:=fixture.QueryScalar(ctx,
"SELECT metadata FROM dependencies WHERE issue_id = ? AND COALESCE(depends_on_issue_id, depends_on_wisp_id, depends_on_external) = ?",
[]any{source,target},&storedMetadata);err!=nil{
t.Fatalf("read stored metadata for %s -> %s: %v",source,target,err)
}
// Compared after re-encoding rather than byte-for-byte: a native JSON
// column is free to re-canonicalize what it stores (e.g. inserting the
// space after ':' Dolt's does), and that is not the thing this case is
// about. canonicalizeForContract has no numeric blind spot here because
// this fixture's metadata values never carry a bare JSON number.
t.Errorf("issue_versions rows for %s went %d -> %d (delta %d), want a delta of 1: the metadata genuinely changed, so the re-add is a real mutation of the source issue and must mint exactly one version (#5898 leg 2)",source,versionsBefore,versionsBefore+delta,delta)
}
}
// countDependencyEditorIssueVersions reports how many issue_versions rows
// exist for the given issue. Shared by every case here that asserts a
// version DELTA rather than an absolute count: the fixture's issues accrue
// versions from more than this one seam, so the relative change across an
// operation is the only thing a case can rely on.
t.Errorf("issue_versions rows for %s went %d -> %d (delta %d), want a delta of 0: the re-add's metadata is semantically identical to what is already stored (byte differences aside), so nothing changed and nothing should be versioned (#6650)",source,versionsBefore,versionsBefore+delta,delta)
}
})
}
}
// RunDependencyEditorSameTypeReAddWithChangedThreadMintsOneVersion is the
// thread_id twin of
// RunDependencyEditorSameTypeReAddWithChangedMetadataMintsOneVersion. The row
// carries a thread as well as metadata, and the source issue's version snapshot
// carries each edge's thread_id, so a same-type re-add naming a thread the row
// does not carry is a real mutation on the same terms as a metadata change:
// the leaf updates the row in place, journals the replacement edge, and mints
// EXACTLY ONE version (#5898 leg 2). The re-add arm once compared metadata
// alone, which read that re-add as change-free and dropped the thread.
//
// The metadata is identical across every write, so the thread is the only
// thing that moves. A last re-add names no thread, and is the change-free
// no-op: an empty thread names none rather than asking for none, which is
// what keeps the callers that never carry a thread from erasing one.
//
// It drives the writes through fixture.AddDependency for the reason the
// metadata case gives: publicops.DependencyEdge carries no thread either.
t.Errorf("issue_versions rows for %s went %d -> %d (delta %d), want a delta of 1: the thread genuinely changed, so the re-add is a real mutation of the source issue and must mint exactly one version (#5898 leg 2)",source,versionsBefore,versionsBefore+delta,delta)
t.Errorf("issue_versions rows for %s went %d -> %d (delta %d) on a re-add naming no thread, want a delta of 0: it keeps the stored thread, so nothing changed (#5898 R3)",source,versionsBefore,versionsBefore+delta,delta)
}
}
// RunDependencyEditorRepeatsWithinOneRequestCollapse pins the clause that
// answers a request naming ONE PAIR TWICE. The same-type re-add rule is stated
// for the pair rather than for the call, so the second occurrence inside a