Repository navigation
Fix Slack log driver: post straight to chat.postMessage - #327
Open
claude-tmgbedu wants to merge 2 commits into
Open
claude-tmgbedu wants to merge 2 commits into
claude-tmgbedu wants to merge 2 commits into
Conversation
The driver resolved channel ids through channels.list, which Slack retired in 2021, so every Slack log raised KeyError 'channels'. chat.postMessage accepts a channel name or id, so the lookup is dropped. The token moves to the Authorization header, HTTP errors and ok:false responses raise SlackApiError (SlackChannelNotFound for channel_not_found), and requests time out after 10 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
# Conflicts: # docs/adr/AGENTS.md
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.
Summary
channels.list(retired by Slack in 2021) to resolve the channel id, so every Slack log crashed withKeyError: 'channels'.find_channelare removed.sendposts JSON tochat.postMessagewithAuthorization: Bearer <token>and the configured channel as is (#alertsor a channel id), with a 10 s timeout.requests.HTTPError. Anok: falseresponse raisesSlackApiErrorwith the Slack error code, andchannel_not_foundraisesSlackChannelNotFound, now aSlackApiErrorsubclass.channel,token,emoji,username,level,driver). ADR 044 explains the change.Config
Tests
requests.post. The tests check thechat.postMessageURL,#alerts, the bearer header, the message text, and thatchannels.listis never called. They also coverok:false→SlackApiError,channel_not_found→SlackChannelNotFound, HTTP error propagation, and that None fields are omitted.pytest --ignore=tests/masoniteorm/postgres --cov: 3496 passed, coverage 92.24%.ruffandbasedpyrightare clean.🤖 Generated with Claude Code