The Best Systems Know How to Explore Without Breaking the World

Kai Nguyen

Hatched by Kai Nguyen

Aug 15, 2026

10 min read

91%

0

What if failure is not the opposite of progress?

A brute force algorithm sounds almost embarrassingly simple: try every possible answer, then choose the best one. A distributed transaction sounds like the opposite kind of problem: delicate, concurrent, and full of partial failures across independent systems.

Yet both are attempts to answer the same question: How can a system make progress when it cannot know in advance which path will work?

The connection matters because modern software rarely operates in a world where every action can be guaranteed before it begins. A service may approve a payment while another service cannot reserve inventory. A route may look optimal until a road closes. A recommendation may be plausible until the user rejects it. In each case, the system has to act under uncertainty, learn from the result, and decide what to do with the consequences of being wrong.

The deeper lesson is this: robust systems are not defined by their ability to avoid failed attempts. They are defined by their ability to make failed attempts survivable.

A Saga provides one architecture for survivable action in a distributed system. Brute force provides one strategy for navigating uncertainty through repeated trial. Together, they suggest a powerful design principle: treat complex workflows as controlled searches through a space of possible states, and make every step reversible enough that exploration does not become permanent damage.

The hidden search inside every business transaction

Consider a simple online purchase. The visible request is one sentence: “Buy this product.” The actual operation may involve several local actions:

  1. Create the order.
  2. Reserve inventory.
  3. Authorize payment.
  4. Arrange shipping.
  5. Confirm the purchase.

Each service owns its own data and commits its own local transaction. There is no single database transaction that can lock the entire process and guarantee that every step succeeds together. The system is therefore navigating a sequence of states:

CartOrder createdInventory reservedPayment authorizedShipment arrangedPurchase confirmed

At every transition, the system faces uncertainty. Inventory can disappear between the request and the reservation. A payment provider can time out. A shipping service can reject an address. The transaction is not a single indivisible event. It is a path through a state space.

This is where brute force offers an illuminating mental model. In its simplest form, brute force explores possible answers until it finds the desired one. A Saga does not usually try every possible business workflow, but it does perform a related operation: it advances along a candidate path, observes whether the next state is attainable, and, if the path fails, takes action to restore a defensible earlier state.

The distinction is crucial. Brute force searches by trying alternatives. A Saga searches by trying commitments while preserving the ability to retreat.

Suppose payment succeeds but shipping fails. The system now has several possible responses. It could leave the customer charged with no shipment. It could ask an operator to repair the situation manually. Or it could execute a compensation transaction that refunds the payment and releases the inventory reservation.

The compensation is not merely an error handler. It is the mechanism that turns a dead end into information. The failed shipping step tells the system that this path is not viable. The refund and release operations ensure that learning this fact does not leave behind an invalid business state.

A failed attempt becomes useful only when the system can extract information from it without being permanently damaged by it.

Why rollback is not the same as undo

Traditional database transactions rely on a comforting promise: either all changes happen, or none of them do. This is the elegance of atomicity. If a transaction fails, the database can roll back to its previous state as though the attempt never happened.

Distributed systems often cannot offer that promise. Once a payment gateway has charged a card, a local database cannot erase the external event. Once a warehouse has picked an item, restoring a database row does not put the item back on the shelf. Once an email has been sent, no rollback can unsend it.

A Saga therefore replaces rollback with compensation. Compensation attempts to create an acceptable business outcome, not a perfect historical reversal.

That difference changes how systems must be designed. If the original action is “charge the customer,” its compensation may be “issue a refund.” Those two actions are not symmetrical. The refund may take days to settle. It may incur fees. It may trigger a separate notification. The customer may see both the charge and the refund in their account history.

Likewise, if the original action is “reserve a seat,” compensation may be “release the seat.” But the seat might have been shown to another customer during the interval. Releasing it does not restore the entire universe to its previous condition. It merely establishes a new state that is acceptable enough for the business.

This is another point of contact with brute force. A brute force algorithm assumes that trying a candidate is cheap enough, or at least safe enough, to repeat. Distributed workflows often violate that assumption. The cost of a failed attempt can be financial, reputational, or operational.

So the engineering challenge is not simply to enumerate possibilities. It is to reduce the cost of exploring the wrong possibility.

That leads to a practical hierarchy of actions:

  1. Perform cheap validation before creating external side effects.
  2. Delay irreversible actions until the path is more likely to succeed.
  3. Make repeated messages and operations idempotent, so a retry does not multiply damage.
  4. Define a compensation for every meaningful commitment.
  5. Record enough state to explain what happened and what remains to be repaired.

The best distributed workflows are not those that pretend uncertainty does not exist. They are those that place uncertainty where it is cheapest to manage.

Two ways to search: the coordinator and the crowd

There are two common ways to structure a Saga, and they resemble two different approaches to navigating a search problem.

In an orchestration based Saga, a central orchestrator directs the process. It tells the inventory service to reserve stock, waits for the result, then tells the payment service to authorize the charge, and so on. If a later action fails, the orchestrator invokes the compensating actions in reverse or in the order required by the business rules.

This resembles a guided search. One component knows the current position, chooses the next move, and maintains the larger plan. The benefits are clarity, explicit control, and easier visibility into the workflow. The cost is concentration of knowledge. The orchestrator can become a bottleneck or a large repository of business logic.

