Skip to content

chore: remove dead segments surface#1685

Merged
sweetmantech merged 1 commit into
testfrom
chore/remove-segments-surface
Apr 17, 2026
Merged

chore: remove dead segments surface#1685
sweetmantech merged 1 commit into
testfrom
chore/remove-segments-surface

Conversation

@arpitgupta1214
Copy link
Copy Markdown
Collaborator

@arpitgupta1214 arpitgupta1214 commented Apr 17, 2026

Summary

  • Deletes local segment list and create routes (app/api/segments/route.ts, app/api/segments/create/route.ts)
  • Deletes the segments page (app/segments/page.tsx) and the components/Segments/* UI tree
  • Deletes the AI tool UI renderers (components/VercelChat/tools/segment-fans/*) and strips their get_segment_fans branches from components/VercelChat/ToolComponents.tsx
  • Deletes segment hooks (useArtistSegments, useCreateSegments, useChatSegment) and their library counterparts (lib/segments/*, lib/chats/getChatSegment.ts, lib/agent/getSegments.tsx, lib/getFanSegments.tsx, lib/getFunnelReport.tsx)
  • Unregisters create_segments, get_artist_segments, get_segment_fans from lib/tools/getMcpTools.ts and deletes their wrappers (lib/tools/{createSegments,getArtistSegments,getSegmentFans}.ts)
  • Drops their entries from lib/utils/getToolsInfo.ts
  • Strips the Segments/Fans nav entries from sidebar/side-menu components (Menu.tsx, SecondaryNav.tsx, MiniMenu.tsx, SideMenu.tsx) and deletes components/Sidebar/FanGroupNavItem.tsx (its only role was rendering the segments nav entry)
  • Deletes segment supabase helpers (lib/supabase/getArtistSegments.ts, getArtistSegmentNames.ts, getSegmentCounts.ts, and artist_segments/fan_segments/segments directories)
  • Deletes hooks/useFansCSVExport.tsx (no surviving callers once segments UI is gone) and prunes the now-orphan Fan, FanResponse, Pagination, SegmentFansResult types from types/fans.ts (kept FAN_TYPE, still used by types/Artist.tsx)
  • Deletes public/segment.svg

Context

The Segments surface is being removed entirely from chat, api, and docs. The earlier migration effort (docs #135, #136, api #443, #444, chat #1679, #1680) was abandoned and those PRs were closed unmerged.

Preceded by:

Related PRs (merge this one first so subsequent steps don't break the UI):

Explicit non-scope:

  • lib/chat/assistant/messageSegmentation.ts is AI message chunking, unrelated to fan segments; left untouched.
  • lib/chat/generateChatTitle.ts has a prompt mentioning "segment name"; harmless text, left untouched.
  • lib/chat/getFunnelAnalysis.tsx reads funnel_analytics_segments — funnel analytics, not fan segments; untouched.
  • types/Agent.tsx / types/Funnel.tsx SEGMENT types are funnel-analytics shapes; untouched.
  • types/database.types.ts still lists segments, artist_segments, fan_segments, segment_rooms, segment_reports, and artist_fan_segment — these get regenerated after the database drop migration.

Test plan

  • Grep sweep post-deletion returns zero hits across app components hooks lib providers for every segment pattern
  • npx eslint app components hooks lib providers: 8 errors / 11 warnings (down from test baseline of 10 errors / 12 warnings — net improvement, no new errors)
  • npx tsc --noEmit: same pre-existing errors as test baseline (SpotifyDeepResearchResult PNG import, extractSendEmailResults test fixtures) — no new errors
  • pnpm build fails only on pre-existing missing Supabase env-var errors (same as test baseline)

Notes

hooks/useFansCSVExport.tsx and the segment-specific types in types/fans.ts became dead once the Segments UI was deleted, so they are removed in this PR rather than left orphan.

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 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 17, 2026

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

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Apr 17, 2026 0:56am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

This pull request removes the entire "segments" (fan groups) feature from the application, including API routes, React UI components, navigation items, database operations, AI tool integrations, and supporting hooks and utilities across the codebase.

Changes

Cohort / File(s) Summary
API Routes & Pages
app/api/segments/create/route.ts, app/api/segments/route.ts, app/segments/page.tsx
Removed POST handler for segment creation, GET handler for fetching segments with caching directives, and the client-side segments page component.
Segment Display Components
components/Segments/Segments.tsx, components/Segments/SegmentButton.tsx, components/Segments/SegmentFanCircles.tsx, components/Segments/FanProfileHover.tsx, components/Segments/SegmentsSkeleton.tsx, components/Segments/NoSegmentsFound.tsx, components/Segments/SegmentsWrapper.tsx
Removed all React components for rendering segment grids, segment cards, fan avatars, fan profile hovers, skeleton loaders, empty states, and the main wrapper orchestrating segment UI logic.
Sidebar & Navigation
components/Sidebar/FanGroupNavItem.tsx, components/Sidebar/SecondaryNav.tsx, components/Sidebar/Menu.tsx, components/Sidebar/MiniMenu.tsx, components/SideMenu/SideMenu.tsx
Removed FanGroupNavItem component and all derived state (isSegments flag) from navigation menus that previously routed to the segments page.
Chat Tool UI Components
components/VercelChat/ToolComponents.tsx, components/VercelChat/tools/segment-fans/GetSegmentFansResult.tsx, components/VercelChat/tools/segment-fans/GetSegmentFansResultSkeleton.tsx, components/VercelChat/tools/segment-fans/FanCard.tsx, components/VercelChat/tools/segment-fans/SegmentHeader.tsx, components/VercelChat/tools/segment-fans/EmptyState.tsx, components/VercelChat/tools/segment-fans/ErrorState.tsx, components/VercelChat/tools/segment-fans/animations.ts
Removed all result/skeleton rendering for the get_segment_fans tool within the chat interface, including animated fan cards, headers, empty/error states, and Framer Motion animation variants.
React Hooks
hooks/useArtistSegments.ts, hooks/useCreateSegments.ts, hooks/useChatSegment.ts, hooks/useFansCSVExport.tsx
Removed hooks for fetching segments, creating segments, fetching chat segment data, and exporting fans to CSV.
Segment Generation & Orchestration
lib/segments/createSegments.ts, lib/segments/generateSegments.ts, lib/segments/getAnalysisPrompt.ts, lib/segments/getFanSegmentsToInsert.ts, lib/segments/createSegmentResponses.ts, lib/agent/getSegments.tsx
Removed orchestration logic for creating segments, generating segment names from prompt + fans, building analysis prompts, and constructing response payloads; also removed agent API segment fetching.
Chat & Supabase Database Operations
lib/chats/getChatSegment.ts, lib/supabase/getArtistSegments.ts, lib/supabase/getArtistSegmentNames.ts, lib/supabase/getSegmentCounts.ts, lib/supabase/segments/deleteSegments.ts, lib/supabase/segments/insertSegments.ts, lib/supabase/fan_segments/selectFanSegments.ts, lib/supabase/fan_segments/insertFanSegments.ts, lib/supabase/artist_segments/insertArtistSegments.ts, lib/getFanSegments.tsx, lib/getFunnelReport.tsx
Removed all database query and mutation functions for segments, fan-segment associations, chat segments, and funnel reporting; includes segment fetching, insertion, deletion, and counting operations.
AI Tool Definitions & Integration
lib/tools/createSegments.ts, lib/tools/getArtistSegments.ts, lib/tools/getSegmentFans.ts, lib/tools/getMcpTools.ts, lib/utils/getToolsInfo.ts
Removed AI/MCP tool definitions for create_segments, get_artist_segments, and get_segment_fans, plus their integration into the tool registry and messaging utilities.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sweetmantech
  • cubic-dev-ai

Poem

🧹 Segments and fans, once a grand display,
Now swept away in this cleanup day,
A hundred files bid their last goodbye,
Clean architecture reaches for the sky ✨

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Solid & Clean Code ✅ Passed PR demonstrates excellent SOLID and clean code adherence with complete, thorough removal of all segment-related UI components across routes, components, hooks, and tools with no orphaned imports or technical debt.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-segments-surface

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
components/Sidebar/MiniMenu.tsx (1)

1-48: Remove MiniMenu component—it's confirmed dead code with zero usages.

The codebase search found no imports or references to this component anywhere. Following SOLID principles and YAGNI, maintaining an unused component adds unnecessary technical debt. Since this PR is already removing dead surfaces, removing components/Sidebar/MiniMenu.tsx aligns with the cleanup effort.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/Sidebar/MiniMenu.tsx` around lines 1 - 48, Delete the unused
MiniMenu component file: remove the entire MiniMenu component
(functions/symbols: MiniMenu, goToItem, toggleMenuExpanded) since it has no
imports/usages; ensure any exports/defaults referencing MiniMenu are removed and
run a quick project build/search to confirm no remaining references before
committing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/Sidebar/MiniMenu.tsx`:
- Around line 1-48: Delete the unused MiniMenu component file: remove the entire
MiniMenu component (functions/symbols: MiniMenu, goToItem, toggleMenuExpanded)
since it has no imports/usages; ensure any exports/defaults referencing MiniMenu
are removed and run a quick project build/search to confirm no remaining
references before committing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3194c5a9-bed4-49d4-9b1e-42f7122f64b1

📥 Commits

Reviewing files that changed from the base of the PR and between 59ad27d and c90285c.

⛔ Files ignored due to path filters (2)
  • public/segment.svg is excluded by !**/*.svg and included by none
  • types/fans.ts is excluded by none and included by none
