Skip to content

Revise a design after critique

12 min reading

A decision-by-decision revision showing why each change helps

Page details

System Design · Optional interview practice

12 min reading · 25 min with practice

Sources

Published · Last edited:

Prerequisite: Practise an unseen design with a visible rubric. For basics, use the independent System Design foundations.

More
20px

Hypothetical scenario. Northwind’s booking candidate checks availability and inserts a reservation later. It also calls a timed-out request failed. Dev suggests a distributed lock after the review; Priya asks which boundary can enforce the actual interval rule and preserve the original booking intention.

Maya: “Fix the customer promise that the critique showed was unsupported.”

Dev: “Then explain why each change addresses that failure instead of adding every suggested component.”

Revise the candidate decision by decision while retaining its scope and selected workload. The booking design and critique are fictional teaching artifacts, not a production incident or interview report. Compare with your own earlier draft, preserving what already works and recalculating only consequences of the correction.

Which assumption did the counterexample disprove?

The candidate supports the same authenticated employees, items, half-open intervals, booking, cancellation and status lookup. It correctly separates search from booking demand and retains the selected daily and morning workloads. Its mistake is interpreting a successful availability read as permission to create a confirmed reservation later.

A second mistake is mapping every client timeout to rejection. The server may have committed before the response was lost. A retry that creates a new independent booking intention can either duplicate the effect or produce a confusing conflict against the caller’s own earlier accepted reservation.

Keep the useful parts: narrow scope, derived demand, immutable outcome identity and a readable request path. Critique does not require replacing PostgreSQL or adding global consensus. Identify the boundary responsible for the failed promise and choose the smallest change whose mechanism can be explained.

Revision one: protect the accepted interval

Make authoritative booking acceptance enforce non-overlap for the same item under the chosen active-state rule. A PostgreSQL range exclusion constraint is one concrete candidate when its supported operators and schema fit. Include item equality and interval overlap in the constraint; use the appropriate supported operator class for the chosen identifier type.

Only the transaction that satisfies the authoritative constraint can publish an accepted booking. A conflicting request receives a deliberate conflict outcome and may search again. Keep the availability cache as a derived convenience. It can lag, but it cannot overrule the acceptance boundary.

Cancellation changes authoritative active state through a guarded transition. Define whether a cancelled booking remains as history and how active intervals participate in the constraint. Do not rely on deleting a cache entry or sending a cancellation message to release the reservation. Confirmed state changes and notifications must remain causally connected through durable obligations.

A revision changes acceptance and recovery before presentationThe critique exposes concurrent acceptance and timeout ambiguity. The revision adds guarded interval commit and stable intention identity. Durable outcomes feed reconciliation and derived presentation instead of relying on notification arrival.Old availability readTwo concurrent requestsTimeout is ambiguousGuarded interval commitStable intention identityDurable schedulingAccepted / conflictStatus reconciliationDerived cache + notices
A revision changes acceptance and recovery before presentation

Repair the failed transition and its migration path

Hypothetical scenario. The critique identifies two defects: distinct concurrent bookings can both pass an old availability read, and retrying after a lost reply creates another intention. Repair them separately with an authoritative no-overlap condition and a stable tenant-scoped operation identity. One repair cannot stand in for the other.

Repair the failed transition and its migration path — selected design evidence
CritiqueRepairNew obligation
Two distinct users both winAuthoritative overlap protectionExisting conflict cleanup
Retry creates another bookingStable K + fingerprint + resultRetention / restore linkage
Old writer bypasses fixCompatibility + owner fenceSafe rollout and rollback
Recovery overloadBounded useful-work admissionMeasure debt and survivor capacity
The repaired transition chooses one legal winner while preserving a recoverable result for its intention.The repaired transition chooses one legal winner while preserving a recoverable result for its intention. User A to Booking authority: 1 · interval proposal A; User B to Booking authority: 2 · competing proposal B; Booking authority to User A: 3 · one accepted receipt; Booking authority to User B: 4 · explicit conflict.User ABooking authorityUser B1 · interval proposal A2 · competing proposal B3 · one accepted receipt4 · explicit conflict
The repaired transition chooses one legal winner while preserving a recoverable result for its intention. Enlarge the diagram to inspect its labels; the surrounding records and explanation give the text alternative.

Now consider deployment. Existing rows may already conflict or lack operation links. Inventory and resolve those cases before enabling a constraint that assumes clean history. Mixed application versions must route through the protected transition; an old writer left on a bypass path can recreate the failure. Retain a rollback policy that does not re-enable unsafe grants.

Add regression histories for distinct competing users, an identical retry, expiry racing acceptance and a paused old owner after migration. Repeat the workload calculation using calls, logical intentions and useful accepted work separately. If overload remains, bound admission rather than hiding the safety repair behind a larger queue. Record the new cost and the measurement that would justify another design change.

Revision two: preserve the caller’s intention

Require a stable booking-operation identity scoped to the authenticated caller or tenant contract. Record its request meaning and accepted outcome with the protected booking transition. Repeating the same identity with incompatible arguments is a conflict, not permission to reuse another employee’s result.

If the reply is lost, status lookup or a same-identity retry recovers the recorded outcome. The server may still be processing, so the API needs a supported pending or unresolved response. A timeout is evidence about waiting, not proof that the booking transaction rolled back.

An overlap conflict and a duplicate retry are different situations. A second employee requesting an occupied interval should receive a conflict. The original employee recovering the same accepted intention should receive that existing booking’s status. Without stable operation identity, the service cannot reliably distinguish those cases from argument similarity alone.

