feat(v3 library): persistent "no match" badge + Unmatched quick filter (#781)

* feat(v3 library): persistent "no match" badge + Unmatched quick filter

The Refresh-Metadata batch (#764) shows a transient per-tile "no match" only
while a pass runs, so the unmatched pile goes quiet at rest. Two additions make
it visible + reachable:

- Persistent per-card "No match" badge: query_page now marks each row
  `unmatched` (a cheap failed-set membership like favs/estd), and enrichBadge
  paints a subtle resting marker for those cards — tracked in a `_unmatched` set
  so a batch tile clearing falls back to it instead of wiping it. A live batch
  tile still wins while a pass runs.
- "Unmatched" toolbar toggle (local-only): one click applies the same filter as
  the drawer's Match → Unmatched (match_state='failed'), so the no-match pile is
  a click away right after a batch. Re-queries + reflects active state.

Test: query_page flags a failed row + the match=unmatched filter returns it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(v3 library): repaint persistent no-match badge after metadata tile-clear

_clearMetaTiles removed every .v3-meta-tile node — including the new
persistent 'No match' resting badge, which derives from _unmatched rather
than _metaTile. A metadata rescan's tile-clear therefore dropped the badge
until the next scroll re-rendered the card. Repaint it from _unmatched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: byrongamatos <xasiklas@gmail.com>
This commit is contained in:
ChrisBeWithYou
2026-07-05 21:00:30 +02:00
committed by GitHub
co-authored by Claude Opus 4.8 byrongamatos
parent 92dc321fdf
commit 3e036e3db6
3 changed files with 86 additions and 10 deletions
+22
View File
@@ -3038,6 +3038,22 @@ class MetadataDB:
out[fn] = st
return out
def _unmatched_set(self, filenames) -> set:
"""The subset of `filenames` whose enrichment landed in the 'failed'
(no-match) state feeds the grid's persistent per-card "no match" badge,
so the misses stay visible at rest (the batch tile only shows while a
refresh runs). Chunked set membership, like favorite_set."""
fns = list(filenames)
out: set = set()
for i in range(0, len(fns), 400):
chunk = fns[i:i + 400]
if not chunk:
break
q = ("SELECT filename FROM song_enrichment WHERE match_state = 'failed' "
"AND filename IN (%s)" % ",".join("?" * len(chunk)))
out.update(r[0] for r in self.conn.execute(q, chunk).fetchall())
return out
def enrichment_song_row(self, filename: str) -> dict | None:
"""The identity fields the matcher/scorer keys on, for one song."""
row = self.conn.execute(
@@ -4042,6 +4058,11 @@ class MetadataDB:
fns = [s["filename"] for s in songs]
udm = self.user_meta_map(fns)
tgm = self.tags_map(fns)
# Enrichment "no match" (failed) set for the page, so a card can show a
# persistent "no match" badge — the Refresh-Metadata batch's transient
# per-tile state only paints while a pass runs. Cheap set membership like
# favs/estd, so the misses stay visible at rest.
um = self._unmatched_set(fns)
# Canonical artist at display (P4): re-label the card's artist through the
# alias override so "ACDC" reads as "AC/DC". Display-only — the row's sort
# position (raw artist) is untouched, so a card can show a canonical name
@@ -4051,6 +4072,7 @@ class MetadataDB:
for s in songs:
s["user_difficulty"] = udm.get(s["filename"])
s["tags"] = tgm.get(s["filename"], [])
s["unmatched"] = s["filename"] in um
if amap:
s["artist"] = amap.get((s.get("artist") or "").lower(), s.get("artist"))
# Grouped rows carry the ⚑ N (chart_count) + the work_key from the