Sprint 3: Production Hardening — 9 tasks completed

## Summary
Implemented 9 production-hardening tasks across risk, execution, calendar, and governance.
All changes verified: build clean (0 errors), 492 tests passing (404 core + 78 integration + 10 perf).

## Core Changes

### Risk & Portfolio (3 tasks)
- **GAP-019** Portfolio Heat Tier 3.5: Added MaxHeatPct (default 3%) to AdvancedRiskConfig;
  ValidatePortfolioHeat() computes TotalOpenRisk + NewTradeRisk / Equity * 100; rejects when exceeded.
- **GAP-003** RiskPerTrade <= MaxTradeRisk Assertion: RiskPerTrade property in RiskConfig; throws
  ArgumentException at ValidateOrder() if RiskPerTrade > MaxTradeRisk; 3 unit tests.
- **GAP-005** GetRiskStatus() Live Config: _currentDailyLossLimit field updated from config.DailyLossLimit
  on each ValidateOrder(); GetRiskStatus() returns actual value; 3 unit tests.

### Execution & Position Management (3 tasks)
- **TASK-06a** Runner Mode Architecture: RunnerMode enum (Auto/Mode1DualLeg/Mode2RunnerOnly/
  Mode3ScalerOnly/Disabled); ResolveRunnerMode() logic; 4-mode SubmitOrderToNT8() behavior.
- **TASK-06b** ATR Dynamic Stop: EnableDynamicStop, AtrPeriod, AtrMultiplier, MinStopTicks, MaxStopTicks;
  computes dynStop = clamp(round(ATR/TickSize * Mult), Min, Max); overrides intent.StopTicks.
- **GAP-006** Position-Close Re-arm: OnPositionUpdate() sends clear_trade_taken when flat;
  EnableBarBasedRearm parameter gates legacy bar-driven re-arm (default false for live).

### Strategy Intelligence (2 tasks)
- **GAP-004** orbRangeTicks Fix: DailyBarContext.OrbRangeTicks field; computed from actual ORB
  high/low / TickSize; passed to Factor 7 (ORBvsATR).
- **GAP-010** Short-Side Regime Filter: EnableShortTrendFilter param; vetoes shorts when
  AVWAP slope > 0 (bullish); configurable, default true.

### Calendar & Trailing (2 tasks)
- **GAP-008** CME Holiday Awareness: NEW CmeHolidayCalendar.cs with 9 observed holidays +
  Good Friday (Easter calc); EnableCMEHolidayGuard skips ORB window on holidays.
- **GAP-009** ATR Trailing Real ATR: EnableATRTrailing, ATRTrailingPeriod (14), ATRTrailingMultiplier (2.0),
  ATRTrailingMinTicks (8), ATRTrailingMaxTicks (60); computes trailTicks from ATR(Close,Period)[0].

## Governance
- SPRINT_BOARD.md, current_status.md, decisions.md (DEC-20260711-01 through -09), NEXT_PROMPT.md updated
- All 9 tasks moved ACTIVE -> COMPLETED; GAP-011 (Gitea CI) now ACTIVE

## Verification
- verify-build.bat: 0 errors, 0 warnings
- Tests: 492 passing (404 core + 78 integration + 10 performance)

## Files
- Modified: 13 source, 3 test, 9 governance
- Deleted: 28 obsolete spec/docs
- Added: 1 new module (NT8.Core.Calendar), governance files
- Dual-deployed to NT8 Custom\Strategies\

## Rollback
Tag: sprint3-production-hardening-complete
To revert: git reset --hard sprint3-production-hardening-complete
This commit is contained in:
2026-07-13 08:38:25 -04:00
parent 99e993bee6
commit c9041df36a
64 changed files with 3338 additions and 825 deletions

View File

@@ -0,0 +1,184 @@
# Build Warnings - Quick Fix Guide
**Date:** February 15, 2026
**Build Status:** ✅ SUCCESS (with warnings)
---
## Current Warnings Summary
### CS1998: Async method without await (12 occurrences)
**Location:**
- `OrderManager.cs` (7 warnings)
- `OrderManagerTests.cs` (2 warnings)
**Issue:** Methods marked as `async` but don't use `await`
**Fix Options:**
#### Option 1: Remove async if not needed
```csharp
// BEFORE (Warning)
public async Task<string> MethodName()
{
return "result";
}
// AFTER (Fixed)
public Task<string> MethodName()
{
return Task.FromResult("result");
}
```
#### Option 2: Add await if async operation exists
```csharp
// If you have async operations
public async Task<string> MethodName()
{
await SomeAsyncOperation();
return "result";
}
```
---
### CS0169/CS0414: Unused fields (5 occurrences)
**Location:** `SimpleORBNT8Wrapper.cs`
**Issue:** Fields declared but never used
**Fields:**
- `_rangeSize`
- `_openingRangeHigh`
- `_openingRangeStart`
- `_openingRangeLow`
- `_openingRangeCalculated`
**Fix Options:**
#### Option 1: Remove if truly unused
```csharp
// Remove these lines if not needed:
private double _openingRangeHigh;
private double _openingRangeLow;
```
#### Option 2: Use the fields
```csharp
// If you plan to use them, implement the logic
private double _openingRangeHigh = 0;
void CalculateRange()
{
_openingRangeHigh = High[0]; // Use the field
}
```
#### Option 3: Suppress if placeholder for future
```csharp
#pragma warning disable CS0169
private double _openingRangeHigh; // Will be used in Phase 2
#pragma warning restore CS0169
```
---
## Action Items
### Priority 1: Critical for OMS
❌ **None** - OMS implementation hasn't started yet
### Priority 2: Existing Code Cleanup
These warnings are in **existing code** (not OMS):
- `OrderManager.cs` - 7 async warnings
- `SimpleORBNT8Wrapper.cs` - 5 unused field warnings
- `OrderManagerTests.cs` - 2 async warnings
**Recommendation:** Fix these **after** OMS implementation to avoid modifying existing code.
---
## For Kilocode: Warning Rules
### ✅ ALLOWED: Warnings in existing code
Kilocode can ignore warnings in:
- `src/NT8.Adapters/**` (existing wrapper)
- Existing `OrderManager.cs` (if it exists before OMS work)
- Existing test files
### ❌ FORBIDDEN: Warnings in new OMS code
Kilocode MUST NOT introduce warnings in new code:
- New `src/NT8.Core/OMS/**` files
- New `tests/NT8.Core.Tests/OMS/**` files
### Rule for Kilocode:
```
When creating new OMS files:
- NO CS1998 warnings (remove async or add await)
- NO CS0169/CS0414 warnings (use all declared fields)
- Build with ZERO warnings for new code
```
---
## Build Verification
### Current Status
```
Build: ✅ SUCCESS
Warnings: 17 total
- 12 × CS1998 (async without await)
- 5 × CS0169/CS0414 (unused fields)
All warnings in EXISTING code (not OMS)
```
### Target for OMS
```
Build: ✅ SUCCESS
New OMS files: ZERO warnings
Existing warnings: Can remain (cleanup later)
```
---
## Quick Fix Script (Optional)
If you want to clean up existing warnings before OMS work:
```powershell
# Fix unused fields in SimpleORBNT8Wrapper.cs
# Option 1: Comment out unused fields
# Option 2: Implement ORB calculation logic
# Option 3: Add #pragma warning disable
# Fix async warnings in OrderManager.cs
# Review each method and either:
# - Remove async keyword + return Task.FromResult()
# - Add await operations
# - Keep as-is if async needed for interface
```
---
## Summary
**For OMS Implementation:**
- ✅ Build is working correctly
- ✅ Existing warnings are acceptable
- ✅ Kilocode should NOT modify existing code
- ✅ New OMS code must have ZERO warnings
**After OMS Complete:**
- Clean up existing warnings
- Review async patterns
- Remove unused fields or implement them
---
**Build status: Ready for OMS implementation!** 🚀
The warnings are in existing code, not a blocker for starting OMS work.