Skip to content

feat(metadata): split rules and view expressions into packs - #618

Merged
dmealing merged 9 commits into
mainfrom
fm/mo-vocab-provider-split
Nov 20, 2026
Merged

dmealing merged 9 commits into
mainfrom
fm/mo-vocab-provider-split

Conversation

@dmealing

@dmealing dmealing commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • Moves business rules (metaobjects-rules: api, operation, binding, transition, plus the child rules that admit them on metadata.root and field.enum) and view expressions (metaobjects-view-expressions: origin.function, @union, @unionAll, @grain, @grainOrdinal) out of the metaobjects-core-types provider into their own providers. Done in TypeScript, C#, Java/Kotlin, Python and Rust (preview), with spec JSON under spec/metamodel/ and server/*/ mirrored in each port. Both packs stay in the default bundle, so existing models load and generate unchanged. A model that uses their types with a pack left out gets a loader error (ERR_UNKNOWN_TYPE / ERR_UNKNOWN_SUBTYPE / ERR_UNKNOWN_ATTR). ExtendDef entries may now carry structural child rules, and the api child rule on metadata.root is declared in data with cardinality (the one registry manifest row that changes; metamodelVersion stays 1.3).
  • Adds a core vocabulary is pinned gate (scripts/check-core-vocabulary-pin.ts, scripts/test-core-vocabulary-pin.ts, fixtures/registry-conformance/core-vocabulary.pin.json, wired into scripts/ci-local.sh). Adding a type, subtype, attribute or child rule to the core provider fails the gate with a pointer to GOVERNANCE.md and the pack mechanism.
  • Adds conformance fixtures packs-left-out-model-loads and error-packs-left-out-{api-used,origin-function-used,transition-used}, and refreshes the regenerated docs, site reference, agent-context goldens and examples/showcase/site-payload.json. Docs and agent guidance (AGENTS.md, .claude/rules/cross-language-porting.md, docs/features/extending-with-providers.md, the authoring skill) now say new vocabulary goes in its own provider pack, never in core. CHANGELOG.md records the change.
  • Includes the mo-vocab-docs-fix docs (merged into this branch so one gate run and one PR carry both). docs/features/extending-with-providers.md was updated to describe what the split ships.
  • Reporting and requirements stay in core. Moving them is not the same small mechanical move: object.report and the dimension/measure/segment rules are woven into object.json, and the requirements ledger is read by the verify gate in every port. They are the next candidates for a pack. Not covered by the split, also recorded as a follow-up: the cast node and the SQL function set of attr.expression are expression grammar parsed in code, so a provider cannot gate them.
  • Out of scope, per the brief: docs and agent-prompt rewrites beyond the docs-fix branch, other toolkit-review findings, and finishing what reads rules.*.
  • Gate runs: this PR took 1 no-mistakes run (the review fixed one finding, the docs-site provider list; the test step fixed one cargo fmt finding).
Validation

Risk Assessment

⚠️ Medium: The change is large and cross-port (182 files, a registry-structure refactor in five ports), but the code I read is consistent and meets the intent, and the earlier docs-site finding is correctly fixed; I could not read every port-level file in depth.

Testing

