PR N: executions.swift_message_id + SWIFT gateway wiring #18

Open
nsatoshi wants to merge 1 commits from devin/1776881860-pr-n-swift-msgid into main
Owner

Closes gap-analysis v2 §4 partial (canonical "Execution Reference Set") and §10.6 SWIFT message ID persistence.

What

  • Migration 006 adds swift_message_id + swift_message_type columns to executions, with a partial index on swift_message_id for acknowledgment ingest (camt.025/054 → original MT760/MT202 lookup).
  • db/executions.tsrecordExecution() UPSERT helper, getExecution(), findBySwiftMessageId(). These are the three queries the bank-instruction phase and the SWIFT gateway need.
  • services/bank.ts.commitBankInstruction now emits a SWIFT reference alongside the ISO-20022 envelope: MT760 for plans carrying an issueInstrument step (real generateMt760 output, messageReference field), MT202 for payment-only plans (synthetic ref; PR R stands up the real FIN-link transport).
  • services/execution.ts persists the reference set at bank_instruction complete-time via recordExecution (best-effort; logs on failure, does not abort the leg).
  • 5 unit tests covering MT760 vs MT202 branching, reference uniqueness across calls, and SQL shape of the UPSERT + SELECT.

Verification

  • npx tsc --noEmit clean.
  • npx jest 85/85 green.

Merge note

Migration numbered 006 on this branch to keep independent of PR L (which introduces 005_plans_participants). Merging PR L first needs no rebase here; merging PR N first will leave a gap that PR L closes.

Closes gap-analysis v2 §4 partial (canonical "Execution Reference Set") and §10.6 SWIFT message ID persistence. ## What - **Migration 006** adds `swift_message_id` + `swift_message_type` columns to `executions`, with a partial index on `swift_message_id` for acknowledgment ingest (camt.025/054 → original MT760/MT202 lookup). - **`db/executions.ts`** — `recordExecution()` UPSERT helper, `getExecution()`, `findBySwiftMessageId()`. These are the three queries the bank-instruction phase and the SWIFT gateway need. - **`services/bank.ts.commitBankInstruction`** now emits a SWIFT reference alongside the ISO-20022 envelope: **MT760** for plans carrying an `issueInstrument` step (real `generateMt760` output, `messageReference` field), **MT202** for payment-only plans (synthetic ref; PR R stands up the real FIN-link transport). - **`services/execution.ts`** persists the reference set at `bank_instruction` complete-time via `recordExecution` (best-effort; logs on failure, does not abort the leg). - 5 unit tests covering MT760 vs MT202 branching, reference uniqueness across calls, and SQL shape of the UPSERT + SELECT. ## Verification - `npx tsc --noEmit` clean. - `npx jest` 85/85 green. ## Merge note Migration numbered `006` on this branch to keep independent of PR L (which introduces `005_plans_participants`). Merging PR L first needs no rebase here; merging PR N first will leave a gap that PR L closes.
nsatoshi added 1 commit 2026-04-22 18:22:25 +00:00
executions.swift_message_id + SWIFT gateway wiring
Some checks failed
CI / Frontend Lint (pull_request) Failing after 8s
CI / Frontend Type Check (pull_request) Failing after 6s
CI / Frontend Build (pull_request) Failing after 5s
CI / Frontend E2E Tests (pull_request) Failing after 6s
CI / Orchestrator Build (pull_request) Failing after 6s
CI / Contracts Compile (pull_request) Failing after 6s
CI / Contracts Test (pull_request) Failing after 5s
Code Quality / SonarQube Analysis (pull_request) Failing after 18s
Code Quality / Code Quality Checks (pull_request) Failing after 5s
Security Scan / Dependency Vulnerability Scan (pull_request) Failing after 3s
Security Scan / OWASP ZAP Scan (pull_request) Failing after 4s
c72f9cd807
Closes gap-analysis v2 §4 partial (canonical "Execution Reference Set")
and §10.6 SWIFT message ID persistence.

- Migration 006 adds swift_message_id + swift_message_type columns to
  executions, with a partial index on swift_message_id for
  acknowledgment ingest (camt.025/054 -> original MT760/MT202 lookup).
- db/executions.ts: recordExecution() UPSERT helper, getExecution(),
  findBySwiftMessageId() — the three queries the bank-instruction phase
  and SWIFT gateway need.
- services/bank.ts.commitBankInstruction now emits a SWIFT reference
  alongside the ISO-20022 envelope: MT760 for plans carrying an
  issueInstrument step (real generateMt760 output, messageReference
  field), MT202 for payment-only plans (synthetic ref).
- services/execution.ts persists the reference set at bank_instruction
  complete-time via recordExecution (best-effort; logs on failure,
  does not abort the leg).
- 5 unit tests covering MT760 vs MT202 branching, reference uniqueness
  across calls, and SQL shape of the UPSERT + SELECT.
Some checks failed
CI / Frontend Lint (pull_request) Failing after 8s
CI / Frontend Type Check (pull_request) Failing after 6s
CI / Frontend Build (pull_request) Failing after 5s
CI / Frontend E2E Tests (pull_request) Failing after 6s
CI / Orchestrator Build (pull_request) Failing after 6s
CI / Contracts Compile (pull_request) Failing after 6s
CI / Contracts Test (pull_request) Failing after 5s
Code Quality / SonarQube Analysis (pull_request) Failing after 18s
Code Quality / Code Quality Checks (pull_request) Failing after 5s
Security Scan / Dependency Vulnerability Scan (pull_request) Failing after 3s
Security Scan / OWASP ZAP Scan (pull_request) Failing after 4s
This pull request has changes conflicting with the target branch.
  • orchestrator/src/services/bank.ts
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin devin/1776881860-pr-n-swift-msgid:devin/1776881860-pr-n-swift-msgid
git checkout devin/1776881860-pr-n-swift-msgid
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: d-bis/CurrenciCombo#18