open-standards/.github/workflows/cross-workspace-check.yml
Transaction Science c353826cec ci: cross-workspace type-drift gate — make the guard actually catch it
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]>
2026-07-25 09:15:35 -04:00

53 lines
1.8 KiB
YAML

name: cross-workspace type-drift gate
# open-standards is many separate cargo workspaces, and some crates path-depend
# on crates in ANOTHER workspace (sandbox-jcp, joule-code-jcp both depend on
# jcp/jcp-rs/crates/jcp-schema across the boundary). `cargo test --workspace`
# inside one workspace never builds the others, so a required-field change to a
# shared type (e.g. a new field on jcp_schema::Grant) is green in its own
# workspace while silently breaking every consumer. This gate builds the
# consuming workspaces together. See scripts/check-cross-workspace.sh.
on:
pull_request:
paths:
- 'jcp/jcp-rs/**'
- 'sandbox/sandbox-rs/**'
- 'joule-code/joule-code-rs/**'
- 'scripts/check-cross-workspace.sh'
- '.github/workflows/cross-workspace-check.yml'
push:
branches: [main]
paths:
- 'jcp/jcp-rs/**'
- 'sandbox/sandbox-rs/**'
- 'joule-code/joule-code-rs/**'
- 'scripts/check-cross-workspace.sh'
- '.github/workflows/cross-workspace-check.yml'
jobs:
cross-workspace:
name: Consumers of shared crates still compile
runs-on: linux
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.97.1"
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
jcp/jcp-rs/target
sandbox/sandbox-rs/target
joule-code/joule-code-rs/target
key: xws-${{ runner.os }}-${{ hashFiles('jcp/jcp-rs/Cargo.lock', 'sandbox/sandbox-rs/Cargo.lock', 'joule-code/joule-code-rs/Cargo.lock') }}
- name: Every consuming workspace compiles
run: bash scripts/check-cross-workspace.sh