Skip to content

Commit 34d3fc3

Browse files
dmealingclaude
andcommitted
feat(fr-033): Python port S-B1 — embed spec/metamodel JSON + reader + descriptions
Embeds the 15 shared spec/metamodel/*.json as Python package data (byte-gated) + adds a reader sourcing every type/attr/common description (+rules/example/whenToUse) from them onto the Python registry pre-seal — single-sourced, byte-identical to TS, never hand-copied. The manifest's description fields now match the golden; test_registry_conformance stays RED pending the strict children graph + cardinality + per-subtype attr scoping (S-B2a/B2b). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4d538ee commit 34d3fc3

19 files changed

Lines changed: 1269 additions & 1 deletion

server/python/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ exclude = ["**/KNOWN_GAPS.md"]
7575
# falls back to walking up to the monorepo agent-context/.
7676
[tool.hatch.build.hooks.custom]
7777

78+
# FR-033 — the 15 shared spec/metamodel/*.json files are COMMITTED copies under
79+
# src/metaobjects/spec_metamodel/ (not build-time-generated), so hatchling's default
80+
# package inclusion ships them in both the sdist and the wheel (read via
81+
# importlib.resources, AOT-safe). A byte-identity gate
82+
# (tests/conformance/test_spec_metamodel_embed.py) keeps the copies from drifting
83+
# from the repo-root spec/metamodel/ source.
7884
[tool.hatch.build]
7985
artifacts = ["src/metaobjects/agent_context/_content/**"]
8086

server/python/src/metaobjects/provider.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,22 @@ def register_types(self, registry: TypeRegistry) -> None:
6363

6464

6565
def compose_registry(providers: list[Provider]) -> TypeRegistry:
66-
"""Topologically sort providers by dependency, then register each into a fresh registry."""
66+
"""Topologically sort providers by dependency, then register each into a fresh registry.
67+
68+
FR-033 S-B1 — after every provider has run (and BEFORE any caller seals the
69+
registry), source every type / attr / common-attr description from the embedded
70+
shared ``spec/metamodel/*.json`` onto the registry. Single-sourced, byte-identical
71+
to TS — never hand-copied. A ``(type, subType)`` (or attr) the spec does not
72+
declare keeps its empty description (the residual S-B2 scoping work).
73+
"""
74+
# Deferred import avoids a provider -> spec_metamodel -> registry import cycle.
75+
from .spec_metamodel import apply_spec_descriptions
76+
6777
ordered = _topo_sort(providers)
6878
registry = TypeRegistry()
6979
for provider in ordered:
7080
provider.register_types(registry)
81+
apply_spec_descriptions(registry)
7182
return registry
7283

7384

0 commit comments

Comments
 (0)