Files
nt8-sdk/.kilocode/rules/verification_requirements.md
mo fb4f5d3bde
Some checks failed
Build and Test / build (push) Has been cancelled
chore: Add project configuration and documentation
- Kilocode AI agent rules and guidelines
- Setup and implementation guides
- Architecture documentation
- Build and verification references
2026-02-15 14:59:36 -05:00

165 lines
4.1 KiB
Markdown

# Verification Requirements
You MUST verify your work at each checkpoint to ensure code quality and prevent errors.
## After EVERY File Creation or Modification
### Step 1: Run Build Verification
```bash
.\verify-build.bat
```
**Expected Output:**
```
✅ 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
### 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
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
## After Completing Each Class
### Step 4: Run Unit Tests (if applicable)
```bash
dotnet test tests\NT8.Core.Tests --filter "FullyQualifiedName~OMS"
```
**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
## 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
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**