Skip to content

Refix merged label#48

Merged
HappyOnigiri merged 10 commits intomainfrom
cursor/refix-merged-label-a24e
Mar 11, 2026
Merged

Refix merged label#48
HappyOnigiri merged 10 commits intomainfrom
cursor/refix-merged-label-a24e

Conversation

@HappyOnigiri
Copy link
Owner

@HappyOnigiri HappyOnigiri commented Mar 11, 2026

Add refix:merged label to PRs upon successful automatic merge by Refix to clearly indicate their completion status.

Open in Web Open in Cursor 

Summary by CodeRabbit

リリースノート

  • 新機能

    • プルリクエストのマージ完了時に「refix:merged」ラベルが自動適用されるようになりました
    • 既にマージされているプルリクエストを自動検出し、対応するラベルをバックフィルする機能を追加
  • ドキュメント

    • コンフィグサンプルとREADMEに、マージ完了時のラベル適用に関する説明を追記
  • テスト

    • マージラベル機能の動作を検証する新しいテスト群を追加しました

Co-authored-by: HappyOnigiri <nodemeld+happy-onigiri@gmail.com>
@cursor
Copy link

cursor bot commented Mar 11, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7fd4c36f-7f44-4a3b-a934-d7b7c7e3e5a8

📥 Commits

Reviewing files that changed from the base of the PR and between ab919fd and 2f39b4b.

📒 Files selected for processing (4)
  • .refix.yaml.sample
  • README.md
  • src/auto_fixer.py
  • tests/test_auto_fixer.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • README.md
  • tests/test_auto_fixer.py
  • .refix.yaml.sample

📝 Walkthrough

Walkthrough

Refixの自動マージ後のPRに対してrefix:mergedラベルを付与・バックフィルする機能を追加し、その検出・適用を行うヘルパー関数群と関連テストを導入しました。

Changes

Cohort / File(s) Summary
Configuration & Docs
\.refix\.yaml\.sample, README\.md
auto_merge設定付近に「マージ完了時に refix:merged ラベルが追加される」説明コメントを追記。
Core implementation
src/auto_fixer.py
REFIX_MERGED_LABEL と色定数を追加。マージ状態の検出・ラベリングとバックフィルを行う新関数 _set_pr_merged_label_pr_has_label_mark_pr_merged_label_if_needed_backfill_merged_labels を実装し、ラベル初期化・自動マージ処理フローへ統合。
Tests
tests/test_auto_fixer.py
マージラベル付与・検出・バックフィルの振る舞いを検証する6件のテストを追加・既存テストを更新。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a clear summary of the feature but lacks proper structure. It is missing the required template sections including Related issues, detailed Changes, Testing, and Checklist completion. Complete the PR description using the template format: add 'Related issues' section with issue number, expand 'Changes' with detailed bullet points, add 'Testing' section explaining how the changes were tested, and check all checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Refix merged label' is concise and directly describes the main change: adding a merged label feature to the Refix tool. It clearly reflects the core functionality introduced across the modified files.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/refix-merged-label-a24e

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

@HappyOnigiri HappyOnigiri marked this pull request as ready for review March 11, 2026 13:35
@HappyOnigiri HappyOnigiri added the refix:running Refix is currently processing review fixes. label Mar 11, 2026
Resolved conflict by keeping English comment from origin/main and
adding refix:merged label info in English (consistent with rest of README).
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/auto_fixer.py`:
- Around line 1736-1737: The call to _backfill_merged_labels runs outside the
modified_prs counting and thus can change multiple PRs regardless of
max_modified_prs_per_run; update the logic so merged-label backfilling is
subject to the same limit by either (a) moving the _backfill_merged_labels work
into the same processing loop that consumes modified_prs and only run it while
remaining_modifications > 0, or (b) change _backfill_merged_labels to return the
number of PRs it modified and subtract that from remaining_modifications
(max_modified_prs_per_run), and check remaining_modifications before performing
each label update; apply the same fix at the other occurrence referenced (lines
around the second call).
- Around line 1201-1238: The function _mark_pr_merged_label_if_needed currently
bases eligibility only on mergedAt and REFIX_DONE_LABEL; change it to also
require that the PR was requested to be auto-merged before adding
REFIX_MERGED_LABEL — e.g. check for a dedicated auto-merge marker by calling
_pr_has_label(pr_data, REFIX_AUTO_MERGE_LABEL) or inspect the GH API field (add
the appropriate key to the gh --json list and check
pr_data.get("autoMergeRequest")/pr_data.get("autoMerge") is truthy); only if
mergedAt is set, REFIX_DONE_LABEL is present, and auto-merge is indicated should
you call _set_pr_merged_label(repo, pr_number) and add the label.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 75db8cf0-d927-4d4e-994c-fdef16326dda

📥 Commits

Reviewing files that changed from the base of the PR and between bd06a51 and ab919fd.

📒 Files selected for processing (4)
  • .refix.yaml.sample
  • README.md
  • src/auto_fixer.py
  • tests/test_auto_fixer.py

_mark_pr_merged_label_if_needed now fetches the autoMergeRequest field
and returns early if auto-merge was not requested, preventing the label
from being applied to manually-merged PRs.

_backfill_merged_labels is updated to call _mark_pr_merged_label_if_needed
instead of _set_pr_merged_label directly, so the same auto-merge guard
applies during backfill.
The two _backfill_merged_labels calls were outside the modification
count, allowing them to bypass max_modified_prs_per_run.

- Pre-loop backfill uses max_modified_prs as its limit when set, and
  stores the returned count in backfilled_count.
- The per-PR limit check now includes backfilled_count so backfilled
  PRs reduce the budget available for open-PR processing.
- Post-loop backfill computes the remaining budget and skips the call
  entirely when the limit is already exhausted.
@HappyOnigiri
Copy link
Owner Author

🤖 Auto Review Fixer Status

処理済みレビュー一覧 (System Use Only)
Comment ID 処理日時 (UTC)
r3932716349 2026-03-11 21:52:34
discussion_r2921154085 2026-03-11 21:52:35
discussion_r2921154093 2026-03-11 21:52:35

…rameter

- assert_called_once_with("owner/repo", limit=100) for backfill call when max_modified_prs==0
- add autoMergeRequest field to pr_view in test_mark_pr_merged_label_if_needed test
- patch _mark_pr_merged_label_if_needed instead of subprocess.run in backfill test to avoid cross-call mock collision
@HappyOnigiri HappyOnigiri added refix:done Refix finished review checks/fixes for now. and removed refix:running Refix is currently processing review fixes. labels Mar 11, 2026
@HappyOnigiri HappyOnigiri merged commit 1417fd2 into main Mar 11, 2026
2 checks passed
@HappyOnigiri HappyOnigiri deleted the cursor/refix-merged-label-a24e branch March 11, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refix:done Refix finished review checks/fixes for now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants