Task: Seed the today's market collection kinds
Table of Contents
This page documents a task in the Model the ORE report configuration as entities story. It captures the goal, current status, acceptance, and any notes or results.
1. Goal
The database refuses a today's market collection kind ORE does not have, and each kind's key attributes live in one row rather than on every entry.
2. Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Model the ORE report configuration as entities |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-10-02 |
3. Acceptance
- A seeded lookup holds the twenty-four collection kinds, each with its ORE
element name and its key attribute or attributes, derived from
todaysmarket.xsdwith the command recorded. todays_market_collection.collectionandtodays_market_configuration_binding.collectionrefer to it, and an unknown kind is refused on insert.todays_market_entry.key_attributeis gone, and the today's market corpus and database round trips still pass.
4. Plan
- The kinds are the children of the
todaysmarkettype inexternal/ore/xsd/todaysmarket.xsd, apart fromConfiguration: twenty-four. Each kind's entry element and key attributes come from the same file; two kinds,SwaptionVolatilitiesandCapFloorVolatilities, identify an entry bykeyandcurrency. todays_market_collection_kindis an analytics lookup seeded for the system tenant and readable by every tenant, aspricing_engine_typeis. Bothcollectioncolumns resolve against it under the system tenant.key_attributeonly ever repeated the kind's attribute, and the export never read it, so it leaves the entry table and the mapper.- The mapper keeps one branch per kind, because the binding gives each kind its own member. A test checks the mapper's twenty-four names against the schema, and the seed test checks the lookup against the same schema, so the two cannot drift apart.
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 |
|---|---|---|---|
| Collection kinds in the schema | 24 | children of todaysmarket in todaysmarket.xsd, apart from Configuration |
4b5499c45d |
| Kinds keyed by two attributes | 2 (SwaptionVolatilities, CapFloorVolatilities: key and currency) |
attributes of each kind's entry element, apart from id |
4b5499c45d |
Places key_attribute was read on export |
0 | grep -n key_attribute projects/ores.ore/core/src/domain/todays_market_mapper.cpp (writes only) |
4b5499c45d |
6. Notes
Moved from Seed the configuration lookups. Decided in the PR #2500
review. A today's market document has twenty-four collection kinds
(YieldCurves, DiscountingCurves and the rest). Today
todays_market_collection.collection and
todays_market_configuration_binding.collection hold the kind as free text,
and every todays_market_entry row repeats the kind's key attribute in
key_attribute. A seeded kind lookup would hold the kind code, its ORE element
name and its key attribute, or attributes for the two kinds keyed twice. Both
collection columns would then refer to it, and the database would refuse an
unknown kind. key_attribute could then leave the entry table.
One limit for this document: the binding gives each kind its own typed member, so the mapper keeps one branch per kind whatever the lookup holds. The acceptance line "no lookup value appears as a literal in mapper code" cannot be met for today's market. The mapper can check its branches against the lookup instead.
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 |
|---|---|
| #2542 | [analytics] Seed the today's market collection kinds |
9. Review
| # | Comment summary | File | Decision | Notes |
|---|---|---|---|---|
| 1 | Run the migration once on a database holding rows from before the change | analytics_todays_market_collection_kinds_migration.sql | Done | Ran on a database with the old shape and test rows: 26 collections, 46 bindings and 339 entries before and after, key_attribute dropped, 24 kinds seeded, exit 0. |
| 2 | The seed test parses the schema with regexes | repository_collection_kind_seed_tests.cpp | No change | The INFO message names the layout it assumes; reading the facts from the schema is what keeps the seed tied to it. |
| 3 | Confirm a tenant cannot update or delete the system rows | analytics_rls_policies_create.sql | No change | The policy is the one pricing_engine_types uses: a tenant reads system rows, and the with check clause refuses any write whose row is not the tenant's own. |
| 4 | Unrelated generated shell scripts in the diff | projects/ores.shell/scripts/library | No change | The tangle regenerates every script, and the shell script drift gate fails a PR whose scripts lag the recipes merged in PR 2539. |
| 5 | Generated code not checked against templates | generated files | No change | check_component_drift.py --all covers it and was clean apart from the known local formatting item. |
10. Result
- New analytics lookup
todays_market_collection_kind, 24 rows seeded for the system tenant fromtodaysmarket.xsd, each with its entry element and key attribute or attributes; readable by every tenant. todays_market_collection.collectionandtodays_market_configuration_binding.collectionresolve against it under the system tenant; an unknown kind is refused on insert.todays_market_entry.key_attributeis gone from the table, the model and the mapper.- Tests: the seed pinned to the schema; the mapper's twenty-four collection names checked against the same schema; a refusal case for an unknown kind. The corpus walk and the database round trip still pass.
- Migration
analytics_todays_market_collection_kinds_migration.sqlfor existing databases. - Build clean; ctest 89/89 after a database recreate.