3.8 KiB
3.8 KiB
Pre-Deploy Validation
Contract
Running npm run check guarantees:
✅ Build succeeds - TypeScript compilation passes with no errors
✅ Security checks pass - Schema, RLS, secrets, guards, tenant isolation verified
✅ Lifecycle checks pass - Trade executor, lifecycle, order sync, persistence, failure injection, WebSocket contract verified
❌ Does NOT guarantee:
- Unit test coverage (no unit tests configured)
- Runtime behavior
- Database connectivity
- External API availability
Pre-Deploy Command
npm run check
What it runs:
npm run build- TypeScript compilationnpm run lint- Security checks (schema, RLS, secrets, guards, tenant)npm run format- Lifecycle checks (executor, sync, persistence, injection, WebSocket)
Individual Check Commands
Build Check
npm run build
Pass criteria: TypeScript compiles with 0 errors
Fail criteria: Any TypeScript error
Security Checks (Lint)
npm run lint
Runs:
check:schema-contract- Database schema matches code expectationscheck:rls-policies- Row-level security policies are correctcheck:secret-hygiene- No secrets in code, env vars configuredcheck:security-guards- Auth guards in placecheck:tenant-isolation- Multi-tenant data isolation verified
Pass criteria: All 5 checks pass
Fail criteria: Any check fails
Lifecycle Checks (Format)
npm run format
Runs:
check:trade-executor-lifecycle- Trade execution flow workscheck:lifecycle-regressions- No regressions in trade lifecyclecheck:order-sync-regressions- Order status sync workscheck:supabase-order-persistence-regressions- Orders persist correctlycheck:failure-injection- System handles failures gracefullycheck:websocket-contract- WebSocket events match contract
Pass criteria: All 6 checks pass
Fail criteria: Any check fails
Pass/Fail Rules
✅ SAFE TO DEPLOY
All of the following must be true:
npm run buildexits with code 0npm run lintexits with code 0npm run formatexits with code 0
❌ DO NOT DEPLOY
If any of the following are true:
npm run buildfails (TypeScript errors)npm run lintfails (security check failed)npm run formatfails (lifecycle check failed)
Current Issues (Must Fix Before Deploy)
⚠️ Build is currently failing:
src/scripts/verifyWebsocketContract.ts:83:5 - error TS2741:
Property 'health' is missing in type 'BotState'
Action required: Fix TypeScript error in verifyWebsocketContract.ts before deploying
Quick Reference
| Command | Purpose | Time | Critical |
|---|---|---|---|
npm run build |
Compile TypeScript | ~10s | YES |
npm run lint |
Security checks | ~30s | YES |
npm run format |
Lifecycle checks | ~45s | YES |
npm run check |
All checks | ~90s | YES |
Troubleshooting
Build fails
- Check TypeScript errors in output
- Fix type errors in code
- Ensure all imports are correct
Lint fails
- Check which security check failed
- Review error output
- Fix schema/RLS/secret/guard/tenant issue
Format fails
- Check which lifecycle check failed
- Review error output
- Fix trade executor/sync/persistence issue
Notes
- No unit tests: This project uses integration-style checks instead of unit tests
- Checks are mandatory: All checks must pass before deploy
- No shortcuts: Do not skip checks or deploy with failures
- Independent: This project's checks are independent of the frontend
Related
- Frontend pre-deploy:
../bytelyst-trading-dashboard-web/docs/pre-deploy.md - Deployment script:
deploy.ps1