This commit is contained in:
Eric Gullickson
2025-11-01 21:27:42 -05:00
parent 20953c6dee
commit 046c66fc7d
203 changed files with 5699 additions and 404943 deletions

View File

@@ -0,0 +1,446 @@
# Validation Checklist - Success Criteria
## Per-Phase Validation
### Phase 1: Docker Compose (infra-agent)
**Container Renaming:**
- [ ] traefik → mvp-traefik
- [ ] admin-frontend → mvp-frontend
- [ ] admin-backend → mvp-backend
- [ ] admin-postgres → mvp-postgres
- [ ] admin-redis → mvp-redis
- [ ] mvp-platform-vehicles-api → mvp-platform
**Service Removal:**
- [ ] admin-minio removed
- [ ] mvp-platform-landing removed
- [ ] mvp-platform-tenants removed
- [ ] platform-postgres removed
- [ ] platform-redis removed
- [ ] mvp-platform-vehicles-db removed
- [ ] mvp-platform-vehicles-redis removed
- [ ] mvp-platform-vehicles-etl removed
**Configuration:**
- [ ] docker-compose.yml validates: `docker compose config`
- [ ] Volume mount added: `./data/documents:/app/data/documents`
- [ ] Network count reduced from 5 to 3
- [ ] All Traefik labels updated with new service names
**Validation Commands:**
```bash
docker compose config # Should validate without errors
docker compose ps # Should show 6 services only
```
---
### Phase 2: Remove Tenant (backend-agent)
**Code Deletion:**
- [ ] backend/src/core/middleware/tenant.ts deleted
- [ ] backend/src/core/config/tenant.ts deleted
- [ ] backend/src/features/tenant-management/ deleted
**Code Modification:**
- [ ] backend/src/app.ts - No tenant middleware import
- [ ] backend/src/app.ts - No tenant middleware registration
- [ ] backend/src/app.ts - No tenant-management routes
- [ ] backend/src/core/plugins/auth.plugin.ts - No tenant_id claim extraction
**No Tenant References:**
```bash
# Should return 0 results in application code
grep -r "tenant_id" backend/src/features/
grep -r "tenantId" backend/src/features/
grep -r "tenant-management" backend/src/
```
**Build Check:**
```bash
cd backend
npm run build # Should compile without errors
```
---
### Phase 3: Filesystem Storage (storage-agent)
**New Files:**
- [ ] backend/src/core/storage/adapters/filesystem.adapter.ts created
- [ ] Implements StorageService interface correctly
- [ ] data/documents/ directory exists
**Modified Files:**
- [ ] backend/src/core/storage/storage.service.ts uses FilesystemAdapter
- [ ] backend/src/features/documents/ updated for filesystem
**No MinIO References:**
```bash
# Should return 0 results
grep -r "minio" backend/src/
grep -r "MinIO" backend/src/
grep -r "s3" backend/src/core/storage/
```
**Functional Test:**
```bash
# Test document upload/download
curl -X POST http://localhost:3001/api/documents/upload \
-H "Authorization: Bearer $TOKEN" \
-F "file=@test.pdf"
# Verify file exists in ./data/documents/{userId}/
```
---
### Phase 4: Config Cleanup (config-agent)
**Config File Updates:**
- [ ] config/app/production.yml - No MinIO section
- [ ] config/app/production.yml - No platform tenant API
- [ ] config/app/production.yml - Platform vehicles URL = http://mvp-platform:8000
**Environment Updates:**
- [ ] .env - No MINIO_* variables
- [ ] .env - No PLATFORM_VEHICLES_API_KEY
- [ ] .env - DATABASE_URL uses mvp-postgres
- [ ] .env - REDIS_URL uses mvp-redis
**Secrets Deletion:**
- [ ] secrets/app/minio-access-key.txt deleted
- [ ] secrets/app/minio-secret-key.txt deleted
- [ ] secrets/app/platform-vehicles-api-key.txt deleted
- [ ] secrets/platform/ directory deleted
**Validation:**
```bash
# No sensitive references should remain
grep -r "minio" config/
grep -r "platform-vehicles-api-key" config/
```
---
### Phase 5: Network Simplification (infra-agent)
**Network Configuration:**
- [ ] Only 3 networks: frontend, backend, database
- [ ] platform network removed
- [ ] egress network removed
**Service Network Assignments:**
- [ ] mvp-traefik: frontend
- [ ] mvp-frontend: frontend, backend
- [ ] mvp-backend: backend, database
- [ ] mvp-postgres: database
- [ ] mvp-redis: database
- [ ] mvp-platform: backend, database
**Validation:**
```bash
docker network ls | grep motovaultpro
# Should show only 3 networks
docker compose config | grep -A5 "networks:"
# Verify correct network assignments
```
---
### Phase 6: Backend Updates (backend-agent)
**Service References:**
- [ ] All database URLs use mvp-postgres
- [ ] All Redis URLs use mvp-redis
- [ ] Platform client URL = http://mvp-platform:8000
**No Old Container Names:**
```bash
grep -r "admin-postgres" backend/src/
grep -r "admin-redis" backend/src/
grep -r "admin-backend" backend/src/
# Should all return 0 results
```
**Build and Start:**
```bash
make rebuild
make logs-backend # No errors
```
---
### Phase 7: Database Updates (infra-agent)
**Connection Strings:**
- [ ] Application uses mvp-postgres
- [ ] Platform service uses mvp-postgres
**Schema Validation:**
```bash
# Connect to database
make db-shell-app
# Verify tables exist
\dt
# Verify no tenant_id columns (only user_id)
SELECT column_name FROM information_schema.columns
WHERE table_schema = 'public' AND column_name = 'tenant_id';
# Should return 0 rows
```
---
### Phase 8: Platform Service (platform-agent)
**Service Simplification:**
- [ ] No MSSQL dependencies
- [ ] No ETL container
- [ ] Uses mvp-postgres and mvp-redis
- [ ] Single container deployment
**API Functionality:**
```bash
# Test platform service endpoints
curl http://localhost:8000/health
curl http://localhost:8000/vehicles/makes?year=2024
```
**No Old Dependencies:**
```bash
grep -r "mssql" mvp-platform-services/vehicles/
grep -r "pyodbc" mvp-platform-services/vehicles/
# Should return 0 results
```
---
### Phase 9: Documentation (docs-agent)
**Documentation Updates:**
- [ ] README.md reflects 6-container architecture
- [ ] CLAUDE.md no multi-tenant guidance
- [ ] AI-INDEX.md updated
- [ ] .ai/context.json updated
- [ ] docs/PLATFORM-SERVICES.md updated
- [ ] docs/TESTING.md updated
- [ ] Makefile uses mvp-* container names
**Consistency Check:**
```bash
# No old container names in docs
grep -r "admin-backend" docs/ README.md CLAUDE.md Makefile
grep -r "admin-frontend" docs/ README.md CLAUDE.md Makefile
# Should return 0 results
```
---
### Phase 10: Frontend Updates (frontend-agent)
**Code Updates:**
- [ ] No tenant selection UI
- [ ] No tenant context provider
- [ ] Auth0 integration updated (no tenant claims)
- [ ] API clients work
**Build Check:**
```bash
cd frontend
npm run build # Should build without errors
```
**No Tenant References:**
```bash
grep -r "tenant" frontend/src/
# Should return minimal/no results
```
---
### Phase 11: Testing (test-agent)
**Container Health:**
- [ ] All 6 containers running
- [ ] All containers healthy status
**Test Suite:**
- [ ] Backend tests pass: `make test`
- [ ] Frontend tests pass
- [ ] Integration tests pass
- [ ] No regressions
**Validation Commands:**
```bash
docker compose ps
# Should show 6 services, all healthy
make test
# All tests should pass
```
---
## Integration Validation
### Cross-Phase Validation
**Architecture Consistency:**
- [ ] 6 containers total (no more, no less)
- [ ] 3 networks configured
- [ ] mvp-* naming consistent everywhere
- [ ] No tenant code remaining
- [ ] No MinIO references
- [ ] No old platform services
**Functional Validation:**
- [ ] Authentication works (Auth0)
- [ ] Vehicle operations work
- [ ] Fuel logs CRUD works
- [ ] Maintenance logs work
- [ ] Stations work
- [ ] Document upload/download works
**Performance Validation:**
- [ ] Application starts in reasonable time
- [ ] API response times acceptable
- [ ] No memory leaks
- [ ] No excessive logging
---
## Final Acceptance Criteria
### Must-Pass Criteria
**Infrastructure:**
```bash
# 1. All containers healthy
docker compose ps
# Expected: 6 services, all "running (healthy)"
# 2. Networks correct
docker network ls | grep motovaultpro | wc -l
# Expected: 3
# 3. Volumes correct
docker volume ls | grep motovaultpro | wc -l
# Expected: 2 (postgres_data, redis_data)
```
**Build and Tests:**
```bash
# 4. Clean rebuild succeeds
make clean && make setup
# Expected: All services start successfully
# 5. All tests pass
make test
# Expected: 0 failures
# 6. Linting passes
cd backend && npm run lint
cd frontend && npm run lint
# Expected: No errors
```
**Code Quality:**
```bash
# 7. No tenant references in application
grep -r "tenant_id" backend/src/features/ | wc -l
# Expected: 0
# 8. No old container names
grep -r "admin-backend" backend/ frontend/ docs/ | wc -l
# Expected: 0
# 9. No MinIO references
grep -r "minio" backend/src/ | wc -l
# Expected: 0
```
**Functionality:**
- [ ] 10. Can log in via Auth0
- [ ] 11. Can create vehicle
- [ ] 12. Can upload document
- [ ] 13. Can create fuel log
- [ ] 14. Can create maintenance log
- [ ] 15. Can search stations
**Mobile Compatibility:**
- [ ] 16. Frontend responsive on mobile
- [ ] 17. All features work on mobile
- [ ] 18. No mobile-specific errors
### Nice-to-Have Criteria
- [ ] Documentation comprehensive
- [ ] Code comments updated
- [ ] Performance improved vs. before
- [ ] Memory usage reduced
- [ ] Startup time faster
---
## Validation Responsibility Matrix
| Validation | Agent | Phase | Critical |
|------------|-------|-------|----------|
| Container rename | infra-agent | 1 | Yes |
| Service removal | infra-agent | 1 | Yes |
| Tenant code deleted | backend-agent | 2 | Yes |
| Filesystem storage | storage-agent | 3 | Yes |
| Config cleanup | config-agent | 4 | Yes |
| Network simplification | infra-agent | 5 | Yes |
| Service references | backend-agent | 6 | Yes |
| Database updates | infra-agent | 7 | Yes |
| Platform simplification | platform-agent | 8 | Yes |
| Documentation | docs-agent | 9 | No |
| Frontend updates | frontend-agent | 10 | Yes |
| Full integration | test-agent | 11 | Yes |
---
## Rollback Triggers
Rollback if:
- [ ] Any critical validation fails
- [ ] Tests have >10% failure rate
- [ ] Containers fail to start
- [ ] Data loss detected
- [ ] Security issues introduced
- [ ] Production blockers identified
See ROLLBACK-STRATEGY.md for procedures.
---
## Sign-Off Checklist
**Project Lead:**
- [ ] All critical validations passed
- [ ] Architecture simplified as intended
- [ ] No functionality regressions
- [ ] Documentation complete
- [ ] Team trained on new architecture
**Technical Lead:**
- [ ] Code quality maintained
- [ ] Tests comprehensive
- [ ] Performance acceptable
- [ ] Security not compromised
**DevOps Lead:**
- [ ] Containers deploy successfully
- [ ] Networks configured correctly
- [ ] Volumes persistent
- [ ] Monitoring operational
**Final Approval:**
- [ ] Ready for production deployment
- [ ] Rollback plan documented
- [ ] Team informed of changes