📒 Files selected for processing (49)
  • app/api/segments/create/route.ts
  • app/api/segments/route.ts
  • app/segments/page.tsx
  • components/Segments/FanProfileHover.tsx
  • components/Segments/NoSegmentsFound.tsx
  • components/Segments/SegmentButton.tsx
  • components/Segments/SegmentFanCircles.tsx
  • components/Segments/Segments.tsx
  • components/Segments/SegmentsSkeleton.tsx
  • components/Segments/SegmentsWrapper.tsx
  • components/SideMenu/SideMenu.tsx
  • components/Sidebar/FanGroupNavItem.tsx
  • components/Sidebar/Menu.tsx
  • components/Sidebar/MiniMenu.tsx
  • components/Sidebar/SecondaryNav.tsx
  • components/VercelChat/ToolComponents.tsx
  • components/VercelChat/tools/segment-fans/EmptyState.tsx
  • components/VercelChat/tools/segment-fans/ErrorState.tsx
  • components/VercelChat/tools/segment-fans/FanCard.tsx
  • components/VercelChat/tools/segment-fans/GetSegmentFansResult.tsx
  • components/VercelChat/tools/segment-fans/GetSegmentFansResultSkeleton.tsx
  • components/VercelChat/tools/segment-fans/SegmentHeader.tsx
  • components/VercelChat/tools/segment-fans/animations.ts
  • hooks/useArtistSegments.ts
  • hooks/useChatSegment.ts
  • hooks/useCreateSegments.ts
  • hooks/useFansCSVExport.tsx
  • lib/agent/getSegments.tsx
  • lib/chats/getChatSegment.ts
  • lib/getFanSegments.tsx
  • lib/getFunnelReport.tsx
  • lib/segments/createSegmentResponses.ts
  • lib/segments/createSegments.ts
  • lib/segments/generateSegments.ts
  • lib/segments/getAnalysisPrompt.ts
  • lib/segments/getFanSegmentsToInsert.ts
  • lib/supabase/artist_segments/insertArtistSegments.ts
  • lib/supabase/fan_segments/insertFanSegments.ts
  • lib/supabase/fan_segments/selectFanSegments.ts
  • lib/supabase/getArtistSegmentNames.ts
  • lib/supabase/getArtistSegments.ts
  • lib/supabase/getSegmentCounts.ts
  • lib/supabase/segments/deleteSegments.ts
  • lib/supabase/segments/insertSegments.ts
  • lib/tools/createSegments.ts
  • lib/tools/getArtistSegments.ts
  • lib/tools/getMcpTools.ts
  • lib/tools/getSegmentFans.ts
  • lib/utils/getToolsInfo.ts
