SniperGold_ML/ml/p3/p3_s222_discrepancy_impact/README.md

121 lines
6.1 KiB
Markdown

# P3-S22.2 — DISCREPANCY IMPACT ASSESSMENT & REPAIR DECISION (research-only)
```text
Session : P3-S22.2 — DISCREPANCY IMPACT ASSESSMENT & REPAIR DECISION
Status : COMPLETE (research-only; NO repair, NO production modification)
Policy : docs/CODE_VERIFICATION_AND_SILENT_BUG_POLICY_v1.md
Disposable : YES — verification/audit artifacts only; nothing here is part of
the production MQL5, FEATURE_CONTRACT, labels, or ML pipeline.
Owner : chiki2bum2 (authoritative repo)
Scope : ADJ-1 (F2 mit_state label) and ADJ-2 (M30 index-pair vs UTC-clock)
impact on F2 semantics, F3 Candidate Setup, F4 gating, Candidate
Setup population, P3-S16 labels, P3-S18/P3-S20 ML, production.
```
This namespace holds the independent oracles, deterministic replay, tests,
machine-readable evidence, and reproducibility manifest for the P3-S22.2
impact assessment of the two discrepancies discovered in P3-S22.1.
---
## What was assessed
| Discrepancy | Observed | Potential effect under test |
|---|---|---|
| ADJ-1 | production FVG/OB zone state never assigns `mit_state=PARTIALLY_FILLED(1)`; partial fills stay `UNMITIGATED(0)`+`partial_filled` | does the representation change F2 semantics, F3 creation, features/labels? |
| ADJ-2 | research M30 gate uses index-pair resampling of M15, not UTC-clock M30 buckets | does the M30 construction difference propagate into F4/F3/Candidate Setups/ML? |
## Scripts (run in order)
| Script | Part | Role |
|---|---|---|
| `s222_partA_adj1.py` | A | independent zone-contract oracle + 14 cases + 6 mutations; ADJ-1 impact |
| `s222_partB_adj2.py` | B | independent UTC-clock M30 oracle + gap taxonomy + 5 mutations; ADJ-2 bar/gate measurements |
| `s222_partC_replay.py` | C | deterministic counterfactual replay (C-A: mit encoding; C-B: UTC M30 gate) on the full scope |
| `s222_partC_spotcheck.py` | C | mechanism spot-check of the C-B population difference |
| `s222_partD_ml.py` | D | ML-impact determination (frozen P3-S18/S20 rows unchanged; population sensitivity quantified) |
| `s222_partE_decision.py` | E | machine-readable repair decision matrix |
| `s222_run_repro.py` | F | reproducibility runner (2 runs, byte-identical except `generated_utc`) |
## Outputs
```text
output/s222_partA_adj1.json ADJ-1 oracle/cases/mutations
output/s222_partB_adj2.json ADJ-2 UTC-clock oracle measurements
output/s222_partC_replay.json counterfactual replay summary
output/s222_partC_rows.csv row-level population diff (909 rows)
output/s222_partC_spotcheck.json mechanism spot-check
output/s222_partD_ml.json ML impact determination
output/s222_partE_decision.json repair decision matrix
output/s222_reproducibility.json reproducibility manifest
output/s222_oracle_utc_m30_cache.npz deterministic cache of the UTC M30 oracle
```
## Headline evidence
### ADJ-1 (Part A + C-A)
- 14/14 cases: production (mit=0+flag) and contract (mit=1) are consumer-ALIGNED
and F3-IDENTICAL; 8/14 exact-label departures (the ADJ-1 label itself).
- Mutations 6/6 detected where contractually expected.
- Part C counterfactual (production mit encoding on the full scope):
**IDENTICAL** — 686/686 chain identities, per-bar outcome signature equal,
0 feature-row changes.
- Classification: **A — REPRESENTATIONAL ONLY / NO DOWNSTREAM IMPACT**.
### ADJ-2 (Part B + C-B)
- UTC-clock M30 oracle: 100,764 M30 bars vs 98,516 index-pair; full-feed gate
diffs 38,399 bars (19.49%); scope diffs 37,651 (19.31%); diff attribution:
intraday-break/weekend/holiday gaps and continuous stretches after a phase
shift. Mutations 5/5 detected.
- Part C counterfactual (UTC m30 gate into the SAME frozen F3 chain):
**DIFFERS** — 686 committed in-scope vs 707 UTC-clock in-scope; 202
committed chain identities NOT reproduced, 223 different identities appear;
per-bar outcome signature differs; shared rows keep m30_gate feature
unchanged (structural identity h4==m30==direction on surviving rows).
- Spot-check: shared (484) setups have 0% creation-bar gate differences;
baseline-only (202) have 62%; UTC-only (223) formed under differing gates.
- ML rows (frozen P3-S18/P3-S20): NOT modified. The historical population is
M30-construction-dependent: 202/686 committed in-scope row-identities are
not reproduced under runtime-consistent UTC-clock M30, and 223 different
ones appear.
- Classification: **C — HISTORICAL BEHAVIOR IMPACT CONFIRMED** (Candidate
Setup creation/population level under runtime-consistent semantics).
## Decision (support only; NOT implemented)
```text
ADJ-1 : ACCEPT WITH CONTRACT CLARIFICATION (option 2) — document that the two
encodings are functionally equivalent; no code repair justified.
ADJ-2 : REPAIR REQUIRED — SEPARATE AUTHORIZATION (option 3) — rebuild the
RESEARCH M30 gate construction on the UTC grid and re-derive Candidate
Setups / P3-S18 / P3-S20 as a separate authorized phase. NO production
MQL5 repair is needed (runtime reads broker M30, which is UTC-grid).
```
## Rules
- NO production MQL5 modification; NO FEATURE_CONTRACT/label/TP-SL/horizon
change; NO retraining; NO calibration; NO nonlinear model; NO external data;
NO Tickstory/Dukascopy; NO deployment; NO trading; NO optimization.
- All mutation/alternate implementations live in disposable copies only.
- Historical P3-S16..P3-S22 artifacts are NOT modified (additive docs only,
per the new handover).
- Reproducibility: every artifact is deterministic; the runner executed each
part twice and found byte-identical substantive outputs (only
`generated_utc` differs).
*End of P3-S22.2 namespace README.*
## Provenance
Docs:
- `docs/P3_S22_2_DISCREPANCY_IMPACT_ASSESSMENT.md`
- `docs/P3_S22_2_REPAIR_DECISION.md`
- `docs/SESSION_HANDOVER_2026-08-25_P3_S22_2_DISCREPANCY_IMPACT_ASSESSMENT.md`
Governing policy: `docs/CODE_VERIFICATION_AND_SILENT_BUG_POLICY_v1.md`.
Inputs: frozen committed caches/feeds (M15 npz, gate-series cache, P3-S18
rows), frozen F3 oracle/engines (canonical_oracle / F3SetupEngine), frozen
agent rules (spec_tests_engine2_gates.py). No network, no terminal execution.