#!/usr/bin/env bash # Guard against cross-workspace type drift. # # open-standards is many separate cargo workspaces, and some crates path-depend # on crates in OTHER workspaces (e.g. sandbox-jcp, joule-code-jcp both depend on # jcp/jcp-rs/crates/jcp-schema across the workspace boundary). `cargo test # --workspace` inside one workspace does NOT build the others, so a # required-field change to a shared type (e.g. adding a field to # jcp_schema::Grant) compiles green in its own workspace while silently breaking # every consumer in another. # # Run this before landing any change to a crate path-depended across a workspace # boundary. Scope: only workspaces that build without exotic system libraries are # listed — adding one that needs libjxl / libwebrtc would make this fail for # unrelated reasons. set -euo pipefail cd "$(dirname "$0")/.." WORKSPACES=( jcp/jcp-rs sandbox/sandbox-rs joule-code/joule-code-rs ) fail=0 for ws in "${WORKSPACES[@]}"; do printf ' %-26s ' "$ws" # --all-targets is load-bearing: the shared-type literals that broke are in # #[cfg(test)] code, which a plain `cargo check` does NOT compile. if cargo check --quiet --all-targets --manifest-path "$ws/Cargo.toml" --workspace 2>/tmp/xws.err; then echo 'ok' else echo 'BROKEN' grep -E '^error' /tmp/xws.err | head -3 | sed 's/^/ /' fail=1 fi done [ "$fail" -eq 0 ] && echo 'cross-workspace check passed' || { echo 'cross-workspace check FAILED'; exit 1; }