Browse documentation

How-to guides

Design an actor boundary

Assign state, operations and authority around one domain invariant.

Put an invariant with the actor that owns the state needed to enforce it. Define requests from other components through typed contracts.

This procedure uses Inventory and Checkout as conceptual roles, not declaration syntax.

1. Choose the owner

Inventory owns stock and reservations. Checkout owns order progress. Inventory enforces “a reservation cannot exceed available stock for this account.” Avoid splitting that decision across independently writable state.

2. Define requests and outcomes

Specify item identity, quantity and any request identity required for retry handling. Distinguish successful reservation, insufficient stock and invalid input where the domain requires it.

Obtain account identity from trusted ingress or established authority. A caller-supplied account field is not authentication.

3. Define directions

Checkout requests a reservation; Inventory replies to that request. A later stock notification is a separate operation. A reply must not become general permission to call the requester.

4. Assign authority

Specify the subject, operation, target and resource scope. Keep the grant separate from the typed declaration.

Test an allowed request and a refused request through the actual admission path. A business-validation error does not demonstrate an authority check.

5. Specify persistence

List durable state and waits. Define recovery when a process stops after accepting work but before replying. Treat an external provider’s uncertain outcome separately.

A change to saved state needs a compatibility or migration decision.

6. Inspect the relationships

Compare declared interactions, permission in a named context and retained observations. Check dynamic targets and coverage. An unobserved edge may still be permitted.

Actors can remain in one runtime. Choose deployment boundaries according to operational needs. See the system model and authority for the contracts behind this procedure.

Search concepts, guides and reference.