chore: remove dead segment report surface#1678
Conversation
The segment report flow is no longer mounted on any active product surface. Remove the entire surface (route, components, hooks, helpers, generation page, docs page, provider) per SEGMENTS_SURFACE_MIGRATION_PLAN.md. - Delete app/api/segment_report route - Delete components/Chat/ChatReport directory - Delete hooks: useReportData, useFunnelReport, useDownloadReport, useGenerateSegmentReport - Delete lib/report directory, lib/getPdfReport, lib/formatPdf - Delete segment-room supabase helpers (getSegmentRoom, createSegmentRoom, getSegmentWithArtist, getSegmentIdForRoomId, getRoomReports) - Delete app/segment/[segmentId] generation page and app/docs/segment_report docs - Delete providers/FunnelReportProvider - Strip report_id plumbing from createRoomWithReport - Unwire ChatReport/useGenerateSegmentReport/FunnelReportProvider from call sites (VercelChat/chat, Segments, chat/[roomId]/page, Providers) - Drop .segment-report CSS rules and room_reports fields from Conversation types Database drop migration for segment_reports / segment_rooms / room_reports is the next step in the plan and is intentionally out of scope for this PR. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
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 52 minutes and 28 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR removes the entire segment report generation and display infrastructure, including the API route for fetching reports, report creation/management hooks, React display components, database operations for report tracking, and the provider context that distributed report state across the application. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
lib/supabase/createRoomWithReport.ts (2)
14-19: Rename this helper to reflect current behavior.
createRoomWithReportnow only creates a room; the report linkage is gone. Renaming tocreateRoom(and updating the caller inlib/chat/handleChatCompletion.ts) will keep the API self-descriptive.♻️ Proposed rename
-export const createRoomWithReport = async ({ +export const createRoom = async ({- createRoomWithReport({ + createRoom({As per coding guidelines, "Ensure code is self-documenting through precise naming with verbs for functions and nouns for variables."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/supabase/createRoomWithReport.ts` around lines 14 - 19, Rename the exported helper function createRoomWithReport to createRoom (update its declaration and export) and update all call sites to use createRoom instead of createRoomWithReport—in particular replace the import and usage in the caller function handleChatCompletion; keep the function signature and return type unchanged so only the symbol name changes, and run a quick search for any remaining references to createRoomWithReport to rename them as well.
19-22: Simplify the return contract (throw or error object, not both).This function throws on failures but still returns
{ error: null }on success. Consider returning onlynew_roomto reduce API noise and keep call sites simpler.♻️ Proposed simplification
}: CreateRoomParams): Promise<{ - new_room: Room & { memories: [] }; - error: PostgrestError | null; -}> => { + new_room: Room & { memories: [] }; +}> => { @@ return { new_room: { ...new_room, memories: [], }, - error: null, };As per coding guidelines, "Write minimal code - use only the absolute minimum code needed."
Also applies to: 39-49
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/supabase/createRoomWithReport.ts` around lines 19 - 22, The function currently returns an object { new_room, error } while also throwing on failures; change the API to either throw errors or return an error object — pick throwing: update the createRoomWithReport function signature (remove the error field from the Promise return type so it returns Promise<Room & { memories: [] }>) and modify the implementation to return only new_room on success; remove all constructions like { new_room, error: null } and any error-return branches (lines referenced around 39-49) so errors are propagated via throw, and update any callers to handle exceptions instead of reading an error property; keep CreateRoomParams and the Room & { memories: [] } types as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/supabase/createRoomWithReport.ts`:
- Around line 14-19: Rename the exported helper function createRoomWithReport to
createRoom (update its declaration and export) and update all call sites to use
createRoom instead of createRoomWithReport—in particular replace the import and
usage in the caller function handleChatCompletion; keep the function signature
and return type unchanged so only the symbol name changes, and run a quick
search for any remaining references to createRoomWithReport to rename them as
well.
- Around line 19-22: The function currently returns an object { new_room, error
} while also throwing on failures; change the API to either throw errors or
return an error object — pick throwing: update the createRoomWithReport function
signature (remove the error field from the Promise return type so it returns
Promise<Room & { memories: [] }>) and modify the implementation to return only
new_room on success; remove all constructions like { new_room, error: null } and
any error-return branches (lines referenced around 39-49) so errors are
propagated via throw, and update any callers to handle exceptions instead of
reading an error property; keep CreateRoomParams and the Room & { memories: [] }
types as-is.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fd71d501-480c-4b13-9964-b88a333de497
⛔ Files ignored due to path filters (2)
types/Chat.tsxis excluded by none and included by nonetypes/Stack.tsxis excluded by none and included by none
📒 Files selected for processing (31)
app/api/segment_report/route.tsapp/chat/[roomId]/page.tsxapp/docs/segment_report/constants.tsapp/docs/segment_report/page.tsxapp/globals.cssapp/segment/[segmentId]/page.tsxcomponents/Chat/ChatReport/Actions.tsxcomponents/Chat/ChatReport/Content.tsxcomponents/Chat/ChatReport/index.tsxcomponents/Chat/ChatReport/types.tscomponents/Segments/SegmentButton.tsxcomponents/Segments/Segments.tsxcomponents/VercelChat/chat.tsxhooks/useConversations.tsxhooks/useDownloadReport.tsxhooks/useFunnelReport.tsxhooks/useGenerateSegmentReport.tsxhooks/useReportData.tslib/formatPdf.tsxlib/getPdfReport.tsxlib/report/createReport.tsxlib/report/getSegmentReport.tsxlib/report/types.tslib/supabase/createRoomWithReport.tslib/supabase/createSegmentRoom.tslib/supabase/getRoomReports.tslib/supabase/getSegmentIdForRoomId.tslib/supabase/getSegmentRoom.tslib/supabase/getSegmentWithArtist.tsproviders/FunnelReportProvider.tsxproviders/Providers.tsx
💤 Files with no reviewable changes (25)
- hooks/useConversations.tsx
- app/globals.css
- components/Chat/ChatReport/Actions.tsx
- hooks/useGenerateSegmentReport.tsx
- app/docs/segment_report/page.tsx
- lib/report/createReport.tsx
- hooks/useDownloadReport.tsx
- lib/supabase/getSegmentRoom.ts
- lib/report/types.ts
- lib/supabase/getRoomReports.ts
- lib/formatPdf.tsx
- lib/getPdfReport.tsx
- lib/supabase/getSegmentIdForRoomId.ts
- components/Chat/ChatReport/Content.tsx
- app/segment/[segmentId]/page.tsx
- lib/report/getSegmentReport.tsx
- components/Chat/ChatReport/types.ts
- hooks/useReportData.ts
- hooks/useFunnelReport.tsx
- app/api/segment_report/route.ts
- providers/FunnelReportProvider.tsx
- lib/supabase/getSegmentWithArtist.ts
- components/Chat/ChatReport/index.tsx
- lib/supabase/createSegmentRoom.ts
- app/docs/segment_report/constants.ts
The report plumbing was stripped in the preceding commit, so the "WithReport" suffix is misleading — the helper only creates a room. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Note: no supabase libs should exist in the Chat codebase.
- Supabase should only be accessed via API.
Promote test → main (includes #1678 dead segment-report removal)
Deletes the remaining segment list/create routes, the Segments UI components, segment-fans renderers, segment hooks, lib/segments, chat-segment lookup, segment MCP/AI tool wrappers, sidebar segment nav entries, and segment-related supabase helpers. The Segments feature is being removed entirely; the earlier migration plan is abandoned. Follows #1678 (segment report removal). Part of SEGMENTS_SURFACE_REMOVAL_PLAN.md. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary
The segment report flow is no longer mounted on any active product surface. The entire surface is being removed rather than migrated. No user-facing flow renders
ChatReport, polls/api/segment_report, or relies onsegment_reports/segment_rooms.What was removed
API route
app/api/segment_report/route.tsComponents
components/Chat/ChatReport/*(entire directory)Hooks
hooks/useReportData.tshooks/useFunnelReport.tsxhooks/useDownloadReport.tsxhooks/useGenerateSegmentReport.tsxLibrary helpers
lib/report/*(entire directory)lib/getPdfReport.tsxlib/formatPdf.tsxSupabase helpers
lib/supabase/getSegmentRoom.tslib/supabase/createSegmentRoom.tslib/supabase/getSegmentWithArtist.tslib/supabase/getSegmentIdForRoomId.tslib/supabase/getRoomReports.tslib/supabase/createRoomWithReport.tsrenamed tocreateRoom.ts;report_idparameter stripped (sole remaining caller,handleChatCompletion, never passed it)Page routes
app/segment/[segmentId]/page.tsxapp/docs/segment_report/*Provider
providers/FunnelReportProvider.tsxWhat was edited (not deleted)
components/VercelChat/chat.tsx— droppedChatReportimport/render and the now-unusedreportIdpropcomponents/Segments/Segments.tsx+SegmentButton.tsx— dropped theuseGenerateSegmentReportCTA wiringapp/chat/[roomId]/page.tsx— stopped fetchingreportIdviagetRoomReportsand stopped passing it toChatproviders/Providers.tsx— removedFunnelReportProviderwrapperapp/globals.css— removed.segment-report*rulestypes/Chat.tsx,types/Stack.tsx,hooks/useConversations.tsx— dropped deadroom_reportsfields from theConversationtype (no consumers read them)Out of scope
segment_reports/segment_rooms/room_reportsis intentionally not part of this PR — it ships separately, after whichtypes/database.types.tswill be regeneratedtypes/database.types.tsare auto-generated and will be cleaned up by that regenerationTest Plan
/api/segment_reporttypes/database.types.ts)🤖 Generated with Claude Code
Summary by cubic
Removed the unused segment report surface and all plumbing. This simplifies chat and segments, removes dead API calls, and cleans up types and CSS.
/api/segment_report,components/Chat/ChatReport/*,lib/report/*,useReportData,useFunnelReport,useDownloadReport,useGenerateSegmentReport, docs underapp/docs/segment_report, and the segment generation page.Chatno longer acceptsreportId;app/chat/[roomId]/page.tsxstopped usinggetRoomReports; Segments removed the generate-report CTA;FunnelReportProviderremoved fromProviders.lib/supabase/createRoom(wascreateRoomWithReport): removedreport_idplumbing and updated call sites (e.g.,lib/chat/handleChatCompletion.ts).getSegmentRoom,createSegmentRoom,getSegmentWithArtist,getSegmentIdForRoomId,getRoomReports..segment-report*CSS and droppedroom_reportsfromConversationtypes.segment_reports,segment_rooms,room_reportswill ship in a separate PR.Written for commit 04e6c14. Summary will update on new commits.