Skip to content

epic: ObjectRegistry Architectural Debt — Circular Dependency & Scalability #1003

@willgriffin

Description

@willgriffin

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:

  1. Prototype chain walking (buildInheritanceChain) — uses constructor references
  2. Manifest extends field (getInheritanceChain) — uses string names
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions