* schema+storage: restore 0068, move participation_generation to 0070 (be-blvmg) MAYOR RULING 2026-09-29 on tracker be-waare: migration 0068 shipped to origin/main as attribution_status-only (be-v33pa). be-h89oq's lineage had appended participation_generation steps 4-5 to that same file while it was still unmerged, which check-migration-hygiene.sh Check C correctly rejects once 0068 is frozen on main. This restores 0068 to origin/main's exact content and re-homes the participation_generation column (issues + wisps, design section 16.3 steps 4-5, be-dt74u amendment) in a new migration 0070, with its clone-local ignored/0028 twin for wisps. Ports back the participation_generation write-fence consumer code (RecordVersionInTx in internal/storage/issueops/version_history.go and its callers) and the dualwrite contract tests that exercise it. RED: the CLI-bundle direct-DDL override for 0070's guarded PREPARE/ALTER pair is not yet registered in cli_migrations.go, so TestBundleMigrationsWithPreparedALTERAreOverriddenOrJustified, TestMigration0070AddsParticipationGeneration, and TestAllMigrationsSQLUsesDirectDDLForKnownCLIIncompatibilities fail -- correctly: a fresh CLI-built bundle would silently omit the column (dolthub/dolt#11345) while a runtime-migrated store has it. git diff origin/main -- internal/storage/schema/migrations/0068_*.sql is empty, confirming 0068 is untouched. Agent-Signature: model=claude-sonnet-5; reasoning=high * schema: register CLI-bundle direct-DDL override for migration 0070 (be-blvmg) GREEN: adds cliMigration0070AddParticipationGeneration and its dispatch entries (cliCompatibleMigrationSQL, cliSubstituteAssumesWispTables), the same pre-2.3 Dolt CLI PREPARE/ALTER escape hatch 0067's wisps.current_revision and 0068's attribution_status already use (dolthub/dolt#11345). Makes TestBundleMigrationsWithPreparedALTERAreOverriddenOrJustified, TestMigration0070AddsParticipationGeneration, and TestAllMigrationsSQLUsesDirectDDLForKnownCLIIncompatibilities pass: a fresh CLI-built bundle now carries participation_generation on both issues and wisps, matching what a runtime-migrated store gets. scripts/check-migration-hygiene.sh checks A-D pass; 0068 remains byte-identical to origin/main. Agent-Signature: model=claude-sonnet-5; reasoning=high * build: bazel-sync BUILD.bazel for migration 0070 files (be-blvmg) make bazel-sync (gazelle) picked up two files the RED commit added that the hand-ported BUILD.bazel hadn't listed yet: 0070's embedded .up.sql in the go_library embedsrcs and migration_0070_add_participation_generation_test.go in the go_test srcs. Agent-Signature: model=claude-sonnet-5; reasoning=high * test(feat): red — Fix: enable history before fixtures in TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit — PR #6943's §16.2b write fence leaves its flag-off neighbor legacy, so the delete mints 0 rows (stacked on44418b3) (refs be-fyaja) * feat: green — Fix: enable history before fixtures in TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit — PR #6943's §16.2b write fence leaves its flag-off neighbor legacy, so the delete mints 0 rows (stacked on44418b3) (refs be-fyaja) * test(conformance): pin that a wisp reaching the issues plane begins its history (be-31mnz) Review feedback on #6943, blocker 1: with the flag on, a promoted wisp is never versioned. None of the five RunParticipationGeneration* cases reaches a promotion, so nothing caught it. Two contract cases, wired on all three legs: - RunParticipationGenerationWispPromotionBeginsHistory: create a wisp with the flag on, promote it, and require a stamped participation_generation, one version row, and +1 on the next update. - RunParticipationGenerationWispPersistenceMoveBeginsHistory: the same check for a persistence-mode update (bd update --persistent). This mints at a different site than promotion on every leg: the guarded update's one end-of-update mint on dolt and embeddeddolt, and MoveIssuePersistenceInTx's own on uow. "Wisp" is in the names because this contract already says "promoted" in R2.3's sense (ProceedsForPromotedRecord), which is a different operation. The fixture gains CreateWisp, PromoteWisp and MovePersistent closures, and each leg's FixtureKitIsWired checks them. Red at this commit on the embedded leg: after the arrival there are 0 rows and participation_generation is NULL, and after the update there are still 0 rows. A flag-on durable create goes 1 -> 2 in the same store. * fix(issueops): mint a wisp's first issues-plane version create-shaped (be-31mnz) Review feedback on #6943, blocker 1. A promotion, or a persistence move out of the wisps table, inserts a new issues row. A wisp never declares participation (FR-8), so that row's participation_generation is NULL. Both sites minted through the update-shaped RecordVersionInTx, and the section 16.2b fence read the NULL as legacy and skipped the mint. Nothing stamps the column later, so every later update skipped too, and a record created with versioned history on was never versioned. These sites now use RecordVersionForCreateInTx, which stamps the column and mints version 1, as a create on the issues plane does: - PromoteFromEphemeralInTx (promote.go). - MoveIssuePersistenceInTx's move out of the wisps table. - ExecuteUpdate's one end-of-update mint (execution.go), when its persistence patch did that move. This is the site bd update --persistent reaches on the dolt and embeddeddolt legs, and the review did not list it. PersistenceMoveResult.EnteredIssuesPlane tells ExecuteUpdate which entry point to use. One site the review named stays update-shaped on purpose: MoveIssuePersistenceInTx's same-plane repair, which clears a stray wisp flag on a row already in issues. That row keeps its own participation_generation. A row created with the flag on still mints. A legacy row stays legacy, because a repair is an ordinary write and R2.3 says an ordinary write does not promote it. A create-shaped mint there would stamp the legacy row and start versioning it. * docs(schema): 0070 must precede turning versioned history on (be-31mnz) Review note on #6943 (schema skew). The write fence reads participation_generation on every flag-on mint of an issues-plane row. On a store that has not applied 0070 the read fails, and the mutation fails with it instead of skipping. The migration header now says so, and says that the flag-off path (the default) returns before the read, so a store below 0070 writes exactly as before. Comment only. 0070 is not on main, so check-migration-hygiene's frozen-file check does not apply to it, and no test pins its bytes. * test(dolt): a persistence repair keeps the row's own participation (be-31mnz) Pins why MoveIssuePersistenceInTx's same-plane repair stays update-shaped while promotion and a move out of the wisps table became create-shaped (the previous commit). The repair clears a stray wisp flag on a row that already lives in issues, so the row keeps its own participation_generation. TestPersistenceRepairKeepsTheRowsOwnParticipation runs the repair with versioned history on for a legacy row (created with the flag off) and a participating row (created with it on), through both repair entry points: MoveIssuePersistenceInTx and a guarded update with a persistence patch. They mint at different sites. The legacy row must stay NULL and mint nothing, since R2.3 says an ordinary write does not promote it. The participating row must mint one version. participation_generation must not change in either case. It fails if the repair mint is create-shaped, which would stamp and start versioning the legacy row. * test(dolt): a delete's rewrite of a legacy neighbor mints nothing (be-31mnz) Folded in from bee's R1 on #6961, note 1. Once TestDualWriteDeleteNeighborRewriteRidesTheDeletesDoltCommit started creating its neighbor with history on, nothing covered a delete whose neighbor was created with history off. Under the section 16.2b fence, the expected result for that case is different: the rewrite still runs, but it mints nothing. TestDualWriteDeleteSkipsALegacyNeighborsRewrite creates the fixtures with history off, turns history on, and force-deletes the cited target. It then checks four things: the rewrite ran (ReferencesUpdated=1), the neighbor has no issue_versions rows, its participation_generation is still NULL, and dolt_status is clean for issue_versions, store_epoch and issues. * test(embeddeddolt): batch-created rows are stamped with the participation generation A batch create writes its rows first and mints each created row's first version last, after the creation-time edges land. The mint has to stay create-shaped for rows the batch inserted (stamping participation_generation from the store epoch) and update-shaped for rows it only upserted over (skipped while the row is a legacy row), so the per-row isNew has to survive the deferral to the batch's final mint pass. Pin that on the embedded engine: - brand-new explicit-id rows are stamped with the store epoch and get one version row each, and match the same input run one row at a time with the batch-create fast paths off (5 rows, and 250 rows across three INSERT statements); - a legacy row the batch upserts over keeps a NULL participation_generation and gets no version row, while the new rows beside it are stamped; - with versioned history off, no row is stamped and no version row is written. * ci(bazel): enroll the participation-generation tests in the embedded shards The embedded-Dolt shard manifest has to name every top-level Test* in internal/storage/embeddeddolt, or the exact-once coverage check fails. The two participation-generation fence tests were written before that check landed on main, and the batch-create stamping test is new, so none of the three is listed yet. Add them to the 15-shard block as the generator's incremental output: three inserted lines, no existing assignment moves. Also list the new batch-create test file in the embeddeddolt_test srcs, in sorted position, so the Bazel target compiles it alongside the Go build. Its imports are already among that target's deps. Rebase note (maintainer): on current main the embedded storage manifest uses a 40-shard block; the generator's incremental output placed these three tests in shards 18, 19 and 39 and re-sorted one existing shard-12 line. * fix(issueops): keep a created row's updated_at when its first version is minted Minting a version is bookkeeping. It must not change a user-visible column of the row it versions. The create-shaped mint stamps participation_generation with an UPDATE of the issues row. issues.updated_at is ON UPDATE CURRENT_TIMESTAMP, so an UPDATE that changes any other column and does not name updated_at rewrites it with the clock. Before the stamp, a row's first mint left current_revision at its column default of 1, so the UPDATE changed nothing and the clause never fired. The stamp moves participation_generation from NULL to the store epoch, so the clause fires on every row whose first version is minted and replaces the updated_at an import supplies. Set updated_at to itself in the stamp, as the blocked-state recompute in issueops/blocked_state.go already does, so the timestamp the row was created with survives. Add a regression that batch-creates rows with a supplied updated_at and requires both the stamp and the unchanged timestamp. * test(createbatchequiv): re-record the digests the participation-generation fence moves The fence does not re-mint rows that predate the stamp: a row whose participation_generation is still NULL gets no new version when a batch touches it. Main mints one, so six recorded entries move. The issue_versions entry of five scenarios loses the versions main mints for rows that predate the stamp: three rows in small, all eleven in depadd, all fifteen in waitsfor, four in import458 and two in import458-reject-stale. In depadd, eq-db1 and eq-dl are the only rows main mints more than once, and each of those mints moves their updated_at off the fixture date. The fence skips them, so the two rows keep the fixture date and join the issues_updated_at entry. No other table, list or counter digest changes, and the fast and per-row bodies already agree in every scenario. The digests were recorded with the embedded backend. The doc comment on GoldenDirEnv now says which entries were re-recorded. * test(storage): waive the participation-generation contracts on the http leg main's #7247 (6d21d337ad, "a served http conformance leg") registered a fourth leg, http, after this PR's original base. The PR's seven RunParticipationGeneration* entrypoints are neither wired nor waived there, so TestEveryLegWiresEveryRoleContract/http fails on the rebased branch. ParticipationGenerationFixture toggles the store's own versioned-history write flag and reads the raw participation_generation column back: store write-fence bookkeeping (design §16.2b), not a publicops role the HTTP client serves. Waive the seven cases on http with a named reason, the same waiver the donnabox fork carries (09e7ce05af), and keep the gap visible until a supported HTTP surface is designed and tested. go test ./internal/storage/ -run TestEveryLegWiresEveryRoleContract now passes on dolt, embeddeddolt, http and uow. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(issueops): decide the fence's plane by the table that holds the row recordVersionInTx chose the plane from the row's flags (IsWisp: Ephemeral || NoHistory) and then read participation_generation from the issues table only. A wisps-TABLE row can carry neither flag, so it passed the IsWisp return and the issues read failed with sql.ErrNoRows, aborting the whole mutation whenever versioned history is on. Two producers: - bd mol squash clears an ephemeral root's flag in place (UpdateIssue {"wisp": false}, after the root's close, in the squash's one transaction); update.go and the uow repository's Update both mint after it unconditionally. - import's "wisp_plane" marker (WispPlaneOverride = &true, flags false) routes the row to wisps, and the batch create mints it create-shaped. On origin/main the same paths do not fail but mint a stray issue_versions row for a wisps-table row, an FR-8 leak (wisps are never versioned). Fix: no issues row means nothing to version. ErrNoRows on the participation_generation read now returns nil (no version, no error) for update- and create-shaped calls alike. That read is the right signal and IsActiveWispInTx is not: GetIssueInTx has already resolved the row, so ErrNoRows on the issues read can only mean "not in issues", which is exactly the question the fence has to answer before it stamps or advances an issues row. It costs no extra query. IsActiveWispInTx asks the inverse question ("is it in wisps?") with one more query per mint, and it folds every error, including a transient one, into "not a wisp". Tests come first, as three new conformance contracts with three new ParticipationGenerationFixture hooks (ClearWispFlag, SquashWispRoot, CreateUnflaggedWisp). They are wired on the dolt, embeddeddolt and uow legs as subtests of each leg's TestParticipationGenerationFence (no new top-level test, so the shard manifests do not change) and waived on http with participationGenerationRawStoreWaiverReason: RunParticipationGenerationWispFlagClearMintsNothing (create wisp, UpdateIssue {"wisp": false}: no error, 0 versions) RunParticipationGenerationWispRootSquashMintsNothing (close + UpdateIssue {"wisp": false} in one transaction: no error, 0 versions) RunParticipationGenerationUnflaggedWispCreateMintsNothing (CreateIssues with WispPlaneOverride=&true, flags false: no error, 0 versions) Red before the fix, green after, run both ways: embeddeddolt (BEADS_TEST_EMBEDDED_DOLT=1): all three FAIL with "versioned history: read participation_generation for pg-...: sql: no rows in result set"; all three PASS after. uow: all three FAIL with the same error; all three PASS after. dolt (BEADS_TEST_DOLT_SERVER=local): WispRootSquash and UnflaggedWispCreate FAIL with the same error; both PASS after. WispFlagClear passes both ways on this leg. The store-level wisp update (updateWisp) runs in a transaction versioned history never scopes, so it never reaches the mint. For the same reason the leg's SquashWispRoot hook turns the events journal on for its one transaction: that pins the wisp writes to the scoped regular transaction, as in a journal-enabled workspace, so that case does reach the seam. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(issueops): a create stamps participation even when the row is flagged no-history A create-shaped mint (RecordVersionForCreateInTx) of a brand-new ISSUES-TABLE row that carries NoHistory or Ephemeral returned at the IsWisp check before the isCreate stamp, so participation_generation stayed NULL although the row was created with versioned history on. Import produces exactly that row: bd-r9uce keeps a promoted no-history wisp's durable row on the issues plane with its stray no_history=true (import_shared.go applyImportWispPlane: WispPlaneOverride = &false). When bd update --persistent later repairs the flag, it is a same-plane normalize whose mint is update-shaped by design (persistence.go: "A row created with the flag on proceeds; a legacy row stays legacy"). The NULL column made the fence read the row as legacy, so the repair and every later update were fenced and the row was never versioned. origin/main versions it after the repair (0, then 1, then 2 rows). Fix: on a create-shaped call, a flagged row that the issues table holds gets participation_generation stamped from store_epoch.epoch, the same source the minting stamp uses, read in the same transaction. No version is minted and updated_at is kept (SET ..., updated_at = updated_at), then the call returns. Update-shaped calls on flagged rows still return before any read. The table check from the previous commit now runs ahead of the IsWisp branch for create-shaped calls, so a flagged wisps-table row (the common wisp create) still mints and stamps nothing. That costs a create-shaped call on a flagged wisp one primary-key miss on issues, and only while versioned history is on. The store_epoch read/seed moves into readStoreEpochInTx so both stamps share it. Tests first: - New conformance contract RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation and hook CreateNoHistoryIssue. Wired on dolt, embeddeddolt and uow as a TestParticipationGenerationFence subtest and waived on http. With history on: create {NoHistory: true, WispPlaneOverride: &false} gives participation_generation non-NULL and 0 versions. The persistent repair (MovePersistent) then gives 1 version, and an update-shaped edit (MutateExisting, a title edit) gives 2. - New subtest TestCreateBatchParticipationGeneration/NoHistoryRowIsStampedUnversionedAndKeepsTheCallersUpdatedAt (embeddeddolt): a batch of such rows with a supplied updated_at comes out stamped, unversioned, and with updated_at unchanged. Red before the fix, green after, run both ways: dolt (BEADS_TEST_DOLT_SERVER=local), embeddeddolt (BEADS_TEST_EMBEDDED_DOLT=1), uow: the contract FAILS on all three legs ("participation_generation for pg-no-history-create is NULL ...", then "= 0 after the persistent repair, want 1", then "went from 0 to 0 ... want exactly +1"). It PASSES on all three after. embeddeddolt subtest: FAILS before the fix ("store_epoch has no row after the batch, so nothing stamped the 5 rows"). With the fix minus the updated_at = updated_at clause it FAILS on every row's updated_at. It PASSES with the full fix. No new top-level Test*, so the shard manifests do not change. The createbatchequiv goldens are unchanged: the dolt and embeddeddolt equivalence tests pass. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs: fix comments the rebase left stale Comment-only. - createbatchequiv.GoldenDirEnv said "One deliberate behavior change since ... nothing else moved" and then listed a second re-record, the participation-generation fence's. It now says there are two deliberate changes, puts each in its own paragraph, and scopes "nothing else moved" to apply.json, the only golden the first change touched. - issueops CreateIssueResult.isNew and deferredVersion still described one write path. After main's #7205, a row written by deferredCreates' multi-row INSERT reaches finishCreateIssueInTx(..., true) directly (create_batch_cache.go flush) and never passes through InsertIssueIfNew or CreateIssueInTxWithResult. isNew is InsertIssueIfNew's result on the per-row path and always true for a multi-row-INSERT row. deferredVersion is filled from both paths. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(issueops): pin the create/update shape split in the version guard TestEveryVersionedEntryPointMints counts RecordVersionInTx and RecordVersionForCreateInTx as one seam. A create-shaped site that fell back to the update-shaped entry therefore stayed green, though the fence then reads the new row's NULL participation_generation as legacy and the record is never versioned. The reverse case also stayed green: an update path that reached the create-shaped entry would stamp an existing legacy row and promote it, which R2.3 forbids. Add the split to the structural guard. It is two small tests over the same journalscan fixpoint and mintVersion edge discipline, with no AST changes: - TestCreateShapedEntryPointsMintCreateShaped: the create-shaped mint sites (finishCreateIssueInTx, CreateIssuesInTxWithContext, PromoteFromEphemeralInTx, moveIssuePersistenceInTx, executeUpdate) must each call RecordVersionForCreateInTx themselves. A delegate is not enough here, because executeUpdate runs its move with mintVersion=false and a batch switches finishCreateIssueInTx's mint off at run time. Every create-shaped entry point, the delegates and #7205's deferredCreates.flush included, must reach it. - TestUpdateShapedEntryPointsNeverMintCreateShaped: every other versionedEntryPoint must not reach RecordVersionForCreateInTx. The exception is ApplyBatchInTx, which runs create and update items together and is listed as mixed with a reason. Mutation-checked, each probe reverted afterwards. executeUpdate's EnteredIssuesPlane mint, PromoteFromEphemeralInTx's mint, or the batch's deferred create-shaped mint switched to RecordVersionInTx: each fails the create half. update.go's end-of-update mint switched to RecordVersionForCreateInTx: fails the update half for UpdateIssueInTx and every entry point that writes through it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(issueops): hold the dual-shape mint sites to both halves of the splitf006c871c5listed executeUpdate, moveIssuePersistenceInTx, finishCreateIssueInTx and CreateIssuesInTxWithContext (and the ExecuteUpdate/MoveIssuePersistenceInTx/create wrappers that delegate to them) as create-shaped, so TestUpdateShapedEntryPointsNeverMintCreateShaped skipped them. Each one also mints update-shaped, on its existing-row or same-plane branch, which is the common path: a guarded update of an existing row, the bd update --persistent repair of an issues-plane row's flags, a create or batch create that resolved to a row already there. Switching that branch to RecordVersionForCreateInTx stamped a legacy row out of legacy (R2.3), and every guard stayed green. Split the lists by what each function actually mints: - versionCreateShapedMintSites keeps only the pure create-shaped site, PromoteFromEphemeralInTx. It must call RecordVersionForCreateInTx and must not call RecordVersionInTx. - versionDualShapeMintSites names the four, each with its two branches. TestDualShapeMintSitesCallBothEntries requires each to call BOTH entries directly. A delegate does not count, for the same mintVersion=false and DeferVersionMint reasons as before. - versionCreateShapedEntryPoints keeps PromoteFromEphemeralInTx and deferredCreates.flush, which passes isNew=true for every row. - versionDualShapeEntryPoints replaces versionMixedShapeEntryPoints. It holds ApplyBatchInTx and the create, persistence-move and guarded-update entries that delegate to a dual-shape site, each with a reason. Each must reach both entries transitively. The update half skips the create-shaped and dual-shape entry points, as before. The update-shaped branch inside a dual-shape site is now the new test's to pin. Mutation-checked in a throwaway worktree. Switching the update-shaped mint to RecordVersionForCreateInTx at execution.go:301, persistence.go:97, create.go:260 or create.go:499 now fails TestDualShapeMintSitesCallBothEntries for that site. Before this commit, the whole issueops package stayed green under each of these switches. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(httpclient): run the participation-generation fence over the served wireedd3b72a1awaived all eleven ParticipationGeneration contracts on the http leg, saying the client had "no write flag to toggle and no raw column to read". That reason was wrong. served_dualwrite_history_test.go already flips the reference store's VersionedHistoryConfigurer and reads its raw columns, with the client driving the mutation. The waiver also hid the one harness that runs the fence behind the update a connected workspace actually sends. Every store leg's MutateExisting is store.UpdateIssue, but the served Lifecycle.Update reaches the guarded update, ExecuteUpdate. Add served_participation_generation_test.go on the same pattern: - Bound to the client: Mutate is Lifecycle.Create, MutateExisting is Lifecycle.Update, MovePersistent is the persistence-mode Lifecycle.Update that bd update --persistent sends, and PromoteWisp is issueops.Promote over the client's Reader/Lifecycle/Commenter, the entry bd promote dials over http. - Bound to the reference store, as before: SetFlag, the CreateWisp seed, and the raw reads. TestServedParticipationGenerationFence runs seven cases: CreateWithFlagOnStampsAValue, CreateWithFlagOffLeavesLegacyNull, SkipsUpdateOnLegacyRecord, ProceedsForPromotedRecord, FenceIgnoresSchemaSkewHatch, WispPromotionBeginsHistory and WispPersistenceMoveBeginsHistory. All seven pass, and no case turned up a server-side fence bug. Four cases stay waived, now with a reason that names the actual wire gap (participationGenerationWireGapWaiverReason): - WispFlagClearMintsNothing: the in-place {"wisp": false} is an untyped UpdateIssue, and IssuePatch.Persistence moves the row instead. - WispRootSquashMintsNothing: it needs RunInTransaction. That and UpdateIssue are both on the client's unsupported allowlist (D8). - UnflaggedWispCreateMintsNothing and NoHistoryIssueCreateDeclaresParticipation: both need WispPlaneOverride, which every create shape on the wire drops (roleIgnoredCreateIssueMembers). The new file is listed in httpclient_test's srcs. The served lane deals unpinned tests round-robin, so no shard manifest names it. Mutation-checked in a throwaway worktree. With execution.go:301 (the guarded update's update-shaped mint) switched to RecordVersionForCreateInTx, SkipsUpdateOnLegacyRecord and FenceIgnoresSchemaSkewHatch fail here ("version row count for hpg-legacy-skip went from 0 to 1"). The embeddeddolt and uow Participation|DualWrite|Version suites stay green under the same probe. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(conformance): an update never stamps a legacy no-history row7c00d65fa6made the seam write participation_generation on a flagged (NoHistory or Ephemeral) issues-table row when the call is create-shaped. Only the early `if IsWisp(issue) && !isCreate { return nil }` keeps an update-shaped call out of that branch, and nothing pinned it. The new contract and its subtest covered only the positive, create-shaped side. With the early return dropped, an ordinary update stamped a legacy no-history row out of legacy (R2.3), and every suite stayed green. Add RunParticipationGenerationLegacyNoHistoryIssueStaysLegacy beside NoHistoryIssueCreateDeclaresParticipation as its negative twin: 1. Create the no-history issues-table row with the flag OFF. 2. Turn the flag on and run MutateExisting. participation_generation must stay NULL, with 0 versions and current_revision unchanged. 3. Run MovePersistent, the bd update --persistent repair that clears the flag in place. The repair is update-shaped too, so the same three things must still hold. Wired on all four legs: dolt, embeddeddolt, uow and http. On http the case exercises the client's Lifecycle.Update and persistence update. Their precondition, the flag-off no-history create, is seeded through the reference store, because no client create can land that row in the issues table. That gap is also why the case whose SUBJECT is that create stays waived on http. Mutation-checked in a throwaway worktree, with the early return made `if false && IsWisp(issue) && !isCreate`. The new case fails on all four legs and is the only case that fails: "participation_generation for pg-no-history-legacy = 1 after an update-shaped mutation with the flag on, want NULL" (dolt server leg, embeddeddolt, uow and http). At tip it passes on all four. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(issueops): say which table and which mint the fence comments mean Comment and doc corrections. No code changes. - RecordVersionForCreateInTx's doc comment covered a flagged issues-table row but not a wisps-table row. A row the wisps table holds mints and stamps nothing, whatever its flags say: there is no issues row to stamp (FR-8). That holds for an ordinary wisp create and for import's unflagged "wisp_plane" row. - The no-history stamp branch said the bd update --persistent repair mints update-shaped "(MoveIssuePersistenceInTx)". That is true only on the unit-of-work path. On dolt and embeddeddolt the repair goes through the guarded update: executeUpdate runs moveIssuePersistenceInTx with mintVersion=false and mints once at its own end. The fixture's MovePersistent doc already says this. - VERSIONED-BEADS-WRITE-PATHS.md row 13 still credited the whole wisp exclusion to `RecordVersionInTx returns on IsWisp` and called every case a NO-OP. Afterec52d29030, the table holding the row decides its plane: only an update-shaped call on a flagged wisp returns on IsWisp. Every other wisps-table row, including an unflagged one, is excluded by the issues-table participation_generation read, which finds no row. After7c00d65fa6, a create-shaped call on a flagged issues-table row is stamped but not versioned, so the row says that too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(conformance): the wisps-table cases check the row is still a wisp runWispTableRowMintsNothing asserted 0 versions but never checked its own precondition, that the wisps table still holds the row. Suppose a step moved the row onto the issues plane through an update-shaped mint. That mint would hit the new row's NULL participation_generation and be fenced, so the count stayed 0 and the case passed without saying anything about a wisps-table row. - Add an InWispsTable hook to ParticipationGenerationFixture and bind it on dolt, embeddeddolt and uow as a raw wisps-table count. The wisps-table body now Fatals if the row is not in the wisps table after its steps. Each leg's KitIsWired test checks the hook. On http it stays nil with the other wisps-table hooks, whose cases are waived there. - The dolt ClearWispFlag hook now bites. A bare store.UpdateIssue on a wisp goes through updateWisp, whose transaction versioned history never scopes. So WispFlagClearMintsNothing passed on dolt with or without theec52d29030fix, as that commit's message admits. The hook now runs the lone flag clear in a RunInTransaction with the events journal on: the journal-enabled shape the SquashWispRoot hook already uses. - Both hooks go through a new withEventsJournal helper. It restores the store's previous journal setting rather than unconditionally setting it to false afterwards, which assumed the store started with the journal off. Mutation-checked in throwaway worktrees: - With version_history.go atec52d29030^, dolt's WispFlagClearMintsNothing now fails ("read participation_generation for pg-flag-clear: sql: no rows in result set"). It used to pass there. - Embedded ClearWispFlag rerouted as a flag-off persistence move followed by a flag-on title update: the case fails on the new precondition ("is not in the wisps table after flag-clear"). With the precondition disabled, the same probe passes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(storage): review fixups for the participation_generation fence The review ofd17b716115approved the PR with no required changes and raised four minors and three nits. Each one below says what changed and why, or why it did not. Minor 1, the upsert create's new-or-existing choice was untested. The unit-of-work create that is not CreateOnly (bd batch, bd todo, tracker sync and mol port) inserts through an upsert, and db.Insert's existed probe picks the mint's shape; forcing it either way shipped green. The new uow TestParticipationGenerationUpsertCreate pins all three outcomes: a new row is stamped and begins its history, a legacy row the upsert resolves to stays legacy with no version, and a participating row mints exactly one more. No served-route case is added because every served create is CreateOnly (uow createParams), so the http wire cannot reach this branch. The cmd/bd proxied-server batch and todo creates call this same use-case method. Minor 2, an update-shaped mint still lets issues.updated_at move through ON UPDATE CURRENT_TIMESTAMP. Not changed here. The maintainer listed it on the PR as follow-up (2), and the approving review ofd17b716115accepted carrying it as a follow-up. It does not change the fence's contract as pinned. Minor 3, the depadd and waitsfor goldens had been re-recorded to zero issue_versions rows. Their seeds run with history off, so every seeded row was legacy and the harness stopped checking the dependency-add, close and reopen mints. Both scenarios now stamp their seeded issues-table rows after the seed (stampParticipation; wisps stay unstamped). Their goldens are back to main's pre-fence files byte for byte: depadd mints 11 version rows and waitsfor 15. The fenced legacy outcome stays pinned by small, import458 and import458-reject-stale. A run scenario that mints no version row now fails rather than recording an empty digest. Minor 4, PromoteFromEphemeralInTx always minted create-shaped. When the issues plane already held the id (the dual presence GH#4455 records), its upsert resolved to that row and the create-shaped mint stamped a legacy record (R2.3). It now keeps InsertIssueIfNew's isNew and mints update-shaped for an existing row, as finishCreateIssueInTx does. The version guard lists it as a dual-shape mint site and entry point, and PromoteOverDualPresenceKeepsLegacy pins the behavior at run time. Nit 1: with versioned history off, db.Insert skips the existed probe, since both mint entries return before reading anything. A create costs the round trips it did before the fence. Nit 2: the MINT COST comment now counts the fence read (about 6 to 7 round trips) and no longer says the snapshot reads current_revision; the fence read can select it for #6379's ordinal seed. Moving that read now would only add a column nothing consumes yet. Nit 3: the http leg's participation-generation wire-gap waiver opens as PENDING and names the wire mutation that would retire each case. Validation, in a scrubbed env with -tags=gms_pure_go on embedded and server Dolt (all pass, none skipped): - uow: TestParticipationGenerationFence, its FixtureKitIsWired check and TestParticipationGenerationUpsertCreate with its 4 subtests. - embeddeddolt: the create-batch equivalence parts (small/depadd, apply/waitsfor), the parts-coverage guard, the large scenarios, and the fence and kit. - dolt: TestCreateBatchFastPathsMatchPerRow_Dolt, the fence, FenceIgnoresSchemaSkewHatch and the kit. - httpclient: TestServedParticipationGenerationFence. - TestEveryLegWiresEveryRoleContract, the issueops structural guards, and the issueops, storage and domain/db packages. Eleven mutants, graded in 13 runs, each fail the test meant to catch them: - upsert always create-shaped or always update-shaped; - the probe guard inverted; - promote always create-shaped or always update-shaped; - the seed left unstamped; - the dependency-add, close or reopen mint dropped; - two on-disk single-entry promotes. Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(storage): a wisp upsert must not stamp a legacy issues twin domain/db's Insert chose the mint shape of its upsert (the create that is not CreateOnly) from an existence probe of the target table. For a wisps-table insert that probe asks the wrong plane: the seam snapshots the issues table first (GetIssueInTx), so when the issues plane already held the id as a legacy row, the wisp create took the create-shaped mint and stamped and versioned that untouched twin. An ordinary wisp write promoted a legacy record, which R2.3 forbids. bd mol port and the proxied mol and wisp writers call CreateWisp this way. It is latent until versioned history is enabled (#6661). A wisps-table insert never creates an issues row, so it now mints update-shaped, without the probe. The fence leaves a legacy twin alone, a wisp-only id still mints nothing through either entry (FR-8), and a participating twin mints the one version main already minted for it. Insert's comment now records that last case: the dual presence predates the fence, and this upsert does not refuse it the way issueops' create path does. TestParticipationGenerationUpsertCreate gains WispOverLegacyIssuesRowKeepsItLegacy, which fails against the previous dispatch (twin stamped, one version row). Also from review: the version shape guard names the dual-shape site its parse cannot see, and the row-lock exemption comment counts all three of the seam's UPDATE issues statements. Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
33 KiB
Versioned Beads: issue-plane write paths and their Phase 2 disposition
This document has two parts. Dispositions at this head is the current inventory: every row whose disposition changed after the completeness fix a14f48b17 (merged as 5098ec85f), the seam's call sites at this head, and notes that are true now. As found at 321a79278 is the review artifact this PR started from — the table donnabox's item 5 on #6358 asked for, derived before the completeness fix — kept verbatim under a dated heading because it is the record of what the review found. Wherever the two parts differ, the current part wins; a reader citing a row number should cite it from the current part.
Dispositions at this head
Status after a14f48b17 (merged as 5098ec85f on deploy/be-764ey-gate): the table below was derived from the tree at 321a79278, before the completeness fix, and is kept as the record of what the review found. Since that commit the following rows changed disposition:
- Rows 17-23, 25 and 27 (close, reopen, claim, unclaim/release, lease reclaim, defer wake, label add/remove, promote, persistence move) are now VERSIONED: each mints once, after its row write and event, gated on a row actually changing.
- Rows 14-16 (legacy
AddDependency/RemoveDependencyverbs, the uow dependency repository, batch-apply structural adds) are now VERSIONED through the lowest-level helpersaddDependencyInTx/removeDependencyInTx(mint gated on the row insert/delete); the publicops editor's own mint call was removed so no leg double-mints. - Ordering:
ExecuteUpdatemints once, after field, label, parent and persistence patches; batch create mints per issue after its creation-time edges are persisted, so the first version carries the outgoing edge set. version_completeness_test.go(46 must-mint entry points, exemption table with reasons, never-mints inverse guard) andembeddeddolt/version_completeness_behaviour_test.gopin the set at runtime.
The seam is issueops.RecordVersionInTx in internal/storage/issueops/version_history.go (line 87 at 321a79278; cite the function rather than a line at later heads, since comment edits move it), which sits beside the events-journal seam issueops.RecordEventInTx (journal.go:309). At 321a79278 it was reached from exactly six call sites: create.go:196, update.go:547, dependency_editor.go:181 and :272, and domain/db/issue.go:87/:102 (Insert) and :339 (Update); after a14f48b17 it is reached from 27 (18 in issueops, 9 in domain/db), listed in the section "Seam call sites after the completeness fix" below. Dispositions: VERSIONED = reaches RecordVersionInTx and mints an issue_versions row plus the current_revision bump; NO-OP = discarded before the seam (DiscardNoopIssueUpdates, the dependency editor's eventWritten gate, create's early returns, or the wisp exclusion); OUT OF CONTRACT = mutates an issue-plane row (issues, wisps, dependencies, labels, comments and wisp_* twins) without ever calling the seam. Paths are under internal/storage/ unless they start with cmd/, internal/compact/ or backend/. Checkout: /var/tmp/mayor-beads-phase2 @ deploy/be-764ey-gate; all line numbers are against commit 321a79278, the HEAD when this inventory was read (see the last note on drift).
Rows whose disposition changed after a14f48b17
Row numbers are the historical table's. Line numbers in this table are against the Go tree at this head (unchanged since 5098ec85f).
| # | Path | Version seam at this head | Disposition | Mechanism |
|---|---|---|---|---|
| 13 | any of rows 1-8 whose target row is a wisp or a promoted no-history bead | no | NO-OP (a flagged issues-table create is stamped, not versioned) | The table that holds the row decides its plane, not its flags. A row in the wisps table mints and stamps nothing, whatever its flags say (FR-8). An update-shaped call on a flagged wisp returns on IsWisp, which is Ephemeral || NoHistory (helpers.go:36-41). Every other wisps-table row is excluded by the seam's read of participation_generation from the issues table, which finds no row and returns: a flagged wisp's create-shaped call, and an unflagged row (bd mol squash's in-place flag clear, import's wisp_plane marker), which passes IsWisp. An issues-table row carrying NoHistory (a promoted no-history bead, bd-r9uce) is never versioned while it says so, because no-history means no history: an update-shaped call returns on IsWisp. A create-shaped call on such a row, with the flag on, still stamps participation_generation and mints nothing, so the row is not legacy once bd update --persistent repairs the flag in place. |
| 14 | dependencies.go:addDependencyInTx via AddDependencyInTx from the store verbs, ApplyParentPatch, applyBatchRun.applyDepAdd |
yes | VERSIONED | mint moved into addDependencyInTx (mintDependencyVersion, dependencies.go:393), gated on the row insert rather than on eventWritten; the publicops editor's own mint call was removed so no leg double-mints |
| 15 | domain/db/dependency.go:dependencySQLRepositoryImpl.Insert (uow AddDependencies, create-time edges) |
yes | VERSIONED | seam at dependency.go:228 and :240 after the insert |
| 16 | dependencies.go:removeDependencyInTx via RemoveDependencyInTx and domain/db/dependency.go:Delete |
yes | VERSIONED | gated on the row delete; dependency.go:409 on the uow leg |
| 17 | close.go:closeIssueInTx (all close variants; ExecuteCloseBatch loops it; domain/db Close/CloseChecked) |
yes | VERSIONED | close.go:394, after the row write and event, gated on the row changing |
| 18 | reopen.go:reopenIssueInTx |
yes | VERSIONED | reopen.go:126 |
| 19 | claim.go:claimIssueInTx and domain/db/issue.go:Claim |
yes | VERSIONED | claim.go:239 and issue.go:551; ExecuteUpdate's Claim flag passes mintVersion=false and mints once at its own end |
| 20 | unclaim.go:finishUnclaimInTx (unclaim, release) |
yes | VERSIONED | unclaim.go:137 |
| 21 | lease.go:ReclaimExpiredLeasesInTx |
yes | VERSIONED | lease.go:786 |
| 22 | wake_defers.go:wakeExpiredDefersInTable |
yes | VERSIONED | wake_defers.go:143 |
| 23 | labels.go:addLabelInTx / removeLabelInTx and domain/db/label.go:Insert / Delete |
yes | VERSIONED | labels.go:190 and :239 gated on RowsAffected() > 0; label.go:91 and :130; applyLabelPatch (aggregate.go:360) mints only when called outside ExecuteUpdate |
| 25 | promote.go:PromoteFromEphemeralInTx |
yes | VERSIONED | promote.go:141, after the label, dependency and comment copies |
| 27 | persistence.go:moveIssuePersistenceInTx |
yes | VERSIONED | persistence.go:76 and :153; ExecuteUpdate passes mintVersion=false and mints once at its own end |
| 34 | batch_apply.go:applyBatchRun |
yes, per item | VERSIONED | its create/update/close items reach rows 1/2, 5/6 and 17; its dep-add items reach addDependencyInTx, which now mints (row 14) |
Rows not listed keep the disposition shown in the historical table: rows 1-8 VERSIONED; rows 9-12 NO-OP gates inside them; rows 24, 26, 28-33 and 35-39 OUT OF CONTRACT; row 40 writes no issue-plane row; row 41 is Phase 3.
Counts at this head
Of the 34 live issue-plane write paths (rows 1-8 and 14-39), 21 are VERSIONED (rows 1-8, 14-23, 25, 27, 34) and 13 are OUT OF CONTRACT (rows 24, 26, 28-33, 35-39); rows 9-13 are the no-op gates inside the versioned ones. The out-of-contract set is what the design puts out of contract: comments (not part of the snapshot), is_blocked flips, delete, rename and demote (Phase 3's deleted-Versioned-Bead guarantee), compaction bookkeeping and restore, migrations, merge-settle, doctor fixes and raw SQL.
Still deferred
Still true and deliberately out of contract or deferred: an unchanged re-import of an existing row mints a version (create has no field-level no-op gate — and the journal seam sits in the same position: RecordEventInTx(EventCreate) at create.go:207 runs on every accepted upsert, only the events-table write behind the isNew gate at create.go:171 is skipped, so a no-op gate belongs in front of both seams, not the version seam alone); the uow leg mints per repository write, so a domain create with N labels and M edges yields 1+N+M versions where the direct legs yield one (each a distinct accepted state; follow-up); demote-to-wisp and delete/rename strand version rows because issue_versions has no FK to issues (Phase 3's deleted-Versioned-Bead guarantee); compaction bookkeeping, restore, migrations, merge-settle, doctor fixes and bd sql remain out of contract by design. The flag-off contract is behaviourally a no-op at the seam (RecordVersionInTx returns before any query) but not literally zero added work: labels.go's RowsAffected gate and the per-transaction sync.Map entry run with the flag off; the differential harness that would prove the stronger claim is not in this PR. The items that become live the first time the flag is on — the uow leg's 1+N+M, the re-import no-op gate on both seams, duplicate-key metadata, the single-writer allocator, and the attribution_status vocabulary being enforced only in Go — are tracked together in gastownhall/beads#6379.
Seam call sites at this head
Verified with grep -rn 'RecordVersionInTx(' internal/ --include='*.go' over non-test files at d484b809d (the Go tree is unchanged between the merge of a14f48b17 as 5098ec85f and this note): 27 call sites reach the seam, 18 on the direct legs in issueops/ and 9 on the uow leg in domain/db/. The figure of 29 quoted in the PR thread was an over-count; this table is the correction. Line numbers are against that tree. The 46 "must-mint entry points" pinned by version_completeness_test.go are a different count by design: they are the public entry functions whose call graph must reach the seam, not the seam's own call sites.
Direct legs, internal/storage/issueops/ (18):
| File:line | Function | Mutation |
|---|---|---|
| aggregate.go:360 | applyLabelPatch |
label patch (mints only when used outside ExecuteUpdate, which passes mintVersion=false) |
| aggregate.go:423 | applyParentPatch |
parent patch (same rule) |
| claim.go:239 | claimIssueInTx |
claim |
| close.go:394 | closeIssueInTx |
close, all variants; ExecuteCloseBatch loops it |
| create.go:216 | CreateIssueInTxWithResult |
singular create and import upsert |
| create.go:384 | CreateIssuesInTxWithContext |
batch create, per issue, after its creation-time edges (DeferVersionMint) |
| dependencies.go:393 | mintDependencyVersion |
from addDependencyInTx / removeDependencyInTx: legacy verbs, the publicops editor, batch-apply |
| execution.go:269 | ExecuteUpdate |
once, after field, label, parent and persistence patches |
| labels.go:190 | addLabelInTx |
label add |
| labels.go:239 | removeLabelInTx |
label remove |
| lease.go:786 | ReclaimExpiredLeasesInTx |
lease reclaim |
| persistence.go:76, :153 | moveIssuePersistenceInTx |
persistence move (two sites in the one function) |
| promote.go:141 | PromoteFromEphemeralInTx |
promote from ephemeral |
| reopen.go:126 | reopenIssueInTx |
reopen |
| unclaim.go:137 | finishUnclaimInTx |
unclaim / release |
| update.go:555 | updateIssueInTx |
update |
| wake_defers.go:143 | wakeExpiredDefersInTable |
defer wake |
uow leg, internal/storage/domain/db/ (9):
| File:line | Method | Mutation |
|---|---|---|
| issue.go:87, :102 | issue repository Insert |
create (two sites in the one method) |
| issue.go:339 | issue repository Update |
update |
| issue.go:551 | issue repository Claim |
claim |
| label.go:91 | label repository Insert |
label add |
| label.go:130 | label repository Delete |
label remove |
| dependency.go:228, :240 | dependency repository Insert |
edge add (two sites in the one method) |
| dependency.go:409 | dependency repository Delete |
edge remove |
Notes at this head
- What actually versions: every accepted issue-plane mutation on every leg — create (singular, batch, import), update (and everything that reaches
updateIssueInTx: metadata merge/delete/CAS, deleted-reference rewrite, compaction's content rewrite), dependency add and remove (editor, legacy verbs, uow repository, batch-apply), close, reopen, claim, unclaim/release, lease reclaim, defer wake, label add and remove, promote, persistence move.version_completeness_test.gopins 46 must-mint entry points with an exemption table (a reason per row) and an inverse never-mints guard;embeddeddolt/version_completeness_behaviour_test.gopins the runtime deltas. - Cross-leg symmetry on dependencies: resolved. The dolt and embeddeddolt editors, the legacy store verbs and the uow repository all reach the seam through
addDependencyInTx/removeDependencyInTx, gated on the row insert or delete. - Ordering inside a versioned call: the mint is the last durable-state write.
ExecuteUpdatemints once after its field, label, parent and persistence patches; batch create mints per issue afterPersistDependenciesWithOptionsResult, so the first version carries the creation-time edge set. - Count vs design: 21 VERSIONED, 13 OUT OF CONTRACT, 5 no-op gates (see Counts at this head). The design's "eighteen" is still not reconcilable item by item from this checkout.
- Import upsert: an unchanged re-import of an existing row still mints, and it also journals —
RecordEventInTx(EventCreate)at create.go:207 runs on every accepted upsert — so the no-op gate belongs in front of both seams (gastownhall/beads#6379, item 2). - No FK from issue_versions to issues (0067), so delete, rename and demote strand version rows under ids that no longer exist in
issues— Phase 3 (gastownhall/beads#6379, item 6). - Non-canonicalizable snapshots fail the mutation by policy: duplicate keys in an issue's
metadata(ajson.RawMessage) makecanonicalDurableStatereturn an error and abort the transaction with the flag on (gastownhall/beads#6379, item 3). - Single writer means one writer at a time per store, not merely one clone:
MAX(revision)+1is not a safe allocator for two concurrent transactions in one store either, and no contract case runs concurrent writers (gastownhall/beads#6379, item 4). - Exemption tables that name the seam: journal_completeness_test.go
beadDMLExemptionsand row_lock_guard_test.gofuncNameExemptionsboth listRecordVersionInTxas bookkeeping for an already-journaled mutation; unchanged.
As found at 321a79278 (historical; superseded above wherever the two parts differ)
The table and notes below are the inventory as derived from the tree at 321a79278, the HEAD when it was read, and all line numbers in this part are against that commit. It is kept verbatim as the record of what the review found. Rows 13-23, 25, 27 and 34 are superseded by the current table above; the notes below that contradict the notes above are superseded too.
| # | Path (file:function) | Writes | Events seam | Version seam | Disposition | Why |
|---|---|---|---|---|---|---|
| 1 | issueops/create.go:CreateIssueInTxWithResult (CreateIssueInTx; execution.go:ExecuteCreate; dolt/issues.go:createIssue; dolt/transaction.go and embeddeddolt/transaction.go CreateIssue) |
issues or wisps row via InsertIssueIfNew (ON DUPLICATE KEY UPDATE upsert) + labels + comments |
yes | yes | VERSIONED | both seams run once after labels/comments persist (create.go:193-197); an existing-row upsert (isNew=false) still mints — create has no field-level no-op gate |
| 2 | domain/db/issue.go:issueSQLRepositoryImpl.Insert (InsertBatch loops it; domain IssueUseCase.CreateIssue/CreateWisp from uow/issue_operations.go, uow/batch_creator.go, uow/batch_applier.go) |
issues or wisps via issueops.InsertIssueStrictInTx |
yes | yes | VERSIONED | uow leg; RecordVersionInTx directly after RecordEventInTx in both branches (issue.go:84-87, 99-102) |
| 3 | issueops/create.go:CreateIssuesInTxWithContext / CreateIssuesInTxWithResult (create_batch.go:ExecuteCreateBatch; store CreateIssuesWithFullOptions on both direct legs) |
row 1 per issue, then PersistDependenciesWithOptionsResult |
yes (per issue, plus dep events) | yes (per issue) | VERSIONED | per-issue loop (create.go:309); creation-time edges are inserted AFTER each issue's version row, so they are neither in that row's durable_state nor versioned themselves |
| 4 | Import: uow/importer.go:importer.ImportBatch; embeddeddolt/store.go:ImportJSONLData; embeddeddolt/transaction.go:CreateIssueImport; cmd/bd/import_shared.go via store.CreateIssuesWithFullOptions |
as row 3 | yes | yes | VERSIONED | import is not a separate write path — it funnels into rows 1/3; at 321a79278 rows get attribution_status supplied/undetermined and imported is only reserved (version_history.go:57-61); 56b2199d4, which landed mid-session, collapses the values to claimed/unknown with no imported at all |
| 5 | issueops/update.go:updateIssueInTx (UpdateIssueInTx, UpdateIssueWithoutEventInTx; execution.go:ExecuteUpdate; metadata.go:writeMergedMetadataInTx from MergeMetadataInTx/DeleteMetadataInTx/metadata_cas.go:CompareAndSetMetadataKeyInTx; delete_role.go:RewriteDeletedReferencesInTx; compaction's content rewrite via store.UpdateIssue) |
UPDATE issues or wisps SET fields, row_lock | yes | yes | VERSIONED | seams at update.go:544-547, after DiscardNoopIssueUpdates (:391) and NOT inside if recordEvent — UpdateIssueWithoutEventInTx still versions |
| 6 | domain/db/issue.go:issueSQLRepositoryImpl.Update (domain IssueUseCase.ApplyUpdate from uow/issue_operations.go, uow/batch_applier.go) |
UPDATE issues or wisps | yes | yes | VERSIONED | uow leg; same no-op gate (issue.go:212-219), seams at :336-339 |
| 7 | issueops/dependency_editor.go:addDependencyEdgeInTx (ExecuteAddDependencies from dolt/dependency_editor.go, embeddeddolt/dependency_editor.go) |
INSERT dependencies or wisp_dependencies via AddDependencyInTx (+ is_blocked marks) |
yes (RecordDepEventInTx inside addDependencyInTx) |
yes, iff eventWritten |
VERSIONED | versions the referencing (source) issue only when a row was recorded (dependency_editor.go:180-183) |
| 8 | issueops/dependency_editor.go:ExecuteRemoveDependency (from dolt/dependency_editor.go, embeddeddolt/dependency_editor.go) |
DELETE dependencies or wisp_dependencies via RemoveDependencyInTx |
yes | yes, iff eventWritten |
VERSIONED | returns Removed:false before the seam when no row matched (:263-274) |
| 9 | update.go:updateIssueInTx / domain/db/issue.go:Update when DiscardNoopIssueUpdates leaves no field |
nothing | no | no | NO-OP | returns before the UPDATE (update.go:391-397; issue.go:212-219) — the FR-2 contract case |
| 10 | dependency_editor.go:addDependencyEdgeInTx on a same-type re-add |
UPDATE dependencies SET metadata (dependencies.go:274) | yes (dependencies.go:281) | no | NO-OP | addDependencyInTx returns eventWritten=false on the existing-edge branch, so the seam is skipped although metadata is rewritten and journaled |
| 11 | dependency_editor.go:ExecuteRemoveDependency on an absent edge |
nothing | no | no | NO-OP | removeDependencyInTx reports eventWritten=false; editor returns at :267 |
| 12 | create.go:CreateIssueInTxWithResult on collision-skip, ConflictSkip or RejectStaleUpserts hit |
nothing | no | no | NO-OP | early returns at create.go:126-128, 135-143 precede both seams |
| 13 | any of rows 1-8 whose target row is a wisp | as per row | yes | no | NO-OP | RecordVersionInTx returns nil on IsWisp (version_history.go:96, FR-8); wisps.current_revision stays at its default |
| 14 | dependencies.go:addDependencyInTx via AddDependencyInTx from the store verbs — dolt/dependencies.go:addDependencyWithOptions, dolt/transaction.go and embeddeddolt/transaction.go AddDependencyWithOptions, embeddeddolt/dependencies.go, dolt/wisps.go:addWispDependency, batch_apply.go:applyBatchRun.applyDepAdd, aggregate.go:ApplyParentPatch |
INSERT dependencies or wisp_dependencies | yes | no | OUT OF CONTRACT | same DML as row 7 but no caller invokes RecordVersionInTx; only the publicops editor role versions |
| 15 | domain/db/dependency.go:dependencySQLRepositoryImpl.Insert (domain DependencyUseCase.AddDependencies from uow/dependency_editor.go and uow/batch_applier.go; IssueUseCase create-time edges, domain/issue.go:980,1041,1053) |
INSERT dependencies or wisp_dependencies | yes | no | OUT OF CONTRACT | the uow leg's dependency add never reaches the seam — only Insert/Update in domain/db/issue.go do |
| 16 | dependencies.go:removeDependencyInTx via RemoveDependencyInTx from store verbs (dolt/dependencies.go and both transactions RemoveDependencyWithOptions, ApplyParentPatch) and domain/db/dependency.go:Delete (uow RemoveDependencyBySource) |
DELETE dependencies or wisp_dependencies | yes (when EmitEvent) | no | OUT OF CONTRACT | as row 14 |
| 17 | close.go:closeIssueInTx (CloseIssueInTx, CloseIssueWithoutEventInTx, CloseIssueCheckedInTx; execution.go:ExecuteClose; close_batch.go:ExecuteCloseBatch loops ExecuteClose; domain/db Close/CloseChecked) |
UPDATE issues or wisps SET status, closed_at, close_reason, closed_by_session, row_lock (close.go:340) | yes (EventClose, close.go:387, not gated by recordEvent) |
no | OUT OF CONTRACT | direct UPDATE; never calls RecordVersionInTx, so a close is invisible to issue_versions |
| 18 | reopen.go:reopenIssueInTx (ReopenIssueInTx; execution.go:ExecuteReopen; domain/db Reopen) |
UPDATE status/closed_at (reopen.go:64) | yes | no | OUT OF CONTRACT | as row 17 |
| 19 | claim.go:ClaimIssueInTx (public_claim.go:ExecuteClaim; ClaimReadyIssueInTx from claim_next.go:ExecuteClaimNext; ExecuteUpdate's Claim flag) and domain/db/issue.go:Claim (uow) |
UPDATE assignee/status/started_at (claim.go:115,124; issue.go:478,488) | yes | no | OUT OF CONTRACT | a claim-only request mints nothing; ExecuteUpdate versions only if other fields also change (execution.go: ClaimIssueInTx then if len(updates) > 0) |
| 20 | unclaim.go:UnclaimIssueInTx / UnclaimIssueIfAssigneeInTx via finishUnclaimInTx; release_role.go:ReleaseIssueInTx wraps them (domain/db UnclaimIssue/ReleaseIssue) |
UPDATE assignee/status (unclaim.go:80,197) | yes | no | OUT OF CONTRACT | direct UPDATE |
| 21 | lease.go:ReclaimExpiredLeasesInTx (dolt/issues.go:473, embeddeddolt/issues.go:134, domain/db ReclaimExpiredLeases) |
UPDATE issues assignee/status revert (lease.go:758) + DELETE leases | yes | no | OUT OF CONTRACT | HeartbeatIssueInTx writes only leases and is not an issue-record write |
| 22 | wake_defers.go:wakeExpiredDefersInTable (WakeExpiredDefersInTx; dolt/queries.go:63, embeddeddolt/queries.go:33, domain/db WakeExpiredDefers) |
UPDATE status (wake_defers.go:116) | yes (actor DeferWakeActor) |
no | OUT OF CONTRACT | scheduled status flip outside the seam |
| 23 | labels.go:AddLabelInTx / RemoveLabelInTx (dolt/labels.go, embeddeddolt/labels.go, both transactions, aggregate.go:ApplyLabelPatch from ExecuteUpdate) and domain/db/label.go:Insert / Delete (uow LabelUseCase) |
INSERT IGNORE / DELETE labels or wisp_labels | yes (EventUpdate) | no | OUT OF CONTRACT | labels ARE in durable_state (get_issue.go:59 hydrates them) but a label change mints nothing; in ExecuteUpdate the label patch runs after UpdateIssueInTx's mint, so a same-call field+label edit records the old label set |
| 24 | comments.go:addIssueCommentInTx (AddIssueCommentInTx, ImportIssueCommentInTx, commenter.go:ExecuteAddComment); dolt/transaction.go:AddComment / ImportIssueComment (InsertDerivedEventReturningID / InsertDerivedComment); domain/db/comment.go:InsertRecord (uow CommentUseCase); create.go:PersistComments |
INSERT comments or wisp_comments (dolt tx AddComment writes an events-table comment row) |
yes (RecordCommentEventInTx) |
no | OUT OF CONTRACT | comments are not in durable_state either (GetIssueInTx joins labels, not comments) |
| 25 | promote.go:PromoteFromEphemeralInTx (dolt/ephemeral_routing.go:205, embeddeddolt/store.go:1003, domain/db PromoteFromEphemeral) |
INSERT issues (+ label/dep/comment copies), DELETE wisps | yes | no | OUT OF CONTRACT | promoted row lands with current_revision default 1 and no version row |
| 26 | dolt/ephemeral_routing.go:DoltStore.demoteToWispInTx |
UpdateIssueWithoutEventInTx (row 5), then raw aux copies + DELETE FROM issues (:303) |
yes | yes (update half only) | OUT OF CONTRACT | mints a version row for an issue the same tx then deletes; issue_versions has no FK to issues (0067), so the row strands |
| 27 | persistence.go:MoveIssuePersistenceInTx (ExecuteUpdate persistence patch; domain/db MovePersistence) |
InsertIssueStrictInTx into the target plane, copy aux, DELETE source (persistence.go:70,106) |
yes (twice) | no | OUT OF CONTRACT | plane move bypasses both the create and update seams |
| 28 | delete.go:deleteIssueRowInTx / DeleteIssuesInTx / DeleteResolvedSetInTx; delete_role.go:DeleteInTx; sweep.go:SweepInTx; dolt/wisps.go:deleteWisp / deleteWispBatchTx; domain/db/issue.go:Delete / DeleteByIDs (+ label/dependency/events DeleteAllForIDs, domain/issue_delete.go) |
DELETE issues or wisps + aux + leases | yes (RecordDeleteInTx) |
no | OUT OF CONTRACT | no surviving row; the deleted-Versioned-Bead guarantee is Phase 3 (PR #6358); orphaned issue_versions rows remain. delete_role.go:RewriteDeletedReferencesInTx then goes through row 5, so neighbours DO mint versions |
| 29 | bulk_ops.go:DeleteIssuesBySourceRepoInTx (dolt/issues.go:946, embeddeddolt/store.go:987) |
bulk DELETE issues WHERE source_repo = ? | yes (per id) | no | OUT OF CONTRACT | bulk path |
| 30 | bulk_ops.go:UpdateIssueIDInTx via updateIssueIDInTx / updateWispIDInTx (dolt/rename.go:14, embeddeddolt/store.go:995) |
UPDATE issues SET id = ? + dependency rekey | yes (dep-remove, delete old, create new, dep-add via recordRenameInJournal) |
no | OUT OF CONTRACT | history stays keyed to the old issue_id; the new id carries current_revision with no matching rows |
| 31 | compaction.go:ApplyCompactionInTx (dolt/compact.go:52, embeddeddolt/store.go:1179) |
UPDATE issues SET compaction_level, compacted_at, compacted_at_commit, original_size, updated_at | no (beadDMLExemptions) |
no | OUT OF CONTRACT | the content rewrite that precedes it (internal/compact/compactor.go:147, cmd/bd/compact.go:702 via store.UpdateIssue) IS row 5, so compaction mints exactly one version for the summary while its own columns land unversioned |
| 32 | compaction.go:RestoreFromSnapshotInTx (dolt/compact.go:82, embeddeddolt/store.go:1203) |
UPDATE issues content from snapshot (compaction.go:173,181) | no | no | OUT OF CONTRACT | restore's CAS composition is Phase 3 (PR #6358) |
| 33 | blocked_state.go mark/unmark templates via RecomputeIsBlocked* / MarkIsBlockedInTx; dependencies.go:markDirectBlockingDependencySourceInTx; domain/db/dependency.go:markDirectBlockedSource |
UPDATE issues or wisps SET is_blocked | yes, flips only (journal.go:recordBlockedJournalChanges, actorless) |
no | OUT OF CONTRACT | derived state; is_blocked is not hydrated into durable_state |
| 34 | batch_apply.go:applyBatchRun (ApplyBatch; uow/batch_applier.go) |
per item: create rows 1/2, update rows 5/6, close row 17, dep add rows 14/15 | per item | per item | OUT OF CONTRACT (mixed) | dep-add items call AddDependencyInTx / DependencyUseCase.AddDependencies, never the versioned editor |
| 35 | schema/cli_migrations.go:cliMigration0053RepairRigWisps (INSERT IGNORE INTO issues, UPDATE issues, DELETE FROM wisps); schema/migration_repairs.go and schema/wisp_dep_forward_repair.go (dependencies rewrites) |
migration DML | no | no | OUT OF CONTRACT | 0067/0068 themselves are DDL only (ADD COLUMN ... DEFAULT 1; no row backfill) |
| 36 | versioncontrolops/automerge.go:resolveIssuesFieldMerge (UPDATE issues); versioncontrolops/mergesettle.go:TryRepairFKCascadeViolations (fkCascadeRepairDeletes on dependencies/labels/comments) |
merge-settle rewrites and orphan deletes | no | no | OUT OF CONTRACT | raw connection during merge settlement |
| 37 | dolt/federation.go:deleteExcludedIssues (from stageFilteredBranch) |
DELETE FROM issues WHERE ephemeral = 1 / issue_type = ? on the staging branch | no | no | OUT OF CONTRACT | raw conn on a filtered-push branch |
| 38 | cmd/bd/doctor/fix/validation.go:OrphanedDependencies / ChildParentDependencies / CrossTableDuplicates |
tx.Exec DELETE FROM dependencies / issues |
no | no | OUT OF CONTRACT | raw doctor fixes |
| 39 | cmd/bd/sql.go (storage.RawDBAccessor.UnderlyingDB then db.ExecContext); cmd/bd/sql_proxied_server.go via uow RawSQLUseCase().Exec to domain/db/raw_sql.go |
arbitrary SQL | no | no | OUT OF CONTRACT | the proxied variant runs inside a uow tx with the version scope bound (uow/dolt_sql_provider.go:178) but raw SQL never calls the seam |
| 40 | issueops/bootstrap.go:BootstrapInTx (uow/bootstrapper.go, hook_bootstrapper.go) |
config + metadata tables only (SetConfigInTx, SetMetadataInTx) |
no | no | OUT OF CONTRACT (n/a) | writes no issue-plane row at all |
| 41 | PLANNED 18th: fk_dep_issue_target ON DELETE CASCADE (schema/cli_migrations.go:284,311; migrations 0041/0043) |
DB-level cascade deleting dependencies rows when their target issues row is deleted; no Go call site | no | no | Phase 3 (planned) | PR #6358 body: "Phase 3 items by design: the fk_dep_issue_target cascade (the 18th path)"; today it fires silently underneath rows 28-29 |
Notes as found at 321a79278
- Count vs design. Grouping by leaf mutation function, the code has 34 live issue-plane write paths (rows 1-8 and 14-39; row 40 excluded because it writes no issue row; rows 9-13 are gates inside rows 1-8) plus the planned FK cascade — not eighteen. Of the 34, 8 are VERSIONED, 26 OUT OF CONTRACT, and 5 NO-OP gates sit inside the versioned ones. The design's own list (be-hs42e.3) is not resolvable from this checkout or
bd show; only PR #6358's "the 18th path" line was found, so the eighteen could not be reconciled item by item. - What actually versions: create, update (and their uow twins in domain/db/issue.go) and the publicops dependency editor. Every other journaled mutation — close, reopen, claim, unclaim/release, lease reclaim, defer wake, labels, comments, promote, persistence move, delete, rename — reaches
RecordEventInTxbut neverRecordVersionInTx, even though version_history.go:20-27 describes the seam as living "inside the same already-short-circuited functions that call RecordEventInTx". journal_completeness_test.go pins 57mutationEntryPointsfor the journal; the version seam is wired into 3 of them, and no equivalent completeness test exists for it. - Cross-leg asymmetry on dependencies: the dolt and embeddeddolt DependencyEditor roles version (rows 7-8); the uow DependencyEditor role goes through domain/db dependency
Insert/Deleteand does not (rows 15-16). The legacy store verbsAddDependency/RemoveDependencydo not on any leg (rows 14, 16). - Versioned only via a helper:
MergeMetadataInTx,DeleteMetadataInTx,CompareAndSetMetadataKeyInTx,RewriteDeletedReferencesInTx, compaction's content rewrite anddemoteToWispInTxversion solely because they callUpdateIssueInTx/UpdateIssueWithoutEventInTx. - Per-issue loops: batch create, import, uow
InsertBatch(versioned per issue);ExecuteCloseBatchloopsExecuteClose(row 17, unversioned per issue);DeleteIssuesInTx(unversioned). - Ordering inside a versioned call: batch-create edges (row 3) and
ExecuteUpdate's label/parent patches (rows 23, 14) land after the mint, so the minteddurable_statepredates them. - Import upsert: an unchanged re-import of an existing row (
isNew=false, stale check not tripped) mints a version because create has no field-level no-op gate — unlike update's FR-2 behaviour (row 9). - No FK from issue_versions to issues (migration 0067 creates the table without one), so delete, rename and demote (rows 26, 28, 30) strand version rows under ids that no longer exist in issues.
- Exemption tables that name the seam: journal_completeness_test.go
beadDMLExemptionsand row_lock_guard_test.gofuncNameExemptionsboth listRecordVersionInTxas bookkeeping for an already-journaled mutation. - Drift during this session (2026-09-07 13:31-13:33): the branch advanced to 56b2199d4 (
attribution_statusrenamed to claimed|unknown, ordinals documented as local) and the working tree then carried further uncommitted edits by another agent — version_history.go (RFC 8785 canonicaldurable_stateviajcs, with go.mod/go.sum), cli_migrations.go, the 0068 up/down SQL, three schema tests and an untracked version_history_durable_state_test.go. Neither adds or removes aRecordVersionInTxcall site (the six above were re-verified against 321a79278 and the live tree) and no disposition changes; this inventory is against 321a79278 and does not cover them.