Repository navigation
fix(mercury): verify exact provider organization, account and canonical Finance tenant - #205
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review. A tight, fail-closed, read-only guard. Scope matches the description and the tests cover the main rejection paths. Notes by importance: Issues / suggestions
Test gaps
Security. Private-origin gating is tested, reads are bounded, errors don't leak internals, and there are no mutation paths. No concerns beyond item 1. Nothing is blocking except possibly item 1, depending on intent. |
Review of #205The design is sound: it is read-only and fail-closed, treats duplicates as ambiguity, and keeps error bodies generic (the test confirms Correctness / robustness
Performance
Tests
The tests use mocked storage only. The SQL in Minor
Overall this looks good to merge once the nits are considered. |
…or conflicted source attribution
Review: Mercury account-binding preflightOverall this is a tight, fail-closed, read-only design. It follows the repo conventions: DB access goes through What looks good
Suggestions
No blocking security issues found. Items 1, 4 and 6 are the ones I'd address before merge. |
ReviewOverall this is a well-scoped, fail-closed read-only guard. The tenant, institution, active-flag and org-provenance checks are sound, and the tests assert that the guard does not read ledger rows before the origin check passes. Notes below, roughly by importance. Correctness / bugs
Design / hardening
Tests
Security
Item 1 should be fixed before merge. The others are suggestions. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Context
Existing ChittyConnect PR #343 cannot safely activate Mercury reconciliations until the ChittyFinance consumer has authoritative account attribution. Live read-only audit found 28/42 Mercury-labeled Finance accounts without
external_id, including all 21 ARIBIA LLC - MGMT accounts, with an FC transaction booked to a conflicting Finance account. Names and last-four digits cannot be treated as binding evidence.Scope
SystemStorage; two matches are an ambiguity, never first-wins.GET /internal/chittyconnect/mercury/account-bindingto verify existing tenant UUID, explicit canonical business identity, active account, exact provider account ID, and existing metadata for the Mercury organization ID. Preserve FC/CHIT organization boundaries despite shared canonical MGMT identity.unboundfor zero rows; reject duplicate, inactive, wrong-tenant, provider-org-provenance-missing, malformed, or query-failure cases. Never auto-provision a tenant, account, or transaction.Release gates
This PR is a preflight guard, not an ingest consumer, not a bookkeeping mutation and not evidence that three missing FC source IDs are reconciled. The ChittyConnect Finance
/mercury-reconciliation/readinessand/consumeendpoints must independently provide a real durable consumer before enabling PR #343 dispatch or registering CHIT/MNW webhooks. Production ledger writes stay operator-gated with exact source ownership, idempotency, audit receipt and rollback evidence. No new database, table, key store, binding, queue or provider write.Existing work: ChittyFinance #203; chittyconnect-finance #21 and #22; ChittyConnect #343.