↑↓ to navigate Enter to open "…" all these words ANDOR to combine

Architecture Decision Record

ADR-107: Transaction Execution and Commit-Ambiguity Contract

Status

Accepted (2026-09-03; adoption counts and consumer state re-measured 2026-09-19). Revised 2026-09-25 (MMCA.ADC's ITransactional count corrected to six, adding BatchAddEventQuestionAnswersCommand; the direct-caller anchors and the Store package pin refreshed; Store's CheckOutHandler documentation now cites this record for the commit-once behavior and names all three pre-flight reads, so the two trade-offs that described its comments as stale are retired). Revised 2026-10-01 (the commit phase now saves enrolled internal-command rows and refuses any other unsaved tracked change before committing, and MMCA.ADC's count is five with RefreshFromSessionizeCommand a documented opt-out; see Revision below). Revised 2026-10-06: the commit phase also releases the internal-command processor wake after a successful commit and drops it on every other path, MMCA.ADC's count is six with DeleteSessionAssetCommand, and three more ADC direct callers are listed. Revised 2026-10-07: anchors refreshed after the v1.233.0 release. Revised 2026-10-21: since v1.247.0 every thrown exception, not only a cancellation, rolls back best-effort and rethrows the original even when the rollback itself throws, a sixth commit-ambiguity test pins that, and anchors are refreshed after the v1.250.0 release. Revised 2026-10-26: the Context and Decision item 3 now name PostgreSQL alongside SQL Server as a retrying engine under the same contract (a SQLite unit runs under a non-retrying strategy), and anchors are refreshed after the v1.261.0 release. Revised 2026-10-28: Store gains a fifth documented opt-out and a fourth direct caller (guest checkout), the CheckOutHandler trade-off now records that its pre-flight also maps delivery and quotes shipping and tax outside the transaction, and anchors are refreshed after the v1.265.1 release. Revised 2026-11-23: MMCA.ADC's ITransactional count is ten (three Engagement commands and a second Identity command) with a second documented opt-out, Store's is four with Identity's DeleteUserCommand, the framework's own SendPushNotificationCommand and two framework direct callers are listed, Store's OrderCancelledSagaHandler now reaches the method through ProcessDomainEventHandlerBase, the CheckOutHandler class doc now names the quote as well, and anchors are refreshed after the v1.315.0 release.

Context

Every transactional write in this workspace funnels through one method. IUnitOfWork.ExecuteInTransactionAsync (MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IUnitOfWork.cs:63) is the Application-layer name for it, UnitOfWork forwards straight through (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/UnitOfWork.cs:91-94), and the implementation is DbContextFactory.ExecuteInTransactionAsync (.../Infrastructure/Persistence/DbContexts/Factory/DbContextFactory.cs:578, contract at .../Factory/IDbContextFactory.cs:70). Two kinds of caller reach it: the ADR-014 pipeline, whose TransactionalCommandDecorator calls it for any command carrying ITransactional (.../Application/UseCases/Decorators/TransactionalCommandDecorator.cs:33), and a handler or service that calls it directly.

The name suggests "begin, do work, commit". The behavior is materially more specific, and every one of those specifics is a durability decision. The delegate runs under EF Core's execution strategy, which for SQL Server and PostgreSQL alike is a retrying one with the same budget: EnableRetryOnFailure(maxRetryCount: 5, maxRetryDelay: TimeSpan.FromSeconds(10)) (.../Persistence/DbContexts/SQLServerDbContext.cs:63-66, .../Persistence/DbContexts/PostgreSQLDbContext.cs:102-105). So the delegate can run more than once, the change tracker has to be reset between attempts, in-process event dispatch has to be held back until the data is durable, and a failure of the commit itself must not be retried at all because its outcome is unknown.

The neighbouring records decide around this without deciding it. ADR-014 decides that the Transactional decorator wraps a command and rolls back on failure, including on a returned failed Result. ADR-006 lists "no cross-database FKs or transactions" as a trade-off of database-per-service (006-database-per-service.md:87). ADR-054 cites "transactions are per data source and best-effort sequential" as a given it builds compensation on top of (054-saga-compensation-and-reconciliation.md:266-267). Nothing in ADR-001 through ADR-106 records the execution, retry and ambiguity contract itself, which is the layer all three depend on.

Decision

ExecuteInTransactionAsync is a re-entrant, retriable, commit-once unit: the whole delegate is the retriable work, the commit phase is deliberately outside the retry, and a commit whose outcome cannot be known is reported as TransactionCommitAmbiguousException naming what each physical source did rather than being retried or swallowed.

  1. One entry point, per-scope state. IDbContextFactory and IUnitOfWork are both registered scoped (.../Infrastructure/DependencyInjection.cs:109, :131), and the transaction flag is an instance field (DbContextFactory.cs:87), so the whole contract below is per request scope. BeginTransaction enlists every transaction-capable context and skips one already carrying a transaction (:487-497, :495); a context materialized later in the same scope is enlisted on creation (:119-120).

  2. A re-entrant call joins the ambient transaction instead of nesting. When the flag is already set, the method awaits the operation and returns its result directly (:589-590). Begin, commit, rollback and the deferred-event flush belong to the outermost call alone (:531-534), because an inner commit would make the outer scope's earlier work durable ahead of its own decision. Before this, an ITransactional command whose handler also opened a transaction hit an InvalidOperationException from EF (:582-588). Two tests pin the behavior: ExecuteInTransactionAsync_Nested_DoesNotThrowAndCommitsOnce and ExecuteInTransactionAsync_NestedInnerSucceedsButOuterFails_RollsBackEverything (MMCA.Common/Tests/Core/MMCA.Common.Infrastructure.Tests/Persistence/DbContexts/DbContextFactoryTransactionTests.cs:133, :163).

  3. The whole delegate is the retriable unit, and each attempt starts from a clean change tracker. The strategy comes from the first transaction-capable context, or from a default context created on the spot so one exists before the handler's first repository call; that default context's engine goes through the data-source resolver (ResolveLogical) rather than being taken literally as SQL Server (:598-599), so in a host that does not configure SQL Server it is the engine the host does configure (.../Persistence/DataSources/DataSourceResolver.cs:97, :110-118). Every relational engine is transaction-capable (DbContextFactory.cs:899-900), and that includes SQLite (.../DataSources/Engines/SqliteDataSourceEngine.cs:41). A SQL Server or PostgreSQL unit runs under a retrying strategy (SQLServerDbContext.cs:63-66, PostgreSQLDbContext.cs:102-105), so the rules below cover a PostgreSQL unit exactly as they cover a SQL Server one. A SQLite unit runs under a non-retrying strategy, because SqliteDbContext configures no EnableRetryOnFailure (.../Persistence/DbContexts/SqliteDbContext.cs:23-33); the reset, commit-once and ambiguity rules still apply to it, but a transient failure is never retried. The delegate is invoked inside strategy.ExecuteAsync (:605-613). From the second attempt on, ResetForRetry runs first (:607-608): it drops deferred dispatch and calls ChangeTracker.Clear() on every context (:875-882). Without it, entities the failed attempt added are still Added and the retry inserts them a second time, with a duplicate outbox row per event (:552-556). Anything the commit depends on therefore has to be produced inside the delegate, once per attempt.

  4. A returned failed Result rolls back exactly like a thrown exception. The attempt inspects the result and calls RollbackTransaction() when IsFailure is true (:642-648), which is the ADR-013 accommodation: a framework that mandates Result-over-exceptions cannot let a handler that saves and then fails a later invariant leave the partial mutation committed. A thrown exception, cancellation and failure alike, goes through one catch that rolls back best-effort and rethrows the original exception (:674-682): RollbackBestEffort swallows a rollback that itself throws (the connection may already be closed or the transaction zombied by the fault being reported), clears the transaction flag and drops every context's deferred work, which is what a successful rollback would have done (:690-704). Rethrowing the original matters because the execution strategy judges retriability on the exception it sees, so a rollback error must never replace the transient one. On a successful result, FlushEnrolledCommandsBeforeCommitAsync runs ahead of the commit (:652): when every pending change is an Added InternalCommandMessage (an internal command scheduled after the handler's last save and enrolled on the context), it saves them inside the transaction so they commit with the caller's change, and any other unsaved tracked change throws InvalidOperationException, which the same catch turns into a rollback, because committing would silently discard it while the unit reported success (:716-742, the throw at :735-738).

  5. The commit is never retried. TryCommit returns its failure instead of throwing it (:628-632, :654-656) so the execution strategy sees a completed attempt, and the failure is thrown outside the strategy afterwards (:619-620). Throwing inside would not work: the strategy classifies retriability by walking the whole inner exception chain, so even a wrapper carrying the transient commit error would be retried (:615-618). The reason the commit is excluded is that its outcome is unknowable, since a commit can fail after the database applied it but before the acknowledgement reached the client, and a retry against a possibly-durable commit duplicates every write including the outbox rows (:559-564, and on the exception type at .../Factory/TransactionCommitAmbiguousException.cs:9-13).

  6. The failure names what each physical source did. TryCommit snapshots the enlisted contexts in commit order, commits them in turn, and on a throw builds the ambiguity from three groups: the sources already committed, the one that threw, and the ones after it in the order that never committed (DbContextFactory.cs:754-788). TransactionCommitAmbiguousException is public and sealed (TransactionCommitAmbiguousException.cs:22) and exposes CommittedSources (:76), AmbiguousSource (:85) and RolledBackSources (:93); its message is the default ambiguity text plus a "Per-source outcome" clause that omits empty groups, so a single-source failure reads as one clause rather than three (:99-118). With one transactional source, the case every host runs today, the ambiguous source is the whole outcome (:80-83).

  7. Rollback after a commit failure is best-effort in the literal sense. AbandonAfterCommitFailure rolls back whatever is still open and swallows a rollback that itself throws, on the grounds that the transaction is already zombied or the connection is gone and the commit ambiguity is the failure worth reporting (DbContextFactory.cs:797-820, the swallow at :813-818). A source listed in RolledBackSources therefore wrote nothing that survives (TransactionCommitAmbiguousException.cs:88-91).

  8. Deferred in-process dispatch is flushed only after a successful commit, and dropped on every other path. Handlers deferred while a transaction is open are flushed per context immediately after the commit succeeds (DbContextFactory.cs:666-670, .../Persistence/Interceptors/DomainEventSaveChangesInterceptor.cs:162). RollbackTransaction drops them (DbContextFactory.cs:511-522, DomainEventSaveChangesInterceptor.cs:179), and so do ResetForRetry between attempts and AbandonAfterCommitFailure after an ambiguous commit (:879, :803). The processor wake owed by internal commands enrolled in the unit follows the same rule: EnrolledCommandWake.Release runs right after a successful commit and ahead of the event flush, so a throwing in-process handler cannot swallow it (DbContextFactory.cs:658-661, and :508 in CommitTransaction), and every drop path above goes through DropDeferredWork, which drops the owed wake together with the deferred dispatch (:889-893; the remark at :547-549). The consequence is stated on the exception: after an ambiguous commit the outbox rows are the only delivery record that survives, and the outbox processor delivers them if the commit did land (TransactionCommitAmbiguousException.cs:16-19).

  9. The witness row that would close a partial multi-source commit is deliberately not built. With several sources the commits are sequential, so a failure on the second leaves the first durable: the ambiguity is a partial commit rather than an unknown one, and the caller's replay is what reconciles it. A marker written inside each source's transaction that a replay could read to learn what landed would close this, and the code says it is not built because a single transactional source needs none (DbContextFactory.cs:567-575). Reporting the per-source outcome is what makes the partial state observable in the meantime.

  10. Cosmos is outside the mechanism entirely. SupportsTransactions is true only for a relational engine (context.Engine.Capabilities.IsRelational, DbContextFactory.cs:899-900), so it is false for a Cosmos context, and begin, commit and rollback all filter on it (:495, :502, :514), so a Cosmos context in the same scope is neither enlisted nor rolled back and is never named in an ambiguity report.

  11. Recovery belongs to the caller, and today that means the ADR-017 idempotency filter. The remarks say so (:563-564), and the exception is part of the frozen public surface (.../MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:568-576), which is what makes it a contract a caller can bind to rather than an internal detail. No framework or consumer code catches it: across the four repos the type is referenced in code only by the two files that define it and by .../MMCA.Common.Infrastructure.Tests/Persistence/DbContexts/DbContextFactoryCommitAmbiguityTests.cs, whose six cases pin the no-rerun wrapper, the dropped dispatch, the ordinary commit path, the still-retried pre-commit failure, the original failure surviving a rollback that throws, and the per-source report (:73, :108, :132, :152, :171, :193). The one consumer mention is prose: Store's CheckOutHandler remarks name it and hand recovery to the [Idempotent] filter (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Application/ShoppingCarts/UseCases/CheckOut/CheckOutHandler.cs:135-140).

  12. Adoption is deliberately narrow. The framework ships one ITransactional command of its own, SendPushNotificationCommand (MMCA.Common/Source/Core/MMCA.Common.Application/Notifications/PushNotifications/UseCases/Send/SendPushNotificationCommand.cs:23), and documents one internal-command handler as not ITransactional because it records its outcome on its own save (.../Application/Webhooks/Delivery/DeliverWebhookInternalCommandHandler.cs:16). MMCA.ADC has ten ITransactional commands: five in Conference (LinkUserToSpeakerCommand.cs:13, UnlinkUserFromSpeakerCommand.cs:12, BatchAddSessionQuestionAnswersCommand.cs:24, BatchAddEventQuestionAnswersCommand.cs:24, DeleteSessionAssetCommand.cs:16), three in Engagement (DeleteTicketRosterCommand.cs:10, LinkExistingAccountsCommand.cs:11, StartTicketRosterImportCommand.cs:18) and two in Identity (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/DeleteUser/DeleteUserCommand.cs:22, which carries the flag so the erasure lands as one write, and RedeemSignInLinkCommand.cs:23), plus two documented opt-outs: RefreshFromSessionizeCommand.cs:9 ("Deliberately NOT ITransactional", because its handler saves the throttle stamp on its own before the Sessionize call and then wraps the entity syncs and their save in an explicit transaction of its own, so it is a direct caller rather than a non-transactional path) and Engagement's ProcessTicketRosterImportInternalCommand.cs:16 ("Not ITransactional either"). MMCA.Store has four (AddVariantCommand.cs:25, ReorderProductImagesCommand.cs:24, UploadProductImageCommand.cs:27, and Identity's MMCA.Store/Source/Modules/Identity/MMCA.Store.Identity.Application/Users/UseCases/DeleteUser/DeleteUserCommand.cs:25, which carries the flag for the same one-write erasure) plus five commands whose XML doc records a deliberate opt-out ("Deliberately NOT ITransactional": VerifyPaymentCommand.cs:11, ProcessPaymentWebhookCommand.cs:9, CheckOutCommand.cs:10 and BulkSetInventoryCommand.cs:11; the fifth, GuestCheckOutCommand.cs:8-9, words it "Deliberately not ITransactional, for the reason CheckOutCommand gives"), and MMCA.Helpdesk has none. Direct callers are the framework's own EFRefreshSessionStore rotation (.../Infrastructure/Persistence/Auth/EFRefreshSessionStore.cs:317), its process-manager step base ProcessDomainEventHandlerBase (MMCA.Common/Source/Core/MMCA.Common.Application/ProcessManagers/ProcessDomainEventHandlerBase.cs:52) and its webhook fan-out (.../Application/Webhooks/Delivery/WebhookFanOutHandler.cs:101); ADC's AuthenticationService for both registration and external login (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/AuthenticationService.cs:88, :289), ADC's RefreshFromSessionizeHandler (RefreshFromSessionizeHandler.cs:162), DeleteSessionHandler and DeleteEventHandler (DeleteSessionHandler.cs:47, DeleteEventHandler.cs:43, which open the transaction themselves because the shared CRUD delete command is not ITransactional), ADC's SessionScoringRunner (SessionScoringRunner.cs:166, in a scope of its own), and Store's CheckOutHandler (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Application/ShoppingCarts/UseCases/CheckOut/CheckOutHandler.cs:106), GuestCheckOutHandler (.../Orders/UseCases/GuestCheckout/GuestCheckOutHandler.cs:65) and UserRegisteredHandler (UserRegisteredHandler.cs:66). Store's OrderCancelledSagaHandler reaches the method through the framework base it derives (OrderCancelledSagaHandler.cs:52) rather than calling it itself, and MMCA.Helpdesk has no direct caller.

