Agent-ready workflow · logic

Business Logic State and Race

Model an invariant, prove sequential behavior, then test bounded concurrency against controlled state.

business-logicracestate-machinereplayinvariant
Stable IDworkflow:business-logic-state-raceSource record dateHuman reviewNot recordedProvenanceCurated workflow graph

Enter with artifacts, leave with evidence.

Use when
  • redeem
  • transfer
  • quota
  • approval
  • inventory
  • multi-step flow
Prerequisites
  • controlled account and records
  • written invariant
  • hard attempt cap
  • recovery plan
MCP retrieval

Agents can search this workflow, retrieve the complete graph, or request one stage through the read-only Vulns.co MCP connector.

01

Write the invariant

Define the property that should always hold and the states that enforce it.

Inputs
  • documented workflow
  • controlled objects
Outputs
  • state diagram
  • invariant statement
Evidence gate
Expected behavior is testable and not based on reward assumptions.
Negative control
A valid sequential transition succeeds.
Stop condition
No concurrency until state and rollback are understood.
02

Establish sequential controls

Run valid, duplicate, reordered, expired, and replayed operations one at a time.

Inputs
  • state diagram
Outputs
  • sequential baseline
Evidence gate
Normal rejection and idempotency behavior are stable.
Negative control
Fresh valid state still works.
Stop condition
Stop on unexpected irreversible effects.
03

Run bounded concurrency

Send the smallest synchronized request set that can cross the invariant.

Inputs
  • hard attempt cap
  • fresh controlled state
Outputs
  • attempt ledger
  • before and after state
Evidence gate
The final state violates the written invariant reproducibly.
Negative control
The same operations sent sequentially do not violate it.
Stop condition
Stop immediately on impact beyond controlled state.
04

Reconcile every state

Account for responses, asynchronous settlement, retries, rollback, and final balances or object states.

Inputs
  • attempt ledger
Outputs
  • reconciled impact
  • cleanup record
Evidence gate
Transient responses are not reported as durable impact without final-state evidence.
Negative control
A fresh control object remains consistent.
Stop condition
Restore state or notify the program if automatic recovery is impossible.

Continue with the right depth.

References