fix(media): a number too long to be an episode is not one #107

Merged
dank merged 1 commits from fix/episode-marker-guard into main 2026-10-31 14:51:03 -07:00
Owner

What

Two findings from the pass-2 TVShows dry run (49,546 renames), both fixed before that plan is applied.

1. A digit run longer than three at an SxxE position was read as an episode number

EP_RANGE capped its first episode group at \d{1,3} but guarded only the second group. The Attack on Titan box set on the array carries:

file the provider row says what the plan wrote
… S03E2019.mkv season 3, episode 2019 S03E201
… S04E47370355.mkv season 4, episode 47370355 S04E473

both filed inside 進撃の巨人 (2013) [tvdbid-267440] — episode slots that belong to real episodes.

  • the first group now carries the same (?![\dpP]) guard the second already had: a longer run states no marker. A glued resolution stays legal — S01E01-1080p is still ONE episode, the case the original guard was added for;
  • EP_MAX = 999 caps the provider row's number as well, so the junk cannot come back through the row: such a row is renumbered from tvdb's title when the series' id answers it, and parks with a reason that names the junk when nothing answers.

2. map rows name no folder on the array lied

All three folders it named are on the array, at the top level. What is true is that none of their files ever became a series: every file in them is bonus material with no owner (NCOP/NCED/promo packs — Fairy Tail 59 files, Kimetsu no Yaiba 12, Dorohedoro 9), and the operator's map names a record — it numbers no episodes and owns no bonus material. The exceptions now separate the two cases (never became a series vs no folder on the array), and the missing-folder hint states that the map reads top-level folders only, which is why a pack that moved into the review pile reads as missing.

Verified

  • 4 new tests in tests/media_shows.bats, read red against the shipping planner first, green after the change.
  • bats tests/media_shows.bats → 45/45. ./tests/run.sh → 779/779 (ALL TESTS PASSED).
  • Real data: the two actual box-set files replanned against the live census (58,551-file enum, 47,644 provider rows) now park under their own names, reasons a provider row of season 3 episode 2019 and … season 4 episode 47370355. Nothing lands in 進撃の巨人 (2013) [tvdbid-267440].

Out of scope, deliberately

Those three credit/extras packs still park. Rescuing them needs absolute-numbering support (the planner has none anywhere) and an owner for bonus material that sits under a mapped folder — separate work, not this PR.


cwd: /home/blank/.omp/wt/wt-20261030-163847-6d1fc1f · session: 01a18f2e-18b1-7573-bcd5-ac99636f8bcb
(build worktree: /home/blank/.omp/wt/tvdb-map)

## What Two findings from the pass-2 TVShows dry run (49,546 renames), both fixed **before** that plan is applied. ### 1. A digit run longer than three at an `SxxE` position was read as an episode number `EP_RANGE` capped its first episode group at `\d{1,3}` but guarded only the *second* group. The Attack on Titan box set on the array carries: | file | the provider row says | what the plan wrote | |---|---|---| | `… S03E2019.mkv` | season 3, episode 2019 | `S03E201` | | `… S04E47370355.mkv` | season 4, episode 47370355 | `S04E473` | both filed inside `進撃の巨人 (2013) [tvdbid-267440]` — episode slots that belong to real episodes. - the first group now carries the same `(?![\dpP])` guard the second already had: a longer run states **no marker**. A glued resolution stays legal — `S01E01-1080p` is still ONE episode, the case the original guard was added for; - `EP_MAX = 999` caps the provider row's number as well, so the junk cannot come back through the row: such a row is renumbered from tvdb's title when the series' id answers it, and parks with a reason that names the junk when nothing answers. ### 2. `map rows name no folder on the array` lied All three folders it named are on the array, at the top level. What is true is that none of their files ever became a series: every file in them is bonus material with no owner (`NCOP`/`NCED`/promo packs — Fairy Tail 59 files, Kimetsu no Yaiba 12, Dorohedoro 9), and the operator's map names a **record** — it numbers no episodes and owns no bonus material. The exceptions now separate the two cases (`never became a series` vs `no folder on the array`), and the missing-folder hint states that the map reads top-level folders only, which is why a pack that moved into the review pile reads as missing. ## Verified - 4 new tests in `tests/media_shows.bats`, read **red** against the shipping planner first, green after the change. - `bats tests/media_shows.bats` → 45/45. `./tests/run.sh` → 779/779 (`ALL TESTS PASSED`). - Real data: the two actual box-set files replanned against the live census (58,551-file enum, 47,644 provider rows) now park under their own names, reasons `a provider row of season 3 episode 2019` and `… season 4 episode 47370355`. Nothing lands in `進撃の巨人 (2013) [tvdbid-267440]`. ## Out of scope, deliberately Those three credit/extras packs still park. Rescuing them needs absolute-numbering support (the planner has none anywhere) and an owner for bonus material that sits under a mapped folder — separate work, not this PR. --- cwd: /home/blank/.omp/wt/wt-20261030-163847-6d1fc1f · session: 01a18f2e-18b1-7573-bcd5-ac99636f8bcb (build worktree: `/home/blank/.omp/wt/tvdb-map`)
dank added 1 commit 2026-10-31 14:49:58 -07:00
The Attack on Titan box set on the array names two files S03E2019 and
S04E47370355, and the provider rows the metadata server recorded for them carry
the same junk. EP_RANGE capped its first episode group at three digits without
guarding the run, so the pass-2 plan filed both under E201 and E473 — slots
that belong to real episodes — inside 進撃の巨人 (2013) [tvdbid-267440].

- guard the first episode group the way the second was already guarded, so a
  longer digit run states no marker at all; a glued resolution stays legal,
  because S01E01-1080p is still ONE episode
- cap a provider row's episode at EP_MAX: such a row is renumbered from tvdb's
  title when the series' id answers, and parks with a reason that names the
  junk when nothing answers
- split the operator-map exceptions into the two things they are: a folder that
  IS on the array whose files never became a series (bonus material with no
  owner: Fairy Tail, Kimetsu no Yaiba, Dorohedoro) is no longer reported as a
  folder the array no longer holds, and the missing-folder hint says the review
  pile counts as moved because the map reads top-level folders only
- the vault's evidence list carries the law; the four tests were read red
  against the shipping planner before any of it changed

Replanning the two real files now parks them under their own names with the
reasons "a provider row of season 3 episode 2019" and
"… season 4 episode 47370355".
dank merged commit 75b04dc313 into main 2026-10-31 14:51:03 -07:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dank/serverAppConfigs#107