[bug] slugify turns "ß" into a hyphen: "Straße" becomes "stra-e"

Aperta Adatta ai principianti
#3,038 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bun, typescript
Ambito
backend

Direzione di ricerca

Inizia da LIFEOS/TOOLS/MemoryTypes.ts, in particolare da slugify vicino alla riga 377 e dal relativo smoke test vicino alla riga 515; esegui prima la riproduzione Bun fornita per confermare l’output attuale. Verifica se la funzione è stata spostata rispetto alla versione segnalata e se è necessario aggiornare anche la copia dell’installer. Il lavoro è completo quando la riproduzione produce strasse e gross, i casi esistenti con accenti restano invariati e lo smoke test copre questi casi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version

LifeOS 8.761.0 · attestation: 133 system file(s) differ from danielmiessler/[email protected] · 9 system file(s) missing:

  • hooks/VoiceCompletion.hook.ts
  • hooks/README.md
  • hooks/PromptProcessing.hook.ts
  • hooks/lib/work-config.ts
  • hooks/lib/notification-channel.ts
  • hooks/FormatGate.hook.ts
  • hooks/handlers/VoiceNotification.ts
  • hooks/handlers/DocCrossRefIntegrity.ts
  • hooks/handlers/UpdateCounts.ts
  • skills/Prioritize/Tools/Prioritize.ts
  • skills/Prioritize/Setup.md
  • skills/StateLog/SKILL.md
  • skills/Errata/Tools/Send.ts
  • skills/Errata/Intents/Send.md
  • skills/CreateSkill/SKILL.md
  • skills/CreateSkill/Intents/OptimizeDescription.md
  • skills/CreateSkill/Intents/CreateSkill.md
  • skills/RichFormat/tests/engine.test.tsx
  • skills/RichFormat/hooks/table.ts
  • skills/RichFormat/hooks/stream.ts
  • skills/RichFormat/SKILL.md
  • skills/LifeOSHooks/hooks/LifeOSHooks.ts
  • skills/Interview/Intents/Phase0Setup.md
  • skills/LifeOS/SKILL.md
  • skills/Interceptor/SKILL.md
  • skills/X/Setup.md
  • skills/X/SKILL.md
  • skills/X/Intents/PullBookmarks.md
  • agents/GeminiResearcher.md
  • agents/Astra.md
  • agents/CodexResearcher.md
  • agents/Sol.md
  • agents/PerplexityResearcher.md
  • agents/Grok.md
  • LIFEOS/TOOLS/CortexHealth.ts
  • LIFEOS/TOOLS/State.ts
  • LIFEOS/TOOLS/Achilles.ts
  • LIFEOS/TOOLS/IntegrityMaintenance.ts
  • LIFEOS/TOOLS/VoiceTags.ts
  • LIFEOS/TOOLS/CloudPager.ts
  • …and 93 more
What is broken

slugify turns the German "ß" into a hyphen, so a knowledge note or idea titled "Straße" is stored as stra-e.md, and "GROẞ" as gro.md. Since #2131 the function strips diacritics with NFKD ("ação" → "acao", "für" → "fur"), but "ß" has no NFKD decomposition: it survives normalization and then falls to SLUG_RE like punctuation. Searched before filing: #2131 (closed) fixed the accents, #2505 (closed) moved accent folding into one helper, and #3016 (open) covers non-Latin titles that collapse to an empty or shared key. None of them mentions "ß".

Where (file:line)

LIFEOS/TOOLS/MemoryTypes.ts:377

Repro on a clean tree
# From the root of a LifeOS 8.761.0 install:
bun -e 'import {slugify} from "./LIFEOS/TOOLS/MemoryTypes.ts"; for (const s of ["Straße","GROẞ","für Zürich","ação"]) console.log(s, "→", slugify(s))'
# 8.761.0 prints:   Straße → stra-e    GROẞ → gro      für Zürich → fur-zurich   ação → acao
# expected:         Straße → strasse   GROẞ → gross    (the other two unchanged)
#
# The negative control below was captured in a fresh checkout of the 8.761.0 release tree,
# not in the reporting install, which already carries a local fix for this.
Negative control

Probe: bun -e 'import {slugify} from "./LIFEOS/TOOLS/MemoryTypes.ts"; const s=slugify("Straße"); console.log(s); process.exit(Number(s !== "strasse"))' · exit 1 · captured 2026-11-29T17:38:39.511Z

Red looks like: stra-e

stra-e
Suggested fix

One .replace(/ß/g, "ss") after toLowerCase() (which also turns the capital "ẞ" into "ß") and before NFKD, plus four assertions in the file's own smoke test (bun LIFEOS/TOOLS/MemoryTypes.ts test).

Storage impact, for you to weigh: existing files are left in place. Future writes for titles or names containing ß or ẞ resolve to the new slug. This can split one note across two files (stra-e.md and strasse.md) or append to an existing ss spelling, because "Straße" and "Strasse" then share one key.

Not in the patch: German writes "ä/ö/ü" as "ae/oe/ue" when the mark is dropped. That would change the path computed on future writes for every name with an umlaut, so it needs a migration and is left out.

Two notes on placement. The diff is against the 8.761.0 file; if slugify has since moved onto the FoldText helper from #2505, the ß step belongs in front of that call. And the installer payload carries a second copy of this file (install/LIFEOS/TOOLS/MemoryTypes.ts in the LifeOS skill), which the diff does not touch.

diff --git a/LIFEOS/TOOLS/MemoryTypes.ts b/LIFEOS/TOOLS/MemoryTypes.ts
index 94c85a0d..5f8045cf 100755
--- a/LIFEOS/TOOLS/MemoryTypes.ts
+++ b/LIFEOS/TOOLS/MemoryTypes.ts
@@ -374,7 +374,8 @@ const SLUG_RE = /[^a-z0-9]+/g;
 // against a copy of this body, so reverting the NFKD fix here left them green.
 export function slugify(s: string): string {
   // Strip diacritics first so "ação" → "acao", not "a-o" (public issue #2131, @drpaulobernardy).
-  return s.trim().toLowerCase().normalize("NFKD").replace(/\p{M}/gu, "").replace(SLUG_RE, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "untitled";
+  // "ß" has no NFKD decomposition, so it fell to SLUG_RE and "Straße" became "stra-e".
+  return s.trim().toLowerCase().replace(/ß/g, "ss").normalize("NFKD").replace(/\p{M}/gu, "").replace(SLUG_RE, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "untitled";
 }
 
 function entityTypeToSubdir(et: EntityType): string {
@@ -514,6 +515,12 @@ function smokeTest(): number {
   const idea = resolveStoragePath({ type: "idea", title: "Single Memory System Insight", content: "..." });
   check("idea → KNOWLEDGE/Ideas/", idea.endsWith("/MEMORY/KNOWLEDGE/Ideas/single-memory-system-insight.md"), idea);
 
+  // 7b. slugify — "ß" and "ẞ" become "ss"; inputs NFKD already handled keep their slug
+  for (const [input, want] of [["Straße", "strasse"], ["GROẞ", "gross"], ["für Zürich", "fur-zurich"], ["ação", "acao"]]) {
+    const got = slugify(input);
+    check(`slugify("${input}") → ${want}`, got === want, got);
+  }
+
   // 8. Path resolution — proposal always goes to pending-proposals.jsonl
   const prop = resolveStoragePath({
     type: "proposal",
Verified after fix

Probe: bun -e 'import {slugify} from "./LIFEOS/TOOLS/MemoryTypes.ts"; const s=slugify("Straße"); console.log(s); process.exit(Number(s !== "strasse"))' · exit 0 · captured 2026-11-29T17:38:39.546Z

strasse
Environment
  • OS: macOS 27.0 (arm64)
  • Harness: claude-code
  • bun: 1.4.3 · git: 2.54.0
  • Doctor broken: none
Lingua principale
TypeScript
Stelle
20k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di danielmiessler/LifeOS

Tutte le issue di danielmiessler/LifeOS

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.