feat: Minstrel no longer talks to Lidarr: its connection, Delete via Lidarr and the unmonitor options are gone, and the track reports are plain quarantine (M502 #5525)
release / govulncheck (push) Successful in 15s
release / web (push) Failing after 17s
release / go (push) Successful in 1m13s
release / integration (push) Successful in 4m56s
release / android (push) Successful in 5m9s
release / Build signed APK (releases and dev) (push) Successful in 5m19s
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

Migration 0091 drops lidarr_config and renames the quarantine tables, types,
indexes and the history column off the Lidarr name. The Integrations Lidarr
card, the Reports "Delete via Lidarr" action, the merge and remove-track
unmonitor options, the Lidarr audit actions and error codes go, on the
server, web and Android. The README describes acquisition as it is now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 13:48:20 -04:00
co-authored by Claude Opus 5.5
parent c54792c51e
commit 3a16732883
170 changed files with 994 additions and 6242 deletions
+3 -121
View File
@@ -10,18 +10,12 @@ vi.mock('./client', () => ({
}));
import {
getLidarrConfig,
putLidarrConfig,
testLidarrConnection,
listQualityProfiles,
listRootFolders,
listAdminRequests,
approveRequest,
rejectRequest,
listAdminQuarantine,
resolveQuarantine,
deleteQuarantineFile,
deleteQuarantineViaLidarr,
listQuarantineActions
} from './admin';
import { api } from './client';
@@ -29,22 +23,10 @@ import { qk } from './queries';
import type {
ActionResult,
AdminQuarantineRow,
LidarrConfig,
LidarrQualityProfile,
LidarrQuarantineActionRow,
MusicRequest,
LidarrRootFolder
QuarantineActionRow,
MusicRequest
} from './types';
const baseConfig: LidarrConfig = {
enabled: true,
base_url: 'http://lidarr.lan:8686',
api_key: '***',
default_quality_profile_id: 1,
default_metadata_profile_id: 1,
default_root_folder_path: '/music'
};
const baseRow: MusicRequest = {
id: 'r1',
user_id: 'u1',
@@ -73,83 +55,6 @@ beforeEach(() => {
vi.clearAllMocks();
});
describe('getLidarrConfig', () => {
test('GETs /api/admin/lidarr/config', async () => {
(api.get as ReturnType<typeof vi.fn>).mockResolvedValueOnce(baseConfig);
const out = await getLidarrConfig();
expect(api.get).toHaveBeenCalledWith('/api/admin/lidarr/config');
expect(out).toBe(baseConfig);
});
});
describe('putLidarrConfig', () => {
test('PUTs /api/admin/lidarr/config with the full config body', async () => {
const next: LidarrConfig = { ...baseConfig, api_key: 'plain-key' };
(api.put as ReturnType<typeof vi.fn>).mockResolvedValueOnce(next);
const out = await putLidarrConfig(next);
expect(api.put).toHaveBeenCalledWith('/api/admin/lidarr/config', next);
expect(out).toBe(next);
});
});
describe('testLidarrConnection', () => {
test('POSTs /api/admin/lidarr/test with empty body when no overrides', async () => {
(api.post as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
ok: true,
version: '2.0.0'
});
const out = await testLidarrConnection();
expect(api.post).toHaveBeenCalledWith('/api/admin/lidarr/test', {});
expect(out).toEqual({ ok: true, version: '2.0.0' });
});
test('forwards override base_url + api_key body', async () => {
(api.post as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
ok: true,
version: '2.0.0'
});
await testLidarrConnection({
base_url: 'http://other:8686',
api_key: 'try-this'
});
expect(api.post).toHaveBeenCalledWith('/api/admin/lidarr/test', {
base_url: 'http://other:8686',
api_key: 'try-this'
});
});
test('returns ok:false branch without throwing', async () => {
(api.post as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
ok: false,
error: 'auth failed'
});
const out = await testLidarrConnection();
expect(out).toEqual({ ok: false, error: 'auth failed' });
});
});
describe('listQualityProfiles', () => {
test('GETs /api/admin/lidarr/quality-profiles', async () => {
const profiles: LidarrQualityProfile[] = [{ id: 1, name: 'Lossless' }];
(api.get as ReturnType<typeof vi.fn>).mockResolvedValueOnce(profiles);
const out = await listQualityProfiles();
expect(api.get).toHaveBeenCalledWith('/api/admin/lidarr/quality-profiles');
expect(out).toBe(profiles);
});
});
describe('listRootFolders', () => {
test('GETs /api/admin/lidarr/root-folders', async () => {
const folders: LidarrRootFolder[] = [
{ path: '/music', accessible: true, free_space: 100 }
];
(api.get as ReturnType<typeof vi.fn>).mockResolvedValueOnce(folders);
const out = await listRootFolders();
expect(api.get).toHaveBeenCalledWith('/api/admin/lidarr/root-folders');
expect(out).toBe(folders);
});
});
describe('listAdminRequests', () => {
test('no args -> /api/admin/requests with no query string', async () => {
(api.get as ReturnType<typeof vi.fn>).mockResolvedValueOnce([baseRow]);
@@ -209,15 +114,6 @@ describe('rejectRequest', () => {
});
describe('qk admin keys', () => {
test('lidarrConfig key', () => {
expect(qk.lidarrConfig()).toEqual(['lidarrConfig']);
});
test('lidarrQualityProfiles key', () => {
expect(qk.lidarrQualityProfiles()).toEqual(['lidarrQualityProfiles']);
});
test('lidarrRootFolders key', () => {
expect(qk.lidarrRootFolders()).toEqual(['lidarrRootFolders']);
});
test('adminRequests key uses "all" when status omitted', () => {
// listAdminRequests sends no status param when called without one (returns
// every status), so the cache key must distinguish that from any specific
@@ -238,7 +134,6 @@ const baseQuarantineRow: AdminQuarantineRow = {
artist_name: 'Aphex Twin',
album_title: 'Drukqs',
album_id: 'alb1',
lidarr_album_mbid: null,
report_count: 1,
latest_at: '2026-01-01T00:00:00Z',
reason_counts: { bad_rip: 1 },
@@ -250,7 +145,7 @@ const baseAction: ActionResult = {
affected_users: 1
};
const baseActionRow: LidarrQuarantineActionRow = {
const baseActionRow: QuarantineActionRow = {
id: 'a1',
track_id: 't1',
track_title: 'Avril 14th',
@@ -258,7 +153,6 @@ const baseActionRow: LidarrQuarantineActionRow = {
album_title: 'Drukqs',
action: 'resolved',
admin_id: 'admin1',
lidarr_album_mbid: null,
affected_users: 1,
created_at: '2026-01-01T00:00:00Z'
};
@@ -293,18 +187,6 @@ describe('deleteQuarantineFile', () => {
});
});
describe('deleteQuarantineViaLidarr', () => {
test('POSTs /api/admin/quarantine/:trackID/delete-via-lidarr with empty body', async () => {
(api.post as ReturnType<typeof vi.fn>).mockResolvedValueOnce(baseAction);
const out = await deleteQuarantineViaLidarr('t1');
expect(api.post).toHaveBeenCalledWith(
'/api/admin/quarantine/t1/delete-via-lidarr',
{}
);
expect(out).toBe(baseAction);
});
});
describe('listQuarantineActions', () => {
test('defaults to limit=50 when no argument', async () => {
(api.get as ReturnType<typeof vi.fn>).mockResolvedValueOnce([baseActionRow]);
+6 -82
View File
@@ -13,14 +13,9 @@ import type {
AdminPlaybackError,
AdminQuarantineRow,
AdminSummary,
LidarrConfig,
LidarrMetadataProfile,
LidarrQualityProfile,
LidarrQuarantineActionRow,
QuarantineActionRow,
MusicRequest,
RequestStatus,
LidarrRootFolder,
LidarrTestResult,
PlaybackErrorResolution
} from './types';
@@ -41,37 +36,6 @@ export function createAdminSummaryQuery() {
});
}
// Admin Lidarr config -----------------------------------------------------
export async function getLidarrConfig(): Promise<LidarrConfig> {
return api.get<LidarrConfig>('/api/admin/lidarr/config');
}
export async function putLidarrConfig(cfg: LidarrConfig): Promise<LidarrConfig> {
return api.put<LidarrConfig>('/api/admin/lidarr/config', cfg);
}
// testLidarrConnection always returns 200 with a discriminated-union body —
// callers branch on `result.ok`. We do NOT throw on `ok:false`; the SPA wants
// to render either branch (e.g. "connected to Lidarr X.Y.Z" vs "auth failed").
export async function testLidarrConnection(
body: { base_url?: string; api_key?: string } = {}
): Promise<LidarrTestResult> {
return api.post<LidarrTestResult>('/api/admin/lidarr/test', body);
}
export async function listQualityProfiles(): Promise<LidarrQualityProfile[]> {
return api.get<LidarrQualityProfile[]>('/api/admin/lidarr/quality-profiles');
}
export async function listMetadataProfiles(): Promise<LidarrMetadataProfile[]> {
return api.get<LidarrMetadataProfile[]>('/api/admin/lidarr/metadata-profiles');
}
export async function listRootFolders(): Promise<LidarrRootFolder[]> {
return api.get<LidarrRootFolder[]>('/api/admin/lidarr/root-folders');
}
// Admin request queue -----------------------------------------------------
export async function listAdminRequests(
@@ -106,42 +70,6 @@ export async function rejectRequest(
// Query factories ---------------------------------------------------------
export function createLidarrConfigQuery() {
return createQuery({
queryKey: qk.lidarrConfig(),
queryFn: getLidarrConfig,
staleTime: 60_000
});
}
// `enabled` is passed in by the caller — typically derived from
// LidarrConfig.enabled — so the query only fires once Lidarr is configured.
// Keeping it as a prop (vs. reading config inside this factory) preserves
// purity and lets the caller choose its own gating logic.
export function createQualityProfilesQuery(enabled: boolean = true) {
return createQuery({
queryKey: qk.lidarrQualityProfiles(),
queryFn: listQualityProfiles,
enabled
});
}
export function createMetadataProfilesQuery(enabled: boolean = true) {
return createQuery({
queryKey: qk.lidarrMetadataProfiles(),
queryFn: listMetadataProfiles,
enabled
});
}
export function createRootFoldersQuery(enabled: boolean = true) {
return createQuery({
queryKey: qk.lidarrRootFolders(),
queryFn: listRootFolders,
enabled
});
}
export function createAdminRequestsQuery(status?: RequestStatus) {
return createQuery({
queryKey: qk.adminRequests(status),
@@ -175,14 +103,10 @@ export async function deleteQuarantineFile(trackID: string): Promise<ActionResul
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/delete-file`, {});
}
export async function deleteQuarantineViaLidarr(trackID: string): Promise<ActionResult> {
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/delete-via-lidarr`, {});
}
export async function listQuarantineActions(
limit: number = 50
): Promise<LidarrQuarantineActionRow[]> {
return api.get<LidarrQuarantineActionRow[]>(
): Promise<QuarantineActionRow[]> {
return api.get<QuarantineActionRow[]>(
`/api/admin/quarantine/actions?limit=${limit}`
);
}
@@ -376,8 +300,8 @@ export type FingerprintSettings = {
acoustic_max_bit_error_rate: number;
backfill_concurrency: number;
sweep_interval_hours: number;
// Lets the duplicate resolver act on its own (M498): merge copies Lidarr
// doesn't need and change a Lidarr release that lists songs twice.
// Lets the duplicate resolver act on its own (M498): merge copies no
// release needs.
auto_resolve: boolean;
};
@@ -916,7 +840,7 @@ export async function runDuplicateSweep(): Promise<{ started: boolean }> {
// the group.
export async function mergeDuplicateGroup(
id: string,
body: { survivor_track_id: string; unmonitor: boolean }
body: { survivor_track_id: string }
): Promise<MergeDuplicateResult> {
return api.post<MergeDuplicateResult>(
`/api/admin/library/duplicates/${encodeURIComponent(id)}/merge`,
+4 -4
View File
@@ -14,11 +14,11 @@ import { flagTrack, unflagTrack, listMyQuarantine } from './quarantine';
import { api, apiFetch } from './client';
import { qk } from './queries';
import type {
LidarrQuarantineRow,
LidarrQuarantineMineRow
QuarantineRow,
QuarantineMineRow
} from './types';
const mockRow: LidarrQuarantineRow = {
const mockRow: QuarantineRow = {
user_id: 'u1',
track_id: 't1',
reason: 'bad_rip',
@@ -26,7 +26,7 @@ const mockRow: LidarrQuarantineRow = {
created_at: '2026-01-01T00:00:00Z'
};
const mockMineRow: LidarrQuarantineMineRow = {
const mockMineRow: QuarantineMineRow = {
track_id: 't1',
reason: 'bad_rip',
notes: null,
+8 -8
View File
@@ -2,21 +2,21 @@ import { createQuery } from '@tanstack/svelte-query';
import { api, apiFetch } from './client';
import { qk } from './queries';
import type {
LidarrQuarantineRow,
LidarrQuarantineMineRow,
LidarrQuarantineReason
QuarantineRow,
QuarantineMineRow,
QuarantineReason
} from './types';
export type FlagParams = {
track_id: string;
reason: LidarrQuarantineReason;
reason: QuarantineReason;
notes?: string;
};
export async function flagTrack(params: FlagParams): Promise<LidarrQuarantineRow> {
export async function flagTrack(params: FlagParams): Promise<QuarantineRow> {
const body: FlagParams = { track_id: params.track_id, reason: params.reason };
if (params.notes && params.notes.length > 0) body.notes = params.notes;
return api.post<LidarrQuarantineRow>('/api/quarantine', body);
return api.post<QuarantineRow>('/api/quarantine', body);
}
// Server returns 204 (no body) for DELETE; apiFetch handles it.
@@ -24,8 +24,8 @@ export async function unflagTrack(trackID: string): Promise<void> {
await apiFetch(`/api/quarantine/${trackID}`, { method: 'DELETE' });
}
export async function listMyQuarantine(): Promise<LidarrQuarantineMineRow[]> {
return api.get<LidarrQuarantineMineRow[]>('/api/quarantine/mine');
export async function listMyQuarantine(): Promise<QuarantineMineRow[]> {
return api.get<QuarantineMineRow[]>('/api/quarantine/mine');
}
export function createMyQuarantineQuery() {
+1 -5
View File
@@ -29,14 +29,10 @@ export const qk = {
likedAlbums: () => ['likedAlbums'] as const,
likedArtists: () => ['likedArtists'] as const,
history: () => ['history'] as const,
// Lidarr / requests / admin.
// Requests / admin.
catalogueSearch: (q: string, kind: string) =>
['catalogueSearch', { q, kind }] as const,
myRequests: () => ['myRequests'] as const,
lidarrConfig: () => ['lidarrConfig'] as const,
lidarrQualityProfiles: () => ['lidarrQualityProfiles'] as const,
lidarrMetadataProfiles: () => ['lidarrMetadataProfiles'] as const,
lidarrRootFolders: () => ['lidarrRootFolders'] as const,
adminRequests: (status?: string) =>
['adminRequests', { status: status ?? 'all' }] as const,
// Wanted list (M502 #5520). Wants sit under ['adminWants'] so one prefix
+1 -1
View File
@@ -9,7 +9,7 @@ import type { MusicRequest, RequestKind } from './types';
const POLL_INTERVAL_MS = 12_000;
/** True if any row is mid-ingest (status === 'approved'). The status flips
to 'completed' / 'rejected' when Lidarr finishes, so this predicate
to 'completed' / 'rejected' when the music arrives, so this predicate
lets the page poll exactly while there's something interesting to watch. */
export function hasInFlightRequest(rows: readonly MusicRequest[] | undefined): boolean {
return rows?.some((r) => r.status === 'approved') ?? false;
+30 -80
View File
@@ -188,73 +188,32 @@ export type MusicRequest = {
updated_at: string;
// Live ingest counters. Server fills these from the matched entity's
// children. Useful for in-flight requests so the operator can see
// "5 albums · 47 tracks" while Lidarr is still working on the rest.
// "5 albums · 47 tracks" while the rest is still being fetched.
imported_album_count: number;
imported_track_count: number;
};
export type LidarrConfig = {
enabled: boolean;
// api_key is "" when unset, "***" when masked on GET, plain text on PUT.
base_url: string;
api_key: string;
default_quality_profile_id: number;
default_metadata_profile_id: number;
default_root_folder_path: string;
};
// Quarantine ------------------------------------------------------------
export type LidarrQualityProfile = {
id: number;
name: string;
};
export type LidarrMetadataProfile = {
id: number;
name: string;
};
export type LidarrRootFolder = {
path: string;
accessible: boolean;
free_space: number;
};
// testLidarrConnection always returns 200; callers branch on `.ok`.
// On success the response carries the live profile + folder lists so the
// integrations page can pre-fill its dropdowns on first-time setup
// without a separate round-trip.
export type LidarrTestResult =
| {
ok: true;
version: string;
quality_profiles?: { id: number; name: string }[];
metadata_profiles?: { id: number; name: string }[];
root_folders?: { path: string; accessible: boolean; free_space: number }[];
list_errors?: Record<string, string>;
}
| { ok: false; error: string };
// Lidarr quarantine ------------------------------------------------------
export type LidarrQuarantineReason =
export type QuarantineReason =
| 'bad_rip'
| 'wrong_file'
| 'wrong_tags'
| 'duplicate'
| 'other';
export type LidarrQuarantineRow = {
export type QuarantineRow = {
user_id: string;
track_id: string;
reason: LidarrQuarantineReason;
reason: QuarantineReason;
notes?: string | null;
created_at: string;
};
// What GET /api/quarantine/mine returns per row
export type LidarrQuarantineMineRow = {
export type QuarantineMineRow = {
track_id: string;
reason: LidarrQuarantineReason;
reason: QuarantineReason;
notes?: string | null;
created_at: string;
track_title: string;
@@ -273,17 +232,16 @@ export type AdminQuarantineRow = {
artist_name: string;
album_title: string;
album_id: string;
lidarr_album_mbid?: string | null;
report_count: number;
latest_at: string;
reason_counts: Partial<Record<LidarrQuarantineReason, number>>;
reason_counts: Partial<Record<QuarantineReason, number>>;
reports: AdminQuarantineReport[];
};
export type AdminQuarantineReport = {
user_id: string;
username: string;
reason: LidarrQuarantineReason;
reason: QuarantineReason;
notes?: string | null;
created_at: string;
};
@@ -315,17 +273,19 @@ export type AdminPlaybackError = {
album_id: string;
};
export type LidarrQuarantineAction = 'resolved' | 'deleted_file' | 'deleted_via_lidarr';
// deleted_album is history: an album removed whole, before Minstrel filed its
// own music (M502).
export type QuarantineAction = 'resolved' | 'deleted_file' | 'deleted_album';
export type LidarrQuarantineActionRow = {
export type QuarantineActionRow = {
id: string;
track_id: string;
track_title: string;
artist_name: string;
album_title?: string | null;
action: LidarrQuarantineAction;
action: QuarantineAction;
admin_id?: string | null;
lidarr_album_mbid?: string | null;
album_mbid?: string | null;
affected_users: number;
created_at: string;
};
@@ -333,7 +293,6 @@ export type LidarrQuarantineActionRow = {
export type ActionResult = {
action_id: string;
affected_users: number;
deleted_track_count?: number;
};
export type SeedContribution = {
@@ -349,7 +308,7 @@ export type ArtistSuggestion = {
name: string;
score: number;
attribution: SeedContribution[]; // up to 3 entries, ordered by contribution DESC
image_url?: string; // resolved on-demand from Lidarr; absent → card placeholder
image_url?: string; // absent → card placeholder
// Tags this candidate shares with your taste profile, strongest first (max 3,
// #2377). Absent for most candidates — tag coverage for artists you don't own
// is partial by nature (#2376) — so the card falls back to seed attribution.
@@ -514,12 +473,10 @@ export type AdminDuplicateSweep = {
};
// What a merge did (#3911). removed_paths are the files that were deleted from
// disk; lidarr_unmonitor_failed appears only when unmonitoring was asked for and
// failed.
// disk.
export type MergeDuplicateResult = {
survivor_track_id: string;
removed_paths: string[];
lidarr_unmonitor_failed?: boolean;
};
export type AdminDuplicatesResponse = {
@@ -543,24 +500,17 @@ export type AdminDuplicatesResponse = {
// The report's group tabs. 'resolved' is the third tab, served separately.
export type DuplicatesView = 'review' | 'cross_release';
// One thing the resolver did on its own (M498), from the audit log.
export type ResolvedDuplicateActivity =
| {
id: string;
action: 'duplicate_merge';
created_at: string;
details: {
survivor_path?: string;
survivor_reason?: string;
removed?: { track_id: string; file_path: string }[];
};
}
| {
id: string;
action: 'lidarr_release_change';
created_at: string;
details: { album_title?: string; artist_name?: string; from_release?: string; to_release?: string };
};
// One merge the resolver made on its own (M498), from the audit log.
export type ResolvedDuplicateActivity = {
id: string;
action: 'duplicate_merge';
created_at: string;
details: {
survivor_path?: string;
survivor_reason?: string;
removed?: { track_id: string; file_path: string }[];
};
};
export type ResolvedDuplicatesResponse = {
total: number;
@@ -856,8 +806,8 @@ export type LibraryListing = { listed_at: string | null; unlisted: number };
// artist heads the list when it is narrowed to one artist's page.
export type WantsPage = Page<Want> & { counts: WantCounts; library: LibraryListing; artist?: WantArtist };
// One artist in the Collection's catalogue (#5572), like Lidarr's artist
// index: how many of their albums on the list are held, of how many.
// One artist in the Collection's catalogue (#5572): how many of their albums
// on the list are held, of how many.
export type WantArtist = {
artist_mbid: string;
artist_name: string;