Task: Wire sub-registrars into the top-level registrar

Table of Contents

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.cpp delegates to register_<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

  1. Map the entities wired in registrar.cpp against the generated sub-registrars; identify which can delegate and which must stay inline.
  2. Extend the nats-sub-registrar implementation archetype with two paste points: custom_subscriptions (extra subjects) and custom_includes (extra headers), driven by :implements blocks in the entity model.
  3. Wire party's read_parties_for_cache subject via a custom_subscriptions block so party fully delegates.
  4. Fix currency: remove the incorrect no_history flag (its history request lives in a split currency_history_protocol.hpp) and add a custom_includes block for that header so history is wired correctly.
  5. Re-tangle, regenerate, and rewrite registrar.cpp to delegate 26 entities and keep 7 inline.
  6. Verify subject-set parity and build.

Notes

PRs

PR Title
#1426 [agile] Close per-entity sub-registrars story
#1421 [refdata] Wire per-entity sub-registrars into the top-level registrar

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.

Emacs 29.3 (Org mode 9.6.15)