Skip to content

fix: an empty listing is not a broken extraction - #15

Merged
cycle-five merged 1 commit into
masterfrom
fix/listing-empty-vs-extraction-empty
Sep 22, 2026
Merged

cycle-five merged 1 commit into
masterfrom
fix/listing-empty-vs-extraction-empty

Conversation

@cycle-five

Copy link
Copy Markdown
Owner

What happened

A Spotify daylist (37i9dQZF1EP6YuccBxUcC1) answered 502 extraction_empty, whose message says "extraction likely stopped matching Spotify's page". cracktunes maps that arm to "⚠️ Spotify lookup is broken right now", so the bot announced an outage of the whole integration for one unreadable id — and an evening went into establishing that nothing was wrong.

Nothing was. Evidence:

  • Spotify's own oEmbed serves that id a trackList of 0 entries, while Today's Top Hits returns a populated one. That is Spotify's answer with sleevenote nowhere in the picture — the playlist's contents exist only for its signed-in owner.
  • Production's sleevenote returns the identical 502 for it, so it was never about one deployment.
  • The user's own daylist share link (37i9dQZF1FbGxhQBHxnJF4, the ?si= form) resolves fine: 50/50 tracks, complete.

The fix

The two zero-track cases were always distinguishable, and the code already had the figure that separates them.

Reaching the zero-track branch already proves extraction still matches the entity — normalizeByKind returns null otherwise, and that throws ExtractionSilentError well before here. So "extraction likely stopped matching" was wrong by construction on that line. The only open question is whether the items are missing or absent, and Spotify's declared total answers it, being the one number there that speaks for the page rather than for our parser.

declared tracks error means
> 0 0 extraction_empty (unchanged) Spotify listed items we recognised none of — our parser broke
0 or null 0 listing_empty (new) there was nothing to extract

listing_empty keeps 502 so no caller's status handling changes — the code string carries the distinction — and is never negative-cached, because a listing empty today can have items tomorrow.

It also stops tripping the redesign canary. extraction_empty exists to make a Spotify redesign loud; counting every personalised playlist as one is how that alarm stops meaning anything. listing_empty is counted in scrape_failures and deliberately not in sleevenote_extraction_empty_total.

Tests

Four, covering both shapes through extract(), the route's code, and the canary staying put. Each was sabotaged and watched fail:

sabotage caught by
collapse the split (if (true)) expected ExtractionEmptyError … to be an instance of ListingEmptyError
let the empty listing call extractionEmpty.inc() expected 1 to be +0
report the old code from the route expected 'extraction_empty' to be 'listing_empty'

Gate: npx tsc --noEmit clean, npm test 217 passed / 9 skipped.

Follow-up

cracktunes needs the matching arm so the user hears something true; that PR cites this one. Until it merges, crack-sleevenote sees listing_empty as ErrorCode::Unrecognized — which is still an improvement on being told the integration is down.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F8PrF3gizKqXCStjCuWL3d

A Spotify "daylist" (37i9dQZF1EP6YuccBxUcC1) answered 502
`extraction_empty`, whose message reads "extraction likely stopped matching
Spotify's page". cracktunes relays that arm as "⚠️ Spotify lookup is broken
right now", so an id nobody can read signed-out was reported as an outage of
the whole integration -- and cost an evening establishing it was not one.

Nothing was broken. Spotify's own oEmbed serves that id a `trackList` of
zero entries too; the playlist's contents exist only for its signed-in
owner. Production's sleevenote returns the same 502 for it, so it was never
about this deployment either.

The two cases were always distinguishable and the code already had the
figure that separates them. Reaching the zero-track branch proves extraction
still matches the ENTITY -- `normalizeByKind` returns null otherwise, which
throws ExtractionSilentError well before here -- so the only question left
is whether the ITEMS are missing or absent. Spotify's declared total answers
it, being the one number there that speaks for the page and not for us:

- declared > 0 and we parsed none -> ExtractionEmptyError, unchanged in
  meaning but now only ever this, with the count in the message.
- declared 0 or none at all -> ListingEmptyError, new: there was nothing to
  extract.

`listing_empty` keeps 502 so no caller's status handling changes -- the code
carries the distinction -- and is never negative-cached, because a listing
empty today can have items tomorrow.

It also stops tripping the redesign canary. `extraction_empty` exists to
make a Spotify redesign loud; counting every personalised playlist as one is
how that alarm stops meaning anything.

Tests: both zero-track shapes through extract(), the route's code, and the
canary staying put. Each was sabotaged and watched fail -- collapsing the
split, letting the empty listing call extractionEmpty.inc(), and reporting
the old code.

Gate: npx tsc --noEmit clean, npm test 217 passed / 9 skipped.

Co-Authored-By: Claude & Lothrop (cycle.five@proton.me)
@cycle-five
cycle-five merged commit 311790b into master Sep 22, 2026
2 checks passed
cycle-five added a commit to cycle-five/cracktunes that referenced this pull request Sep 22, 2026
…lic (#556)

* fix: stop telling users Spotify is broken when a link is just not public

A user linked their Spotify daylist. The bot answered "⚠️ Spotify lookup is
broken right now. This has been logged." Nothing was broken: a daylist's
contents exist only for its signed-in owner, so a signed-out scraper sees an
empty listing. Spotify's own oEmbed serves that id a trackList of zero
entries too.

sleevenote answered `extraction_empty` for it, and this crate maps that arm
to SPOTIFY_LOOKUP_BROKEN -- correctly, for what that code used to mean.
sleevenote 0.6.0 splits the code in two (cycle-five/sleevenote#15):
`extraction_empty` now means only that Spotify declared items extraction
recognised none of, and the new `listing_empty` means the listing is real
and has nothing in it we can see.

This side takes the new code:

- `ErrorCode::ListingEmpty` / `Error::ListingEmpty`, round-tripping like
  every other documented code rather than landing in Unrecognized.
- SPOTIFY_LISTING_EMPTY, which offers no retry -- retrying the same link
  cannot work -- and names the thing that does: the share link. Measured,
  on the reporter's own daylist: the personalised link yields zero tracks,
  the `?si=` share form resolves 50 of 50.

SPOTIFY_NOT_FOUND already described this case ("private or personalized -- a
playlist Spotify generates for you, like your daylist"), but it hangs off
`not_found`, which a daylist never returns. The right words were already
written and simply unreachable.

🪤 user_message ends in a catch-all `other` arm, so a new client variant
compiles clean and silently reports SPOTIFY_LOOKUP_FAILED. Nothing but a
test can catch that, so the two new tests pin both halves: the invisible
listing must not say "broken", and a genuine extraction break still must.
Both were sabotaged -- re-pointing the arm at the old message, and deleting
the arm so it falls through -- and watched fail.

Gate: cargo fmt --check clean, clippy 0 warnings, 557 passed / 0 failed.

Co-Authored-By: Claude & Lothrop (cycle.five@proton.me)

* chore: release as 0.14.0, not 0.13.2

The tag that ships the daylist message fix also carries the 2026-09-21
dependency batch, which is a sqlx major (0.8.6 -> 0.9.0), and this branch
adds a variant to `ErrorCode`, which is not `#[non_exhaustive]`. Either one
argues for the minor position; a patch would read as neither having happened.

Owner's call, taken 2026-09-22.

Co-Authored-By: Claude & Lothrop (cycle.five@proton.me)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant