Inventory system-scoped entities and rationalise tenant scoping strategy
Table of Contents
This page is a capture in the inbox bucket of the product backlog — a pre-sprint idea, not yet pulled into a sprint as a story.
What
Audit every codegen entity to determine its correct tenant-scoping strategy and apply it consistently. Currently two incompatible patterns coexist:
- Per-tenant copies (party_type approach) — seed data replicated to every tenant during provisioning. The repository filters by
tenant_idnaturally and each tenant sees its own copy. Works for entities that might need per-tenant variation. - System-tenant context switch (old pricing_engine_type handler approach) — data lives only under the system tenant. The handler switches to
sys_ctxviawith_tenant(system()). All tenants read from one source. The template supports this via:system_tenant_validation:.
The new simple-lookup profile sets system_scope: false by default, implying per-tenant copies. But many entities (pricing engine types, instrument codes, etc.) are reference taxonomies that should never diverge per tenant — copying them is waste and a drift hazard.
Why
Discovered while applying safe drift to analytics-cpp: pricing_engine_type returned zero rows for Acme because its 44 system-tenant rows had no per-tenant copies, and the regenerated handler no longer had the system-tenant context switch that the old hand-authored handler hardcoded. Adding :system_tenant_validation: fixed it mechanically, but the real question is strategic: which entities genuinely need this treatment?
Key questions
- Which entities need per-tenant copies vs system-tenant read-only?
- For system-tenant entities that evolve with upstream (e.g. new ORE version adds engine types), how are writes gated?
- Is
:system_tenant_validation:the right mechanism, or do we need a finer-grained:read_only: truethat allows writes under the system tenant only? - Should this be a profile axis rather than a per-entity flag?
References
- Refactor ores.codegen C++ generation — the story that surfaced this
- Simple lookup profile — sets
system_scope: false - ORE Studio Variability Model — profiles and features
See also
- UUID-identified lookup — the new counterpart profile