Repository navigation
fix(mercury): authoritative org-scoped Finance account binding preflight - #204
chitcommit wants to merge 3 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 of PR 204 Solid fail-closed design: read-only, no schema change, strict UUID validation, every binding dimension checked, and no internals leaked in error bodies. No blocking issues. Suggestions
Test gaps
Security 🤖 Generated with Claude Code |
Existing Mercury reconciliation workstream — ChittyConnect #343 / ChittyFinance #203 / chittyconnect-finance #21/#22
The canonical
chittyconnect-financeadapter requires a read-only exact provider-org/provider-account→Finance account binding resolver before any sync. ChittyFinance's private API exposes global source-owner reads but does not expose the corresponding account-binding contract. Previous Finance read-only audits found many Mercury-labeled accounts without external IDs, including ARIBIA LLC - MGMT. Account display names, mask suffixes, and shared DBAs must never be used as substitutes.Changes
SystemStorage.getMercuryAccountBindingCandidatesByExternalId()querying all tenants by the exact external Mercury account UUID and returning at most two candidates. Read-only; no auto-provision, no financial records changed.GET /internal/chittyconnect/mercury/account-binding/:accountIdbehind the existing private service-binding hostname/caller gate. Verify exact org/account IDs, active tenant and exact canonical business identity, unique provider account binding, active Mercury institution, exact metadatamercuryOrganizationId/mercuryOrgId, and authorized tenant. On incomplete/missing/duplicate/conflicting data return 409/503 rather than a guessed match.Integration and deployment gates
This PR implements a read-only prerequisite; NOT a durable reconciliation consumer, Finance readiness/consume endpoint, completed ledger sync, or permission to write. Existing seven Mercury webhooks unchanged; CHIT/MNW registration remains blocked. Do not activate PR #343's org-scoped events until canonical provider reads, financial account binding, source ownership, write-executor idempotency, queue receipts, and governance are verified. No new queue/DB/schema/store/secret.
Finance operating constitution: document governs projections, fail closed on incomplete coverage, no hand-written apply SQL and operator-gate all production financial writes.