Story: Composite child-entity and hierarchy Qt widgets for codegen

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

Discovered while verifying counterparty's Qt UI (Commission: counterparty): party and counterparty share a hand-maintained EntityDetailDialog=/=EntityDetailOperations abstraction (~2,300 lines) implementing capabilities the current Qt codegen profile has no facet for at all — embedded, editable identifier and contact child tables, and a self-referencing parent-hierarchy tree view. Naively running --address ores.cpp.qt on these entities would regress functionality, not migrate it. This story adds the missing capabilities to codegen properly, so party and counterparty (and future org-hierarchy entities) can eventually retire the hand-maintained abstraction.

Sequenced in three tasks:

  1. Design the child-entity Qt facet: counterparty_identifier, counterparty_contact_information, party_identifier, and party_contact_information are already full codegen entities with no * Qt facet of their own (they're not independently navigable). Determine whether an embeddable child-table widget, fetched via the foreign_keys=/=list_by paged backend query already added this sprint, is generatable as a facet — or whether it needs its own handcrafted base widget with a thin generated binding, mirroring the hierarchy approach below.
  2. Build two 100%-handcrafted, reusable classes: a generic HierarchyTreeWidget (self-referencing id/parent-id/label tree, no entity knowledge), and a hierarchy-model-builder that, given a party or counterparty entity list, produces a tree model ready to hand to the widget. Add minimal paste-block seams to the Qt detail-dialog codegen templates so a generated dialog can construct the model builder and plug it into the widget with as little pasted code as possible.
  3. Once 1 and 2 are proven, design and execute binding both against party and counterparty specifically, verify feature parity against the current hand-maintained dialog, and retire EntityDetailDialog=/=EntityDetailOperations once confirmed.

Status

Field Value
State DONE
Parent sprint Sprint 22
Now Nothing.
Waiting on Nothing.
Next None — the remaining bind-to-party/counterparty task is now a prerequisite tracked under Commission party, counterparty, and party_status together.
Last touched 2026-07-10

Acceptance

  • Written design decision on whether identifier/contact child entities need a new codegen Qt facet, or a handcrafted base widget + generated binding, for embeddable child tables.
  • HierarchyTreeWidget and its hierarchy-model-builder exist, 100% handcrafted, entity-agnostic, unit-testable independent of party=/=counterparty.
  • Qt detail-dialog codegen templates (header/impl/ui) have paste-block extension points, following the existing repository/service :implements <UUID> convention.
  • party and counterparty regenerate through the new facets with verified feature parity (identifiers, contacts, hierarchy) against the current hand-maintained dialog before the old code is removed.

Tasks

Task State Start End Description
Design child-entity Qt facet for embeddable tables DONE 2026-07-04 2026-07-04 Determine whether counterparty_identifier/counterparty_contact_information/party_identifier/party_contact_information need a new codegen Qt facet for embeddable child tables, or a handcrafted base widget with a thin generated binding, fetched via the existing foreign_keys/list_by paged backend query.
Build standalone HierarchyTreeWidget and hierarchy-model-builder DONE 2026-07-04 2026-07-04 Build two 100%-handcrafted, reusable Qt classes: a generic self-referencing HierarchyTreeWidget, and a hierarchy-model-builder producing a ready-to-plug-in tree model given a party or counterparty. Add minimal paste-block seams to the Qt detail-dialog codegen templates to bind them.
Bind composite child-entity and hierarchy widgets to party and counterparty ABANDONED   2026-07-10 Moved — now a prerequisite tracked under Commission party, counterparty, and party_status together.
Generalize self-referential hierarchy into a codegen facet (SQL, CTE, NATS) DONE 2026-07-04 2026-07-05 Scope narrowed during implementation: has_parent_id is a SQL-only Flag generating just the hierarchy_fn query function; the NATS message/handler is hand-written for party and counterparty (not codegen-generated); book and codegen-generating the NATS layer filed as follow-up captures.

Decisions

Child-entity tables (identifiers, contacts) will use a handcrafted, reusable widget (EmbeddedChildTableWidget, parameterized by column defs + fetch/save/remove callbacks) plus a thin generated binding — not a new codegen Qt facet — mirroring the hierarchy-widget decision. Only two distinct column shapes exist across all 4 child entities (identifier shape, contact shape), and the backend paged fetch-by-parent-id query is already fully generated. See task 1's * Notes for the full evidence trail.

Out of scope

Emacs 29.3 (Org mode 9.6.15)