# Changelog

Complete history of FluxiQ PIX platform development phases.

## Development Phases

### Phase 13 — GAP Remediation (2026-02-13)

- PR #2, branch: `feature/gap-remediation-bacen-readiness`
- 15 commits, 33 files changed, +3,651/-321 lines
- Migration #26: institution category column
- Migration #27: monthly RANGE partitions for `monetarie_spi.messages`
- E2E ID centralized to `MessageBuilder` (31-char bug fixed)
- DICT rate limiting per BACEN Manual v8.0 (General=250/25, Special=50/10 req/s)
- Automated ANS monitor (1600ms SLA breach detection)
- DLQ admin: list + replay dead letter messages
- BCB Circular 4010: COSIF export + balance sheet + income statement
- BaseWorker: graceful drain on SIGTERM (30s timeout)
- Query safety: LIMIT 10K on 17 unbounded `Repo.all` calls

### Phase 12 — Production Hardening (2026-02-09)

- Image: `pix-backend:240d3f4`
- Migration #25: monthly partitions for `activity_log` + `login_history`
- PartitionManager GenServer: daily partition check + audit purge
- RBAC: `RequirePermission` plug on 35 actions — FAIL-CLOSED on DB errors
- Token blacklist: Redis JWT revocation on logout
- Idempotency: SET NX atomic lock, SHA-256 fingerprint, user-scoped, 24h TTL
- Distributed tracing: `x-trace-id` in HTTP headers + NATS messages
- Worker telemetry: 3 event types + adaptive backpressure
- Deep audit: 40 findings fixed (6C + 14H + 20M) across 27 files

### Phase 11 — TPS Hardening (2026-02-09)

- K8s: 2Gi/2cpu requests, 4Gi/4cpu limits, PDB, anti-affinity
- DB: 8 TPS indexes (branch, CPF, GIN trigram e2e, composites)
- Auth: Login rate limit (10/15min), account lockout after 10 failures
- Circuit breaker: ETS-based, 5 failures → open, 30s cooldown
- NATS workers: parallel processing (batch 100, concurrency 5-10)
- BaseWorker: retry path checks `max_retries` (prevents infinite loops)
- Deep audit: 10 parallel agents, 2 rounds — all PASS

### Phase 10 — Core Banking Readiness (2026-02-09)

- Cloud SQL direct private IP (10.140.241.2, removed Proxy)
- Connection pool: POOL_SIZE=200 per repo × 4 repos × 2 pods
- MED 2.0: 5 infraction report endpoints
- Migrations #20-22: performance indexes, auth FKs, infraction_reports

### Phase 9 — BCB Transaction Views + NATS on GKE (2026-02-08)

- Portuguese status labels (10 BCB status codes)
- ANS timing: OK/EXCEDIDO badge on transaction detail
- JavaScript timezone fix (`formatDateOnly` + `formatDateTime`)
- `NATS_ENABLED=true` on GKE

### Phase 8 — PaymentController Real DB (2026-02-08)

- Replaced stub with real queries against `monetarie_spi.messages`
- Filters: status, E2E ID, date range, instrument type
- Pagination and summary statistics

### Phase 7 — Core Banking Integration (2026-02-07)

- Auth JWT secret fallback chain (`JWT_SECRET` → `GUARDIAN_SECRET_KEY` → `SECRET_KEY_BASE`)
- `MONETARIE_CORE` stream for Core→PIX events
- CoreEventProcessor: 6 event types (payment, return, key CRUD, lookup, balance)
- CoreEventAdapter: Core-compatible payload format

### Phase 6 — Gap Resolution (2026-02-07)

- 8 commits, 68 files, ~7,200 lines
- i18n 5 locales (admin + user portals)
- Chart.js: 3 reusable components + 12 charts
- 288 ExUnit tests
- User auth hardening (HttpOnly cookies, RSA-OAEP, MFA)
- SystemConfig API

### Phase 5 — Real-Time Monitoring + GL Accounting (2026-02-06)

- Migration: 4 accounting tables + 44 COSIF accounts
- Phoenix Channels: 6 WebSocket topics
- Monitoring GenServers: Broadcaster, HealthChecker, QueueMonitor
- Real-time dashboard with TPS sparkline chart

### Phases 1-4 — Foundation (2026-02-01 to 2026-02-05)

- Base infrastructure: 4 Elixir umbrella apps (shared, dict, spi, settlement)
- 8 PostgreSQL schemas + 175+ domain values
- BACEN client: mTLS, XMLDSig, channel routing (CPM/CSM)
- Admin portal Vue 3: 82 routes, 17 Pinia stores
- Seed data: 369 banks, 15,442 DICT operations, 1,000+ transactions

## Migrations

| # | Timestamp | Purpose |
|---|-----------|---------|
| 1 | 20260201000001 | All initial schemas and tables |
| 2 | 20260203000001 | 13 gap resolution tables |
| 3 | 20260203000002 | Reference data seeding |
| 4 | 20260203100001 | PostgreSQL extensions and ENUMs |
| 5 | 20260203100002 | Missing schemas + auth tables |
| 6 | 20260203100003 | Missing DICT tables |
| 7 | 20260203100004 | Missing SPI tables |
| 8 | 20260203100005 | Missing settlement tables |
| 9 | 20260203100006 | New schema tables |
| 10 | 20260203100007 | DB functions, triggers, views |
| 11 | 20260203100008 | BACEN simulator tables |
| 12 | 20260203100009 | Load remaining seed SQL |
| 13 | 20260206000001 | Auth institutions and groups |
| 14 | 20260206200001 | BACEN compliance tables |
| 15 | 20260206200002 | ALTER domain_values |
| 16 | 20260206200003 | Alcada authorization tier (3 tables) |
| 17 | 20260207300001 | MFA fields |
| 18 | 20260207400001 | GL accounting (44 COSIF + 6 cost centers) |
| 19 | 20260207500001 | System config + 13 parameters |
| 20 | 20260208000001 | Performance indexes |
| 21 | 20260208100001 | Account ISPB + user_groups |
| 22 | 20260209000001 | Recreate infraction_reports |
| 23 | 20260209100001 | 8 TPS indexes |
| 24 | 20260209200001 | Fix audit: reported_cpf_cnpj + user_groups |
| 25 | 20260210000001 | Partitions activity_log + login_history |
| 26 | 20260213000001 | Institution category column |
| 27 | 20260213000002 | Monthly partitions monetarie_spi.messages |

## Expected Outcome

This changelog provides the complete development history of the FluxiQ PIX platform.
