Repository navigation
feat(rust): publish shared model via cargo meta gen - #708
Merged
Merged
Conversation
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.
… agent-context source
…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.
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
shared-modelgenerator tometaobjects-codegen.cargo meta genwrites<name>.metaobjects.jsonandmetaobjects.pkg.json, the artifact and manifest a consumer'smeta deps synccopies. Options match the other ports:name,include,exclude,requirements,files,version. The version defaults to the nearestCargo.tomlorpackage.json.metaobjects::shared_modelengine 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 infixtures/shared-model-conformance/. The generator is registered forcargo meta eject shared-model, and it is listed in the CLI generator help as opt-in.changelog.d/rust-shared-model.md.metamodelVersiondoes not change.Validation
Risk Assessment
✅ Low: The increment changes only docs, comments and regenerated agent-context files. The new version-default sentence matches
nearest_versionin shared_model.rs. All shipped copies, goldens and manifests are byte-identical and named by their sha256 prefix, and no stale3b598be0reference remains.Testing
Baselinescripts/ci-local.sh --affected --strict-toolchainsalready passed at this commit and was not re-run. I drove two live scenarios through the realcargo-metabinary 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 "name" and "include" on its entry in the project's generator list (exit=1, no output written)"}]Evidence: Live publish: generated artifact byte-identical to pinned dependency-conformance artifact
Evidence: Live adversarial: bare shared-model entry refused
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 "...incheck. 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 addedmetaobjects genandcargo meta gento the generator list,cargo meta verify --depsto 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 includedshared-model. That generator writes the shared-model artifact and itsmetaobjects.pkg.jsonmanifest, 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 noversionoption the manifest takes the nearestpackage.jsonversion, else apyproject.toml[project]version". The Rust generator first resolves the nearestCargo.toml([package]/[workspace.package]) version (metaobjects-codegen/src/shared_model.rsnearest_version). Fix: add the Cargo default to the Rust sentence, for example "the version defaults to the nearestCargo.tomlpackage 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 onlymetamodel-docstakes options, and its opt-in list omittedshared-model(anddocs-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.
scripts/ci-local.sh --affected --strict-toolchainscargo test -p metaobjects-codegen --test shared_model(13 passed, 0 failed)cargo build -p metaobjects-clito producecargo-metaLive: disposable project in /mnt/scratch/mo-r2-live with corpus source files and an options-completeshared-modelentry, runcargo-meta gen;cmpof generated/acme-common.metaobjects.json against fixtures/dependency-conformance/artifacts/acme-common-v1.jsonLive adversarial: bare {"generators": ["shared-model"]} entry run viacargo-meta gen; exit 1, ERR_SHARED_MODEL, no output writtenScratch 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:50said 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
Terminatedunder 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 hostedgatescheck runs it again.✅ **Push** - passed
✅ No issues found.