Rationale

  • Retrying the operation is safe; retrying the commit is not. A transient failure before the commit leaves nothing durable, so re-running the delegate against a cleared change tracker is the cheap, correct recovery. A transient failure of the commit is a different class of event: the write may already exist. Splitting the two is the whole point of returning the commit failure out of the strategy instead of throwing it inside.
  • An unknown outcome should be reported, not guessed. The alternatives are retrying (which duplicates whatever landed) or swallowing (which reports success for work that may not exist). Naming the ambiguity, with the provider failure as the inner exception, is the only option that leaves the caller able to do something correct.
  • Per-source outcomes cost nothing and make partial state observable. The commit loop already knows the order it is walking, so recording which sources committed, which threw and which never ran is bookkeeping on a path that is already failing, and it turns "something went wrong somewhere" into a message a human can act on.
  • Joining a re-entrant call beats forbidding one. The alternative is a convention that a handler under ITransactional must never open its own transaction, enforced by comments. Joining makes the nest one unit and removes a whole class of InvalidOperationException outright.
  • Post-commit dispatch keeps in-process handlers honest. An in-process handler that runs inside an uncommitted transaction can act on state that then rolls back. Deferring the flush until after the commit, and dropping it on every failure path, means a handler only ever sees durable state, and the outbox remains the delivery guarantee for everything else (ADR-003).

