Skip to content

Conversation

@ShivamIsh
Copy link

@ShivamIsh ShivamIsh commented Dec 30, 2025

fixes #336 by adding an input validation block

Summary by CodeRabbit

  • Bug Fixes
    • Strengthened input validation for the boolean-question endpoint: requests with empty or too-short text (fewer than five words) now receive a 400 error and descriptive message, preventing unnecessary processing and downstream errors.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

Added input validation to the /get_boolq endpoint in backend/server.py: if input_text is missing or contains fewer than 5 words, the endpoint returns HTTP 400 with an error message and an empty output, short-circuiting the BoolQ generation.

Changes

Cohort / File(s) Summary
Input validation for /get_boolq endpoint
backend/server.py
Enforce minimum input length: if input_text is empty or has fewer than 5 words, respond with HTTP 400 and {"error": "...", "output": []} instead of invoking BoolQGen.generate_boolq.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit's ode to better questions:
Five words, please — no empty plea,
Stop the noise, let meaning be.
Short prompts now meet a gate,
Clearer questions, tidy slate. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates the main change: adding input validation to fix issue #336, which directly relates to the core changeset of adding a validation block to the /get_boolq endpoint.
Linked Issues check ✅ Passed The PR implements input validation with a 5-word minimum requirement, directly addressing issue #336's request for validation when input_text is missing or insufficient, preventing generic unrelated questions.
Out of Scope Changes check ✅ Passed All changes in the PR are narrowly scoped to adding input validation in the /get_boolq endpoint as specified in issue #336, with no extraneous modifications.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d372f38 and 2d0dfb6.

📒 Files selected for processing (1)
  • backend/server.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/server.py

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

@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

🧹 Nitpick comments (1)
backend/server.py (1)

79-79: Remove unnecessary blank line.

Line 79 contains only whitespace within the jsonify call. Consider removing it for cleaner formatting.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6e4ad and d372f38.

📒 Files selected for processing (1)
  • backend/server.py
🔇 Additional comments (1)
backend/server.py (1)

74-83: Apply consistent input validation across all question generation endpoints.

The /get_mcq, /get_shortq, and /get_problems endpoints lack the input validation added to /get_boolq. All three should check for minimum text length before processing, especially /get_problems which calls all three question generators. Without validation, they may return generic or unrelated questions for missing or insufficient input.

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.

Unexpected behavior in /get_boolq when input_text is missing or very short

1 participant