Baseline scripts/ci-local.sh --affected --strict-toolchains had already passed. I drove three scenarios live. The real CLI loaded a rules model with the packs composed by default. The real loader returned ERR_UNKNOWN_TYPE or ERR_UNKNOWN_SUBTYPE when the rules or view-expressions pack was left out, and a model using neither loaded with both packs removed. The core pin gate and its adversarial self-test passed. The docs-site fix passed its focused test. All scenarios passed, and I removed the scratch files.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Default compose: real meta CLI (dist/bin/meta.js on repo source) in a scratch project holding the rules-purchase-request model (api.operational, operation.*, transition.action). meta fmt --check l… ✅ pass live default-compose-cli.txt. The model loaded with no loader error. The only complaint was 'not canonical' formatting,…
Pack left out: real MetaDataLoader with composeRegistry(coreProviders minus the rules or view-expressions pack) loads models that use api.operational, transition.action and origin.function. A model wi… ✅ pass live packs-left-out-loader.txt. With default providers, errors=[]. Without the rules pack: ERR_UNKNOWN_TYPE for api.o…
Core vocabulary pin guard: bun scripts/check-core-vocabulary-pin.ts passes on the committed spec. The self-test adds an attribute or a type to core in a throwaway copy of spec/metamodel and checks t… ✅ pass live pin-guard.txt. The check exits 0 with 'core vocabulary pin ok (90 types owned by metaobjects-core-types)'. The self-test ran…
Evidence: Core vocabulary pin guard run
core vocabulary pin ok (90 types owned by metaobjects-core-types).
exit=0
ok: the committed pin matches spec/metamodel
ok: adding an attribute to a core type fails the gate
ok:   the failure names the added attribute
ok:   the failure points at GOVERNANCE.md and the pack mechanism
ok: adding a type to the core provider fails, naming it
ok: the same type added to a pack (not core) does not fail
ok: the core-only TypeScript registry holds no unpinned type
exit=0
Evidence: Real loader with packs composed and left out
ids: metaobjects-core-types,metaobjects-db,metaobjects-documentation,metaobjects-prompt,metaobjects-ui,metaobjects-ui-web,metaobjects-rules,metaobjects-view-expressions
api-used, DEFAULT providers: errors=[]
api-used, rules pack LEFT OUT: errors=[{"code":"ERR_UNKNOWN_TYPE","msg":"Unknown type \"api.operational\" — not registered"}]
transition-used, rules LEFT OUT: errors=[{"code":"ERR_UNKNOWN_TYPE","msg":"Unknown type \"transition.action\" — not registered"}]
origin.function-used, DEFAULT: errors=[]
origin.function-used, view-expressions LEFT OUT: errors=[{"code":"ERR_UNKNOWN_SUBTYPE","msg":"Unknown type \"origin.function\" — not registered"}]
no-pack model, BOTH packs LEFT OUT: errors=[]
no-pack model, DEFAULT: errors=[]
Evidence: Real CLI with packs composed by default
## default CLI: model with api/operation/transition
  not canonical  metaobjects/meta.purchasing.json
