forked from chiki2bum2/SniperGold_ML
13 KiB
13 KiB
P3-S22.1 VERIFICATION DEBT-CLOSURE — FINAL REPORT
Date : 2026-08-25
Session : P3-S22.1 — VERIFICATION DEBT CLOSURE (machine-readable only)
Status : COMPLETE (verification-only; NO repair performed)
Result : C — DISCREPANCY FOUND
2 documented contract-level departures (ADJ-1 F2 state label,
ADJ-2 M30 research-vs-runtime alignment); no production/ML/
external-data change; population replay proven impossible in
this environment (UNVERIFIED — ENVIRONMENT/DATA REPRODUCTION
LIMITATION); P3-S21.1 coefficient re-audit VERIFIED.
Policy : docs/CODE_VERIFICATION_AND_SILENT_BUG_POLICY_v1.md
Next : P3-S22.2 = NOT STARTED (owner decision required)
A. Session handover used
docs/SESSION_HANDOVER_2026-08-25_P3_S22_TERMINAL_INDICATOR_VERIFICATION.md
(newest by Git ancestry at start; predecessor chain traced through the
handovers/reports to P1 as required).
B. Starting checkpoint (verified before any work)
P3_S2211_START_SHA : 010ee52d76617e55ae11d4f83d828bcd10c968fc
local HEAD == origin/main (git ls-remote origin HEAD == 010ee52),
branch main, working tree CLEAN, no stash, no untracked files,
origin = https://forge.mql5.io/chiki2bum2/SniperGold_ML.git
Reconciles exactly with the P3-S22 handover (P3-S22 final SHA recorded as
f90f878 + the doc-close commit 010ee52 on top; two-commit convention).
C. Final SHA
P3_S2211_FINAL_SHA : ef80fc31b44e6bcf90d4999bffe80b84f0df87da
(main == origin/main, working tree CLEAN)
D. Method
Each of the four debt items was treated as an INDEPENDENT verification target
with its own oracle, inputs, expected result, independent comparison,
deterministic evidence, failure classification and reproducibility (two runs,
byte-identical except generated_utc). Visual verification: NONE (prohibited).
Mutation testing performed exclusively on disposable in-memory copies.
1. SUBPHASE 1 — F2 NUMERIC ZONE-BOUNDARY PARITY
Oracle : independent canonical zone-contract evaluator written fresh for this
audit (UNMITIGATED/PARTIALLY_FILLED/FULLY_MITIGATED; FVG wick
full-fill; OB close-through strict; invalidation = full fill).
Runtime : faithful numeric transcription of the FROZEN MQL5 functions
(AF_FVGZoneState / AF_OBZoneState / AF_FindFVG / AF_FindOrderBlock,
AF_Engine2_Agents.mqh) with exact operators and 1e-12 overlap
tolerance; series (reversed) indexing identical to the runtime.
Matrix : F2B-01..F2B-16 + probes F2B-E1/E2 (narrow/wide zone, exact lower &
upper boundary touch, inside/outside price, exact mitigation
threshold, just-below threshold, invalidation terminal, pre-entry
mitigation, post-entry mitigation scope, bull/bear symmetry,
newest-active find, epsilon-window probes).
RESULT (consumer/availability level) : 15/15 ALIGNED PARITY
- every boundary/touch/threshold/invalidation/availability case agrees
between runtime transcription and the independent oracle;
- real-feed cross-check on the validated research feed (600 bars):
1085 zone-state checks, 0 aligned mismatches;
- mutations 3/3 detected (FVG '<='->'<', OB '<'->'<=', overlap epsilon
1e-12->1e-9);
- probes F2B-E1/E2: representation-level tolerance window (production
1e-12 vs canonical 1e-9) reachable only by sub-tick prices (price is
quantized to the 0.01 point) — classified
REPRESENTATION_LEVEL_TOLERANCE_WINDOW, not a real-price defect.
EXACT-LABEL DEPARTURE (recorded, NOT repaired):
3/15 state cases and 570/1085 real-feed checks show the PARTIALLY_FILLED
mit_state label handled differently:
production : mit_state = UNMITIGATED(0) + partial_filled flag = true
contract : mit_state = PARTIALLY_FILLED(1)
Source-verified: AF_ZONE_PARTIALLY_FILLED appears in AF_Engine2_Agents.mqh
only in the enum definition and in IsActive(); it is NEVER assigned by
AF_FVGZoneState / AF_OBZoneState. The committed research chain (reference +
vectorized kernels) and the frozen contract use mit=1. Consumer availability
is identical (IsActive treats 0 and 1 the same); F3 is fed the research-
encoded inputs (verified EXACT 25/25 in P3-S22); ML features do not consume
mit_state.
-> DISCREPANCY-ADJ-1 (see discrepancy report). Severity LOW.
Classification (debt item 1) : DISCREPANCY FOUND — REQUIRES INVESTIGATION
(boundary matrix and consumer semantics VERIFIED; one contract-state-label
mismatch discovered and documented).
2. SUBPHASE 2 — HISTORICAL M30/H4 BOUNDARY-TIMESTAMP PARITY
Oracle : from M15 open timestamps only (frozen as-of §L / GR-T11): the
selected higher-timeframe bar is the newest CLOSED bar with
close_time <= decision close (t+900). No runtime used.
Self-test: boundary fixtures (exact M30/H4 boundary, before/after, data gap)
PASS (monotone ids, boundary-exact, closed-bar property).
H4 : committed H4 gate series is constant within the frozen as-of buckets
on the FULL feed (197,032 bars): 0 constancy violations, boundary
exact. Real H4 feed as-of: change events match except 142
idealized-grid-only events that are US-market-holiday feed gaps
(Jul-4, Thanksgiving, NYE, MLK); real-only = 0 (no false
negatives); 9 real-feed constancy residuals are the same holiday
artifacts (gate series is grid-synthesized at feed gaps).
M30 : committed M30 gate changes ONLY at odd M15 indices (28,395 change
points, 100% odd) -> constant within each index-pair segment
(research construction: m30_from_m15 resamples M15 by index pairs);
internal as-of consistency 0 violations. It is NOT constant within
fixed-UTC 30-min buckets (best wall-clock grid violations 7,040)
and the pair phase drifts across session/data gaps.
M15/H4/M30 relationship : PASS (as-of H4 open <= as-of M30 open; opens on the
30-min / 4-h grids; ids monotone).
Mutations : 3/3 detected (unclosed-bar selection, wrong-period bucket,
off-by-one bucket).
RESULT:
H4 historical boundary-timestamp selection: VERIFIED (0 violations on the
frozen grid; boundary-exact; closed-bar; real-feed superset explained).
M30: the research M30 construction is index-pair aligned and therefore
differs from the runtime UTC-clock M30 at gaps — the documented claim in
spec_tests_engine2_gates.py ("identical to the runtime M30 OHLC") does not
hold at session gaps.
-> DISCREPANCY-ADJ-2 (see discrepancy report). Severity LOW-MODERATE;
no setup-level impact demonstrated (h4==m30==direction holds on all 571
binary rows; F3 exactness independent; ML features do not consume M30
timestamps).
Classification (debt item 2) : DISCREPANCY FOUND — REQUIRES INVESTIGATION
(H4 dimension VERIFIED; M30 research-vs-runtime alignment divergence
discovered and documented).
3. SUBPHASE 3 — POPULATION-LEVEL TERMINAL REPLAY
Target : 694 total / 686 in-scope = 594 leads + 92 follow-ons
(committed P3-S19/20 accounting).
Feasibility : an exact terminal replay requires (R1) per-M15 F1 events,
(R2) per-M15 F2 zones, (R3) per-M15 F4 gates, (R4) the
AFSetupEngine chain over the FULL research scope (194,985
bars, 2017-01-03..2026-07-21), (R5) the SAME feed as the
research environment, and (R6) machine-readable per-setup
export.
Blocker proof :
B1 deployed runtime reads broker history via CopyRates; research uses
committed npz feeds (different data registries); feed substitution is
prohibited by the phase brief.
B2 no committed MQL5 full historical semantic-input replay harness exists
in the repo (only 2026 tester windows were ever run: P3-S22).
B3 terminal coverage = ~20 trading days of 2026; the population range
(2017-2026) is untouched by the terminal.
B4 the research chain (F1/F2/F4/F3) is FULL PARITY at research level
(P3-S17R2), so the SEMANTICS are verified; only the terminal full
population replay is missing.
RESULT: exact population replay is NOT technically possible in this
environment without building a new terminal replay capability or substituting
the feed (both out of scope). No aggregate-count similarity is claimed as
reproduction evidence.
Classification (debt item 3) : UNVERIFIED — ENVIRONMENT/DATA REPRODUCTION
LIMITATION (as prescribed; NOT labelled PASS).
4. SUBPHASE 4 — P3-S21.1 COEFFICIENT-LEVEL RE-AUDIT (independent)
Method : reconstructed the frozen P3-S20 fold training data (571 binary
rows; folds (0,300,300,395),(0,395,395,490),(0,490,490,571); purge
16) from the FROZEN dataset; refit the frozen logistic per fold
(StandardScaler train-only + LogisticRegression(C=1.0, max_iter=
5000, seed 42)); independently derived standardized coefficients,
signs, ranks, mean|std|; independently verified the structural
identities; the committed S20/S21.1 values were used ONLY as
cross-checks, never as the oracle.
RESULT :
structural identities (all True on 571 rows):
h4_gate == m30_gate == direction TRUE
dist_to_zone_center_atr == price_in_zone_offset - 0.5 TRUE
choch_latency_bars == sweep_age_bars - choch_age_bars TRUE
zone_type_code constant TRUE
pooled OOS ROC-AUC (independent) = 0.5791603786527645
committed P3-S20 pooled ROC = 0.5791603786527645 (cross-check equal)
OOS cross-check max|d| vs committed CSV = 0.0 (271/271 rows)
coefficients reproduce the committed S21.1 table EXACTLY (e.g.
price_in_zone_offset std +0.1186/+0.1251/+0.1705; direction/h4/m30
-0.0945/-0.0688/-0.0824; zone_width_atr -0.0786/-0.0939/-0.0642).
focus features (top-rank, stable sign) = direction/h4/m30 and
price_in_zone_offset/dist_to_zone_center_atr (matches S21.1).
mutation tests 7/7 detected (fold-boundary shift, global-scaler leak,
h4 identity break, zone-center affine break, latency identity break,
zone-type constancy break, feature-column swap — the last requiring the
full feature-table signal, per the P3-S22 sparse-vs-full lesson).
reproducibility: run twice byte-identical.
Classification (debt item 4) : VERIFIED
5. REPRODUCIBILITY
Every subphase executed twice from the same frozen inputs.
s2211_run_repro.py compares ALL produced artifacts:
s2211_s1_f2_boundary.json OK
s2211_s2_mtf_boundary.json OK
s2211_s3_population_feasibility.json OK
s2211_s4_coefficients.csv OK
s2211_s4_reaudit.json OK
s2211_s4_repro.json OK
identical_except_generated_utc = True
6. PROVENANCE
Git SHA : 010ee52 (start) -> ef80fc31b44e6bcf90d4999bffe80b84f0df87da
(pushed HEAD)
feature_sha16 : unchanged (S4 uses the frozen schema; no recomputation of
hashes changed any committed artifact)
dataset identity: frozen P3-S16/S18 pipeline (571 binary rows)
environment : Python 3.14.6, numpy 2.5.1, scikit-learn 1.9.0, Windows,
x64; no MetaTrader terminal execution in this phase
input hashes : recorded per-run (numpy arrays / committed caches)
output hashes : sha256 of each artifact recorded by s2211_run_repro.py
test counts : S1 15+2 probes (mutations 3/3); S2 8 blocks (mutations
3/3); S3 feasibility 4 blockers; S4 12 features x 3 folds
+ 7 mutations
discrepancies : 2 (ADJ-1, ADJ-2) - documented, not repaired
7. FINAL CLASSIFICATION
Debt item 1 (F2 numeric boundary parity) : DISCREPANCY FOUND
Debt item 2 (M30/H4 timestamp parity) : DISCREPANCY FOUND
Debt item 3 (population replay) : UNVERIFIED - ENVIRONMENT/DATA
REPRODUCTION LIMITATION
Debt item 4 (S21.1 coefficient re-audit) : VERIFIED
OVERALL DECISION : C — DISCREPANCY FOUND
(an actual implementation/semantic mismatch was discovered in items 1-2;
no defect repair performed; see docs/P3_S22_1_DISCREPANCY_REPORT.md)
8. PRODUCTION / ML / EXTERNAL-DATA STATUS
Production MQL5 : UNCHANGED (verified by git: no tracked file modified).
F1/F2/F3/F4 : UNCHANGED (contracts untouched).
FEATURE_CONTRACT: UNCHANGED. Label contract v1: UNCHANGED. TP/SL/H: UNCHANGED.
ML : NONE (no retraining, calibration, feature selection,
ablation, nonlinear models, deployment).
External data : NONE introduced (no Tickstory/Dukascopy/substitution).
Trading/deploy : NONE.
9. NEXT-PHASE STATEMENT
P3-S22.2 = NOT STARTED. No automatic advance to P3-S22.2 / P3-S23 / ML
retraining / calibration / feature redesign / nonlinear modeling /
external-data integration / deployment. Owner decision required.
End of P3-S22.1 debt-closure report. Evidence under ml/p3/p3_s2211_debt_closure/ (disposable, verification-only).