-
Notifications
You must be signed in to change notification settings - Fork 1
fix(pr-review): FORCE_REVIEW bypasses the ci-failing gate (self-host break-glass #619) #1230
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
103b8e9
fix(pr-review): let FORCE_REVIEW bypass the ci-failing gate (self-hos…
don-petry 2262e70
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot 92a5543
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot d6c940e
Merge branch 'main' into fix/pr-review-force-review-ci-gate-619
don-petry 2f88530
fix(bot): address bot feedback [skip ci-relay]
donpetry-bot 6f9ad88
Merge branch 'main' into fix/pr-review-force-review-ci-gate-619
don-petry 1257363
Merge branch 'main' into fix/pr-review-force-review-ci-gate-619
don-petry 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env bats | ||
| # Guards the #619 break-glass in scripts/review-one-pr.sh: | ||
| # a manual FORCE_REVIEW=true run overrides the ci-failing gate (so a fix to the | ||
| # CI gate itself can be reviewed through ring-0 self-host), while a normal run | ||
| # still skips on failing CI. FORCE_REVIEW is manual-only (repository_dispatch / | ||
| # explicit input); the scheduled sweep dispatches with force_review=false. | ||
|
|
||
| setup() { | ||
| REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)" | ||
| export REVIEW_SCRIPT="$REPO_ROOT/scripts/review-one-pr.sh" | ||
| export SHA="deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" | ||
| export PR_URL="https://github.com/petry-projects/.github-private/pull/999" | ||
| export TEST_DIR="$BATS_TEST_TMPDIR" | ||
| mkdir -p "$TEST_DIR/bin"; cd "$TEST_DIR" | ||
| # A single external check FAILED -> compute_ci_status classifies "failing". | ||
| cat > "$TEST_DIR/snapshot.json" <<EOF | ||
| { | ||
| "headRefOid": "$SHA", | ||
| "statusCheckRollup": [ | ||
| { "name": "dev-lead / dispatch", "status": "COMPLETED", "conclusion": "FAILURE" } | ||
| ], | ||
| "reviewDecision": "", | ||
| "reviews": [], | ||
| "labels": [], | ||
| "comments": [] | ||
| } | ||
| EOF | ||
| cat > "$TEST_DIR/bin/gh" <<EOF | ||
| #!/bin/bash | ||
| if [ "\$1" = "pr" ] && [ "\$2" = "view" ]; then cat "$TEST_DIR/snapshot.json"; exit 0; fi | ||
| exit 0 | ||
| EOF | ||
| chmod +x "$TEST_DIR/bin/gh" | ||
| # Stub engines so a bypassed run can't block on a real CLI. | ||
| for e in claude copilot gemini; do printf '#!/bin/bash\nexit 0\n' > "$TEST_DIR/bin/$e"; chmod +x "$TEST_DIR/bin/$e"; done | ||
| export PATH="$TEST_DIR/bin:$PATH" | ||
| export REVIEW_ENGINE="claude" GH_TOKEN="fake" DRY_RUN="true" | ||
| } | ||
| teardown() { rm -rf "$TEST_DIR"; } | ||
|
|
||
| @test "normal run (no FORCE_REVIEW): failing CI → skip reason=ci-failing, exit 100" { | ||
| unset FORCE_REVIEW | ||
| run timeout 25 bash "$REVIEW_SCRIPT" "$PR_URL" | ||
| [ "$status" -eq 100 ] | ||
| [[ "$output" == *'"reason":"ci-failing"'* ]] | ||
| [[ "$output" != *"bypassing the ci-failing gate"* ]] | ||
| } | ||
|
|
||
| @test "FORCE_REVIEW=true: failing CI → ci-failing gate bypassed (break-glass #619)" { | ||
| export FORCE_REVIEW="true" | ||
| run timeout 25 bash "$REVIEW_SCRIPT" "$PR_URL" | ||
| # Must NOT emit the ci-failing skip; must announce the break-glass bypass. | ||
| [[ "$output" != *'"reason":"ci-failing"'* ]] | ||
| [[ "$output" == *"bypassing the ci-failing gate"* ]] | ||
|
don-petry marked this conversation as resolved.
|
||
| [ "$status" -ne 100 ] | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.