docs(exec): omp task brief — 10K test-types for Flight7UE exec libs (mock exchange ONLY)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-07-15 10:00:45 +02:00
parent 82eb5f551a
commit fa76070c79

View File

@@ -0,0 +1,76 @@
# omp task — 10K test-types for the new exec libs (Flight7UE)
**From:** Fable · **Date:** 2026-07-15 · **Branch:** `tools/pi_wake_agent`
Flight7UE (T1 smart-exec) launched and smoke-passed on MOCK venue. Now it needs a deep test
campaign. Write a **large, comprehensive suite ("10K test-types")** across FOUR dimensions —
**seams, async, typing, bugs** — for every NEW library below.
## THE ONE HARD RULE — read twice
**Every test MUST mock the exchange. NEVER, EVER hit, hammer, poll, or disturb the real
exchange (BingX).** No live venue. No network to a venue. No real API keys. Use
`DITA_V2_VENUE=MOCK` and/or in-process fakes ONLY. A test that reaches a real venue is a
defect worse than no test — it risks the live account AND the running BLUE trader. If you are
unsure whether a code path can touch the venue, stub it at the seam. `venue_mode` is never
`BINGX` in a test.
Corollary: do not touch running processes. BLUE (`nautilus_event_trader.py`, supervised) and
the `dolphin_data:*` services are LIVE. Tests run offline, self-contained, deterministic.
## New libraries to cover (absolute paths)
1. `/mnt/dolphinng5_predict/prod/exec_unified/dialect.py` — BingX venue idiom boundary
(clientOrderId, dash_symbol, quantize price/size, build_order_payload; PostOnly = timeInForce).
2. `/mnt/dolphinng5_predict/prod/exec_unified/friction.py` — §12 friction telemetry
(effective-bps, naive-baseline savings, commission-sign flip, side-lane journal that cannot raise).
3. `/mnt/dolphinng5_predict/prod/exec_unified/intent_translator.py` — §7 IntentSpec → dita_v2
KernelIntent (side inversion on EXIT, size verbatim/no ×leverage, cancel side ignored).
4. `/mnt/dolphinng5_predict/prod/exec_unified/kernel_port.py` — ExecPort over the DITAv2 kernel
(async pump/submit/cancel, slot_view, exit-size cap).
5. `/mnt/dolphinng5_predict/prod/clean_arch/violet/uv/exec/smart_bridge.py` — T1 SmartExecBridge
(maker-first entries, MARKET exits, TTL sweep-then-place, fail-soft, friction side-lane).
Supporting exec_unified modules already tested (extend, don't duplicate): `contract.py`,
`router.py`, `working.py`, `drive_loop.py`, `executor.py`, `placer.py`.
## Existing tests — style + baseline (read these first, match the idiom)
- `/mnt/dolphinng5_predict/prod/exec_unified/test_dialect.py`
- `/mnt/dolphinng5_predict/prod/exec_unified/test_friction.py`
- `/mnt/dolphinng5_predict/prod/exec_unified/test_intent_translator.py`
- `/mnt/dolphinng5_predict/prod/exec_unified/test_kernel_port.py`
- `/mnt/dolphinng5_predict/prod/clean_arch/violet/uv/exec/test_smart_bridge.py`
## The four dimensions
- **seams** — boundaries between modules: contract→router→(placer)→kernel_port→translator→
dialect; smart_bridge→promotion.build_kernel_intent_from_decision→kernel. Assert the data that
crosses each seam (side, size, order_type, tif, ids) is exactly right. Fake the kernel/venue.
- **async** — `kernel_port` pump/submit/cancel and `process_intent_async` are async: cover
await ordering, awaitable-vs-sync returns, exceptions mid-await, out-of-order/duplicate venue
events, latch of last-own-fill. `asyncio.run` per case; no real sleeps/soaks.
- **typing** — money is **Decimal, never float** (catch a float leaking into a price/size);
V-TYPES are frozen (mutation raises); enums are exhaustive; beartype where the code uses it.
- **bugs** — poison + edges: NaN/inf/negative/zero price & size, dust below step, tick=0,
side inversion (ENTER vs EXIT), TTL boundary (== vs > ttl), filled-vs-unfilled sweep,
gate on/off, sink that raises (journal must not), duplicate/after-close, unknown action.
## Litmus (non-negotiable — testing doctrine)
**Mutation test each invariant:** flip a comparison / drop a guard / return a constant — a test
MUST go red. Invariants already proven red (preserve + extend): commission sign
(`fee_cost_from_commission`), side-lane never-raises (`FrictionJournal.record`), EXIT side
inversion (`intent_translator._position_side`), entry-maker policy (`smart_bridge.urgency_for`),
stale-sweep (`smart_bridge._sweep_stale_entry`). No green-by-pollution (restore any
sys.path/env/cwd you touch). Deterministic; seed-pin anything stochastic.
## Run
```
cd /mnt/dolphinng5_predict
/home/dolphin/siloqy_env/bin/python3 -m pytest prod/exec_unified/ -q
/home/dolphin/siloqy_env/bin/python3 -m pytest prod/clean_arch/violet/uv/exec/ -q
```
Current baseline: 143 green in `prod/exec_unified/`, 11 green in `violet/uv/exec/`. Grow it.
Keep everything offline + MOCK. Ping Fable on the bus with questions.