chore: remove dead code and dedupe web formatDuration #94

Merged
joshuafhiggins merged 2 commits from t3/general-cleanup into main 2026-11-16 21:45:26 -05:00
Owner

An audit turned up a lot of dead code: old server-side queue and library CRUD functions in Convex, unused files and exports in web and mobile, an unreachable mobile /queue screen, and five copies of formatDuration. This PR removes it without changing behavior.

Changes

  • Convex: removed 21 unused functions from playback.ts (the old server-side queue: playInOrder, skipNext, toggleShuffle, reorderQueue, getQueuePaginated, getSongProgress, …) and 19 from library.ts (browseSongs, browseAlbumSummary, browseAlbumTracksPaginated, getSongByName, createSong, …). Also removed playlists.browsePlaylistSummary, browsePlaylistSongsPaginated, the includeSongs arg, favorites.browseFavoritesSummary, browseFavoritesSongsPaginated, the unused BrowseAlbumSummary type, and actions.cleanupHlsStreams.
    • I deleted cleanupHlsStreams instead of scheduling it. Nothing ever scheduled it, the web server already evicts idle HLS jobs in server-hls.ts, and admins can still trigger adminCleanupHlsStreams from settings.
  • Web: deleted lib/data.ts, generateKeys.mjs (a duplicate of docker/generate-auth-keys.mjs), and the unwired lib/station-artist.test.mjs. Removed unused exports in media-links.ts, album-grid-classes.ts and selection-range-styles.tsx. The five formatDuration copies now use one lib/format-duration.ts, which keeps player-bar's flooring. The other call sites pass integer durationSeconds, so their output is unchanged.
  • Mobile: deleted the unreachable /queue routes (the mini player opens /(app)/player?queue=1, and no links or deep links point at /queue) and the media-actions-sheet re-export barrel; its importers now import from media-context-menu. Memoized the ConvexAuthSessionProvider value and fixed its error message, which named the wrong provider. Dropped the unused palette.background dep from the playlist screenOptions memo and formatted use-cover-palette.ts.

Not done

  • The ~32 one-line route re-export shims under library/, search/ and the (albums,…) group are still there. Merging home/library/search into a shared group would change the NativeTabs triggers, anchor: "library", the per-tab index/_layout screens, and the +native-intent deep link target (/(app)/(tabs)/home/...). That's a navigation refactor on both platforms, not a cleanup.

Older mobile builds on self-hosted servers

  • Builds from before #38 (Nov 3) call browsePlaylistSongsPaginated, browseFavoritesSongsPaginated and browsePlaylistDetail({ includeSongs: false }). Their playlist and favorites screens break against this server.
  • Builds from before 4a740c9 (Oct 8, client-first playback) call the old server-side queue functions and library.browseSongs.
  • Every build from #38 onward is unaffected.

Verification

pnpm -r typecheck (convex, web, mobile) and web eslint pass. I didn't run the app on a simulator; the only route change is deleting screens that nothing navigates to.


Changes made by Claude Opus 5.5 via Claude Code (T3 Code harness).

🤖 Generated with Claude Code

An audit turned up a lot of dead code: old server-side queue and library CRUD functions in Convex, unused files and exports in web and mobile, an unreachable mobile `/queue` screen, and five copies of `formatDuration`. This PR removes it without changing behavior. ## Changes - **Convex**: removed 21 unused functions from `playback.ts` (the old server-side queue: `playInOrder`, `skipNext`, `toggleShuffle`, `reorderQueue`, `getQueuePaginated`, `getSongProgress`, …) and 19 from `library.ts` (`browseSongs`, `browseAlbumSummary`, `browseAlbumTracksPaginated`, `getSongByName`, `createSong`, …). Also removed `playlists.browsePlaylistSummary`, `browsePlaylistSongsPaginated`, the `includeSongs` arg, `favorites.browseFavoritesSummary`, `browseFavoritesSongsPaginated`, the unused `BrowseAlbumSummary` type, and `actions.cleanupHlsStreams`. - I deleted `cleanupHlsStreams` instead of scheduling it. Nothing ever scheduled it, the web server already evicts idle HLS jobs in `server-hls.ts`, and admins can still trigger `adminCleanupHlsStreams` from settings. - **Web**: deleted `lib/data.ts`, `generateKeys.mjs` (a duplicate of `docker/generate-auth-keys.mjs`), and the unwired `lib/station-artist.test.mjs`. Removed unused exports in `media-links.ts`, `album-grid-classes.ts` and `selection-range-styles.tsx`. The five `formatDuration` copies now use one `lib/format-duration.ts`, which keeps `player-bar`'s flooring. The other call sites pass integer `durationSeconds`, so their output is unchanged. - **Mobile**: deleted the unreachable `/queue` routes (the mini player opens `/(app)/player?queue=1`, and no links or deep links point at `/queue`) and the `media-actions-sheet` re-export barrel; its importers now import from `media-context-menu`. Memoized the `ConvexAuthSessionProvider` value and fixed its error message, which named the wrong provider. Dropped the unused `palette.background` dep from the playlist `screenOptions` memo and formatted `use-cover-palette.ts`. ## Not done - The ~32 one-line route re-export shims under `library/`, `search/` and the `(albums,…)` group are still there. Merging `home/library/search` into a shared group would change the NativeTabs triggers, `anchor: "library"`, the per-tab `index`/`_layout` screens, and the `+native-intent` deep link target (`/(app)/(tabs)/home/...`). That's a navigation refactor on both platforms, not a cleanup. ## Older mobile builds on self-hosted servers - Builds from before #38 (Nov 3) call `browsePlaylistSongsPaginated`, `browseFavoritesSongsPaginated` and `browsePlaylistDetail({ includeSongs: false })`. Their playlist and favorites screens break against this server. - Builds from before `4a740c9` (Oct 8, client-first playback) call the old server-side queue functions and `library.browseSongs`. - Every build from #38 onward is unaffected. ## Verification `pnpm -r typecheck` (convex, web, mobile) and web `eslint` pass. I didn't run the app on a simulator; the only route change is deleting screens that nothing navigates to. --- Changes made by Claude Opus 5.5 via Claude Code (T3 Code harness). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
joshuafhiggins added 1 commit 2026-11-16 13:52:53 -05:00
Remove ~45 unused Convex functions (old server-side queue, library CRUD,
paginated playlist/favorites queries, unscheduled cleanupHlsStreams), dead
web/mobile files and exports, and the unreachable mobile /queue routes.
Share one formatDuration helper in web. Memoize the auth session context
value and fix its provider error message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joshuafhiggins added 1 commit 2026-11-16 21:45:20 -05:00
# Conflicts:
#	apps/mobile/hooks/use-cover-palette.ts
joshuafhiggins merged commit 22e659cd66 into main 2026-11-16 21:45:26 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joshuafhiggins/otunes#94