---
description: Production readiness check — run all checks across repos, fix as you go, commit incrementally
date: 2025-02-12
---

# Production Readiness Workflow

> Runs comprehensive checks across all 3 repos, fixes failures as they occur, commits + pushes incrementally.
> **NOTE**: GitHub Actions are temporarily disabled due to billing issues. Please run these checks manually.
> Order: common_plat → voice_agent → mindlyst (dependency-safe).
> 
> See MANUAL_CI.md in each repo for quick pre-push checks.
>
> **This repo — human smoke:** after automated checks, walk through [`docs/SMOKE_CHECKLIST.md`](../../docs/SMOKE_CHECKLIST.md) (start stack, one dictation path, one portal login).

## Phase 1: learning_ai_common_plat (shared packages + services)

```bash
# 1. Install + build
cd $HOME/code/mygh/learning_ai_common_plat
pnpm install
pnpm build

# 2. Type-check
pnpm typecheck
# If fails: fix, then git add . && git commit -m "fix(common): type-check fixes" && git push

# 3. Clean unused imports (NEW)
pnpm lint:fix
# This will auto-remove unused imports. If any changes were made:
git add . && git commit -m "fix(common): remove unused imports" && git push

# 4. ESLint
pnpm lint
# If fails: fix, then git add . && git commit -m "fix(common): lint fixes" && git push

# 5. Unit tests with coverage (80% threshold)
pnpm test:coverage
# If fails: fix, then git add . && git commit -m "test(common): fix failing tests" && git push

# 6. Security audit (NEW)
pnpm audit
# If fails: fix, then git add . && git commit -m "fix(common): security updates" && git push

# 7. Code formatting (NEW)
pnpm format:check
# If fails: run pnpm format, then git add . && git commit -m "style(common): format fixes" && git push

# 8. Verify package exports (quick smoke test)
for pkg in packages/*/dist; do node -e "require('./$pkg/index.js')" 2>/dev/null && echo "✓ $pkg OK" || echo "✗ $pkg FAIL"; done
# If fails: fix build/exports, commit push

# 9. Service health (optional, if services running)
# ./scripts/health-check-all.sh
```

## Phase 2: learning_voice_ai_agent (LysnrAI product)

```bash
# 1. Install dashboards (requires common_plat built)
# NOTE: admin-dashboard-web and tracker-dashboard-web moved to learning_ai_common_plat/dashboards/
cd $HOME/code/mygh/learning_voice_ai_agent/user-dashboard-web && npm install

# 2. Type-check all dashboards
npx tsc --noEmit
# If fails: fix, then git add . && git commit -m "fix(admin): type-check fixes" && git push (repeat per dashboard)

# 3. Clean unused imports (NEW)
npm run lint:fix
# This will auto-remove unused imports. If any changes were made:
git add . && git commit -m "fix(dashboard): remove unused imports" && git push (repeat per dashboard)

# 4. Lint dashboards
npm run lint
# If fails: fix, commit push per dashboard

# 5. Code formatting (NEW)
npm run format:check
# If fails: run npm run format, then git add . && git commit -m "style(dashboard): format fixes" && git push

# 6. Unit tests with coverage (NEW)
npm run test:coverage
# If fails: fix, commit push per dashboard

# 7. Next.js build + bundle analysis (NEW)
npm run build && npm run build:analyze
# If fails: fix, commit push per dashboard

# 8. Bundle size limits (NEW)
npm run size:check
# If fails: fix, commit push per dashboard

# 9. Security audit for dashboards (NEW)
npm audit --audit-level moderate
# If fails: fix, commit push per dashboard

# 10. Python type checking
cd .. && pyright
# If fails: fix, then git add . && git commit -m "fix(python): type-check fixes" && git push

# 11. Python lint + auto-fix
python3 -m ruff check src/ tests/ backend/src/ backend/tests/ --fix --unsafe-fixes
# If remaining errors: fix manually, then:
git add . && git commit -m "fix(python): ruff lint fixes" && git push

# 12. Python tests (657 total: desktop + backend)
python3 -m pytest tests/ backend/tests/ -v --tb=short
# If fails: fix, then git add . && git commit -m "test(python): fix failing tests" && git push

# 13. Security audit for Python (NEW)
make audit
# If fails: fix, then git add . && git commit -m "fix(python): security updates" && git push

# 14. Backend API specific checks (if backend deployed)
cd backend
# FastAPI type check
python -m pyright src/
# If fails: fix, then git add . && git commit -m "fix(backend): type-check fixes" && git push
# Backend lint (should be 0 errors after step 11)
python3 -m ruff check src/ tests/
# If fails: fix, then git add . && git commit -m "fix(backend): lint fixes" && git push
cd ..

# 15. Desktop app build verification (optional, resource-intensive)
bash scripts/build.sh
# If fails: fix, then git add . && git commit -m "fix(desktop): build fixes" && git push

# 16. E2E tests for user dashboard
cd user-dashboard-web && npm run test:e2e
# If fails: fix, commit push
# NOTE: admin + tracker E2E tests now run from learning_ai_common_plat/dashboards/
```

