feat(execution): preserve durable recovery on canonical Rust core

This commit is contained in:
Boki 2026-10-23 15:58:44 -04:00
parent 5e9655de0b
commit c01e96e4dd
27 changed files with 3644 additions and 182 deletions

View file

@ -410,6 +410,18 @@ S03 is the next highest-priority code/ADR-ready task. [Its pinned execution cont
Preserve existing row locks, journal context, idempotency and rollback behavior. Canonical next-event timing and immutable policy differ explicitly from legacy execution; refuse implicit account conversion. Retain failed native prefixes atomically as terminal, and keep notification delivery separate from financial commit. No performance work, default switch, paper feed activation or other pending ADR approval is included. S04 owns feed readiness; R01/R11 still require ADR-006.
**Validated handoff:** S03 is `review` / `validated_uncommitted`. Twenty-two source/test files are integrated with recorded hashes and independent G1/G2 signoff. `stageFinancialTransaction` restores private state and applies the existing Rust matcher. Its ordered financial views are reconstructed through the same risk reducer and checked against the authoritative result. Replayed commands return their original outcome with the current checkpoint and no new effect journal.
The canonical host uses the existing PostgreSQL account row lock. It commits all due owners' state/RNG/checkpoints and one complete batch intent together, then dispatches the batch in a separate transaction. Native snapshots, per-effect views, journals, input status and admission feedback commit atomically. Mixed-cadence owners retain their unconsumed observations. The shared decision helper preserves S01 research behavior. One additive migration stores complete canonical batches; legacy accounts explicitly refuse canonical envelopes and retain their existing execution path.
Coverage includes competing hosts, SQL rollback, lost acknowledgements, frozen callback inputs, all four time-in-force policies, risk reservations, stale quotes, exact quote-cursor decisions, and terminal failures during both admission and execution. A real SMA program matches uninterrupted state and journals after repeated replacement. Four separate-process kill cases cover decision staging, checkpoint commit, admission commit and fill/fee commit; recovery matches uninterrupted execution exactly.
`CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/audit/lint plus **82 tooling, 43 utility, 44 calculation, 432 integration and 150 Rust tests**. Four existing manual Rust measurements remain ignored. The complete disposable PostgreSQL/Redis suite passed **81 tests / 545 assertions**. Extra strict TypeScript exposed only test fixture typing issues; these were corrected without changing application behavior, then strict test compilation, scoped format/lint and **38 targeted tests / 281 assertions** passed. Browser/Python boundaries were unchanged and their suites were not rerun. No profiling, optimization or benchmark run occurred.
The native addon was built and verified against this checkout's debug library for the full gates, then rebuilt in release mode. Another **38 tests / 366 assertions** passed against the final release addon; no timing measurements were performed. Source archives, exact commands/hashes and logs are recorded in `manifest.json` → `sixteenth_wave_validation` and `/tmp/stock-bot-wave16.kgaZm4/`. Only the two exact disposable test containers were stopped; development services, worktrees and logs were retained.
Limits remain explicit: trusted SQL custody, new canonical account IDs, execution-series observations only, immutable declared program metadata rather than retained code artifacts, and invalid queued inputs that fail closed until diagnosed. Rust validates opaque financial receipts before each financial transition; startup alone is not a full receipt audit. **Next after acceptance/commit: S04**, feed scheduling, auxiliary observation manifests and operator readiness. S05 is independently code/ADR-ready; R01/R11 still require ADR-006. S03 does not activate paper/live execution or switch existing web/research defaults. No S03 commit, push or PR was created.
## Deferred and rejected
Conditional: shared feature cache D04; cross-trial resident datasets P03; large-detail pagination/storage P05; tiny DSL P06; expanded cross-service monitoring O02. Each has a measured/real-need trigger and is not a prerequisite for scheduled work.