Skip to content

fix(release): make astrid-sys cargo-publishable (unblocks v0.7.0 workspace publish) - #49

Merged
joshuajbouw merged 2 commits into
mainfrom
fix/publish-astrid-sys-wit-path
May 25, 2026
Merged

fix(release): make astrid-sys cargo-publishable (unblocks v0.7.0 workspace publish)#49
joshuajbouw merged 2 commits into
mainfrom
fix/publish-astrid-sys-wit-path

Conversation

@joshuajbouw

Copy link
Copy Markdown
Member

Linked Issue

Closes #48

Summary

cargo publish -p astrid-sys failed verifier compile because build.rs reads ../contracts/host/ (the workspace WIT submodule) which isn't part of the .crate tarball. The include = ["../contracts/host/**/*.wit", ...] directive can't reach outside the crate dir — same class of bug as unicity-astrid/astrid#763 and #765.

Blocks the v0.7.0 release of the entire SDK workspace (astrid-sys is the dep-graph root).

Changes

  • astrid-sys/.gitignore: drop wit-staging/ entry. The staged WIT now ships in the crate.
  • astrid-sys/build.rs: short-circuits when ../contracts/host/ doesn't exist OR contains no .wit files (uninitialised submodule). Workspace builds clean+re-stage as before; published / consumer builds use the committed wit-staging/ directly.
  • astrid-sys/Cargo.toml: include drops ../contracts/host/**/*.wit (cargo can't honor .. paths), adds wit-staging/**/*.wit.
  • Commit wit-staging/: 15 files (root.wit placeholder + 13 per-domain WIT under deps/astrid-*/).

Test Plan

  • cargo check -p astrid-sys clean
  • cargo publish -p astrid-sys --dry-run --allow-dirty packages + verifier-compiles cleanly
  • cargo workspaces publish --from-git resumes from astrid-sys after merge + re-tag

Release coordination

v0.7.0 is already tagged but cargo workspaces publish failed verifier on astrid-sys (the first crate in dep order). After this merges, force-update v0.7.0 to the merge commit, then retry cargo workspaces publish --from-git. No version bump — the published crate contents under 0.7.0 are functionally identical (Cargo.toml + build.rs + bundled WIT only).

Checklist

  • Linked to an issue
  • CHANGELOG.md updated — N/A, no functional change

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the astrid-sys build process to support both workspace builds (where the contracts/host submodule is present) and published builds (where the submodule is absent). It achieves this by checking for the presence of WIT files in the submodule path and conditionally skipping the staging step, relying instead on a committed copy of the WIT files in wit-staging/. A critical issue was identified in build.rs where returning early when WIT files are missing fails to register Cargo watches on the submodule directory and .gitmodules, which would prevent Cargo from detecting when the submodule is subsequently initialized.

Comment thread astrid-sys/build.rs
Closes #48

`cargo publish -p astrid-sys` failed verifier compile because
`build.rs` reads `../contracts/host/` (the unicity-astrid/wit
workspace submodule) which isn't part of the .crate tarball. The
`include = ["../contracts/host/**/*.wit", ...]` directive was meant
to bundle it but cargo silently ignores `..` paths in include.

Same class as astrid-runtime/astrid#763 (astrid-capsule wit) and #765
(astrid-cli apparmor). Cargo's include can't reach outside the crate
dir; published crates must be self-contained.

Fix:
- Commit wit-staging/ to the crate (drop from .gitignore). 14 staged
  WIT files ship in the tarball.
- build.rs becomes tolerant: if ../contracts/host/ doesn't exist OR
  contains no .wit files (uninitialised submodule), short-circuit
  and treat committed wit-staging/ as authoritative.
- Cargo.toml include: drop ../contracts/host path, add wit-staging.

Workspace builds: clean+re-stage from submodule, committed copy
stays in lockstep.
Published builds: short-circuit; wit_bindgen::generate! reads the
committed copy directly.

Verified: cargo publish -p astrid-sys --dry-run --allow-dirty
packages and verifier-compiles cleanly. The downstream tier
(astrid-sdk-macros, astrid-sdk) chains on top once astrid-sys
lands on crates.io.
@joshuajbouw
joshuajbouw force-pushed the fix/publish-astrid-sys-wit-path branch from 5f79003 to b74c3a1 Compare May 25, 2026 22:34
Gemini #49 finding. The published-crate / uninitialised-submodule
early-return registered `cargo:rerun-if-changed=wit-staging` but
not the submodule path or `.gitmodules`. After a developer runs
`git submodule update --init` on a fresh clone, Cargo wouldn't
detect the newly-present WIT files and wouldn't rerun build.rs;
the committed wit-staging would stay stale relative to the now-
checked-out submodule.

Now: register the same surface in both code paths (wit-staging,
host_src, build.rs, .gitmodules) so a freshly-initialised submodule
triggers a rebuild.
@joshuajbouw
joshuajbouw merged commit 8859871 into main May 25, 2026
8 checks passed
@joshuajbouw
joshuajbouw deleted the fix/publish-astrid-sys-wit-path branch May 25, 2026 22:40
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.

cargo publish -p astrid-sys fails: build.rs reads contracts/host outside the crate

1 participant