Epic: ObjectRegistry Architectural Debt
Background
The ObjectRegistry in packages/core/src/registry.ts has grown to 5,539 lines with 10+ distinct responsibilities. Issue #1001 exposed a latent failure where name resolution ambiguity causes false circular inheritance detection when enough packages (459 objects across 25 manifests) are loaded simultaneously.
This is not an isolated bug — it is structural debt that will worsen as more packages are added.
Root Cause Analysis
Three competing class identity resolution systems exist in the registry:
- Prototype chain walking (
buildInheritanceChain) — uses constructor references
- Manifest
extends field (getInheritanceChain) — uses string names
- FK dependency graph (
getInitializationOrder) — uses simple class names
These systems disagree under scale. Manifest-loaded classes have stub constructors (class extends SmrtObject) that bypass the declared extends hierarchy. When findClass() resolves an ambiguous simple name, getInheritanceChain() can produce circular chains like VideoShot → VideoShot → VideoShot.
Additionally, getInheritanceChain() has side effects — it calls registerFromManifest() during what should be a read operation, making the system non-deterministic based on call order.
Issues in This Epic
Immediate (fix #1001):
Short-term (reduce risk):
Long-term (architecture evolution):
Reference
Epic: ObjectRegistry Architectural Debt
Background
The
ObjectRegistryinpackages/core/src/registry.tshas grown to 5,539 lines with 10+ distinct responsibilities. Issue #1001 exposed a latent failure where name resolution ambiguity causes false circular inheritance detection when enough packages (459 objects across 25 manifests) are loaded simultaneously.This is not an isolated bug — it is structural debt that will worsen as more packages are added.
Root Cause Analysis
Three competing class identity resolution systems exist in the registry:
buildInheritanceChain) — uses constructor referencesextendsfield (getInheritanceChain) — uses string namesgetInitializationOrder) — uses simple class namesThese systems disagree under scale. Manifest-loaded classes have stub constructors (
class extends SmrtObject) that bypass the declaredextendshierarchy. WhenfindClass()resolves an ambiguous simple name,getInheritanceChain()can produce circular chains likeVideoShot → VideoShot → VideoShot.Additionally,
getInheritanceChain()has side effects — it callsregisterFromManifest()during what should be a read operation, making the system non-deterministic based on call order.Issues in This Epic
Immediate (fix #1001):
extendsresolutionfindClassStrict()for inheritance resolutionShort-term (reduce risk):
ObjectRegistryinto focused modulesLong-term (architecture evolution):
Reference
packages/core/src/registry.ts,packages/core/src/manifest/manifest-loader.ts