flowchart LR accTitle: Which export writes must survive together? accDescr: Separate the acceptance transaction from the later rendering work. Trace the credit, job and dispatch record through retries, claims and publication. %% journal-architecture-commit-boundary (en) %% https://www.thebsq.com/blog/modular-monolith-vs-microservices/ subgraph g1 ["Exports owns admission"] %% n_access — The HTTP process derives the tenant from the authenticated request and checks access to the immutable snapshot. Accounts supplies identity while Exports owns the write contract. n_access["Authorize the snapshot"] %% n_identity — A unique tenant, operation and request key identifies the intent. Record a fingerprint of the normalized input so an accepted duplicate can recover its original receipt. n_identity["Claim request identity"] %% n_quota — Only the winner attempts the conditional debit. The balance must still be positive at the write. With no qualifying row, roll back the transaction. n_quota["Debit one credit"] %% n_commit — The request receipt, quota debit, durable job and outbox record commit in one short transaction. Only then may the HTTP process return acceptance to the caller. n_commit["Commit four writes"] %% n_receipt — A matching authorized retry reads the same accepted job and status location. A changed snapshot under the same key conflicts with that recorded intention. n_receipt["Recover the receipt"] end subgraph g2 ["Separate execution"] %% n_relay — The relay sends a stable job ID and input version to the external broker. A crash after sending can cause a second publication of the same event. n_relay["Relay the outbox"] %% n_claim — The worker loads the authoritative job and takes a time-limited lease with a new generation. Rendering uses its own CPU allocation outside the database transaction. n_claim["Acquire a worker claim"] %% n_artifact — Store the CSV under the tenant, job and generation as an immutable object. A second attempt can finish computation without changing the object of its predecessor. n_artifact["Write an attempt object"] %% n_publish — A later database transaction publishes the artifact pointer only if the claim generation still matches. A stale worker leaves an unreferenced object for cleanup. n_publish["Publish the current pointer"] end subgraph g3 ["Boundaries beyond the claim"] %% n_provider — A paid provider may have acted before a timeout. A stable provider operation ID or an explicit reconciliation process covers that external effect. n_provider["Resolve provider effects"] %% n_split — Moving allowance to another service introduces a new partial state. Either keep the debit with admission or define who reserves, confirms, cancels and reconciles it. n_split["Test an ownership split"] end n_access -->|"Pass the authorized, normalized intent"| n_identity n_identity -->|"New key wins admission"| n_quota n_identity -->|"Existing key requires comparison"| n_receipt n_quota -->|"One credit successfully debited"| n_commit n_quota -->|"Changing owners breaks the local invariant"| n_split n_commit -->|"Reply after durable acceptance"| n_receipt n_commit -->|"Dispatch intent becomes visible"| n_relay n_relay -->|"Deliver the job ID and input version"| n_claim n_claim -->|"Render against the immutable snapshot"| n_artifact n_claim -->|"An external paid action needs its own identity"| n_provider n_artifact -->|"Guard the visible result by generation"| n_publish %% From one credit to one visible result — n_access → n_identity → n_quota → n_commit → n_relay → n_claim → n_artifact → n_publish %% Recover a lost acceptance — n_access → n_identity → n_receipt %% Trace an external effect — n_commit → n_relay → n_claim → n_provider