# EVT-02 event-sourcing reproduction

This fixture tests one narrow distinction: code can publish events while its
current-state row remains authoritative; an event-sourced model instead treats
its ordered event stream as the durable source from which state is rebuilt.

The pinned PHP 8.4.12 and SQLite experiment retains eleven behavior cases:

- a fair current-state wallet which publishes incomplete notifications;
- deterministic wallet rehydration by stream position;
- incremental projection and from-empty rebuild checksums;
- mixed v1 and v2 event schemas without rewriting old bytes;
- explicit refusal of an unknown schema;
- stale-writer and stream-gap failures;
- duplicate-safe projection handling;
- projection crash, visible lag, and checkpoint-based resume;
- repair of stale derived state by replay; and
- rejection of an event-ID rewrite.

Ten isolated mutations prove those checks detect false rebuild history,
mutable events, wrong ordering, missing and unknown schema handling, missing
optimistic concurrency, duplicate application, premature checkpoints,
defective projection arithmetic, and external side effects during replay.

Run the complete retained experiment with:

```bash
./run.sh
```

The runner replaces only this fixture's generated result subdirectories,
builds the digest-pinned container, retains each case and mutation
independently, records primary-source provenance, and runs a semantic result
verifier.

After committing the evidence, verify its exact tree with:

```bash
./bin/run-clean-export.sh HEAD
```

The clean-export check rebuilds an archive of the selected commit and compares
its semantic verifier, projection rebuild, and mixed-schema replay evidence to
the retained results.

The wallet is a synthetic persistence control. Its credit rule, event schema,
replay procedure, and operating choices are not production rules or Brian's
reported experience.
