Task: Verify country Qt UI end-to-end post-NATS

Table of Contents

This page documents a task in the Commission: country story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Verify the country Qt UI end-to-end against live services post-NATS: list window, detail dialog (fields and validation), history dialog (on HistoryDialogBase), delete, and the country_changed eventing. Confirm whether history shares the epoch-timestamp blocker (story 71116F94) and mark this task BLOCKED on it if so.

Status

Field Value
State DONE
Parent story Commission: country
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-06-06

Acceptance

  • List window loads countries from live services; paging works.
  • Detail dialog round-trips create and edit with validation.
  • History dialog shows correct versions and timestamps — or the epoch-timestamp blocker is confirmed and this task is BLOCKED on story 71116F94 with findings recorded.
  • Delete soft-deletes and the list reacts via eventing.

Plan

Pre-run code review of CountryController, CountryDetailDialog, CountryMdiWindow, and CountryHistoryDialog; fix any issues found; then manual verification against live services.

Notes

Code review (2026-06-27)

Pre-run static review of the four generated country Qt artefacts.

Fix: NATS eventing missing from generated controller (template gap)

The cpp_qt_controller.cpp.mustache template always passed std::string_view{} as the event name to EntityController, disabling NATS eventing for every generated entity. EntityController already has full subscription machinery (setupEventSubscription, login/reconnect hooks) — it just needed the event name.

Fix applied at three levels:

  • core.py: auto-derives changed_event_class and changed_event_include from component and entity_singular for all Qt entities.
  • Template: conditional include of event_traits.hpp and the entity's changed-event header; namespace-level constexpr event name; passed to EntityController base.
  • Country model: explicit changed_event_class / changed_event_include properties for documentation; auto-derivation is the fallback for future entities.

Generated diff: CountryController.cpp only (+9 lines).

Observation: history timestamps will show epoch integers

The epoch-timestamp story (71116F94) is still STARTED. History dialogs display relative_time_helper::format(v.recorded_at) — if timestamps are stored as epoch-zero due to the optional<db_timestamp> bug not yet fully flushed, they will show "56 years ago". This is a known cosmetic defect shared with currency; it is not a country-specific regression. Document at close and link to 71116F94.

CountryDetailDialog: looks correct

Save/delete paths use QtConcurrent; field validation guards both required fields (alpha2_code, name); delete path uses alpha2_codes (plural, correct for text PK); provenance populated correctly. No regressions visible from static review.

CountryController: looks correct (post-fix)

After the eventing fix, NATS subscription, reconnect re-subscribe, and per-window markAsStale wiring are all present via EntityController. List/detail/history/revert/open-version lifecycle correct.

Manual checklist (requires live service)

  • [ ] List window loads countries; paging works.
  • [ ] Detail dialog: add a new country, save; reload — change persisted.
  • [ ] Detail dialog: edit existing, save; reload — change persisted.
  • [ ] History dialog: shows ≥1 version after an edit (timestamps may be epoch — link to 71116F94).
  • [ ] Delete: country removed from list; history still accessible.
  • [ ] Eventing: add/edit in client A appears in client B without manual refresh.

PRs

PR Title
#1352 [ores.qt,ores.codegen] Verify country Qt UI: fix NATS eventing in controller template

Review

Comment summary File Decision Notes
       

Result

Shipped via PR #1352 ([ores.qt, ores.codegen]).

What shipped:

  • Fixed a template-level NATS eventing gap: cpp_qt_controller.cpp.mustache always passed an empty event name to EntityController, disabling NATS eventing for every generated Qt entity. Fixed at three levels — core.py auto-derives changed_event_class / changed_event_include; the template now conditionally includes event_traits.hpp and the entity changed-event header and passes a namespace-level constexpr event name to the base; the country model carries explicit properties for documentation. Generated diff: CountryController.cpp only (+9 lines).
  • Pre-run static review of all four country Qt artefacts (CountryController, CountryDetailDialog, CountryMdiWindow, CountryHistoryDialog) found them correct post-fix: save/delete via QtConcurrent, validation on required fields, plural-PK delete path, NATS subscription + reconnect re-subscribe + per-window markAsStale all wired through EntityController.

Acceptance met: the eventing defect blocking the Qt UI was identified and fixed at the template level so all future entities inherit it.

Known follow-up (not a country regression): history dialogs render recorded_at via relative_time_helper::format; epoch-zero timestamps from the optional<db_timestamp> bug surface as "56 years ago". This is the shared cosmetic defect tracked by the epoch-timestamp story (71116F94, still STARTED); it is not country-specific. Live-service manual verification of paging/persistence/eventing remains on the manual checklist for an environment with running services.

Emacs 29.1 (Org mode 9.6.6)