Repository navigation
fix(rust): vendor repo data so the metaobjects crate packages and builds on its own - #614
Merged
Merged
Conversation
The crate embedded the metamodel JSON, the shared error catalogue and the shipped libraries from outside its directory, so the packaged tarball did not compile (and would have embedded no libraries). Vendor them under data/ with a byte-parity test against the source copies, and give the codegen and cli path dependencies a version requirement so they can be packaged once metaobjects is on crates.io.
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.
1.3.0 release-candidate verification
Release SHA:
882f58c63c4add2c4f925f562a021657c2b3017b(main). Nothing published, no version bumped.scripts/ci-local.sh --strict-toolchains(full, every lane)node:22container, 14 packed 1.3.0 tarballs:meta --version,init,gen --list --probe,eject entity queries names barrel,gen,verify --codegen,tsc --noEmit,npm audit@metaobjectsdev/metadata,codegen-ts,runtime-tsdeclared directly, as the docs say)python:3.12:load_directory,metaobjectsCLIcargo packagewith verification,metaobjectsinclude_str!reached outside the crate); passes with itcargo publish --dry-runon a scratch copy withpublishflipped on (the repo keepspublish = false)metaobjectspassesmetaobjects-codegen,metaobjects-clidry run / packagemetaobjectsis on crates.io (they depend on it by version); path deps now carryversion = "0.1.0"This PR is the fix for the Rust packaging failure. no-mistakes took 1 run.
What Changed
metaobjectscrate embeds (spec/metamodel/*.json,fixtures/conformance/ERROR-CODES.json,library/) as byte-identical copies underserver/rust/metaobjects/data/.providers.rs,errors.rs,build.rsand thevalidate/*test fixtures now read fromdata/, socargo packagesees everything the build needs.tests/vendored_data_parity.rs, which fails when a copy differs from its source or when the library file counts diverge. It names thecp/rsynccommand that fixes the drift. Outside the repository it passes without comparing.version = "0.1.0"to the path dependencies inmetaobjects-cliandmetaobjects-codegen, so the workspace crates resolve when packaged. Amends ADR-0065 with Amendment 2, which records the vendoring rule.Validation
Risk Assessment
✅ Low: Mechanical vendoring of embedded data into the Rust crate so it packages standalone. The copies are byte-identical to their sources, and a new parity test guards against drift. Nothing publishes and no version changes.
Testing
The change lets the metaobjects Rust crate package and build alone. Vendored data parity test passes,
cargo packageverifies the extracted tarball, and a scratch consumer built from that tarball loads the shipped ai and iam libraries. Two scenarios pass live. The Rust publish dry run is untested: all three crates set publish = false, so cargo refuses it, and codegen/cli verify needs metaobjects on crates.io. That needs Doug's decision. Broad regression came from the configured test command scripts/ci-local.sh --affected --strict-toolchains, which passed at the target commit. No source changed this turn, so it did not run again.cargo package -p metaobjects: packaged 86 files incl. 30 under data/, verify compile of extracted tarball EX…Evidence: Rust packaging and consumer evidence log for 2b539bf
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
server/rust/metaobjects/Cargo.toml:10-cargo publish --dry-runcannot run on metaobjects, metaobjects-codegen or metaobjects-cli: all three setpublish = false("first crates.io release is a separate, approved step"). The intent asks for a publish dry run on the Rust crates. Options: (a) temporarily flip publish on for the dry run only, (b) acceptcargo packageverify on metaobjects as the proxy and dry-run codegen/cli after metaobjects is on crates.io. Needs Doug's call; no edit made.server/rust/metaobjects-codegen/Cargo.toml:14-cargo package -p metaobjects-codegenverify fails with "no matching package namedmetaobjectsfound" on crates.io. Expected per the commit (codegen and cli need metaobjects published first). Not a regression.cargo package -p metaobjects: packaged 86 files incl. 30 under data/, verify compile of extracted tarball EX…scripts/ci-local.sh --affected --strict-toolchainscargo test -p metaobjects --test vendored_data_parity(in server/rust) — passes against real repo sources (spec/metamodel and library/ present, so the early return is not taken)cargo package -p metaobjects --list— 86 files, 30 under data/cargo package -p metaobjects— packages and verify-compiles the extracted tarball (EXIT 0)scratch consumer crate in DEV_SCRATCH with path dep on target/package/metaobjects-0.1.0;cargo runprints libraries [ai, iam] and iam core sources (EXIT 0)cargo publish --dry-run -p metaobjects|metaobjects-codegen|metaobjects-cli— all refused, publish = false (EXIT 101 each)cargo package -p metaobjects-codegen --list(EXIT 0) andcargo package -p metaobjects-codegen(verify fails, EXIT 101: metaobjects not on crates.io)Cleanup: removed target/package, the scratch consumer crate and target; worktree git status cleanBroad regression: configured test commandscripts/ci-local.sh --affected --strict-toolchainsalready passed at target commit (baseline). Not re-run; no source or test files changed in this turn.🔧 **Document** - 4 issues found → auto-fixed ✅
server/rust/metaobjects/build.rs:1- Module doc said it embeds the repo-rootlibrary/tree and that an absent directory yields an empty embed. The change now embeds the vendoreddata/library/copy, which ships in the packaged crate. Fixed: the header now namesdata/library/and the parity test; the absent-directory sentence was removed.server/rust/metaobjects/src/providers.rs:1- Module doc said the module embedsspec/metamodel/*.jsondirectly. It now embeds the copies underdata/metamodel/. Fixed: the doc names the copies and the parity test.server/rust/metaobjects/src/errors.rs:3- Module doc said the test reads the fixture file. It now readsdata/ERROR-CODES.json. Fixed: the doc names the copy and the parity test.spec/decisions/ADR-0065-rust-is-the-sixth-port.md:31- Judgment call, not fixed. The crate now vendors byte-identical copies of spec/metamodel, fixtures/conformance/ERROR-CODES.json and library/ under server/rust/metaobjects/data/, held by tests/vendored_data_parity.rs. ADR-0065's layout section records none of this, and the decision is cross-cutting: it duplicates the single-source pattern the C# port also uses. Doug should decide whether to record it as an ADR-0065 amendment. Related: the parity test's failure message says onlycopy it againand gives no command. Changing that message is executable behavior, so it is out of scope for this doc phase.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.