history: flag rows whose slug no longer means the same anime
Provider switch (anidb -> hianime-first) left anidb-era rows whose slugs
200 on hianime as a DIFFERENT anime: /watch/jujutsu-kaisen-2552 is now
Burning Kabaddi (the trailing number is a hianime id), and the stored
anidb ep id doesn't even exist in that anime's list — the row rendered
as watched JJK but linked to the wrong show.
Client-side validation (no data migration): every history row's slug is
checked against GET /api/anime/{slug} once per slug; title mismatch (or
a dead slug) marks the entry stale. Stale rows:
- home: one card per stale anime above the hero + 'history ->' link
- history page: separate 'Moved or renamed on the source' section
Each card: title, 'find it ->' (search by stored title) and x (remove,
same endpoint as regular cards). Current rows are untouched: a hianime
slug whose details name matches the stored title passes.
Tests: API contract for a stale row (deletable while on the board);
live browser test (gated) with the real jujutsu-kaisen-2552 row:
remap card renders, card doesn't link to the wrong slug, find-it
lands on the title's search.
This commit is contained in:
1 parent
0f6bd0a52a
commit
379f591180
3 files changed
+141
-3
No files matched your search
@@ -506,3 +506,25 @@ def test_fetch_parallel_stitches_range_lanes():
|
||||
finally:
|
||||
u._session = real
|
||||
u._get = real_get
|
||||
|
||||
|
||||
def test_stale_entries_surfaced_as_remappable(base=BASE):
|
||||
# provider switch left anidb-era rows: their slug 200s on hianime as a
|
||||
# DIFFERENT anime (id 2552 = Burning Kabaddi). The client flags the
|
||||
# mismatch; the API contract is unchanged — the entry is deletable by
|
||||
# slug+ep while it sits on the remap board.
|
||||
jar = login("bob", "bobpw12345", base)
|
||||
stale = {"title": "Jujutsu Kaisen", "slug_id": "jujutsu-kaisen-2552",
|
||||
"season_id": 2552, "ep_id": 35996, "lang": "jpn", "ep": 1, "pos": 42}
|
||||
good = {"title": "Seed Anime", "slug_id": "seed-1", "season_id": 1,
|
||||
"ep_id": 1, "lang": "eng", "ep": 1, "pos": 10}
|
||||
assert req("POST", "/api/history", stale, jar=jar, base=base) == 200
|
||||
assert req("POST", "/api/history", good, jar=jar, base=base) == 200
|
||||
all_ = _json("GET", "/api/history?all=1", jar=jar, base=base)
|
||||
got = [x for x in all_ if x["slug_id"] == "jujutsu-kaisen-2552"]
|
||||
assert got and got[0]["ep_id"] == 35996 and got[0]["pos"] == 42, got
|
||||
removed = _json("DELETE", "/api/history?slug_id=jujutsu-kaisen-2552&ep_id=35996",
|
||||
jar=jar, base=base)
|
||||
assert removed["removed"] >= 1, removed
|
||||
all_ = _json("GET", "/api/history?all=1", jar=jar, base=base)
|
||||
assert not [x for x in all_ if x["slug_id"] == "jujutsu-kaisen-2552"], all_
|
||||
Reference in new issue
Block a user