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): long worktree setup details no longer end in half an emo… · pingdotgg/t3code@221bc8a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/project
    • WorktreeSetupTracker.test.ts
    • WorktreeSetupTracker.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/project/WorktreeSetupTracker.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/project/WorktreeSetupTracker.test.ts
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,24 @@ describe("WorktreeSetupTracker", () => {
140140
yield* Fiber.interrupt(fiber);
141141
}),
142142
);
143+
144+
it.effect("clamps stage detail and finish error without splitting surrogate pairs", () =>
145+
Effect.gen(function* () {
146+
const tracker = yield* WorktreeSetupTracker.make;
147+
yield* tracker.begin({
148+
threadId,
149+
branch: null,
150+
baseRef: null,
151+
stages: ["agent"],
152+
fiber: null,
153+
});
154+
155+
yield* tracker.stageStatus(threadId, "agent", "running", `${"a".repeat(198)}\u{1F680}tail`);
156+
yield* tracker.finish(threadId, "failed", `${"e".repeat(998)}\u{1F680}tail`);
157+
158+
const final = yield* tracker.get(threadId);
159+
expect(final?.stages[0]?.detail).toBe(`${"a".repeat(198)}\u2026`);
160+
expect(final?.error).toBe(`${"e".repeat(998)}\u2026`);
161+
}),
162+
);
143163
});
Collapse file

‎apps/server/src/project/WorktreeSetupTracker.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/project/WorktreeSetupTracker.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
WORKTREE_SETUP_STAGE_ORDER,
1212
WORKTREE_SETUP_TAIL_LINE_MAX_LENGTH,
1313
} from "@t3tools/contracts";
14+
import { splitsSurrogatePair } from "@t3tools/shared/assistantCitations";
1415
import * as Context from "effect/Context";
1516
import * as DateTime from "effect/DateTime";
1617
import * as Effect from "effect/Effect";
@@ -67,7 +68,9 @@ export class WorktreeSetupTracker extends Context.Service<
6768
const TAIL_LINE_LIMIT = 4;
6869

6970
function clampText(text: string, maxLength: number): string {
70-
return text.length <= maxLength ? text : `${text.slice(0, maxLength - 1)}\u2026`;
71+
if (text.length <= maxLength) return text;
72+
const end = splitsSurrogatePair(text, maxLength - 1) ? maxLength - 2 : maxLength - 1;
73+
return `${text.slice(0, end)}\u2026`;
7174
}
7275

7376
const clampDetail = (detail: string | null): string | null =>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.