Skip to content

fix: code quality and safety improvements - #1160

Closed
saurabhhhcodes wants to merge 1 commit into
knoxiboy:mainfrom
saurabhhhcodes:fix/DoubtDesk-73301
Closed

fix: code quality and safety improvements#1160
saurabhhhcodes wants to merge 1 commit into
knoxiboy:mainfrom
saurabhhhcodes:fix/DoubtDesk-73301

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

CodeAnt-AI Description

Use explicit validation for IDs and dates across API routes

What Changed

  • Invalid alert, doubt, reply, and date values continue to receive consistent rejection or omission instead of being implicitly coerced
  • Date formatting on the members page safely handles invalid join dates without displaying a malformed date

Impact

✅ Consistent invalid ID responses
✅ Reliable date filtering for exports
✅ Safe display of member join dates

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for dates and numeric identifiers across member views, data exports, alerts, doubts, and replies.
    • Invalid values are now detected more consistently, reducing the risk of incorrect results or unexpected errors.
    • Existing behavior for valid dates, identifiers, and export requests remains unchanged.

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeant-ai

codeant-ai Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 6840151 Aug 02, 2026 · 14:48 14:50

@codeant-ai

codeant-ai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions Bot added gssoc'26 GSSoC program issue level:intermediate Intermediate level task type:bug Bug fix labels Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a0c3a189-6d84-4c88-a46a-460123de901f

📥 Commits

Reviewing files that changed from the base of the PR and between 1a16173 and 6840151.

📒 Files selected for processing (5)
  • src/app/(routes)/rooms/[id]/members/page.tsx
  • src/app/api/classrooms/[id]/export/route.ts
  • src/app/api/confusion/route.ts
  • src/app/api/doubts/[id]/route.ts
  • src/app/api/replies/action/[id]/route.ts

Walkthrough

The change replaces global isNaN checks with Number.isNaN for date timestamps and parsed numeric identifiers in one page and four API routes.

Changes

Validation hardening

Layer / File(s) Summary
Date validation updates
src/app/(routes)/rooms/[id]/members/page.tsx, src/app/api/classrooms/[id]/export/route.ts
Joined-date and export date validation now uses Number.isNaN for parsed timestamps.
Identifier validation updates
src/app/api/confusion/route.ts, src/app/api/doubts/[id]/route.ts, src/app/api/replies/action/[id]/route.ts
Alert, doubt, and reply ID validation now uses Number.isNaN. PATCH and DELETE reply handlers are updated.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: quality:clean

Suggested reviewers: knoxiboy

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

We are closing this pr as it has no linking issue to it. If your is actually related to a isssue assigned to u then create a new pr and link the issue in discription.

@github-actions github-actions Bot added the invalid This doesn't seem right label Aug 2, 2026
@github-actions github-actions Bot closed this Aug 2, 2026
@github-actions github-actions Bot added size/xs and removed size:XS This PR changes 0-9 lines, ignoring generated files labels Aug 2, 2026
if (from) {
const fromDate = new Date(from);
if (!isNaN(fromDate.getTime())) {
if (!Number.isNaN(fromDate.getTime())) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Invalid from values are silently ignored, so a request intended to restrict the export to a date range instead exports all matching doubts. Reject malformed date parameters with a 400 response, or otherwise preserve the requested filter rather than dropping it; apply the same handling to to. [logic error]

Severity Level: Major ⚠️
- ⚠️ Teacher exports silently ignore malformed date boundaries.
- ⚠️ Export results can include records outside the requested range.
- ⚠️ The query remains capped at 1,000 default records.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/app/api/classrooms/[id]/export/route.ts
**Line:** 50:50
**Comment:**
	*Logic Error: Invalid `from` values are silently ignored, so a request intended to restrict the export to a date range instead exports all matching doubts. Reject malformed date parameters with a 400 response, or otherwise preserve the requested filter rather than dropping it; apply the same handling to `to`.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

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

Labels

gssoc'26 GSSoC program issue invalid This doesn't seem right level:intermediate Intermediate level task size/xs type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant