Story: Commission: currency
Table of Contents
This page documents a story in Sprint 22. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Commission currency and its three ores.refdata auxiliary types — rounding_type,
monetary_nature, and currency_market_tier — across all access layers: verify SQL DDL,
verify the Qt UI end-to-end post-NATS migration, verify existing shell and CLI commands,
fix any regressions found, and add documentation (manual chapter, recipes, NATS reference).
File backlog captures for Wt and HTTP support. Auxiliary types are commissioned using the
same per-layer approach as the primary entity; they may have fewer moving parts but the
same checklist applies.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 22 |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | None. |
| Last touched | 2026-07-10 |
Acceptance
The following acceptance criteria apply to currency and, where the layer exists, to each
auxiliary type (rounding_type, monetary_nature, currency_market_tier).
SQL
- currency DDL verified against all DB-layer checklist criteria.
- rounding_type, monetary_nature, currency_market_tier DDL verified against same checklist.
- Any missing columns, indexes, or constraints fixed or filed as captures.
Qt
- Currency MDI list window loads and displays records correctly.
- Currency detail window: edit and save round-trips without error (dropdowns for rounding_type, monetary_nature, currency_market_tier populated correctly).
- Currency history window: shows change history for the entity.
- Currency delete command: removes the record; history is preserved.
- Currency eventing: a change made in one connected session appears in a second session without manual refresh.
- rounding_type, monetary_nature, currency_market_tier Qt windows (if they exist): loads, detail, history, delete verified.
Shell
- currency: list, add, remove, history commands verified working post-NATS.
- rounding_type, monetary_nature, currency_market_tier: shell commands verified or implemented.
CLI
- currency: list, add, remove commands verified working post-NATS.
- rounding_type, monetary_nature, currency_market_tier: CLI commands verified or implemented.
Documentation
- Manual chapter for currency documents Qt windows, shell, and CLI commands.
- CLI recipes for currency and auxiliaries created or updated.
- Shell recipes for currency and auxiliaries created.
- NATS message reference documents subjects and types for currency and auxiliaries.
- Backlog captures filed for Wt and HTTP support (currency and auxiliaries).
- All regressions found are fixed inline or filed as captures.
- Site builds cleanly.
Decisions
- Messaging codegen:
currency_history_protocol.hppand itshistory()handler stay hand-maintained, not generated by theprotocol=/ =nats-handlerprofiles. Currency's history payload carries per-version diffs (currency_version_history) rather than the plainstd::vector<currency>the template produces for a history request/response pair — templating it would redefine the same struct names with an incompatible shape. - Version-navigation UI (first/prev/next/last/revert) generalised as
an opt-in
has_version_navigationdetail_dialogtemplate capability, currency as first consumer — same minimal-footprint approach as the setting-gated-actions capability: land the mechanism in the template, verify by regenerate+diff against the hand-written file, but leave currency's own file untouched until the final mechanical sync task reconciles all capabilities at once. - NATS notification-wiring: the base
EntityControlleralready handled subscription + list-window staleness generically (currency just never used it, having hand-rolled a parallel mechanism). Added a protected virtualnotifyOpenDialogs()hook to the base instead of regenerating the duplication, plus a symmetricDetailDialogBase::code()accessor (mirroringHistoryDialogBase::code()) so the generated override can identify open dialogs without knowing their concrete type. Verified by a real regenerate + rebuild (not just diff), which caught and fixed a live bug in the previous version-nav PR (wrong mustache path, silently empty, broke compilation). - Flag/combo reconciliation: unlike the 5 prior capability tasks,
this one really did migrate currency's checked-in files (not just
land-template-then-discard) — flag handling now calls
DetailDialogBase's existing generic mechanism, dropping ~180 lines of duplicated hand-rolled code. The combo-field codegen emit (combo_domain_type, callingpopulateDynamicCombo<Entity>) is new; only currency's 3 combo fields are modelled in its "Detail fields" org table, the other 11 stay unmodelled until the final sync task. The pilot's flagged fetch-failure gap was fixed for real (std::expected+on_errorcallback), not deferred. - Final Qt codegen sync: 10 of 12 output files now regenerate cleanly
and are the source of truth. Two stay permanently hand-written with
documented reasons —
CurrencyHistoryDialog(currency's diff-annotated history response has no template-compatible shape, a pre-existing decision) andClientCurrencyModel(its synthetic- currency-highlighting feature has noAbstractClientModelequivalent; follow-up task filed rather than a risky rushed merge). Three currency-specific features with no template mechanism (cross-domain navigation to the 3 auxiliary list windows, detail-dialog and MDI-window synthetic-data generation) were restored by hand on top of the generated files. Fixed two model-data bugs found along the way (wrong delete-request field name; missing flag-icon model properties) and added one new small template capability (history_protocol_include). Verified via full whole-app rebuild at every iteration, not diff-only.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Appraise currency across all layers and produce evaluation checklist | DONE | 2026-05-29 | 2026-05-29 | Assess each layer; produce reusable entity evaluation checklist. |
| Verify currency SQL against evaluation checklist | DONE | 2026-05-29 | 2026-05-29 | Inspect DDL against DB-layer checklist criteria; fix any gaps. |
| Verify and fix codegen for currency and auxiliaries | DONE | 2026-05-29 | 2026-05-30 | SQL zero-diff; component path fix in three auxiliaries; currency_domain_entity.json confirmed unnecessary; C++ drift filed. |
| Verify and fix currency CLI commands | DONE | 2026-05-29 | 2026-05-29 | Confirm list/add/remove exist; implement missing; run against live service. |
| Verify currency shell commands and NATS integration | DONE | 2026-05-29 | 2026-05-31 | Run list/add/remove/history in shell; validates NATS end-to-end. |
| Verify currency Qt UI end-to-end post-NATS | DONE | 2026-06-12 | Manually test MDI list, detail, history, delete, eventing. Blocked on timestamp unification story. | |
| Fix duplicate refdata rows: add tenant filters to auxiliary repositories | DONE | 2026-06-04 | 2026-06-05 | Rounding/monetary-nature/market-tier repos read unfiltered; apply change_reason tenant-filter pattern. |
| Write currency documentation (manual chapter, recipes, NATS reference) | DONE | 2026-06-06 | 2026-06-06 | Manual chapter, CLI recipe, shell recipe, NATS message reference. |
| Sync SQL codegen for currency and auxiliaries | DONE | 2026-06-26 | 2026-06-26 | Re-run SQL codegen for rounding_type, monetary_nature, currency_market_tier; diff against repo; fix templates to match code. |
| Sync C++ core codegen for currency auxiliaries | DONE | 2026-06-26 | Re-run domain, repository, service, and generator profiles for rounding_type, monetary_nature, currency_market_tier; diff against repo; fix templates to match code. | |
| Sync C++ messaging codegen for currency auxiliaries | DONE | 2026-06-25 | 2026-06-26 | Re-run protocol, nats-eventing, and nats-handler profiles for rounding_type, monetary_nature, currency_market_tier; diff against repo; fix templates to match code. |
| Sync Qt codegen for currency auxiliaries | DONE | 2026-06-25 | 2026-06-26 | Re-run Qt profile for rounding_type, monetary_nature, currency_market_tier; diff against repo; fix templates to match code. |
| Define and implement entity view document type | DONE | 2026-06-12 | Create entity view docs listing all artefacts per entity across every projection and component, with proj: links to artefacts and codegen archetypes; implement currency as the first example. | |
| Sync C++ core codegen for currency | DONE | 2026-07-02 | 2026-07-03 | Re-run domain, repository, service, and generator profiles for currency; diff against repo; fix templates or code per drift classification. |
| Sync C++ messaging codegen for currency | DONE | 2026-07-04 | 2026-07-04 | Re-run protocol, nats-eventing, and nats-handler profiles for currency; diff against repo; fix templates or code per drift classification. |
| Sync Qt codegen for currency | DONE | 2026-07-03 | 2026-07-08 | Final mechanical regenerate: re-run the qt profile for currency; diff the 12 output files against the repo; reconcile. Blocked on the 6 prerequisite tasks below (relocate generator logic; land CSV/XML export, setting-gated visibility, version-nav UI, and NATS notification-wiring template capabilities; reconcile flag image/combos). |
| File Wt and HTTP gap captures for currency | ABANDONED | 2026-07-10 | Superseded by the top-level Wt/HTTP commissioning-story captures. | |
| Migrate currency model from ores.codegen.table to ores.codegen.entity | DONE | 2026-06-26 | 2026-06-26 | Convert currency_table.org from the SQL-only ores.codegen.table type to the unified ores.codegen.entity type so that all currency code (C++, SQL, Qt, NATS) can be generated from a single model. |
| Relocate random-pick generator logic out of currency Qt UI | DONE | 2026-07-05 | 2026-07-06 | CurrencyDetailDialog::onGenerateClicked() and CurrencyMdiWindow::generateSynthetic() do inline std::uniform_int_distribution random-pick selection over generated currencies; this belongs in the generator/service layer, not the Qt UI. Relocate it before the Qt sync task touches these files, so regeneration wires to the relocated call rather than re-embedding the logic. |
| Land CSV/XML import-export as a qt-profile template capability | DONE | 2026-07-06 | 2026-07-06 | Currency's CurrencyMdiWindow has hand-rolled CSV export and XML import/export with no template equivalent. Generalise it into an opt-in qt-profile mdi_window template capability, with currency as the first real consumer, so the Qt sync task doesn't silently drop it on regeneration. |
| Land setting-gated action-visibility knob as a qt-profile template capability | DONE | 2026-07-06 | 2026-07-06 | Currency's feature-flagged 'generate synthetic test data' button (gated by system.synthetic_data_generation) has no template equivalent. Generalise it as a conditional action-visibility knob in the mdi_window and detail_dialog templates, with currency as the first real consumer. |
| Land version-navigation UI as a qt-profile detail_dialog template capability | DONE | 2026-07-06 | 2026-07-07 | Currency's CurrencyDetailDialog has a full version-navigation UI (first/prev/next/last/revert) 100% absent from the template and the synced peer. Generalise it as a detail_dialog template capability, with currency as the first real consumer. |
| Land NATS notification-wiring capability in the qt-profile controller template | DONE | 2026-07-08 | 2026-07-08 | Currency's CurrencyController has hand-added onNotificationReceived staleness-propagation logic; the template's changed_event_class flag wires the subscription but generates no handler. Land the handler-generation half of this capability, with currency as the first real consumer (no peer currently configures changed_event_class). |
| Reconcile currency's flag image handling and wire the piloted combo-field mechanism | DONE | 2026-07-08 | 2026-07-08 | Migrate currency's hand-rolled flag image handling onto the template's existing has_flag_icon mechanism (no new template work, just a call-site migration). Wire currency's 3 soft-FK combo fields (rounding_type, monetary_nature, market_tier) to the already-piloted populateDynamicCombo<Entity> helper via the small per-field codegen emit. Decide and land the fetch-failure-signalling gap flagged during the combo-field pilot before finalizing the emit. |
| Render currency's monetary_nature and market_tier combos as badges | DONE | Currency's monetary_nature and market_tier detail-dialog fields are soft-FK dynamic combos populated via populateDynamicCombo<Entity>; render them as colored badges like Book's book_status field does (setup_badge_combo/BadgeCache), instead of plain text combo items. | ||
| Migrate currency's synthetic-currency tracking onto the generic client model | ABANDONED | Superseded by Rethink synthetic reference-data generation across entities — the feature was never actually save-able, so it's being removed and redesigned rather than migrated as-is. | ||
| Show market_tier and monetary_nature as badge columns on the currency list by default | DONE | The currency list window doesn't currently surface market_tier or monetary_nature columns as badges; once task AEEDE877 lands dynamic-combo badge rendering for the detail dialog, apply the same badge rendering to these two columns in ClientCurrencyModel/CurrencyMdiWindow's list view, and ensure both columns are visible by default (not hidden behind a column-visibility toggle), matching how Book's book_status column renders as a badge in its list view. |