Task: Map netting sets to and from ORE
Table of Contents
This page documents a task in the Model netting agreements, netting sets and CSAs story. It captures the goal, current status, acceptance, and any notes or results.
1. Goal
Read and write ORE's netting set definitions through the new entities, so an imported document exports unchanged.
2. Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Model netting agreements, netting sets and CSAs |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-10-03 |
3. Acceptance
- A mapper turns a nettingsetdefinitions document into netting sets, CSAs and eligible currencies, and back.
- Every netting set document in ORE's examples round-trips through the entities unchanged.
- A netting set carries ORE's call type and initial margin type through the round trip.
4. Plan
- A
netting_set_mapperinores.ore.core, following the credit simulation mapper:mapreturns one list per table (sets, CSAs, eligible currencies) andreverserebuilds the document. - ORE names a set by id alone, so an imported set has no agreement and no parties. NettingSetDetails with an agreement type or a legal entity is refused, since both must resolve to entities and the mapper has no store; no ORE example uses either.
- A set exports as NettingSetDetails when it has a call type or an initial margin type, and as a plain NettingSetId otherwise.
- The round trip is checked by serialising the original and the rebuilt document with the same binding and comparing the text.
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 |
|---|---|---|---|
6. Notes
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 |
|---|---|
| #2539 | [ore] Map netting sets to and from ORE |
9. Review
| # | Comment summary | File | Decision | Notes |
|---|---|---|---|---|
| 1 | ActiveCSAFlag always written | mapper | Document | Every example states it; the header says export always does. |
| 2 | Defaults hide a half-stated CSA | mapper | Fix | Export refuses a CSA with half an independent amount or one margining frequency. |
| 3 | Active flag without details refused | mapper | Keep | Nothing could hold the flag; no example has it. |
| 4 | Quadratic lookup in reverse | mapper | Fix | CSAs and currencies indexed by key. |
| 5 | Tenant and party not set | mapper | Keep | The import planner sets them when it is wired. |
| 6 | Missing refusal tests | tests | Fix | Agreement type, active flag without details, and one margining frequency on export. |
| 7 | Includes by transit | mapper, tests | Fix | <optional> and <stdexcept> included directly. |
10. Result
netting_set_mappermaps a NettingSetDefinitions document to netting sets, CSAs and eligible currencies, and back.- All 99 netting set documents in ORE's examples, holding 191 netting sets, round-trip through the entities to the same serialised document. The binding keeps the whitespace between CSADetails' elements as mixed text; the test checks that it is whitespace before setting it aside.
- NettingSetDetails carries a set's call type and initial margin type through the round trip; details naming a legal entity are refused.
- An inactive CSA keeps its terms through the mapping.
- After review: export refuses a half-stated independent amount or margining frequency rather than inventing the missing value, and reverse indexes CSAs and currencies by key.
- ctest: 89 of 89 binaries passed,
ores.ore.core.testswith the four new cases.