docs: CRITICAL - Make verification mandate absolute top priority

REAL MONEY SYSTEM - NO EXCEPTIONS ON VERIFICATION

Changes:
- Moved VERIFICATION MANDATE to very top of copilot-instructions.md
- Added clear visual separators with ⚠️ and 🚨 emojis
- Made it unmissable: Must be read before any other instructions
- Added explicit definition of what 'working' means vs does NOT mean
- Emphasized: Deployment ≠ Working without verification

Added concrete example (Nov 25, 2025 Health Monitor Bug):
- What went wrong: Declared 'working' without testing
- What should have been done: Add logging, test API, verify errors recorded
- Lesson: Never trust code appearance, always verify with real data

Why this matters:
- User building from $901 → $100,000+ with this system
- Every unverified change is financial risk
- This is not a hobby project - it's user's financial future
- Declaring something working without proof = causing financial loss

Development Ethos:
- NEVER say done/finished without testing
- NEVER skip verification for 'simple' changes
- ALWAYS double-check new development for 100% functionality
- Code appearance ≠ Code correctness
- Deployment ≠ Feature working

This is mandatory for all AI agents working on this codebase.
This commit is contained in:
mindesbunister
2025-11-25 10:21:40 +01:00
parent 0cdcd973cd
commit a854d74a2a

View File

@@ -1,5 +1,74 @@
# AI Agent Instructions for Trading Bot v4
## ⚠️ CRITICAL: VERIFICATION MANDATE - READ THIS FIRST ⚠️
**THIS IS A REAL MONEY TRADING SYSTEM - EVERY CHANGE AFFECTS USER'S FINANCIAL FUTURE**
### 🚨 IRON-CLAD RULES - NO EXCEPTIONS 🚨
**1. NEVER SAY "DONE", "FIXED", "WORKING", OR "DEPLOYED" WITHOUT 100% VERIFICATION**
This is NOT optional. This is NOT negotiable. This is the MOST IMPORTANT rule in this entire document.
**"Working" means:**
- ✅ Code deployed (container restarted AFTER commit timestamp)
- ✅ Logs show expected behavior in production
- ✅ Database state matches expectations (SQL verification)
- ✅ Test trade executed successfully (when applicable)
- ✅ All metrics calculated correctly (manual verification)
- ✅ Edge cases tested (0%, 100%, boundaries)
**"Working" does NOT mean:**
- ❌ "Code looks correct"
- ❌ "Should work in theory"
- ❌ "TypeScript compiled successfully"
- ❌ "Tests passed locally"
- ❌ "Committed to git"
**2. TEST EVERY CHANGE IN PRODUCTION**
Financial code verification requirements:
- **Position Manager changes:** Execute test trade, watch full cycle (TP1 → TP2 → exit)
- **API endpoints:** curl test with real payloads, verify database records
- **Calculations:** Add console.log for EVERY step, verify units (USD vs tokens, % vs decimal)
- **Exit logic:** Test actual TP1/TP2/SL triggers, not just code paths
**3. DEPLOYMENT VERIFICATION IS MANDATORY**
Before declaring anything "deployed":
```bash
# 1. Check container start time
docker logs trading-bot-v4 | grep "Server starting" | head -1
# 2. Check latest commit time
git log -1 --format='%ai'
# 3. Verify container NEWER than commit
# If container older: CODE NOT DEPLOYED, FIX NOT ACTIVE
# 4. Test feature-specific behavior
docker logs -f trading-bot-v4 | grep "expected new log message"
```
**Container start time OLDER than commit = FIX NOT DEPLOYED = DO NOT SAY "FIXED"**
**4. DOCUMENT VERIFICATION RESULTS**
Every change must include:
- What was tested
- How it was verified
- Actual logs/SQL results showing correct behavior
- Edge cases covered
- What user should watch for on next real trade
**WHY THIS MATTERS:**
User is building from $901 → $100,000+ with this system. Every bug costs money. Every unverified change is a financial risk. This is not a hobby project - this is the user's financial future.
**Declaring something "working" without verification = causing financial loss**
---
## Mission & Financial Goals
**Primary Objective:** Build wealth systematically from $106 → $100,000+ through algorithmic trading
@@ -262,6 +331,43 @@ docker logs -f trading-bot-v4 | grep "expected log message from fix"
3. **Edge cases**: Test boundary conditions (0, 100%, max leverage, min size)
4. **Regression**: Check that fix didn't break other functionality
### 🔴 EXAMPLE: What NOT To Do (Nov 25, 2025 - Health Monitor Bug)
**What the AI agent did WRONG:**
1. ❌ Fixed code (moved interceptWebSocketErrors() call)
2. ❌ Built Docker image successfully
3. ❌ Deployed container
4. ❌ Saw "Drift health monitor started" in logs
5.**DECLARED IT "WORKING" AND "DEPLOYED"** ← CRITICAL ERROR
6. ❌ Did NOT verify error interception was actually functioning
7. ❌ Did NOT test the health API to see if errors were being recorded
8. ❌ Did NOT add logging to confirm the fix was executing
**What ACTUALLY happened:**
- Code was deployed ✅
- Monitor was starting ✅
- But error interception was still broken ❌
- System still vulnerable to memory leak ❌
- User had to point out: "Never say it's done without testing"
**What the AI agent SHOULD have done:**
1. ✅ Fix code
2. ✅ Build and deploy
3.**ADD LOGGING** to confirm fix executes: `console.log('🔧 Setting up error interception...')`
4. ✅ Verify logs show the new message
5.**TEST THE API**: `curl http://localhost:3001/api/drift/health`
6. ✅ Verify errorCount field exists and updates
7.**SIMULATE ERRORS** or wait for natural errors
8. ✅ Verify errorCount increases when errors occur
9.**ONLY THEN** declare it "working"
**The lesson:**
- Deployment ≠ Working
- Logs showing service started ≠ Feature functioning
- "Code looks correct" ≠ Verified with real data
- **ALWAYS ADD LOGGING** for critical changes
- **ALWAYS TEST THE FEATURE** before declaring success
### SQL Verification Queries
**After Position Manager changes:**