Skip to content

fix(auth): rename dict variable to avoid shadowing built-in#2920

Open
hobostay wants to merge 1 commit into
Chainlit:mainfrom
hobostay:fix/jwt-dict-shadowing
Open

fix(auth): rename dict variable to avoid shadowing built-in#2920
hobostay wants to merge 1 commit into
Chainlit:mainfrom
hobostay:fix/jwt-dict-shadowing

Conversation

@hobostay
Copy link
Copy Markdown

@hobostay hobostay commented May 10, 2026

Summary

  • Rename the local variable dict to decoded_token in decode_jwt() to avoid shadowing the Python built-in dict type.

Why

In backend/chainlit/auth/jwt.py:35, the decode_jwt function assigns the decoded JWT payload to a variable named dict, which shadows Python's built-in dict type. While this doesn't currently cause a runtime error, it is a code clarity issue and could lead to subtle bugs if the built-in dict were needed later in the function (e.g., for type checking or casting).

Test plan

  • Verify the existing JWT tests pass (uv run pytest tests/ -k jwt from backend/)
  • Verify login/auth flows still work correctly

🤖 Generated with Claude Code


Summary by cubic

Renamed the local variable dict to decoded_token in decode_jwt() to avoid shadowing the Python built-in and improve code clarity. No behavior change; JWT payload handling remains the same.

Written for commit 9ca50ef. Summary will update on new commits.

The `decode_jwt` function used a local variable named `dict` which
shadows the Python built-in `dict` type. This is a code clarity issue
and could cause subtle bugs if the built-in is needed later in the
function.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. auth Pertaining to authentication. labels May 10, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

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

Labels

auth Pertaining to authentication. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant