Skip to content

📦 [Consolidated] PR #59, #67 の github.ts 改善統合・レビュー指摘対応#66

Merged
is0692vs merged 8 commits intomainfrom
perf-optimize-fetch-activity-2469035037922359680
Mar 14, 2026
Merged

📦 [Consolidated] PR #59, #67 の github.ts 改善統合・レビュー指摘対応#66
is0692vs merged 8 commits intomainfrom
perf-optimize-fetch-activity-2469035037922359680

Conversation

@is0692vs
Copy link
Contributor

@is0692vs is0692vs commented Mar 13, 2026

概要

このPRは、src/lib/github.ts に対する関連変更である以下2個のPRを一つのブランチにて統合(マージ)し、競合解消とレビューコメント対応を行ったうえで、GitHub API 周辺の改善を一本のPRにまとめるためのものです。

統合元のPR(これらは本作業に伴いクローズ対象です):

対応した修正点 (レビュー指摘への対応)

  1. src/lib/github.ts の競合解消

  2. src/lib/github.ts (PR 📦 [Consolidated] PR #59, #67 の github.ts 改善統合・レビュー指摘対応 #66 指摘対応)

    • 途中で待たれない Promise の rejection を完全に握り潰すのではなく、console.error で抑止したエラーを記録する形に変更し、デバッグ可能性を残しました。
  3. 既存動作を崩さない形での整理

    • イベント結合順序、早期打ち切り条件、レートリミット情報の取り扱いを維持したまま、レスポンス処理の共通化と補助関数の抽出を同一差分内で整理しています。

確認事項

google-labs-jules bot and others added 2 commits March 13, 2026 04:48
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
github-user-summary Ready Ready Preview, Comment Mar 14, 2026 2:20pm

@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Extract duplicated rate limit reset timestamp calculation into a single helper function.

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Summary by CodeRabbit

  • パフォーマンス向上
    • GitHub データ取得を並列処理に変更し、読み込み速度を向上させました。
    • エラーハンドリングの堅牢性を改善し、より安定した動作を実現しました。

Walkthrough

fetchActivity関数の実装が、ページ1~3の取得を順序実行から並列実行に変更されました。すべてのページリクエストを同時に開始し、その後結果を個別に処理する仕様となり、エラーハンドリングの防御措置が強化されています。

Changes

Cohort / File(s) Summary
並列フェッチの実装
src/lib/github.ts
fetchActivity関数内のページ取得ロジックが順序実行から並列実行に変更。すべてのページリクエストを同時に開始し、個別に結果を処理。未処理の例外を抑制するcatchハンドラーが追加され、UserNotFoundErrorRateLimitErrorは再スローされる。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 並列の道へ、羽ばたきて
三つのページが舞い踊る
待つ時間も短かぶり
エラーの盾で守られし
効率の歌よ、奏でよ!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは複数PRの統合とレビュー指摘対応という変更内容を言及しており、実装内容(並列化、ヘルパー抽出、エラーハンドリング改善)と関連していますが、具体的な主要な変更を明確に伝えていません。
Description check ✅ Passed 説明は複数PRの統合目的、具体的な修正点(Promise拒否の処理、handleResponse再利用、ヘルパー抽出)、および既存動作の維持について詳細に記載されており、変更内容と十分に関連しています。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 perf-optimize-fetch-activity-2469035037922359680
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、GitHubのpublic eventsを取得する際のパフォーマンスを大幅に改善することを目的としています。以前はページごとに直列にリクエストを送信していたため、ネットワークの遅延が累積していましたが、今回の変更により、最大3ページ分のリクエストを並列で実行することで、既存のビジネスロジックを維持しつつ、I/O処理の効率化を実現しました。これにより、モック環境で約3分の1に高速化され、実際のネットワーク環境ではさらに大きな遅延削減効果が期待されます。

Highlights

  • パフォーマンス最適化: src/lib/github.tsfetchActivity 関数におけるGitHub public eventsの取得処理を最適化しました。
  • 並列リクエスト: 最大3ページ分のリクエストを pages.map() を使用して並列で発行するように変更しました。
  • 順次awaitと結合: 発行されたPromiseを for...of ループで順次 await し、各ページの結果を順序通りに結合するようにしました。
  • 早期中断ロジックの維持: 取得イベントが100件未満の場合やエラー発生時に早期に処理を中断する既存のロジックを維持しました。
  • UnhandledPromiseRejectionの抑制: 後続のPromiseが早期中断やエラーで待機されなかった場合に発生する UnhandledPromiseRejection 警告を防ぐため、Promise配列に .catch(() => {}) を追加しました。
Changelog
  • src/lib/github.ts
    • fetchActivity 関数内のGitHubイベント取得ロジックを、直列処理から並列処理に移行しました。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、fetchActivity関数におけるGitHubイベント取得処理を並列化し、パフォーマンスを改善するものです。リクエストを並列で発行しつつ、結果は順次処理することで、早期リターンのロジックを維持したまま高速化を実現しており、素晴らしい改善です。1点、UnhandledPromiseRejectionを抑制するためのエラーハンドリングについて、デバッグの容易性を向上させるための改善提案をさせていただきました。詳細はコメントをご確認ください。

@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 14, 2026
@is0692vs is0692vs changed the title ⚡ Optimize GitHub events fetching by parallelizing requests 📦 [Consolidated] PR #59, #67 の github.ts 改善統合・レビュー指摘対応 Mar 14, 2026
…uppressed errors

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
…9680

# Conflicts:
#	.github/copilot-instructions.md
Copy link

@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/lib/github.ts`:
- Around line 640-641: The linter flags the promises.forEach callback because
p.catch(...) returns a Promise which forEach ignores; fix by explicitly
signaling intent or iterating properly: either prefix the callback call with the
void operator (change the callback passed to promises.forEach in the code that
currently references promises.forEach((p) => p.catch(...)) to use void
p.catch(...)) or replace the forEach with an explicit for-of loop over the
promises array and call p.catch(...) inside it; update the occurrence that uses
promises.forEach in this file (the suppressed event fetch error line)
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 14fc50a0-7ccd-4f74-92a8-6c14eb33fe55

📥 Commits

Reviewing files that changed from the base of the PR and between 328d1fb and f83a79b.

📒 Files selected for processing (1)
  • src/lib/github.ts

Comment on lines +640 to +641
// Suppress unhandled promise rejections for subsequent pages if we break early or throw
promises.forEach((p) => p.catch((e) => console.error("Suppressed event fetch error:", e)));
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

forEach コールバックから値を返しているため、リンターエラーが発生しています。

p.catch() は Promise を返しますが、forEach はコールバックの戻り値を無視します。Biome がこれを疑わしいパターンとしてフラグしています。void 演算子を使用して意図を明確にするか、for-of ループに変更することで解決できます。

♻️ 修正案

オプション 1: void 演算子を使用

-  promises.forEach((p) => p.catch((e) => console.error("Suppressed event fetch error:", e)));
+  promises.forEach((p) => void p.catch((e) => console.error("Suppressed event fetch error:", e)));

オプション 2: for-of ループを使用

-  promises.forEach((p) => p.catch((e) => console.error("Suppressed event fetch error:", e)));
+  for (const p of promises) {
+    p.catch((e) => console.error("Suppressed event fetch error:", e));
+  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Suppress unhandled promise rejections for subsequent pages if we break early or throw
promises.forEach((p) => p.catch((e) => console.error("Suppressed event fetch error:", e)));
// Suppress unhandled promise rejections for subsequent pages if we break early or throw
promises.forEach((p) => void p.catch((e) => console.error("Suppressed event fetch error:", e)));
🧰 Tools
🪛 Biome (2.4.6)

[error] 641-641: This callback passed to forEach() iterable method should not return a value.

(lint/suspicious/useIterableCallbackReturn)

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

In `@src/lib/github.ts` around lines 640 - 641, The linter flags the
promises.forEach callback because p.catch(...) returns a Promise which forEach
ignores; fix by explicitly signaling intent or iterating properly: either prefix
the callback call with the void operator (change the callback passed to
promises.forEach in the code that currently references promises.forEach((p) =>
p.catch(...)) to use void p.catch(...)) or replace the forEach with an explicit
for-of loop over the promises array and call p.catch(...) inside it; update the
occurrence that uses promises.forEach in this file (the suppressed event fetch
error line) accordingly.

@is0692vs is0692vs merged commit 87d145d into main Mar 14, 2026
7 checks passed
@is0692vs is0692vs deleted the perf-optimize-fetch-activity-2469035037922359680 branch March 14, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant