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(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>
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(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>
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.
* 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.
* security: pin build toolchain to go1.26.7
go1.26.5 carries 8 stdlib advisories, 7 of them reachable from the shipped
bd binary. Verified with govulncheck in call-graph mode against ./cmd/bd,
toolchain pinned so the analysis cannot drift:
GO-2026-6218 net/url quadratic resolvePath
GO-2026-6091 html/template JS-regexp context tracking
GO-2026-6090 crypto/tls post-handshake message flood
GO-2026-6089 net/http ReadHeaderTimeout on the h2c check
GO-2026-6088 encoding/xml recursion depth
GO-2026-5972 encoding/asn1 recursion depth
GO-2026-5026 net/http vendored x/net/idna punycode
GO-2026-5942 net dnsmessage SVCB/HTTPS RR (linked, uncalled)
`bd serve` is a real HTTP server and bd makes TLS client connections, so
these are live paths rather than dead weight: httpapi.Serve reaches four of
them directly. go1.26.6 fixes all eight; 1.26.7 adds one more net/http fix.
After the bump the same scan reports zero.
The `go` directive stays at 1.26.5 so importers of the module keep their
current floor; `toolchain` is what we actually build with. release.yml
builds the shipped binaries with a bare `go build` under the default
GOTOOLCHAIN=auto, which honors the toolchain line.
The Makefile needed the second half of this. It pinned GOTOOLCHAIN from the
`go` directive, which is the importer floor, not the build version - left
alone it would have held every make target (the test suite, the npm and MCP
package gates, local `make build`) at 1.26.5 while the release binaries
moved to 1.26.7, which is both a silent downgrade and a split between what
CI tests and what we ship. It now reads `toolchain` first and falls back to
`go` when there is no toolchain directive, preserving the original reason
for pinning: one exact version so the compile tools and coverage
instrumentation cannot disagree.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* security: bump x/crypto, x/mod, klauspost/compress, moby/go-archive
Four advisories, none reachable from the shipped bd binary; these are
hygiene bumps that also clear the Dependabot board.
golang.org/x/crypto v0.54.0 -> v0.55.0 GO-2026-6303
golang.org/x/mod v0.37.0 -> v0.40.0 GO-2026-6179/6180
github.com/klauspost/compress v1.18.5 -> v1.18.7 GO-2026-5841
github.com/moby/go-archive v0.2.0 -> v0.3.3 CVE-2026-17106 (#140)
Reachability, from `go list -deps ./cmd/bd` plus govulncheck call-graph mode:
x/crypto/ssh proper enters only through testcontainers (test-only); the
compress advisory is in the s2 codec, which is not linked into bd at all
(bd links zstd/gzip/flate/huff0 via dolt); the x/mod sumdb/tlog code is
required but never called; go-archive is testcontainers-only and absent
from the binary's package graph entirely.
go-archive goes to v0.3.3, not the advisory's minimum v0.3.0: v0.3.0's
hardened extraction rejected absolute symlinks and hardlinks and broke
device nodes and implied directories, all fixed across v0.3.1-v0.3.3.
MVS carries x/net, x/text, x/tools and x/telemetry along. No replace
directives, and the dolt pin is untouched - dolt requires older versions of
all three x/ modules, so beads' go.mod already wins the version selection.
The examples/ modules reach the parent through a `replace` directive, so
their recorded graph goes stale on any root go.mod change and both failed
scripts/build-examples.sh with the documented "updates to go.mod needed".
Re-tidied here rather than left for the advisory job to warn about; the
diff is purely the mirror of the bumps above.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* security: bump oapi-codegen to v2.7.1 and kin-openapi to v0.144.0
Clears the board's one critical (#133, GHSA-r277-6w6q-xmqw, CVSS 9.1) plus
#142, #141, #134 and the low #132. All five are codegen-tool-only:
kin-openapi reaches the module graph solely through the go.mod `tool`
directive for oapi-codegen, no beads source file imports kin-openapi,
oapi-codegen or openapi3filter, and `go list -deps ./cmd/bd` contains none
of them. The critical is a fail-open bug in openapi3filter's
ValidationHandler.Load(), middleware this repo never runs - request
validation in internal/httpapi is hand-rolled. Dependabot scopes the alert
"runtime" because it cannot model Go tool-directive semantics.
Both must move together: oapi-codegen v2.6.0 does not compile against
kin-openapi v0.144.0 (pkg/codegen/schema.go:909, openapi3.MappingRef vs
string). v2.7.1 is the minimum-fix pair, chosen over the latest 2.8.0/0.149.0
to keep codegen churn off a release branch.
The `make api-gen` regen diff is two lines of real change: the generated
BearerTokenScopes constant picks up a generated named context-key type
instead of being an untyped string. The identifier has no references outside
types.gen.go. `make api-check` is green - regeneration is idempotent,
pinning.go's compile-time welds hold, and TestWireTagBijection passes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* security: refresh beads-mcp uv.lock (clears all 19 pip alerts)
`uv lock --upgrade` with fastmcp still pinned ==3.4.5. Every one of the 19
Dependabot alerts on integrations/beads-mcp/uv.lock is a fastmcp transitive,
and each lands at or above its first-patched version:
mcp 1.25.0 -> 1.29.1 #129#128#127 (high)
cryptography 48.0.0 -> 50.0.1 #137#138#82#139
pyjwt 2.12.1 -> 2.13.0 #79#136#81#78#135
joserfc 1.6.5 -> 1.7.4 #113#109
python-multipart 0.0.27 -> 0.0.32 #88#87#86#85
idna 3.11 -> 3.19 #68
Real exposure was already low: beads-mcp runs stdio transport only
(server.py's mcp.run_async(transport="stdio")), so the three high mcp-SDK
alerts - WebSocket Host/Origin validation, HTTP session principal handling,
task-handler cross-access - are all HTTP/WS-transport bugs this server never
reaches, and the auth libraries ride along with fastmcp's extras rather than
being used by beads-mcp's own code. The lock governs dev and CI installs;
PyPI users resolve fresh and already get patched versions.
mcp 1.25 -> 1.29 is the only behaviorally interesting jump. The full package
gate is green: uv sync --locked, ruff, mypy, 228 passed / 5 skipped, uv build.
The resolved lock is byte-identical under uv 0.9.5 and CI's uv 0.11.16.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore(nix): update vendorHash for go.sum changes
The go.mod/go.sum bumps in this branch invalidate the proxyVendor
fixed-output hash in default.nix, which fails the nix-build gate. The
workflow that repairs this automatically only fires for dependabot PRs
targeting main, so it does not cover this branch.
Recomputed with scripts/update-nix-vendorhash.sh's flow and verified:
`nix build .#default` completes green, which also confirms the new
`toolchain go1.26.7` directive is compatible with default.nix's
GOTOOLCHAIN = "local".
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(upgrade-guard): parse the version witness as semver, and stop reading "unreadable" as "legacy"
The cross-era upgrade guard (#4907) refused five production workspaces
outright:
legacy Dolt server workspace detected; explicit migration is required
before this bd version can open or modify the workspace.
Every one was current-era. The witness was a Go pseudo-version,
`v1.1.1-0.20260805093327-bf97b73749ac`, and `currentVersionWitness` split
it on "." expecting exactly three fields. It got four. Measured blast
radius before the operator hand-rewrote nine `.local_version` files to
`1.1.0`: every `bd` invocation against five cities failed, taking every
order that shells out to bd with it — one gate sweep alone logged 644
failures in 6 hours, which froze PR review gates entirely (no bead ever
left `needs-review`), stalled triage, and left demand-driven pools at
zero (one city ran 1 session against 8 declared agents). Rewriting the
witness files took the sweep to 0 failures/6h immediately.
Two defects, one in the parse and one in the policy.
## The parse
`.local_version` holds `main.Version` verbatim, and release tooling
injects that by ldflags: goreleaser passes `{{.Version}}`, the release
workflow passes `steps.version.outputs.version`, and other build paths
pass whatever they resolved. So the writer can emit a plain release, a
release candidate, a build carrying metadata, or a Go pseudo-version —
all valid semantic versions, none of them three bare numeric fields. bd
could not read what bd wrote. The writer is right; recording anything
but the true version would destroy the ordering `CompareVersions` needs.
The reader was counting dots.
`classifyVersionWitness` now parses with `golang.org/x/mod/semver`
(already an indirect dependency) and reports an era. `legacyVersionMinor`
shares the parse, so a pre-1.0 pseudo-version or release candidate is now
*correctly* classified as legacy where it used to fall through
unrecognized. Shapes strict semver rejects but a distributor could still
stamp on a legacy build — zero-padded or four-component versions — are
still read as legacy from their major component alone, so the pre-1.0
guard only tightens.
## The policy
Before this change an unparseable witness meant "legacy workspace, refuse
every command". That is the part that turned a trivial parse bug into a
fleet outage, and it is wrong on its own terms: every pre-1.0 bd wrote a
plain X.Y.Z through this same writer, so a string that fails a real semver
parse is affirmative evidence *against* a legacy workspace. The guard was
inferring "legacy" from data that positively excludes it, using a file the
codebase treats as advisory everywhere else — `.local_version` is
gitignored, clone-local, written best-effort, and `bd doctor` downgrades a
bad value to a warning whose suggested fix is "run any bd command", which
the guard made impossible.
So a witness that is *present but unreadable* is now its own era,
unknown: bd warns and opens the workspace. A *missing* witness is
unchanged and still refused — a workspace that never announced itself is
genuinely ambiguous — as is any witness that reads as pre-1.0.
The warning is self-healing rather than permanent noise: the guard runs
in PersistentPreRunE immediately before `trackBdVersion`, which rewrites
the witness whenever it differs from `Version`, so the admitted command
leaves a readable witness behind and the next command is silent.
## Coverage
`TestClassifyVersionWitness` pins the production string, plain and
v-prefixed releases, release candidates, build metadata, the pre-1.0 side
of each, empty, and garbage. `TestVersionWitnessRoundTrip` pins the
contract the guard depends on — everything bd can write, including
`Version` itself, bd reads back and recognizes as current, which also
holds the writer inside the witness reader's bounded size.
`TestLegacyUpgradeGuardStillRefusesPreOneWorkspaces` and the missing-
witness test prove the cross-era guard did not relax. Red before the
parse fix on 15 cases across 5 tests.
Refs GH#5603. That report reaches the same conclusion from a different
writer — Homebrew stamps `HEAD-<shortsha>` into `main.Version` for
`--HEAD` installs — and the unknown era admits those workspaces too
(`TestLegacyUpgradeGuardAdmitsBrewHeadStamp`). It does not silence their
warning: a HEAD stamp is rewritten identically every run, so it never
heals. Silencing it wants the shape recognizer in GH#5625 (anisoptera),
which this deliberately does not duplicate; the two changes compose.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(upgrade-guard): warn+open on a present-but-blank version witness
The legacy-upgrade guard's witness reader collapsed a present-but-blank
`.local_version` (0-byte or whitespace-only, e.g. from an interrupted or
disk-full best-effort write) into the same ("", false) result as a
genuinely missing witness. In server mode with a local Dolt root the
`if ok` reader-gate then routed present-blank onto the missing->refuse
path, hard-refusing a possibly-current workspace as "legacy Dolt server
workspace" with no self-heal -- the exact false-refusal class this PR
removes, left open for the blank-witness shape.
Make legacyUpgradeVersionWitness report presence independently of blank
contents: a present, bounded, regular witness returns ("", true) so the
guard classifies it witnessEraUnknown and warns-and-opens (matching the
present-but-unparseable case and the documented upgrading.md contract),
while a missing, non-regular, or oversized witness stays ("", false) and
still refuses, preserving the pre-1.0 guard safety invariant.
Adds guard-level tests for present-blank (0-byte / newline-only /
spaces+tabs) -> warn+open and missing -> refuse, plus a reader-contract
test pinning present-blank->present and missing/oversized->absent.
Addresses the maintainer review's one major finding (Codex).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <ci@beads.test>
Co-authored-by: Claude <noreply@anthropic.com>
* Add sealed-copy SQLite migration bridge (bd-mvh)
Create a fresh current workspace from a fingerprinted copy of an authenticated historical SQLite workspace. Keep every historical executable inside an isolated destination and reject malformed or semantically lossy cutovers without touching the source.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Test User <test@test.com>
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* Refuse implicit historical workspace upgrades (bd-mvh)
Detect historical SQLite and legacy Dolt layouts before config migration, version tracking, init, bootstrap, doctor, or store construction. Require the sealed-copy bridge while preserving current shared-server admission against the explicitly selected workspace.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Test User <test@test.com>
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* Qualify authenticated historical upgrades (bd-mvh)
Replace generic recipe discovery with a fixed, checksum-pinned corpus spanning the reviewed SQLite, server-Dolt, and embedded-Dolt eras. Assert source isolation, representative data fidelity, schema idempotence, and rollback retention while keeping historical executables inside bounded temporary environments.
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Test User <test@test.com>
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* Add authenticated legacy SQLite reader (bd-tku)
Let the current binary read the exact v0.49.6/v0.50.3 SQLite contract from a sealed private DB/WAL copy and emit canonical JSONL for the normal fresh-Dolt import path. Reject schema drift and values that current import would lose, default, truncate, or deduplicate.
Qualify both authentic releases end to end, including current DATETIME(0) canonicalization and reader-to-fresh-import timestamp equality.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* Fix empty embedded-root upgrade bypass (bd-e6m)
Require an actual embedded Dolt repository marker before current layout precedence can suppress historical SQLite or legacy Dolt refusal.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* fix(migrate): maintainer review fixups for legacy SQLite upgrade PR
- decompose the legacy-workspace guard and extract the dependency-row loader
(behavior-preserving), and align the legacy SQLite reader projection with
issueops.ScanIssueFrom arity after the 0060/0061 rebase, guarded by a
projection arity test.
- assert the historical-upgrade harness schema no-op by shape
("Schema already at v<N>") instead of a hardcoded v59, so the migration-test
matrix stops reddening on every schema bump (candidate now prints v61).
* Fix historical upgrade review blockers (bd-mvh)
Route direct SQLite lanes through the current authenticated reader, guard no-store commands before legacy workspace mutation, and move coarse embedded repository detection behind the storage adapter. Restore the legacy reader projection contract and verify source-preserving behavior across the repaired paths.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* Fix historical upgrade edge cases (bd-mvh)
Refuse ambiguous local server-Dolt roots before storage opens and normalize nullable legacy SQLite sentinel fields during authenticated export.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
* Fix final historical upgrade review blockers (bd-mvh)
Make explicit server selection outrank stale embedded repository markers, so ambiguous local server roots still fail closed.
Permit zero-record cutovers only through the authenticated direct SQLite reader, verify the empty round trip against a fresh current export, and align the upgrade guidance with the enforced admission matrix.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot
---------
Co-authored-by: CI Bot <ci@beads.test>
Co-authored-by: Test User <test@test.com>
Adds issueops.Lifecycle — Create, Update, Close, Reopen — reached from the storage handle via
store.IssueLifecycle(), implemented once and shared by the CLI and linked library consumers. Three backends
implement it and a shared conformance suite asserts them against one spec. The bd CLI's create, update,
close and reopen now route through it.
Fixes several defects that predate this change and became visible once the write paths were forced to
agree: swallowed metadata-edit failures, a claim applied before field validation, missing value validation
on title/priority/estimate, silently dropped create edges to missing targets, infra-typed creates landing in
the wrong table, a dropped SourceRepo, closed_by_session written but never read, and a compound update
writing twice.
Behavior changes needing release notes: create with an occupied explicit id now fails instead of silently
overwriting; a compound update is one atomic operation with one hook and one version commit; reparenting
replaces all parent edges; reopening something not closed reports nothing to do.
The first slice that runs a server. Proxied-server workspaces go live; the
read and claim operations are registered as transitional 501 stubs so route
and spec parity can be proved all at once instead of growing a hole per slice.
`bd serve --addr 127.0.0.1:0 [--allow-non-loopback]`, and no other flags in
v0. The bound address is stdout's first line, because under the ephemeral
default it is the only way to find the port. Shutdown rides the signal context
the root command already installs. No lock file, pid file or discovery file:
serve is operator-invoked and the TCP bind IS the mutual exclusion — dbproxy
needs that machinery only because clients race to auto-spawn it.
The mode gate says two different things, deliberately. Embedded is a PERMANENT
typed storage.ErrUnsupported: there is no unit-of-work provider for that
backend. Dolt server mode is STAGED — the provider construction exists and is
tested, it just is not wired in yet — so the text names what works today and
says this does not, rather than reading as an architectural limit that would
send an operator off to change their topology for nothing.
One unit of work per request, closed through a DETACHED context. The
transaction layer poisons the pinned connection when a ROLLBACK send fails
(doltserver_tx.go), so closing with the request's own canceled context would
burn a session on every client disconnect.
Front-tier hardening lands here, not later, because without it a hung Dolt
becomes a silently growing black hole: slots fill with immortal queries,
/healthz stays green because it never touches the database, and recovery
produces a thundering herd. So: a Host-header allowlist (DNS-rebinding defense
for an unauthenticated, browser-reachable loopback service), a
netutil.LimitListener connection cap (Go spawns a goroutine per connection, so
the database semaphore alone does not bound what is accepted), a database
semaphore with a BOUNDED 10s wait mapping to the already-documented 503 busy,
a 60s per-request deadline, and explicit pool limits on the provider's *sql.DB
via a new uow.PoolTuner knob — openDB set none, and database/sql's default is
unlimited.
/v0/beads/context serializes an explicit ten-field allowlist and nothing else.
SyncRemote is hard-excluded in this and every future version: it is populated
unconditionally from config sync.remote, and remote URLs routinely embed
credentials. The database bind endpoint and the remaining absolute host paths
are excluded too. `capabilities` is derived from IMPLEMENTED handlers only, so
a release cut between this slice and the endpoint slices advertises only what
actually works.
The observability floor is an acceptance criterion, not a convention: one
structured stderr line per request (method, path, status, problem code,
duration, semaphore wait, unit-of-work acquire), startup and shutdown lines, a
semaphore-saturation event, and a request_id on every problem response. That
last one required documenting request_id on the spec's Problem schema — the
only spec edit here, additive, with types regenerated.
Decisions implemented as given: hooks do not fire (a user-controlled
subprocess per mutation is an unbounded latency multiplier and an orphaned
child at shutdown); the per-command auto-commit globals are never touched
(nothing to exclude — proxied PersistentPostRunE only closes the provider);
and actor on an HTTP request stays caller-asserted provenance, which the
context and capabilities wording does not contradict.
Tests: TestSpecRouteParity asserts set equality between the route table and
the document's paths, and builds the real mux so a pattern ServeMux would
refuse fails here rather than on the first request.
TestSpecStatusCodesMatchHandlerTable carries a commented, enumerated 501
exemption that is self-deleting — it fails if the route table and the list
disagree, and fails again if the list outlives the last stub. The context
allowlist is enforced from the handler out, over a body built from a snapshot
with every field populated and a credential-bearing sync remote.
TestWithUOWClosesWithADetachedContext records the close context's state AT
close time, which is the only moment it says anything.
Verified: build, vet and golangci-lint clean (the two gosec findings in
cmd/bd/main.go pre-date this change); internal/httpapi green under -race;
protocol corpus byte-identical with BEADS_PROTOCOL_REQUIRE_DOLT=1; and a real
server started against a proxied workspace, answered both endpoints, refused
a foreign Host, an unknown query key and a second bind, and drained to exit 0
on SIGTERM.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Lands the bd serve wire contract and the machinery that keeps it honest. No
runtime behavior: nothing routes, nothing serves, and no CLI surface changes.
internal/httpapi/spec/openapi.v0.yaml is hand-written and is the source of
truth; internal/httpapi/apigen is generated from it with oapi-codegen
types-only (no server stubs, no router), via a go.mod tool directive so
contributors need no extra install.
The decisions this slice fixes, because they are one-way doors:
- No second wire struct. Issue, IssueWithCounts, IssueDetails and
IssueWithDependencyMetadata are pinned to the canonical Go types with
x-go-type, so the generator emits type aliases and the CLI's --json, the
JSONL interchange and the HTTP bodies all marshal one struct. A hand-written
Go-to-Go mapping layer would recreate the drift disease this epic exists to
cure. Guarded by a two-way JSON-tag bijection test, not a round-trip fixture:
a new omitempty field absent from a fixture round-trips cleanly in both
directions and proves nothing.
- limit=0 means unlimited, matching the CLI exactly, with defaults 50 (list)
and 100 (ready) documented as the shared constants. The only exception --
refusal under --allow-non-loopback -- is in the limit description.
- ready returns IssueWithCounts, not bare Issue.
- Unknown query parameters are rejected with 400 invalid_argument naming the
parameter in a machine-readable extension member: with types-only codegen the
decoders are hand-written, and Go's silent-ignore default would WIDEN a
filtered result set under version skew.
- /v0/beads/issues forces (created_at DESC, id ASC) on every request, and the
spec documents the deliberate divergence from bd list's priority ordering.
- One RFC 9457 problem+json envelope everywhere, with a frozen code vocabulary
mapped from the sentinels via errors.Is. 5xx bodies carry a static per-code
detail; the real error goes only to the log, because driver and dial errors
routinely embed the DSN.
- Only the status codes the six operations need are documented. Every
documented status+code pair is permanent wire surface.
Two traps found while building this, both now guarded:
- oapi-codegen v2.6.0 silently drops x-go-type from a component that also
carries allOf. An allOf-composed IssueWithCounts generated
"type IssueWithCounts = types.Issue" -- the ready endpoint would have shipped
with the count fields gone. The pinned schemas therefore repeat their
property lists, and internal/httpapi/pinning.go turns a regression into a
build failure.
- context.DeadlineExceeded satisfies net.Error, so a tripped request deadline
would have mapped to 503 db_unavailable instead of a generic 500.
make api-check is the three-part gate (regenerate, diff-or-fail, spec tests)
and runs from scripts/ci/pr-policy.sh, i.e. in a required PR job -- the Main
workflow is perpetually concurrency-cancelled, so a gate living only there
would be unenforced.
The go.mod diff is the tool directive and its closure. The protocol corpus is
untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Add `bd schema` command emitting JSON Schema for output records
`bd schema` reflects the canonical issue/dependency output structs
(internal/types) into a JSON Schema via invopop/jsonschema, so consumers can
codegen typed models (datamodel-code-generator, quicktype, ...) instead of
hand-mirroring the --json / export format. Because the schema is generated from
the same structs bd serializes, it cannot drift from the actual output the way
docs/JSON_SCHEMA.md or a downstream consumer model (e.g. beads-mcp's Pydantic
models) can. Output carries schema_version (== JSONSchemaVersion).
Promotes invopop/jsonschema from an indirect to a direct dependency.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 2bb8d2c305)
* Enumerate status/type/dependency values in `bd schema` + add tests
- Add canonical AllStatuses / AllIssueTypes / AllDependencyTypes lists to
internal/types and derive Status.IsValid / IssueType.IsValid from them, so
validation and the schema enums share one source (behaviour-preserving;
internal/types tests pass).
- `bd schema` now enriches the status, issue_type, and dependency `type`
fields with their allowed values via a jsonschema Mapper sourced from those
lists, so the published schema constrains them instead of emitting a bare
"string" — exactly the constraint hand-mirrored consumers can't track.
- Extract schemaDocument() so the command is unit-testable without a workspace
or DB; add cmd/bd/schema_test.go asserting valid JSON, schema_version, the
issue/dependency records, required fields, and the populated enums.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 9beb73d023)
* Fix misspell + regenerate CLI docs for `bd schema`
- internal/types: "recognises" -> "recognizes" (misspell lint).
- Regenerate docs/CLI_REFERENCE.md, the website CLI reference pages, and
llms-full.txt to cover the new `bd schema` command (via
scripts/generate-cli-docs.sh + generate-llms-full.sh from a canonical
pure-go build). The CLI-docs freshness gate now passes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 1cd9be76c6)
* fixup: errcheck on outputJSONRaw, godoc placement, go.mod tidy for bd schema
- cmd/bd/schema.go: switch schemaCmd.Run to RunE and return the
outputJSONRaw error instead of discarding it, matching the
return-outputJSON(...) pattern used elsewhere in cmd/bd (e.g.
branch.go, audit.go, comment.go).
- internal/types/types.go: reorder the AllIssueTypes var and its
godoc so each comment sits directly above its own declaration; the
cherry-picked var block had split IsValid's godoc comment across
the inserted var.
- go.mod: go mod tidy after the cherry-picked invopop/jsonschema
v0.14.0 direct-require resolution; drops the now-unneeded
mailru/easyjson indirect entry.
Agent-Signature: claude-code-sonnet-medium on behalf of matt wilkie
* fix(schema): skip store init — the command reflects static types only
Without skipStoreAnnotation, bd schema ran the PersistentPreRunE store open
and failed outside a workspace or on a CGO-less build, defeating the
command's storage-free design.
Agent-Signature: claude-fable-5-medium on behalf of matt wilkie
---------
Co-authored-by: Ellis Breen <1263585+griels@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* /{engdocs,examples,go.mod}: bump go version
* deps: bump golang.org/x/text to v0.39.0 (GO-2026-5970)
govulncheck against today's vuln DB flags GO-2026-5970 (infinite loop on
invalid input in x/text, reachable via internal/routing), published after
this PR's original clean scan. Bump x/text to the fixed v0.39.0 (with its
MVS sibling x/* minimums) and re-tidy examples/library-usage, which
builds against the parent via a replace directive and would otherwise
fail with missing go.sum entries.
examples/bd-example-extension-go is left untouched: it already fails
'go build' (needs go mod tidy) at the PR's base state, so its tidy is
pre-existing follow-up work, not fallout from this bump.
Verified: CGO_ENABLED=0 go build -tags gms_pure_go ./cmd/bd; both
example modules build; go test ./internal/routing; govulncheck now
reports 0 affecting vulnerabilities.
Agent-Signature: claude-fable-5-high on behalf of maphew
---------
Co-authored-by: matt wilkie <maphew@gmail.com>
Extend #4847's rollback to the last alternative backend: bd now ships a
single storage engine (Dolt, embedded and server mode).
- Delete internal/storage/{sqlite,sqlitedialect} and the packages the
removal orphans: sqlkit (sole importer was the sqlite store),
unsupportedgen (sole go:generate consumer), the NonCommitGraphBackend
marker and its two dead consumer checks, and the domain-db parity test
that used sqlite as its harness. Drop modernc.org/sqlite from go.mod
and regenerate the nix vendorHash.
- Tombstone backend="sqlite" exactly like postgres/mysql: recognized in
metadata (never silently aliased to a fresh Dolt DB), rejected before
any open with its own rationale and the export -> re-init -> import
guidance. The fail-closed guarantee now also covers never creating the
beads.db file the removed backend would have provisioned.
- bd init: --backend=sqlite reaches removed-backend guidance;
--sqlite-path becomes a hidden parser tombstone like the pg/mysql
flags; help text and supported-backend enumerations say Dolt only.
- Doctor: sqlite workspaces fail closed like the other tombstones; the
modern sqlite stub payloads are gone. The legacy pre-Dolt surface
(artifact scans, migration validation, migrate-sqlite-to-current.sh,
the migration-test harness) is untouched; genuine pre-Dolt workspaces
carry no backend field and never hit the tombstone.
- Conformance: drop the sqlite profile; the CLI differential runner
idles (skip, not fail) until another backend profile is registered,
and the export/import round-trip keeps running against the embedded
Dolt reference. Tier-1 oracle legs are unchanged.
Backend selection has never shipped in a release (v1.1.0 predates it),
so released workflows are unaffected and the pinned CLI docs already
describe the resulting behavior.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Roll back the direct adapters, dialect layers, credential handling, dependencies, CI services, and conformance profiles for general-purpose server databases. That support adds operational and testing complexity at odds with our goal of keeping Beads as simple as possible and consuming as few resources as possible.
Keep the Storage and DoltStorage interfaces unchanged. Embedded Dolt, Dolt server, and SQLite remain supported; the MySQL wire driver remains because Dolt server uses it.
Retain legacy metadata identifiers and hidden init flags only as compatibility tombstones. Removed, unknown, or corrupt backend metadata now fails safely across CLI, SDK, bootstrap, doctor, factories, and Dolt administration before storage is opened or modified, with guidance to export using a supporting build and reinitialize via bd help init-safety.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Test User
Rebase of PR #4601 (feat/choose-your-own-backend) onto current origin/main,
squashed to a single commit because the original 73-commit history built and then
removed the uowStore derisk spike incrementally, which does not replay cleanly
over the 125 commits main has since advanced (notably #4679, the ready-work
counts fix, which merged to main and is now inherited rather than re-applied).
The full pre-rebase history remains on the original branch tip for reference.
Contents (multi-backend feature + the six review follow-ups):
- bd init --backend=postgres|mysql|sqlite provisioning behind the Dolt-parity
seam; the three SQL backends share *sqlkit.Store over pluggable dialects and
carry a generated typed-unsupported shell for the non-core surface.
- Passwords in init DSNs are redacted before persisting to metadata.json (driver
parser + re-parse verification), with a negative-test matrix proving no secret
survives (pgdialect + mysql).
- The uowStore derisk spike and its report artifacts are removed; the shell
generator now lives in internal/storage/unsupportedgen (neutral name).
- Compile-time guard `var _ storage.DoltStorage = (*Store)(nil)` on each backend
plus a regen-idempotence test keep the generated skip lists honest.
- sqlkit exposes CountReadyWork so every SQL backend satisfies
storage.ReadyWorkCounter and inherits the shared page-pushed ready-counts path.
- Commercial/product names scrubbed from the feature's own code for vendor
neutrality.
Rebase reconciliations: adopted main's metadata-load hardening in the store
factories alongside the backend dispatch; combined the config interface
(GetMetadata + ReconcileVersion) and the conformance registrations (ReadyCounts +
Claim/lease); took main's versions of the shared-infra concurrency (uow
doltserver_tx) and delete-cascade (domain/issue_delete) evolutions; implemented
the interface's new UnclaimIssue on sqlkit (delegating to issueops) and added it
to the skip lists.
Verified: go build (cgo + CGO_ENABLED=0) and go vet clean; unit tests
(sqlbuild/issueops/pgdialect/mysql/unsupportedgen) and the SQLite conformance
suite green (RunAll, incl. ReadyCounts equivalence and Claim/lease on the real
sqlkit backend).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* build(deps): bump otel to 1.44.0 and go-sql-driver/mysql to 1.10.0
Absorbs dependabot PRs #4265 (otel/metric), #4264 (otlpmetrichttp) and
#3638 (go-sql-driver/mysql) into one change. The three go.mod bumps
conflict with each other on every merge - each landing invalidates the
others' branches, which is how they sat CONFLICTING since May. Landing
them together takes one CI cycle instead of three serial
rebase-and-wait rounds.
Unlike the per-package dependabot bumps, this moves the whole
go.opentelemetry.io/otel family (otel, sdk, sdk/metric, trace, metric,
otlpmetrichttp) to 1.44.0 in lockstep, with the transitive updates
go mod tidy requires (grpc 1.81.1, oauth2 0.36.0, genproto 2026-05-26).
Preflight: CGO_ENABLED=0 -tags gms_pure_go build of ./... passes;
internal/observability tests pass. Embedded-Dolt suites left to CI
(require CGO).
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Agent-Signature: claude-fable-5-high on behalf of matt wilkie
* build(nix): update Go vendorHash for the dependency bumps
nix build's fixed-output derivation pins the Go module vendor hash;
the go.sum changes invalidate it. New hash taken from the CI failure
output. This is also why dependabot's own go.mod PRs can't pass the
Nix flake checks unaided.
Agent-Signature: claude-fable-5-high on behalf of matt wilkie
---------
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps github.com/dolthub/driver from 1.86.4 to 1.88.1 and includes CI repair for the Nix vendor hash plus generated CLI docs.\n\n_codex-gpt-5-medium on behalf of CI Bot_
The replace directive never worked for \`go install\` (per \`go help install\`,
replace is not honored for install@version). Removing it fixes \`go install\`
on Linux/macOS; Windows was already broken and stays broken pending GH#3307.
Full analysis in gastownhall/beads#3303.