Repository navigation
feat(metadata): move reporting and requirements into vocabulary packs - #632
Merged
Merged
Conversation
…raise on missing template variables; refuse permission-name collisions - Reporting (object.report, dimension.*, measure.* incl. measure.derived/@expr, segment.filter, the entity's dimension/measure/segment children and @segment on origin.aggregate/origin.first) is registered by metaobjects-reporting; requirements (requirement.* and the root's requirement child) by metaobjects-requirements. Both are in the default bundle of every port (TS, C#, Java/Kotlin, Python, Rust), so existing models load and generate identically. A model that uses a left-out pack's vocabulary gets a loader error (new error-packs-left-out-*-used fixtures). The verify requirements gate reads through the pack. - A pack subtype declared with extendsBase may fold a base another provider registered (object.report folds object.base); folded attributes keep the base's owner under ADR-0062. - Core vocabulary pin, registry manifest (root requirement child gains min 0 / max null), metamodel docs, site reference and payload regenerated. - GOVERNANCE.md: an attribute promoted from a pack into core keeps its name and meaning. - B4: Mustache and Jinja raise ERR_VAR_NOT_ON_PAYLOAD for a variable or dotted path absent from the payload, in every port that renders; render runners learn expected-error.txt. - B5: rules rule P3 refuses two permission points whose names resolve equal when at least one name is derived (ERR_TRANSITION_NAME_COLLISION), in every port. - C3: Python checks @union shape and @Grain views at load; both must-fail fixtures leave its expected-failures ledger.
…not one name The P3 collision check rewrote '::' to '.' before comparing, so a derived p::Order.open counted as a collision with the transition's p.Order.open. They are different names in the metadata and the policy receives them as written. Removed the rewrite in TS, C#, Java, Python and Rust. The former error-rules-permission-name-op-package fixture becomes rules-permission-name-package-separator-distinct, which every port's conformance runner now loads clean.
…raise on missing template variables; refuse permission-name collisions - Reporting (object.report, dimension.*, measure.* incl. measure.derived/@expr, segment.filter, the entity's dimension/measure/segment children and @segment on origin.aggregate/origin.first) is registered by metaobjects-reporting; requirements (requirement.* and the root's requirement child) by metaobjects-requirements. Both are in the default bundle of every port (TS, C#, Java/Kotlin, Python, Rust), so existing models load and generate identically. A model that uses a left-out pack's vocabulary gets a loader error (new error-packs-left-out-*-used fixtures). The verify requirements gate reads through the pack. - A pack subtype declared with extendsBase may fold a base another provider registered (object.report folds object.base); folded attributes keep the base's owner under ADR-0062. - Core vocabulary pin, registry manifest (root requirement child gains min 0 / max null), metamodel docs, site reference and payload regenerated. - GOVERNANCE.md: an attribute promoted from a pack into core keeps its name and meaning. - B4: Mustache and Jinja raise ERR_VAR_NOT_ON_PAYLOAD for a variable or dotted path absent from the payload, in every port that renders; render runners learn expected-error.txt. - B5: rules rule P3 refuses two permission points whose names resolve equal when at least one name is derived (ERR_TRANSITION_NAME_COLLISION), in every port. - C3: Python checks @union shape and @Grain views at load; both must-fail fixtures leave its expected-failures ledger.
…not one name The P3 collision check rewrote '::' to '.' before comparing, so a derived p::Order.open counted as a collision with the transition's p.Order.open. They are different names in the metadata and the policy receives them as written. Removed the rewrite in TS, C#, Java, Python and Rust. The former error-rules-permission-name-op-package fixture becomes rules-permission-name-package-separator-distinct, which every port's conformance runner now loads clean.
The rebase onto main brought in the metaobjects-render crate (#630), whose corpus runner read expected.txt for every render case. This branch adds two render-conformance cases that expect a missing-variable error instead, so the Rust renderer now refuses an interpolated name the payload lacks, with the same message and the same rules as the reference (sections over an absent name stay legal, null is present, only rendered bodies are checked), and the runner learns the expected-error.txt convention.
…d branch The branch was rebased onto main after the first no-mistakes run pushed PR 632, so that run's commits were replayed rather than kept. This merge records them as ancestors so the pushed history stays reachable and the next push is a fast-forward; the tree is the rebased one, unchanged.
…lookup in every port The B4 missing-variable check follows TypeScript on mustache.js: a dotted name is tried whole against each context from the innermost outward, and a list's length is a property. Python and C# now resolve that way; the Java check pass falls back to a whole-path lookup before raising; the Rust check pass counts a list's length as present. So no port raises ERR_VAR_NOT_ON_PAYLOAD on a name TypeScript renders. What the C#, Java and Rust engines then print for those names is a separate parity question.
…equirements-packs # Conflicts: # AGENTS.md # CHANGELOG.md # docs/CONFORMANCE.md # examples/showcase/site-payload.json # server/python/src/metaobjects/loader/validation_passes.py
…s, as mustache.js does
An empty list's length now resolves, so {{#items.length}} on an empty list
rendered its body in Python. mustache.js tests sections with JavaScript
falsiness, where 0 and NaN are falsy; Python's section test and the C#
check pass now do the same. Adds a Python test pinning the shadowed-prefix,
length, zero and null-mid-path cases against the TypeScript output.
Also tidies the Java whole-path fallback (imports, a named length constant,
loop-invariant work hoisted) and the C# lookup (using, a redundant assignment).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
object.report,dimension.*,measure.*incl.measure.derived/@expr,segment.filter, the entity's dimension/measure/segment children,@segmentonorigin.aggregate/origin.first) is registered bymetaobjects-reporting, andrequirement.functional/requirement.architectural(plus the root'srequirement.*child) bymetaobjects-requirements, in every port (TS, C#, Java, Python, Rust). Both stay in the default bundle so existing models load unchanged; with a pack composed out, using its types fails the load with the unknown type/subtype error (newerror-packs-left-out-*-usedconformance fixtures and per-portRequirementsPackLeftOuttests). The core vocabulary pin, registry manifest and the ~100 existing reporting/requirements fixtureproviders.jsonfiles were updated accordingly; the root'srequirementchild rule is nowmin: 0, max: null. A pack subtype declared withextendsBase(e.g.object.reportfoldingobject.base) keeps the base provider as owner of the folded attributes instead of claiming them (ADR-0062, with a Rust registry base-ownership conformance test), and GOVERNANCE.md records that an attribute promoted from a pack into core keeps its name and meaning.metaobjects-rendercrate, via a newpresence.rspre-walk that skips falsy section bodies and checks list sections per element) raiseERR_VAR_NOT_ON_PAYLOAD (<name>)instead of silently rendering empty; a present-but-null variable still renders empty. Render and Jinja conformance fixtures may carryexpected-error.txtin place ofexpected.txt, and new parity fixtures pin listlengthresolution, shadowed dotted prefixes, dotted-path lookup and zero-is-falsy behavior across ports.@permissionor the derived<package>.<path>, compared exactly as the policy receives it, sop::Order.openandp.Order.openare distinct — reportERR_TRANSITION_NAME_COLLISIONon the later one when at least one name is derived; two equal declared names remain a legal shared permission (newerror-rules-permission-name-op-*andrules-permission-name-package-separator-distinctfixtures). Java now accepts dotted operation names, matching TypeScript, C# and Python.Validation
Validation runs and follow-ups
This PR took 4 no-mistakes runs. Run 1 found the dotted-name lookup review item; run 2 failed only on gate-provider quota; run 3 was lost at the document step when every gate agent was killed by host memory pressure (exit 137) after review and test had passed; run 4 passed every step. Runs 3 and 4 were each approved explicitly.
Follow-ups, not in this PR:
render-shadowed-dotted-prefix, and Rust ledgers that case plusrender-list-lengthandrender-zero-falsiness(KnownDrift, recorded indocs/CONFORMANCE.md). These go to the engine-parity follow-up task, which closes every ledger entry.mo-rust-extends-base-ownership.Risk Assessment
Testing
Broad regression came from the configured test command scripts/ci-local.sh --affected --strict-toolchains, which passed at the target commit before this run; no source or test files were changed this turn, so no re-run was needed. On top of that I drove three live scenarios: the SDK loader composed without each pack refuses that pack's vocabulary (report pack out gives ERR_UNKNOWN_TYPE on measure.aggregate plus ERR_UNKNOWN_SUBTYPE on object.report; requirements pack out gives ERR_UNKNOWN_TYPE on requirement.functional; both default-bundle loads are clean, oracle = committed expected-errors.json), the real meta CLI rejects the same-name permission collision with exit 1 while accepting the :: vs . distinct names clean, and meta types attributes 50 vocabulary entries to metaobjects-reporting and 32 to metaobjects-requirements with folded base attrs keeping core-types ownership. Evidence artifacts written to the evidence directory; scratch fixture project and driver script removed; worktree left clean.
packs-driver-output.txt, not published)packs-driver-output.txt, not published)p3-cli-fmt-check.txt, not published)meta-types-report.txt, not published)Evidence: SDK driver output: pack-out vs default loads and P3 collision/distinct checks, all PASS
report pack OUT : [ERR_UNKNOWN_TYPE, ERR_UNKNOWN_SUBTYPE] report default : [] req pack OUT : [ERR_UNKNOWN_TYPE] req default : [] P3 collision : [ERR_TRANSITION_NAME_COLLISION] P3 distinct sep : [] all PASSEvidence: Real meta CLI: collision fixture refused, separator-distinct fixture loads clean and canonical
collision fixture, meta fmt --check, exit 1: operation.query "Orders.Order.open" asks the policy about the permission name "p.Order.open", which transition.action "Order.status.open" also asks about, and one of the two names is derived rather than declared; declare a distinct @permission on one, or rename it. separator-distinct fixture, meta fmt + fmt --check, exit 0: meta fmt --check — every file is already canonical.Evidence: meta types report: object.report vocabulary attributed to the reporting pack, base-folded attrs to core-types
meta types report (metamodelVersion 1.3, total 10) subtype object.report - attr object.report @collectionName metaobjects-reporting attr object.report @dimensions metaobjects-reporting attr object.report @measures metaobjects-reporting attr object.report @spine metaobjects-reporting attr object.report @segment metaobjects-reporting attr object.report @object metaobjects-core-types attr object.report @objectAdapter metaobjects-core-typesPipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - outcome: 4 findings fixed, 1 info follow-up
Fixed in this run:
server/typescript/packages/metadata/src/loader/rules-validation.ts- the P3 header comment now states the B5 ruling:p::Order.openandp.Order.openare different permission names and do not collide (reviewer inline fix, no behavior change).docs/CONFORMANCE.md- says the TypeScript render runner checks that the expected error message is contained, matching what it does.AGENTS.md/CLAUDE.md- the render corpus line now says C# and Rust carry KnownDrift render ledgers recorded indocs/CONFORMANCE.md.server/rust/metaobjects/src/registry.rs- the ADR-0062 ownership exemption is limited toextends_basedefinitions, so a provider redeclaring a core base attr on a non-extending subtype is refused, as in TypeScript and C#, with Rust tests.Remaining (info, follow-up task
mo-rust-extends-base-ownership):server/rust/metaobjects/src/registry.rs- inside anextends_basedefinition the exemption is still by name, so a subtype that redeclares a base attr there is accepted in Rust where TypeScript and C# refuse it. The review round cap was reached, so it is not fixed here.✅ **Test** - passed
✅ No issues found.
packs-driver-output.txt, not published)packs-driver-output.txt, not published)p3-cli-fmt-check.txt, not published)meta-types-report.txt, not published)scripts/ci-local.sh --affected --strict-toolchainsscripts/ci-local.sh --affected --strict-toolchains (baseline, passed at target commit before this run)SDK driver against committed fixtures error-packs-left-out-report-used, error-packs-left-out-requirement-used, error-rules-permission-name-op-dotted, rules-permission-name-package-separator-distinct via MetaDataLoader.fromDirectory with strict:true, composing coreProviders with and without the reporting/requirements packs (driver was a scratch script, executed then deleted; output retained as evidence)meta fmt --check (real CLI binary) on collision fixture in a disposable $DEV_SCRATCH project — exit 1 with ERR_TRANSITION_NAME_COLLISIONmeta fmt + meta fmt --check (real CLI binary) on the separator-distinct fixture — exit 0, model loads and is canonicalmeta types --format json and meta types report (real CLI binary) — pack-owned vocabulary and folded-attr ownership attribution✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.