GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): avoid broken emoji in project search previews during indexing by saphid · Pull Request #44531 · pingdotgg/t3code

Conversation

@saphid

@saphid saphid commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Problem

While the native content search index is still warming up, WorkspaceSearchIndex.searchContentsWithGit truncates matched lines with line.slice(0, 512), which can cut a UTF-16 surrogate pair in half and return an ill-formed lineContent string containing a lone high surrogate.

Deterministic repro on origin/main (2e2af395f6268c3b840b4a0995fcf6c7e0771dfa): Write 'needle' + 'a'.repeat(505) + '😀\n' to long.txt in a temporary Git repo and call WorkspaceSearchIndex.make(dir, "content").searchContents({ query: "needle", limit: 10, caseSensitive: false, wholeWord: false, useRegex: false }) while the native content finder reports { isScanning: false, isWarmupComplete: false }.

  • Observed: lineContent has length 512, ends in lone high surrogate U+D83D, and returns false from lineContent.isWellFormed().
  • Expected: lineContent keeps the complete 511-unit prefix (isWellFormed() === true), omits the split emoji, and keeps matchRanges: [{ start: 0, end: 6 }].

Change

Check splitsSurrogatePair(line, CONTENT_LINE_MAX_LENGTH) from @t3tools/shared/assistantCitations before slicing lineContent in apps/server/src/workspace/WorkspaceSearchIndex.ts, backing the slice endpoint up by one code unit when the 512-unit boundary would split a surrogate pair. Existing range filtering (range.end <= lineContent.length) already clips against the actual returned prefix, and the native fff search path slices on UTF-8 boundaries in Rust, so web and desktop clients receive well-formed previews without client-side changes.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base failure (2e2af395f6268c3b840b4a0995fcf6c7e0771dfa): Extended the long-line fixture in apps/server/src/workspace/WorkspaceSearchIndex.test.ts (answers content searches with git grep while a slow content index builds); vp test run apps/server/src/workspace/WorkspaceSearchIndex.test.ts -t "answers content searches with git grep while a slow content index builds" failed with line 5 returning length 512 instead of 511.
  • Head pass (b976ab751fc15109755dba5d24e31b55c53dae02): vp test run apps/server/src/workspace/WorkspaceSearchIndex.test.ts passed 2/2 consecutive runs (18/18 tests each).
  • Changed checks: vp run check:changed exited 0 (format, lint, knip, graphql, typecheck across 3 packages, and 20/20 affected tests).
  • Before/after runtime transcript: https://gist.github.com/saphid/e9725c6a681c5d0fd51d2f8677ba85de
  • Not shown: Interactive web/desktop/mobile UI rendering (server-only preview truncation fix with no client code changes) and full repo-wide test suite (owned by CI).

Authored by Gemini 4 Neon (Antigravity); reviewed by Kimi K3.1 Pro (Model Hub).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@saphid
fix(server): avoid broken emoji in project search previews during ind…
dff00e7
…exing
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Git-backed content search now avoids ending displayed line content in the middle of a surrogate pair. Tests cover whole-word and regex searches for a long line where the 512-code-unit cap falls inside an emoji.

Changes: Content search results

Layer / File(s) Summary
Safe line truncation and test coverage
apps/server/src/workspace/WorkspaceSearchIndex.ts, apps/server/src/workspace/WorkspaceSearchIndex.test.ts
Search results return 511 code units when the 512-code-unit boundary splits a surrogate pair. Tests cover whole-word and regex matches and assert the 511-character display and match range.

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

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#43904: Changes truncation and match-range handling in the same content-search fallback.

Suggested labels: bugfix

Suggested reviewers: only21mil

Merge Risk: Minimal · up to a572c

This change stops Git-backed project search previews from ending in the middle of an emoji while the content index warms up. The test is deterministic and covers the case. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the server search preview no longer ends in a broken emoji during indexing. It follows the conventional commit form and matches the WorkspaceSearchIndex surrogate-pair…
Description check Passed The description follows the template. It has a Problem section with a deterministic repro and expected behavior, a Change section explaining the surrogate-pair backoff, a Scope section explaining why …
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: the server search preview no longer ends in a broken emoji during indexing. It follows the conventional commit form and matches the WorkspaceSearchIndex surrogate-pair fix in the summary and objectives.

Full details: Description check

Explanation

The description follows the template. It has a Problem section with a deterministic repro and expected behavior, a Change section explaining the surrogate-pair backoff, a Scope section explaining why no issue is needed, and a Verification section with a base failure, head passes, check results, and a runtime transcript link. It names the model and harness used. The description does not reproduce the template's HTML comments, which is acceptable.

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

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: 0941856
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2912d5d-fd15-4a53-8dc9-819e343564de
Commits

Reviewing files that changed from the base of the PR and between dff00e7 and a572c94.

Files selected for processing: 1

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 27, 2026
juliusmarminge and others added 2 commits November 27, 2026 23:49
@juliusmarminge
Merge remote-tracking branch 'origin/main' into hunter/c-4aef06fa8f
8b072fd
@juliusmarminge @claude
test(server): fold the emoji boundary case into the long-line table
a572c94
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge

juliusmarminge commented Nov 28, 2026

Copy link
Copy Markdown
Member

Evidence

Created a committed repository containing long.txt (needle + 505 ASCII a characters + 😀) and 30,000 filler files. On fresh databases, opened the real web client, pressed Ctrl+Shift+F, searched for needle, and captured the first result and its DOM text. Chromium 156, Linux, 1280×800, light theme. scenarios:prove exited 0: fails on base, passes on head.

Before After
Commit 09418562d6 a572c94ff9
Rendered DOM 512 UTF-16 units; malformed; ends 61 61 D83D Exact 511-unit prefix; well-formed; ends 61 61 61
Highlight needle preserved needle preserved
Capture Before: warmup search preview After: warmup search preview
Recording Before recording After recording

The dialog's CSS ellipsis hides the malformed ending visually; the DOM measurements establish the difference. DOM measurements. Scenario source and seed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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 28, 2026
@juliusmarminge
juliusmarminge merged commit 1060a7e into pingdotgg:main Nov 28, 2026
59 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 28, 2026
@omegent-app omegent-app Bot mentioned this pull request Nov 28, 2026
Merge upstream main through 0f78747290a1 patroza/t3code#688
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@saphid @juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.