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

1 Commits

Author SHA1 Message Date
Devin
c72f9cd807 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
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.
2026-04-22 18:22:04 +00:00