Skip to content

chore(bot): remove dead track-management service in utils/music - #2276

Merged
LucasSantana-Dev merged 2 commits into
mainfrom
chore/remove-dead-track-management-service
Sep 6, 2026
Merged

LucasSantana-Dev merged 2 commits into
mainfrom
chore/remove-dead-track-management-service

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #1968.

Deleted packages/bot/src/utils/music/service.ts (TrackManagementService) and its spec. Confirmed via repo-wide grep: zero production importers, direct or via barrel - the utils/music/index.ts barrel that once re-exported it was already deleted separately. Only its own 445-line spec file referenced it.

This was #1984's finding (closed, but the actual deletion never landed - #1989's PR body says it was "deliberately left in place" pending a maintainer call). #1968 explicitly named this file as in its scope, so making that call here.

#1968's broader state, re-verified while investigating this: the directory it originally flagged (136 files, 10.5k LOC of misplaced stateful services mixed into a utils/ folder) is now 34 files / 3535 LOC. Prior bounded-slice PRs (#1985-#1989 and others, all explicitly scoped as "Nth bounded slice of #1968") already moved every DB/API-touching, timer-driven service out to services/musicRecommendation/ and services/musicManagement/ (watchdog.ts, queueResolver.ts, queueStateManager.ts, sessionStartupRestore.ts, the queue*.ts mutation files, the autoplay/ cluster including replenisher.ts/candidateScorer.ts, candidateFallback.ts, sessionSnapshots.ts, collaborativePlaylist.ts - all exactly matching the issue's original "suggested approach" destinations).

Checked every remaining class-based file in utils/music/ for the same misplacement pattern (DB access, external API calls, timers/recurring background state):

  • search/engineManager.ts's only setTimeout is an inline retry-backoff delay inside a function call, not a persistent scheduler
  • titleComparison/service.ts's Map is a plain in-memory memoization cache, no DB/API/timers
  • Everything else in the remaining 34 files is pure functions/type helpers (trackValidator.ts, trackNormalization.ts, searchQueryCleaner.ts, buttonComponents.ts, skipReasonMap.ts, etc.) - matching the issue's own "Keep in utils/" list

None of the remaining files match the pattern that made the original 136-file audit finding real. #1968 is functionally complete with this PR.

Test plan

  • Repo-wide grep confirms zero references to TrackManagementService/trackManagementService outside the deleted files
  • tsc --noEmit clean across bot/backend/frontend/shared
  • Full bot suite: 250 suites / 3285 tests pass (down from 251/3286 by exactly the deleted spec's own tests, no other regressions)

Summary by cubic

Removes the unused TrackManagementService from packages/bot/src/utils/music/service.ts and its spec file. It has no production importers (the barrel re-export was already removed), so only its own tests referenced it.

Context

Written for commit 900210d. Summary will update on new commits.

Review in cubic

Confirmed via repo-wide grep: zero production importers, direct or
via barrel (the utils/music/index.ts barrel that once re-exported it
was already deleted separately). Only its own 445-line spec file
referenced it.

This was #1984's finding, already independently reached the same
"genuinely unused" conclusion and closed without the actual deletion
landing - #1989's PR body says it was "deliberately left in place"
pending a maintainer call. #1968 (the utils/music/ -> services/ split
this file was orphaned by) explicitly names this file as in its
scope, so making that call here: delete it.

Also re-verified #1968's broader state while investigating this: the
utils/music/ directory it originally flagged (136 files, 10.5k LOC of
misplaced stateful services) is now 34 files / 3535 LOC after prior
bounded-slice PRs (#1985-#1989 and others) already moved the
DB/API-touching services into services/musicRecommendation/ and
services/musicManagement/. Checked every remaining class-based file
in utils/music/ for the same pattern (DB access, external API calls,
timers/recurring state) that made the original files misplaced - none
qualify (search/engineManager.ts's setTimeout is an inline retry
delay, not a scheduler; titleComparison/service.ts's Map is a plain
in-memory memoization cache). #1968 is functionally complete once
this PR merges.
@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) September 6, 2026 17:27

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Auto-approved: Removes the orphaned TrackManagementService and its spec; the service has no production importers after earlier migration, so this is a bounded dead-code deletion with no behavior change.

Re-trigger cubic

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

Removes the TrackManagementService unit test suite (service.spec.ts), dropping coverage for constructor option merging, track add/queue management flows, and their error paths.

No blocking issues surfaced. 2 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 0 functions depend on the 0 functions this change touches.

Health — grade A; no new coupling hotspots.

Verification — 0 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.


Graphify review — findings

Deletes the TrackManagementService unit test suite (service.spec.ts), removing coverage for queue add/manage behaviour, option merging, and error handling.

Worth a look

  • Deleted public TrackManagementService export — packages/bot/src/utils/music/service.ts:20 · Escalate · high
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 0 functions depend on the 0 functions this change touches.

Health — grade A; no new coupling hotspots.

Verification — 0 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(bot): utils/music/ (136 files, 10.5k LOC) contains stateful services mislabeled as utilities

1 participant