## Phase 3: learning_multimodal_memory_agents (MindLyst)

> For comprehensive mobile code quality checks, see: `.windsurf/workflows/mobile-code-quality.md`

```bash
# 1. Install dependencies
cd $HOME/code/mygh/learning_multimodal_memory_agents/mindlyst-native
./gradlew build

# 2. KMP compile check
./gradlew :shared:compileKotlinIosSimulatorArm64
# If fails: fix, then git add . && git commit -m "fix(mindlyst): KMP compile fixes" && git push

# 3. Clean unused imports (NEW)
# For KMP shared module
./gradlew :shared:ktlintFormat
# If changes made: git add . && git commit -m "fix(mindlyst): remove unused imports (KMP)" && git push

# 4. Android compile (if SDK available)
# ./gradlew :androidApp:compileDebugKotlin
# If fails: fix, commit push

# 5. Web lint + build
cd web && npm install && npm run lint
# If fails: fix, then git add . && git commit -m "fix(mindlyst): web lint fixes" && git push
npm run build
# If fails: fix, then git add . && git commit -m "fix(mindlyst): web build fixes" && git push

# 6. Unit tests (9 test files)
cd .. && ./gradlew :shared:test
# If fails: fix, commit push

# 7. E2e tests (if any)
# Add commands if you have Playwright/etc configured

# 8. Mobile code quality (NEW - optional)
# Run dedicated mobile workflow for comprehensive checks:
# - SwiftLint for iOS
# - ktlint & detekt for Kotlin
# - Performance budgets
# - Security scans
# See: .windsurf/workflows/mobile-code-quality.md
```

## Phase 4: Final Integration Smoke Test

```bash
# 1. Ensure all services start (if you have docker-compose)
cd $HOME/code/mygh/learning_voice_ai_agent
docker compose up -d
sleep 10
docker compose ps
# If any service fails: fix, commit push in appropriate repo

# 2. Health check using monitoring script
cd $HOME/code/mygh/learning_ai_common_plat
npx tsx services/monitoring/health-check.ts
# If fails: fix, commit push in common_plat or voice_agent

# 3. Dashboard loads (manual check)
# Open http://localhost:3001 (admin), http://localhost:3002 (user), http://localhost:3003 (tracker)
# If any fails: fix, commit push in voice_agent
```

## Enhanced Coverage Summary (Post-Quick Wins)

| Component | Type-Check | Lint | Format | Unit Tests | Coverage | Build | Bundle | E2E | Security |
|-----------|------------|------|--------|------------|----------|-------|--------|-----|----------|
| **common_plat packages** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
| **common_plat services** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
| **admin-dashboard** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| **user-dashboard** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| **tracker-dashboard** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| **desktop app** | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ |
| **backend API** | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
| **mindlyst shared** | ✅ | 📱 | 📱 | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
| **mindlyst web** | ❌ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
| **mindlyst android** | ✅ | 📱 | 📱 | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
| **mindlyst ios** | ❌ | 📱 | 📱 | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |

📱 = Available via dedicated mobile workflow (.windsurf/workflows/mobile-code-quality.md)

**All Quick Wins Implemented:**
- ✅ Prettier formatting (consistent across all repos)
- ✅ ESLint for common_plat (12 projects now linted)
- ✅ Test coverage with 80% threshold enforcement
- ✅ Bundle size limits with actual enforcement
- ✅ Security audit for all npm and pip dependencies
- ✅ TypeScript strict mode (already enabled everywhere)
- ✅ EditorConfig (already present in MindLyst)

**Total Validation Dimensions: 9** (was 4)

## Notes

- **Commit message pattern**: 
  - `fix(scope): type-check fixes`
  - `test(scope): fix failing tests`
  - `fix(python): lint/format fixes`
  - `fix(mindlyst): KMP compile fixes`
  - `fix(common): security updates`
- **Push after each fix** to keep history clean and avoid merge conflicts
- **common_plat first** because dashboards depend on its built packages
- Coverage reports generated in `coverage/` directory
- Bundle analysis opens in browser when `ANALYZE=true`
