Skip to content

feat: migrate room segment lookup to dedicated chats api#1616

Open
arpitgupta1214 wants to merge 1 commit intotestfrom
codex/arpit-migrate-room-segment-endpoint
Open

feat: migrate room segment lookup to dedicated chats api#1616
arpitgupta1214 wants to merge 1 commit intotestfrom
codex/arpit-migrate-room-segment-endpoint

Conversation

@arpitgupta1214
Copy link
Copy Markdown
Collaborator

Summary

  • migrate useChatSegment to dedicated GET /api/chats/{id}/segment
  • use bearer auth via useAccessToken
  • respect API override via useApiOverride
  • map dedicated response shape (segment_id) to existing hook contract (segmentId)
  • remove local route app/api/roomSegment/route.ts

Validation

  • pnpm exec eslint hooks/useChatSegment.ts
  • rg -n "/api/roomSegment|roomSegment" --glob "!**/node_modules/**"

@coderabbitai
Copy link
Copy Markdown
Contributor

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 21 minutes and 46 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 21 minutes and 46 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: 4e25fafb-5358-4980-8bea-14721e41fc9b

📥 Commits

Reviewing files that changed from the base of the PR and between f7e799a and 9054cd0.

📒 Files selected for processing (2)
  • app/api/roomSegment/route.ts
  • hooks/useChatSegment.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/arpit-migrate-room-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.

@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-chat Ready Ready Preview Mar 30, 2026 7:38pm

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9054cd0990

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const baseUrl = apiOverride || NEW_API_BASE_URL;

return useQuery({
queryKey: ["roomSegment", roomId],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Key room segment query by token and API base

The query function now depends on both accessToken and baseUrl, but the cache key only includes roomId. In React Query, if the user logs out/in in the same tab (or changes ?api= override) while roomId stays constant, the hook can reuse cached data for up to the 5-minute staleTime and skip refetching, which can show segment data fetched under a different auth/backend context. Add auth/backend scope to the key (or invalidate on token/base URL changes) so cached results cannot bleed across sessions/environments.

Useful? React with 👍 / 👎.

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