fix: conversations.infoのエラーログ追加とチャンネル名キャッシュ#22
Merged
Conversation
conversations.infoが例外をスローした場合にBoltに飲まれて原因不明だった問題に対応。 try-catchでエラー内容をログ出力するようにした。 また、同一チャンネルへの重複API呼び出しを避けるためキャッシュを追加した。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
一時的なSlack APIエラーで転送が失敗するケースに対応。 500ms間隔で最大2回リトライし、自動回復を試みる。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
運用中に発生した転送失敗の原因特定を進めやすくするため、Slack conversations.info 周りのログ強化と、チャンネル名取得の重複 API 呼び出し削減(キャッシュ)を導入するPRです。
Changes:
conversations.info呼び出しをgetChannelNameに集約し、例外時のエラーログを追加- チャンネルID→チャンネル名のキャッシュ(
Map)を追加して重複呼び出しを抑制 - ハンドラーのログを構造化し、スキップ理由を明確化
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit d04cf28.
モジュールスコープで無制限に増え続ける問題を解消するため、 ハンドラーのファクトリ関数内に閉じ込めた。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
error.messageだけではエラー種別やスタックトレースが失われるため、 name, message, stackをすべて出力するようにした。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
同一チャンネルでconversations.infoが1回だけ呼ばれること、 例外時にchat.postMessageが呼ばれないことを検証するテストを追加した。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
getChannelName呼び出しの引数を複数行に展開した。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
describeスコープで共有していたhandlerを各itブロック内で createMessageHandlerから生成するように変更し、 テスト間のキャッシュ状態の依存を排除した。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue
なし(運用中に発見した転送失敗の調査対応)
変更内容
conversations.infoが例外をスローした場合にtry-catchでエラー内容(name/message/stack)をログ出力するようにしたcreateMessageHandler内のクロージャ)確認したこと
npm run typecheckで新規型エラーなしnpm testで既存テスト通過(env.test.tsの失敗は既存)補足事項
CloudWatchログで動画投稿が転送されないケースを確認。
conversations.infoが例外をスローしていたが、try-catchがなくBoltに飲まれて原因不明だった。ログ改善をデプロイし、エラー内容を特定してから対策を決める。PR時のセルフチェック
by