feat: Admin › Reports is one queue of broken tracks, whether a listener flagged it or it failed to play, one row per track with one set of actions (M503 #5606)
release / govulncheck (push) Successful in 16s
release / web (push) Failing after 1m18s
release / go (push) Successful in 1m36s
release / integration (push) Successful in 5m27s
release / android (push) Successful in 5m28s
release / Build signed APK (releases and dev) (push) Successful in 5m38s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped

- /admin/reports folds the quarantine queue and the unresolved playback
  errors into one row per track, newest first: who flagged it and why,
  what failed and for whom, the file, with Resolve (clears the reports and
  marks the errors fixed), Play, Copy details, Delete file and, for an album
  Lidarr holds, Delete via Lidarr.
- One delete path: Delete file removes the track, and its reports and
  errors go with the row.
- A Handled tab shows what was done: reports cleared, files deleted,
  errors marked fixed or ignored.
- The summary counts reports by track across both sources, so the rail,
  the Overview and the page agree.
- /admin/quarantine and /admin/playback-errors redirect to Reports: the
  notifications and the Android app link to them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 10:53:58 -04:00
co-authored by Claude Opus 5.5
parent 864eb45580
commit 89a2653995
17 changed files with 765 additions and 960 deletions
+23 -20
View File
@@ -15,10 +15,17 @@ const adminSummary = `-- name: AdminSummary :one
SELECT
(SELECT count(*) FROM requests WHERE status = 'pending')::bigint AS requests,
(SELECT min(requested_at) FROM requests WHERE status = 'pending')::timestamptz AS requests_since,
(SELECT count(DISTINCT track_id) FROM lidarr_quarantine)::bigint AS quarantined,
(SELECT min(created_at) FROM lidarr_quarantine)::timestamptz AS quarantined_since,
(SELECT count(*) FROM playback_errors WHERE resolved_at IS NULL)::bigint AS playback_errors,
(SELECT min(occurred_at) FROM playback_errors WHERE resolved_at IS NULL)::timestamptz AS playback_errors_since,
-- A broken track is one report however it was found: a listener flagged
-- it, or it failed to play (#5606). Counted by track, as the Reports
-- page lists them.
(SELECT count(*) FROM (
SELECT track_id FROM lidarr_quarantine
UNION
SELECT track_id FROM playback_errors WHERE resolved_at IS NULL) r)::bigint AS reports,
(SELECT min(at) FROM (
SELECT created_at AS at FROM lidarr_quarantine
UNION ALL
SELECT occurred_at FROM playback_errors WHERE resolved_at IS NULL) r)::timestamptz AS reports_since,
(SELECT count(*) FROM duplicate_groups g
WHERE g.status = 'pending'
AND (SELECT count(*) FROM duplicate_group_members m WHERE m.group_id = g.id) >= 2)::bigint AS duplicates,
@@ -32,18 +39,16 @@ SELECT
`
type AdminSummaryRow struct {
Requests int64
RequestsSince pgtype.Timestamptz
Quarantined int64
QuarantinedSince pgtype.Timestamptz
PlaybackErrors int64
PlaybackErrorsSince pgtype.Timestamptz
Duplicates int64
DuplicatesSince pgtype.Timestamptz
Suspect int64
SuspectSince pgtype.Timestamptz
Missing int64
MissingSince pgtype.Timestamptz
Requests int64
RequestsSince pgtype.Timestamptz
Reports int64
ReportsSince pgtype.Timestamptz
Duplicates int64
DuplicatesSince pgtype.Timestamptz
Suspect int64
SuspectSince pgtype.Timestamptz
Missing int64
MissingSince pgtype.Timestamptz
}
// What the admin rail and the Overview's verdict read (#5605): each queue
@@ -57,10 +62,8 @@ func (q *Queries) AdminSummary(ctx context.Context) (AdminSummaryRow, error) {
err := row.Scan(
&i.Requests,
&i.RequestsSince,
&i.Quarantined,
&i.QuarantinedSince,
&i.PlaybackErrors,
&i.PlaybackErrorsSince,
&i.Reports,
&i.ReportsSince,
&i.Duplicates,
&i.DuplicatesSince,
&i.Suspect,