ci: skip removed files in validate and review-hook workflows#587
Merged
Conversation
Both workflows pulled the changed-files list from the GitHub PR files API without filtering by `status`, so any removal-shaped PR caused: - `validate.py` to receive a path that no longer exists on the PR head, failing with FileNotFoundError before any schema check could run. - `review-hook` to ask Claude to verify a file against on-chain source that no longer exists in the PR tree. Filter the API response with `select(.status != "removed")`. In `validate.yml`, also reshuffle so the "one file, all under hooks/" diff policy still runs on the full changed-files list before the early-exit on "nothing to schema-validate" — otherwise a PR could remove a hook and modify a non-hook file in the same commit and bypass policy. Hook addition/modification PRs behave identically to before. Pure removal PRs now early-exit SUCCESS on both required checks instead of crashing on FileNotFoundError. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Both
validate.ymlandreview-hook.ymlquery the GitHub PR files API without filtering bystatus. Removal-shaped PRs (e.g., reverting a hook entry) crash because:validate.pyreceives a path that no longer exists on the PR head and fails withFileNotFoundError.review-hookwould ask Claude to verify a file against on-chain source even though the file is gone from the PR tree.Surfaced while reverting #580 (the
0x0f7f…ShitGiftHook entry the submitter asked to drop after merge) — see PR #585, whosevalidatecheck is currently red purely from this bug.Fix
select(.status != "removed")in both workflows.validate.yml, reshuffle so the exact-diff policy (onlyhooks/**, exactly one file) still runs on the full changed-files list before the early-exit on "nothing to schema-validate." A naive filter-then-early-exit would let a PR remove a hook + modify a non-hook file and bypass policy.Behavior matrix
Test plan
validatecheck passes on this PR (no hooks/ touched → early-exit SUCCESS)reviewcheck passes on this PR (no hooks/ touched → claude-action skipped, job SUCCESS)validate+reviewearly-exit SUCCESS for that removal PR