Task: Introduce nats-sub-registrar codegen templates
This page documents a task in the Introduce per-entity NATS sub-registrars story. It captures the goal, current status, acceptance, and any notes or results.
Goal
Add a nats-sub-registrar codegen profile that produces a
<entity>_registrar.hpp/cpp pair for each refdata entity. The hpp
declares register_<entity>_handlers(); the cpp includes only that
entity's handler header and wires its NATS subjects to the handler
instance. The top-level registrar.cpp will delegate to these in the
next task.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Introduce per-entity NATS sub-registrars |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-06-27 |
Acceptance
nats-sub-registrarentry exists infacet_catalogue.orgwith two template/output rows (hpp and cpp).cpp_nats_registrar.hpp.mustacheandcpp_nats_registrar.cpp.mustacheexist inlibrary/templates/and match the org literate sources.cpp_nats_registrar_hpp.organdcpp_nats_registrar_cpp.orgexist with tangle blocks referencing the mustache files.cpp_messaging.orgarchetypes table updated to include the two new archetypes.- Template flags
no_history(skip history subject) andlist_only(skip save/remove/history) documented in the org sources.
Plan
- Add
nats-sub-registrartolibrary/facet_catalogue.org: two rows (hpp under include/, cpp under src/messaging/). - Write
cpp_nats_registrar.hpp.mustache— include guard + free function declaration; bothdomain_entityandentitysections. - Write
cpp_nats_registrar.cpp.mustache— includes + implementation;list_onlyflag controls save/remove/history;no_historyflag skips history subscription; both model-type sections. - Write
cpp_nats_registrar_hpp.organdcpp_nats_registrar_cpp.orgas org literate sources with tangle blocks. - Update
cpp_messaging.orgsummary and archetypes table.
Notes
- Approach changed at re-apply time. The original plan targeted the
monolithic
facet_catalogue.org+ standalonecpp_nats_registrar_*.orgliterate sources. Between first attempt and re-apply, codegen migrated to the physical-space graph: facets/archetypes are nowores.*.orgdocs underlibrary/templates/(#+type: facet|archetype,#+facet:,#+output:), discovered byphysical_space.py. The templates were re-modelled accordingly (see Result).
PRs
| PR | Title |
|---|---|
| #1397 | [codegen,refdata] Introduce per-entity NATS sub-registrars |
Review
| Comment summary | File | Decision | Notes |
|---|---|---|---|
Result
Added the nats-sub-registrar codegen facet producing a per-entity
<entity>_registrar.hpp/cpp pair. The hpp declares
register_<entity>_handlers(); the cpp includes only that entity's
handler header and wires its NATS subjects to the handler instance, so a
compile failure in one entity's handler cannot block the rest of the
service.
Re-modelled onto the physical-space graph (current codegen):
ores.cpp.nats-sub-registrar.org— facet doc (#+type: facet,#+model_types: domain_entity schema,#+facet_group: ores.cpp).ores.cpp.nats-sub-registrar.nats_registrar_header.organd…nats_registrar_implementation.org— archetype docs with#+output:paths,#+facet:back-reference, and the mustache tangle blocks.generate.py:nats-sub-registrar → {ores.cpp.nats-sub-registrar}added to the_PROFILE_TO_FACETSshim.- Tangled to
cpp_nats_registrar.{hpp,cpp}.mustacheviacompass build --direct tangle_codegen_templates. - Inventories regenerated (
regenerate_physical_space_inventories.py): facet now listed inores.cpp.org. list_onlywires only the list subject;no_historyskips the history subscription — both documented in the archetype docs.
The meta-pattern is documented under Entity-composed registrars, whose NATS instance section links to these archetypes.