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
+10 -10
View File
@@ -452,21 +452,21 @@ func (h *handlers) handleMergeDuplicateGroup(w http.ResponseWriter, r *http.Requ
writeJSON(w, http.StatusOK, resp)
}
// refetchDuplicateRequest is an admin's answer for one recording filling
// wrongSlotRequest is an admin's answer for one recording filling
// several of an album's slots. keep_track_id is the copy whose title the
// recording is; empty means they cannot say, and every copy goes.
type refetchDuplicateRequest struct {
type wrongSlotRequest struct {
KeepTrackID string `json:"keep_track_id"`
}
// refetchDuplicateResponse reports what went.
type refetchDuplicateResponse struct {
// wrongSlotResponse reports what went.
type wrongSlotResponse struct {
KeptTrackID *string `json:"kept_track_id"`
RemovedPaths []string `json:"removed_paths"`
}
// handleRefetchDuplicateGroup implements POST
// /api/admin/library/duplicates/{id}/refetch: settle a group of one
// handleRemoveWrongSlotFiles implements POST
// /api/admin/library/duplicates/{id}/remove-files: settle a group of one
// recording in several slots of an album the way the resolver would, with an
// admin's answer. The copies in slots that are not the recording's are
// removed and marked missing, so the slot shows as missing until a good copy
@@ -479,7 +479,7 @@ type refetchDuplicateResponse struct {
// - 404 duplicate_group_not_pending when the group was already resolved
// - 400 not_wrong_slot when the group is not one recording in several slots
// - 400 survivor_not_in_group, invalid_id, invalid_body
func (h *handlers) handleRefetchDuplicateGroup(w http.ResponseWriter, r *http.Request) {
func (h *handlers) handleRemoveWrongSlotFiles(w http.ResponseWriter, r *http.Request) {
admin, ok := requireUser(w, r)
if !ok {
return
@@ -489,7 +489,7 @@ func (h *handlers) handleRefetchDuplicateGroup(w http.ResponseWriter, r *http.Re
writeAdminJSONErr(w, http.StatusBadRequest, "invalid_id")
return
}
var body refetchDuplicateRequest
var body wrongSlotRequest
if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, mergeRequestBodyLimit)).Decode(&body); err != nil && !errors.Is(err, io.EOF) {
writeAdminJSONErr(w, http.StatusBadRequest, "invalid_body")
return
@@ -517,13 +517,13 @@ func (h *handlers) handleRefetchDuplicateGroup(w http.ResponseWriter, r *http.Re
case errors.Is(err, library.ErrSurvivorNotInGroup):
writeAdminJSONErr(w, http.StatusBadRequest, "survivor_not_in_group")
default:
h.logger.Error("admin: refetch duplicate group", "group_id", uuidToString(groupID), "err", err)
h.logger.Error("admin: remove wrong-slot files", "group_id", uuidToString(groupID), "err", err)
writeAdminJSONErr(w, http.StatusInternalServerError, "server_error")
}
return
}
resp := refetchDuplicateResponse{RemovedPaths: make([]string, 0, len(res.Removed))}
resp := wrongSlotResponse{RemovedPaths: make([]string, 0, len(res.Removed))}
if res.Kept != nil {
id := uuidToString(res.Kept.TrackID)
resp.KeptTrackID = &id
+1 -1
View File
@@ -247,7 +247,7 @@ func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, events *playev
admin.Post("/library/duplicates/sweep", h.handleRunDuplicateSweep)
admin.Post("/library/duplicates/{id}/dismiss", h.handleDismissDuplicateGroup)
admin.Post("/library/duplicates/{id}/merge", h.handleMergeDuplicateGroup)
admin.Post("/library/duplicates/{id}/refetch", h.handleRefetchDuplicateGroup)
admin.Post("/library/duplicates/{id}/remove-files", h.handleRemoveWrongSlotFiles)
admin.Get("/invites", h.handleListInvites)
admin.Post("/invites", h.handleCreateInvite)