Repository navigation
Conversation
Testing Slack notifications locally needs a real Slack app and workspace. With SENTRY_USE_FAKE_SLACK on, the devserver starts a fake Slack Web API on port 8099 and sends Sentry's Slack API calls to it. Messages show up in a Slack-like viewer at http://localhost:8099. Run `sentry django fake_slack_setup` once to connect an organization to the fake workspace. Production behavior is unchanged. The new SENTRY_SLACK_API_BASE_URL setting stays empty unless the flag is on, and while it's empty the Slack client uses https://slack.com/api/. The fake only records what Sentry sends. It validates nothing, and it doesn't send interactions such as button clicks back to Sentry yet.
Sentry checks a channel exists by scheduling a message and deleting it. Fake Slack posted scheduled messages as visible ones and ignored the delete, so every channel check left a message in the viewer. Scheduled messages are now kept apart and removed on delete.
Trim comments, fold the request handler factory into make_server, and merge the unsimulated-method check into the existing flow test.
The viewer decoded & before < and >, so a literal "<" in a message rendered as "<". Decode in the right order, and pull markdown links out before escaping instead of partially unescaping their URLs.
A button's style went into its class attribute unescaped, so a crafted message could inject markup into the viewer. Escape it, along with message timestamps and channel IDs.
Clicking a button or menu in the viewer now explains that Fake Slack doesn't support it, instead of doing nothing. Slack methods Sentry calls that Fake Slack doesn't simulate are recorded and listed in a viewer banner, linked to the related message when there is one.
The setup command always printed http://localhost:8099, which is wrong on a remote dev box. It now uses $FAKE_SLACK_PUBLIC_URL when set, the same default the server uses for links.
Nothing in Sentry follows Fake Slack's message links, so FAKE_SLACK_PUBLIC_URL only changed the setup command's hint. Remove it and --public-url, and have the hint name the port instead.
Both production images ship everything under src/, including testutils, and strip only tests/ and fixtures/. Move Fake Slack's server and viewer to fixtures/integrations/fake_slack/, next to the other integration mocks, so it stays out of production. The setup command keeps its own copy of the workspace ID, and its test checks that it matches the server's.
…e-slack-devserver # Conflicts: # src/sentry/runner/commands/devserver.py
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b029538. Configure here.
A thread root showed up in both the channel and the open thread with the same element ID, so links scrolled to the channel copy. Thread-pane copies now get their own ID, and the viewer scrolls to that copy when a thread is open.
This branch was successfully deployed
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.

Testing Slack notifications locally needs a real Slack app and workspace. With
SENTRY_USE_FAKE_SLACK = Truein your Sentry config, the devserver now starts a fake Slack Web API on port 8099 and sends Sentry's Slack API calls to it. Everything Sentry posts shows up in a Slack-like viewer athttp://localhost:8099, andsentry django fake_slack_setupconnects an organization to the fake workspace.Production behavior is unchanged.
SlackSdkClientand the install-timeWebClientnow pass a newSENTRY_SLACK_API_BASE_URLsetting asbase_url. It stays empty, so they keep usinghttps://slack.com/api/, unlessSENTRY_USE_FAKE_SLACKis on, in which caseinitialize_apppoints it at the fake. That way shells and taskworkers are redirected too, not just devserver processes. The server and viewer live infixtures/integrations/fake_slack/, which both the SaaS and self-hosted images strip, so only the settings, the devserver hook and the setup command ship. The fake only records what Sentry sends: it validates nothing and doesn't send button clicks, @mentions or modal submissions back to Sentry yet. The viewer says so: clicking a button or menu shows a notice, and a banner lists any Slack methods Sentry called that Fake Slack doesn't simulate.Issue alerts built by Sentry's real Slack message builder, as they appear in the viewer:
Opening a thread shows the repeat alert Sentry posted as a reply:
When Sentry calls Slack methods that Fake Slack doesn't simulate, the banner lists them and links to the related message: