Codegen-generate the get_hierarchy NATS message once proven

Table of Contents

This page is a capture in the discarded bucket of the product backlog.

Resolved (deep backlog refinement, 2026-07-11): The capture file itself contains a '* Resolved' section stating the has_parent_id-gated blocks were added to protocol/repository/service/nats-handler/nats-sub-registrar codegen templates and counterparty was regenerated and verified zero-diff. Confirmed the nats-sub-registrar facet templates exist under projects/ores.codegen/library/templates/.

Resolved

Done, sooner than planned (didn't wait for task 3's Qt binding to prove the pattern first — build/unit verification was judged sufficient given the pattern already had a full live NATS round-trip for party). has_parent_id-gated blocks added to the protocol, repository, service, nats-handler, and nats-sub-registrar codegen templates; counterparty regenerated for real across all five addresses, each verified zero-diff (or diff-only-in-clang-format-reflow) against the hand-written version first. party intentionally left hand-written — its repository/entity/mapper layer has the same pre-existing, unrelated drift already found in its SQL/protocol layers.

What

Extend the C++ protocol/repository/service/handler codegen templates to generate the get_<entity>_hierarchy_request/response message, repository query, service method, and handler/registrar subscription per has_parent_id entity, superseding the hand-written implementations added for party and counterparty.

Why

The pattern was deliberately hand-written first (repository → service → protocol → handler → registrar for party, mirrored to counterparty) to prove it end-to-end before investing in template work, following the same approach already used for the Qt hierarchy widgets in this same story. Once task 3 (binding the Qt widgets to party/counterparty) has exercised the pattern in the UI and it's holding up, generalizing it into codegen removes the now-duplicated hand-written code and gets it for free for any future has_parent_id entity (e.g. book, see the companion capture).

References

  • projects/ores.refdata/core/include/ores.refdata.core/messaging/party_handler.hpp — hand-written reference implementation (hierarchy() method).
  • projects/ores.refdata/api/include/ores.refdata.api/messaging/party_protocol.hppget_party_hierarchy_request/response.
  • projects/ores.codegen/modeling/org_entity_meta_model.orghas_parent_id Flag documentation (SQL layer only, so far).

See also

  • Companion capture: Add net-new self-referencing hierarchy support to book — a second consumer that would benefit once this is generated.

See also

Emacs 29.3 (Org mode 9.6.15)