Skip to content

Conversation

@anirudhprmar
Copy link
Contributor

Proposed change

Resolves #2888

Removed the assignment to blocks = [ ] as it was making the assignment to block before it redundant.
On, make check-test I got failing tests so i updated the users_test.py which i tested again passed all the tests.

changes i made in users_test.py

  • previously we were checking if the len(blocks) > 1, now it works as it true that blocks exists by using block[0] for header value
  • applied the same thing to rest of the information which depended on blocks, to follow the block list.

Checklist

  • I read and followed the contributing guidelines
  • I ran make check-test locally and all tests passed
  • I used AI for code, documentation, or tests in this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 14, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the display of user information in Slack messages. User data now appears with proper header introductions followed by individual user details, improving message clarity and structure.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Removed a redundant reinitialization of the blocks list in the user blocks rendering function. The code now preserves the header block and accumulates user details as separate blocks instead of discarding the header. Corresponding test expectations were updated to reflect the new two-block structure.

Changes

Cohort / File(s) Summary
Handler cleanup
backend/apps/slack/common/handlers/users.py
Removed explicit blocks = [] reinitialization that was discarding the header block, allowing progressive accumulation of user detail blocks.
Test expectation update
backend/tests/apps/slack/common/handlers/users_test.py
Updated test assertions to expect two-block structure: first block contains intro text ("OWASP users that I found for"), second block contains user details (rank, avatar, company, location, followers, bio).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the removed assignment was indeed redundant and not intentionally clearing state
  • Confirm test expectations accurately reflect the new block structure (header + user details separation)
  • Ensure no edge cases or pagination logic is affected by the change

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing an unused variable assignment (blocks = []).
Description check ✅ Passed The description explains the redundant assignment removal and documents the test updates required to ensure tests pass.
Linked Issues check ✅ Passed The PR addresses issue #2888 by removing the redundant blocks = [] assignment and updating tests to work with the new block structure.
Out of Scope Changes check ✅ Passed All changes directly address the removal of the unused blocks = [] assignment and necessary test updates. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 670fdff and f4091a9.

📒 Files selected for processing (2)
  • backend/apps/slack/common/handlers/users.py (0 hunks)
  • backend/tests/apps/slack/common/handlers/users_test.py (1 hunks)
💤 Files with no reviewable changes (1)
  • backend/apps/slack/common/handlers/users.py
🔇 Additional comments (1)
backend/tests/apps/slack/common/handlers/users_test.py (1)

40-45: Implementation correctly produces the expected two-block structure.

The get_blocks function in backend/apps/slack/common/handlers/users.py properly initializes a blocks list with the header at index 0 (lines 66-71) and appends user details blocks at subsequent indices (lines 73-94). All test assertions are satisfied:

  • Header block (blocks[0]) contains "OWASP users that I found for {search_query}"
  • User detail block (blocks[1]) includes formatted name, company, location, followers count, and bio
  • No redundant blocks = [] assignment exists in the code

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.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove this assignment to local variable 'blocks = []' as the value is never used.

1 participant