Task: Write the equity basket as rows

Table of Contents

This page documents a task in the Rework the equity instruments to the instrument table rule story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

The basket is rows of a child table keyed by the trade, and no list is stored as an encoded string.

2. Status

Field Value
State DONE
Parent story Rework the equity instruments to the instrument table rule
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-10-17

3. Acceptance

4. Plan

(Implementation strategy. Written when work starts; key decisions are distilled into the parent story's * Decisions at close, but the plan itself stays — it is the historical record of what we did.)

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
#3472 [agile] Collapse the basket result heading
#3471 [trading] Write the equity basket as rows of a child table

9. Review

Comment summary File Decision Notes
       

10. Result

The worst-of basket now has a child table. equity_basket_constituents is keyed by trade_id and sequence_number, so a list is rows and the order the document stated is the order a read returns. One model declaration generates the domain type, JSON I/O, the table, the entity, the repository, the service, the messaging, the eventing, the shell commands, the SQL create, drop and notify-trigger files, and the RLS policy.

Two checks hold the rows honest. The ordinal is positive, and the underlying name is never empty.

basket_json stays on the swap model. The ORE import still writes the basket there, and moving it onto these rows is the mapper work the operator deferred to the xsdcpp removal. Retiring the column first would drop the basket silently.

The unit also fixed a defect this session shipped: the generator expression for variance_strike was hand-edited in the generated file, and codegen reverted it, breaking the build. It is declared in the model now, which is where codegen reads it.

Verification. Full build clean. The whole suite passes, 96 of 96, with the database recreated for the new table. The workflow flake that failed twice under parallel load did not recur.

Emacs 29.3 (Org mode 9.6.15)