Repository navigation
test(governance): exercise multiline CodeRabbit pending notice #1448
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
Changes from all commits
f6aa846
0b1b177
1b1f679
95b664f
1a5d33c
874c098
068aefd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,7 +140,7 @@ if [ "$1" = "api" ] && [[ "$2" == repos/*/commits/*/check-runs* ]]; then | |
| coderabbit_pending) | ||
| printf '{"check_runs":[{"name":"CodeRabbit","app":{"slug":"coderabbitai"},"status":"in_progress","conclusion":null,"html_url":"https://checks/coderabbit"}]}' | ||
| ;; | ||
| missing_coderabbit|missing_coderabbit_with_adversarial_approval|missing_coderabbit_stale_approval|missing_coderabbit_actions_approval|missing_coderabbit_one_probe|opencode_reviews_error|coderabbit_status_success|coderabbit_status_pending|coderabbit_status_failed|coderabbit_status_unknown|coderabbit_approval_pending_comment|coderabbit_approval_pending_walkthrough|coderabbit_multiline_approval_pending_comment|github_code_quality_approval_pending_comment|coderabbit_stale_head_with_unrelated_current_sha) | ||
| missing_coderabbit|missing_coderabbit_with_adversarial_approval|missing_coderabbit_stale_approval|missing_coderabbit_actions_approval|missing_coderabbit_one_probe|opencode_reviews_error|coderabbit_status_success|coderabbit_status_pending|coderabbit_status_failed|coderabbit_status_unknown|coderabbit_approval_pending_comment|coderabbit_approval_pending_walkthrough|coderabbit_multiline_approval_pending_comment|coderabbit_multiline_json_approval_pending_comment|github_code_quality_approval_pending_comment|coderabbit_stale_head_with_unrelated_current_sha|coderabbit_current_head_mixed_approval_pending_blocking_comment) | ||
| printf '{"check_runs":[]}' | ||
| ;; | ||
| coderabbit_failed) | ||
|
|
@@ -243,13 +243,13 @@ if [ "$1" = "api" ] && [[ "$args" == *repos/*/issues/42/comments* ]]; then | |
| coderabbit_approval_pending_walkthrough) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nCodeRabbit has no unresolved comments, but it has not reviewed the latest commit.\\nCodeRabbit will approve the changes if it finds no pre-merge blocking issues.\\n- [ ] {\\\"headCommitId\\\":\\\"0123456789abcdef0123456789abcdef01234567\\\"}\\n<!-- approval_notice_end -->\\n<!-- walkthrough_start -->\\nGeneric walkthrough terms: Failure, Warning, Potential issue, and blocking comments are described here.\\n<!-- walkthrough_end -->"}]' | ||
| ;; | ||
| coderabbit_multiline_approval_pending_comment) | ||
| coderabbit_multiline_json_approval_pending_comment) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nheadCommitId:\\n0123456789abcdef0123456789abcdef01234567\\n<!-- approval_notice_end -->"}]' | ||
| ;; | ||
| coderabbit_stale_head_with_unrelated_current_sha) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nPotential issue remains under review.\\n- [ ] {\\"headCommitId\\":\\"old-head\\"}\\nThe current head is 0123456789abcdef0123456789abcdef01234567, but this is unrelated prose.\\n<!-- approval_notice_end -->"}]' | ||
| ;; | ||
| coderabbit_mixed_approval_pending_blocking_comment) | ||
| coderabbit_current_head_mixed_approval_pending_blocking_comment) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nheadCommitId: old-head\\nBlocking issue: the current parser can cross tenant boundaries.\\nCurrent head is 0123456789abcdef0123456789abcdef01234567 in unrelated prose.\\n<!-- approval_notice_end -->"}]' | ||
| ;; | ||
| coderabbit_current_failure_approval_notice) | ||
|
|
@@ -261,6 +261,12 @@ if [ "$1" = "api" ] && [[ "$args" == *repos/*/issues/42/comments* ]]; then | |
| coderabbit_current_potential_issue_approval_notice) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nheadCommitId: 0123456789abcdef0123456789abcdef01234567\\nPotential issue: the current parser can cross tenant boundaries.\\n<!-- approval_notice_end -->"}]' | ||
| ;; | ||
| coderabbit_multiline_approval_pending_comment) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nCodeRabbit has no unresolved comments, but it has not reviewed the latest commit.\\nCodeRabbit will approve the changes if it finds no blocking issues.\\n- [ ] {\\"headCommitId\\":\\n \\"0123456789abcdef0123456789abcdef01234567\\"}\\n<!-- approval_notice_end -->"}]' | ||
| ;; | ||
| coderabbit_mixed_approval_pending_blocking_comment) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nCodeRabbit has no unresolved comments, but it has not reviewed the latest commit.\\nBlocking issue: the current parser can cross tenant boundaries.\\n- [ ] {\\"headCommitId\\":\\"0123456789abcdef0123456789abcdef01234567\\"}\\n<!-- approval_notice_end -->"}]' | ||
| ;; | ||
|
Comment on lines
+264
to
+269
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Added multiline notice fixtures never run The added stub branches Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| coderabbit_malformed_approval_pending_comment) | ||
| printf '[{"id":777,"user":{"login":"coderabbitai[bot]"},"created_at":"2026-05-19T00:01:00Z","body":"<!-- approval_notice_start -->\\n## Approval pending\\nPotential issue for 0123456789abcdef0123456789abcdef01234567"}]' | ||
| ;; | ||
|
|
@@ -713,6 +719,37 @@ assert_invalid_pr_number_fails_closed_without_gh_calls() { | |
| fi | ||
| } | ||
|
|
||
| assert_invalid_repository_fails_closed_without_gh_calls() { | ||
| local temp_dir status | ||
| temp_dir="$(mktemp -d)" | ||
| mkdir -p "$temp_dir/bin" | ||
| make_fake_gh "$temp_dir/bin" | ||
| : > "$temp_dir/gh.log" | ||
| set +e | ||
| GH_LOG="$temp_dir/gh.log" \ | ||
| GH_SCENARIO="pass" \ | ||
| PATH="$temp_dir/bin:$PATH" \ | ||
| GITHUB_REPOSITORY='owner/repo;echo injected' \ | ||
| GH_TOKEN="fake" \ | ||
| EVENT_NAME="workflow_dispatch" \ | ||
| DIRECT_PR_NUMBER="42" \ | ||
| TARGET_PR_NUMBER="" \ | ||
| WORKFLOW_RUN_PR_NUMBER="" \ | ||
| bash "$script" > "$temp_dir/output.txt" 2>&1 | ||
| status=$? | ||
| set -e | ||
|
|
||
| if [ "$status" != "1" ]; then | ||
| printf 'expected exit 1 for invalid repository identity, got %s\n' "$status" >&2 | ||
| return 1 | ||
| fi | ||
| assert_in_file 'Repository identity is invalid; refusing to evaluate.' "$temp_dir/output.txt" | ||
| if [ -s "$temp_dir/gh.log" ]; then | ||
| printf 'expected no gh invocations for invalid repository identity\n' >&2 | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| assert_evaluation_error_publishes_gate_failure() { | ||
| local temp_dir | ||
| temp_dir="$(mktemp -d)" | ||
|
|
@@ -764,7 +801,7 @@ assert_coderabbit_approval_pending_walkthrough_does_not_block() { | |
| assert_multiline_coderabbit_approval_pending_notice_does_not_block() { | ||
| local temp_dir | ||
| temp_dir="$(mktemp -d)" | ||
| run_gate coderabbit_multiline_approval_pending_comment "$temp_dir" | ||
| run_gate coderabbit_multiline_json_approval_pending_comment "$temp_dir" | ||
|
|
||
| assert_exit_code 0 "$temp_dir" | ||
| assert_in_file 'Waiting for current-head CodeRabbit evidence' "$temp_dir/output.txt" | ||
|
|
@@ -786,7 +823,7 @@ assert_stale_coderabbit_head_with_unrelated_current_sha_blocks() { | |
| assert_mixed_coderabbit_approval_pending_notice_blocks() { | ||
| local temp_dir | ||
| temp_dir="$(mktemp -d)" | ||
| run_gate coderabbit_mixed_approval_pending_blocking_comment "$temp_dir" | ||
| run_gate coderabbit_current_head_mixed_approval_pending_blocking_comment "$temp_dir" | ||
|
|
||
| assert_exit_code 0 "$temp_dir" | ||
| assert_in_file 'Current-head CodeRabbit issue comment has blocking warning/failure evidence' "$temp_dir/gh.log" | ||
|
|
@@ -1061,14 +1098,15 @@ assert_coderabbit_skip_with_blocking_language_blocks | |
| assert_unrecognized_required_check_state_blocks | ||
| assert_pr_checks_error_is_not_published_verbatim | ||
| assert_invalid_pr_number_fails_closed_without_gh_calls | ||
| assert_invalid_repository_fails_closed_without_gh_calls | ||
| assert_evaluation_error_publishes_gate_failure | ||
| assert_coderabbit_blocking_issue_comment_blocks | ||
| assert_coderabbit_approval_pending_notice_does_not_block | ||
| assert_coderabbit_approval_pending_walkthrough_does_not_block | ||
| assert_multiline_coderabbit_approval_pending_notice_does_not_block | ||
| assert_coderabbit_approval_pending_walkthrough_does_not_block | ||
| assert_stale_coderabbit_head_with_unrelated_current_sha_blocks | ||
| assert_mixed_coderabbit_approval_pending_notice_blocks | ||
| assert_current_coderabbit_approval_notice_findings_block | ||
| assert_mixed_coderabbit_approval_pending_notice_blocks | ||
| assert_malformed_coderabbit_approval_pending_notice_blocks | ||
| assert_github_code_quality_approval_pending_notice_does_not_block | ||
| assert_github_code_quality_blocking_issue_comment_blocks | ||
|
|
||
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.
📝 Info: Repository identity guard is sound
The added guard
^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$requires exactly one slash and rejects shell metacharacters, running before OWNER/REPO extraction so malformed values fail closed before anyghcall. Behaves as intended.Was this helpful? React with 👍 or 👎 to provide feedback.