Skip to content

fix(data-quality): align EPISODE_ID_PATTERN with TMDB-suffixed episode IDs - #693

Open
fro-bot wants to merge 1 commit into
mainfrom
fro-bot/fix-data-quality-episode-id-pattern
Open

fro-bot wants to merge 1 commit into
mainfrom
fro-bot/fix-data-quality-episode-id-pattern

Conversation

@fro-bot

@fro-bot fro-bot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What

EPISODE_ID_PATTERN in scripts/lib/data-quality.ts didn't accept the optional trailing TMDB numeric suffix (e.g. _253 in tos_s1_e01_253) that real episode IDs in src/data/star-trek-data.ts use.

Why

PR #435 added trailing-suffix support to isValidEpisodeId() in src/utils/metadata-validation.ts, but the sibling EPISODE_ID_PATTERN/validateEpisodeId() in scripts/lib/data-quality.ts was never updated to match. Since validateEpisodeId() requires both functions to pass, this caused generateQualityReport() (used by scripts/generate-star-trek-data.ts --validate) to flag 861 of 916 real episode IDs as invalid — a false-positive rate that would make the data-generation quality report useless for real curation work.

Discovered during scheduled autohealing (category 3, code-aware convention checks) while validating ID pattern compliance across the dataset.

Fix

  • Updated EPISODE_ID_PATTERN to allow an optional trailing _\d+ suffix, matching the already-canonical pattern in src/utils/metadata-validation.ts.
  • Added regression tests (tos_s1_e01_253, ds9_s2_e10_4567) to test/scripts/data-quality.test.ts to prevent this drift from recurring.

Verification

  • pnpm lint — 0 errors (44 pre-existing warnings, unrelated)
  • pnpm exec tsc --noEmit — clean
  • pnpm test — 1299/1299 passing (was 1298; +1 new test)
  • pnpm build — successful
  • Manual generateQualityReport() invocation: invalidEpisodeIds dropped from 861 to 0

🤖 Opened by Fro Bot daily autohealing run.

…e IDs

EPISODE_ID_PATTERN in scripts/lib/data-quality.ts was not updated when
PR #435 added optional trailing TMDB numeric suffix support to
isValidEpisodeId() in src/utils/metadata-validation.ts. This caused
validateEpisodeId() (and generateQualityReport(), used by
scripts/generate-star-trek-data.ts --validate) to flag 861 of 916
episode IDs in the live dataset as invalid, since real IDs like
tos_s1_e01_253 include a trailing TMDB suffix that the stale regex
did not permit.

Update EPISODE_ID_PATTERN to accept the same optional trailing
_\d+ suffix, and add regression tests covering suffixed IDs.
This was referenced Jul 22, 2026
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