From 2a277bd2a24dc14a5343d2155fb1d44b993eecda Mon Sep 17 00:00:00 2001 From: mo Date: Mon, 26 Oct 2026 12:47:05 -0400 Subject: [PATCH] [GOV]: record GAP-077 implementation and validation status --- SPRINT_BOARD.md | 4 ++-- docs/00-governance/active_work.md | 2 +- docs/00-governance/decisions.md | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/SPRINT_BOARD.md b/SPRINT_BOARD.md index bda8b05..540250d 100644 --- a/SPRINT_BOARD.md +++ b/SPRINT_BOARD.md @@ -9,7 +9,7 @@ | Area | State | Evidence | |---|---|---| | Deployed code matches repo | 🟑 | Orphan quarantined by operator 2026-10-26; deployed source equality/recompile not yet verified. **GAP-065** | -| **Backtests trade** | ❌ **NO since 2026-08-18** | `session_20261019_155354.log`: `Account : Backtest`, `HistoricalReplayCatchup count=117`, zero `SUBMIT`. **GAP-077** | +| **Backtests trade** | ❌ **NO since 2026-08-18 (last proof predates source fix)** | `session_20261019_155354.log`: `Account : Backtest`, `HistoricalReplayCatchup count=117`, zero `SUBMIT`. GAP-077 fix committed; operator validation pending. | | Live SIM | 🟑 | 2026-10-05: 844 `WarmupIncomplete`, `ageSecondsβ‰ˆ602` β€” possible delayed data. **GAP-078** | | Working tree / push | βœ… | Operator push completed 2026-10-26; GAP-069 closed. Subsequent local commits are not pushed by this task. | | Gate Run #3 | ⏳ cannot start | Freeze discarded (`DEC-20260922-01`) | @@ -21,7 +21,7 @@ **P0-A / GAP-065 operator quarantine (2026-10-26):** the pre-cleanup preflight check 6 failed and named unexpected `SimpleORBStrategy.cs` (deployed 2026-07-13). The operator quarantined it, `@@SimpleORBNT8Wrapper.cs`, `SDK*.zip`, and `.DS_Store` to `Documents\NT8_quarantine_20261026`. No deployed-folder cleanup was performed by Kilocode. Deployment/recompile and the preflight after-proof remain pending. **Open blockers (v9.0 + 2026-10-24):** -- **[GAP-077] Backtests take zero trades** | HIGH | πŸ”΄ NEW β€” live catch-up guard `State == State.Historical && Account != null` blocks every Strategy Analyzer intent because Analyzer uses the `Backtest` account. Also breaks backtest `MaxDailyTrades` counting. `DEC-20261024-01`; prompt `NEXT_PROMPT.md` App. B. +- **[GAP-077] Backtests take zero trades** | HIGH | βœ… Source fix committed `e2439c0`; 590 tests pass. Operator validation remains pending: Strategy Analyzer trades >0 and ≀1/trading date, with late-enable SIM catch-up still blocked. `DEC-20261024-01`. - **[GAP-065] Deployed-source divergence** | CRITICAL | P0-A quarantine done; deploy/recompile verification remains. `DEC-20260922-01`. - **[GAP-054] Runner trail failed a +$1,200 excursion** | CRITICAL | independent of GAP-065; `TASK_GAP054_FOLLOWUP_TRAIL_VALIDATION_FAILURE_PROMPT.md` (Stage 2). - **[GAP-066] `base.OnStateChange()` last β€” overwrote 4 ORB defaults** | HIGH | βœ… Ordering fixed; operator settings-export validation remains after deploy/recompile (`TASK_GAP066_SETDEFAULTS_ORDERING_PROMPT.md`). diff --git a/docs/00-governance/active_work.md b/docs/00-governance/active_work.md index 633ec39..d3aba54 100644 --- a/docs/00-governance/active_work.md +++ b/docs/00-governance/active_work.md @@ -13,7 +13,7 @@ Run order of record: **`NEXT_PROMPT.md`**. Stage model from Master Document v9.0 | P0-B | βœ… Implemented and committed 2026-10-26; before-proof captured (check 6 failed on `SimpleORBStrategy.cs`); after-proof remains after deploy/recompile (GAP-068) | `TASK_GAP068_DEPLOY_VERIFICATION_PROMPT.md` | Kilocode / Operator | | P0-A | βœ… Operator quarantine completed 2026-10-26 after before-proof; deploy/recompile verification remains (GAP-065) | `Documents\NT8_quarantine_20261026` | Operator | | P0-C | βœ… Implemented and committed 2026-10-26; `base.OnStateChange()` precedes subclass defaults (GAP-066); settings-export validation follows deploy/recompile | `TASK_GAP066_SETDEFAULTS_ORDERING_PROMPT.md` | Kilocode / Operator | -| P0-H | **Backtests blocked by live catch-up guard (GAP-077)** | `NEXT_PROMPT.md` App. B β†’ `TASK_GAP077_BACKTEST_HISTORICAL_GUARD_PROMPT.md` | Kilocode | +| P0-H | βœ… GAP-077 source fix committed `e2439c0` on 2026-10-26; 590 tests passed. Strategy Analyzer and late-enable SIM operator validation remains pending. | `NEXT_PROMPT.md` App. B β†’ `TASK_GAP077_BACKTEST_HISTORICAL_GUARD_PROMPT.md` | Kilocode / Operator | | P0-G | `EnableKillSwitch=True`, `TraceOrders=true`; confirm real-time CME data (GAP-078) | operator | Operator | | β€” | Single deploy + full recompile, then validate: backtest (GAP-077), settings export (GAP-066), one SIM RTH day (N-02) | operator | Operator | diff --git a/docs/00-governance/decisions.md b/docs/00-governance/decisions.md index 79bfbce..654ddc1 100644 --- a/docs/00-governance/decisions.md +++ b/docs/00-governance/decisions.md @@ -43,13 +43,17 @@ Use this file to record durable project decisions that affect implementation pat ### DEC-20261024-01 - **ID:** DEC-20261024-01 - **Date:** 2026-10-24 -- **Status:** decided β€” GAP-077 opened and prompted (`NEXT_PROMPT.md` Appendix B β†’ `TASK_GAP077_BACKTEST_HISTORICAL_GUARD_PROMPT.md`) +- **Status:** implemented β€” GAP-077 source commit `e2439c0adfedf22cfd21f3039b309703458042c4`; `verify-build.bat` 590/590 tests; operator validation pending - **Context:** Operator reported that backtests have stopped taking trades. Reviewed `session_20261019_155354.log` (Strategy Analyzer, MNQ SEP26, Jan–Oct 2026) and the deployed `bin\Custom\Strategies\NT8StrategyBase.cs`. -- **Finding β€” GAP-077 (HIGH):** the header reads `Account : Backtest`. Strategy Analyzer assigns a non-null `Backtest` account. `ProcessStrategyIntent()`'s catch-up guard `if (State == State.Historical && Account != null)` (`DEC-20260818-08`) therefore treats every backtest bar as live catch-up replay. Result: `REJECT SUMMARY: reason=HistoricalReplayCatchup count=117` β€” 117 intents generated, 117 blocked, zero `SUBMIT`/`FILL`. Every Strategy Analyzer run since 2026-08-18 has taken zero trades. `DEC-20260818-08`'s premise ("`Account == null` during genuine `State.Historical` backtests") is **corrected** by this entry; its Action Required backtest check was never run. `NT8StrategyBaseHistoricalGuardTests` asserts the defective literal and so enshrines the bug. +- **Finding β€” GAP-077 (HIGH):** the header reads `Account : Backtest`. Strategy Analyzer assigns a non-null `Backtest` account. `ProcessStrategyIntent()`'s catch-up guard `if (State == State.Historical && Account != null)` (`DEC-20260818-08`) therefore treats every backtest bar as live catch-up replay. Result: `REJECT SUMMARY: reason=HistoricalReplayCatchup count=117` β€” 117 intents generated, 117 blocked, zero `SUBMIT`/`FILL`. Every Strategy Analyzer run since 2026-08-18 has taken zero trades. `DEC-20260818-08`'s premise ("`Account == null` during genuine `State.Historical` backtests") is **corrected** by this entry; its Action Required backtest check was never run. At task opening, `NT8StrategyBaseHistoricalGuardTests` still asserted the defective literal; this task replaces that assertion with the predicate-aware guard. - **Same false assumption elsewhere:** `ShouldAllowDailyTradeCountIncrement()` returns `Account == null` in Historical β†’ `MaxDailyTrades` never counts in a backtest (fixing only the guard would allow unlimited trades/day); daily-trade-count persistence and `TrailingDrawdownMonitor` registration key on `Account != null` and would bind an account named `Backtest`; the session header labels backtests `LIVE/SIM` (written from `DataLoaded`); `LogRejectRateLimited()` drops all non-Realtime reasons except `HistoricalReplayCatchup`, so a backtest cannot self-document; the GAP-060 snapshot heartbeat wrote 15,594 duplicate `REJECT SUMMARY` lines in one backtest. -- **Decision:** single `IsBacktestRun()` predicate (`IsInStrategyAnalyzer || Account.Name == "Backtest"`), routed through all of the above; live/SIM behaviour unchanged. Commit-only; deploy once at the end of Stage 0, after the P0-A orphan sweep β€” otherwise the first working backtest would still execute the 2026-07-13 orphan strategy (GAP-065), which is **still present** in `bin\Custom\Strategies` as of 2026-10-24 (modified 2026-07-13, last accessed 2026-10-19). +- **Decision:** single `IsBacktestRun()` predicate (`IsInStrategyAnalyzer || Account.Name == "Backtest"`), routed through the catch-up guard, daily-trade counting, session mode, daily persistence, and trailing-drawdown registration/checks. Backtest rejection detail is enabled and summary snapshots are capped at one per trading date; live/SIM replay guards remain. Commit-only; deploy once at the end of Stage 0 after P0-A. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `tests/NT8.Core.Tests/Adapters/NT8StrategyBaseHistoricalGuardTests.cs`, `session_20261019_155354.log`, `DEC-20260818-08` (corrected), GAP-076. -- **Action Required:** run the prompt; operator validation per its final section (backtest trades > 0 and ≀1/day; live late-enable still blocked). +- **Implementation (2026-10-26):** `e2439c0adfedf22cfd21f3039b309703458042c4`; full verification 590/590 (500 Core, 80 Integration, 10 Performance), with 6 existing CS1998 warnings and zero errors. Required Core `--no-build` run passed 500/500. +- **IsInStrategyAnalyzer documentation check:** official [NinjaTrader IsInStrategyAnalyzer](https://docs.ninjatrader.com/ninjascript/isinstategyanalyzer.md) defines true when the current strategy is run from a Strategy Analyzer chart; its example evaluates the property inside `OnBarUpdate`, confirming runtime strategy context rather than chart-display-only state. Local `NinjaTrader.Core.xml` and `NinjaTrader.Gui.xml` were present but contain no `IsInStrategyAnalyzer` member entry. The documented property was used as directed; the Oct 19 `Account : Backtest` evidence-backed fallback remains. +- **Account occurrence verdicts in `NT8StrategyBase.cs`:** changed to exclude Analyzer/backtest account persistence/side effects: 595-599 (daily persistence activation), 960/974-975 (drawdown monitor), 1801-1804 and 1838-1842 (monitor registration/state), 1944 (persistence-enabled context), 2020-2021 (`IsBacktestRun` name fallback), and 2101 (halt query). Kept as real-time-only micro-upgrade state: 863, 873, 892-899, 928-942. Kept as non-persistent account data/diagnostics: 1368-1372, 1626, 1709, 1945, 2031-2034, 2414, 2806. Drawdown status/file diagnostics at 1006, 1015, 1851, 1914 remain reachable only through the now backtest-excluded monitor paths. +- **State.Historical occurrence verdicts in `NT8StrategyBase.cs`:** line 640 comment kept (describes the Realtime-only replay-burst branch); line 1624 changed to `IsBacktestRun()` for the session mode; line 2009 branch kept but its return changed to `IsBacktestRun()` for daily trade counts; line 2082 changed to `State == State.Historical && !IsBacktestRun()` for catch-up blocking; line 2197 kept (historical orders bypass the live circuit breaker, while live-account historical intents are blocked earlier). `_realtimeBarSeen` initialization and Realtime eligibility guards remain unchanged. +- **Action Required:** after the operator-controlled P0-A deploy/recompile, validate Strategy Analyzer trades > 0 and ≀1 per trading date with no `daily_trade_count_Backtest_*.json`; validate late-enable SIM still logs `HistoricalReplayCatchup` and submits no historical order. GAP-076 remains empirically pending this run. ### DEC-20261024-02 - **ID:** DEC-20261024-02