Trade-offs

  • The ambiguity is a hard failure the caller must handle, and today nobody catches it. A host with no [Idempotent] coverage on the affected endpoint surfaces it as an unhandled exception. The contract moves the problem to where it can be solved; it does not solve it.
  • A multi-source commit can leave a genuine partial commit, and the reconciliation is manual. The witness row is not built, so replay plus the outbox is the entire recovery story. That is acceptable only while every host runs a single transactional source, which is a property of today's deployments rather than a guarantee of the code.
  • The retry contract is a trap for handler authors. Anything computed outside the delegate but committed inside it is silently wrong on the second attempt, and the change-tracker reset makes the failure quiet rather than loud. Store's CheckOutHandler documents exactly this: its class doc says only the pre-flight stays outside the delegate, naming the non-tracking cart snapshot, the two cross-service gRPC reads (Catalog prices and the customer's display name, run through CheckOutPreflight) and the shipping and tax quote computed from them, so their latency never holds database locks (CheckOutHandler.cs:19-21, :29-33). The code matches it: before opening the transaction it takes the snapshot, maps the delivery addresses (:70-80), runs the two gRPC reads (:87-93, CheckOutPreflight.ResolveAsync at :89-91) and quotes shipping and tax through QuoteChargesAsync (:95-104, the call at :100-102), all once per checkout (:57-104). The tax quote reaches Stripe only when Tax:Enabled is on: while it is off, the default (TaxSettings.cs:18), and set in no Store appsettings, bicep or workflow file, StripeTaxCalculator returns zero tax with no Stripe call (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Infrastructure/Payments/Stripe/StripeTaxCalculator.cs:18-19, :40-41; section name TaxSettings.cs:15), so the network round trip the handler's comment names is opt-in. The write-phase remarks explain why the whole read-execute-write unit runs inside (:126-133) and why a commit failure is not retried (:135-140, citing this record for the behavior MMCA.Common shipped in v1.135.0, MMCA.Common/CHANGELOG.md:5505, and that Store consumes at v1.315.0, MMCA.Store/Directory.Packages.props:28). That is discipline, not enforcement: nothing checks that a new handler keeps its commit dependencies inside the delegate.
  • Cosmos participation is silent. A Cosmos context in a transactional scope is skipped without a warning (DbContextFactory.cs:899-900), so a future host mixing engines gets partial atomicity with no signal at the call site.
  • The commit-order snapshot makes source order load-bearing. TryCommit enumerates the context dictionary and that enumeration order is the commit order (DbContextFactory.cs:758-763), so which source is durable after a partial failure is determined by materialization order rather than by anything the caller declared.

Revision (2026-10-01)

The commit phase gained a pre-commit step. Since v1.215.0 (MMCA.Common/CHANGELOG.md:53), a successful attempt runs FlushEnrolledCommandsBeforeCommitAsync before TryCommit (DbContextFactory.cs:653-654, defined at :695-731): internal-command rows enrolled after the handler's last save are saved inside the transaction and commit with it, and any other unsaved tracked change throws InvalidOperationException and rolls the unit back (:688-692) instead of being silently discarded. The default context created for the execution strategy now resolves its engine through _dataSourceResolver.ResolveLogical (:594-601). Decision items 3 and 4 record both. The re-entrant, retriable, commit-once and ambiguity rules are unchanged.

The 2026-09-25 count of six ADC ITransactional commands was true then and is stale now: RefreshFromSessionizeCommand dropped the flag on 2026-09-30 (ADC #227) and is now a documented opt-out (RefreshFromSessionizeCommand.cs:9), so ADC has five, four in Conference. MMCA.Store has three, since AddVariantCommand gained the flag in Store #171 (AddVariantCommand.cs:25). Every DbContextFactory.cs anchor was refreshed after the file grew, along with the IUnitOfWork, UnitOfWork, TransactionalCommandDecorator, DependencyInjection, nested-transaction test, PublicAPI.Shipped.txt, CheckOutHandler and CHANGELOG anchors, and the Store package pin (v1.216.0).

Revision (2026-10-06)

  • The commit phase now also wakes the internal-command processor: EnrolledCommandWake.Release runs right after a successful commit and before the event flush (DbContextFactory.cs:631-634, :481), and DropDeferredWork drops the owed wake on rollback, ambiguous commit and retry (:850-854). Decision item 8 records it.
  • Decision item 10 now states what SupportsTransactions actually tests, the engine's relational capability (context.Engine.Capabilities.IsRelational, :860-861), rather than naming CosmosDbContext; the Cosmos outcome is unchanged.
  • MMCA.ADC has six ITransactional commands, not five: DeleteSessionAssetCommand (DeleteSessionAssetCommand.cs:16) is a fifth Conference command. ADC's direct callers also include DeleteSessionHandler (:47), DeleteEventHandler (:43) and SessionScoringRunner (:167), and AuthenticationService moved to :86, :221.
  • Store now consumes MMCA.Common v1.232.0 (MMCA.Store/Directory.Packages.props:11); the v1.135.0 CHANGELOG heading is at MMCA.Common/CHANGELOG.md:3966 and the v1.215.0 heading cited in the 2026-10-01 revision is at :390.
  • Every DbContextFactory.cs, UnitOfWork, DependencyInjection and PublicAPI.Shipped.txt anchor in the live sections was re-verified against current source and refreshed where it had moved.

Revision (2026-10-07)

Re-verified against current source. The execution, retry, commit-once, ambiguity and deferred-dispatch rules are unchanged, every live DbContextFactory.cs anchor still holds, and MMCA.ADC still has six ITransactional commands; only the anchors and the Store package pin below moved.

  1. Anchors re-verified against current source: DomainEventSaveChangesInterceptor.FlushDeferredAsync is at MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Interceptors/DomainEventSaveChangesInterceptor.cs:160 and DropDeferred at :177; the EFRefreshSessionStore rotation calls ExecuteInTransactionAsync at .../Persistence/Auth/EFRefreshSessionStore.cs:134; the v1.135.0 CHANGELOG heading is at MMCA.Common/CHANGELOG.md:3991; Store consumes MMCA.Common v1.233.0 (MMCA.Store/Directory.Packages.props:11).

Revision (2026-10-21)

Re-verified against current source. The re-entrant, retriable, commit-once, ambiguity and deferred-dispatch rules are unchanged; the exception path of an attempt moved, a test was added, and nearly every DbContextFactory.cs anchor shifted (only :87 and :119-120 held).

  1. Decision item 4 now describes one exception path for every throw. Since v1.247.0 (MMCA.Common/CHANGELOG.md:45, entry :98, M229) a single catch handles cancellation and failure alike (DbContextFactory.cs:673-681) and calls RollbackBestEffort (:689-701), which swallows a throwing rollback, clears the transaction flag and drops every context's deferred work, then the original exception is rethrown so the execution strategy judges retriability on it rather than on the rollback error. The guarded path is no longer cancellation-only.
  2. Decision item 11 counts six commit-ambiguity cases, adding ExecuteInTransactionAsync_OperationFailsAndRollbackThrows_StrategySeesTheOriginalFailure (MMCA.Common/Tests/Core/MMCA.Common.Infrastructure.Tests/Persistence/DbContexts/DbContextFactoryCommitAmbiguityTests.cs:171); the per-source report case is now at :193.
  3. The Related entry for ADR-009 says "five-retry budget": the strategy sets maxRetryCount: 5 (.../Persistence/DbContexts/SQLServerDbContext.cs:64), which ADR-009 records as 5 retries (009-resilience-and-recovery-objectives.md:135-136).
  4. Anchors re-verified against current source: in DbContextFactory.cs, ExecuteInTransactionAsync :577, BeginTransaction :486-496 (skip filter :494), the join :588-589, the re-entrancy remark :530-533 and comment :581-587, the resolver :597-598, strategy.ExecuteAsync :604-612, the reset call :606-607, ResetForRetry :868-875, the duplicate-outbox remark :551-556, the failed-Result rollback :641-648, the enrolled-command flush call :651 and definition :713-739 (throw :730-736), the returned commit failure :653-655 (doc :627-631), the throw past the strategy :618-619 and its comment :614-617, the ambiguity remark :558-564, the caller-owns-recovery remark :562-563, TryCommit :751-783 (snapshot :755-760), AbandonAfterCommitFailure :792-813 (swallow :807-811), the post-commit flush :665-669, the wake release :657-660 and :507 in CommitTransaction, RollbackTransaction :510-521, the drops :872 and :798, DropDeferredWork :882-886, the wake remark :546-549, the witness-row remark :565-575, SupportsTransactions :892-893 and the begin, commit and rollback filters :494, :501, :513; the EFRefreshSessionStore rotation calls ExecuteInTransactionAsync at EFRefreshSessionStore.cs:184; the v1.135.0 CHANGELOG heading is at MMCA.Common/CHANGELOG.md:4310; Store consumes MMCA.Common v1.250.0 (MMCA.Store/Directory.Packages.props:11); the ADR-006 trade-off is at 006-database-per-service.md:71 and the ADR-054 premise at 054-saga-compensation-and-reconciliation.md:219-220.

Revision (2026-10-26)

Re-verified against current source. The re-entrant, retriable, commit-once, ambiguity and deferred-dispatch rules are unchanged, every live DbContextFactory.cs anchor still holds, and the ADC and Store adoption counts and remaining direct-caller anchors are unchanged; the record now names the second retrying engine, and a few anchors and the Store package pin moved.

  1. The Context and Decision item 3 name PostgreSQL alongside SQL Server. PostgreSQLDbContext calls npgsql.EnableRetryOnFailure(maxRetryCount: 5, maxRetryDelay: TimeSpan.FromSeconds(10), errorCodesToAdd: null) (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/PostgreSQLDbContext.cs:102-105), the same budget as SQLServerDbContext.cs:63-66, and the strategy is taken from the first transaction-capable context (DbContextFactory.cs:597-598), so the retriable-delegate and commit-once rules cover a PostgreSQL unit too. SQLite is also relational (SqliteDataSourceEngine.cs:41), so it is transaction-capable and can supply the strategy, including for the default context when the host configures no SQL Server (DataSourceResolver.cs:97, :110-118); SqliteDbContext sets no EnableRetryOnFailure (SqliteDbContext.cs:23-33), so a SQLite unit is not retried. The earlier text was an omission rather than a false statement.
  2. Anchors re-verified against current source: DomainEventSaveChangesInterceptor.FlushDeferredAsync is at .../Persistence/Interceptors/DomainEventSaveChangesInterceptor.cs:162 and DropDeferred at :179 (the flush call in DbContextFactory.cs is at :667, inside :665-669); the EFRefreshSessionStore rotation calls ExecuteInTransactionAsync at EFRefreshSessionStore.cs:187; ADC's AuthenticationService calls it at AuthenticationService.cs:86 and :220; the nine TransactionCommitAmbiguousException entries are at .../MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:520-528; the v1.135.0 CHANGELOG heading is at MMCA.Common/CHANGELOG.md:4525 (its TransactionCommitAmbiguousException entry at :4567), the v1.215.0 heading cited in the 2026-10-01 revision is at :949, and the v1.247.0 heading and M229 entry cited in the 2026-10-21 revision are at :260 and :313; Store consumes MMCA.Common v1.260.0 (MMCA.Store/Directory.Packages.props:11, every MMCA.Common.* entry at the same version, on :8-25, :27, :77 and :114). The anchors restated in the dated revisions above stay as written.

Revision (2026-10-28)

Re-verified against current source. The re-entrant, retriable, commit-once, ambiguity and deferred-dispatch rules are unchanged, the type is still referenced in code only by DbContextFactory.cs, TransactionCommitAmbiguousException.cs and DbContextFactoryCommitAmbiguityTests.cs, and the ADC adoption count is unchanged; Store's guest checkout adds an opt-out and a direct caller, the CheckOutHandler pre-flight grew, and several anchors and the Store package pin moved.

  1. Decision item 12 counts five Store opt-outs, adding GuestCheckOutCommand, whose XML doc says it is "Deliberately not ITransactional, for the reason CheckOutCommand gives" (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Application/Orders/UseCases/GuestCheckout/GuestCheckOutCommand.cs:8-9), and lists GuestCheckOutHandler as a fourth Store direct caller (GuestCheckOutHandler.cs:65).
  2. The retry-contract trade-off no longer says the CheckOutHandler pre-flight is only the cart snapshot plus the two gRPC reads. Before the transaction the handler also maps the delivery addresses (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Application/ShoppingCarts/UseCases/CheckOut/CheckOutHandler.cs:69-79) and quotes shipping and tax through QuoteChargesAsync (:94-102), which calls Stripe Tax only when Tax:Enabled is on; it is off by default and in every Store configuration file (StripeTaxCalculator.cs:17-18, :35-36). Its class doc (:29-32) still names only the snapshot and the two reads, and the 2026-09-25 Status sentence ("names all three pre-flight reads") was true of the code at that date.
  3. Anchors re-verified against current source: the nine TransactionCommitAmbiguousException entries are at .../MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:522-530; in CheckOutHandler.cs the ExecuteInTransactionAsync call is at :104, the pre-flight code at :56-102, the write-phase remarks at :124-131 and the commit-failure remark at :133-138; CheckOutCommand's opt-out line is at CheckOutCommand.cs:10; OrderCancelledSagaHandler.cs:55 and UserRegisteredHandler.cs:65 hold; the v1.135.0 CHANGELOG heading is at MMCA.Common/CHANGELOG.md:4568 (its TransactionCommitAmbiguousException entry at :4610), the v1.215.0 heading is at :992, and the v1.247.0 heading and M229 entry are at :303 and :356; Store consumes MMCA.Common v1.265.1 (MMCA.Store/Directory.Packages.props:11, every MMCA.Common.* entry at the same version). The anchors restated in the dated revisions above stay as written.

Revision (2026-11-23)

Re-verified against current source. The re-entrant, retriable, commit-once, ambiguity and deferred-dispatch rules are unchanged, the exception type is still referenced in code only by DbContextFactory.cs, TransactionCommitAmbiguousException.cs and DbContextFactoryCommitAmbiguityTests.cs, and the Store opt-outs hold; the adoption counts, the direct-caller list and the CheckOutHandler class doc moved, and nearly every DbContextFactory.cs anchor shifted (only :87 and :119-120 held).

  1. Decision item 12 counts ten MMCA.ADC ITransactional commands, not six. Conference's five hold; Engagement, which the record did not mention, has three (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/DeleteRoster/DeleteTicketRosterCommand.cs:10, LinkExistingAccountsCommand.cs:11, StartTicketRosterImportCommand.cs:18), and Identity has a second, RedeemSignInLinkCommand.cs:23. ADC also has a second documented opt-out, ProcessTicketRosterImportInternalCommand.cs:16.
  2. Decision item 12 counts four MMCA.Store ITransactional commands, adding Identity's MMCA.Store/Source/Modules/Identity/MMCA.Store.Identity.Application/Users/UseCases/DeleteUser/DeleteUserCommand.cs:25.
  3. Decision item 12 now opens with the framework's own adoption: SendPushNotificationCommand is ITransactional (MMCA.Common/Source/Core/MMCA.Common.Application/Notifications/PushNotifications/UseCases/Send/SendPushNotificationCommand.cs:23), and DeliverWebhookInternalCommandHandler.cs:16 documents a not-ITransactional case.
  4. The direct-caller list gains two framework callers, ProcessDomainEventHandlerBase.cs:52 and WebhookFanOutHandler.cs:101. Store's OrderCancelledSagaHandler no longer calls the method itself: it derives ProcessDomainEventHandlerBase (OrderCancelledSagaHandler.cs:52), whose step makes the call.
  5. The retry-contract trade-off no longer says the code keeps more outside the delegate than CheckOutHandler's class doc names. The doc now names the shipping and tax quote alongside the snapshot and the two gRPC reads (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Application/ShoppingCarts/UseCases/CheckOut/CheckOutHandler.cs:29-33) and routes the reads through CheckOutPreflight (:19-21). Tax:Enabled is still off by default (TaxSettings.cs:18) and set in no Store configuration file.
  6. Anchors re-verified against current source: in DbContextFactory.cs, ExecuteInTransactionAsync :578, BeginTransaction :487-497 (skip filter :495), the join :589-590, the re-entrancy remark :531-534 and comment :582-588, the resolver :598-599, strategy.ExecuteAsync :605-613, the reset call :607-608, ResetForRetry :875-882, the duplicate-outbox remark :552-556, the failed-Result rollback :642-648, the catch :674-682, RollbackBestEffort :690-704, the enrolled-command flush call :652 and definition :716-742 (throw :735-738), the returned commit failure :654-656 (doc :628-632), the throw past the strategy :619-620 and its comment :615-618, the ambiguity remark :559-564, the caller-owns-recovery remark :563-564, TryCommit :754-788 (snapshot :758-763), AbandonAfterCommitFailure :797-820 (swallow :813-818), the post-commit flush :666-670, the wake release :658-661 and :508 in CommitTransaction, RollbackTransaction :511-522, the drops :879 and :803, DropDeferredWork :889-893, the wake remark :547-549, the witness-row remark :567-575, SupportsTransactions :899-900 and the begin, commit and rollback filters :495, :502, :514; the scoped registrations are at DependencyInjection.cs:109 and :131; the nine TransactionCommitAmbiguousException entries are at .../MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:568-576; EFRefreshSessionStore calls the method at EFRefreshSessionStore.cs:317, ADC's AuthenticationService at :88 and :289, RefreshFromSessionizeHandler at :162, SessionScoringRunner at :166, Store's CheckOutHandler at :106 and UserRegisteredHandler at :66; in CheckOutHandler.cs the pre-flight is at :57-104, the delivery mapping :70-80, the gRPC reads :87-93, the quote :95-104, the write-phase remarks :126-133 and the commit-failure remark :135-140; StripeTaxCalculator.cs's off-by-default remark is at :18-19 and its zero-tax return at :40-41; the v1.135.0 CHANGELOG heading is at MMCA.Common/CHANGELOG.md:5505 (its TransactionCommitAmbiguousException entry at :5547), the v1.215.0 heading at :1929, and the v1.247.0 heading and M229 entry at :1240 and :1293; Store consumes MMCA.Common v1.315.0 (MMCA.Store/Directory.Packages.props:28, every MMCA.Common.* entry at the same version); the ADR-006 trade-off is at 006-database-per-service.md:87 and the ADR-054 premise at 054-saga-compensation-and-reconciliation.md:266-267. The anchors restated in the dated revisions above stay as written.

ADR-014 (the Transactional decorator that is the main caller, and whose 2026-07-19 revision decided the failed-Result rollback this record implements), ADR-006 (database-per-service, whose "no cross-database transactions" trade-off is what makes the sequential best-effort commit the only option), ADR-054 (compensation and reconciliation, which builds on the same per-data-source best-effort commit, though it attributes that premise in-line to ADR-006 and does not reference this record), ADR-003 (the outbox that survives an ambiguous commit, and the deferred in-process dispatch that does not), ADR-013 (Result-over-exceptions, the reason a returned failure has to roll back), ADR-017 (the [Idempotent] replay this contract names as the caller's recovery), ADR-009 (the resilience posture the retrying execution strategy and its five-retry budget sit inside).