From 4e0c285347c3fa2cc62c75460a72f0513d5889d9 Mon Sep 17 00:00:00 2001 From: ginnoir Date: Fri, 14 Aug 2026 15:03:21 -0500 Subject: [PATCH] refactor: drop the mojibake workaround from slugifyStem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit slugifyStem carried `.replaceAll('ΓÇÖ', "'")`, which patched a corrupted apostrophe at the slug layer so three notes with mojibake filenames still produced correct URLs. The underlying filenames are now repaired, so no stem contains that sequence and the line is dead code that encodes an assumption which is no longer true. Proved it is dead rather than assuming: rebuilt and diffed all 411 generated slugs against the previous build - identical, nothing moved. The unit test asserted against the corrupted string, so it was testing the workaround rather than the behaviour. It now uses the real repaired stem, 'A Farfetch’D Story', which exercises the same thing that actually matters - that U+2019 becomes a hyphen - and still expects 'a-farfetch-d-story'. Added a case for 'Fused Dimensions' to pin the non-breaking-space folding, since that name previously carried U+00A0. Also syncs the catalog for the Fused Dimensions rename. Verified: npm run check (0 errors, vitest 9/9), npm run build (486 pages), CI=1 npm run test:ui (8/8), deployed; live 200 on all seven repaired URLs and the h1 renders without NBSP. Co-Authored-By: Claude Opus 5 --- data/catalog.json | 4 ++-- src/lib/catalog.test.ts | 5 +++-- src/lib/catalog.ts | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/catalog.json b/data/catalog.json index 3f0d58e..f978188 100644 --- a/data/catalog.json +++ b/data/catalog.json @@ -7864,8 +7864,8 @@ ] }, { - "stem": "Fused Dimensions", - "title": "Pokémon Fused Dimensions", + "stem": "Fused Dimensions", + "title": "Pokémon Fused Dimensions", "platform": "GBA", "base": "FireRed", "version": null, diff --git a/src/lib/catalog.test.ts b/src/lib/catalog.test.ts index 217219f..76865ef 100644 --- a/src/lib/catalog.test.ts +++ b/src/lib/catalog.test.ts @@ -47,7 +47,7 @@ const baseCatalog: RawCatalog = { links: [{ label: 'Source / info', url: 'https://example.com/radical' }], }, { - stem: 'A FarfetchΓÇÖD Story', + stem: 'A Farfetch’D Story', title: 'Pokémon A Farfetch’D Story', platform: 'PC', base: null, @@ -89,7 +89,8 @@ const baseCatalog: RawCatalog = { describe('catalog normalization', () => { it('creates deterministic URL-safe slugs from stems', () => { expect(slugifyStem('Radical Red')).toBe('radical-red'); - expect(slugifyStem('A FarfetchΓÇÖD Story')).toBe('a-farfetch-d-story'); + expect(slugifyStem('A Farfetch’D Story')).toBe('a-farfetch-d-story'); + expect(slugifyStem('Fused Dimensions')).toBe('fused-dimensions'); expect(slugifyStem('Pokémon: Crystal Clear!')).toBe('pokemon-crystal-clear'); }); diff --git a/src/lib/catalog.ts b/src/lib/catalog.ts index 930c982..7ff224f 100644 --- a/src/lib/catalog.ts +++ b/src/lib/catalog.ts @@ -127,7 +127,6 @@ export function normalizeHack(raw: RawHack): SiteHack { export function slugifyStem(stem: string): string { return stem - .replaceAll('ΓÇÖ', "'") .normalize('NFKD') .replace(/[\u0300-\u036f]/g, '') .replace(/[^a-zA-Z0-9]+/g, '-')