In a choreography based Saga, services react to events and publish new events after completing their local actions. An order created event may prompt inventory reservation. An inventory reserved event may prompt payment authorization. A payment authorized event may prompt shipping.

This resembles a distributed search in which each participant knows how to respond to the evidence it receives. It can reduce central coordination and allow services to evolve independently. But the overall path becomes harder to see. A failure may ripple through several event handlers, and it can be difficult to determine which service is responsible for the next decision.

The analogy reveals a design tradeoff that is often described too narrowly as a matter of architecture style. The real question is: Where should knowledge of the search strategy live?

Use orchestration when the workflow has a clear sequence, strict business policy, or substantial compensation logic. A central coordinator can make the state machine explicit. Use choreography when the process benefits from loose coupling and services can make meaningful local decisions from events, provided that observability and failure handling are strong.

Neither approach removes complexity. They relocate it. Orchestration concentrates complexity in the coordinator. Choreography distributes complexity across event contracts, handlers, and the invisible interactions among them.

A useful test is to ask whether an engineer can answer three questions from the system's records:

  1. What state was the workflow in before the failure?
  2. Which action caused the transition into the problematic state?
  3. What exact action will restore an acceptable state?

If the answer requires reconstructing a mystery from scattered logs, the system is not merely difficult to debug. It has failed to make its search process legible.

The design rule: make commitments narrow and exits explicit

The most useful synthesis between brute force and Saga design is a framework for reversible exploration. Every significant step in a distributed workflow should be evaluated along four dimensions.

1. What state does this action create?

Do not describe an operation only as a function call, such as reserveInventory. Describe the business state it establishes: “Inventory is unavailable to other orders for fifteen minutes.” This makes the consequence visible and exposes the expiration or release rule that must exist.

2. What evidence proves success?

A timeout is not the same as a failure. The payment provider may have charged the card even though the response never reached your service. A retry based on an assumption of failure could charge the customer twice.

Every step needs a durable result, a correlation identity, and a way to query or reconcile ambiguous outcomes. In search terms, the system needs a reliable test for whether it actually moved to the next state.

3. What is the compensation, and what does it fail to restore?

Writing “refund payment” in a design document is not enough. Ask when the refund occurs, whether it can be retried safely, how its completion is observed, and what happens if the refund itself fails.

Most importantly, name the residue. A compensation may restore financial correctness while failing to restore timing, customer trust, or inventory availability. Honest designs account for these differences instead of using the word “rollback” as a comforting fiction.

4. How much search is affordable?

A brute force algorithm is practical only when the search space and evaluation cost are acceptable. The same is true of distributed retries and alternative workflows. A process that retries indefinitely is not resilient. It is an uncontrolled search that may create repeated charges, duplicate shipments, or an endless stream of compensating events.

Set explicit limits: maximum attempts, time windows, escalation thresholds, and terminal states. When automated exploration ends, the system should move into a visible repair queue rather than silently continuing.

This framework also clarifies why idempotency is so important. If the same event is delivered twice, an idempotent operation recognizes that the target state has already been reached and does not create a second side effect. Idempotency does not make an operation reversible, but it makes the search safer by ensuring that uncertainty about message delivery does not become multiplicity of action.

Key Takeaways

  1. Model workflows as state transitions, not function calls. For every step, define the state created, the evidence of success, and the next valid states.

  2. Treat compensation as a business operation. A refund, release, or cancellation is not a technical erase button. Specify its timing, failure modes, and imperfect consequences.

  3. Make exploration cheap before making it external. Validate early, postpone irreversible effects, and reserve expensive commitments for paths that have passed inexpensive checks.

  4. Choose coordination based on where decision knowledge belongs. Central orchestration improves explicit control. Choreography improves local independence. Both require strong observability.

  5. Bound retries and expose unresolved work. A failed automated path should become a visible, actionable state, not an infinite loop disguised as resilience.

The real measure of intelligence in a system

We often praise algorithms for finding the right answer and architectures for preventing failure. Those are reasonable goals, but they are incomplete. In uncertain environments, the system may not have enough information to choose correctly on its first attempt. What matters then is the quality of its second move.

Brute force teaches that simple trial can solve difficult problems when the search is bounded and evaluation is reliable. Saga design teaches that distributed action can remain coherent when each commitment is local, communication is explicit, and failed steps have meaningful compensation. Their intersection produces a more demanding standard: build systems that can search without losing control of reality.

That standard applies far beyond microservices. It describes financial operations, supply chains, deployment pipelines, customer support workflows, and even personal decision making. Whenever an action changes the world before you know whether it was wise, you need more than a plan. You need an exit.

The mature question is not, “How do we guarantee that every attempt succeeds?” Such guarantees are often unavailable. The better question is: “If this attempt fails halfway through, can we learn what the failure means, protect what matters, and continue from a known state?”

A system that can do that is not merely fault tolerant. It is capable of intelligent exploration. It does not confuse progress with uninterrupted success. It understands that, under uncertainty, the path to the right answer may include wrong turns, provided every wrong turn has been designed to teach rather than destroy.

Sources

← Back to Library

Hatch New Ideas with Glasp AI 🐣

Glasp AI allows you to hatch new ideas based on your curated content. Let's curate and create with Glasp AI :)

Start Hatching 🐣
The Best Systems Know How to Explore Without Breaking the World | Glasp