meta: meta fmt --check — 1 file(s) not canonical. Run `meta fmt` to fix.
exit=1
api.base                     Registry anchor for the declared API surface (ADR-0030, ADR-0054): not authorable. The `…  [base]
api.operational              A named, packaged request/response surface whose children are operations (ADR-0030). It …

  [base]     the type's shared root — its @attrs apply to every subtype of that type
  [<port>; pending elsewhere]  cross-port vocabulary only <port> implements so far (e.g. [ts; …]); every port loads and type-checks it, the others do not act on it yet
  [<port>-only]  every port loads and type-checks it; only <port> acts on it ([java+kotlin]: only those ports)

2 matches.
operation.command @transitions The lifecycle moves this command may make: names of `transition.action` nodes on its tar…
transition.action            An allowed move between two values of a `field.enum`, made by an operation (ADR-0066). A…  (@condition, @from, @permission, @public, @to)
transition.action @condition A guard over the entity's own fields, in the attr.expression grammar: the same name, gra…
transition.action @from      The states this move may start from: members of the parent enum's @values (ERR_TRANSITIO…
Evidence: docs-site provider-extension test
bun test v1.3.14 (0d9b296a)

 4 pass
 0 fail
 6 expect() calls
Ran 4 tests across 1 file. [133.00ms]
  • Outcome: 🔧 3 issues found → no changes applied ✅ across 2 runs (1h1m23s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ server/typescript/packages/docs-site/src/load.ts:43 - docs-site hand-picks its provider list and was not updated for the pack split. composeRegistry([coreTypesProvider, dbProvider, docProvider, promptProvider, uiProvider, ...extraProviders]) used to get api/operation/binding/transition and origin.function from coreTypesProvider. After this change coreTypesProvider alone no longer registers them (the CHANGELOG 'Embedders' note says so). A model that declares an api.operational, a transition.action or an origin.function therefore fails to load in the site builder with ERR_UNKNOWN_TYPE or ERR_UNKNOWN_SUBTYPE. The same model still loads in meta gen, meta verify and the loader, which compose coreProviders. This contradicts the intent that the packs are 'registered by default'. Smallest fix: build the registry from coreProviders (deduped against extraProviders), or at least add the rules and view-expressions providers. I found no other non-test TS, Python, C# or Java caller that composes core alone.

🔧 Fix applied.
✅ Re-checked - no issues remain.

🔧 **Test** - 3 issues found → no changes applied ✅
  • 🚨 configured test command failed with exit code 1
  • ⚠️ server/typescript/packages/docs-site/src/load.ts - Pack-split intent not live-validated (rules and view-expression packs default-composed, loader error without pack, core-vocabulary pin). Needs follow-up run.
  • ⚠️ live validation verdict: inconclusive (1 of 4 scenarios were driven live against the product); untested: Load a model using rules.* and view-expression types with packs composed by default, Model using rules/view-expression types without the pack fails with clear loader error, Core vocabulary pin fails on added core type, pointing to GOVERNANCE.md
  • Live validation: ⚠️ inconclusive - 1 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Affected-lane CI selection and build/conformance for the change ✅ pass live
Load a model using rules.* and view-expression types with packs composed by default ⏸️ untested no Not driven in this run.
Model using rules/view-expression types without the pack fails with clear loader error ⏸️ untested no Not driven in this run.
Core vocabulary pin fails on added core type, pointing to GOVERNANCE.md ⏸️ untested no Not driven in this run.
  • scripts/ci-local.sh --affected --strict-toolchains
  • scripts/ci-local.sh --affected --strict-toolchains (csharp, python, java, ts passed; rust failed pre-fix)
  • scripts/ci-local.sh --only rust --no-integration after fmt fix (passed)

🔧 No changes applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Default compose: real meta CLI (dist/bin/meta.js on repo source) in a scratch project holding the rules-purchase-request model (api.operational, operation.*, transition.action). meta fmt --check l… ✅ pass live default-compose-cli.txt. The model loaded with no loader error. The only complaint was 'not canonical' formatting,…
Pack left out: real MetaDataLoader with composeRegistry(coreProviders minus the rules or view-expressions pack) loads models that use api.operational, transition.action and origin.function. A model wi… ✅ pass live packs-left-out-loader.txt. With default providers, errors=[]. Without the rules pack: ERR_UNKNOWN_TYPE for api.o…
Core vocabulary pin guard: bun scripts/check-core-vocabulary-pin.ts passes on the committed spec. The self-test adds an attribute or a type to core in a throwaway copy of spec/metamodel and checks t… ✅ pass live pin-guard.txt. The check exits 0 with 'core vocabulary pin ok (90 types owned by metaobjects-core-types)'. The self-test ran…
  • scripts/ci-local.sh --affected --strict-toolchains
  • Broad regression came from the configured baseline scripts/ci-local.sh --affected --strict-toolchains; it passed at this target commit, and I did not re-run it.
  • bun scripts/check-core-vocabulary-pin.ts and bun scripts/test-core-vocabulary-pin.ts
  • bun server/typescript/packages/cli/dist/bin/meta.js fmt --check and meta types api|transition|operation in a scratch project holding the rules-purchase-request fixture
  • A throwaway loader script (bun drive.ts) using composeRegistry(coreProviders) with and without the rules and view-expressions packs, on the error-packs-left-out-* and packs-left-out-model-loads fixture inputs
  • bun test test/provider-extension.test.ts in docs-site
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…der into packs

Move the 1.3.0 business-rules vocabulary (api, operation, binding, transition) and the
view-expressions vocabulary (origin.function, @union, @unionall, @Grain, @grainOrdinal) into
their own providers, metaobjects-rules and metaobjects-view-expressions, composed by default
in every port that carries them. Data-driven extends may now carry structural child rules so
a pack owns the child rules that admit its types. Pin the core provider's vocabulary with a
gate that points at GOVERNANCE.md and the pack mechanism. Add pack-omission conformance
fixtures.
Rewrite 'What modularity does and does not mean' as 'Where vocabulary lives': core holds the base metamodel, other vocabulary lives in its own provider, composed by default and removable. Record honestly what still sits in metaobjects-core-types. Defer the entry rule to GOVERNANCE.md. Drop the metaobjects-forge mention from the default bundle.
One sentence each in AGENTS.md (design judgment), the auto-loading cross-language rule and the authoring skill, all pointing at GOVERNANCE.md.
@dmealing
dmealing merged commit f938b7e into main Nov 20, 2026
10 checks passed
@dmealing
dmealing deleted the fm/mo-vocab-provider-split branch November 20, 2026 15:27
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