fix: 通知内容の見直し・改善 (#96)#99
Conversation
- pretext を reason(なぜ通知されたか)を反映した文言にする。未知の reason は 汎用文言にフォールバック(Notification#reason_message / #pretext) - title を `owner/repo#番号 タイトル` 形式にして対象を一目で分かるようにする。 番号が取れない(Commit 等)場合はタイトルのみ(Subject#number / #display_title) - title_link をコメント html_url → リポジトリ html_url にフォールバックし、 リンク無し通知を無くす(Notification#link) - コメント本文を BODY_LIMIT(500)字で切り詰め、Slack/Discord 共通で長文が流れる のを防ぐ(Github::Usecase#truncate_body) - コメント取得失敗時は内部エラー文字列ではなく表示用文言を本文に出し、詳細は ログのみに残す - build_message が pretext を内部生成するよう整理し引数を廃止 - spec 追加(reason 文言 / number / display_title / link / build_message) メンション対象の絞り込み(issue の項目2)は「現状維持」の方針コメントに従い 本 PR では変更しない。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request enhances GitHub notification formatting and robustness by mapping notification reasons to user-friendly Japanese messages, formatting titles with issue/PR numbers, truncating long comment bodies, and falling back to repository links when comment links are missing. It also refactors comment fetching to return a placeholder message on API errors. The review feedback suggests handling trailing slashes when extracting issue/PR numbers from URLs, adding corresponding test cases, and wrapping the HTTP request in a rescue block to gracefully handle network errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7443ba457e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Subject#number を末尾スラッシュに強くし(chomp)、#番号が意味を持つ type (Issue/PullRequest/Discussion)に限定。Release/CheckSuite 等の数値 ID を 誤って #番号 表示しない - コメント URL が無い通知では body を持つ type(Issue/PullRequest)のみ subject.url へフォールバックし、CI 完了等(CheckSuite/Commit)には本文を 付けない(comment_url が空を返す) - find_comment_by_url の GET をネットワーク例外含め握りつぶし、1件の取得失敗が 他通知の送信を巻き添えにしないようにする - spec 追加(末尾スラッシュ / 非番号 type / body 非対象 type の comment_url) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
概要
issue #96 を解決する。通知の文面・情報量・リンクを見直し、「なぜ通知されたか」「どの対象か」が分かりやすい通知にする。送信先非依存の
Notify::Message+ アダプタ構成は維持し、組み立て側(Github::Notification/Github::Usecase/Notify::Usecase)に変更を集中させた。Slack / Discord アダプタは変更していない。変更内容
1. reason ベースの通知文言
update?による「更新があったみたいです」一辺倒だと通知理由が伝わらないため、reason(mention / review_requested / assign …)を pretext に反映する。Github::Notification#reason_message/#pretextを追加。[<type>] <reason 文言>形式(例:[PullRequest] レビューを依頼されました)2. メンション対象の絞り込み → 見送り
issue コメントの「一旦現状を維持する方針」に従い、
MENTION_REASONSは変更しない。3. title の情報量アップ + リンクのフォールバック
owner/repo#番号 タイトル形式にして対象を一目で分かるようにする(Notification#display_title)。番号はsubject.url末尾から取得し、数値でない(Commit の SHA 等)場合はタイトルのみ(Subject#number)html_url→ リポジトリhtml_urlにフォールバックし、リンク無し通知を無くす(Notification#link)4. 本文の切り詰め + 取得失敗時の表示文言
BODY_LIMIT(500)字 +…で切り詰め(全文はリンク先で読む前提)。組み立て側で行い Slack / Discord 共通comments api return client error: ...)ではなく「(本文を取得できませんでした)」を本文に出し、エラー詳細はログのみに残す。コメントが無い通知(CI 完了等)は本文を付けない表示イメージ(実ペイロード / Discord)
テスト
spec/github/models_spec.cr:reason_message(既知/未知フォールバック)、pretext、Subject#number、display_title、linkを追加spec/github/usecase_spec.cr(新規):build_messageの title 形式・リンクフォールバック・本文切り詰め・本文無しを検証crystal spec54 examples 0 failures /ameba0 failures /crystal build src/main.cr成功補足
Subject#update?/UPDATE_TYPESは本 PR では未使用になるが、モデルの述語として妥当かつ既存 spec もあるため残置した。Closes #96
🤖 Generated with Claude Code