Repository navigation
feat(slugs)!: keep native letters in slugs, in every script - #1269
Conversation
slugifyValue maps ä/ö/ü to ae/oe/ue before slugify runs (ß → ss is already in its charmap), so "Universität Trier" slugs to universitaet-trier instead of universitat-trier. slugify's own locale: 'de' is not used because it also rewrites symbols in every slug (% → prozent, | → oder). Upload filenames follow the new rule. Table-of-contents heading anchors keep the old spelling (slugifyAnchor), since anchors already sit in shared links. scripts/umlaut-region-slugs.ts re-spells existing region slugs generated from a name with an umlaut: dry run by default, --apply writes through the Local API so descendants' breadcrumbs follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Single-pass slug plan that treats every current slug as taken, one exit in the CLI, depth 0 on the update, slugifyValue built on slugifyAnchor, LayoutBlock tab anchors on slugifyAnchor, and an umlaut upload-key case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-1269 environment in sahajcloud
1 service not affected by this PR
|
Heading and tab anchors now follow slugifyValue's umlaut spelling too. WeMeditateWeb is unpublished, so no shared anchor links exist, and no live page stores a table-of-contents heading or default tab whose anchor the umlaut rule changes (read-only production check). Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The slug change is the size of its problem: one mapping, its callers, and the script the 20 existing rows need. Nothing smuggled. The plan/CLI split is scripts/AGENTS.md's own convention.
The claim behind it does not hold. An anchor and a slug answer to different contracts: a slug must not match WeMeditateWeb's slugifier, an in-page anchor must. So "the one slugifier in this repo" breaks the layout-tab caller, and "nothing reads the stored slug" covers the ToC slug but not titleUrl, which that repo reads verbatim.
The rest checks out: slugPattern still admits every new spelling, webPath is composed from the region tree on read so no descendant goes stale, and WeMeditateWeb's ToC re-derives from the heading text. The native app is the one anchor consumer I cannot read from here.
Needing nothing: an existing ToC entry on an umlaut heading drops on the next re-scan, since resolveStored matches by slug alone. Production holds none.
Findings
- should-fix — a layout-tab anchor points at an id WeMeditateWeb does not emit →
LayoutBlock.ts:12 - should-fix — Streamline: the docstring's caller list rots on the next import →
slugify.ts:9 - consider — the docstring names ICAO, wider than the three letters mapped →
slugify.ts:13
What was checked
Read on the branch: slugify.ts, slugField.ts, LayoutBlock.ts, filenameUtils.ts, both scripts, the three specs, Regions.ts, Regions/webPath.ts, headings.ts, scripts/AGENTS.md, audit-region-slugs.
Consumers followed into WeMeditateWeb: lib/urls/slugify.ts, TableOfContents.tsx, LayoutBlock.tsx. Neither repo pins titleUrl. Streamliner: 5 pieces covered, 5 kept, 3 returned, 1 posted.
Preview: both ids exist in src/fixture/ and show their claim (1002002 Harbourton/city, 1014001 with a ToC block), and both are ON_HOST.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
A heading `id` and a tab's `titleUrl` answer to a consumer's own slugifier, which folds an umlaut to a bare vowel, and WeMeditateWeb's LayoutBlock reads `titleUrl` verbatim. So a tab "Über uns" stored as `#ueber-uns` points at an id nobody emits — both were `uber-uns` before. A stored slug is ours to spell; an anchor is not. slugifyAnchor carries that split, and the table-of-contents headings take it too, so an existing entry no longer drops on its next re-scan. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYdgfhusMtVbtcHsWL
`git grep` is the inventory, and a list in a docstring rots on the next
import. `{@link slugField}` resolved to nothing here either — this file
imports it nowhere.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYdgfhusMtVbtcHsWL
ICAO Doc 9303 also maps `Ø → OE` and `Å → AA`, so a reader taking the docstring at its word and adding the rest would need a second rename script and would break more place URLs. The rule is the three letters. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYdgfhusMtVbtcHsWL
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYdgfhusMtVbtcHsWL
|
Three critic threads, all adopted. Pushed 459f427.
The outline, the ToC preview step, Contract impact and the Anchors note were each false after the fix. The body is refreshed. Gate green, unit lane 3909. The security sweep found nothing. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
slugifyValue now lowercases and hyphenates but keeps every letter as written: Universität Trier → universität-trier, София → софия. It replaces the slugify library's ASCII transliteration, which mangled Armenian (Մաս 1. Ուղիներ → m-1) and Persian. Upload filenames keep the library's ASCII spelling. webPath stays raw; webUrl and buildCanonicalUrl percent-encode it. The atlas URL contract moves to version 2: a Unicode slugPattern (u flag) and two encoded cases. SahajAtlasWeb and SahajAtlasWordpress must sync it and decode segments before matching. scripts/respell-region-slugs.ts (was umlaut-region-slugs) re-spells every region slug that is still the old library spelling of its name. BREAKING CHANGE: atlas-url-contract.json version 2; region slugs and webUrl values for non-ASCII names change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The loop's split (slugifyAnchor) answered WeMeditateWeb's old umlaut-folding anchors. WeMeditateWeb now runs the same native-letter recipe, so heading and tab anchors take slugifyValue again; the layout anchor spec stays, pinned to the shared spelling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The library's ASCII import becomes asciiSlugify in the two places that still need it (upload filenames, the re-spelling plan's old spelling). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two resolutions, both with one answer. `src/migrations/index.ts`: both sides added a migration, so both are kept, ordered by timestamp — `20261123_185218_pages_parent_index_pages` then `20261124_042718_import_created_regions`. `src/plugins/eventImport/cities.ts`: no textual conflict, but #1269 renamed `slugifyValue` to `slugify`, so the city slug allocator would not compile. Taking the new name is also the behaviour this PR wants: a created city gets a native-letter slug, as every other region now does. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYsoDuvMm4wewNgiwt
Summary
universität-trier,софия,մաս-1-ուղիներ. Previously theslugifylibrary transliterated them to ASCII, and it mangled Armenian (m-1) and Persian.Change outline
Behaviour —
slugify, the only slugifierContract — URLs and
atlas-url-contract.jsonv2webPathstays raw Unicode. Every place it becomes a URL encodes it once.Files — the re-spelling script
Preview
fixture-münster. Don't save.über-uns.Contract impact
atlas-url-contract.jsonis now version 2. These PRs ship with this one, and each consumer's test fails on the version until its PR merges:/maproutes, SEO and sitemap encode URLs exactly once.Merge order: this PR, then SahajAtlasWeb and WordPress, then WeMeditateWeb and the app. Apply the region renames last.
Test results
check.sh): ✓regions,region-canonical-url,atlas-seo,pages,slug-field-posted-blank,atlas-collections. All pass.region-canonical-urlfailed once under parallel load and passed on two reruns.Manual verification
sofiya → софия,odesa → одеса,universitat-trier → universität-trierandburgstrasse-72 → burgstraße-72. 3 hand-set slugs are skipped. Run--applyonly with the owner's approval./bg/софияopens in the atlas from both a percent-encoded link and a raw one.Notes for reviewer
slugifyAnchorcommits were merged and then superseded. They kept anchors on the old ASCII spelling to match WeMeditateWeb's folding slugifier. WeMeditateWeb now runs the same recipe, so anchors useslugifyagain. The layout-anchor spec stays, pinned to the shared spelling.generateSlug: false.🤖 Generated with Claude Code