[GAP-022-FOLLOWUP]: connection-state seam complete

- src/NT8.Adapters/NinjaTrader/ConnectionStateMonitor.cs: added plain testable connection-state monitor
- src/NT8.Adapters/Strategies/NT8StrategyBase.cs: wired monitor and added pre-submit ConnectionLost check
- tests/NT8.Core.Tests/Scenarios/ScenarioTests.cs: added disconnect scenario coverage
- SPRINT_BOARD.md: GAP-022-FOLLOWUP implemented/deployed
- docs/00-governance/current_status.md: updated
- docs/00-governance/decisions.md: added DEC-20260826-07

Build: clean | Tests: 580 passing | Dual-deployed: yes, backup 20260826_011650
This commit is contained in:
2026-08-26 01:18:21 -04:00
parent 9bd2a0f716
commit 186e1dd56d
7 changed files with 348 additions and 19 deletions

View File

@@ -1,5 +1,13 @@
# Current Status — NT8 SDK
**Last Updated:** 2026-08-26 (GAP-030 implemented/deployed test-only)
**Last Updated:** 2026-08-26 (GAP-022-FOLLOWUP implemented/deployed)
---
## 2026-08-26 — GAP-022-FOLLOWUP implemented; connection-state seam added
Implemented and deployed `TASK_GAP022_FOLLOWUP_CONNECTION_SEAM_PROMPT.md` as Option A. Added a plain `ConnectionStateMonitor` in `NT8.Adapters.NinjaTrader` to own connected/disconnected state without a NinjaScript dependency. `NT8StrategyBase.OnConnectionStatusUpdate()` now delegates state changes to it, the existing early `OnBarUpdate` `ConnectionLost` guard reads through it without changing behavior, and `ProcessStrategyIntent()` now re-checks the same monitor immediately before risk/sizing/order submission so a disconnect after signal generation but before submit is blocked atomically.
Added real scenario coverage for the two deferred disconnect cases: `MID_TRADE_DISCONNECT` proves a disconnect with an existing open position blocks new entries without inventing flatten-on-disconnect behavior, and `PRE_ENTRY_DISCONNECT` proves a generated signal is blocked before submit with the existing `ConnectionLost` rejection. The connected common path is also covered. `NEWS_DAY_REDUCED_SIZE` remains deferred because it still needs a high-impact-event calendar and sizing-policy API. Verification passed: focused `ScenarioTests` 9/9, `verify-build.bat` 580/580, and Core Release no-build 490/490. Deploy completed with backup `20260826_011650`; `NinjaTrader.Custom.dll` was already absent.
---

View File

@@ -13,6 +13,17 @@ Use this file to record durable project decisions that affect implementation pat
## Decision Log
### DEC-20260826-07
- **ID:** DEC-20260826-07
- **Date:** 2026-08-26
- **Status:** implemented and deployed by operator request
- **Context:** GAP-022's original scenario coverage was partial because `MID_TRADE_DISCONNECT` and `PRE_ENTRY_DISCONNECT` could not be tested honestly while `NT8StrategyBase` owned connection state as a private NinjaScript-only `_connectionLost` field. Source review confirmed the existing guard blocked disconnected bars early in `OnBarUpdate`, but there was no second check immediately before order submission, leaving a narrow timing gap if connection state changed after a signal was generated.
- **Decision:** Implement Option A from `TASK_GAP022_FOLLOWUP_CONNECTION_SEAM_PROMPT.md`: extract connection state into a plain, testable `ConnectionStateMonitor`, wire `NT8StrategyBase.OnConnectionStatusUpdate()` and the existing early guard through it, and add a pre-submit `ConnectionLost` check in `ProcessStrategyIntent()` before risk/sizing/order submission. Do not implement `NEWS_DAY_REDUCED_SIZE`; it remains a separate, larger design task requiring calendar and sizing-policy APIs.
- **Proof:** Added tests showing disconnect/reconnect changes entry permission, a mid-trade disconnect blocks new entries without flattening the existing position, a pre-entry disconnect blocks a generated signal before submit with the standard `ConnectionLost` reason/detail, and the connected pre-entry path remains allowed. `ScenarioTests.cs` now leaves only the `NEWS_DAY_REDUCED_SIZE` TODO.
- **Verification:** `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --filter "FullyQualifiedName~ScenarioTests" --verbosity minimal` passed 9/9. `verify-build.bat` passed 580/580. `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 490/490. Deploy completed with backup `20260826_011650`; `NinjaTrader.Custom.dll` was already absent.
- **Related Files:** `TASK_GAP022_FOLLOWUP_CONNECTION_SEAM_PROMPT.md`, `src/NT8.Adapters/NinjaTrader/ConnectionStateMonitor.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `tests/NT8.Core.Tests/Scenarios/ScenarioTests.cs`, `SPRINT_BOARD.md`, `docs/00-governance/current_status.md`.
- **Action Required:** Manual NinjaScript compile after deploy. Future news-day reduced-sizing work should be prompted separately after a calendar/sizing-policy design exists.
### DEC-20260826-06
- **ID:** DEC-20260826-06
- **Date:** 2026-08-26