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>
* 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>
`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>
* 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>
* 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>
* 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(events): thread the request actor through the issueops delete door
`bd delete --actor A` journaled its `delete` row and every cascade
`dep_remove` row with actor='' — the #5985 finding. The actor was in hand
at the role body (DeleteInTx already passes req.Actor to the reference
rewrite) and dropped one call below it.
Widen the delete workers with an explicit `actor string` parameter, the
house style PR #5908 used for the rest of the journal (never ambient
context): DeleteResolvedSetInTx, DeleteIssue(s)InTx, deleteIssueRowInTx,
and the RecordDependencyRemovals* family. DeleteInTx passes req.Actor and
SweepInTx passes SweepRequest.Actor, so sweep deletions become attributable
for free.
The genuinely actorless system surfaces — storage.DeleteIssue(s),
Tx.DeleteIssue, the dolt wisp deletes, the source-repo wipe behind
`bd repo remove` — pass "" explicitly, which the 0066 contract reads as
system/unknown. Their comments now say why rather than claiming the
plumbing cannot carry an actor.
No storage.Storage interface change and no migration: 0066 already added
`actor VARCHAR(255) NOT NULL DEFAULT ''`.
The domain/db repository call sites keep their existing "" for now; the
next commit threads the UOW door's actor to them.
Refs #5985
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(events): thread the request actor through the domain repository delete seam
The UOW door (proxied-server `bd delete`, HTTP API deleteIssues, `bd sweep`
over a unit of work) had the actor as far down as domain.deleteMany and lost
it at the repository interface, so its `delete` and cascade `dep_remove` rows
landed with actor=''.
Widen the seam the way PR #5908 widened IssueRepository.MovePersistence, for
the same reason: an explicit trailing `actor string` on
IssueSQLRepository.Delete / DeleteByIDs and DependencySQLRepository.
DeleteAllForIDs. deleteMany passes the actor its use case was already given,
so DeleteIssue / DeleteWisp / DeleteIssues / DeleteWisps keep their surfaces
unchanged and both doors now agree.
No variadic and no default: a new caller has to say whose delete this is, or
say "" and mean it.
Refs #5985
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(events): say when the journal being read is disabled; correct the actor docs
Zero rows is indistinguishable from caught-up. A consumer polling a workspace
whose writers never enabled the journal gets a successful, empty read forever
and concludes it is up to date — the "nothing to read and no way to tell why"
trap behind the field report's "0 rows" claim, which was default-off
activation and not a write-path gap.
`bd events export` and `bd events tail` now print a one-line stderr notice when
the target workspace resolves to disabled, and still serve whatever rows exist:
exporting the ledger a now-disabled workspace recorded while it WAS enabled is
legitimate, so this is a notice and not a refusal. It is the CLI mirror of the
HTTP API's EventsJournalDisabled 409, which can refuse because it has no
historical-export case. stderr, not the JSONL stream, and the exit code is
unchanged.
The default stays off. Flipping it changes write amplification and retention
for every workspace, which is not release-branch material.
Also fixes two now-false statements about attribution — the `bd events tail`
record contract and the docs page both said deletes never carry an actor — and
documents the requirement that every WRITER workspace enable the journal, not
just the one a consumer reads.
The golden gains the delete/dep_remove attribution, regenerated deliberately.
It keeps an actorless delete alongside the attributed one: the fixture used to
be the only evidence a consumer had, and reading it as "deletes are never
attributed" would mis-resolve every delete conflict.
Refs #5985
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(events): pin delete/cascade attribution at the DB on every plumbing
Four levels, because the drop happened at a seam no single one of them can
see:
- internal/storage/dolt: a ROLE-path delete (store.Deleter(), Force, an
explicit actor) reads back `deleter-1` on both the delete row and the
cascade dep_remove row. The store.DeleteIssue stanza in
TestEventsJournal_ActorAttribution keeps asserting '' and its comment now
says WHY — that surface is the actorless system interface, so the pin is
meaningful instead of aspirational.
- internal/storage/domain/db: the repository seam itself — Delete,
DeleteByIDs and DeleteAllForIDs each journal under the actor they are
handed — plus the cascade through the use case. journalRow gains Actor, so
the existing suite can see the column at all.
- internal/storage/uow: the same promise through the unit-of-work Deleter,
the door #5908's review caught drifting once already.
- internal/storage/embeddeddolt: a per-op matrix over the DEFAULT LOCAL
WORKSPACE. One mutation of every journaled kind, asserted at the DB, both
directions — every attributed op names its actor, and the only rows that
may carry none are the derived is_blocked updates.
- cmd/bd: #5985's repro verbatim through the real binary, and the
disabled-journal notice (present on export and tail, on stderr, absent
when enabled).
Also corrects the two remaining "actorless delete plumbing" claims in the
journalops.Row and issueops.RecordEventInTx contract comments.
Closes#5985
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(events): fix the CLI repro's flag and read stdout where stderr now speaks
`bd delete` has no --yes; --force is what makes it a real delete rather than
a preview.
TestRoutedCreateJournalsIntoTheTargetWorkspace asserted "the launching
workspace journaled nothing" against COMBINED output, which the new
disabled-journal notice now legitimately writes to. Its subject is journal
ROWS, so it reads stdout.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat(events-journal): record the mutating actor on every journal row (bd-mbrxm)
The bd_events_journal row recorded op/ts/issue_id/payloads but never WHO
performed the mutation, so downstream attribution (e.g. same-field,
different-actor conflict detection over the journal) had nothing to key on.
- Schema: `actor VARCHAR(255) NOT NULL DEFAULT ''` on bd_events_journal, on
both migration planes (0066 + ignored/0025) so the two-door shape converges.
- Record*InTx takes the actor explicitly (no ambient ctx) — every call site
already sits beside an audit-event emit that has the actor in hand; thread
that same value (incl. the UOW door's MovePersistence). Comment rows carry
the comment's author. Blank = unattributed (derived maintenance, deletes —
follow-up bd-zxt49 — and pre-column rows); never user attribution.
- `bd events tail/export` JSON gains an additive, omitempty `actor` field;
the wire vocabulary is otherwise untouched (openapi spec, reference doc,
CHANGELOG; golden regenerated deliberately).
- CLI bundle: direct-DDL override for 0066 in cliCompatibleMigrationSQL —
dolt 2.2.0 (CI's pin) no-ops the prepared ALTER (dolthub/dolt#11345), so
without it the parity oracle sees actor only on the runtime side. Measured:
AllMigrationsSQL() through 2.2.0 lands bd_events_journal WITHOUT actor and
2.3.1 WITH; with the override both land it. String assertions + a
requireDoltColumnShape guard pin it without a Dolt binary.
Verified (enumerated): go build ./...; gofmt; go vet; migration hygiene
(BASE_SHA=07c163df0); internal/storage/schema (string test + CLI-apply test
under dolt 2.3.1 AND 2.2.0); internal/storage/domain/...; eventsjournal;
journalops; httpapi (wire-tag bijection incl. actor); storage/dolt
-run 'Journal|EventsJournal|ActorAttribution' against real dolt;
cmd/bd -run Events (golden); storage/uow -p 1 (-timeout 90m): every test green except 3
timeout-shaped reds (ConcurrentInstantiation lock-acquire, EndToEnd 30s
init-schema, PreexistingDirty docker reaper) in a /private/tmp worktree
under box load 40-68; the same 3 at origin/main in that worktree also
red, and at THIS commit in the primary clone all 3 PASS (130s) — box
flake, not the diff.
* docs(events-journal): align seq:4 example with the actorless golden fixture
Maintainer review follow-up on PR #5908 (bd-mbrxm). Both reviewers flagged that
the reference JSONL example's seq:4 is_blocked derived-maintenance row carried
"actor":"worker-1", contradicting the record-contract field table (derived
is_blocked recomputes are actorless) and the golden fixture
cmd/bd/testdata/events_journal_records.jsonl, which emits that same seq:4/bd-100
row without an actor. Drop the actor member so the doc example mirrors the
fixture byte-for-byte and consumers do not misclassify a system recompute as a
user write.
The other, optional review nit (the "stray typographic quote" in the
insertEventRow doc comment) is intentionally left as-is: that glyph is gofmt's
canonical rendering of '' in a Go 1.19+ doc comment (TeX-style quoting turns two
ASCII apostrophes into U+201D), so the reviewers' literal '' suggestion is a
no-op the enforced pre-commit gofmt reverts on every commit. It is cosmetic and
non-gating; the DDL and INSERT are already correct.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
`bd events tail|export|prune` is how a consumer actually reaches the journal.
tail emits JSONL from a --since checkpoint and --follow keeps printing new
records as they commit; export is tail from zero; prune deletes below --before,
honoring the retention floors. All three work identically against the embedded
store, a server-mode store, and proxied-server mode, which reads and prunes
through its unit-of-work journal capability rather than a raw connection. The
proxied prune commits with the SQL-only form: the journal table is dolt_ignored,
so its delete must persist into the working set without minting a Dolt commit.
A pruned-past checkpoint surfaces as {"code":"events_journal_truncated","since",
"floor","head"} with a non-zero exit. Both read call sites report it, because
wiring only one still lets `export` present a pruned journal as a complete
history — and the two are framed differently on purpose. The one-shot read
prints the object the way every other --json failure does. The --follow poll
prints it as ONE line on the JSONL stream it interrupts: the consumer there is
a line reader, and a pretty-printed multi-line object dropped into its input is
unparseable, so it would see the stream stop with garbage after the last good
record. Same fields, same code, same exit; only the framing follows the stream.
A negative --since is refused outright rather than serving `seq > -5` as if it
were a resume.
Activation is applied by the FACTORIES that build a store or a unit-of-work
provider, not by the commands that use one. It did not start there, and the
failures that got it here are the argument for the guard that now holds it:
first a process-global switch; then two root pre-run call sites, which covered
the CLI's own store and its proxied provider and missed `bd serve` (which
builds its own provider for a server-mode workspace), routed creates and
remote-cache hydration (which open a SECOND store for another workspace), the
pluggable backend registry arm, and the personal-migration planning store; then
a blanket exemption for bd doctor whose stated reason — "workspace repairs, not
bead mutations" — was FALSE for three of its repair handlers. Each ran with the
journal off while every command reported success, and an empty journal is
indistinguishable from a quiet one.
Those three now journal. StaleClosedIssues and PatrolPollution DELETE issues
and the two fresh-clone import paths CREATE them, so they open through an
activating factory of their own; a repair is the last place a silent divergence
is acceptable, because it runs unattended on a workspace someone is already
worried about. The policy moved to internal/eventsjournal for it: bd doctor's
fix package cannot import package main, and two copies of an activation rule is
how the rule stops being one rule. What remains exempt in doctor is named
handler by handler with a reason that can be checked against the code, rather
than inherited from a directory.
So TestEveryStoreConstructionActivatesTheEventsJournal enumerates every
construction of a store or provider across cmd/bd, bd doctor, its fix package
and the standalone embedded utility, and fails unless the constructing function
activates in its OWN body or carries a written exemption. Deliberately no
call-graph fixpoint: "the caller does it" is exactly the assumption that kept
being wrong. The factories use a deferred rewrite of their named results so the
open and its activation are one syntactic unit, which is what makes the check
local. Sites are keyed by file, so the CGO and non-CGO twins of a factory are
checked separately rather than one silently shadowing the other, and
constructors are matched through each file's IMPORT TABLE rather than by
package identifier — an aliased import would otherwise produce no site at all,
which is the worst thing a guard can do, because it reports success while
checking nothing. Its remaining honest limits (a constructor reached through a
method value, a package nobody added to the scan) are written down in the
guard rather than claimed away.
A cross-workspace open reads the TARGET workspace's own config.yaml, not the
launching one's: the journal records that workspace's mutations, so that
workspace decides whether they are recorded. An explicitly set
BD_EVENTS_JOURNAL outranks both — environment beats file here as everywhere
else in bd, and a routed write into several workspaces is exactly where an
operator reaches for it; a file that could veto it would make the variable a
suggestion, discovered later as an empty journal.
The three config keys join YamlOnlyKeys, which is the whole of review blocker 6.
They are read through viper during pre-run, before the store is open, so a
DB-backed write is silently unread — the GH#536 class that map exists to
prevent. TestEventsPruneHonorsRetainRowsFloorFromConfig enables the journal
through `bd config set` and then asserts records actually appear, so the
blocker cannot regress into a green suite.
The committed golden pins the record envelope external consumers parse,
including the comment op, and is built by marshaling real types.Issue /
EventDep / EventComment values through the same buildRecord path tail uses.
Four properties are guarded rather than assumed. No record may carry an inline
"dependencies" array. Every comment record's source must be one an emit site
can actually produce, and both must appear — the golden shipped for one
revision pinning "comment", a value invented for the fixture, which is worse
than no fixture because a golden's job is to be the thing consumers trust. And
the file must be reproducible: an issue snapshot carries wall-clock ride-alongs,
notably lease_expires_at / heartbeat_at, which a claim stamps from time.Now().
A fixture that reached for the clock would pass on the run that regenerated it
and fail on every run after, reading as flake rather than as the fixture bug it
is. Rather than normalize those fields away, the claimed fixture carries FIXED
lease values — so the golden pins the shape a consumer of a claimed bead really
sees — and a second test renders twice and requires byte equality.
The help text carries the contract a consumer has to know before it trusts a
cursor, because none of it is inferable from the records: the journal is
per-branch working-set state and per REPLICA, so `bd dolt pull` and the changes
a merge settles in are NOT journaled and a mirror must re-baseline after a sync;
each replica counts its own seq space, so a checkpoint taken against one is
meaningless against another; raw DML through `bd sql` bypasses the mutation seam;
store-open-time migrations and version reconciliation are unjournaled by design;
retention floors are not a consumer watermark; prune is manual and pairs with
`dolt gc`, since ordinary Dolt commits never collect dolt_ignored state. And the
two dependency asymmetries a naive consumer gets wrong: a dep_add is emitted for
an idempotent same-type re-add that only refreshes metadata (the audit table
dedupes that case, the journal does not — it is an upsert, not proof the edge is
new), and dep.metadata is the value being written on add but the raw stored
column read back on remove, so the two can differ byte for byte while meaning
the same thing.
Four end-to-end tests hold the activation paths, and each was verified by
removing the activation it covers: a proxied mutation reports "journaled 0
records"; `bd serve` against a server-mode workspace journals nothing for an
HTTP mutation; a routed create into a journal-enabled target records nothing;
and a bead-mutating `bd doctor --fix` deletes issues while journaling none of
them. The routed tests also pin the direction and the precedence — the
launching workspace, which enabled nothing, stays empty, and a target that
explicitly set the key to false is still overridden by the environment.
Ports cmd/bd/events.go + events_journal.go from 3bfed2431/0a3fe0f9b and the
golden from 3666e5026. Deviations: the reference's validateEventsJournalBackend
named a backend allowlist including a SQL family OSS main does not have, so the
capability check itself fails closed instead; its proxied prune used a
uow.RunInTx helper that does not exist here, replaced by RunTxEphemeral, which
states the dolt_ignored intent rather than relying on the commit path to demote
an empty DOLT_COMMIT; activation is factory-scoped rather than applied at the
reference's root pre-run call sites; and the golden's comment source is taken
from the engine's constants rather than restated.
Co-authored-by: CI Bot <ci@beads.test>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of julianknutsen
* fix(update): exit nonzero when a multi-ID update partially fails
bd update applies updates per issue ID, but the exit code only went
nonzero when every ID failed (len(args) > 0 && firstUpdatedID == "").
A single successful ID reset the whole batch to exit 0, so a bogus or
unresolvable ID mid-batch was silently swallowed and callers (scripts,
orchestrators) could not detect a partial batch. The GH audit flagged
this: per-ID errors were printed inline on stderr, but the process
reported success.
Empirical baseline-vs-patched evidence (red-team scenarios S1-S7):
baseline `bd update good1 bogus good2 --priority 1` exits rc=0 with one
inline stderr line; patched exits rc=1 with "1 of 3 issues failed to
update" plus a per-ID report. In --json mode the last stderr line is
now a machine-parseable failure report ({error, failed[], schema_version},
envelope-aware) while stdout keeps the array-of-updated-issues success
shape (parsed_list_len=2, both good IDs applied - the command stays
per-ID, not atomic). All-good paths are unchanged: rc=0 and stderr
byte-identical to baseline in both text and JSON modes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: auto-regenerate CLI reference
Applied from the cli-docs-freshness-patch artifact of https://github.com/gastownhall/beads/actions/runs/29144979580
(generated with CI's canonical pinned build). See
scripts/check-cli-docs-drift.sh for how drift is attributed.
* docs: auto-regenerate CLI reference
Applied from the cli-docs-freshness-patch artifact of https://github.com/gastownhall/beads/actions/runs/29521598853
(generated with CI's canonical pinned build). See
scripts/check-cli-docs-drift.sh for how drift is attributed.
* fix(update): per-ID failure handling + output parity for multi-ID batches
Maintainer review fixup for PR #4726.
`bd update` over multiple IDs is per-ID, not atomic: every failed ID must
be reported and the command must exit nonzero while the other IDs still
update. Several paths still short-circuited that contract; this fixup
brings them all in line with the documented behavior.
Direct-mode metadata failures are now per-ID (review finding: major /
correctness). A `--metadata` merge or `--set-metadata`/`--unset-metadata`
edit that failed for one ID (e.g. that issue's stored metadata is not a
JSON object) used to return immediately -- aborting the batch, skipping
later IDs, and in --json mode writing the error to stdout instead of the
stderr failure report. It now prints the per-ID error, records the failed
ID, closes the unmutated result, and continues, exactly like the
resolve/update/label/parent paths. Added text and --json coverage with a
middle ID whose existing metadata is non-object for both the merge and the
edit paths.
Proxied-server exit-code parity (review finding: major / correctness). The
proxied path used to exit 0 whenever another ID in the batch succeeded,
hiding generic per-ID failures from exit-code automation.
runUpdateProxiedServer now accumulates every failed ID -- generic per-ID
errors and lost --claim races alike -- and returns the shared
reportUpdateFailures() after emitting successful output, so the batch
exits nonzero with the same stderr failure report (text and --json) as the
non-proxied path.
Proxied output-mode consistency (review finding: minor / maintainability).
Proxied success output now keys off the same global JSON decision (--json
OR --format json OR config) that reportUpdateFailures uses, so success
output and the failure report can no longer disagree on format within one
invocation.
Also fold the non-proxied reparent old-parent RemoveDependency failure
into the failed-ID ledger (review finding: minor / correctness): a failed
removal no longer proceeds to add the new parent edge on top of a stale
one, and no longer counts the ID as a silent success.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Test User <test@test.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 <adopt-pr@gascity.com>
- docsmint: all page rewrites (HTML-comment, relative-link, ESM) now skip
fenced code blocks; fence contents render verbatim
- docsmint: spliceCLINav fails closed when the "pages" key found after
"group": "CLI Reference" is not a sibling key of the same object, and
validates the spliced docs.json parses before writing
- docsmint: neutralize MDX ESM hazards in docs/CLI_REFERENCE.md too (bd
emits it without the per-page transforms, but Mintlify serves it as a
hidden page); regenerated docs/CLI_REFERENCE.md accordingly
- help_all: fail loudly when two commands collide on the same doc page ID
instead of letting the later write win; repair a garbled comment
- generate-cli-docs.sh: --check no longer trusts a repo-root ./bd it was
not explicitly given (the CGO guard detects CGO-ness, not staleness)
- docsync: validate the docs.json redirects array (well-formed, no dup
sources, destinations resolve)
- pour: runtime strings match the corrected Long text (Dolt sync, issue
database — not "sync to git" / "persistent in .beads/")
- testdata: formula_help.txt asserts the new docs/workflows/formulas.md path
* feat(formula): add bd formula schema reflection-driven primitive index (beads-9ib)
Generates internal/formula/schema_gen.go from types.go via go:generate,
exposing all 18 exported structs (Formula, Step, LoopSpec, OnCompleteSpec,
etc.) with field types, json/toml tags, required-flag, and doc comments.
Surfaced via:
bd formula schema # list every primitive
bd formula schema loop # show LoopSpec fields
bd formula primitives on_complete # alias + snake_case match
bd formula schema --json # machine-readable
Lookup prefers exact match over Spec/Rule(s) suffix-strip, so "gate"
resolves to Gate (not GateRule). Fields tagged json:"-" (Step.SourceFormula,
Step.SourceLocation) are excluded.
TestSchemaGenIsCurrent re-runs the AST walker in-memory and byte-diffs
against the committed schema_gen.go, so a new struct in types.go without
a regen will fail CI.
Item 2 of GH#3621.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(formula): point bd formula --help at the primitive index (beads-lnf)
Extends the cobra Long descriptions on `formula`, `formula list`, and
`formula show` so an agent reading any of them is told that
`bd formula schema` (alias `primitives`), the curated
`examples/formulas/primitives/` directory, and the website primitives
reference exist. Without these pointers, agents land on the formula
surface and conclude there is no primitive index — which is the exact
failure mode GH#3621 is closing.
Adds cmd/bd/testdata/formula_help.txt as the regression gate: a
scripttest that runs `bd formula --help` (plus `--help` on the list
and show subcommands) and asserts the four pointers are present. If
someone deletes a pointer, the snapshot fails.
website/docs/cli-reference/formula.md is auto-generated from the Long
descriptions via `bd help --doc formula`, so the website doc inherits
the pointers on its next regeneration with no manual edit.
Item 1 of GH#3621.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(formula): curated primitive examples + smoke harness (beads-0sp)
Adds examples/formulas/primitives/ with one minimal `.formula.toml` per
empirically wired primitive in internal/formula/types.go:
loop-count LoopSpec.count expand body 3x → .iter1.work…
loop-range LoopSpec.range/var {n} substitutes into title
children-epic Step.Children epic + children w/ sibling needs
branch-fanin ComposeRules.Branch fork-join, deploy depends on 3 sibs
condition Step.Condition var-driven step inclusion
gate-timer Step.Gate sibling gate-typed issue blocks step
Each fixture has a header doc-comment explaining the primitive in
plain language; README.md indexes them with a one-line description
each and points back at `bd formula schema`.
cmd/bd/formula_primitives_test.go is the smoke harness: for each
fixture it parses, cooks through the full transformation pipeline
(loops → branches → gates → advice → expansions → conditions), and
asserts the primitive's observable effect on the cooked subgraph
(issue IDs, blocking deps, substituted titles, gate await_type).
Cooks against an in-memory subgraph rather than a Dolt-backed temp
DB so the harness exercises the primitive transformation, not the
persistence/auto-export infrastructure.
A subtest fails if a fixture is added to the directory without a
registered assertion in cases[] — the harness exists to prove
primitives are wired, not just that fixtures parse.
Explicitly omits an `on_complete` fixture; that primitive is a
runtime no-op as of v1.0.3 and ships with beads-i02's resolution,
not this epic.
Item 3 of GH#3621.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(formula): satisfy CI gosec G306 + regen CLI doc for new help text
Two CI fixes for the formula primitives PR:
- internal/formula/cmd/schemagen/main.go:26 — drop WriteFile perms
from 0644 to 0600 (gosec G306).
- website/docs/cli-reference/formula.md and the v1.0.0 mirror —
regenerated from the updated `bd formula --help` Long text via
scripts/generate-cli-docs.sh, using a CGO_ENABLED=0 bd build to
match CI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(formula): distinguish schema from wired primitives
* fix(formula): regen schema_gen.go for rebase onto current main
Upstream main's Formula struct gained an Intent field after PR #3781 was
opened; regenerate schema_gen.go via go generate so
TestSchemaGenIsCurrent passes after rebasing the PR's commits onto
current main.
Maintainer fix-merge for gastownhall/beads#3781.
Agent-Signature: claude-fable-5-medium on behalf of matt wilkie
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
* fix(init): make JSONL auto-export opt-in
Default export.auto and export.git-add to false for new repos, make the init prompt opt-in, and update docs/tests to describe JSONL as an optional viewer/interchange/backup export rather than core sync behavior.
Fixes GH#4062
* refactor(auto-export): check commit before throttle
Move cheap Dolt commit change detection ahead of the auto-export throttle and extract the throttle decision into a tested helper. This keeps the default-off design while carrying the compatible part of Jeremy Longshore's GH#4061 refactor.
Based-on: 313e1f8258
Co-authored-by: jeremylongshore <jeremylongshore@users.noreply.github.com>
* docs: regenerate versioned CLI references
* docs: call out JSONL export opt-in change
---------
_codex-gpt-5.5-medium on behalf of CI Bot_
_codex-gpt-5.5-high on behalf of matt wilkie_
Co-authored-by: CI Bot <ci@beads.test>
* fix: enable auto-export by default with canonical issues.jsonl name (GH#2973)
Users expected JSONL export to refresh automatically but export.auto
defaulted to false, requiring explicit opt-in. Also the default filename
(export.jsonl) didn't match the canonical issues.jsonl used in docs and
git hooks. Change defaults: export.auto=true, export.path=issues.jsonl,
export.git-add=true so viewers (bv) and git workflows see fresh data
without extra configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(init): add auto-export prompt and document export.* config (GH#2973)
Interactive bd init now asks whether to enable auto-export (default: yes).
Users can opt out during setup instead of discovering the setting later.
Also documents the export.* config namespace in bd config --help with
all four keys (export.auto, export.path, export.interval, export.git-add)
and adds export examples.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: document export.* auto-export config keys (GH#2973)
Document the export.auto/path/interval/git-add keys in docs/CONFIG.md
and note the default-on switch in CHANGELOG.md [Unreleased].
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(export): don't prime throttle on empty init and skip git-add without git (GH#2973)
Review feedback on #3204 surfaced two regressions in the default-on
auto-export path:
1. bd init's PersistentPostRun fired maybeAutoExport with zero issues,
writing an empty .beads/issues.jsonl and saving export-state.json with
the current dolt commit + timestamp. The next `bd create` was then
throttled for up to export.interval (default 60s) because the
timestamp check in maybeAutoExport returned before considering the new
commit, leaving issues.jsonl stale on fresh repos.
Skip saving state and remove the empty file when the export produced
no issues and no memories. The next write runs a real export
immediately.
2. export.git-add defaulting to true emitted
`Warning: auto-export: git add failed: exit status 128` on every
write in the supported standalone BEADS_DIR flow where init
intentionally skips `git init`. Gate the git add call on isGitRepo()
so standalone users get silent, working auto-export.
Adds a scripttest regression guard for the init -> immediate create
path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test(memory): disable auto-export in concurrent test (GH#2973)
TestEmbeddedMemoryConcurrent started failing on this branch after
auto-export became the default: every concurrent 'bd remember'/'bd
forget' call now fires maybeAutoExport, which reads store state after
the write. Under 8-worker contention this intermittently leaves a
forgotten key visible to 'bd memories'.
The test exercises memory concurrency, not export behavior; opt it
out of auto-export so the signal stays focused. Followup: investigate
the race between write commit and post-write auto-export read in
embedded Dolt concurrent paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The bd import command takes a positional file argument, not a -i flag.
Three files referenced the nonexistent flag:
- cmd/bd/testdata/import.txt (testscript fixture)
- cmd/bd/testdata/export.txt (testscript fixture)
- CLAUDE.md (documentation)
Also updated CLAUDE.md comment from 'SQLite cache' to 'Dolt database'
to reflect the current storage backend.
Fixes bd-6nr, related to bd-7ds.
Amp-Thread-ID: https://ampcode.com/threads/T-019d7da6-5933-71c3-87bf-45fb4594ef25
Co-authored-by: Amp <amp@ampcode.com>
Surfaces existing but undiscoverable commands in bd prime output (CLI mode)
and beads-section.md template. Adds doctor --check=conventions as a composite
of lint, stale, and orphan checks (advisory only).
Fix-merge changes:
- Remove Close Reason Format section (not an established convention yet)
- Fix --by to --with for bd supersede (matches actual flag name)
Co-Authored-By: seanmartinsmith <114885497+seanmartinsmith@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Standardize start-work semantics to `bd update <id> --claim` across docs,
examples, templates, and website static LLM artifacts. Replaces
`--status in_progress` with `--claim` where the meaning is start-work.
Also fixes stale comment in llms.txt ("Update status" → "Start work").
Co-Authored-By: Valeriy Pavlovich <iqdoctor@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Jira CLIs use --resolution flag (go-jira, jira-cli). Adding this as a
hidden alias improves agent ergonomics - LLMs have a prior for this flag.
Follows same pattern as --body alias for --description (GitHub CLI).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This change improves information density by using Base36 (0-9, a-z) instead
of hex (0-9, a-f) for hash-based issue IDs. Key benefits:
- Shorter IDs: Can now use 3-char IDs (was 4-char minimum)
- Better scaling: 3 chars good for ~160 issues, 4 chars for ~980 issues
- Case-insensitive: Maintains excellent CLI usability
- Backward compatible: Old hex IDs continue to work
Changes:
- Implemented Base36 encoding with proper truncation (keep LSB)
- Updated adaptive length thresholds (3-8 chars instead of 4-8)
- Fixed collision probability math to match encoding (was calculating
for base36 but encoding in hex - now both use base36)
- Fixed ID parser bug (use prefixWithHyphen for substring matching)
- Updated all tests and test data patterns
Fixes#213🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Renamed config.json to metadata.json to clarify purpose (database metadata)
- Fixed config.yaml/config.json conflict by making Viper explicitly load only config.yaml
- Added automatic migration from config.json to metadata.json on first read
- Fixed jsonOutput variable shadowing across 22 command files
- Updated bd init to create both metadata.json and config.yaml template
- Fixed 5 failing JSON output tests
- All tests passing
Resolves config file confusion and makes config.yaml work correctly.
Closes#178 (global flags), addresses config issues from #193
Amp-Thread-ID: https://ampcode.com/threads/T-e6ac8192-e18f-4ed7-83bc-4a5986718bb7
Co-authored-by: Amp <amp@ampcode.com>
- Create internal/configfile package for config.json handling
- bd init now creates .beads/config.json with database, version, and jsonl_export fields
- Database discovery checks config.json first, falls back to beads.db
- Update .gitignore to not ignore config.json (part of repo state)
- Update test to expect beads.db and config.json
- Backward compatible with existing beads.db-only setups
- Create .gitignore file in .beads/ when running bd init
- Ignores *.db and *.db-* patterns to prevent database commits
- Add test coverage to verify .gitignore creation
- Add .claude/settings.local.json to project .gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Ben Madore <madorb@users.noreply.github.com>
- Complete test coverage for all major bd commands:
blocked, close, create, dep (add/remove/tree), export, help,
import, init, list, quickstart, ready, show, stats, update, version
- Test data files validate command behavior and output
- Enables automated testing of full CLI workflows