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

Đang mở Phù hợp với người mới
#3,038 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bun, typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại LIFEOS/TOOLS/MemoryTypes.ts, đặc biệt là slugify gần dòng 377 và smoke test gần dòng 515; trước tiên chạy bản tái hiện Bun được cung cấp để xác nhận đầu ra hiện tại. Kiểm tra xem hàm có được di chuyển kể từ phiên bản được báo cáo hay không và liệu bản sao trong trình cài đặt cũng cần được cập nhật hay không. Công việc hoàn tất khi bản tái hiện cho ra strasse và gross, các trường hợp dấu hiện có vẫn giữ nguyên và smoke test bao quát các trường hợp này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
TypeScript
Star
20k
Fork
2.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của danielmiessler/LifeOS

Tất cả issue của danielmiessler/LifeOS

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.