Production hardening: kill switch, circuit breaker, trailing stops, log level, holiday calendar
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
This commit is contained in:
@@ -1,164 +1,79 @@
|
||||
# Verification Requirements
|
||||
|
||||
You MUST verify your work at each checkpoint to ensure code quality and prevent errors.
|
||||
Run `.\verify-build.bat` from `C:\dev\nt8-sdk\` after **every single file change**.
|
||||
Do not proceed to the next task until this passes.
|
||||
|
||||
## After EVERY File Creation or Modification
|
||||
---
|
||||
|
||||
### Step 1: Run Build Verification
|
||||
```bash
|
||||
## After Every File Change
|
||||
|
||||
### Step 1 — Build verification
|
||||
```bat
|
||||
cd C:\dev\nt8-sdk
|
||||
.\verify-build.bat
|
||||
```
|
||||
|
||||
**Expected Output:**
|
||||
```
|
||||
✅ All checks passed!
|
||||
```
|
||||
Expected: `✅ All checks passed!`
|
||||
|
||||
**If build fails:**
|
||||
1. Read the error message carefully
|
||||
2. Fix the error immediately
|
||||
3. Re-run verify-build.bat
|
||||
4. DO NOT proceed to next file until build passes
|
||||
If it fails:
|
||||
1. Read the compiler error carefully
|
||||
2. Fix it immediately
|
||||
3. Re-run before continuing
|
||||
4. NEVER move to the next file with a broken build
|
||||
|
||||
### Step 2: Verify File Location
|
||||
Check that the file is in an allowed directory:
|
||||
- ✅ `src/NT8.Core/OMS/` - Implementation files
|
||||
- ✅ `tests/NT8.Core.Tests/OMS/` - Test files
|
||||
- ✅ `tests/NT8.Core.Tests/Mocks/` - Mock files
|
||||
- ❌ Anywhere else - STOP and ask
|
||||
|
||||
### Step 3: Check Syntax Compliance
|
||||
### Step 2 — Syntax check (self-audit before running)
|
||||
Scan your code for forbidden patterns:
|
||||
- ❌ No `$"..."` - Use `string.Format()`
|
||||
- ❌ No `?.` or `?[` - Use explicit null checks
|
||||
- ❌ No `=>` in properties/methods - Use full syntax
|
||||
- ❌ No `nameof()` - Use string literals
|
||||
- No `$"..."` (string interpolation) → use `string.Format("...", a, b)`
|
||||
- No `?.` or `?[` → use explicit null checks
|
||||
- No `=>` on properties or methods → use full `{ get { return x; } }` syntax
|
||||
- No `nameof(x)` → use `"x"` string literal
|
||||
- No `var x; ...TryGetValue(key, out var x)` inline → declare var separately
|
||||
|
||||
## After Completing Each Class
|
||||
### Step 3 — After completing a whole class
|
||||
```bat
|
||||
dotnet test tests\NT8.Core.Tests --verbosity minimal
|
||||
```
|
||||
All existing tests must still pass. Zero regressions allowed.
|
||||
|
||||
### Step 4: Run Unit Tests (if applicable)
|
||||
```bash
|
||||
dotnet test tests\NT8.Core.Tests --filter "FullyQualifiedName~OMS"
|
||||
---
|
||||
|
||||
## Specific Test Commands by Area
|
||||
|
||||
```bat
|
||||
# Test execution layer (TrailingStopManager etc.)
|
||||
dotnet test tests\NT8.Core.Tests --filter "FullyQualifiedName~Execution"
|
||||
|
||||
# Test adapters
|
||||
dotnet test tests\NT8.Core.Tests --filter "FullyQualifiedName~Adapters"
|
||||
|
||||
# Test all integration tests
|
||||
dotnet test tests\NT8.Integration.Tests --verbosity minimal
|
||||
|
||||
# Full suite
|
||||
dotnet test NT8-SDK.sln --verbosity minimal
|
||||
```
|
||||
|
||||
**Expected Output:**
|
||||
```
|
||||
Passed! - Failed: 0, Passed: X
|
||||
```
|
||||
|
||||
### Step 5: Review Against Checklist
|
||||
- [ ] All public members have XML documentation
|
||||
- [ ] All dictionary access uses `lock (_lock)`
|
||||
- [ ] All public methods have try-catch
|
||||
- [ ] All logging uses `string.Format()`
|
||||
- [ ] No C# 6+ syntax anywhere
|
||||
- [ ] File compiles without warnings
|
||||
|
||||
## After Completing Full Task
|
||||
|
||||
### Step 6: Comprehensive Build
|
||||
```bash
|
||||
dotnet build NT8-SDK.sln --configuration Release
|
||||
```
|
||||
|
||||
### Step 7: Full Test Suite
|
||||
```bash
|
||||
dotnet test tests\NT8.Core.Tests --verbosity normal
|
||||
```
|
||||
|
||||
### Step 8: Code Coverage (Optional but Recommended)
|
||||
```bash
|
||||
dotnet test tests\NT8.Core.Tests --collect:"XPlat Code Coverage"
|
||||
```
|
||||
|
||||
**Target:** >80% coverage for new code
|
||||
|
||||
## Common Verification Failures
|
||||
|
||||
### "Feature 'string interpolation' is not available"
|
||||
**Cause:** Used `$"text {var}"`
|
||||
**Fix:** Replace with `string.Format("text {0}", var)`
|
||||
|
||||
### "Feature 'null-conditional operator' is not available"
|
||||
**Cause:** Used `obj?.Property`
|
||||
**Fix:** Replace with explicit null check
|
||||
|
||||
### "Cannot access member before initialization"
|
||||
**Cause:** Used auto-property initializer
|
||||
**Fix:** Move initialization to constructor
|
||||
|
||||
### Lock-related warnings
|
||||
**Cause:** Dictionary access outside lock
|
||||
**Fix:** Wrap in `lock (_lock) { ... }`
|
||||
---
|
||||
|
||||
## Emergency Stop Conditions
|
||||
|
||||
STOP immediately and ask for help if:
|
||||
1. ❌ Build fails with errors you don't understand
|
||||
2. ❌ Tests fail unexpectedly after your changes
|
||||
3. ❌ You need to modify files outside allowed directories
|
||||
4. ❌ You're unsure about a design decision
|
||||
5. ❌ Performance is severely degraded
|
||||
STOP and report back if:
|
||||
- Build fails with errors you do not understand
|
||||
- Existing tests fail after your changes
|
||||
- You need to touch a file outside allowed boundaries
|
||||
- You are unsure about a design decision
|
||||
- You are about to modify a NinjaTrader API call signature
|
||||
|
||||
## Verification Workflow Summary
|
||||
---
|
||||
|
||||
```
|
||||
Write Code
|
||||
↓
|
||||
Run verify-build.bat
|
||||
↓
|
||||
Build passes? → NO → Fix errors, repeat
|
||||
↓ YES
|
||||
Check syntax (no C# 6+)
|
||||
↓
|
||||
Check patterns (locks, try-catch, logging)
|
||||
↓
|
||||
Check documentation (XML docs)
|
||||
↓
|
||||
Run unit tests (if applicable)
|
||||
↓
|
||||
All pass? → NO → Fix tests, repeat
|
||||
↓ YES
|
||||
Mark file complete ✅
|
||||
↓
|
||||
Move to next file
|
||||
```
|
||||
## Quality Gates (ALL must pass before task is complete)
|
||||
|
||||
## Quality Gates
|
||||
|
||||
Your code MUST pass these gates before being considered complete:
|
||||
|
||||
### Gate 1: Compilation
|
||||
- ✅ `verify-build.bat` outputs "All checks passed!"
|
||||
- ✅ No compiler warnings
|
||||
- ✅ All references resolve
|
||||
|
||||
### Gate 2: Syntax Compliance
|
||||
- ✅ No C# 6+ features detected
|
||||
- ✅ Only .NET Framework 4.8 APIs used
|
||||
- ✅ Proper using statements
|
||||
|
||||
### Gate 3: Pattern Compliance
|
||||
- ✅ Thread-safe operations
|
||||
- ✅ Error handling present
|
||||
- ✅ Logging at correct levels
|
||||
- ✅ XML documentation complete
|
||||
|
||||
### Gate 4: Testing
|
||||
- ✅ Unit tests written and passing
|
||||
- ✅ Coverage >80% (target)
|
||||
- ✅ Edge cases tested
|
||||
|
||||
## Self-Check Questions
|
||||
|
||||
Before marking a file complete, ask:
|
||||
1. Does `verify-build.bat` pass?
|
||||
2. Did I use any C# 6+ syntax?
|
||||
3. Is all dictionary access inside locks?
|
||||
4. Do all public methods have try-catch?
|
||||
5. Does all logging use string.Format?
|
||||
6. Do all public members have XML docs?
|
||||
7. Are there unit tests for this code?
|
||||
8. Do the tests pass?
|
||||
|
||||
**If any answer is "No" or "I'm not sure" → DO NOT PROCEED**
|
||||
| Gate | Check |
|
||||
|---|---|
|
||||
| ✅ Compilation | `verify-build.bat` outputs "All checks passed!" |
|
||||
| ✅ Syntax | No C# 6+ features |
|
||||
| ✅ Thread safety | All shared `Dictionary`/`List` access inside `lock (_lock)` |
|
||||
| ✅ Error handling | All public methods have `try-catch` |
|
||||
| ✅ Logging | All log calls use `string.Format()` not `$""` |
|
||||
| ✅ XML docs | All public members have `/// <summary>` |
|
||||
| ✅ No regressions | 240+ existing tests still pass |
|
||||
|
||||
Reference in New Issue
Block a user