SniperGold_ML/docs/P3_S9_CONSOLIDATED_REPAIR_PLAN.md

202 lines
11 KiB
Markdown
Raw Permalink Normal View History

# P3-S.9 CONSOLIDATED REPAIR PLAN — SNIPERGOLD_ML
```text
Date : 2026-08-22
Session : P3-S.9 — Consolidated Architecture & Repair-Design Review
Status : REPAIR SPECIFICATION ONLY. NOT implemented. No production change.
Purpose : Classify every known issue (RETAIN/REPAIR/REDESIGN/DEPRECATE/
DOCUMENT ONLY) so the future implementation phase patches ONE
architecture (Option A, docs/P3_S9_ARCHITECTURE_REVIEW.md) and
never N files independently.
Priorities : P1 Correctness -> P2 Architecture -> P3 Documentation/cleanup.
Human verification : CANCELLED.
```
---
## 1. MASTER CLASSIFICATION
| ID | Issue | Source evidence | Priority | Classification | Repair family |
|----|-------|-----------------|----------|----------------|---------------|
| BUG-P3S2-001 | stale sweep state consumed in f9/f18 (no validity window) | P3-S.2 E-10; EA 470-471/510-516 | P1 | REPAIR | EVENT contract (validity window) |
| BUG-P3S2-002 | same-bar tie precedence (oldest pivot wins) | P3-S.2 BUG-002 | P3 | DOCUMENT ONLY | terminology |
| BUG-P3S2-003 | runtime vs training window divergence (theoretical) | P3-S.2 E-13 | P1 | REPAIR | training/runtime alignment |
| BUG-P3S2-004 | FEATURE_CONTRACT §0 wording ambiguity | P3-S.2 BUG-004 | P3 | DOCUMENT ONLY | terminology |
| BUG-P3S2-005 | unused parameter time[] | P3-S.2 BUG-005 | P3 | DOCUMENT ONLY | cleanup |
| BUG-P3S3-001 | stale CHoCH consumed in f9/f18 (34.7% / 58.0% stale) | P3-S.3 E-11; audit_choch_state | P1 | REPAIR | EVENT contract (validity window) |
| BUG-P3S3-002 | training STRICT pivots vs runtime equal-allowed (0.26% / 2.40%) | P3-S.3 E-13 | P1 | REPAIR | training/runtime alignment |
| BUG-P3S3-003 | (info) minor divergence notes | P3-S.3 BUG-003 | P3 | DOCUMENT ONLY | cleanup |
| BUG-P3S4-001 | Engine-2 FVG consumed without mitigation | P3-S.4 E-9 | P1 | REPAIR | ZONE contract (mitigation) |
| BUG-P3S4-002 | FVG formation timing divergence (C3 vs lag-1; C/E lookback 40/20) | P3-S.4 E-6/E-15 | P1 | REPAIR | ZONE contract (timing) |
| BUG-P3S4-003 | FVG timestamp convention (C2 vs C3) | P3-S.4 BUG-003 | P3 | DOCUMENT ONLY | terminology |
| BUG-P3S4-004 | (info) | P3-S.4 BUG-004 | P3 | DOCUMENT ONLY | cleanup |
| BUG-P3S5-001 | Engine-2 OB consumed without mitigation/age | P3-S.5 E-9/E-14 | P1 | REPAIR | ZONE contract (mitigation) |
| BUG-P3S5-002 | two OB definitions (strong-move vs structure-break) | P3-S.5 A-2 | P2 | DESIGN DECISION (then DOCUMENT ONLY) | canonical definitions |
| BUG-P3S5-003 | min zone size filters diverge (none/0.15/0.15 ATR) | P3-S.5 BUG-003 | P3 | DOCUMENT ONLY | terminology |
| BUG-P3S5-004 | display dedupe vs Engine-2 newest-only vs legacy keep-all | P3-S.5 A-3 | P2 | DESIGN DECISION | zone consumer scope |
| BUG-P3S6-001 | OB "strong move" 1.5x vs displacement 1.6x | P3-S.6 E-8 | P2 | DESIGN DECISION (unify constant or document) | cross-concept consistency |
| D-1 | hierarchical-to-flat-voting drift | P3-S.7 D-1 / S-A | P2 | REDESIGN (Option A: setup chain gates signal; vote = scoring) | setup layer + aggregator re-scope |
| D-2 | conflict policy undefined | P3-S.7 D-2 / S-X | P2 | REDESIGN (OD-4: gate-fail for context; M3 contrary = micro-score only) | MTF hierarchy |
| D-3 | runtime TF-identity by convention | P3-S.7 D-3 | P2 | REPAIR (assert slot->TF at consume time) | MTF hierarchy |
| D-4 | display vs decision inconsistency (V-1..V-4) | P3-S.7 D-4 | P2 | REPAIR (render setup entity + H4/M30 structures) | display contract |
| D-5 | FEATURE_CONTRACT MTF mismatch (D1/H4/H1 vs H4/M30/M15/M3) | P3-S.7 D-5 | P2 | REDESIGN (OD-2; align or document) | MTF/training alignment |
| D-6 | three MTF models coexist | P3-S.7 D-6 | P2 | DEPRECATE (legacy D1/H4/H1 to reference) | canonical MTF model |
| D-7 | same detector per-TF (role divergence) | P3-S.7 D-7 | P3 | DOCUMENT ONLY (informational) | — |
| D-8 | two incompatible setup definitions (A vs B) | P3-S.8 D-8 | P2 | REDESIGN (canonical = Option A chain; E-rule re-scoped to M15 entry predicate) | setup layer |
| D-9 | score can produce signal without setup | P3-S.8 D-9 | P1 | REPAIR/REDESIGN (entry signal bound to a valid setup) | setup layer + aggregator |
| D-10 | no setup identity | P3-S.8 D-10 | P2 | DESIGN REQUIREMENT (identity contract G) | setup layer |
| D-11 | E-vote saturation masks setup absence | P3-S.8 D-11 | P1 | REPAIR (expose the setup predicate as an explicit field) | setup layer |
| D-12 | no freshness window in Engine 2 (CHoCH/sweep never expire) | P3-S.8 D-12 | P1 | REPAIR (per-stage validity windows) | EVENT/STATE contract |
| D-13 | conflict policy absent at setup level | P3-S.8 D-13 | P2 | REDESIGN (OD-4) | MTF hierarchy |
| D-14 | legacy gate chain not ported to Engine 2 | P3-S.8 D-14 | P3 | DEPRECATE/DOCUMENT (extract semantics, do not restore code) | — |
---
## 2. REPAIR FAMILIES (implementation units for the future phase)
```text
FAMILY 1 — EVENT/STATE contract (fixes A, C, D, J):
BUG-P3S2-001, BUG-P3S3-001, D-12. Adds validity windows + supersession
for sweep/CHoCH events; f9/f18 consumers read events, not raw states.
FAMILY 2 — ZONE contract (fixes B, D):
BUG-P3S4-001/-002, BUG-P3S5-001. Mitigation-aware, timing-unified,
invalidation-aware zone consumption in Engine 2 (C/E agents).
FAMILY 3 — SETUP LAYER (fixes F, I, J; the core of Option A):
D-8, D-9, D-10, D-11, D-1 (aggregator re-scope). Setup entity with
identity (G), lifecycle (H), M15 chain consumer, H4/M30 context gates.
FAMILY 4 — MTF/TRAINING ALIGNMENT (fixes E, G, H):
D-2, D-3, D-5, D-6, BUG-P3S2-003, BUG-P3S3-002. Canonical MTF model,
conflict policy, slot->TF enforcement, training/runtime pivot semantics.
FAMILY 5 — DISPLAY/CONTRACT (fixes F display side):
D-4. Render the setup entity; draw H4/M30 structures; align the
"TRADE SETUP" panel with the setup layer.
FAMILY 6 — CANONICAL DEFINITIONS / CLEANUP (fixes E, P3):
BUG-P3S5-002/-003/-004, BUG-P3S6-001, BUG-P3S2-004/-005, BUG-P3S3-003,
BUG-P3S4-003/-004, D-7, D-14. Adjudicate definitions; document;
deprecate legacy semantics to reference.
```
---
## 3. REPAIR PRIORITIES
### Priority 1 — Correctness (stale state, wrong mitigation, lifecycle, future leakage, runtime/training mismatch)
```text
BUG-P3S2-001, BUG-P3S3-001, BUG-P3S2-003, BUG-P3S3-002,
BUG-P3S4-001, BUG-P3S4-002, BUG-P3S5-001, D-9, D-11, D-12
-> FAMILY 1 + FAMILY 2 + (D-9/D-11 setup-predicate exposure)
```
### Priority 2 — Architecture (setup identity, MTF hierarchy, primitive relationships, canonical definitions)
```text
D-1, D-2, D-3, D-4, D-5, D-6, D-8, D-10, D-13,
BUG-P3S5-002, BUG-P3S5-004, BUG-P3S6-001
-> FAMILY 3 + FAMILY 4 + FAMILY 5 (after owner adjudication of OD-1..OD-5)
```
### Priority 3 — Documentation/cleanup (terminology, legacy comments, duplicate specs)
```text
BUG-P3S2-004/-005, BUG-P3S3-003, BUG-P3S4-003/-004,
BUG-P3S5-003, D-7, D-14
-> FAMILY 6
```
---
## 4. IMPLEMENTATION ORDER (for the future phase — NOT executed)
```text
Step 0 : Owner adjudication of OD-1..OD-5 (architecture lock).
Step 1 : Tests first — extend P3-S.2/S.3/S.4/S.5/S.8 synthetic suites to
assert the new contracts (f9/f18 expiry, zone mitigation, setup
identity/lifecycle).
Step 2 : FAMILY 1 (EVENT contract) — one repair family at a time.
Step 3 : FAMILY 2 (ZONE contract).
Step 4 : FAMILY 3 (SETUP LAYER, Option A) + aggregator re-scope.
Step 5 : FAMILY 4 (MTF/training alignment).
Step 6 : FAMILY 5 (display) + FAMILY 6 (definitions/cleanup).
Step 7 : Regression (Engine 1/2/3 unit tests), parity (SB-06 class),
setup dataset rebuild; preserve historical evidence
(immutable checkpoints; P3-S.2 §13 rule).
```
---
## 5. EXPLICIT NON-GOALS (this plan does NOT authorize)
```text
- No AUC/PF/profit-based selection of any repair or constant.
- No human annotation restart.
- No ML retraining / parameter optimization.
- No restoring legacy v4.x code as-is (semantics extracted only).
- No "best of both" grab-bag (brief §21).
```
*Provenance: Forge HEAD 533c8c6647a552d01a1a290cb2d0505f94887666 (P3-S.6);
P3-S.7/P3-S.8 artifacts intact. No production file modified. Human
verification CANCELLED.*
---
## 9. P3-S.10 ADDENDUM — OWNER ADJUDICATION COMPLETE (2026-08-22)
```text
Step 0 of §4 (Owner adjudication of OD-1..OD-5 — architecture lock) is now
COMPLETE. The historical body of this plan (§1-§5) is UNCHANGED. This
addendum records only the adjudicated outcomes that finalize the plan's
open design-decision items. Authority: docs/P3_S10_OWNER_ADJUDICATION.md;
frozen contract: docs/SNIPERGOLD_CANONICAL_SETUP_CONTRACT_v1.md.
OD-1 (H4/M30 gate policy) = YES — H4 AND M30 are hard direction-compatible
context gates for Candidate Setup formation; conflict/neutral -> NO
CANDIDATE SETUP. Overrides P3-S.7 S-N/S-C FOR THE SETUP LAYER ONLY.
SIGNAL != CANDIDATE SETUP (H4-only/M30-only/M15-only signals may exist).
OD-2 (Canonical MTF model) = H4/M30/M15/M3 (runtime/setup); D1/H4/H1/M15 =
legacy/current training semantics, UNCHANGED; F4 alignment requirement
recorded. -> finalizes D-5/D-6.
OD-3 (Validity windows) = SEMANTIC CONTRACT per primitive; W_sweep = 40
(justified), W_choch = 40 (justified), zone age = none by semantics;
W_setup / W_m3 / W_zone_age = OPEN NUMERIC PARAMETERS (never from
performance). -> finalizes the "split per stage" row of §J.
OD-4 (MTF conflict policy) = GATE-FAIL for the setup layer (H4<->M30 ->
BLOCKED; M15 vs H4/M30 -> BLOCKED; M3 contrary -> micro-score only;
no arithmetic voting). Aggregator = scoring layer. -> finalizes D-2/D-13.
OD-5 (Canonical OB) = A — OB "strong move" (1.5x avg) is the
intentional simpler proxy for Displacement (1.6x); OB requires NO
displacement and NO BOS/CHoCH (redundant with the chain's CHoCH stage;
legacy structure-break definition = historical). 1.5/1.6 kept and
documented. -> finalizes BUG-P3S5-002 (canonical current confirmed,
DOCUMENT ONLY) and BUG-P3S6-001 (DOCUMENT ONLY, F6).
Master classification deltas (classification column only, per OD):
BUG-P3S5-002 : DESIGN DECISION -> DOCUMENT ONLY (OD-5; canonical current
definition confirmed; legacy structure-break = historical).
BUG-P3S6-001 : DESIGN DECISION -> DOCUMENT ONLY (OD-5; constants kept
separate; roles documented).
D-2, D-13 : REDESIGN -> RESOLVED (OD-4 policy defined; implementation
remains F4).
D-5, D-6 : REDESIGN/DEPRECATE -> RESOLVED (OD-2 model frozen;
implementation remains F4).
D-8 : REDESIGN -> RESOLVED (frozen contract §A/§D; implementation
remains F3).
OD-3 windows : per-primitive semantic contract frozen; OPEN NUMERIC
PARAMETERS recorded (§5 of P3_S10_REPAIR_IMPLEMENTATION_SPEC.md).
ARCHITECTURE STATUS (post-adjudication): READY FOR REPAIR.
Next: P3-S.11 — F1 EVENT CONTRACT REPAIR (separate implementation session,
tests first, one family at a time).
P3-S.10 artifacts: docs/P3_S10_OWNER_ADJUDICATION.md,
docs/SNIPERGOLD_CANONICAL_SETUP_CONTRACT_v1.md,
docs/P3_S10_REPAIR_IMPLEMENTATION_SPEC.md,
docs/SESSION_HANDOVER_2026-08-22_P3_S10_OWNER_ADJUDICATION.md.
No production file modified by P3-S.10. Human verification CANCELLED.
```