From 7c00d65fa6972b00da0f6ec0c820d821bf0fe884 Mon Sep 17 00:00:00 2001 From: Julian Knutsen Date: Sun, 18 Oct 2026 03:19:49 +0000 Subject: [PATCH] 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) --- ...write_participation_generation_contract.go | 69 +++++++++++++++++ ..._participation_generation_contract_test.go | 15 ++++ ...ate_batch_participation_generation_test.go | 45 +++++++++++ ..._participation_generation_contract_test.go | 15 ++++ internal/storage/issueops/version_history.go | 77 ++++++++++++++----- internal/storage/leg_contract_wiring_test.go | 21 ++--- ..._participation_generation_contract_test.go | 13 ++++ 7 files changed, 227 insertions(+), 28 deletions(-) diff --git a/backend/conformance/dualwrite_participation_generation_contract.go b/backend/conformance/dualwrite_participation_generation_contract.go index 97dc9bf12..a0d0d00e3 100644 --- a/backend/conformance/dualwrite_participation_generation_contract.go +++ b/backend/conformance/dualwrite_participation_generation_contract.go @@ -78,6 +78,9 @@ type ParticipationGenerationFixture struct { // closure rather than a second spelling of PromoteWisp because it mints at // a different site on every leg: the guarded update's one end-of-update // mint on dolt and embeddeddolt, MoveIssuePersistenceInTx's own on uow. + // On an issues-plane row whose flags disagree with it (see + // CreateNoHistoryIssue) the same update repairs the flags in place, a + // same-plane normalize, rather than moving the row. MovePersistent func(ctx context.Context, id string) error // ClearWispFlag clears the wisp id's ephemeral flag IN PLACE: the untyped // UpdateIssue of {"wisp": false} bd mol squash makes on a squashed root @@ -95,6 +98,12 @@ type ParticipationGenerationFixture struct { // the batch create import runs), or on the unit-of-work leg CreateWisp, // which routes by the call rather than by the flags. CreateUnflaggedWisp func(ctx context.Context, id string) error + // CreateNoHistoryIssue creates id in the ISSUES table carrying + // NoHistory=true: import's promoted-no-history shape (bd-r9uce), a + // durable row whose stray flag is preserved while WispPlaneOverride = + // &false pins its plane, through the batch create import runs; or on the + // unit-of-work leg CreateIssue, which routes by the call. + CreateNoHistoryIssue func(ctx context.Context, id string) error // CurrentRevision reads issues.current_revision for id. CurrentRevision func(ctx context.Context, id string) (int64, error) // VersionRowCount reads how many issue_versions rows exist for id. @@ -391,6 +400,66 @@ func runWispTableRowMintsNothing(t *testing.T, ctx context.Context, fixture Part } } +// RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation pins +// that a create declares participation for every ISSUES-table row it makes +// with the flag on, a row carrying NoHistory included. Import keeps a +// promoted no-history wisp's durable row on the issues plane with its stray +// no_history=true (bd-r9uce). While the row says no-history it is not +// versioned, so the create mints nothing. But it was created with history +// on, so it is not legacy: once bd update --persistent repairs the flag in +// place (a same-plane normalize, update-shaped by design), the repair and +// every update after it must mint. Left NULL by the create, the column reads +// as legacy to the fence, and the row is never versioned at all. +func RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation(t *testing.T, ctx context.Context, fixture ParticipationGenerationFixture) { + t.Helper() + if err := fixture.SetFlag(ctx, true); err != nil { + t.Fatalf("enabling versioned history: %v", err) + } + id := fixture.IssuePrefix + "-no-history-create" + if err := fixture.CreateNoHistoryIssue(ctx, id); err != nil { + t.Fatalf("creating no-history issues-plane row %s: %v", id, err) + } + gen, err := fixture.ParticipationGeneration(ctx, id) + if err != nil { + t.Fatalf("reading participation_generation for %s: %v", id, err) + } + if gen == nil { + t.Errorf("participation_generation for %s is NULL after a create with the flag on, want a stamped "+ + "value: the row is new on the issues plane, so the create declares participation (design "+ + "§16.2b) even though its NoHistory flag keeps it unversioned for now", id) + } + if count, err := fixture.VersionRowCount(ctx, id); err != nil { + t.Fatalf("counting version rows for %s: %v", id, err) + } else if count != 0 { + t.Errorf("version row count for %s = %d after a create carrying NoHistory, want 0: a no-history "+ + "row is not versioned while it says so", id, count) + } + + if err := fixture.MovePersistent(ctx, id); err != nil { + t.Fatalf("repairing %s to persistent: %v", id, err) + } + repairedCount, err := fixture.VersionRowCount(ctx, id) + if err != nil { + t.Fatalf("counting version rows for %s: %v", id, err) + } + if repairedCount != 1 { + t.Errorf("version row count for %s = %d after the persistent repair, want 1: the row was created "+ + "with the flag on, so the fence must let the repair's update-shaped mint through", id, repairedCount) + } + + if err := fixture.MutateExisting(ctx, id); err != nil { + t.Fatalf("mutating existing %s: %v", id, err) + } + afterCount, err := fixture.VersionRowCount(ctx, id) + if err != nil { + t.Fatalf("counting version rows for %s: %v", id, err) + } + if afterCount != repairedCount+1 { + t.Errorf("version row count for %s went from %d to %d across an update-shaped mutation after the "+ + "repair, want exactly +1", id, repairedCount, afterCount) + } +} + // RunParticipationGenerationFenceIgnoresSchemaSkewHatch pins design §16.2(c): // BD_IGNORE_SCHEMA_SKEW=1 downgrades CheckForwardDrift's refusal to a warning // (internal/storage/schema/schema.go), but it must have no effect on this diff --git a/internal/storage/dolt/dualwrite_participation_generation_contract_test.go b/internal/storage/dolt/dualwrite_participation_generation_contract_test.go index e2c93bfe2..140773eff 100644 --- a/internal/storage/dolt/dualwrite_participation_generation_contract_test.go +++ b/internal/storage/dolt/dualwrite_participation_generation_contract_test.go @@ -50,6 +50,9 @@ func TestParticipationGenerationFence(t *testing.T) { t.Run("UnflaggedWispCreateMintsNothing", func(t *testing.T) { conformance.RunParticipationGenerationUnflaggedWispCreateMintsNothing(t, ctx, fixture) }) + t.Run("NoHistoryIssueCreateDeclaresParticipation", func(t *testing.T) { + conformance.RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation(t, ctx, fixture) + }) } // TestParticipationGenerationFence_FenceIgnoresSchemaSkewHatch pins the same @@ -104,6 +107,9 @@ func TestParticipationGenerationFixtureKitIsWired(t *testing.T) { if fixture.CreateUnflaggedWisp == nil { t.Error("ParticipationGenerationFixture.CreateUnflaggedWisp is nil") } + if fixture.CreateNoHistoryIssue == nil { + t.Error("ParticipationGenerationFixture.CreateNoHistoryIssue is nil") + } if fixture.CurrentRevision == nil { t.Error("ParticipationGenerationFixture.CurrentRevision is nil") } @@ -271,6 +277,15 @@ func buildParticipationGenerationFixture(store *DoltStore, configurer storage.Ve WispPlaneOverride: &wispPlane, }}, "actor", storage.BatchCreateOptions{SkipPrefixValidation: true}) }, + CreateNoHistoryIssue: func(ctx context.Context, id string) error { + // Import's promoted-no-history shape (bd-r9uce): the flag stays on + // the row, and the override pins it to the issues table. + durable := false + return store.CreateIssuesWithFullOptions(ctx, []*types.Issue{{ + ID: id, Title: "t-" + id, IssueType: types.TypeTask, Status: types.StatusOpen, + NoHistory: true, WispPlaneOverride: &durable, + }}, "actor", storage.BatchCreateOptions{SkipPrefixValidation: true}) + }, CurrentRevision: func(ctx context.Context, id string) (int64, error) { var revision int64 err := store.db.QueryRowContext(ctx, `SELECT current_revision FROM issues WHERE id = ?`, id). diff --git a/internal/storage/embeddeddolt/create_batch_participation_generation_test.go b/internal/storage/embeddeddolt/create_batch_participation_generation_test.go index a1282e657..1f16fbadd 100644 --- a/internal/storage/embeddeddolt/create_batch_participation_generation_test.go +++ b/internal/storage/embeddeddolt/create_batch_participation_generation_test.go @@ -338,6 +338,51 @@ func TestCreateBatchParticipationGeneration(t *testing.T) { } }) + t.Run("NoHistoryRowIsStampedUnversionedAndKeepsTheCallersUpdatedAt", func(t *testing.T) { + ctx := t.Context() + te := newTestEnv(t, "pgn") + te.store.SetVersionedHistoryEnabled(true) + + // Import's promoted-no-history shape (bd-r9uce): a durable row whose + // stray no_history=true is preserved while the override pins it to the + // issues table. The create declares participation without minting a + // version, and that stamp is an UPDATE too, so it must keep the + // supplied updated_at the same way the minting stamp does. + supplied := time.Date(2026, 1, 2, 3, 4, 5, 0, time.UTC) + ids := batchIDs("pgn", 5) + batch := make([]*types.Issue, 0, len(ids)) + for _, id := range ids { + issue := newBatchIssue(id, "imported no-history row "+id) + issue.CreatedAt, issue.UpdatedAt = supplied, supplied + durable := false + issue.NoHistory, issue.WispPlaneOverride = true, &durable + batch = append(batch, issue) + } + if err := te.store.CreateIssues(ctx, batch, batchActor); err != nil { + t.Fatalf("CreateIssues of %d rows: %v", len(ids), err) + } + + snap := snapshotBatch(t, ctx, te) + if !snap.epoch.Valid { + t.Fatalf("store_epoch has no row after the batch, so nothing stamped the %d rows", len(ids)) + } + for _, id := range ids { + row, found := snap.row(id) + if !found || row.generation != (sql.NullInt64{Int64: snap.epoch.Int64, Valid: true}) { + t.Errorf("%s: row %v after the batch, want it on the issues plane stamped with store epoch %d", + id, row, snap.epoch.Int64) + } + if versions := snap.versionsOf(id); len(versions) != 0 { + t.Errorf("%s: issue_versions rows %v after the batch, want none for a no-history row", id, versions) + } + var got time.Time + te.queryScalar(t, ctx, "SELECT updated_at FROM issues WHERE id = ?", []any{id}, &got) + if !got.UTC().Equal(supplied) { + t.Errorf("%s: updated_at is %v after the batch, want the supplied %v", id, got.UTC(), supplied) + } + } + }) + t.Run("HistoryOffLeavesNull", func(t *testing.T) { const rows = 5 batch := createBatch(t, "pgo", rows, false, false) diff --git a/internal/storage/embeddeddolt/dualwrite_participation_generation_contract_test.go b/internal/storage/embeddeddolt/dualwrite_participation_generation_contract_test.go index 638436da2..06c9a8b84 100644 --- a/internal/storage/embeddeddolt/dualwrite_participation_generation_contract_test.go +++ b/internal/storage/embeddeddolt/dualwrite_participation_generation_contract_test.go @@ -58,6 +58,9 @@ func TestParticipationGenerationFence(t *testing.T) { t.Run("UnflaggedWispCreateMintsNothing", func(t *testing.T) { conformance.RunParticipationGenerationUnflaggedWispCreateMintsNothing(t, ctx, fixture) }) + t.Run("NoHistoryIssueCreateDeclaresParticipation", func(t *testing.T) { + conformance.RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation(t, ctx, fixture) + }) } // TestParticipationGenerationFixtureKitIsWired is this leg's half of the @@ -98,6 +101,9 @@ func TestParticipationGenerationFixtureKitIsWired(t *testing.T) { if fixture.CreateUnflaggedWisp == nil { t.Error("ParticipationGenerationFixture.CreateUnflaggedWisp is nil") } + if fixture.CreateNoHistoryIssue == nil { + t.Error("ParticipationGenerationFixture.CreateNoHistoryIssue is nil") + } if fixture.CurrentRevision == nil { t.Error("ParticipationGenerationFixture.CurrentRevision is nil") } @@ -183,6 +189,15 @@ func newEmbeddedParticipationGenerationFixture(t *testing.T, te *testEnv, prefix WispPlaneOverride: &wispPlane, }}, "actor", storage.BatchCreateOptions{SkipPrefixValidation: true}) }, + CreateNoHistoryIssue: func(ctx context.Context, id string) error { + // Import's promoted-no-history shape (bd-r9uce): the flag stays on + // the row, and the override pins it to the issues table. + durable := false + return store.CreateIssuesWithFullOptions(ctx, []*types.Issue{{ + ID: id, Title: "t-" + id, IssueType: types.TypeTask, Status: types.StatusOpen, + NoHistory: true, WispPlaneOverride: &durable, + }}, "actor", storage.BatchCreateOptions{SkipPrefixValidation: true}) + }, CurrentRevision: func(ctx context.Context, id string) (int64, error) { var revision int64 err := kit.QueryScalar(ctx, "SELECT current_revision FROM issues WHERE id = ?", []any{id}, &revision) diff --git a/internal/storage/issueops/version_history.go b/internal/storage/issueops/version_history.go index 13e05d383..dde532244 100644 --- a/internal/storage/issueops/version_history.go +++ b/internal/storage/issueops/version_history.go @@ -250,7 +250,10 @@ func RecordVersionInTx(ctx context.Context, tx DBTX, issueID, actor string) erro // from a true legacy row (FR-7). A wisp arriving on the issues plane, by // promotion or a persistence move out of the wisps table, mints through here // too: its issues row is just as new, and a wisp never declares -// participation (FR-8). +// participation (FR-8). A new issues-table row that carries NoHistory (or a +// stray Ephemeral) is stamped but not versioned: no-history keeps it out of +// history for now, but it was created with the flag on, so it is not +// legacy once that flag is repaired. func RecordVersionForCreateInTx(ctx context.Context, tx DBTX, issueID, actor string) error { return recordVersionInTx(ctx, tx, issueID, actor, true) } @@ -264,7 +267,10 @@ func recordVersionInTx(ctx context.Context, tx DBTX, issueID, actor string, isCr if err != nil { return fmt.Errorf("versioned history: snapshot %s: %w", issueID, err) } - if IsWisp(issue) { + // A flagged row (Ephemeral || NoHistory) is never versioned, so an + // update-shaped call has nothing to do. A create-shaped one may still + // have to declare participation; see the IsWisp branch below. + if IsWisp(issue) && !isCreate { return nil } @@ -282,8 +288,8 @@ func recordVersionInTx(ctx context.Context, tx DBTX, issueID, actor string, isCr // per-row data. // // THE TABLE THAT HOLDS THE ROW decides its plane, not its flags. IsWisp - // above reads Ephemeral || NoHistory, and a wisps-table row can carry - // neither: bd mol squash clears a wisp root's flag in place, and import's + // reads Ephemeral || NoHistory, and a wisps-table row can carry neither: + // bd mol squash clears a wisp root's flag in place, and import's // "wisp_plane" marker routes an unflagged row to wisps. Such a row passes // IsWisp, but there is no issues row for it, so this read finds nothing. // No issues row means nothing to version (FR-8), for an update- or a @@ -300,6 +306,30 @@ func recordVersionInTx(ctx context.Context, tx DBTX, issueID, actor string, isCr } return fmt.Errorf("versioned history: read participation_generation for %s: %w", issueID, err) } + if IsWisp(issue) { + // Only a create-shaped call gets here: an issues-table row that + // carries NoHistory (or a stray Ephemeral). It is not versioned while + // its flags say so, so this mints nothing. But it is brand new on the + // issues plane with the flag on, so it is not legacy, and the create + // still declares its participation. Import keeps a promoted + // no-history row on the issues plane exactly this way (bd-r9uce). + // When bd update --persistent later repairs the flag in place, that + // repair mints update-shaped (MoveIssuePersistenceInTx), and left + // NULL here the fence would read the row as legacy for good. Same + // source and same updated_at rule as the stamp at the end of this + // function. + epoch, err := readStoreEpochInTx(ctx, tx) + if err != nil { + return err + } + if _, err := tx.ExecContext(ctx, + "UPDATE issues SET participation_generation = ?, updated_at = updated_at WHERE id = ?", + epoch, issueID, + ); err != nil { + return fmt.Errorf("versioned history: stamp participation_generation for %s: %w", issueID, err) + } + return nil + } if !isCreate && !participationGeneration.Valid { return nil } @@ -329,21 +359,9 @@ func recordVersionInTx(ctx context.Context, tx DBTX, issueID, actor string, isCr } issue.Dependencies = deps[issueID] - // store_epoch is one shared row (id = 1) that every minting transaction - // reads. Read first and seed only when the row is absent, so the seed - // INSERT happens once per store rather than once per mint: an INSERT IGNORE - // on every mint put that shared row into every write transaction's - // footprint for nothing. - var epoch int - err = tx.QueryRowContext(ctx, "SELECT epoch FROM store_epoch WHERE id = 1").Scan(&epoch) - if errors.Is(err, sql.ErrNoRows) { - if _, seedErr := tx.ExecContext(ctx, "INSERT IGNORE INTO store_epoch (id, epoch) VALUES (1, 1)"); seedErr != nil { - return fmt.Errorf("versioned history: seed store epoch: %w", seedErr) - } - err = tx.QueryRowContext(ctx, "SELECT epoch FROM store_epoch WHERE id = 1").Scan(&epoch) - } + epoch, err := readStoreEpochInTx(ctx, tx) if err != nil { - return fmt.Errorf("versioned history: read store epoch: %w", err) + return err } var newRevision int64 @@ -392,3 +410,26 @@ func recordVersionInTx(ctx context.Context, tx DBTX, issueID, actor string, isCr } return nil } + +// readStoreEpochInTx reads store_epoch.epoch as of tx, the source of both a +// version row's epoch and a participation_generation stamp. +// +// store_epoch is one shared row (id = 1) that every minting transaction +// reads. Read first and seed only when the row is absent, so the seed +// INSERT happens once per store rather than once per mint: an INSERT IGNORE +// on every mint put that shared row into every write transaction's +// footprint for nothing. +func readStoreEpochInTx(ctx context.Context, tx DBTX) (int, error) { + var epoch int + err := tx.QueryRowContext(ctx, "SELECT epoch FROM store_epoch WHERE id = 1").Scan(&epoch) + if errors.Is(err, sql.ErrNoRows) { + if _, seedErr := tx.ExecContext(ctx, "INSERT IGNORE INTO store_epoch (id, epoch) VALUES (1, 1)"); seedErr != nil { + return 0, fmt.Errorf("versioned history: seed store epoch: %w", seedErr) + } + err = tx.QueryRowContext(ctx, "SELECT epoch FROM store_epoch WHERE id = 1").Scan(&epoch) + } + if err != nil { + return 0, fmt.Errorf("versioned history: read store epoch: %w", err) + } + return epoch, nil +} diff --git a/internal/storage/leg_contract_wiring_test.go b/internal/storage/leg_contract_wiring_test.go index 36d283ea9..769c52334 100644 --- a/internal/storage/leg_contract_wiring_test.go +++ b/internal/storage/leg_contract_wiring_test.go @@ -121,16 +121,17 @@ func init() { "RunLifecycleUpdateExpectedVersionSingleWinnerWithDisjointColumnsUnderConcurrency": issuePatchFieldsNotOnUpdateWireWaiverReason, "RunLifecycleUpdateExpectedVersionSingleWinnerAcrossUpdateAndCloseUnderConcurrency": issuePatchFieldsNotOnUpdateWireWaiverReason, - "RunParticipationGenerationCreateWithFlagOffLeavesLegacyNull": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationCreateWithFlagOnStampsAValue": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationFenceIgnoresSchemaSkewHatch": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationProceedsForPromotedRecord": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationSkipsUpdateOnLegacyRecord": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationUnflaggedWispCreateMintsNothing": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationWispFlagClearMintsNothing": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationWispPersistenceMoveBeginsHistory": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationWispPromotionBeginsHistory": participationGenerationRawStoreWaiverReason, - "RunParticipationGenerationWispRootSquashMintsNothing": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationCreateWithFlagOffLeavesLegacyNull": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationCreateWithFlagOnStampsAValue": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationFenceIgnoresSchemaSkewHatch": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationProceedsForPromotedRecord": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationSkipsUpdateOnLegacyRecord": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationUnflaggedWispCreateMintsNothing": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationWispFlagClearMintsNothing": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationWispPersistenceMoveBeginsHistory": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationWispPromotionBeginsHistory": participationGenerationRawStoreWaiverReason, + "RunParticipationGenerationWispRootSquashMintsNothing": participationGenerationRawStoreWaiverReason, }) } diff --git a/internal/storage/uow/dualwrite_participation_generation_contract_test.go b/internal/storage/uow/dualwrite_participation_generation_contract_test.go index 573581ada..e875dcfa0 100644 --- a/internal/storage/uow/dualwrite_participation_generation_contract_test.go +++ b/internal/storage/uow/dualwrite_participation_generation_contract_test.go @@ -51,6 +51,9 @@ func TestParticipationGenerationFence(t *testing.T) { t.Run("UnflaggedWispCreateMintsNothing", func(t *testing.T) { conformance.RunParticipationGenerationUnflaggedWispCreateMintsNothing(t, ctx, fixture) }) + t.Run("NoHistoryIssueCreateDeclaresParticipation", func(t *testing.T) { + conformance.RunParticipationGenerationNoHistoryIssueCreateDeclaresParticipation(t, ctx, fixture) + }) } // TestParticipationGenerationFixtureKitIsWired is this leg's half of the @@ -90,6 +93,9 @@ func TestParticipationGenerationFixtureKitIsWired(t *testing.T) { if fixture.CreateUnflaggedWisp == nil { t.Error("ParticipationGenerationFixture.CreateUnflaggedWisp is nil") } + if fixture.CreateNoHistoryIssue == nil { + t.Error("ParticipationGenerationFixture.CreateNoHistoryIssue is nil") + } if fixture.CurrentRevision == nil { t.Error("ParticipationGenerationFixture.CurrentRevision is nil") } @@ -186,6 +192,13 @@ func newUOWParticipationGenerationFixture(t *testing.T, ctx context.Context, pre ID: id, Title: "t-" + id, IssueType: types.TypeTask, Status: types.StatusOpen, }, "actor") }, + CreateNoHistoryIssue: func(ctx context.Context, id string) error { + // CreateIssue routes by the call, so the NoHistory flag rides on an + // issues-table row without moving it to the wisps table. + return kit.CreateIssue(ctx, &types.Issue{ + ID: id, Title: "t-" + id, IssueType: types.TypeTask, Status: types.StatusOpen, NoHistory: true, + }, "actor") + }, CurrentRevision: func(ctx context.Context, id string) (int64, error) { var revision int64 err := kit.QueryScalar(ctx, "SELECT current_revision FROM issues WHERE id = ?", []any{id}, &revision)