Task: Wire sub-registrars into the top-level registrar
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
Replace the monolithic registrar.cpp body with delegating calls to each
per-entity sub-registrar, so the top-level registrar holds no entity-specific
wiring. Entities without a valid sub-registrar stay inline.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Introduce per-entity NATS sub-registrars |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-07-03 |
Acceptance
registrar.cppdelegates toregister_<entity>_handlers()for every entity that has a valid sub-registrar (26 entities).- Entities without a valid sub-registrar stay inline, each with a comment explaining why (no codegen model, table model, handler-name mismatch, or bespoke multi-subject handler).
- The set of subscribed NATS subjects is unchanged (no regressions, no additions) — verified by diffing subjects against the previous registrar.
- Custom, non-codegen subscriptions/includes are wired via the sub-registrar paste-block mechanism, not hand-edited into generated files.
- ores.refdata.core builds.
Plan
- Map the entities wired in
registrar.cppagainst the generated sub-registrars; identify which can delegate and which must stay inline. - Extend the
nats-sub-registrarimplementation archetype with two paste points:custom_subscriptions(extra subjects) andcustom_includes(extra headers), driven by:implementsblocks in the entity model. - Wire
party'sread_parties_for_cachesubject via acustom_subscriptionsblock sopartyfully delegates. - Fix
currency: remove the incorrectno_historyflag (its history request lives in a splitcurrency_history_protocol.hpp) and add acustom_includesblock for that header so history is wired correctly. - Re-tangle, regenerate, and rewrite
registrar.cppto delegate 26 entities and keep 7 inline. - Verify subject-set parity and build.
Notes
PRs
Review
| # | Comment summary | File | Decision | Notes |
|---|---|---|---|---|
| 1 | Include block sorted by filename, call block by function name — couple of entities differ in relative order | registrar.cpp | Declined | Cosmetic; reviewer said not worth a follow-up. Both lists exhaustive, each entity once. |
| 2 | ctx/verifier copied by value per handler | registrar.cpp | Declined | Pre-existing pattern, unchanged by this refactor. |
Result
Rewrote registrar.cpp (856 -> 283 lines) to delegate to each
register_<entity>_handlers(): 26 entities delegate, 7 stay inline with a
documented reason (asset_class=/=business_centre=/=business_unit_type have no
codegen model, purpose_type is a table, party_contact=/=counterparty_contact
have a handler-vs-protocol name mismatch, publish_from_dq is a bespoke
multi-subject handler).
Extended the nats-sub-registrar implementation archetype with two paste
points so non-codegen wiring lives in the entity model, not hand-edits to
generated files: custom_subscriptions (extra subjects) and custom_includes
(extra headers). Used them to let party fully delegate its
read_parties_for_cache subject, and to fix currency (dropped an incorrect
no_history flag and pulled in its split currency_history_protocol.hpp).
The set of subscribed NATS subjects is unchanged — 144 before and after,
verified by diff and independently re-confirmed by three PR reviewers.
ores.refdata.core builds. Merged in PR #1421. This closes the story.