Two fixes on top of the checkpointed script: 1. `--all-targets` (the load-bearing fix). The checkpointed script used `cargo check --workspace`, which does NOT compile #[cfg(test)] code — and the shared-type literals that actually broke (sandbox-jcp, joule-code-jcp) live in test modules. So the guard as checkpointed would have passed while main was broken. Verified the corrected guard by deleting a `budget_funds` field from a test literal: it now fails red with the exact E0063 in `lib test`, and passes green when restored. 2. The CI workflow. `runs-on: linux` per the fleet doctrine (self-hosted forgejo runner; the repo family never uses ubuntu-latest). Triggers only on changes under the three consuming workspaces or the script. NOTE: the seven existing workflows in this repo use `runs-on: ubuntu-latest`, which contradicts that doctrine — they may be legacy/non-firing; worth a separate look. This gate may stay dormant until the repo's Actions unit is enabled, but it is doctrine-correct and the script it runs is proven independently of CI. Guards the class of break that required PRs #36 and #43 to repair: a required field added to a crate that is path-depended across a workspace boundary. Co-Authored-By: Claude Opus 4.8 <[email protected]>
38 lines
1.4 KiB
Shell
Executable file
38 lines
1.4 KiB
Shell
Executable file
#!/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; }
|