# Release Checklist — ABC Core Phase 4.1

**Date:** 2026-07-03  
**Version:** 1.1.0 (Phase 4.1 Stabilized)  
**Status:** READY FOR PRODUCTION (with caveats)

---

## 1. Pre-Release Verification

### Code Quality

- [x] No TODO placeholders remaining
- [x] No commented production code
- [x] No dead code or unused classes
- [x] No `var_dump`, `print_r`, or `die()` statements
- [x] No hardcoded credentials or secrets
- [x] PSR-4 autoloading verified
- [x] `declare(strict_types=1)` on all service/controller files

### Database

- [x] All 16 migrations run successfully
- [x] Indexes created (including 000015 performance indexes)
- [x] Foreign keys verified
- [x] Unique constraints verified
- [x] Character set: utf8mb4
- [x] Collation: utf8mb4_unicode_ci
- [x] Engine: InnoDB
- [x] Clearing accounts seeded (CLEARING-NGN, CLEARING-USD, CLEARING-EUR, CLEARING-GBP)

### Security

- [x] SQL injection: all queries parameterized
- [x] XSS: JSON-only API, no HTML responses
- [x] CSRF: not applicable (Bearer token API)
- [x] Rate limiting: file-based, isolated storage
- [x] Security headers: X-Content-Type-Options, X-Frame-Options, Referrer-Policy, CSP, Permissions-Policy
- [x] Password hashing: bcrypt cost 12
- [x] Token generation: 256-bit random
- [x] Trace leak prevention: environment-gated

### Ledger Integrity

- [x] Double-entry for all 12 transaction types
- [x] `verifyDoubleEntry()` called on every transaction
- [x] `BalanceEngine` is the only balance writer
- [x] Opening/closing balance tracked per entry
- [x] Reversal creates negating entries
- [x] Reference collision avoidance verified

### API Consistency

- [x] All responses include `success`, `message`, `data`, `errors`, `meta`
- [x] HTTP status codes consistent
- [x] Pagination metadata included in list responses
- [x] Error messages consistent
- [x] Validation messages consistent

---

## 2. Known Limitations (Non-Blocking)

| # | Limitation | Impact | Mitigation |
|---|-----------|--------|------------|
| 1 | No SMTP integration | Email notifications queued but not sent | Monitor `storage/queue/` and implement SMTP worker |
| 2 | No PDF receipt generation | Receipts created but not rendered | Receipt data is available; PDF generation deferred to future phase |
| 3 | No ATM withdrawal | Returns 501 | Feature not in scope for Phase 4 |
| 4 | No cheque/draft deposit | Not supported | Feature not in scope for Phase 4 |
| 5 | File-based queue | Throughput limited by disk I/O | Sufficient for shared hosting; monitor queue depth |
| 6 | No Redis/Memcached | Balance calculation is database-bound | Composite indexes mitigate; consider caching for >1M entries |
| 7 | No load testing executed | Performance numbers are projections | Run load tests before high-volume deployment |
| 8 | No integration tests | Only unit and manual verification planned | Execute manual checklist before production |
| 9 | Clearing account used for all counterparty entries | Semantically not perfect for fees/interest | Functionally correct for double-entry; proper revenue/expense accounts in future phase |

---

## 3. Deployment Steps

1. [ ] Backup existing database
2. [ ] Run migrations 000000 through 000015
3. [ ] Verify clearing accounts exist: `SELECT * FROM accounts WHERE account_number LIKE 'CLEARING-%'`
4. [ ] Set `APP_ENV=production` in `.env`
5. [ ] Set `RATE_LIMIT_MAX=60` and `RATE_LIMIT_WINDOW=60` in `.env`
6. [ ] Verify `storage/queue/` and `storage/rate_limit/` are writable
7. [ ] Verify `storage/logs/` is writable
8. [ ] Configure web server to point to `public/` directory
9. [ ] Enable HTTPS (required for HSTS)
10. [ ] Run manual verification checklist (see TEST_RESULTS.md)
11. [ ] Monitor audit logs for 24 hours
12. [ ] Monitor queue depth for 24 hours

---

## 4. Rollback Plan

| Scenario | Action |
|----------|--------|
| Database migration fails | Restore from backup; run `down()` on last successful migration |
| Double-entry imbalance detected | Run `BalanceEngine::rebuildBalance()` for affected accounts |
| Queue overflow | Increase `RATE_LIMIT_MAX` temporarily; add worker processes |
| API response format breaks | Revert `Response.php` to previous version; update clients |
| Performance degradation | Add `idx_account_uuid_status` index; consider partitioning ledger_entries |

---

## 5. Post-Release Monitoring

| Metric | Threshold | Action |
|--------|-----------|--------|
| Queue depth > 100 | Alert | Add worker process |
| Rate limit hits > 10/min | Alert | Investigate for DDoS |
| Double-entry failures > 0 | **CRITICAL** | Stop all transactions; investigate ledger |
| Balance mismatches > 0 | **CRITICAL** | Run `rebuildBalance()` for affected accounts |
| Audit log write failures > 0 | **HIGH** | Investigate disk space / database connectivity |
| 500 errors > 1% of requests | **HIGH** | Review ExceptionHandler logs |
| Response time > 500ms (p95) | **MEDIUM** | Add indexes or caching |

---

## 6. Sign-Off

| Role | Name | Date | Status |
|------|------|------|--------|
| Lead Developer | — | — | ⏳ |
| QA Engineer | — | — | ⏳ |
| Security Reviewer | — | — | ⏳ |
| Database Administrator | — | — | ⏳ |
| DevOps Engineer | — | — | ⏳ |
| Product Owner | — | — | ⏳ |

---

## Release Status: CONDITIONAL GO

ABC Core Phase 4.1 is **stable, secure, and production-ready** with the following conditions:
1. Manual verification checklist must be executed before production deployment
2. SMTP worker must be implemented before email notifications are expected
3. Load testing must be performed before high-volume deployment
4. All sign-offs must be obtained before production deployment

**Do NOT proceed to Phase 5 (Loans, Cards, KYC, OTP, Admin APIs, Reports) without explicit approval.**
