STATE & RECOVERY · REVISION INSPECTION DESK
State diff: compare drafts, revisions and commits
Follow concurrent drafts into committed revisions, inspect the checkpoint and reconstruct state after a simulated crash.
Scroll the diagram horizontally to read every column. Snapshot, comparison and trace give equivalent text.
Compare the selected reference with the current step
| Path | Change | Before | After |
|---|
Inspect comparison JSON
Your experiment
Compare the staged values with the actual committed transition under each write policy. With last-write-wins, the second write can overwrite another worker’s increment.
Each transition takes three playback seconds. Pause, step or scrub to inspect the state before and after an operation. Capture a baseline before changing policy.
Current snapshot
Recent transitions
Offline application-state exercise, not an ADK storage implementation or database benchmark. Two workers add configured integers in two fixed interleavings. Checkpoints and optional event history are assumed durable and atomically written; all actual data remains in this browser simulation. Process state is volatile. Compare-and-swap rejects stale revisions; retry re-reads and reapplies intent. Replay applies recorded state values without repeating tool side effects. Compensation reverses the last recorded state delta only when durable history is present and fully replayed; it cannot undo external effects. No distributed consensus, transactional crash window, migration, personal data or durability guarantee is modeled. ADK state concepts · Event-sourcing reference.
Compare actual snapshots
The comparison panel separates the selected reference step from the current timeline position. Reference step chooses a snapshot from this deterministic run; Pin current step makes the visible step the reference. Seek or step forward to see only the fields that changed. Paths begin with a slash, object keys are escaped, and array entries use their positions. Added and removed fields are distinguished from a field whose value becomes null. This is a structural teaching diff, not an executable JSON Patch, a text diff or an audit API. Changing a simulation parameter creates a new run and resets the reference to its initial state.
Find the first stale draft
Keep the default compare-and-swap policy and pin the snapshot after both workers have read revision zero. At the next transition, A commits value one at revision one. B still holds a draft with base revision zero and staged value two. The comparison shows the committed value and revision changing while B’s draft stays the same. Advance through B’s rejection and reread: the conflict counter increases, then B stages value three against revision one. Only its subsequent commit changes stored state. A draft is an intention; it is not a committed transition.
Measure a lost update
Worker A increment per round and Worker B increment per round control two rounds of additions. Defaults imply six in total. Last write wins accepts B’s stale draft and reaches four; compare-and-swap with Re-read and retry stale intent reaches six with two rejected attempts; disabling retry reaches two before a crash. Atomic increment applies the delta to the current value and reaches six without stale-write rejection. Retry is disabled in the interface for policies where it has no effect. The fixed interleaving demonstrates a specific failure, not a measured throughput distribution.
Inspect the recovery boundary
Checkpoint every N commits persists a snapshot after that many accepted transitions. At the default three, the durable checkpoint contains value four at revision three. With Inject process crash, process value and revision become null and both drafts are lost. Persist event history decides whether log records survive; Replay events after checkpoint restores the last committed value six when that durable history is available. Disable replay to remain at four. Compare the crash snapshot with the recovered snapshot to distinguish null from absent data. Checkpoints are assumed durable; partial disk writes and external side effects are outside this model.
Compare compensation with deletion
Append compensation after recovery adds an inverse delta only when durable history is caught up. At the defaults, it reverses the final increment of two: six becomes four at revision five. The original events remain, and the comparison shows a new event instead of a removed event. Export replay JSON includes the computed run and selected comparison for offline inspection. The file contains fictional values, not a backup of a real session. A compensation can repair this local counter; it cannot unsend an email or erase a historical action.
Control the pace and preserve observations
Play and Pause advance or hold the inspection clock; Next transition advances one three-second boundary; Restart rewinds without changing parameters. Speed changes viewing pace and Time scrubs directly to a state. Inputs rebuild the run and start playback unless reduced motion is requested. Hidden tabs pause. Diagram scrolling preserves readable labels on phones and the snapshot, comparison and trace provide text equivalents. Expand experiment opens fullscreen. Capture baseline preserves the current controls and result, while Replace baseline and Clear baseline manage that comparison note. Notebook observations survive a reload locally; Export notes downloads them. Playback seconds are explanatory time, not storage latency.