Task: Close the credit round trip
Table of Contents
This page documents a task in the Rework the credit instruments to the instrument table rule story. It captures the goal, current status, acceptance, and any notes or results.
1. Goal
Each swap-like credit product's ORE elements come back from the tables.
2. Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Rework the credit instruments to the instrument table rule |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-10-11 |
3. Acceptance
- The dropped elements of the credit default swap, the index swap, the index option, the synthetic CDO and the credit linked swap are stored in the product's fact table and exported.
- The index option stores its own elements in its fact row, the wrapped index swap's elements in the index swap's table, and its option block in the shared option tables.
- A mapper test per product holds its elements through the round trip.
- The ORE suite passes.
- The risk participation agreement is out of scope: unit 7 takes it, because its protection fee is a list of legs and its underlying can hold a treasury lock on a bond.
4. Plan
- Widen the fact tables. Add a column only with its writer: the accrual and payment flags, the payment time, the protection start, the upfront date and fee, the trade date and the cash settlement days of the swap-like products, the option's knock-out flag, index term, strike type and front-end start, and the credit linked swap's default payment time. A flag is a boolean and the upfront fee is an exact decimal.
- Two rows for the index option. The option wraps an index swap, so the trade has its option row and a row of the index swap's table. The carrier holds the option row as its fact and the wrapped swap's row beside it. This undoes the one-row shortcut of unit 5, which could not hold the wrapped swap's columns without copying them.
- The shared option block. The swaption's option mapping becomes public as
map_option_blockandrebuild_option_block, and the credit carrier holds the option rows. The header's delete cascade, the export service and the import handler carry them. - Prove it. A test per product reads its elements back, and the suites run against a recreated database.
5. Measurements
Every number this task claims about a tree, with the command that produced it
and the commit it was measured at. A number without both is not a measurement,
because a clean-up record describes a tree and trunk moves under a branch: a
consumer count, a gate's component count and a suite's size all change with no
code changing, and the reader of a bare number cannot tell which tree it came
from. Where the raw output matters, put it in an evidence/ file beside the
task and name that file in the Command column.
| What | Value | Command | Commit |
|---|---|---|---|
| ORE core suite | all pass | ctest --preset linux-clang-debug-make -R ores.ore.core.tests |
the PR head |
| Trading core suite | all pass, with the generated eventing tests | ctest --preset linux-clang-debug-make -R ores.trading.core.tests |
the PR head |
| Shell trading suite | all pass | ctest --preset linux-clang-debug-make -R ores.shell.trading.tests |
the PR head |
| Build | exit 0 | compass build ores.ore.core.tests ores.trading.core.tests ores.shell.trading.tests ores.ore.service.exe |
the PR head |
6. Notes
- After the review the trading API, trading service, shell application and ORE
core suites passed through
compass test run, the codegen suite passed with 1,397 cases, and a misspell scan of every file the branch changes found nothing. - The ORE binding showed what the analysis missed. The agreement's
ProtectionFeeis a list of legs, not an amount, and itsUnderlyingholds legs, an optional option block, a naked-option flag and an optional treasury lock whose data is a whole bond. The design had a money column for the fee. The agreement became unit 7, and the design now says so. - The synthetic CDO states its upfront fee as text that is empty or a number. The mapper stores a number as an exact decimal and an empty text as null.
- The ORE flag type has thirteen spellings (Y, YES, true, 1 and so on). The
tables hold a boolean, so the export writes Y or N. A document that wrote
falsecomes back asN. Both are valid ORE. - The index option's exercise rules beyond a list of dates (an exercise schedule) go to the shared schedule tables through the swaption's mapping.
7. Test Scenarios
Manual QA scenarios (scaffolded via compass add test_scenario)
that verify this task. Link
new ones here as they're created; the scenario doc itself links back
via its "Verifies task" field.
| Scenario | State | Notes |
|---|---|---|
8. PRs
| PR | Title |
|---|---|
| #3220 | [ore,trading,sql] Close the credit round trip for swap-like products |
9. Review
| # | Comment summary | File | Decision | Notes |
|---|---|---|---|---|
| 1 | The agreement is split from this unit | the staging | accept | Its protection fee and underlying need legs, an option and a bond; they are unit 7. |
| 2 | A flag spelled false comes back as N | credit_instrument_mapper.cpp | accept | The ORE flag type has thirteen spellings and the table holds a boolean, so the export is canonical. |
| 3 | The index option writes two fact rows | the carrier | accept | The wrapped swap's columns would otherwise be copied into the option's table. |
| 4 | An index option with no wrapped swap row exports an empty curve id | credit_instrument_mapper.cpp | accept | The export logs a warning. The importer writes both rows, so a missing row means a partial write. |
| 5 | An unknown strike type becomes Price | credit_instrument_mapper.cpp | decline | The table's check allows Spread and Price only, so no other value is stored. |
| 6 | A number that does not parse in the CDO upfront fee is dropped | credit_instrument_mapper.cpp | decline | The schema type allows an empty text or a float, so a valid document never fails the parse. |
| 7 | The cash settlement days are cast from 64 bits to int with no bound | credit_instrument_mapper.cpp | decline | A value beyond the integer range wraps negative and the table's check refuses the row, so the import reports an item error. |
| 8 | The trading API, trading service, shell application and codegen suites and the misspell scan were not run | the PR | accept | Run before the merge; see the Notes. |
10. Result
Each swap-like credit product stores the elements the mapper used to drop. The credit default swap, the index swap and the synthetic CDO hold their accrual and payment flags, payment time, upfront date and fee, and the swaps their protection start, trade date and cash settlement days. The credit linked swap holds its settles-accrual flag and default payment time. The index option holds its knock-out flag, index term, strike type, trade date and front-end start in its own row, the wrapped swap's elements in the index swap's table, and its option block in the shared option tables. All of them come back through the export.
Acceptance met for the five swap-like products. The risk participation agreement is unit 7.