Skip to content

feat(rust): publish shared model via cargo meta gen - #708

Merged
dmealing merged 13 commits into
mainfrom
fm/mo-140-w0-r2
Dec 3, 2026
Merged

dmealing merged 13 commits into
mainfrom
fm/mo-140-w0-r2

Conversation

@dmealing

@dmealing dmealing commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • Adds the opt-in shared-model generator to metaobjects-codegen. cargo meta gen writes <name>.metaobjects.json and metaobjects.pkg.json, the artifact and manifest a consumer's meta deps sync copies. Options match the other ports: name, include, exclude, requirements, files, version. The version defaults to the nearest Cargo.toml or package.json.
  • Adds the metaobjects::shared_model engine in the core crate. It handles node selection, the closure check, and both output files, and it is byte-identical with the other ports on all 15 cases in fixtures/shared-model-conformance/. The generator is registered for cargo meta eject shared-model, and it is listed in the CLI generator help as opt-in.
  • Updates the Rust port docs, the CONFORMANCE matrix, and the shipped agent-context and dependency-reference files to describe the shared-model publisher. Adds changelog.d/rust-shared-model.md. metamodelVersion does not change.
Validation

Risk Assessment

✅ Low: The increment changes only docs, comments and regenerated agent-context files. The new version-default sentence matches nearest_version in shared_model.rs. All shipped copies, goldens and manifests are byte-identical and named by their sha256 prefix, and no stale 3b598be0 reference remains.

Testing

Baseline scripts/ci-local.sh --affected --strict-toolchains already passed at this commit and was not re-run. I drove two live scenarios through the real cargo-meta binary on a disposable project: a configured publish, which matches the pinned artifact byte for byte, and a bare entry, which fails loudly as the review-1 fix requires. The 13 focused shared_model Rust tests also pass. I did not run the 15 fixtures/shared-model-conformance cases as a separate runner, so their coverage comes from the 13 tests and the live runs. Overall result: pass.</testing_summary> <parameter name="artifacts">[{"label":"Live publish: generated artifact byte-identical to pinned dependency-conformance artifact","kind":"command-output","content":"gen: 2 files (2 created, 0 updated, 0 unchanged) ... created generated/acme-common.metaobjects.json, created generated/metaobjects.pkg.json; cmp against fixtures/dependency-conformance/artifacts/acme-common-v1.json -> identical"},{"label":"Live adversarial: bare shared-model entry refused","kind":"command-output","content":"cargo meta gen failed: ERR_SHARED_MODEL: the generator shared-model needs the options &#34;name&#34; and &#34;include&#34; on its entry in the project's generator list (exit=1, no output written)"}]

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Configured shared-model entry publishes the pinned acme-common artifact and manifest via cargo-meta gen (local CLI, synthetic corpus project) ✅ pass live cargo-meta gen run in /mnt/scratch/mo-r2-live/proj; cmp of generated artifact vs fixtures/dependency-conformance/artifacts/acme-common-v1.json identical; pkg manifest lists version 1.0.0, metamodelVer…
Bare shared-model entry without name/include fails loudly, no publish (adversarial, review-1 fix) ✅ pass live cargo-meta gen with {"generators": ["shared-model"]} exits 1 with ERR_SHARED_MODEL naming name and include; no generated/ output
Focused shared-model codegen behaviour: opt-in, option refusal, closure, inheritance, version source, own-layer edit republish (13 Rust tests) ✅ pass live cargo test -p metaobjects-codegen --test shared_model: 13 passed
Evidence: Live publish: generated artifact byte-identical to pinned dependency-conformance artifact
gen: 2 files (2 created, 0 updated, 0 unchanged) ... created generated/acme-common.metaobjects.json, created generated/metaobjects.pkg.json; cmp against fixtures/dependency-conformance/artifacts/acme-common-v1.json -> identical
Evidence: Live adversarial: bare shared-model entry refused
cargo meta gen failed: ERR_SHARED_MODEL: the generator shared-model needs the options "name" and "include" on its entry in the project's generator list (exit=1, no output written)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

♻️ Reviewed only the branch's changes since run 01M8YG3NQE5YQE38RYA7E3F991 approved; the rest of the branch carries that approval.

Findings carried from run 01M8YG3NQE5YQE38RYA7E3F991, already decided there:

  • ℹ️ agent-context/skills/metaobjects-fit-assessment/references/capability-sheet.md:39 - Applied inline. The change removed "Python cannot publish, and" but left a stray "Python" at the end of a line. The rendered text read "...in check. Python A JVM classpath read...", which is a broken sentence. I removed the stray word. In the same paragraph, the publish and consume lists still said only "TypeScript, Java, Kotlin and C# publish" and "TypeScript, Python, Java, Kotlin and C# consume". I added Python and Rust as publishers, and Rust as a consumer. I added metaobjects gen and cargo meta gen to the generator list, cargo meta verify --deps to the drift checks, and Rust to the consumers that need Node to sync. All of these match docs/features/metadata-dependencies.md:698-705.
  • ℹ️ docs/features/cli.md:46 - Applied inline. The Rust row said "Twelve generators ship, each writing one crate per metadata package", and the new list included shared-model. That generator writes the shared-model artifact and its metaobjects.pkg.json manifest, not a crate. I added a clause that says so.
  • ℹ️ agent-context/skills/metaobjects-codegen/references/dependencies-and-shared-models.md:45 - The new text says Rust publishes. The default-version sentence just before it still says only "With no version option the manifest takes the nearest package.json version, else a pyproject.toml [project] version". The Rust generator first resolves the nearest Cargo.toml ([package] / [workspace.package]) version (metaobjects-codegen/src/shared_model.rs nearest_version). Fix: add the Cargo default to the Rust sentence, for example "the version defaults to the nearest Cargo.toml package version". Then regenerate the shipped copies, manifests and agent-context-conformance goldens. This is not an inline fix, because it renames the hashed shipped files.
  • ℹ️ server/rust/metaobjects-codegen/src/generator_list.rs:14 - Updated the stale module doc: it said only metamodel-docs takes options, and its opt-in list omitted shared-model (and docs-site).
  • ℹ️ docs/features/metadata-dependencies.md:698 - Added Rust to the sentence listing the ports that publish and consume dependencies. The following text already said Rust "can also publish", but the consume list omitted it.

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Configured shared-model entry publishes the pinned acme-common artifact and manifest via cargo-meta gen (local CLI, synthetic corpus project) ✅ pass live cargo-meta gen run in /mnt/scratch/mo-r2-live/proj; cmp of generated artifact vs fixtures/dependency-conformance/artifacts/acme-common-v1.json identical; pkg manifest lists version 1.0.0, metamodelVer…
Bare shared-model entry without name/include fails loudly, no publish (adversarial, review-1 fix) ✅ pass live cargo-meta gen with {"generators": ["shared-model"]} exits 1 with ERR_SHARED_MODEL naming name and include; no generated/ output
Focused shared-model codegen behaviour: opt-in, option refusal, closure, inheritance, version source, own-layer edit republish (13 Rust tests) ✅ pass live cargo test -p metaobjects-codegen --test shared_model: 13 passed
  • scripts/ci-local.sh --affected --strict-toolchains
  • cargo test -p metaobjects-codegen --test shared_model (13 passed, 0 failed)
  • cargo build -p metaobjects-cli to produce cargo-meta
  • Live: disposable project in /mnt/scratch/mo-r2-live with corpus source files and an options-complete shared-model entry, run cargo-meta gen; cmp of generated/acme-common.metaobjects.json against fixtures/dependency-conformance/artifacts/acme-common-v1.json
  • Live adversarial: bare {"generators": ["shared-model"]} entry run via cargo-meta gen; exit 1, ERR_SHARED_MODEL, no output written
  • Scratch project removed after the run; no background processes started
✅ **Document** - 1 finding, already resolved; no changes needed
  • server/python/src/metaobjects/agent_context/shipped/files/a8d92da9d56dc95d.md:50 said Python cannot publish a shared model. That file is no longer in the tree: the earlier source fix replaced it, and the agent-context source and every shipped copy now say Python publishes. Re-running the repo's regeneration (shipped tree, port copies, conformance goldens) changed nothing, so no commit was needed.
✅ **Lint** - 1 warning, approved: environmental
  • The "site payload is true" gate was killed by the machine partway through (Terminated under heavy load); no test had failed, and every other gate passed. Re-run alone on the same head it passed: 172 of 172 tests, and the payload check reported the file current. Approved on that basis; the hosted gates check runs it again.
✅ **Push** - passed

✅ No issues found.

Add metaobjects::shared_model (build_shared_model, render_shared_model_files),
the five-step publish engine every other port ships: strict standalone load,
scope selection, closure check over extends, ref-bearing attrs and requirement
claims, canonical shared document, core-vocabulary re-load. It runs all 15
cases of fixtures/shared-model-conformance/ byte-identically.

Add the opt-in, ejectable `shared-model` generator to metaobjects-codegen
(options name, include, exclude, requirements, files, version; the version
defaults to the nearest Cargo.toml or package.json), register it for Rust in
the generator registry, and update the port and conformance docs.

metamodelVersion and the registered vocabulary do not move.
…del publish claims

The document fix corrected which ports publish a shared model in the
agent-context source, but the agent-context-conformance goldens that the
TypeScript and Rust assemblers reproduce byte for byte were not regenerated.
Regenerated with sdk/scripts/regen-agent-context-conformance.ts; only the
two corrected passages change.
The Rust shared-model generator reads the nearest Cargo.toml [package] or
[workspace.package] version before package.json. Say so in the shared-models
reference, and regenerate the shipped agent-context copies and the
agent-context conformance goldens with the repo scripts.
@dmealing
dmealing merged commit 29d7c37 into main Dec 3, 2026
11 checks passed
@dmealing
dmealing deleted the fm/mo-140-w0-r2 branch December 3, 2026 18:49
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