Skip to content

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

Merged
sweetmantech merged 6 commits intotestfrom
codex/arpit-chat-segment-endpoint
Mar 31, 2026
Merged

feat: add GET /api/chats/[id]/segment endpoint#375
sweetmantech merged 6 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 31, 2026 4:03am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 10 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 22 minutes and 10 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: 80fee4d7-e6ad-429b-9f26-7adce1feda72

📥 Commits

Reviewing files that changed from the base of the PR and between 11ae9f2 and 0ce86b9.

⛔ Files ignored due to path filters (1)
  • lib/chats/__tests__/getChatSegmentHandler.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (3)
  • app/api/chats/[id]/segment/route.ts
  • lib/chats/getChatSegmentHandler.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.

Keep auth fixes (null params, null account_id checks) while
preserving room + accountId return for segment/artist handlers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sweetmantech
Copy link
Copy Markdown
Contributor

Smoke test results (post-conflict resolution, commit 0ce86b9)

Preview URL: https://recoup-api-git-codex-arpit-chat-segm-287ad2-recoupable-ad724970.vercel.app

Test: GET /api/chats/{id}/segment

GET /api/chats/21373dde-96f6-4022-82c2-ecb6be0e482e/segment with x-api-key200

{
    "status": "success",
    "room_id": "21373dde-96f6-4022-82c2-ecb6be0e482e",
    "segment_id": null,
    "segment_exists": false
}

Endpoint working correctly on the preview deployment.

@sweetmantech sweetmantech merged commit 4afc4cf into test Mar 31, 2026
4 of 5 checks passed
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.

2 participants