Task: Carry the credit digits

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

Every credit money value is stored and exported as the digits the document wrote, and every credit numeric column has the type its kind needs: money is an exact decimal, a continuous quantity is a binary float, and the column and the domain type agree.

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

  • UpfrontFee and Strike keep the document's digits, through the reapply script.
  • A continuous quantity (FixedRecoveryRate, AttachmentPoint, DetachmentPoint, ParticipationRate) stays a binary float.
  • The tranche columns are double precision, so each column agrees with its domain type; recovery_rate stays double precision.
  • A mapper test holds the digits of the money member the mapper stores, and the goldens that change are numeric text only.
  • The ORE suite passes.

4. Plan

  1. Classify. Sort every credit numeric column and binding member into money or continuous, with the exact-money check of the data-oriented design page. Money is an exact decimal. A continuous quantity stays a binary float. The column and the domain type must agree.
  2. The binding. Add a table of credit money members to the reapply script: the two UpfrontFee members and the index option's Strike. The script patches the struct, the getter, the element info and the serializer of each, and it refuses an anchor that is missing or not unique.
  3. The mapper. The forward mapping already reads a lexical leaf through exact_decimal. The reverse mapping writes the strike with set_exact, which moves to the boundary header so both mappers share it.
  4. The tranche columns. The tranche points are continuous quantities. Their columns become double precision, so they agree with their double domain type.
  5. Tests and goldens. A mapper test holds the strike's digits, a binding test holds the strike and the upfront fee, and the goldens that change are regenerated.

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
Credit money members made lexical leaves 3 (two UpfrontFee, one Strike) grep -c moneyFloat projects/ores.ore/core/include/ores.ore.core/domain/domain.hpp is 6: the leaf, the two FRA members and these three the PR head
Golden files changed 3 of 132, one numeric line each git diff --stat -- assets the PR head
ORE core suite 651 cases, 482,975 assertions, all pass ores.ore.core.tests the PR head
Trading core suite 152 cases, 1,080 assertions, all pass ores.trading.core.tests after compass db recreate the PR head
Codegen tests 1,374 passed pytest projects/ores.codegen/tests -q the PR head
SQL hygiene 2,363 files, 0 problems check_sql_hygiene.py the PR head
Reapply script self-tests both pass scripts/reapply_ore_lexical_form.py --self-test and --self-test-missing-anchor the PR head

6. Notes

  • The first version of this unit made the recovery rate, the tranche points and the participation rate lexical leaves and the recovery rate an exact decimal. That was wrong. The data-oriented design page lists the recovery rate and the tranche fraction as continuous quantities, which stay binary floats, and the review criteria the data-model skill walks showed the contradiction. The unit was corrected before it was raised: those members are not leaves, the recovery rate keeps its type, and the tranche columns follow their domain type. The participation rate is treated as continuous like a weight; the page does not name it, so the operator can overrule that.
  • The design, the ER diagram, the memory and the runbook carried the same mistake and are corrected in this unit.

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
#3139 [ore,trading] Carry the credit money digits

9. Review

# Comment summary File Decision Notes
1 The first version treated the recovery rate and the tranche fraction as money credit_instrument.org, domain.cpp accept They are continuous quantities and stay binary floats. The unit was corrected.
2 The design, memory and runbook carried the same classification design.org, the memory, the runbook accept Corrected, and the runbook gains a classify-each-column step.
3 The tranche columns were numeric while the domain type was double credit_instrument.org accept The columns are double precision.
4 A double blank line before set_exact ore_boundary_decimal.hpp accept Removed.
5 The required=True branches of the member patch never run reapply_ore_lexical_form.py accept Removed; the patch handles optional members and refuses another shape.
6 The reverse patch is not idempotent reapply_ore_lexical_form.py decline The un-patch runs only in the self-test, on a patched file.
7 The binding test reads the external submodule xml_lexical_form_export_tests.cpp decline The golden, mapper and corpus tests already read it, and the ORE suite needs it.
8 The tranche column change needs a migration credit_instrument.org decline The project recreates the database; no migration is written.

10. Result

The credit money members keep the document's digits. The upfront fee and the option strike are lexical leaves in the ORE binding, patched in by the reapply script, and the strike is read and written through them. The continuous quantities, the recovery rate, the tranche points and the participation rate, stay binary floats, as the data-oriented design rule says, and the tranche columns are double precision so each agrees with its domain type.

Three golden files changed, one numeric line each. The ORE suite, the trading suite after a database recreate, the codegen tests and the SQL hygiene check pass.

Acceptance met: the money members keep their digits through the script, the continuous quantities stay floats, the tranche columns agree with their domain type, a mapper test and a binding test hold the digits, and the ORE suite passes.

Emacs 29.3 (Org mode 9.6.15)