Skip to content

Commit 1788d02

Browse files
fix(workspace): fold case fully when comparing workspace names
Lower-casing alone leaves `Straße` and `STRASSE` different; upper-casing first gives full case folding, so a namesake that differs only by case is found. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172qrhMa5TQgETASi5hxMqD
1 parent 5a3d3e9 commit 1788d02

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/opencode/src/altimate/workspace/workspace-name.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ export function workspaceLabel(name: string, id: string | undefined, budget = MA
4949
}
5050

5151
/** A name as the link pickers compare it: control characters and runs of whitespace
52-
* collapsed, trimmed, case folded. */
52+
* collapsed, trimmed, case folded. Upper-casing first gives full case folding, so
53+
* `Straße` and `STRASSE` compare equal; lower-casing alone would not. (codex) */
5354
function comparableName(name: string): string {
5455
return name
5556
.replace(/[\u0000-\u001F\u007F-\u009F\u2028\u2029]+/g, " ")
5657
.replace(/\s+/g, " ")
5758
.trim()
59+
.toUpperCase()
5860
.toLowerCase()
5961
}
6062

‎packages/opencode/test/altimate/workspace/same-named-workspace.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("sameNamedWorkspace", () => {
1212
test.each([
1313
["exact name", [ws(1, "analytics")], "analytics", 1],
1414
["case differs", [ws(1, "Analytics")], "analytics", 1],
15+
["case differs beyond ASCII (full case folding)", [ws(1, "Straße")], "STRASSE", 1],
1516
["surrounding and inner whitespace differ", [ws(1, " data platform ")], "data platform", 1],
1617
["a control character in the listed name", [ws(1, "analy\u0007tics")], "analy tics", 1],
1718
["no workspace has the name", [ws(1, "marketing"), ws(2, "finance")], "analytics", undefined],

0 commit comments

Comments
 (0)