Repository navigation
fix(mercury): enforce Legal Person identity in private Finance account preflight - #206
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (2)
✨ 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: PR #206 (Legal Person guard on Mercury account-binding preflight)Verdict: LGTM. I found no blocking issues. Correctness
Suggestions (non-blocking)
Tests
Operational note
Security and performance
🤖 Generated with Claude Code |
ReviewSmall, well-scoped fail-closed guard. It reuses Notes / suggestions (non-blocking)
No security or performance concerns. I didn't run the tests. LGTM once point 1 is confirmed as intended. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60aee62ed0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Mercury multitenant contract requires an explicit Legal Person ChittyID | ||
| // for a new governed reconciliation pass. Preserve the legacy webhook path: | ||
| // its older rows are flagged but never silently promoted to trusted binds. | ||
| if (!isLegalPersonChittyId(getLegalPersonChittyId(account))) { |
There was a problem hiding this comment.
Verify the Legal Person instead of only its type code
When legal_person_chittyid contains any syntactically valid T=P identifier for a natural or synthetic person, this guard passes: isLegalPersonChittyId explicitly checks only group 5 and its own documentation notes that the Legal subtype is not encoded in the ID. Because this route neither receives an expected Legal Person ID from the broker nor verifies the stored value with the delegated ChittyID authority, malformed ownership metadata can still open reconciliation for an account that is not bound to a verified P-Legal entity. Require an authoritative subtype/identity assertion or compare against a broker-supplied, verified Legal Person identity.
AGENTS.md reference: AGENTS.md:L90-L92
Useful? React with 👍 / 👎.
Contract defect
docs/contracts/mercury-multitenant.mdrequires every Mercury account to be attributable to exactly one Legal Person ChittyID. Finance PR #205 verifies exact Mercury organization, account and canonical tenant identity but omitted the existing Legal Person guard. A provider org/account match without Legal Person provenance must NOT open the new reconciliation consumer.Bounded remediation
server/lib/legal-person-binding.ts::isLegalPersonChittyIdto validate the pre-existingaccounts.metadata.legal_person_chittyidbefore the private Finance/mercury/account-bindingroute returns a Finance account UUID.legal_person_binding_missingwhen absent/invalid/non-Person, without disclosing identifiers, creating records, assigning entity ownership or mutating books.Release gate
Read-only Neon audit 2026-10-12 showed zero of 42 Mercury-labeled accounts with
legal_person_chittyidand zero explicit provider org binding; thus this safely remains fail-closed until independently sourced and operator-gated metadata corrections. ChittyConnect #343 and Finance #205 are deployed but Finance readiness/consume is still missing. Do NOT invent a ready/processed receipt. No new infrastructure or financial write.