Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(aio): remove narration comments from textHelpers (#102010)

posthog[bot]f60b7082d965
diff --git a/products/ai_observability/frontend/text-view/parsing/textHelpers.ts b/products/ai_observability/frontend/text-view/parsing/textHelpers.ts
index c57fbafed29f..38445c929acf 100644
--- a/products/ai_observability/frontend/text-view/parsing/textHelpers.ts
+++ b/products/ai_observability/frontend/text-view/parsing/textHelpers.ts
@@ -1,14 +1,8 @@
-/**
- * Text helper utilities for text view display
- */
// eslint-disable-next-line import/no-cycle
import { parseTruncatedSegments } from './segmentParser'
import { TextSegment } from './types'
-/**
- * Decode base64-encoded UTF-8 string properly
- * Using TextDecoder to handle emoji and special characters correctly
- */
+// Use TextDecoder so emoji and other multi-byte UTF-8 characters decode correctly
export function decodeBase64Utf8(base64String: string): string {
const binaryString = atob(base64String)
const bytes = new Uint8Array(binaryString.length)
@@ -18,35 +12,24 @@ export function decodeBase64Utf8(base64String: string): string {
return new TextDecoder('utf-8').decode(bytes)
}
-/**
- * Get plain text representation for copying (with all truncated sections collapsed)
- */
export function getPlainText(segments: TextSegment[]): string {
return segments.map((seg) => (seg.type === 'truncated' ? seg.content : seg.content)).join('')
}
-/**
- * Get expanded tree text for copying trace views
- * Expands all gen_expandable nodes but keeps truncation markers collapsed
- */
+// Expands gen_expandable nodes but keeps truncation markers collapsed
export function getExpandedTreeText(segments: TextSegment[]): string {
return segments
.map((seg) => {
if (seg.type === 'gen_expandable' && seg.fullContent) {
- // Expand this node but keep any nested truncation markers collapsed
const nestedSegments = parseTruncatedSegments(seg.fullContent)
return nestedSegments.map((nestedSeg) => nestedSeg.content).join('')
}
- // For truncated and text segments, use content as-is
return seg.content
})
.join('')
}
-/**
- * Calculate the padding width needed for line numbers based on the maximum line number
- * Returns the number of digits in the largest line number (e.g., 3 for L100, 4 for L1000)
- */
+// Returns the number of digits in the largest line number (e.g. 3 for L100, 4 for L1000)
export function calculateLineNumberPadding(text: string): number {
let maxLineNumber = 0
const lineMatches = text.matchAll(/^L(\d+):/gm)