💤 Files with no reviewable changes (48)
  • lib/utils/getToolsInfo.ts
  • lib/getFunnelReport.tsx
  • components/VercelChat/tools/segment-fans/ErrorState.tsx
  • components/SideMenu/SideMenu.tsx
  • components/Sidebar/Menu.tsx
  • components/Sidebar/SecondaryNav.tsx
  • lib/supabase/segments/insertSegments.ts
  • lib/supabase/artist_segments/insertArtistSegments.ts
  • components/VercelChat/ToolComponents.tsx
  • components/VercelChat/tools/segment-fans/SegmentHeader.tsx
  • components/Segments/Segments.tsx
  • lib/tools/getArtistSegments.ts
  • lib/supabase/getArtistSegmentNames.ts
  • lib/supabase/fan_segments/insertFanSegments.ts
  • lib/supabase/getSegmentCounts.ts
  • components/VercelChat/tools/segment-fans/EmptyState.tsx
  • hooks/useArtistSegments.ts
  • lib/getFanSegments.tsx
  • lib/supabase/fan_segments/selectFanSegments.ts
  • components/Sidebar/FanGroupNavItem.tsx
  • components/Segments/SegmentsSkeleton.tsx
  • app/segments/page.tsx
  • lib/tools/getMcpTools.ts
  • components/Segments/NoSegmentsFound.tsx
  • components/VercelChat/tools/segment-fans/animations.ts
  • lib/segments/getFanSegmentsToInsert.ts
  • lib/agent/getSegments.tsx
  • lib/segments/generateSegments.ts
  • hooks/useFansCSVExport.tsx
  • components/VercelChat/tools/segment-fans/FanCard.tsx
  • hooks/useCreateSegments.ts
  • lib/chats/getChatSegment.ts
  • components/Segments/SegmentButton.tsx
  • lib/segments/getAnalysisPrompt.ts
  • lib/tools/createSegments.ts
  • lib/segments/createSegmentResponses.ts
  • lib/supabase/getArtistSegments.ts
  • components/VercelChat/tools/segment-fans/GetSegmentFansResult.tsx
  • lib/supabase/segments/deleteSegments.ts
  • components/Segments/SegmentsWrapper.tsx
  • hooks/useChatSegment.ts
  • components/Segments/FanProfileHover.tsx
  • lib/tools/getSegmentFans.ts
  • app/api/segments/route.ts
  • components/VercelChat/tools/segment-fans/GetSegmentFansResultSkeleton.tsx
  • app/api/segments/create/route.ts
  • components/Segments/SegmentFanCircles.tsx
  • lib/segments/createSegments.ts

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 51 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Large-scale deletion of a feature (51 files, ~1800 lines) including API routes, hooks, and core navigation components. Decommissioning features requires human verification of dependencies.

Note: This PR contains a large number of files. During the trial, cubic reviews up to 50 files per PR. Paid plans get a higher limit.

@sweetmantech sweetmantech merged commit 49f8c89 into test Apr 17, 2026
4 checks passed
@sweetmantech sweetmantech deleted the chore/remove-segments-surface branch April 17, 2026 20:09
sweetmantech added a commit that referenced this pull request Apr 17, 2026
Promote test → main: segments-surface cleanup (#1685)
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