Skip to content

Conversation

@LuoIaoSeng
Copy link

@LuoIaoSeng LuoIaoSeng commented Dec 28, 2025

The original condition throw 400 error when the password is verified,
thereforce add negate symbol in front of password verify condition negate the result make it right

Summary by CodeRabbit

  • Bug Fixes
    • Fixed authentication check logic in documentation that was incorrectly rejecting valid password verifications. The authentication flow now properly validates credentials and returns appropriate error responses.

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

Add '!' in front of password verify condition make it's logic right
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 28, 2025

Walkthrough

A logic error in an authentication example within documentation is corrected. The condition previously reversed the intended behavior, throwing an error on successful password verification instead of on failure. The conditional guard now correctly enforces authentication flow, allowing successful verification to proceed.

Changes

Cohort / File(s) Summary
Authentication Logic Fix
docs/essential/best-practice.md
Corrected authentication conditional: reversed the boolean logic so failed password verification (false) now triggers the error path, while successful verification (true) allows proceeding.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop, a skip, a logic twist—
The guard now guards what it once missed!
False blocks the path, true lets us through,
Password verified, onward we flew! 🔐✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: inverting the password verification condition in the best practice documentation file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa0ed05 and 4021aed.

📒 Files selected for processing (1)
  • docs/essential/best-practice.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/essential/best-practice.md

98-98: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🔇 Additional comments (1)
docs/essential/best-practice.md (1)

98-103: ✅ Logic fix correctly implements authentication guard.

The negation operator inverts the condition as intended: the error is now thrown on failed verification (false) rather than on successful verification (true). This aligns with standard authentication patterns and the example's purpose.

LIMIT 1`

if (await Bun.password.verify(password, user.password))
if (!await Bun.password.verify(password, user.password))
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix hard tab indentation; use spaces instead.

The indentation on this line uses hard tabs, which violates the Markdown linting rule MD010. Replace with spaces for consistency with Markdown best practices.

🔎 Proposed fix: Replace hard tab with spaces
-		if (!await Bun.password.verify(password, user.password))
+		if (!await Bun.password.verify(password, user.password))

(Replace the leading hard tab with two levels of space indentation to match the surrounding code block formatting.)

📝 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
if (!await Bun.password.verify(password, user.password))
if (!await Bun.password.verify(password, user.password))
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

98-98: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In docs/essential/best-practice.md around line 98, the line "if (!await
Bun.password.verify(password, user.password))" is indented with a hard tab which
violates MD010; replace the leading hard tab with spaces (use two-level space
indentation to match the surrounding fenced code block) so the line uses only
spaces for indentation and aligns with neighboring lines.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant