Skip to content

feat: add GET /api/chats/[id]/segment endpoint#375

Open
arpitgupta1214 wants to merge 5 commits intotestfrom
codex/arpit-chat-segment-endpoint
Open

feat: add GET /api/chats/[id]/segment endpoint#375
arpitgupta1214 wants to merge 5 commits intotestfrom
codex/arpit-chat-segment-endpoint

Conversation

@arpitgupta1214
Copy link
Copy Markdown
Collaborator

Summary

  • add dedicated GET /api/chats/[id]/segment endpoint for chat-to-segment lookup
  • add shared resolveAccessibleRoom utility for id validation, auth, and access checks
  • add segment-room select helper under lib/supabase/segment_rooms
  • return stable response shape: room_id, segment_id, segment_exists
  • add focused unit tests for resolver and handler paths

Validation

  • pnpm test lib/chats/__tests__/resolveAccessibleRoom.test.ts lib/chats/__tests__/getChatSegmentHandler.test.ts
  • pnpm exec eslint "app/api/chats/[id]/segment/route.ts" lib/chats/getChatSegmentHandler.ts lib/chats/resolveAccessibleRoom.ts lib/chats/__tests__/resolveAccessibleRoom.test.ts lib/chats/__tests__/getChatSegmentHandler.test.ts lib/supabase/segment_rooms/selectSegmentRoomByRoomId.ts

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Mar 30, 2026 9:14pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@arpitgupta1214 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 33 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 15 minutes and 33 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 782846ca-328b-47fb-b5ea-66814aeee3bd

📥 Commits

Reviewing files that changed from the base of the PR and between 54072ca and 58f8bb8.

⛔ Files ignored due to path filters (2)
  • lib/chats/__tests__/getChatSegmentHandler.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/chats/__tests__/validateChatAccess.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (4)
  • app/api/chats/[id]/segment/route.ts
  • lib/chats/getChatSegmentHandler.ts
  • lib/chats/validateChatAccess.ts
  • lib/supabase/segment_rooms/selectSegmentRoomByRoomId.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/arpit-chat-segment-endpoint

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.

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