TxTransactions Lab
GitHub
VI · Defend the implementation

Defend your transaction.

A design is useful when another engineer can find its commit boundary, challenge its assumptions and reproduce the evidence behind it.

You will: produce a transaction design review supported by baseline, broken and repaired runs. Prerequisites: the order-service investigation and your six core implementation benches. Runtime: your saved evidence and a local design notebook; no new protocol is simulated here.

Start from a requirement

Design a bicycle checkout that reserves a bicycle and helmet, charges a customer, creates an order and requests dispatch. A client may repeat a request after losing the response. Workers may crash between any two durable operations. A dependency may stay unavailable longer than your request deadline.

Write the customer promise before choosing isolation or a messaging mechanism. Decide whether a failed payment releases stock immediately, eventually or through a manual exception path.

Concept diagram · before the experiment

Map every promise to the boundary that enforces it

The order database atomically owns stock, reservation, workflow state and outbox intent. The payment service owns charges, the broker owns event delivery, and the consumer owns dispatch effects and deduplication. Each boundary needs recovery and stable identity; no local database commit spans all services.
Read the diagram: For each boundary, ask: which identifier survives retries, who stores the outcome, and what restarts unfinished work? Inventory, charges, deliveries and dispatch effects need independent checks. A passing order count does not establish all four promises. Open full diagram

Predict

Before reopening a model, predict the result of removing the consumer inbox while keeping the outbox. Will the order count, delivery count and dispatch-effect count tell the same story? Write your reasoning, then use the replay case to identify which extra failure test your implementation needs.

Assemble the evidence

  1. On Break the order service, select Baseline and Run to end. In Inspect JSON or download run evidence, select Download run evidence.
  2. Run Repair and replay on that page. Download each run and compare the charge, delivery and effect counts.
  3. Add a concurrent anomaly example from lost updates or write skew. State why the chosen protection applies to your actual invariant.
  4. Add a crash-prefix example from files or WAL. Identify the durable commit point and distinguish restart from power-loss claims.
  5. Use the native or server extensions where the design needs independent sessions or real file operations. Keep their limitations beside their results.

Model evidence supports reasoning about that model. It does not establish that a production implementation executes those transitions. State how your implementation would be tested at the same boundaries.

Review the design

Design question Evidence a reviewer should be able to find
What must stay true? Exact invariants and request postconditions, including individual resource checks.
Who owns the state? Database, payment API, broker, consumer and workflow owner.
What commits together? Local transaction boundaries and external effects outside them.
What can overlap? Conflicting reads/writes, lock ordering and isolation choice.
What makes a decision durable? Commit records, request/result storage and publication intent.
What does a timeout mean? An explicit unknown outcome and a lookup/retry protocol.
How does recovery finish? Retry scope, stable identities, compensation and reconciliation.
Can it make progress? Waiting bounds, hot keys, dependency failure and intervention policy.
What remains unproven? Failure model, durability assumptions and implementation test gaps.

Challenge the happy path

For each case below, state the last durable fact, the next safe action, the customer-visible state and the independent check of the final result:

Hint 1 · Follow one logical identity

Carry the same request/order identity through reservation, payment, outbox and consumer records. Name each component's deduplication scope and retention.

Hint 2 · Ask for a counterexample

For each claimed guarantee, try removing one assumed mechanism or moving one crash before/after a durable write. If the claim survives every removal, it may be too vague to test.

What a defensible answer includes

Conditional inventory reservation and the reservation record commit locally; payment uses a durable stable key and recoverable result; a workflow reconciles successful payments with pending orders; paid status and an outbox intent commit together; the relay can repeat delivery; the consumer atomically stores its inbox identity with its effect. Cancellation and expiry have explicit versions and compensation paths. This is one possible design, not a single global ACID transaction. It still needs resource limits, retry budgets, retention policy, observability and tests against the real components.

Defend the mechanism as well as the design

Include your six implementation-bench functions and their named-case results. Choose one guarantee and trace it end to end through transaction descriptor, read visibility or lock/validation metadata, tentative writes, recovery records and acknowledgement. Identify the exact publication or durable-record boundary at each layer.

Show a tuple header and snapshot calculation, a lock-table or version-validation conflict, and a pageLSN/log recovery decision. For a distributed claim, include term/index pairs, an election check and the committed decision record, then distinguish that record from participant-local commit. Say which production details your small engines deliberately omit.

Finally propose one core extension to implement yourself: predicate/range validation, a safe version-retention horizon, or retransmitted two-phase decision messages. Provide data structures, transition rules, an adversarial schedule and independent verification criteria before coding it. If you choose the optional advanced ARIES path, interrupted undo with CLRs is an alternative extension rather than a core requirement.

Transfer the idea

Choose a different system: a document index, account provisioning or a multi-file package update. Reuse the design questions, replacing the checkout-specific mechanisms where needed. Explain which guarantees can be weaker and why the business requirement permits that change.

Success criteria: submit the six core functions and named-case results, a boundary diagram, reproducible concurrency/crash/replay evidence and a failure response table; challenge one claim with a counterexample and separate implemented behavior from assumptions. Optional ARIES work is not required.

Open Write your design notes below. Include filenames of the run evidence and what each run shows. Open Download notes and evidence and select Download notebook + evidence to keep the record. A completed checklist is a review aid; the reasoning and reproducibility are the deliverable.

Your design record

Explain what happened and cite the run or SQL result that supports it.

Write your design notes

Download notes and evidence

Downloads include current editor text. Run evidence stays on this page until you leave.