Reconciliation — engineering¶
Runtime shape¶
Seven Cloud Run services (README) plus exception-service, coordinated by Pub/Sub and BigQuery. Engine fans windows to workers; Redis supports session/pipeline state; DLQ replay prevents silent loss.
flowchart LR
ing[bk_ingestion] --> names[bk_name_worker]
ing --> rev[bk_reversals]
rev --> eng[bk_recon_engine]
eng --> workers[bk_recon_worker]
workers --> eng
eng --> load[bk_loader]
workers --> dlq[bk_dlq_replay]
exc[exception_service] --> eng
Layout¶
banking-reconciliation-ai-backend/
microservices/
ingestion/ reconciliation-engine/ loader/ reversals/ exception-service/
cloud-functions/
name-worker/ reconciliation-worker/ recon-work-dlq-replay/ ingest-worker/
shared/
docs/ # contracts + flagged inconsistencies
Makefile
head-cloudbuild.yaml
Happy-path trail (money)¶
POST /v1/ingestion/background→ ETL to BigQuery + publishnames-work-topic-<env>- Name worker
POST /extract-names→ cache / Gemini →session_name_results - Reversals → engine
POST /v1/reconcile/banking - Engine publishes
recon-work-topic-<env>(pull by default) - Worker matches window →
recon-completepush →/v1/reconcile/complete-batch - Loader persists matches / updates backend
- Failures → DLQ →
POST /replay
Invariants¶
- Do not drop DLQ messages without an operational decision.
- Exception resolve scope: partner + tenant + domain + cluster type (exception_resolution.md).
- Asset flows use separate ingest endpoint and event contract.
- Prefer router paths when README disagrees (e.g. reversals
/pipeline/backgroundvs README/background).
Local¶
cd banking-reconciliation-ai-backend
make run-all # or make run-core
# APP_ENVIRONMENT=local → sequential matching
Ports: ingestion 8001, engine 8002, loader 8003, reversals 8004, exception-service 8005.
Flagged inconsistencies¶
docs/FLAGGED-inconsistencies.md — behaviour-preserving metric/summary quirks awaiting product decisions. Do not “quietly fix” in drive-by changes.