Repository navigation
feat(rust): resolve metadata dependencies in the Rust loader - #701
Merged
Merged
Conversation
resolve_collection loads each declared dependency from its committed snapshot, verified against .metaobjects/deps.lock.json (stale, metamodel and node-collision refusals), and Collection gains the imported, in_scope, in_ledger and in_migrate_scope predicates. cargo meta gen generates nothing for an imported object unless scope.include names its package, and refuses a new node declared into a dependency's package (ERR_DEPENDENCY_PACKAGE_NOT_OWNED). Rust now runs the resolution arm of fixtures/dependency-conformance (all 36 cases, the 7 ledger cases included) and fixtures/scope-conformance. The check arm (verify --deps) is not built yet. SHA-256 moves into the metaobjects crate; metaobjects-codegen re-exports it.
dmealing
added a commit
that referenced
this pull request
Dec 3, 2026
* fix(ci): verify the Rust crates against fresh sibling builds in the publish dry run cargo fingerprints a registry crate by version, not by its source, so a build of the overlay registry's metaobjects 1.3.1 left in a restored target/ was reported Fresh and linked into metaobjects-codegen's verify build, which then failed with E0432 on runners whose cache predated #701. The dry run now uses its own target directory and removes this workspace's crates from it first; scripts/rust-publish-dry-run.sh is the one definition, run by the rust lane and by the release pack-verify. * no-mistakes(document): Docs follow rust publish dry-run script
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
resolve_collectionnow loads declareddependenciesfrom their committed snapshots, verified against.metaobjects/deps.lock.json, ahead of the project's own files. It refuses stale, metamodel-incompatible and node-colliding snapshots.Collectiongainsimported,in_scope,in_ledgerandin_migrate_scope, backed by newmetaobjects::dependenciesandmetaobjects::scopemodules. A declared dependency with no snapshot or lock, previously read and ignored, is nowERR_DEPENDENCY_SNAPSHOT_STALE.Collectionalso gains new fields and can no longer be built with a struct literal.cargo meta genrefuses a new node declared into a dependency-owned package (ERR_DEPENDENCY_PACKAGE_NOT_OWNED) and generates nothing for imported objects unlessscope.includenames their package.verify --depsis still not available in Rust (its message is updated), and requirement ledger membership is exposed only throughdependencies::requirement_ledger.metaobjectscrate;metaobjects-codegenre-exports it and addsmetaobjectsas a build dependency. Rust now runs the resolution arm offixtures/dependency-conformance/and thefixtures/scope-conformance/corpus, and the docs, roadmap and a changelog fragment (with upgrade notes) are updated to match.Validation
Risk Assessment
✅ Low: A Rust-only port that mirrors the Python reference function by function (lock validation, snapshot verification, predicates, ownership refusal, ledger walk), is gated by the shared 36-case and 10-case corpora, and reuses the existing reference-node exclusion mechanism. The one behaviour break (a declared dependency with no lock is now an error) is intended and documented in the changelog.
Testing
Broad regression came from the configured
scripts/ci-local.sh --affected --strict-toolchainsrun, which had already passed and was not repeated. On top of it, I drove the real Rust CLI against a Node-synced dependency in a throwaway project, covering exclusion, opt-in, overlay and the refusal paths, compiled the generated crates, and ran the focused dependency, scope, config and imported-node tests; every scenario passed. The one limitation seen (referencing an imported value object under the default scope) is reported as information. The change has no UI, so the evidence is CLI transcripts. My scratch project was removed and the worktree is clean; no source files changed.meta deps sync, thencargo meta genandverify --codegen: only the project's own objects are generated; a wildcardscope.includeadds nothing,…cargo check -p appexit 0; C: opt-in compiles; D:cargo meta gen Customeris refused w…cargo meta genbefore any sync, after a hand edit of the snapshot, and after declaring a new object into the dependency's package fails with ERR_DEPENDENCY_SNAPSHOT_STALE or ERR_DEPENDENCY_P…cargo test -p metaobjects --test dependency_conformance --test scope_conformance --test config_readerandcargo test -p metaobjects-codegen --test imported_nodes, both exit…Evidence: CLI transcript: sync, generate, refusals, overlay and scope opt-in
Evidence: CLI transcript: references to imported types and compile of generated crates
Evidence: Focused Rust test output (dependency, scope, config reader, imported nodes)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/rust/metaobjects-cli/src/lib.rs:619- Theverify --depsusage error still says "metadata dependencies are resolved and checked by the Nodemetacommand". After this change the Rust loader itself resolves and verifies dependency snapshots (resolve_collection plus deps.lock.json). Only the check arm (meta deps check) remains Node-only. Reword to e.g. "checking metadata dependencies against their publishers is the Nodemetacommand's (meta deps check)". The file is outside the changed set, so this was not fixed inline.server/rust/metaobjects/tests/config_reader.rs:506- The testa_declared_dependency_resolves_against_its_lockasserts that resolution FAILS with ERR_DEPENDENCY_SNAPSHOT_STALE because no lock exists. The name says the opposite of what the test pins. Rename it to e.g.a_declared_dependency_without_a_lock_is_stale.server/rust/metaobjects-codegen/src/project.rs:57- With the default scope, an app entity withfield.object @objectRef: acme::common::Address(a value object exported by a dependency) makescargo meta genfail withERR_RUST_UNSUPPORTED: app::Order.shipTo refers to acme::common::Address, which is not a concrete entity or value object the entity generator emits. Nothing is written, and the message does not mentionscope.include. Addingacme::common::**toscope.includeworks and the generated crates compile, but it generates the whole package. Extending an imported abstract works under the default scope. This follows from reusing the existing reference-node set, and it is not a regression because dependencies were previously ignored. docs/features/metadata-dependencies.md says C# still emits such a reached value object, so this is a candidate follow-up before relying on cross-port reader parity. The same page's list of consuming ports also does not name Rust.meta deps sync, thencargo meta genandverify --codegen: only the project's own objects are generated; a wildcardscope.includeadds nothing,…cargo check -p appexit 0; C: opt-in compiles; D:cargo meta gen Customeris refused w…cargo meta genbefore any sync, after a hand edit of the snapshot, and after declaring a new object into the dependency's package fails with ERR_DEPENDENCY_SNAPSHOT_STALE or ERR_DEPENDENCY_P…cargo test -p metaobjects --test dependency_conformance --test scope_conformance --test config_readerandcargo test -p metaobjects-codegen --test imported_nodes, both exit…scripts/ci-local.sh --affected --strict-toolchainsBroad regression came from the configured test commandscripts/ci-local.sh --affected --strict-toolchains, which already ran and passed at this commit; it was not re-runMO_CI_LIST_ONLY=1 scripts/ci-local.sh --affected --strict-toolchains(listing only: confirms the rust lane is among the selected lanes)cargo build -p metaobjects-clicargo meta init, thenmeta deps sync(Node) andcargo meta gen/cargo meta verify --codegenon a throwaway consumer projectcargo meta gen --forceandcargo meta verifyafter tampering with the snapshot and after declaring a new object intoacme::commoncargo meta gen --forcewith an overlay, a wildcardscope.include, a namingscope.include, imported references, andcargo meta gen Customercargo check --offline -p appandcargo check --offline -p app -p acme_commonon the generated cratescargo test -p metaobjects --test dependency_conformance --test scope_conformance --test config_readercargo test -p metaobjects-codegen --test imported_nodes🔧 **Document** - 2 issues found → auto-fixed ✅
server/rust/metaobjects-cli/src/lib.rs:619- Thecargo meta verify --depsusage error still says metadata dependencies are "resolved and checked by the Nodemetacommand". The Rust loader now resolves committed snapshots itself, so only the sync and the upstream check are Node's. This is executable text, so the documentation phase did not edit it. R1b, which buildsverify --deps, would replace it.spec/roadmap.md:427- This was stale before this change. The FR-023 paragraph's "Still deferred" list still names thenpm/python/maven/nugettransports and Java/Kotlin/C# as consumers or publishers, which contradicts the same paragraph and docs/features/metadata-dependencies.md. A follow-up could reduce the paragraph to a short pointer to that page. Only the Rust consumer note and the stale corpus count were changed here.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.