feat(library): remove a track from the library without deleting the file

RemoveFromLibrary deletes the audio_files rows the way the scan's own
orphan cleanup does and records each path in excluded_paths. The
exclusion is not an enhancement: without it the next scan finds the
file, sees no row and imports it again, so the button undoes itself.

The soft scan compares files on disk against rows in the database, so
surveyAudioFiles and countAudioFiles both take the exclusion set —
otherwise an excluded path makes the two disagree forever and queues a
full scan on every launch. Deleting a row cascades to queue_tracks, so
the removal calls the same CompactQueue hook RemoveLibrary does.

Also lands the requested badge: library-status-indicator is a button
again where it can act, utils/library-status.ts states once what owning
and wanting mean, and the long-declared queued state finally has a
producer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDCbcCZQepnpSQYJ6SxxZm
This commit is contained in:
2026-08-14 13:12:01 -04:00
co-authored by Claude Opus 5
parent dcc40b1781
commit dc890d1fcc
48 changed files with 3450 additions and 103 deletions
+18 -2
View File
@@ -182,10 +182,26 @@ describe('a track the library does not have', () => {
expect(rows[11]?.getAttribute('aria-label')).toContain('not in your library');
});
it('no longer marks the owned ones with a badge', async () => {
/**
* The badge is only on rows that can act on it. An owned track has
* nothing to request, so it carries no mark at all — the undimmed row
* already says it is yours, which is what retired the green tick.
* An unowned one keeps the badge, because it is now a request
* control rather than a decoration, revealed on hover or focus so a
* mostly-owned album is not a column of plus signs.
*/
it('marks only the rows with something left to ask for', async () => {
const el = await withVersion(3, 12);
const rows = shadowAll(el, '.track-row');
expect(shadowAll(el, '.track-row library-status-indicator')).toHaveLength(0);
const badgeIn = (row: Element) =>
row.querySelector('library-status-indicator');
expect(badgeIn(rows[0]!)).toBeNull();
expect(badgeIn(rows[11]!)).not.toBeNull();
expect(
shadowAll(el, '.track-row library-status-indicator'),
).toHaveLength(9);
expect(shadow(el, '.tracklist-legend')).toBeNull();
});
});