Task: Seed the configuration lookups

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

A discriminator is data, so adding a kind is a seeded row and never a column or a struct. The ORE element name each kind serialises to lives here, which is what lets the mappers stay thin.

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-09-27

3. Acceptance

  • Each lookup is a seeded table with a stable code and a name, loaded by the seeder and covered by a test.
  • The vocabularies are derived from the schemas, and the derivation command is recorded with its output.
  • No lookup value appears as a literal in mapper code.

4. Plan

Measured on 2026-10-02 before any change:

Lookup State Needs
configuration_types table exists, 0 rows the seventeen ORE configuration kinds; this blocks every report from pointing at a configuration
today's market collection kinds no table; collection is free text a lookup of the 24 kinds with their key attributes, and a foreign key from both collection columns
stress shift families and shift types no table; family and shift_type are free text a lookup and a foreign key
analytic_types, parameter_value_domains, pricing_engine_types seeded: 38, 6, 58 nothing
risk classes nothing refers to them wait for SIMM calibration
report types 2 sample rows its own task, Bind the report types and their taxonomy

This task seeds the configuration types. The today's market collection kinds and the stress shift kinds are tasks of their own, because a pull request can only merge once its task is closed.

Configuration types. The kinds come from ORE's own schemas: every global element of a configuration schema in external/ore/xsd, excluding the run document (ORE, which a report owns directly through report_definition_id, not through a configuration), trades and portfolios, instrument and shared-type fragments, collateral balances (data, not configuration) and the script library. Each kind records the root element it serialises to, the component that owns its entities, and the run-document parameter that names its file. A test ties the seed to the binding: for every kind the binding can save, an empty document must start with the seeded root element.

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
Configuration types seeded 17 recreate output, =Configuration Types \ 17= 14ec81e5b8
Kinds the binding can save, checked against the seeded root 12 of 17; 5 listed as unbound ores.ore.core.tests "[configuration_types]" 14ec81e5b8
Seed test against a prefix-broken root fails, then passes on restore update one row, run, restore 14ec81e5b8
Migration on a database created before the change 17 rows, required columns not null, second run harmless rolled-back transaction 14ec81e5b8

6. Notes

The today's market collection kinds and the stress shift kinds moved to their own tasks when the plan split, so that each can close with its own pull request: Seed the today's market collection kinds and Seed the stress shift families and shift types.

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
#2520 [reporting] Seed the configuration types with their ORE mapping

9. Review

# Comment summary File Decision Notes
1 Review: a seeded code that already exists with empty mapping columns would make the migration fail seed, migration Accepted The seed fills the empty mapping columns of every version of a seeded code, current or closed, in place. Tested: 16 closed versions and 1 current row without a mapping all filled, not null set. Rows under test tenants with generated codes still stop the migration, by design; the comment says to recreate such a database.
2 Review: could the triggers rewrite the new columns seed No change The migration test showed every value stored as seeded.
3 Review: the root check found the name anywhere, not the first element seed test Accepted It now skips the declaration and comments and checks the first element.
4 Review: run_parameter is not checked seed test Accepted Each non-null run_parameter must appear in a shipped run document. Seeding simmCalibrationFile for simmCalibration makes the test fail.
5 Review: how to pass null to the shell's optional run_parameter shell No change The generated recipe uses -, as for every optional on the generated commands.
6 Review: a new seeded kind forces a test update seed test No change Intended.

10. Result

The configuration types are seeded, so a reporting configuration can now be registered, and through it a report can point at its configuration.

What a configuration type holds. Its code, name and order, and now the root element of the ORE document it serialises to, the component that owns its entities, and the run-document parameter that names its file. The mapping from a kind to its document is data, not code.

The seventeen kinds are the global elements of ORE's configuration schemas, derived as recorded in the derivation. The run document is not one: a report owns its run setup directly through report_definition_id. Historical return and Basel traffic light have no run-document parameter, because no shipped run document names one.

How it is proven. For each of the twelve kinds the binding can save, an empty document must open with exactly the seeded root element; breaking one row to a prefix of the real name makes the test fail. The five kinds without a binding are listed, so one that gains a binding without joining the check fails. A migration adds the columns and the rows to a database created before the change.

Moved out. The today's market collection kinds and the stress shift kinds became tasks of their own, so that each can close with its own pull request. The other lookups the task named were already seeded (analytic types, value domains, pricing engine types) or wait for work that does not exist yet (risk classes, for SIMM calibration).

Component audit. The task touched ores.reporting through one model, and added a seed, a migration and a test. validate_docs.sh passes for all 41 components, and no folder, type or component changed.

Emacs 29.3 (Org mode 9.6.15)