Skip to content

fix: sort tracks and tags in PlaylistServiceImpl.mapToResponseDTO for deterministic responses#16

Merged
jfontdev merged 1 commit into
feat/update-delete-operationsfrom
copilot/sub-pr-15
Mar 28, 2026
Merged

fix: sort tracks and tags in PlaylistServiceImpl.mapToResponseDTO for deterministic responses#16
jfontdev merged 1 commit into
feat/update-delete-operationsfrom
copilot/sub-pr-15

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

mapToResponseDTO() was converting HashSet-backed sets directly to lists, producing nondeterministic ordering of tracks and tags across API responses.

Changes

  • PlaylistServiceImpl.mapToResponseDTO() — sorts tracks by title and tags by name before constructing response DTOs
List<TrackResponseDTO> trackDTOs = playlist.getTracks().stream()
    .map(track -> {
        List<TagResponseDTO> tagDTOs = track.getTags().stream()
                .map(tag -> new TagResponseDTO(tag.getId(), tag.getName()))
                .sorted(Comparator.comparing(TagResponseDTO::name))
                .toList();
        return new TrackResponseDTO(..., tagDTOs);
    })
    .sorted(Comparator.comparing(TrackResponseDTO::title))
    .toList();

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] [WIP] Address feedback on Phase 6 implementation for update, delete, and relationships fix: sort tracks and tags in PlaylistServiceImpl.mapToResponseDTO for deterministic responses Mar 28, 2026
Copilot AI requested a review from jfontdev March 28, 2026 21:40
@jfontdev jfontdev marked this pull request as ready for review March 28, 2026 21:43
@jfontdev jfontdev merged commit 006667c into feat/update-delete-operations Mar 28, 2026
1 check passed
@jfontdev jfontdev deleted the copilot/sub-pr-15 branch March 28, 2026 21:43
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