Two more cohesive blocks lifted out of monolithic files following the
same recipe as the marketplace refund split (commit 36ee3da1).
internal/core/track/service.go : 1639 → 1026 LOC
Extracted to service_upload.go (640 LOC) :
UploadTrack (multipart entry point)
copyFileAsync (local/s3 dispatcher)
copyFileAsyncLocal (FS write path)
copyFileAsyncS3 (direct S3 stream path, v1.0.8)
chunkStreamer interface (helper for chunked → S3)
CreateTrackFromChunkedUploadToS3 (v1.0.9 1.5 fast path)
extFromContentType (helper)
MigrateLocalToS3IfConfigured (post-assembly migration)
mimeTypeForAudioExt (helper)
updateTrackStatus (status updater)
cleanupFailedUpload (rollback helper)
CreateTrackFromPath (no-multipart constructor)
Removed `internal/monitoring` import from service.go (the only user
was the upload path).
internal/handlers/playlist_handler.go : 1397 → 1107 LOC
Extracted to playlist_handler_collaborators.go (309 LOC) :
AddCollaboratorRequest, UpdateCollaboratorPermissionRequest DTOs
AddCollaborator, RemoveCollaborator,
UpdateCollaboratorPermission, GetCollaborators handlers
All four handlers were a self-contained surface (one route group,
one DTO pair, no shared helpers with the rest of the file).
Tests run after each split :
go test ./internal/core/marketplace -short → PASS
go test ./internal/core/track -short → PASS
go test ./internal/handlers -short → PASS
The dette-tech split target was three files at 1.7k+ / 1.6k+ / 1.4k+
LOC. After this commit + 36ee3da1 :
marketplace/service.go : 1737 → 1340 (-397)
track/service.go : 1639 → 1026 (-613)
handlers/playlist_handler.go : 1397 → 1107 (-290)
total reduction : 4773 → 3473 (-1300, -27%)
Each receiver still has a clear "main" file ; the extracted siblings
encapsulate one concern apiece. Future splits should follow the same
naming pattern (service_<concern>.go,
playlist_handler_<concern>.go) so a quick `ls` shows the file
organisation matches the feature surface.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>