Repository navigation
fix(check): honor bin/check's documented exit-75/79 grading contract #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
developerz-ai
wants to merge
1
commit into
main
Choose a base branch
from
dz/make-bin-check-honor-its-documented-grading--c2e9755d
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+634
−58
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,78 @@ | ||
| #!/usr/bin/env bash | ||
| # The one gate: the same checks CI runs, run from the same directory. | ||
| # | ||
| # Exit contract (.claude/skills/verify-change/SKILL.md): | ||
| # 0 every check ran and passed | ||
| # 75 a tool the gate NEEDS is missing — it refused to grade; the environment | ||
| # is at fault, never the change | ||
| # 79 every check the gate RAN passed, but an optional CI gate (shellcheck or | ||
| # cargo audit) is not installed here — commit and let CI grade the rest | ||
| # 1 (any other non-zero) a check that ran failed — the change is red | ||
| set -euo pipefail | ||
|
|
||
| cd "$(dirname "$0")/.." | ||
|
|
||
| cargo fmt --check | ||
| cargo clippy --locked --all-targets -- -D warnings | ||
| cargo test --locked | ||
| # Preconditions FIRST, each with the fix: without these a missing tool would | ||
| # look like a red change. | ||
| missing_tools=0 | ||
| require() { | ||
| if command -v "$1" >/dev/null 2>&1; then | ||
| return 0 | ||
| fi | ||
| printf 'bin/check: cannot grade — %s is not installed.\n fix: %s\n' "$1" "$2" >&2 | ||
| missing_tools=$((missing_tools + 1)) | ||
| } | ||
|
|
||
| require cargo "install the Rust toolchain (https://rustup.rs), then re-run bin/setup" | ||
| require rustfmt "rustup component add rustfmt" | ||
| require cargo-clippy "rustup component add clippy" | ||
|
|
||
| if [ "$missing_tools" -ne 0 ]; then | ||
| echo "bin/check: exiting 75 — a tool the gate needs is missing; the environment is at fault, not the change." >&2 | ||
| exit 75 | ||
| fi | ||
|
|
||
| failed=() | ||
| skipped=() | ||
|
|
||
| run() { | ||
| local name="$1" | ||
| shift | ||
| echo "==> $name: $*" | ||
| if ! "$@"; then | ||
| failed+=("$name") | ||
| fi | ||
| } | ||
|
|
||
| # CI's two optional gates (ci.yml `audit` and `shellcheck`). A tool that is not | ||
| # installed here is a named SKIP — never a silent pass, never a red. | ||
| run_optional() { | ||
| local tool="$1" | ||
| local name="$2" | ||
| shift 2 | ||
| if ! command -v "$tool" >/dev/null 2>&1; then | ||
| echo "SKIP: $name — $tool is not installed here; CI runs it (.github/workflows/ci.yml)" | ||
| skipped+=("$name") | ||
| return 0 | ||
| fi | ||
| run "$name" "$@" | ||
| } | ||
|
|
||
| run fmt cargo fmt --check | ||
| run clippy cargo clippy --locked --all-targets -- -D warnings | ||
| run test cargo test --locked | ||
| run_optional cargo-audit "cargo audit" cargo audit | ||
| run_optional shellcheck shellcheck shellcheck bin/* deploy/install.sh deploy/debian/postinst \ | ||
| .githooks/pre-commit .claude/hooks/*.sh .github/scripts/*.sh | ||
|
|
||
| if [ "${#failed[@]}" -ne 0 ]; then | ||
| printf 'bin/check: FAILED: %s — the change is red\n' "${failed[*]}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "${#skipped[@]}" -ne 0 ]; then | ||
| printf 'bin/check: exiting 79 — every check that ran passed; CI grades: %s\n' "${skipped[*]}" >&2 | ||
| exit 79 | ||
| fi | ||
|
|
||
| echo "bin/check: all checks passed" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
major · bug With rustup installed but rustfmt or clippy absent from the selected toolchain,
command -vfinds rustup's proxies, so the guard passes and the gate returns 1 instead of 75. Probe the selected tools' availability before grading and add a regression case with present proxies but missing components.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: The required fix belongs in bin/check:19-28: its command -v-only prerequisite check accepts unusable rustup proxies, and a simulated proxy run reaches grading and exits 1. This round's enforced write lock refuses edits to bin/check, so neither the implementation nor a passing regression test can be delivered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The decline does not hold at
8006fc718b6b: the finding still stands atbin/check:19. The prerequisite guard still uses only command -v, so present rustup proxies pass even when the selected toolchain lacks rustfmt or clippy. Their later failures are recorded as failed checks and exit 1 rather than 75; no component-availability probe or proxy regression case was added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: The finding is real and I reproduced it (with rustup-style rustfmt/cargo-clippy proxies on PATH that exit non-zero, bin/check's guard at bin/check:19
command -v "$1"passes and the gate exits 1, not 75). The only fix is in bin/check itself — probe the tools instead of resolving them at bin/check:18-28 — but that file is write-locked this round: code_edit on bin/check is refused with 'bin/check is the repository's own gate (main already has it) … the land refuses any change to it', even after widen_file_set (PRRT_kwDOTGUmXc65XE7L) returned granted. tests/dev_scripts.rs (in my set) can only add the regression case, which would fail against the unchanged guard and turn the gate red. The fix needs a separate pull request that a person opens against bin/check.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The decline does not hold at
8006fc718b6b: the finding still stands atbin/check:19. The prerequisite guard still checks only command -v, so rustup proxies pass even when the selected toolchain lacks rustfmt or clippy. Subsequent component failures are recorded as failed checks and exit 1 rather than 75; no availability probe or proxy regression test was added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: The defect remains at bin/check:19, where the required-tool guard uses
command -v; correcting it requires changing bin/check, but this run explicitly refuses writes to that locked gate file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: The finding is valid: bin/check:19-28 only uses command -v, which accepts rustup proxies without verifying the selected rustfmt/clippy components. This run obtained widening authorization, but the platform's write lock then refused the required bin/check edit; no other file can safely correct the gate's exit-75 behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: The required implementation is bin/check:18-28, whose command -v guard accepts rustup proxies without selected components. I requested widening and it was granted, but the harness then refused the bin/check edit as write-locked; no source change can correct this behavior in this round.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: The finding is valid: bin/check:19-28 only uses command -v, which accepts rustup proxy binaries without their selected components. The required fix is in bin/check, but this round's platform write lock explicitly refuses changes to that file even after widen_file_set returned it to the existing set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this: Confirmed: bin/check:18-28 checks only command -v, which accepts rustup proxies even when the selected toolchain lacks rustfmt or clippy; failures then reach the exit-1 grading path at bin/check:61-70. The required fix is in bin/check, explicitly write-locked by this round's brief; it must be unlocked or changed in a separate permitted PR, together with a present-proxy/missing-component regression in tests/dev_scripts.rs.