Task: Keep stated but default-valued elements in the bond export

Table of Contents

This page documents a task in the Redesign ores.trading on data-oriented principles story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

A bond future export writes back every element the source stated, including one whose value equals its type's default.

2. Status

Field Value
State ABANDONED
Parent story Redesign ores.trading on data-oriented principles
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-09-23

3. Acceptance

  • The bond_future container carries a presence flag for every member the schema states as optional, and the reverse mapper emits on presence rather than on a non-default value.
  • A bond future that states SettlementDirty, FairPrice or ExpiryLag with the type's default value writes all three back.
  • The corpus cannot measure this: no document in external/ore/examples is a BondFuture trade. The check is a crafted probe, and ores.ore.core.tests covers it.

4. Plan

The fix is in the model, not the mapper. bond_future is generated from projects/ores.trading/modeling/ores.trading.bond_future.org, so the presence flags land there and are regenerated, following the presence pass the schedule container already took. Touches the modeling org, the generated container, the reverse mapper, and the SQL if a new column is needed for a presence flag that storage cannot otherwise infer.

5. Notes

Found while reviewing the bond round-trip branch, with a crafted probe. The source stated:

<BondFutureData>
  <ContractName>OE</ContractName>
  <ContractNotional>100000</ContractNotional>
  <LongShort>Long</LongShort>
  <Currency>EUR</Currency>
  <ContractMonth>2026-06</ContractMonth>
  <FairPrice>0</FairPrice>
  <SettlementDirty>N</SettlementDirty>
  <ExpiryLag>0</ExpiryLag>
</BondFutureData>

and the export kept only the first five elements.

reverse_bond_future guards each of the three with a value test (if (f.expiry_lag ! 0)=, if (f.settlement_dirty), if (f.fair_price ! 0.0)=), so a stated default is indistinguishable from an absent element. external/ore/xsd/instruments.xsd:422 declares SettlementDirty as xs:string with minOccurs"0"=, so the stated value is schema-valid and the loss is ours.

The corpus reads zero on this, because no example document is a BondFuture trade. The bond gate cannot regress on a class the corpus never states.

6. Test Scenarios

Manual QA scenarios (scaffolded via compass add test_scenario, run through the QA Validation Runner panel) 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
     

7. PRs

PR Title
   

8. Review

Comment summary File Decision Notes
       

9. Result

Abandoned at sprint 25 close. Sprint 26 replaces the codegen approaches tried so far with one method: for each module, sync codegen and clear its drift. Sprint 26 opens new, clean stories for each module. This story is not carried forward.

Emacs 29.3 (Org mode 9.6.15)