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.
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.
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.
This pull request has changes conflicting with the target branch.
orchestrator/src/services/bank.ts
This pull request is broken due to missing fork information.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes gap-analysis v2 §4 partial (canonical "Execution Reference Set") and §10.6 SWIFT message ID persistence.
What
swift_message_id+swift_message_typecolumns toexecutions, with a partial index onswift_message_idfor 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.commitBankInstructionnow emits a SWIFT reference alongside the ISO-20022 envelope: MT760 for plans carrying anissueInstrumentstep (realgenerateMt760output,messageReferencefield), MT202 for payment-only plans (synthetic ref; PR R stands up the real FIN-link transport).services/execution.tspersists the reference set atbank_instructioncomplete-time viarecordExecution(best-effort; logs on failure, does not abort the leg).Verification
npx tsc --noEmitclean.npx jest85/85 green.Merge note
Migration numbered
006on this branch to keep independent of PR L (which introduces005_plans_participants). Merging PR L first needs no rebase here; merging PR N first will leave a gap that PR L closes.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.