chore: checkpoint contaminated Gate 2 findings

This commit is contained in:
2026-08-03 08:46:51 -04:00
parent 0c6b6b90a1
commit 56d7c7880e
21 changed files with 1593 additions and 892 deletions

View File

@@ -1,101 +1,95 @@
# Sprint Board
**Last Updated:** 2026-07-11 | **Active Sprint:** 3 — Production Hardening
**Build:** ✅ Clean | **Tests:** ✅ 492 passing (404 core + 78 integration + 10 performance) | **SIM Gate:** ⏳ In progress
# NT8 SDK — Sprint Board
**Last Updated:** 2026-07-14
**Truth source:** compiler output, test output, deployed-file comparisons, and runtime artifacts override board claims.
> Kilocode maintains this file. After every task: move ACTIVE → COMPLETED, advance QUEUE → ACTIVE.
> Full prompts for every task are in `KILOCODE_RUNBOOK.md`. Next prompt is always in `NEXT_PROMPT.md`.
## Current gate state
| Area | State | Evidence / required next step |
|---|---|---|
| Core source build | ✅ | `verify-build.bat`: 0 errors; 6 existing CS1998 warnings in test mocks/tests. |
| Automated tests | ✅ | 497 passed: 409 Core, 78 Integration, 10 Performance. |
| Provenance | ✅ | Session/trade records include session, parameter hash, and compiled code-version stamp. |
| Scenario coverage | 🟡 | 5/8 genuine assertions; 3 explicitly deferred for missing seams. |
| Gate Run #2 | ⏳ | Complete RB-4.1 configuration freeze, deploy/compile the cleanup source, then start the gate. |
> **Gate deployment rule:** Once RB-4.1 is recorded and Gate Run #2 begins, do not dual-deploy to the gate machine. Run GAP-025 and connection-seam work in branches only.
---
## ✅ COMPLETED THIS SPRINT
## 🔵 ACTIVE — Human Gate Preparation
**[TASK-06a]** Runner Mode Architecture | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Core/Common/Models/Configuration.cs` (RunnerMode enum), `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`
- Implemented: RunnerMode enum (Auto, Mode1DualLeg, Mode2RunnerOnly, Mode3ScalerOnly, Disabled); ResolveRunnerMode() with Auto logic (Qty≥2→Mode1, Qty=1→Mode2); four mode behaviors in SubmitOrderToNT8(); [SDK] log confirms resolved mode; dual-deployed to NT8 Custom\Strategies\
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (486 tests passing)
**[TASK-06b]** ATR Dynamic Stop | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`
- Implemented: EnableDynamicStop, AtrPeriod (14), AtrMultiplier (1.5), MinStopTicks (12), MaxStopTicks (50); ATR accessed via ATR(Close, AtrPeriod)[0] in State.Configure; intent.StopTicks overridden pre-sizing; [SDK] Dynamic stop log confirms ATR stop value; context.CustomData["current_atr"] populated; dual-deployed.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (486 tests passing)
**[GAP-019]** Portfolio Heat — Tier 3.5 Risk Layer | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Core/Risk/AdvancedRiskManager.cs`, `src/NT8.Core/Risk/AdvancedRiskModels.cs`
- Implemented: MaxHeatPct parameter (default 3.0) in AdvancedRiskConfig; ValidatePortfolioHeat() calculates TotalOpenRisk/AccountBalance; called as Tier 3.5 in ValidateOrder(); returns RiskDecision.Reject with reason when exceeded; _logger.LogDebug heat check logging; edge cases for 0/negative account balance handled.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (486 tests passing)
**[GAP-003]** RiskPerTrade ≤ MaxTradeRisk Assertion | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Core/Common/Models/Configuration.cs` (RiskPerTrade property), `src/NT8.Core/Risk/BasicRiskManager.cs`, `tests/NT8.Core.Tests/Risk/BasicRiskManagerTests.cs`
- Implemented: RiskPerTrade property in RiskConfig; validation in ValidateOrder() throws ArgumentException if RiskPerTrade > MaxTradeRisk; unit tests for >, ==, < cases.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (401 core tests passing)
**[GAP-004]** orbRangeTicks Hardcoded 0.0 Fix | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `src/NT8.Core/Intelligence/FactorCalculators.cs` (DailyBarContext)
- Implemented: OrbRangeTicks field added to DailyBarContext; BuildDailyBarContext now calculates orbRangeTicks = (ORB high - ORB low) / TickSize; CreateIntent passes computed value; Factor 7 (ORBvsATR) now receives correct orb_range_ticks.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (401 core tests passing)
**[GAP-005]** GetRiskStatus() Returns Live Config Value | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Core/Risk/BasicRiskManager.cs`, `tests/NT8.Core.Tests/Risk/BasicRiskManagerTests.cs`
- Implemented: _currentDailyLossLimit field updated from config.DailyLossLimit on each ValidateOrder(); GetRiskStatus() returns actual value; constructors initialize to default (1000) or provided value; 3 unit tests: explicit limit, default, config switching.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (492 tests passing)
**[GAP-006]** Position-Close-Driven _tradeTaken Re-arm | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`
- Implemented: OnPositionUpdate() sends clear_trade_taken when position goes flat; EnableBarBasedRearm parameter (default false) gates legacy bar-driven re-arm for SIM-only; SimpleORBStrategy.SetParameters() handles both force_session_reset and clear_trade_taken.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (492 tests passing)
**[GAP-010]** Short-Side Regime Filter | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`
- Implemented: EnableShortTrendFilter parameter (default true); short veto when AVWAP slope > 0 (bullish); long veto in bearish regime always enforced; parameter passed via StrategyContext.CustomData; logs when vetoed.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (492 tests passing)
**[GAP-008]** CME Holiday Awareness | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Core/Calendar/CmeHolidayCalendar.cs` (new), `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`
- Implemented: CmeHolidayCalendar with 9 observed holidays + Good Friday (Easter calc); EnableCMEHolidayGuard parameter (default true); NT8StrategyBase.OnBarUpdate() skips on holidays; SimpleORBStrategy.OnBar() skips ORB window; early-close tracking via IsEarlyClose().
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (492 tests passing)
**[GAP-009]** ATR Trailing Real ATR Wiring | Sprint 3 | ✅ DONE 2026-07-11
- Files: `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`
- Implemented: EnableATRTrailing, ATRTrailingPeriod (14), ATRTrailingMultiplier (2.0), ATRTrailingMinTicks (8), ATRTrailingMaxTicks (60); SubmitOrderToNT8() computes trailTicks = clamp(round(ATR(Close,Period)[0]/TickSize * Mult), Min, Max); uses SetTrailStop; logs [SDK] ATR Trail line; falls back to RunnerTrailTicks when disabled.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (492 tests passing)
**[GAP-011]** Gitea CI Pipeline | Sprint 3 | ✅ DONE 2026-07-11
- Files: `.gitea/workflows/ci.yml`, `scripts/ci_build.sh`
- Implemented: Gitea Actions workflow with Windows self-hosted runner (primary) + Linux/mono fallback; triggers on push/PR to main; runs verify-build.bat logic; uploads test artifacts and build logs on failure; ci_build.sh wrapper for Linux/mono runners.
- Verification: .\verify-build.bat ✅ | dotnet test ✅ (492 tests passing)
**[RB-4.1] Gate Run #2 Configuration Freeze** | Human operator | 🔵 ACTIVE
- In SimSimple ORB, set and verify: `EnableDynamicStop=TRUE`, `RunnerActivationMode=Auto`, `RegimeGate=GradePenalty`, `MinTradeGrade=A`, `MaxDailyTrades=1`, `TestMode=FALSE`, `EnableFileLogging=TRUE`, `EnableVerboseLogging=TRUE`, and `LogDirectory=C:\\Users\\billy\\Documents\\NinjaTrader 8\\log\\nt8-sdk`.
- Export settings, retain the parameter hash and code-version stamp, and record `DEC-GATE2-CONFIG` with the gate start date.
- Before the gate begins, dual-deploy the completed cleanup source and run the NinjaTrader compile check.
- Acceptance: the frozen export/provenance evidence is archived and the no-deploy rule is in force at gate start.
---
## 🔵 ACTIVE
## 📋 QUEUE — no deploy to the gate machine during a run
*All Sprint 3 tasks complete. Sprint 4 backlog ready for next session.*
**[GAP-025] Runner No-Fill Anomaly Diagnosis** | Sprint 2.7 | ⏳ QUEUED — branch-only during Gate Run #2
- Add diagnostic-only runner order/execution state logging.
- Diagnose the SIM fill sequence; this blocks live promotion, not Gate Run #2.
**[GAP-022-FOLLOWUP] Connection-State Test Seam** | Sprint 2.7 | ⏳ QUEUED — branch-only during Gate Run #2
- Add an injectable connection-state seam around `NT8StrategyBase`.
- Then implement the three deferred scenarios: news-day reduced sizing, mid-trade disconnect, and pre-entry disconnect.
**[GAP-030] Historical ORB State Hydration** | Sprint 2.7 | ⏳ QUEUED — branch-only during Gate Run #2
- On a late strategy enable, reconstruct only the current day's 09:30–10:00 ET opening-range high/low from loaded bars.
- Preserve the realtime replay guard: hydrated historical bars must never create an intent/order; only genuine post-hydration realtime bars may be evaluated.
- Add tests for correct range reconstruction and for zero historical-order submissions.
**[GAP-007] Walk-Forward Validation** | Sprint 2.7 | ⏳ QUEUED — only after a passing Gate Run #2 ruling
---
## 📋 SPRINT 4 BACKLOG (not yet queued — awaiting Sprint 3 gate)
## ✅ COMPLETED — Sprint 2.7
- **VWAPMeanReversion** — new core strategy, 11 AM–2 PM RTH window, uses AVWAPCalculator
- **OvernightGapContinuation** — gap >0.5% from prior close, enter at open in gap direction
- **OvernightGapReversion** — gap >1% stalls and reverses, 15-min time gate
- **LondonORBNT8** — 30-min ORB at 3:00–3:30 AM ET, MaxContracts=1
- **GAP-013** — ContractRollHandler.InitiateRollover() completion
- **GAP-015** — Config JSON export/import (StrategyConfig, RiskConfig, SizingConfig)
- **GAP-014** — LiquidityMonitor Level II data prep
- **MNQ Phase 1 Prep** — go-live checklist, MNQ parameter calibration, risk limits for micro
**[TASK-GOV-02] Governance Truth Reconciliation** | ✅ 2026-07-13
- Restored the July 11 historical record, corrected documentation placement, and logged DEC-20260713-02.
**[TASK-00a] Provenance Controls (reissued)** | ✅ 2026-07-13
- Session provenance, trade JSONL, SHA256 parameter hashing, settings export, TestMode state, and July 11 parameter export are implemented.
**[GAP-024] Session Tagging Data Layer** | ✅ 2026-07-13
- Exact `RTH_ORB`, `ETH`, `HOLIDAY`, and `EARLY_CLOSE` tags are written to provenance and trade records.
**[GAP-022] Scenario Tests** | 🟡 PARTIAL — 5/8 verified 2026-07-14
- Implemented with real assertions: high volatility rejection, low liquidity degradation, partial fill, daily-loss halt, and circuit-breaker open.
- Deferred honestly with source TODOs: news-day reduced sizing needs calendar/sizing-policy API; mid-trade and pre-entry disconnect scenarios need an injectable connection-state seam.
**[GAP-029] Code-Version Provenance Stamp** | ✅ 2026-07-14
- Session provenance, per-trade JSONL, settings exports, and SimpleORB snapshots now record the compiled assembly version plus module MVID.
- Each real-time signal also writes its TestMode/LIVE MODE state to the session file log.
---
## 📋 SPRINT 5 BACKLOG (deferred — requires 60+ days live data)
## 📋 HISTORICAL RECORD: July 11 Sprint (Sprint 2) — COMPLETED
- **FastAPI /predict endpoint** — LightGBM/XGBoost on Ollama workstation
- **MLSignalFactorCalculator** — 11th IFactorCalculator calling /predict
- **Multi-strategy PortfolioManager** — coordinator for shared-account strategies
- **Dashboard Phase 1+2** — read-only then real-time WebSocket
- **n8n AM Briefing** — daily pre-market summary (see IDEAS_BACKLOG.md)
- **GAP-017** — ParameterOptimizer → NT8 Strategy Analyzer wiring
The following 11 tasks were completed on 2026-07-11 and are already implemented in code. They were incorrectly erased/re-queued during a prior governance rewrite; this record preserves their actual completion dates.
| Task | Sprint | Date | Status |
|---|---:|---|---|
| TASK-06a Runner Mode | 2 | 2026-07-11 | ✅ |
| TASK-06b ATR Dynamic Stop | 2 | 2026-07-11 | ✅ |
| GAP-019 Portfolio Heat | 2 | 2026-07-11 | ✅ |
| GAP-003 RiskPerTrade Assert | 2 | 2026-07-11 | ✅ |
| GAP-004 orbRangeTicks Fix | 2 | 2026-07-11 | ✅ |
| GAP-005 GetRiskStatus Live | 2 | 2026-07-11 | ✅ |
| GAP-006 Position-Close Re-arm | 2 | 2026-07-11 | ✅ |
| GAP-010 Short-Side Filter | 2 | 2026-07-11 | ✅ |
| GAP-008 CME Holiday | 2 | 2026-07-11 | ✅ |
| GAP-009 ATR Trailing | 2 | 2026-07-11 | ✅ |
| GAP-011 Gitea CI | 2 | 2026-07-11 | ✅ |
---
## 🚫 BLOCKED
## 📋 Sprint 3 Backlog — deferred until Gate Run #2 ruling
*(None — add items here if a task cannot proceed, with blocking reason)*
- TASK-06d — VWAP Mean Reversion
- GAP-013 — ContractRollHandler completion
- GAP-014 — LiquidityMonitor Level II preparation
- GAP-015 — Config JSON export/import
- MNQ-001 / MNQ-002 — MNQ preparation and parameter calibration