Skip to content

fix: improve Slack unavailable messaging for end users#94

Merged
bd73-com merged 4 commits intomainfrom
claude/fix-1.1.5-regression-2FG9Y
Mar 7, 2026
Merged

fix: improve Slack unavailable messaging for end users#94
bd73-com merged 4 commits intomainfrom
claude/fix-1.1.5-regression-2FG9Y

Conversation

@bd73-com
Copy link
Owner

@bd73-com bd73-com commented Mar 7, 2026

Summary

PR #91 made the Slack notification card always visible, but when the server reports available: false, end users now see "Contact your administrator to set up the Slack app" — a confusing admin-targeted message they cannot act on. This PR replaces that generic message with specific, user-friendly text by splitting the server's single unavailableReason into two distinct reasons.

Changes

API contract (shared/routes.ts)

  • Replace unavailableReason: "unavailable" enum with "tables-not-ready" | "oauth-not-configured"

Server (server/routes.ts)

  • Split the combined !tablesReady || !oauthReady check into two sequential early returns, each with its own reason
  • Tables checked first (transient/recoverable), OAuth second (needs admin)

Client display logic (slack-display-state.ts, use-slack.ts)

  • Add "not-ready" display state for transient table failures
  • Derive SlackStatus type from Zod schema via z.infer<...> (single source of truth)
  • Deduplicate SlackStatus interface (was defined in two files)

UI (NotificationChannelsPanel.tsx)

  • tables-not-ready"Slack notifications are temporarily unavailable. Please try again in a moment."
  • oauth-not-configured"Slack notifications are not available for this service."
  • Replace 5-deep ternary chain with IIFE + early returns (calls getSlackDisplayState once instead of 4×)

Tests (slack-display-state.test.ts, routes.notificationChannels.test.ts, routes.test.ts)

  • 9 new tests: Zod schema validation (accepts/rejects reason values), isolated table-failure scenario, precedence of available: false over connected: true
  • Updated 6 existing tests for new reason values

How to test

  • Start the app without SLACK_CLIENT_ID/SLACK_CLIENT_SECRET env vars set
  • Navigate to a monitor's notification channels panel
  • Verify the Slack section shows "Slack notifications are not available for this service." (not "Contact your administrator")
  • Set SLACK_CLIENT_ID and SLACK_CLIENT_SECRET to valid values, restart
  • Verify the Slack section shows "Connect to Slack" button
  • Run npm run test — all 1161 tests pass
  • Run npm run build — production build succeeds

https://claude.ai/code/session_01RSvtzrtyhYtfcAb9Mm4BR4

Summary by CodeRabbit

  • New Features

    • Added "not-ready" Slack state to clarify when tables aren't initialized.
    • Enhanced Slack setup with distinct messages for configuration and readiness issues.
  • UI Improvements

    • Redesigned Slack connection panel with separate Disconnect button and channel selection controls.
    • Improved button styling and messaging throughout Slack setup flow.

claude added 4 commits March 7, 2026 10:37
…h user-friendly text

PR #91 made the Slack section always visible, but when the server reports
available=false, end users saw "Contact your administrator to set up the
Slack app" — a confusing admin-targeted message they can't act on.

Root cause: the server lumped "tables not ready" (transient) and "OAuth
not configured" (needs admin) into one generic unavailableReason. Now
the API returns specific reasons ("tables-not-ready" vs
"oauth-not-configured") so the client can show appropriate messages:

- tables-not-ready: "temporarily unavailable, try again in a moment"
- oauth-not-configured: "not available for this service" (neutral, no
  admin jargon)

https://claude.ai/code/session_01RSvtzrtyhYtfcAb9Mm4BR4
Export SlackStatus from use-slack.ts and import it in
slack-display-state.ts instead of maintaining two separate copies.

https://claude.ai/code/session_01RSvtzrtyhYtfcAb9Mm4BR4
…ranching

- Derive SlackStatus type from the Zod schema in shared/routes.ts via
  z.infer so adding a new unavailableReason only requires a single change
- Replace 5-deep ternary chain with IIFE + early returns, calling
  getSlackDisplayState once instead of 4 times per render

https://claude.ai/code/session_01RSvtzrtyhYtfcAb9Mm4BR4
- Zod schema validation: accepts valid reasons, rejects the old
  "unavailable" value, rejects missing required fields
- Server endpoint: tables-not-ready when OAuth IS configured (isolated
  table failure, not just the combined-missing case)
- Display state: available=false takes precedence over connected=true

https://claude.ai/code/session_01RSvtzrtyhYtfcAb9Mm4BR4
@github-actions github-actions bot added the fix label Mar 7, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 566edb17-a323-4445-9433-62776ff99109

📥 Commits

Reviewing files that changed from the base of the PR and between 8ea2155 and c91a28c.

📒 Files selected for processing (8)
  • client/src/components/NotificationChannelsPanel.tsx
  • client/src/components/slack-display-state.test.ts
  • client/src/components/slack-display-state.ts
  • client/src/hooks/use-slack.ts
  • server/routes.notificationChannels.test.ts
  • server/routes.ts
  • shared/routes.test.ts
  • shared/routes.ts

📝 Walkthrough

Walkthrough

The PR refactors Slack integration handling to distinguish between missing database tables (tables-not-ready) and missing OAuth configuration (oauth-not-configured). Changes span client UI rendering, server status endpoint logic, and shared API schema to support this new state distinction with enhanced test coverage.

Changes

Cohort / File(s) Summary
Slack Display State Logic
client/src/components/slack-display-state.ts, client/src/components/slack-display-state.test.ts
Adds "not-ready" to SlackDisplayState type; imports SlackStatus from hooks instead of defining locally. Updates getSlackDisplayState to branch on unavailableReason ("tables-not-ready" vs. "oauth-not-configured"). Expands tests to cover new states and validate precedence rules.
Client UI Components
client/src/components/NotificationChannelsPanel.tsx
Refactors nested ternary chains into explicit IIFE for Slack state rendering. Introduces "loading" state for non-free tier status fetches, "not-ready" state with new messaging, and splits connected UI into dedicated block with Disconnect and channel selection controls.
Client Hooks & Types
client/src/hooks/use-slack.ts
Replaces SlackStatus interface with zod-inferred type derived from API schema, importing z from zod for type inference.
Server Route Handlers
server/routes.ts, server/routes.notificationChannels.test.ts
Separates unavailability logic: returns "tables-not-ready" when channel tables missing; returns "oauth-not-configured" when OAuth config missing. Updates tests to assert correct unavailableReason values and prevent Slack connection lookups when configuration incomplete.
API Schema & Validation
shared/routes.ts, shared/routes.test.ts
Updates unavailableReason enum from ["unavailable"] to ["tables-not-ready", "oauth-not-configured"]. Adds comprehensive validation tests for new enum values, connected responses, missing fields, and unknown reasons.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

fix

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: improve Slack unavailable messaging for end users' accurately summarizes the main objective: distinguishing Slack unavailability reasons and improving user-facing messages. It reflects the core change across the PR.

✏️ 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 claude/fix-1.1.5-regression-2FG9Y

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.

@bd73-com bd73-com merged commit a0b93d0 into main Mar 7, 2026
3 checks passed
@bd73-com bd73-com deleted the claude/fix-1.1.5-regression-2FG9Y branch March 7, 2026 11:04
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.

2 participants