Skip to content

feat(create-pr): replace check-conflicts with preflight-check, add wait-for-merge - #578

Merged
baleen37 merged 9 commits into
mainfrom
improve/create-pr-preflight
Mar 26, 2026
Merged

feat(create-pr): replace check-conflicts with preflight-check, add wait-for-merge#578
baleen37 merged 9 commits into
mainfrom
improve/create-pr-preflight

Conversation

@baleen37

@baleen37 baleen37 commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Summary

Replace check-conflicts.sh with broader preflight-check.sh (adds BEHIND detection + branch protection advisory) and add wait-for-merge.sh for post-PR merge completion. Simplifies SKILL.md from 8 steps to 5.

Changes

  • Add preflight-check.sh: BEHIND + conflict + advisory branch protection checks before push
  • Add wait-for-merge.sh: blocks on gh pr checks --watch, handles MERGED/OPEN/CLOSED states
  • Delete check-conflicts.sh and its dedicated test file
  • Update SKILL.md: 8-step → 5-step workflow, updated Overview and Stop Conditions
  • Add integration tests (BEHIND, conflict, clean scenarios) using temporary git repos

Tests

  • 54/54 BATS tests passing
  • Integration tests verify real git operations (bare repo + clones)
  • E2E verification: reference integrity, script existence, no orphan references

Summary by CodeRabbit

  • Documentation

    • Updated PR automation workflow to a streamlined pre-flight → commit → push → PR → wait-for-merge flow.
  • Refactor

    • Moved conflict detection into a blocking pre-flight check and replaced multi-step PR verification with a single merge-wait step, simplifying failure conditions and recovery.
  • Tests

    • Added tests covering the new pre-flight and merge-wait behaviors; removed tests for the previous conflict-check step.

Test User added 7 commits March 26, 2026 10:55
…provement

Skill for improving a file (prompt, config, template) toward reference
quality through repeated single-change A/B testing. Each iteration makes
exactly one change, tests it against reference examples via parallel
generation + judge evaluation, and adopts only what works.

Key design decisions:
- One change per iteration (bundled changes hide what helped/hurt)
- Dynamic next-change based on judge feedback (not pre-planned list)
- Same inputs every iteration for valid comparison
- Adopt on TIE (change that doesn't hurt is worth keeping)
- Stop after 2+ consecutive rejections (rethink approach)
Replace eval-specific iterative-eval with a general-purpose iterate
skill. Works for any incremental improvement: prompts, code, configs,
docs — anything where you can verify whether a change helped.

Key design:
- One change per iteration (clear signal)
- Pluggable verification (test, build, judge, user, metric, composite)
- Feedback-driven next change (not pre-planned)
- Stop on 2+ consecutive rejections

BREAKING CHANGE: removes iterative-eval skill
Replaced by preflight-check.sh (Task 2). Tests migrated to
test_create_pr_verify_status.bats (Task 1).
@baleen37
baleen37 enabled auto-merge (squash) March 26, 2026 02:40
@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@baleen37 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c0a347ba-cf87-4589-aaa5-0b2c456ed122

📥 Commits

Reviewing files that changed from the base of the PR and between 033c34f and 1fd86a0.

📒 Files selected for processing (1)
  • tests/me/me-specific.bats
📝 Walkthrough

Walkthrough

The create-pr workflow was simplified: the standalone conflict check and verify-pr-status steps were removed and replaced by a blocking preflight-check before push and a wait-for-merge step after PR creation. Documentation, two new scripts, and tests were updated accordingly.

Changes

Cohort / File(s) Summary
Documentation
plugins/me/skills/create-pr/SKILL.md
Updated documented workflow sequence to reflect removal of the separate conflict-check and verify steps, and introduction of preflight-check.sh and wait-for-merge.sh.
Removed Automation Scripts
plugins/me/skills/create-pr/scripts/check-conflicts.sh
Deleted the standalone conflict-detection script (logic for merge-tree conflict detection and distinct exit codes removed).
New Automation Scripts
plugins/me/skills/create-pr/scripts/preflight-check.sh, plugins/me/skills/create-pr/scripts/wait-for-merge.sh
Added preflight-check.sh (pre-push validation: behind/conflict detection, branch-protection advisory, exit codes 0/1/2) and wait-for-merge.sh (post-PR creation CI monitoring and final PR-state handling).
Test Updates
tests/skills/test_check_conflicts.bats, tests/skills/test_create_pr_verify_status.bats
Removed tests for deleted check-conflicts.sh; added Bats tests validating executability, shebang, set -euo pipefail, documented exit codes, negative cases (non-git), and integration scenarios for preflight-check.sh and wait-for-merge.sh.

Sequence Diagram

sequenceDiagram
    participant User as User/Automation
    participant Local as Local Repo/Script
    participant Origin as Git Origin
    participant GitHub as GitHub
    participant CI as CI System

    User->>Local: run create-pr workflow
    Local->>Origin: preflight-check: fetch origin/base
    Origin-->>Local: remote state
    Local->>Local: check behind/conflicts & query branch protection
    alt preflight fails (behind/conflict)
        Local-->>User: exit non-zero with advisory
    else preflight passes
        Local->>Local: commit changes
        Local->>Origin: push branch
        Origin-->>Local: push OK
        Local->>GitHub: create PR + enable auto-merge
        GitHub-->>Local: PR created
        Local->>GitHub: wait-for-merge: gh pr checks --watch
        GitHub->>CI: run/check CI
        CI-->>GitHub: checks complete
        GitHub-->>Local: PR merged or open/blocked
        Local-->>User: finish (success or error)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A nimble hop through branches green,

I check for conflicts, keep things clean;
No dual verify, we push and plea,
Then wait for CI — merge, set free! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: replacing check-conflicts.sh with preflight-check.sh and adding wait-for-merge.sh, which aligns with the core modifications documented in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve/create-pr-preflight

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/skills/test_create_pr_verify_status.bats (1)

6-9: ⚠️ Potential issue | 🟠 Major

Stale script references will cause test failures.

The setup references verify-pr-status.sh and sync-with-base.sh, but based on the PR summary, these scripts are being replaced/removed. Lines 11-49 test verify-pr-status.sh which appears to no longer exist.

#!/bin/bash
# Check if the referenced scripts exist
ls -la plugins/me/skills/create-pr/scripts/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/skills/test_create_pr_verify_status.bats` around lines 6 - 9, The
setup() function exports VERIFY_SCRIPT and SYNC_SCRIPT pointing to
verify-pr-status.sh and sync-with-base.sh which are removed/renamed; update
setup() to reference the new script paths or remove these exports and the
dependent tests (the block that exercises verify-pr-status.sh around lines
11-49) so tests don't fail; specifically edit the setup() exports for
VERIFY_SCRIPT and SYNC_SCRIPT (and any usages of VERIFY_SCRIPT in tests) to
match the current scripts in plugins/me/skills/create-pr/scripts/ or adjust the
tests to the new verification flow after confirming the actual filenames with a
directory listing.
🧹 Nitpick comments (2)
tests/skills/test_create_pr_verify_status.bats (2)

76-94: Consider using TEST_TEMP_DIR from bats_helper for consistency.

These tests create their own temp directories with manual cleanup, but the loaded bats_helper.bash already provides TEST_TEMP_DIR with automatic cleanup in teardown(). This would ensure cleanup even on test failure.

♻️ Optional: use shared temp directory
 `@test` "preflight-check.sh: exits 2 when not in a git repository" {
   PREFLIGHT_SCRIPT="${BATS_TEST_DIRNAME}/../../plugins/me/skills/create-pr/scripts/preflight-check.sh"
-  TEMP_DIR=$(mktemp -d)
-  cd "$TEMP_DIR"
+  cd "$TEST_TEMP_DIR"
   run env -u GIT_DIR -u GIT_WORK_TREE "$PREFLIGHT_SCRIPT" main
   [ "$status" -eq 2 ]
   [[ "$output" =~ "Not in a git repository" ]]
-  rm -rf "$TEMP_DIR"
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/skills/test_create_pr_verify_status.bats` around lines 76 - 94, Replace
the manual temp-dir creation/cleanup in the two tests ("preflight-check.sh:
exits 2 when not in a git repository" and "preflight-check.sh: exits 2 when no
base branch given and gh fails") by using the shared TEST_TEMP_DIR provided by
bats_helper: remove mktemp -d, remove explicit rm -rf cleanup, and cd into
"$TEST_TEMP_DIR" before running PREFLIGHT_SCRIPT; ensure bats_helper.bash is
sourced so TEST_TEMP_DIR is available and rely on its teardown for automatic
cleanup.

129-143: Resource cleanup placement is fragile.

Calling teardown_git_repos before assertions means temp directories are cleaned up even when tests pass. However, if the test fails before reaching teardown_git_repos (e.g., on line 139), the directories leak. Consider using bats' teardown function for guaranteed cleanup.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/skills/test_create_pr_verify_status.bats` around lines 129 - 143, The
test currently calls teardown_git_repos inside the test body (in test
"preflight-check.sh: exits 0 when branch is up to date and clean"), which can
leak temp repos if the test fails before that call; instead add a bats
teardown() function that calls teardown_git_repos so cleanup always runs, and
remove the inline teardown_git_repos call from the test body; ensure
PREFLIGHT_SCRIPT and setup_git_repos remain in the test but that the final
assertions run before any manual cleanup inside the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/skills/test_create_pr_verify_status.bats`:
- Around line 104-123: In setup_git_repos, the test assumes the local branch is
named main which fails when Git's default is master; fix by explicitly creating
or pushing to main: when creating the bare repo call git init --bare
--initial-branch=main (if supported) and/or ensure the commit is on a main
branch by running git checkout -b main before the initial commit in
TEST_CLONE_A, and replace the unconditional git push origin main with git push
origin HEAD:main so the current branch is pushed to remote main regardless of
its local name.

---

Outside diff comments:
In `@tests/skills/test_create_pr_verify_status.bats`:
- Around line 6-9: The setup() function exports VERIFY_SCRIPT and SYNC_SCRIPT
pointing to verify-pr-status.sh and sync-with-base.sh which are removed/renamed;
update setup() to reference the new script paths or remove these exports and the
dependent tests (the block that exercises verify-pr-status.sh around lines
11-49) so tests don't fail; specifically edit the setup() exports for
VERIFY_SCRIPT and SYNC_SCRIPT (and any usages of VERIFY_SCRIPT in tests) to
match the current scripts in plugins/me/skills/create-pr/scripts/ or adjust the
tests to the new verification flow after confirming the actual filenames with a
directory listing.

---

Nitpick comments:
In `@tests/skills/test_create_pr_verify_status.bats`:
- Around line 76-94: Replace the manual temp-dir creation/cleanup in the two
tests ("preflight-check.sh: exits 2 when not in a git repository" and
"preflight-check.sh: exits 2 when no base branch given and gh fails") by using
the shared TEST_TEMP_DIR provided by bats_helper: remove mktemp -d, remove
explicit rm -rf cleanup, and cd into "$TEST_TEMP_DIR" before running
PREFLIGHT_SCRIPT; ensure bats_helper.bash is sourced so TEST_TEMP_DIR is
available and rely on its teardown for automatic cleanup.
- Around line 129-143: The test currently calls teardown_git_repos inside the
test body (in test "preflight-check.sh: exits 0 when branch is up to date and
clean"), which can leak temp repos if the test fails before that call; instead
add a bats teardown() function that calls teardown_git_repos so cleanup always
runs, and remove the inline teardown_git_repos call from the test body; ensure
PREFLIGHT_SCRIPT and setup_git_repos remain in the test but that the final
assertions run before any manual cleanup inside the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce0a00e1-93b4-47b4-be93-4d9674494d27

📥 Commits

Reviewing files that changed from the base of the PR and between 9d7bc70 and 257a3ed.

📒 Files selected for processing (6)
  • plugins/me/skills/create-pr/SKILL.md
  • plugins/me/skills/create-pr/scripts/check-conflicts.sh
  • plugins/me/skills/create-pr/scripts/preflight-check.sh
  • plugins/me/skills/create-pr/scripts/wait-for-merge.sh
  • tests/skills/test_check_conflicts.bats
  • tests/skills/test_create_pr_verify_status.bats
💤 Files with no reviewable changes (2)
  • tests/skills/test_check_conflicts.bats
  • plugins/me/skills/create-pr/scripts/check-conflicts.sh

Comment thread tests/skills/test_create_pr_verify_status.bats
Test User added 2 commits March 26, 2026 11:49
…ibility

setup_git_repos() needs user.name/email for git commit to work in CI
environments where global git config is not set. Also use -b main for
git init --bare to ensure consistent default branch name.
…nd wait-for-merge.sh

Replace check-conflicts.sh references with new script names after the
create-pr skill improvement.
@baleen37
baleen37 merged commit 83f8a5c into main Mar 26, 2026
5 checks passed
@baleen37
baleen37 deleted the improve/create-pr-preflight branch March 26, 2026 02:53
baleen-release-app Bot pushed a commit that referenced this pull request Mar 26, 2026
# [16.0.0](v15.0.0...v16.0.0) (2026-03-26)

### Features

* **create-pr:** replace check-conflicts with preflight-check, add wait-for-merge ([#578](#578)) ([83f8a5c](83f8a5c))

### BREAKING CHANGES

* **create-pr:** removes iterative-eval skill

* test(create-pr): add failing tests for preflight-check and wait-for-merge

* feat(create-pr): add preflight-check.sh replacing check-conflicts.sh

* feat(create-pr): add wait-for-merge.sh for post-PR merge completion

* remove(create-pr): delete check-conflicts.sh and its test file

Replaced by preflight-check.sh (Task 2). Tests migrated to
test_create_pr_verify_status.bats (Task 1).

* feat(create-pr): simplify workflow to 5 steps, use preflight-check and wait-for-merge

* fix(create-pr): configure git user in integration tests for CI compatibility

setup_git_repos() needs user.name/email for git commit to work in CI
environments where global git config is not set. Also use -b main for
git init --bare to ensure consistent default branch name.

* fix(tests): update me-specific.bats to reference preflight-check.sh and wait-for-merge.sh

Replace check-conflicts.sh references with new script names after the
create-pr skill improvement.
@coderabbitai coderabbitai Bot mentioned this pull request Aug 2, 2026
4 tasks
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