Recalculate only the decisions affected by the critique

Hypothetical worked example. Keep the morning cohort of one hundred logical booking attempts in sixty seconds. Suppose twenty callers repeat the same intention once after losing a reply. HTTP booking calls become 100 + 20 = 120 in that interval. Call arrival is 120 ÷ 60 = 2 calls per second; logical new intentions remain one hundred. Do not turn the twenty retries into twenty new reservations.

For a separate selected contention example, ten distinct employees request the same item and interval while no booking exists. If all are otherwise valid and no cancellation occurs, the chosen exclusive-acceptance rule permits one accepted reservation and 10 − 1 = 9 conflicts. This is an expected result of the selected scenario, not a measured fairness or throughput guarantee.

Revisit the earlier educational rubric. The initial vector was scope two, arithmetic two, authority zero, recovery one and communication two: 2 + 2 + 0 + 1 + 2 = 7. After the explained revisions, a reviewer may assign 2 + 2 + 2 + 2 + 2 = 10 if each criterion is actually demonstrated. The three-point increase is 10 − 7 = 3. It indicates rubric coverage, not production certification.

The storage subtotal from the brief remains unchanged unless the selected retained record or outcome population changes. Additional attempt audit records may add storage, so estimate them separately if retention requires them. Do not multiply all existing capacity estimates by the HTTP retry factor without tracing which components see the extra work.

In the wild: the database constraint has limits

PostgreSQL’s range-type documentation shows how exclusion constraints can prevent overlapping ranges. Verify actual schema support and transaction behavior before implementation. The feature can protect an accepted interval invariant; it does not authenticate a caller, interpret a business cancellation policy or recover a lost client response by itself.

The review should therefore inspect the full transaction and API contract around the constraint. A correctly configured overlap rule can coexist with a broken operation-identity table or notification lifecycle. The revision is complete only when those boundaries fit the same product promise.

A lock is added but the stale handler still inserts

Hypothetical failure scenario. To fix the critique, the author adds a short distributed lease around the original handler. The worker pauses, its lease expires, another worker books the interval, and the old handler resumes its unchecked insert. The extra component did not make the accepted write enforce the invariant.

Prefer the selected database invariant where the ownership and schema permit it, or specify a serial authority whose accepted-write boundary rejects obsolete ownership. A lease can support scheduling, but the final effect must still be protected. Explain that mechanism before claiming the concurrency problem is fixed.

Record consequences instead of hiding the cost

The revised design adds constraint-conflict handling, operation-identity retention and durable publication work. It may reject an interval that looked free moments earlier. The interface should explain that conflict and let the employee choose another interval rather than promising that cached availability is a reservation.

Consider a serial command stream per item as an alternative. It can order decisions, but requires careful ownership, recovery and status semantics. For this selected narrow relational workload, the database constraint can be a simpler authority. A future cross-store booking transaction or recurring-reservation rule can change that decision; write down the trigger rather than speculating about every future feature.

Validate the mechanism with adversarial interleavings, lost replies, repeated identities with changed arguments, cancellation races and restore. Static reasoning identifies required cases; a written draft does not claim that executable integration or load tests have run. Preserve the untested items in a review record before promoting a real implementation.

Finish with a design that can still be questioned

Compare your own revision with the candidate without treating the presented architecture as the sole correct answer. Can you explain which invariant is protected, what remains uncertain and why the tradeoff fits the declared workload? If not, return to the relevant core chapter and revise that decision.

This completes the course draft. The progression began with a product promise, followed a request, examined data and failure, then composed and revised complete systems. Continue practice by changing one constraint at a time and preserving the workload ledger. Progress means making the reasoning easier to inspect, not accumulating another inventory of technologies.

Challenge the proposed mechanism

Which evidence distinguishes a real revision from a new diagram with the same race?

Reveal the design reasoning

Execute the original counterexample against the new operation and show where one transition is rejected. Then execute the lost-reply retry and mixed-version rollout. State the added contention, cleanup and migration cost and keep unsupported capacity claims unproven.

Decision and reconsideration: Carry each critique into a changed mechanism, regression history and rollout obligation. Revisit only when the recorded decision trigger is met.

Check the design against changed conditions

  1. Twenty callers retry the same hundred intentions. Are there one hundred twenty new booking intentions?

    Reason through the consequence

    No. The selected cohort has one hundred logical intentions and one hundred twenty HTTP calls. Stable identity preserves that distinction through uncertain replies.

  2. A short lease surrounds the old check-then-insert. Does that alone protect the final interval write?

    Reason through the consequence

    No. A paused stale holder can resume. Enforce the invariant or current authority at accepted mutation rather than assuming lease expiry stopped the process.

  3. The revised answer earns ten rubric points. Is the service ready for production?

    Reason through the consequence

    The score indicates demonstrated educational criteria only. Implementation, actual source and schema behavior, failure tests, operational evidence and release checks remain separate obligations.

You have reached the end of the sequence. Revisit the earlier checkpoints with this same review method: preserve the user promise, expose the counterexample, revise the enforcing boundary and record the evidence that would make you change the design again.

Northwind decision log

Revise the exact failed transition while preserving valid assumptions.
Separate logical intentions, attempts and accepted effects in every review.
Course draft complete; revisit the map and review the sequence as a whole.

Go deeper: Using models to revise a decision