PINK: FLAWS doc — backfill SHA b30205c for pass-6 persistence entries
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,7 @@
|
|||||||
| E20 | `_capital()` reads live from `AccountProjection` — stale row risk | Persistence | Low |
|
| E20 | `_capital()` reads live from `AccountProjection` — stale row risk | Persistence | Low |
|
||||||
| E21 | `persist_fill_events()` synthesizes fake Decision/Intent | Persistence | Medium |
|
| E21 | `persist_fill_events()` synthesizes fake Decision/Intent | Persistence | Medium |
|
||||||
| E22 | `_write_trade_exit_leg` capital_before uses arithmetic reconstruction | Persistence | Medium |
|
| E22 | `_write_trade_exit_leg` capital_before uses arithmetic reconstruction | Persistence | Medium |
|
||||||
| E23 | `_write_trade_event` uses entry_price as exit_price — **✅ FIXED `(pass-6)`** | Persistence | Medium |
|
| E23 | `_write_trade_event` uses entry_price as exit_price — **✅ FIXED `b30205c`** | Persistence | Medium |
|
||||||
| E24 | Mock venue always emits fill on `partial_fill_ratio > 0` | Test | Low |
|
| E24 | Mock venue always emits fill on `partial_fill_ratio > 0` | Test | Low |
|
||||||
| E25 | Test scenarios use MARKET-only `_si()` helper — no LIMIT tests | Test | Low |
|
| E25 | Test scenarios use MARKET-only `_si()` helper — no LIMIT tests | Test | Low |
|
||||||
| E26 | Fresh-kernel reconcile tests create second kernel but share venue | Test | Low |
|
| E26 | Fresh-kernel reconcile tests create second kernel but share venue | Test | Low |
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
| G18 | `exit_leg_ratios` no sum-to-1 validation | Config | Low |
|
| G18 | `exit_leg_ratios` no sum-to-1 validation | Config | Low |
|
||||||
| G19 | RealZincControlPlane.read() no sequence check — torn-read risk | Config | Low |
|
| G19 | RealZincControlPlane.read() no sequence check — torn-read risk | Config | Low |
|
||||||
| G20 | ClickHouse journal strategy/db env vars — SQL injection risk | Config | Low |
|
| G20 | ClickHouse journal strategy/db env vars — SQL injection risk | Config | Low |
|
||||||
| G21 | entry_price used as exit_price in trade_events — **✅ FIXED `(pass-6)`** | Persistence | **High** |
|
| G21 | entry_price used as exit_price in trade_events — **✅ FIXED `b30205c`** | Persistence | **High** |
|
||||||
| G22 | active_leg_index → entry_bar semantic mis-mapping | Persistence | Medium |
|
| G22 | active_leg_index → entry_bar semantic mis-mapping | Persistence | Medium |
|
||||||
| G23 | capital_before arithmetic absorbs cross-slot PnL | Persistence | Medium |
|
| G23 | capital_before arithmetic absorbs cross-slot PnL | Persistence | Medium |
|
||||||
| G24 | Recovery trade_reconstruction always has trade_id="" | Persistence | Medium |
|
| G24 | Recovery trade_reconstruction always has trade_id="" | Persistence | Medium |
|
||||||
@@ -383,12 +383,12 @@
|
|||||||
| Flaw | Commit | What changed |
|
| Flaw | Commit | What changed |
|
||||||
|------|--------|--------------|
|
|------|--------|--------------|
|
||||||
| W10 — `BingxHttpError` blindly mapped to "REJECTED" | `e90d542` | `_http_error_status()` helper: 429/5xx/transport → RATE_LIMITED; 4xx → REJECTED |
|
| W10 — `BingxHttpError` blindly mapped to "REJECTED" | `e90d542` | `_http_error_status()` helper: 429/5xx/transport → RATE_LIMITED; 4xx → REJECTED |
|
||||||
| **G21/E23/A13** — `exit_price = entry_price` in trade_events / trade_exit_legs | `(pass-6)` | `_write_trade_event` + `_write_trade_exit_leg` now use `fill_price_hint` (extracted from venue FULL_FILL event) → `intent.reference_price` → `decision.reference_price`; entry_price only as last resort |
|
| **G21/E23/A13** — `exit_price = entry_price` in trade_events / trade_exit_legs | `b30205c` | `_write_trade_event` + `_write_trade_exit_leg` now use `fill_price_hint` (extracted from venue FULL_FILL event) → `intent.reference_price` → `decision.reference_price`; entry_price only as last resort |
|
||||||
| **A14** — `entry_bar` maps `active_leg_index` | `(pass-6)` | `_write_position_state`: `entry_bar = intent.bars_held if intent else 0` |
|
| **A14** — `entry_bar` maps `active_leg_index` | `b30205c` | `_write_position_state`: `entry_bar = intent.bars_held if intent else 0` |
|
||||||
| **A15** — `persist_recovery_state` uses account dict as slot dict | `(pass-6)` | Recovery reads actual slot from `kernel.slot(0).to_dict()` when kernel is wired; `trade_id` no longer always empty |
|
| **A15** — `persist_recovery_state` uses account dict as slot dict | `b30205c` | Recovery reads actual slot from `kernel.slot(0).to_dict()` when kernel is wired; `trade_id` no longer always empty |
|
||||||
| **NaN tracing** — `_safe_float` silently swallows anomalies | `(pass-6)` | `_checked_float()` added: logs WARNING + writes `anomaly_events` spool row on NaN/inf in financial fields; used for `realized_pnl` in exit paths |
|
| **NaN tracing** — `_safe_float` silently swallows anomalies | `b30205c` | `_checked_float()` added: logs WARNING + writes `anomaly_events` spool row on NaN/inf in financial fields; used for `realized_pnl` in exit paths |
|
||||||
| **External-position exit_qty=0** — untracked positions gave empty exit legs | `(pass-6)` | `_write_trade_exit_leg`: when `prev_size<=0` (no prior ENTER tracked), falls back to `initial_size` or `intent.target_size` for exit_qty |
|
| **External-position exit_qty=0** — untracked positions gave empty exit legs | `b30205c` | `_write_trade_exit_leg`: when `prev_size<=0` (no prior ENTER tracked), falls back to `initial_size` or `intent.target_size` for exit_qty |
|
||||||
| **exit_qty field missing** from `trade_exit_legs` rows | `(pass-6)` | `exit_qty` added explicitly to `trade_exit_legs` sink dict |
|
| **exit_qty field missing** from `trade_exit_legs` rows | `b30205c` | `exit_qty` added explicitly to `trade_exit_legs` sink dict |
|
||||||
|
|
||||||
### Fixes applied (2026-06-04 pass 5) — async/thread/race audit
|
### Fixes applied (2026-06-04 pass 5) — async/thread/race audit
|
||||||
|
|
||||||
@@ -1190,7 +1190,7 @@ fixing for robustness.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Flaw A13: `persist_fill_events` uses current price as exit price — **✅ FIXED `(pass-6)`**
|
### Flaw A13: `persist_fill_events` uses current price as exit price — **✅ FIXED `b30205c`**
|
||||||
|
|
||||||
**Location:** `pink_clickhouse.py` lines ~408
|
**Location:** `pink_clickhouse.py` lines ~408
|
||||||
|
|
||||||
@@ -1214,7 +1214,7 @@ for the persisted trade, breaking any PnL reconstruction that relies on
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Flaw A14: `_write_position_state` maps active_leg_index to entry_bar — **✅ FIXED `(pass-6)`**
|
### Flaw A14: `_write_position_state` maps active_leg_index to entry_bar — **✅ FIXED `b30205c`**
|
||||||
|
|
||||||
**Location:** `pink_clickhouse.py` line ~673
|
**Location:** `pink_clickhouse.py` line ~673
|
||||||
|
|
||||||
@@ -1236,7 +1236,7 @@ from `entry_time` to now.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Flaw A15: `persist_recovery_state` passes account dict as slot dict — **✅ FIXED `(pass-6)`**
|
### Flaw A15: `persist_recovery_state` passes account dict as slot dict — **✅ FIXED `b30205c`**
|
||||||
|
|
||||||
**Location:** `pink_clickhouse.py` lines ~447-460
|
**Location:** `pink_clickhouse.py` lines ~447-460
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user