Skip to content

fix(server): keep discovered workspace folder labels valid when an emoji crosses the name limit - #42133

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-workspace-folders-surrogate-name
Nov 24, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-workspace-folders-surrogate-name

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a project folder holds a repository named 127 ASCII as followed by 🚀 (a valid 131-byte Linux name), its saved label ends in a lone \ud83d instead of stopping before the emoji. The 128-UTF-16-unit label cut in WorkspaceFolders.ts splits the emoji's surrogate pair.

Change

The cut (also used for .code-workspace folder names) stops one unit earlier when it would split a surrogate pair, using the shared splitsSurrogatePair helper. Leading whitespace is trimmed first, so the step back can't blank a label. Names that fit are unchanged.

Scope

Bug fix for wrong stored data in discovered folder labels. The steps below reproduce it, so it needs no issue. Folders named with t3 project add --track use a separate limit, fixed in #42083.

Verification

Setup: Ubuntu 26.04.1, Node 26.13.1, git 2.53.0, fresh scratch folders, T3CODE_LOG_LEVEL=Warn, server named "Test machine". t3 is node <checkout>/apps/server/src/bin.ts. Before mounts base's WorkspaceFolders.ts over head. Screens, light theme: web (vp run dev, T3's Browser panel, 1280×800), desktop (vp run dev:desktop, driven over its debug port), Android 17 Pixel 10 emulator (SwiftShader) and iOS 27.2 iPhone 18 Pro simulator.

Steps: these commands on both revisions; the last prints the stored label's tail, length, isWellFormed(), discovered. For the screens, app also holds repositories named 127 spaces + 🚀 and web, and --base-dir matches vp run dev --home-dir; then (phones paired) Settings → Projects → app → Repositories.

name="$(printf 'a%.0s' {1..127})🚀"
git init -q "app/$name"
t3 project add app --base-dir state; echo "exit $?"
node -e 'const db = new (require("node:sqlite").DatabaseSync)("state/userdata/statev2.sqlite"); const [f] = JSON.parse(db.prepare("SELECT tracked_folders_json FROM projection_projects").get().tracked_folders_json); console.log(JSON.stringify(f.name.slice(-3)), f.name.length, f.name.isWellFormed(), f.discovered)'
26f4c7550e7a 3dbeb77c7192
Web: the padded repository shows �
Web: the padded repository shows �
Web: the padded repository shows 🚀
Web: the padded repository shows 🚀
Desktop: the padded repository shows �
Desktop: the padded repository shows �
Desktop: the padded repository shows 🚀
Desktop: the padded repository shows 🚀
Android: the padded repository shows �
Android: the padded repository shows �
Android: the padded repository shows 🚀
Android: the padded repository shows 🚀
iOS: the padded repository shows �
iOS: the padded repository shows �
iOS: the padded repository shows 🚀
iOS: the padded repository shows 🚀

Before, 26f4c7550e7a, last two lines:

exit 0
"aa\ud83d" 128 false true

After, 3dbeb77c7192:

exit 0
"aaa" 127 true true

On newest green main b6a04be41c51 they print the Before line; merged cleanly with 3dbeb77c7192, the After line.

An AI agent found this reading the cut against the 128-unit limit, and ran each check:

  • The scan test now also finds repositories named 127 letters + 🚀 (labelled as the letters), 126 letters + 🚀 (kept) and 127 spaces + 🚀 (labelled 🚀). It fails on 26f4c7550e7a, and on 3dbeb77c7192 without the surrogate check or the leading trim.
  • WorkspaceFolders.test.ts passes 3 of 3 serial runs on 3dbeb77c7192 and passes on the merge; vp run check:changed passes.

Links: the commits above, the test rows and the proof scripts.

Not shown:

  • Windows and macOS servers; no platform-specific code.

Generated with Claude Opus 5.5 in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3dbeb77 and 5f63769.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Workspace folder names are trimmed and capped at 128 UTF-16 code units. Truncation avoids splitting surrogate pairs. The scan tests cover whitespace-padded names and labels at the truncation boundary.

Changes: Workspace folder name bounds

Layer / File(s) Summary
Bound and validate folder names
apps/server/src/workspace/WorkspaceFolders.ts, apps/server/src/workspace/WorkspaceFolders.test.ts
boundedName trims leading whitespace, avoids splitting surrogate pairs when it truncates names to 128 UTF-16 code units, and trims trailing whitespace. Scan tests cover padded names and emoji at the boundary.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · previous review 3dbeb

Discovered workspace folder labels that fall on the 128-character limit no longer end in a broken half-emoji. Names that already fit are unchanged. The change is small and covered by new boundary tests, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: discovered workspace folder labels are kept valid when an emoji crosses the 128-unit name limit. It follows conventional commit form and matches the WorkspaceFolders.t…
Description check Passed The description follows the template. It covers Problem (a 127-ASCII-letter plus rocket-emoji repository stores a lone surrogate), Change (cut steps back on a split surrogate pair, leading whitespace …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: discovered workspace folder labels are kept valid when an emoji crosses the 128-unit name limit. It follows conventional commit form and matches the WorkspaceFolders.ts change, the surrogate-pair check, and the test additions.

Full details: Description check

Explanation

The description follows the template. It covers Problem (a 127-ASCII-letter plus rocket-emoji repository stores a lone surrogate), Change (cut steps back on a split surrogate pair, leading whitespace trimmed first), Scope (bug fix with reproduction steps, separate --track limit referenced to #42083), and Verification (detailed setup, before/after outputs, test results, and screenshots). It does not state the agent model in the template's requested form, but it does name Claude Opus 5.5 at the end. Overall it is mostly complete and specific.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 43a0e74 and 3dbeb77.

Files selected for processing: 2

  • apps/server/src/workspace/WorkspaceFolders.test.ts
  • apps/server/src/workspace/WorkspaceFolders.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Created the three boundary-case repositories, added their parent through the project CLI, and opened Settings → Projects → emoji-labels → Repositories on fresh state for each commit. The space-padded label visibly changes from a replacement character to 🚀. The scenario also checks the exact rendered names for all three cases and Unicode validity. scenarios:prove exited 0.

Environment: Chromium, 1920×1000, light theme, Noto Color Emoji; local path descriptions hidden for privacy. Details below are crops of the inspected app captures.

Before After
f692811b95 5f637697c2
Before: malformed space-padded label After: intact rocket label

Full before capture · Full after capture · Scenario source

Not shown:

  • .code-workspace labels were not exercised.
  • The long a/b label endings overflow the app row and are not visible in the captures; their exact rendered DOM text was checked by the scenario.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
@juliusmarminge
juliusmarminge merged commit 354d9f1 into pingdotgg:main Nov 24, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants