VIOLET V2c: synthetic intent scripts + ExecStormHarness + 9-scenario matrix

synthetic_intents.py: seeded IntentScriptSpec -> CycleSpec scripts
(script_hash + outcomes_hash determinism, V0 discipline); per-scenario
router ExecConfig constructed directly (no env mutation); cycle executor
runs full ENTER->terminal->flatten lifecycles with per-scenario terminal
predicates and cycle-end invariants (working registry empty, driver
drained, slot flat).

exec_harness.py: composition root — production bundle (MOCK, injected
ScriptedVenue), ExecDeadlineDriver ports wired, pump = venue.reconcile()
-> kernel + driver.on_fill forwarding (the production seam), gate report
via the ExecGateReport schema, archive next to V0 reports.

scripted_venue.py amendment: MARKET orders never rest (venue realism —
directives are keyed by trade_id and the R1 MARKET fallback shares the
position's trade_id).

Matrix green through the REAL kernel at 100ms TTL: immediate fill,
rest-then-fill (deadline cancelled), fill-races-cancel (no retry),
rest-expire-retry (-r1 opens), retry-exhaust skip|market, exit-expire ->
MARKET same trade_id, post-only reject, cancel-reject (no strand). Two
runs same seed -> identical outcomes_hash. Router 77 green; shared clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-06-13 00:31:09 +02:00
parent dfe7136404
commit 7ae49c587e
5 changed files with 773 additions and 1 deletions

View File

@@ -85,7 +85,11 @@ class ScriptedVenue(MockVenueAdapter):
def submit(self, intent: KernelIntent) -> List[VenueEvent]:
self.submits.append(intent.trade_id)
script = self._script_for(intent.trade_id)
if script is None or script.directive == Directive.IMMEDIATE_FILL:
# Venue realism: MARKET orders never rest — directives (keyed by
# trade_id) only govern LIMIT quotes, so a MARKET fallback that
# shares the trade_id of a resting maker quote always fills.
if (script is None or script.directive == Directive.IMMEDIATE_FILL
or str(intent.order_type) == "MARKET"):
return super().submit(intent) # parent default: ACK + FULL_FILL
order_id = f"V-{next(self._order_seq):08d}"