feat(web): every Collection queue can remove the file and keep the track
release / web (push) Failing after 1m28s
release / go (push) Successful in 1m53s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m16s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 2m13s
release / android (push) Canceled after 2m59s

Reports offers "Remove the file" ahead of "Remove from library": the
bad file goes and the track waits in Needs a file, with its likes and
plays, for a good copy. Suspect sources gets "Remove this file", and the
Duplicates wrong-slot action and its route are named for what they do
(remove-files). Their toasts and copy name Needs a file.

Missing files becomes Needs a file in the rail, the Collection header and
the Overview counts. Each track says why it waits and who removed it, and
can be forgotten one at a time or by folder; the list exports as a CSV or
copies to the clipboard. The empty state says how a track gets there and
how it leaves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 18:47:36 -05:00
co-authored by Claude Opus 5.5
parent 492eb2fb9a
commit bcd9e422a5
19 changed files with 461 additions and 139 deletions
+32 -8
View File
@@ -9,7 +9,7 @@ import type {
AdminDuplicatesResponse,
DuplicatesView,
MergeDuplicateResult,
RefetchDuplicateResult,
WrongSlotRemoval,
ResolvedDuplicatesResponse,
AdminPlaybackError,
AdminQuarantineRow,
@@ -61,6 +61,13 @@ export async function resolveQuarantine(trackID: string): Promise<ActionResult>
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/resolve`, {});
}
// Removes the reported file and keeps the track, which waits in Needs a file
// for a good copy. Its reports and playback errors are settled with it.
export async function removeQuarantineFile(trackID: string): Promise<ActionResult> {
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/remove-file`, {});
}
// Removes the track from the library with its file, history and all.
export async function deleteQuarantineFile(trackID: string): Promise<ActionResult> {
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/delete-file`, {});
}
@@ -834,14 +841,15 @@ export async function mergeDuplicateGroup(
);
}
// One recording in several of an album's slots: keep the copy whose
// title it is, or none (empty keep_track_id), and fetch the album again.
export async function refetchDuplicateGroup(
// One recording in several of an album's slots: keep the copy whose title it
// is, or none (empty keep_track_id). The other copies' files go and their
// tracks wait in Needs a file for a good copy.
export async function removeWrongSlotFiles(
id: string,
body: { keep_track_id: string }
): Promise<RefetchDuplicateResult> {
return api.post<RefetchDuplicateResult>(
`/api/admin/library/duplicates/${encodeURIComponent(id)}/refetch`,
): Promise<WrongSlotRemoval> {
return api.post<WrongSlotRemoval>(
`/api/admin/library/duplicates/${encodeURIComponent(id)}/remove-files`,
body
);
}
@@ -850,7 +858,7 @@ export async function dismissDuplicateGroup(id: string): Promise<void> {
await api.post(`/api/admin/library/duplicates/${encodeURIComponent(id)}/dismiss`, {});
}
// Missing files -----------------------------------------------------
// Needs a file ------------------------------------------------------
export async function listMissingFiles(
offset: number = 0,
@@ -876,6 +884,16 @@ export function createMissingFilesQuery(offset: number = 0, limit: number = 50)
});
}
// Forgets tracks waiting for a file, for good: each goes with its likes, plays
// and playlist places. All or nothing; a track whose file is back is refused.
export async function forgetMissingTracks(trackIds: string[]): Promise<{ forgotten: number }> {
return api.post<{ forgotten: number }>('/api/admin/library/missing/forget', { track_ids: trackIds });
}
// The whole list as a CSV, to hand to whatever finds music. A plain link
// downloads it: the session cookie goes with it.
export const MISSING_FILES_CSV_URL = '/api/admin/library/missing.csv';
// Suspect sources --------------------------------------------------
export const SUSPECT_SOURCES_PAGE_SIZE = 50;
@@ -910,6 +928,12 @@ export async function setSuspectVerdict(trackId: string, verdict: SuspectVerdict
await api.put(`/api/admin/library/suspect-sources/${encodeURIComponent(trackId)}`, { verdict });
}
// Removes a suspect source's file and keeps its track, which waits in Needs a
// file for a clean copy.
export async function removeSuspectFile(trackId: string): Promise<void> {
await api.post(`/api/admin/library/suspect-sources/${encodeURIComponent(trackId)}/remove`, {});
}
// Notification emails: when the grouped emails go out.
export type NotificationEmailSettings = {
summary_hour: number;
+19 -8
View File
@@ -215,7 +215,7 @@ export type AdminPlaybackError = {
// deleted_album is history: an album removed whole, before Minstrel filed its
// own music.
export type QuarantineAction = 'resolved' | 'deleted_file' | 'deleted_album';
export type QuarantineAction = 'resolved' | 'removed_file' | 'deleted_file' | 'deleted_album';
export type QuarantineActionRow = {
id: string;
@@ -247,13 +247,18 @@ export type HomePayload = {
you_might_like_artists: ArtistRef[];
};
// Missing files -----------------------------------------------------
// Needs a file ------------------------------------------------------
// One track whose file the scan could not find. The text fields come from the
// tracks row rather than the filesystem — the recording is still a known thing
// with a history, only its bytes are absent. last_played_at is null for a file
// that was never played, which is the signal that separates "worth chasing"
// from "let it go".
// Which Collection queue a track's file was removed from. A track with none
// went missing from disk on its own.
export type RemovedFor = 'report' | 'duplicate' | 'suspect';
// One track waiting for a file. The text fields come from the tracks row
// rather than the filesystem — the recording is still a known thing with a
// history, only its bytes are absent. last_played_at is null for a file that
// was never played, which is the signal that separates "worth chasing" from
// "let it go". removed_by is the admin who removed it, null for the duplicate
// checker or a file gone from disk.
export type AdminMissingTrack = {
track_id: string;
title: string;
@@ -263,6 +268,12 @@ export type AdminMissingTrack = {
album_title: string;
file_path: string;
duration_sec: number;
disc_number: number | null;
track_number: number | null;
recording_mbid: string | null;
release_group_mbid: string | null;
removed_for: RemovedFor | null;
removed_by: string | null;
missing_since: string;
last_played_at: string | null;
};
@@ -381,7 +392,7 @@ export type MergeDuplicateResult = {
// What settling one recording in several slots did. kept_track_id is
// null when every copy went.
export type RefetchDuplicateResult = {
export type WrongSlotRemoval = {
kept_track_id: string | null;
removed_paths: string[];
};