Story: Decommission ores.codegen.table model type
Table of Contents
This page documents a story in Sprint 21. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Eliminate the ores.codegen.table model type entirely. Every refdata table that currently uses a _table.org model must be converted to ores.codegen.entity so that all code generation (SQL, C++, Qt) flows from a single unified model. Once all table models are migrated, remove the table model type from the facet catalogue, the component catalogue, and the generator.
Status
| Field | Value |
|---|---|
| State | BACKLOG |
| Parent sprint | Sprint 21 |
| Now | Not yet started. |
| Waiting on | Nothing. |
| Next | Pick up detect-model-type-by-frontmatter task. |
| Last touched | 2026-06-26 |
Acceptance
- All _table.org files converted to ores.codegen.entity format. Zero ores.codegen.table entries remain in the codegen model corpus. The table profile is removed from the facet catalogue. Codegen regenerate runs cleanly with zero diff on the migrated entities. The schema reference doc is updated to mark table as removed.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Detect model type from #+type: frontmatter, not filename suffix | BACKLOG | Change get_model_type() in generator.py to read #+type: rather than matching filename suffixes. Keep the suffix fallback temporarily so existing files still resolve. | ||
| Unify the SQL template to support validation function and insert trigger from entity models | BACKLOG | Extend sql_schema_domain_entity_create.mustache so the domain_entity data shape carries a full validation-function body and insert-trigger validations — sourced from new model sections, not just the paste-marker stub. Retires the template-level distinction between table and entity SQL output. | ||
| Merge the org parsers: teach load_org_model() to parse Validation function and Insert trigger sections | BACKLOG | Teach load_org_model() to parse the * Validation function and * Insert trigger sections that today are handled exclusively by load_org_table_model(). Populate has_tenant_id, coding_scheme, and image_id from the entity file. Once load_org_model() covers the full table data shape, delete load_org_table_model(). | ||
| Add variability guards: introduce #+sql_only and #+has_qt flags to the entity schema | BACKLOG | Introduce #+sql_only: true and #+has_qt: false frontmatter flags. Make C++ field derivation in load_org_model() conditional on sql_only being absent or false. Make Qt field derivation conditional on has_qt. This lets SQL-only entities (purpose_type) and C++-without-Qt entities be expressed in a single entity file without triggering C++ or Qt profile dispatch. | ||
| Migrate content: move _table.org sections into entity files and delete table files | BACKLOG | For each of the 9 dual-file entities (book_status, contact_type, country, currency_market_tier, monetary_nature, party_id_scheme, party_status, party_type, rounding_type), move the * Validation function and * Insert trigger sections from the _table.org file into the entity file. Verify generated SQL is byte-identical to the table-pathway output. Delete the _table.org file. For purpose_type (the sole table-only entity), create a sql_only entity file and delete purpose_type_table.org. For currency, delete currency_table.org directly once commission-currency sync tasks complete — the entity model already exists. Validate each migrated entity with the domain entity evaluation checklist. | ||
| Collapse components: merge refdata and refdata-cpp into a single component | BACKLOG | Merge the refdata and refdata-cpp entries in the component catalogue into one component with a single discovery glob over ores.refdata.*.org (excluding junctions and the module index). Remove the dead models_dir entries from both component catalogue entries. Update compass codegen regenerate invocations that reference –component refdata or –component refdata-cpp. | ||
| Retire the table model type: remove the table branch from the generator and profile matrix | BACKLOG | Once no _table.org files remain, remove the table branch from get_model_type(), load_model(), and the profile matrix in the facet catalogue. Junction files remain a distinct type and are out of scope. Update the codegen input org-file schema reference to mark ores.codegen.table as removed. |
Decisions
Out of scope
- Junction table models (
party_currency_junction,party_country_junction,party_counterparty_junction) — junction is a distinct model type and is not affected by this story.