Skip to content

feat(slugs)!: keep native letters in slugs, in every script - #1269

Merged
Ardnived merged 13 commits into
mainfrom
feat/umlaut-slugs
Nov 25, 2026
Merged

Ardnived merged 13 commits into
mainfrom
feat/umlaut-slugs

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Slugs now keep their native letters, lowercased, in any script: universität-trier, софия, մաս-1-ուղիներ. Previously the slugify library transliterated them to ASCII, and it mangled Armenian (m-1) and Persian.
  • This is one recipe used by every repo: SahajCloud, WeMeditateWeb, WeMeditateApp. The atlas URL contract moves to version 2 so its parsers decode Unicode paths.
  • The PR started as an umlaut fix (ä → ae). The owner then chose native letters as the policy for every project.

Change outline

Behaviour — slugify, the only slugifier

 src/fields/slugify.ts
 slugify(value)
-  slugify(value, { lower, strict })            # ASCII transliteration
+  NFC → lowercase
+  drop apostrophes, Armenian in-word marks, emoji variation/keycap marks
+  runs of non-\p{L}\p{M}\p{N} → '-' ; trim
 callers: every slugField, ToC headings, LayoutBlock tab anchors / defaultTab
 src/plugins/storage/filenameUtils.ts           # unchanged: filenames stay ASCII (owner's choice)

Contract — URLs and atlas-url-contract.json v2

webPath stays raw Unicode. Every place it becomes a URL encodes it once.

 src/fields/publicUrlFields.ts   webUrl = base + encodeURI(path)
 src/lib/atlas/canonicalUrl.ts   buildCanonicalUrl = base + encodeURI(webPath)
 src/lib/atlas/atlas-url-contract.json
-  "version": 1, "slugPattern": "^(/[a-z0-9-]+)+$"
+  "version": 2, "slugPattern": "^(/[\\p{Ll}\\p{Lm}\\p{Lo}\\p{M}\\p{N}-]+)+$"   # compile with u
+  2 cases: /bg/софия and /de/trier/universität-trier/1998, percent-encoded

Files — the re-spelling script

scripts/respell-region-slugs-plan.ts   # pure: a slug still equal to the old library spelling of its name → native spelling
scripts/respell-region-slugs.ts        # dry run by default; --apply renames one at a time through the Local API

Preview

Contract impact

atlas-url-contract.json is now version 2. These PRs ship with this one, and each consumer's test fails on the version until its PR merges:

  • SahajAtlasWeb: the widget decodes each path segment before matching it.
  • SahajAtlasWordpress: routing decodes the path, and the plugin's canonical, hreflang and sitemap URLs are encoded.
  • WeMeditateWeb: the same recipe for anchors, and the /map routes, SEO and sitemap encode URLs exactly once.
  • WeMeditateApp: the Dart port of the recipe.

Merge order: this PR, then SahajAtlasWeb and WordPress, then WeMeditateWeb and the app. Apply the region renames last.

Test results

  • Lean gate (check.sh): ✓
  • Targeted int specs: regions, region-canonical-url, atlas-seo, pages, slug-field-posted-blank, atlas-collections. All pass. region-canonical-url failed once under parallel load and passed on two reruns.

Manual verification

  1. After every consumer PR is merged and deployed, run the read-only production dry run again. On 2026-11-25 it listed 114 renames of 678 regions, for example sofiya → софия, odesa → одеса, universitat-trier → universität-trier and burgstrasse-72 → burgstraße-72. 3 hand-set slugs are skipped. Run --apply only with the owner's approval.
  2. After the renames, check that /bg/софия opens in the atlas from both a percent-encoded link and a raw one.

Notes for reviewer

  • Old place URLs break for the 114 renamed regions. Event URLs still resolve, because events resolve by id. The owner accepted this, with no aliases.
  • The loop's slugifyAnchor commits 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 use slugify again. The layout-anchor spec stays, pinned to the shared spelling.
  • No existing slug changes on save: production has no Author, SongTag or UserChoice with a non-ASCII source field, and the pages with non-ASCII titles have generateSlug: false.

🤖 Generated with Claude Code

Ardnived and others added 4 commits November 25, 2026 09:10
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]>
@railway-app

railway-app Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1269 environment in sahajcloud

Service Status Web Updated
SahajCloud 😴 Sleeping (View Logs) Web Nov 25, 2026 at 6:58 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🤖 no session running

recent dispatches
  • 17:20Z address-review · attempt 1 · session · done
  • 17:20Z address-review · attempt 1 · session
  • 17:07Z review-pr · attempt 1 · session · done
  • 17:07Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

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]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1269 November 25, 2026 16:47 Destroyed
@Ardnived
Ardnived enabled auto-merge November 25, 2026 16:52
@Ardnived
Ardnived disabled auto-merge November 25, 2026 17:01
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 25, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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

Comment thread src/fields/slugify.ts Resolved
Comment thread src/fields/slugify.ts Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
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
@sydevs-bot

Copy link
Copy Markdown
Contributor

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

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1269 November 25, 2026 17:38 Destroyed

@sydevs-dispatcher sydevs-dispatcher Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 25, 2026
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]>
Ardnived and others added 2 commits November 25, 2026 11:17
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]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1269 November 25, 2026 18:32 Destroyed
@Ardnived
Ardnived added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 1505199 Nov 25, 2026
11 checks passed
@Ardnived
Ardnived deleted the feat/umlaut-slugs branch November 25, 2026 19:03
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 25, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
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

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1269 — 1f25adf2 Deployed Nov 25, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants