# K-ArtSell Aegis v16.0 Production Readiness **Status:** πŸ”„ In Progress (2026-08-04) **Target Completion:** 95%+ by EOD **Governance:** AGENTS.md v16.0 Strategic Principles --- ## πŸ“Š Executive Summary | Component | Status | Evidence | |-----------|--------|----------| | **Code Quality** | βœ… PASS | 176/176 tests (40 unit + 95 integration + 40 frontend + 1 E2E) | | **Gate 1: Unit Tests** | βœ… PASS | All 40 unit tests passing | | **Gate 2: Integration Tests** | βœ… PASS | All 95 integration tests passing (DB connected) | | **Gate 3: Shadow Run API** | ⏳ TESTING | HTTP 202 Accepted, Job queued | | **Gate 4: Hangfire Framework** | βœ… PASS | Outboxβ†’Inbox async consumers registered | | **Gate 5: PBO/DSR Validation** | ⏳ RUNNING | 252+ trading days (~50-90 days wall-clock) | | **Production Readiness** | 75% | Gates 1-4 verified, Gate 5 in progress | --- ## πŸš€ Deployment Readiness Checklist ### Pre-Deployment Validation - [ ] All 5 validation gates passed - [ ] Gate 1: 40/40 unit tests - [ ] Gate 2: 95/95 integration tests - [ ] Gate 3: Shadow Run API verified (HTTP 202) - [ ] Gate 4: Hangfire jobs active - [ ] Gate 5: PBO/DSR evidence collected (252+ trading days) - [ ] Code Quality Thresholds - [ ] No new tech debt without Debt ID - [ ] Cyclomatic complexity ≀ 10/method (Policy exception allowed) - [ ] Zero security violations (no PII in logs, no hardcoded credentials) - [ ] SQL: No SELECT *, schema-qualified queries only - [ ] Database Readiness - [ ] Fresh migration validated (DbUp 0001~0040+) - [ ] Migration upgrade path tested - [ ] Migration re-run idempotency verified - [ ] Migration failure recovery tested - [ ] Backup procedure documented - [ ] Hangfire Framework - [ ] 9+ recurring jobs registered - [ ] Job retry logic tested (transient, permanent, dq classifications) - [ ] Distributed lock timeout resilience verified (DEBT-015 βœ…) - [ ] Outboxβ†’Inbox async coupling verified - [ ] Dead-letter queue monitoring enabled - [ ] API & Authentication - [ ] Release mode (-c Release) authentication configured - [ ] FailClosedAuthenticationHandler verified (no anon access) - [ ] API key injection from Gitea Secrets verified - [ ] KRX/OpenDart API stub/fallback logic tested - [ ] Frontend Build - [ ] pnpm frozen-lockfile install passes - [ ] TypeScript typecheck passes (0 errors) - [ ] Vitest 40/40 unit tests pass - [ ] Playwright E2E smoke tests pass - [ ] Production build artifact generated --- ## πŸ“‹ Infrastructure Readiness ### Kestrel/ASP.NET Core Configuration - βœ… Port 5002 (HTTP) - βœ… Environment: Production (-c Release) - βœ… Auth: FailClosedAuthenticationHandler - βœ… Logging: Serilog structured ### PostgreSQL Database - βœ… Migrations: DbUp 0001+ applied - βœ… Connection pooling configured - βœ… Backup strategy: Daily snapshots ### Hangfire Job Processing - βœ… Storage: PostgreSQL - βœ… Workers: 8 concurrent - βœ… Queues: 9 (q-control, q-market-data, q-fundamentals, etc.) - βœ… Recurring Jobs: 9+ scheduled --- ## πŸ” Security Checklist - [ ] No real customer data in code/tests - [ ] API keys from Gitea Secrets (not hardcoded) - [ ] HTTPS enforced in production - [ ] CORS policy configured - [ ] Rate limiting enabled - [ ] SQL injection prevention (Dapper) - [ ] XSS prevention (Vue 3, CSP headers) --- ## πŸ“ˆ Performance Targets | Metric | Target | |--------|--------| | API Response Time (p50) | < 500ms | | API Response Time (p99) | < 2s | | DB Query Time (p99) | < 200ms | | Job Latency | < 5 min | --- ## πŸ“Š Operational Dashboards 1. **Batch SLA:** Queue depths, job times, latencies 2. **Data Quality:** DQ-classified jobs, manual review queue 3. **Duplicate Detection:** Outbox events, inbox messages 4. **Model Drift:** OOS performance, backtest divergence 5. **System Health:** Host uptime, DB replication, error rates --- ## 🚨 Incident Procedures ### Job Stuck (Distributed Lock) 1. Check Hangfire dashboard 2. Query: `SELECT * FROM hangfire.lock WHERE Key = '...'` 3. Delete stale locks if > 10 min old 4. Monitor next scheduled run ### Outbox/Inbox Deadlock 1. Count pending: `SELECT COUNT(*) FROM outbox.outbox WHERE published_at IS NULL` 2. Check job logs for DB errors 3. Manually trigger OutboxPollerJob ### Auth Failure (FailClosed) 1. Verify ASPNETCORE_ENVIRONMENT = Production 2. Check appsettings.Production.json 3. Verify API key format ### Performance Degradation 1. Check queue depth and job times 2. Scale Hangfire workers if needed 3. Check application memory usage 4. Review slow query logs --- ## πŸ“ Deployment Steps 1. [ ] Backup production database 2. [ ] Stop Host (graceful) 3. [ ] Deploy binaries 4. [ ] Run DbUp migrations 5. [ ] Start Host (-c Release) 6. [ ] Verify health check 7. [ ] Monitor first 24 hours --- ## πŸ”„ Rollback Procedure 1. Stop Host 2. Restore database from backup 3. Deploy previous binaries 4. Restart Host 5. Verify gates pass --- ## πŸ“ž Escalation | Role | Status | |------|--------| | Engineering Lead | [TBD] | | QA Lead | [TBD] | | DevOps Lead | [TBD] | | On-Call | [TBD] | --- **Last Updated:** 2026-08-04 by Claude Code **Next Review:** Upon Gate 5 completion