Skip to content

Improve slack guidelines. #1507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ahmedxgouda
Copy link
Collaborator

  • Improved the docs with some steps.
  • Added Django prefix to workspace token environment variable.

@ahmedxgouda ahmedxgouda requested a review from arkid15r as a code owner May 21, 2025 23:09
Copy link
Contributor

coderabbitai bot commented May 21, 2025

Summary by CodeRabbit

  • Documentation
    • Updated and reorganized the contributing guide for setting up NestBot Slack integration, including clearer step-by-step instructions and new guidance for workspace registration and environment variables.
  • Bug Fixes
    • Updated the expected environment variable name for Slack bot tokens to use the new format, ensuring consistency across the application and tests.

Summary by CodeRabbit

  • Documentation

    • Improved and reorganized the NestBot development section in the contributing guide for better clarity and step-by-step instructions.
    • Added explicit instructions for creating and registering a Slack workspace, updating environment variables, and syncing Slack data.
  • Chores

    • Updated environment variable naming conventions for Slack bot tokens to enhance consistency.

Walkthrough

The changes update the Slack bot token environment variable naming convention in the backend code and reorganize the contributing guide for setting up NestBot development. The documentation now provides clearer, step-by-step instructions for Slack workspace and app setup, including updated environment variable formats and a new Slack data sync step.

Changes

Files/Paths Change Summary
CONTRIBUTING.md Reorganized and expanded NestBot development instructions: clarified Slack workspace/app setup, updated environment variable guidance, and added a Slack data sync step. Minor formatting adjustments to warnings.
backend/apps/slack/models/workspace.py Changed the environment variable key for retrieving Slack bot tokens from SLACK_BOT_TOKEN_{WORKSPACE_ID} to DJANGO_SLACK_BOT_TOKEN_{WORKSPACE_ID}.
backend/tests/slack/models/workspace_test.py Updated test environment variable key to DJANGO_SLACK_BOT_TOKEN_{WORKSPACE_ID} to match new naming convention for Slack bot tokens.

Suggested labels

backend

Suggested reviewers

  • arkid15r

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d89373b and 334dc68.

📒 Files selected for processing (2)
  • CONTRIBUTING.md (2 hunks)
  • backend/apps/slack/models/workspace.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • backend/apps/slack/models/workspace.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • CONTRIBUTING.md
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added docs Improvements or additions to documentation nestbot labels May 21, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
CONTRIBUTING.md (2)

344-347: Use a consistent callout style for warnings
The “❗” bullets stand out, but consider using Markdown admonitions (e.g., > **Warning:** …) to improve consistency and accessibility.


377-386: Clarify workspace ID casing
When pulling the ID from the Slack URL, note that it must be uppercase in the env var name. Recommend adding a line like:

Use the uppercase workspace ID when setting DJANGO_SLACK_BOT_TOKEN_<WORKSPACE_ID>.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8c033a and 48f83ae.

📒 Files selected for processing (2)
  • CONTRIBUTING.md (2 hunks)
  • backend/apps/slack/models/workspace.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Run frontend unit tests
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (1)
CONTRIBUTING.md (1)

402-405: Approve Slack data sync step
The new “Sync the slack data” step and make slack-sync-data command align well with the code updates and enhance the onboarding flow.

@@ -29,4 +29,4 @@ def bot_token(self) -> str:
str: The bot token for the workspace.

"""
return os.getenv(f"SLACK_BOT_TOKEN_{self.slack_workspace_id.upper()}", "")
return os.getenv(f"DJANGO_SLACK_BOT_TOKEN_{self.slack_workspace_id.upper()}", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure fallback for global bot token
The documentation instructs users to also set DJANGO_SLACK_BOT_TOKEN without a workspace suffix, but this property only reads the suffixed variable. You should either update the docs to drop the global var or add a fallback in code.

Apply this diff to fall back to the generic token when the workspace‐specific one isn’t set:

@@ class Workspace(TimestampedModel):
     @property
     def bot_token(self) -> str:
         """Get bot token for the workspace."""
-        return os.getenv(f"DJANGO_SLACK_BOT_TOKEN_{self.slack_workspace_id.upper()}", "")
+        return (
+            os.getenv(f"DJANGO_SLACK_BOT_TOKEN_{self.slack_workspace_id.upper()}")
+            or os.getenv("DJANGO_SLACK_BOT_TOKEN", "")
+        )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return os.getenv(f"DJANGO_SLACK_BOT_TOKEN_{self.slack_workspace_id.upper()}", "")
@property
def bot_token(self) -> str:
"""Get bot token for the workspace."""
return (
os.getenv(f"DJANGO_SLACK_BOT_TOKEN_{self.slack_workspace_id.upper()}")
or os.getenv("DJANGO_SLACK_BOT_TOKEN", "")
)
🤖 Prompt for AI Agents
In backend/apps/slack/models/workspace.py at line 32, the code only retrieves
the workspace-specific Slack bot token environment variable and does not fall
back to the global DJANGO_SLACK_BOT_TOKEN if the specific one is not set. Modify
the return statement to first attempt fetching the workspace-specific token, and
if it is empty, then return the global DJANGO_SLACK_BOT_TOKEN environment
variable as a fallback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48f83ae and 4721bb8.

📒 Files selected for processing (1)
  • backend/tests/slack/models/workspace_test.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
backend/tests/slack/models/workspace_test.py

11-11: Line too long (104 > 99)

(E501)

🪛 GitHub Actions: Run CI/CD
backend/tests/slack/models/workspace_test.py

[error] 11-11: Ruff E501: Line too long (104 > 99) at line 11.


[error] 11-13: Ruff format hook modified the file to fix formatting issues related to line length and code style.

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation nestbot nestbot-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants