Skip to content

style(auto_fixer): refix:merged ラベルのデフォルト色を GitHub マージアイコンに合わせて紫色に変更#65

Merged
HappyOnigiri merged 5 commits intomainfrom
style/merged-label-purple
Mar 12, 2026
Merged

style(auto_fixer): refix:merged ラベルのデフォルト色を GitHub マージアイコンに合わせて紫色に変更#65
HappyOnigiri merged 5 commits intomainfrom
style/merged-label-purple

Conversation

@HappyOnigiri
Copy link
Owner

@HappyOnigiri HappyOnigiri commented Mar 12, 2026

概要 / Summary

refix:merged ラベルのデフォルト色を GitHub のマージアイコンに合わせて紫色に変更。CI の pyright 設定を修正。

変更内容 / Changes

  • REFIX_MERGED_LABEL_COLOR1D76DB(青)から 6F42C1(GitHub マージアイコンと同じ紫)に変更
  • pyrightconfig.jsonvenvPathvenv を追加し、pyright が venv 内の pytest を解決できるようにする
  • ruff format による整形を適用

テスト / Testing

make ci で全チェックパス済み。

関連 issues / Related issues

なし

Summary by CodeRabbit

  • スタイル

    • コード全体のフォーマットと可読性をさらに改善しました(リフォーマットと整理)。
  • テスト

    • テストコードの書式と構成を整えました(動作は変更なし)。
  • 設定

    • プロジェクトレベルの仮想環境設定を明示的に追加・最適化し、除外リストを調整しました。
  • リファクタ

    • 内部集計の扱いを整理する変更を導入しましたが、エンドユーザー向けの挙動に変更はありません。

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

プロジェクトにPyrightのプロジェクトレベル仮想環境設定を追加し、src/auto_fixer.pyでグローバル蓄積カウンタ(global_backfilled_count)を受け渡すために関数シグネチャが拡張され、関連するログ表示とバックフィル算出が調整されました。複数ファイルで改行・インデントの整形が行われ、テストが新引数に合わせて更新されています。

Changes

Cohort / File(s) Summary
Pyright 設定
pyrightconfig.json
プロジェクト仮想環境を明示:"venvPath": ".", "venv": ".venv"を追加。excludeから.venvを削除(結果:["works","tmp"])。
バックフィル状態の伝搬(主要変更)
src/auto_fixer.py
グローバル蓄積カウンタを受け渡すためにprocess_repo(...)に`global_backfilled_count: list[int]
整形・軽微リファクタ
src/summarizer.py, src/auto_fixer.py
多くの関数引数・条件式・リテラルの改行/インデント整形。論理や制御フローに実質的変更なし(ただし上記でシグネチャ変更あり)。
テスト更新
tests/test_auto_fixer.py
process_repoおよびmain呼び出しに新しいglobal_backfilled_count引数(デフォルト[0])を追加してテストを同期。主に引数伝搬と整形の変更。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested labels

refix:done

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes a style change to the default color of the refix:merged label, but the actual changes include functional modifications to backfill counting logic in auto_fixer.py and Pyright configuration updates, which are not reflected in the title. Update the title to reflect all significant changes, such as 'refactor(auto_fixer): global backfill count tracking and style updates' or separate this into multiple PRs.
Description check ⚠️ Warning The PR description mentions color change and Pyright config updates, but omits significant functional changes to backfill logic (global_backfilled_count parameter additions and refactoring in auto_fixer.py). Add details about the backfill counting logic changes to the '変更内容 / Changes' section to accurately document all modifications.
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ 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 style/merged-label-purple

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

@HappyOnigiri HappyOnigiri added the refix:running Refix is currently processing review fixes. label Mar 12, 2026
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: 1

🤖 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 1556-1558: The code treats failure to add the
refix:auto-merge-requested label as success; change the calls to
_edit_pr_label(repo, pr_number, add=True,
label=REFIX_AUTO_MERGE_REQUESTED_LABEL) so you check its return value and only
proceed/return True when it succeeded, otherwise return/propagate failure; apply
the same check in both places where this call appears and ensure that
_mark_pr_merged_label_if_needed() and _backfill_merged_labels() are only invoked
when the label-add returned success.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e03b5651-77df-4c67-bc4c-539bd10e58bd

📥 Commits

Reviewing files that changed from the base of the PR and between 89f0459 and 1f4d3f4.

📒 Files selected for processing (4)
  • pyrightconfig.json
  • src/auto_fixer.py
  • src/summarizer.py
  • tests/test_auto_fixer.py

_edit_pr_label() の戻り値が無視されていた2箇所を修正し、
ラベル追加が失敗した場合は False を返すようにする。
@HappyOnigiri
Copy link
Owner Author

HappyOnigiri commented Mar 12, 2026

🤖 Refix Status

処理済みレビュー一覧 (System Use Only)
Comment ID 処理日時
r3933672316 2026-03-12 12:46:15 JST
discussion_r2922050877 2026-03-12 12:46:15 JST
r3933732860 2026-03-12 12:56:15 JST
discussion_r2922106740 2026-03-12 12:56:16 JST
r3933760161 2026-03-12 13:02:39 JST

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: 1

🤖 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 2123-2126: The current stop condition uses len(modified_prs) +
backfilled_count but backfilled_count is per-repo, so merged-label backfills
from previously processed repos aren’t counted; change the logic to track a
global backfilled total (e.g., total_backfilled_count) or add per-repo backfill
increments into the shared modified_prs count when you perform backfills, and
then use len(modified_prs) + total_backfilled_count (or the updated modified_prs
length) in the if condition that references modified_prs and backfilled_count to
enforce max_modified_prs across all repos.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f305a7f2-b18b-4700-a382-6c1e000da856

📥 Commits

Reviewing files that changed from the base of the PR and between 1f4d3f4 and 671483d.

📒 Files selected for processing (1)
  • src/auto_fixer.py

PR が already merged の場合、ラベル追加はベストエフォートとし
結果に関わらず True を返すようにする。
…s_per_run を正確に適用

- global_backfilled_count: list[int] を main() で生成し process_repo に渡す
- 各リポジトリの backfill 件数をグローバル集計に加算し、次リポジトリへの超過分を防ぐ
- 初回 backfill_limit・PR ループの上限チェック・2 回目 backfill remaining の
  いずれも全リポジトリ合計値を参照するよう修正
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.

♻️ Duplicate comments (1)
src/auto_fixer.py (1)

1563-1566: ⚠️ Potential issue | 🟠 Major

already merged 分岐でもラベル付与失敗を成功扱いしています。

Line 1565 で _edit_pr_label() の戻り値を無視したまま True を返しているため、refix:auto-merge-requested の付与に失敗しても後続が成功扱いになります。その場合、_mark_pr_merged_label_if_needed() / _backfill_merged_labels() の前提が崩れ、refix:merged を取りこぼします。ここもラベル追加が成功したときだけ成功扱いにしてください。

修正案
     if "already merged" in combined_lower:
         print(f"PR #{pr_number} is already merged.")
-        _edit_pr_label(repo, pr_number, add=True, label=REFIX_AUTO_MERGE_REQUESTED_LABEL)
-        return True
+        return _edit_pr_label(
+            repo, pr_number, add=True, label=REFIX_AUTO_MERGE_REQUESTED_LABEL
+        )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/auto_fixer.py` around lines 1563 - 1566, "already merged" 判定ブロックは
`_edit_pr_label(repo, pr_number, add=True,
label=REFIX_AUTO_MERGE_REQUESTED_LABEL)` の戻り値を無視して常に True
を返しているため、ラベル付与失敗でも成功扱いになっています。`_edit_pr_label` の戻り値を受け取り、ラベル追加が成功したときのみ True
を返すよう修正し(失敗時は False を返す/伝播する)、この結果に基づいて後続の `_mark_pr_merged_label_if_needed()` や
`_backfill_merged_labels()` の前提が壊れないようしてください(参照: combined_lower, pr_number,
REFIX_AUTO_MERGE_REQUESTED_LABEL)。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/auto_fixer.py`:
- Around line 1563-1566: "already merged" 判定ブロックは `_edit_pr_label(repo,
pr_number, add=True, label=REFIX_AUTO_MERGE_REQUESTED_LABEL)` の戻り値を無視して常に True
を返しているため、ラベル付与失敗でも成功扱いになっています。`_edit_pr_label` の戻り値を受け取り、ラベル追加が成功したときのみ True
を返すよう修正し(失敗時は False を返す/伝播する)、この結果に基づいて後続の `_mark_pr_merged_label_if_needed()` や
`_backfill_merged_labels()` の前提が壊れないようしてください(参照: combined_lower, pr_number,
REFIX_AUTO_MERGE_REQUESTED_LABEL)。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 883e746a-a203-4cdc-9f3e-84bdcd69579c

📥 Commits

Reviewing files that changed from the base of the PR and between 2f1127e and 1ce62d6.

📒 Files selected for processing (2)
  • src/auto_fixer.py
  • tests/test_auto_fixer.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_auto_fixer.py

@HappyOnigiri HappyOnigiri added refix:done Refix finished review checks/fixes for now. and removed refix:running Refix is currently processing review fixes. labels Mar 12, 2026
@HappyOnigiri HappyOnigiri merged commit 4e70cb2 into main Mar 12, 2026
2 checks passed
@HappyOnigiri HappyOnigiri deleted the style/merged-label-purple branch March 12, 2026 04:02
@HappyOnigiri HappyOnigiri added refix:auto-merge-requested Refix has requested auto-merge for this PR. refix:merged PR has been merged after Refix auto-merge. and removed refix:auto-merge-requested Refix has requested auto-merge for this PR. labels Mar 12, 2026
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. refix:merged PR has been merged after Refix auto-merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant