Account merge saga: Confirm with consent record and sealed proofs, one crash-safe step function for the Heimdall move and reversal, one merge loop
AccountMergeSaga is the only caller of the move client and the only writer of Confirmed, HeimdallMoved, Failed, UndoRequested and HeimdallReversed; the ledger keeps Committed, Final and Undone. Migration AddAccountMergeSaga adds the saga columns and the two move-id keys; its Down is roll-forward only. AccountMergeSweeper becomes the one loop: saga advance, then finalize, every 30 s. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c62166c6ce
commit
cdf64b2a10
8 changed files with 726 additions and 5 deletions
|
|
@ -28,9 +28,18 @@ namespace Bifrost.Web.Data.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Attempts")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset?>("CommittedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("ConfirmedByUserAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("ConfirmedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
|
|
@ -45,24 +54,75 @@ namespace Bifrost.Web.Data.Migrations
|
|||
b.Property<DateTimeOffset?>("FinalizedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("FoldedProofProviders")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("character varying(120)");
|
||||
|
||||
b.Property<Guid>("FoldedUserAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("GraceEndsUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("HeimdallMoveId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("HeimdallReverseMoveId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("LastOutcome")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("MovedIdentityIds")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset?>("NextAttemptUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("PreviewDigest")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("ProofFromTier")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("character varying(8)");
|
||||
|
||||
b.Property<string>("ProofToTier")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("character varying(8)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ReversedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SealedProofs")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.HasMaxLength(24)
|
||||
.HasColumnType("character varying(24)");
|
||||
|
||||
b.Property<string>("SurvivorProofProvider")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<Guid>("SurvivorUserAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("UndoneUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("UndoRequestedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FoldedUserAccountId")
|
||||
|
|
@ -72,6 +132,14 @@ namespace Bifrost.Web.Data.Migrations
|
|||
|
||||
b.HasIndex("FoldedUserAccountId", "State");
|
||||
|
||||
b.HasIndex("HeimdallMoveId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"HeimdallMoveId\" IS NOT NULL");
|
||||
|
||||
b.HasIndex("HeimdallReverseMoveId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"HeimdallReverseMoveId\" IS NOT NULL");
|
||||
|
||||
b.HasIndex("State", "GraceEndsUtc");
|
||||
|
||||
b.HasIndex("SurvivorUserAccountId", "State");
|
||||
|
|
|
|||
Loading…
Reference in a new issue