Skip to content

Centralize renderer registration metadata - #146

Open
hallerite wants to merge 1 commit into
mainfrom
codex/renderer-spec-registry
Open

Centralize renderer registration metadata#146
hallerite wants to merge 1 commit into
mainfrom
codex/renderer-spec-registry

Conversation

@hallerite

@hallerite hallerite commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

  • add a declarative RendererSpec manifest for renderer names, loaders, config classes, model IDs, aliases, and modalities
  • derive runtime registration, auto-routing, multimodal metadata, config lookup, and lazy imports from that manifest
  • require every mapped checkpoint to resolve to an explicitly parity-tested representative
  • add structural tests preventing registry and config-union drift

RendererConfig remains explicit for static typing, with an exact manifest consistency guard. Generated model routing and modality maps are unchanged from main.

Validation

  • 9763 passed, 57 skipped (tests/test_multimodal.py excluded because processor loading requires unavailable Hugging Face network access in the local sandbox)
  • ruff check .
  • exact comparison of generated routing and modality maps against origin/main

Note

Low Risk
Refactor-only with structural tests and claimed byte-identical routing/modality maps; risk is accidental drift when editing the manifest, not runtime behavior change.

Overview
Introduces a single declarative manifest in renderers/registry.py (RendererSpec / ModelSpec / RENDERER_SPECS) that records renderer names, import paths, config classes, HF model IDs, aliases, and multimodal modalities.

renderers.base, renderers.configs, and renderers.__init__ no longer maintain parallel hand-edited maps. MODEL_RENDERER_MAP, MULTIMODAL_MODELS, lazy renderer imports, _CONFIG_BY_NAME, and _populate_registry are all built from the manifest. Aliases route like their representative checkpoint and inherit modalities; MODEL_PARITY_REPRESENTATIVES ties every mapped ID to a parity-tested model.

RendererConfig pydantic variants stay explicit for typing; tests/test_registry.py locks manifest ↔ runtime metadata ↔ config union consistency and checks representatives exist in MODEL_CATALOG.

Reviewed by Cursor Bugbot for commit 88973d5. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Centralize renderer metadata into RENDERER_SPECS registry

  • Adds renderers/registry.py as the single source of truth for renderer metadata, defining RendererSpec and ModelSpec dataclasses plus the RENDERER_SPECS tuple that describes all renderers, their modules, classes, configs, and covered models with aliases and modalities
  • Replaces hardcoded mappings in _LAZY_RENDERERS, MODEL_RENDERER_MAP, MULTIMODAL_MODELS, _populate_registry, and _CONFIG_BY_NAME with dict comprehensions that derive their entries from RENDERER_SPECS at import time
  • _validate_specs() runs at import time and raises ValueError on duplicate renderer names, classes, or model IDs, or unknown modality values
  • Adds tests/test_registry.py asserting that all runtime metadata maps match computations from RENDERER_SPECS and that _populate_registry loads every declared renderer
  • Risk: importing renderers.registry now raises ValueError at import time if any spec has a duplicate name, class, or model ID — a previously-silent condition

Macroscope summarized 88973d5.

@macroscopeapp

macroscopeapp Bot commented Aug 31, 2026

Copy link
Copy Markdown

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR centralizes routing, modality, lazy-import, and config-registration behavior behind a new manifest and dynamic loader, affecting shared runtime initialization across the package. Structural tests provide coverage, but the breadth of the abstraction and changed loading mechanics merit human review.

Notes:

  • Macroscope's correctness review did not run, so approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant