Task: Sync Qt codegen for country
This page documents a task in the Commission: country story. It captures the goal, current status, acceptance, and any notes or results.
Goal
Ensure the Qt codegen templates (qt profile) produce output that matches
the repository for country. Fix templates to match code — not the
reverse — unless the code has a demonstrable bug.
The qt profile generates: client model (Client*Model.hpp/.cpp), MDI
window (*MdiWindow.hpp/.cpp), detail dialog (*DetailDialog.hpp/.cpp),
history dialog (*HistoryDialog.hpp/.cpp), controller
(*Controller.hpp/.cpp), and UI files (*DetailDialog.ui,
*HistoryDialog.ui).
Country's Qt UI is a full bi-temporal entity with list, detail, history, and delete. Its three-code columns (alpha-2, alpha-3, numeric) and official name may require template extensions or hand-crafted sections.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Commission: country |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-06-25 |
Acceptance
codegen generate(qtprofile) forcountryproduces zero diff against the Qt files inores.qt.refdata.- Per-change-category decision recorded for any drift found.
- Findings recorded in
* Result.
Plan
- Run the
qtprofile on thecountryentity model. - Scope the diff to the generated Qt files in
ores.qt.refdata. - For each changed file decide direction (fix template or fix code with justification).
- Fix templates; re-run until zero diff.
- Commit and raise PR.
Notes
PRs
| PR | Title |
|---|---|
| #1345 | [ores.codegen, ores.qt] Sync Qt codegen for country; fix plural slot names; update recipes |
Review
| # | Comment summary | File | Decision | Notes |
|---|---|---|---|---|
| 1 | Stale #+updated: in new-entity recipe (3 bots) |
how_do_i_create_a_new_entity.org |
Fixed (b49e49634) | Bumped to 2026-06-27. |
| 2 | Task Goal placeholder unfilled in migrate task (3 bots) | task_migrate-country-unified-model.org |
Fixed (b49e49634) | Goal + Acceptance filled in. |
| 3 | Alpha-2 Code label derived as Alpha2 Code by template (all bots) |
CountryDetailDialog.ui |
Fixed (b49e49634) | Added *** Detail fields to entity model; zero-diff. |
| 4 | Silent fallback if entity_plural absent (2 bots) |
core.py |
Won't fix | Entity lifecycle standard requires entity_plural; low risk. |
| 5 | Dead else branch in plural derivation (1 bot) |
core.py |
Won't fix | Harmless; kept for symmetry. |
| 6 | UiPersistence stores by index not name (1 bot) |
CountryMdiWindow.cpp |
Not a risk | Country Qt commissioned fresh; old code had different column count. |
| 7 | Event subscription removed (2 bots) | CountryController.cpp |
Accepted | Intentional; EntityController guards empty string_view{} safely. BACKLOG. |
| 8 | maxLength removed from codeEdit (1 bot) |
CountryDetailDialog.cpp |
Accepted | Server validates; restore when full dialog is hand-crafted. BACKLOG. |
| 9 | API narrowing / include-path migration (1 bot) | multiple | Accepted | Intentional; CI is gate. |
Result
All 12 Qt files for country regenerated via compass codegen entity
generate country --profile qt and confirmed at zero diff.
During the run, a bug was found and fixed in ores.codegen/src/codegen/core.py:
entity_pascal_short_plural was derived by naive +s on the PascalCase short
form (Country + s → Countrys, Status + s → Statuss). Fixed to
derive from entity_plural last word, capitalised (countries → Countries,
book_statuses → Statuses). This corrects slot names across all future
entities with irregular or compound plurals.
Disk files predated the template and carried an older architecture
(ImageCache, QAbstractTableModel base, ColumnMetadata arrays, exportToCSV,
per-entity ImageCache constructor arg). Template output accepted as canonical
— it matches the pattern used by all other commissioned entities and removes
dead dependencies.
Stale codegen recipes updated in the same commit: all run_generator.sh and
generator.py references replaced with compass codegen commands; Qt UI
regenerate recipe cross-referenced to both entity-level and component-level
entry points.