Skip to content

ci(guardrails): a switch to skip the tables check's cargo step locally - #1260

Merged
Hona merged 2 commits into
devfrom
ci/guardrails-skip-cargo-locally
Nov 25, 2026
Merged

Hona merged 2 commits into
devfrom
ci/guardrails-skip-cargo-locally

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

scripts/guardrails.sh is described as cheap, but one of its steps starts cargo. tables-check.mjs step 4 runs cargo run -q -p opencode-plugin-spec -- --check, which compiles the spec crate whenever it or its contract changed since the last run. On a machine that must not compile, that step needs an off switch.

What changes

  • scripts/guardrails/tables-check.mjs: with OPENCODE_GUARDRAILS_NO_CARGO=1, step 4 is skipped.
    • It prints SKIP step 4 skipped locally (plugin-spec check runs in CI).
    • The script's last line becomes tables check: ok for 3 of 4 steps (step 4 not run), so a skipped run never reads as a full pass.
  • CI is unchanged. No workflow sets the variable, so a pull request's guardrails check runs step 4 as before.
  • ARCHITECTURE.md: one sentence on the switch beside the step it skips.

What a skipped run does not prove

  • That the generated files match the contract. After an edit of contract.json whose generated files were not written again, a skipped local run passes and only CI fails. The author still needs --write, or CI's red, to find out.

Not changed

  • arch-check.mjs still runs cargo metadata. It reads the crate graph and compiles nothing; whether the switch should cover it too is left open.

Runs

Run Step 4 Last line
Local, variable set SKIP step 4 skipped locally (plugin-spec check runs in CI) tables check: ok for 3 of 4 steps (step 4 not run)
This PR's guardrails check (variable not set) INFO plugin spec: 15 generated files match contract.json 1.10 tables check: ok

Hona added 2 commits November 26, 2026 04:49
tables-check's step 4 runs cargo run -p opencode-plugin-spec -- --check: the one guardrail step that starts cargo, and a compiler whenever that crate or its contract changed since the last run. OPENCODE_GUARDRAILS_NO_CARGO=1 skips it, prints that it did, and the script's last line then says 3 of 4 steps ran. CI does not set the variable, so a pull request's guardrails check runs the step as before.
@Hona
Hona merged commit 43b1d87 into dev Nov 25, 2026
7 checks passed
@Hona
Hona deleted the ci/guardrails-skip-cargo-locally branch November 25, 2026 19:26
Hona added a commit that referenced this pull request Nov 25, 2026
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.

1 participant