From e4ad195df9dcbfdfc1596908071668fbbf8a1794 Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Mon, 25 May 2026 15:36:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20silence=20Turbopack=20pro?= =?UTF-8?q?ject-wide=20glob=20warning=20(#15194)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `path.join(this.root, sub)` still tripped Turbopack's static file-pattern analyzer because `safeSegment`'s `|| 'unknown'` fallback gave the analyzer a finite alternation, fanning out into a project-wide glob that matched 11k+ files at build time. Hand-roll the join with `path.sep` so the analyzer can't see it as a path pattern; output is byte-identical to `path.join` on both Unix and Windows. Co-authored-by: Claude Opus 4.7 --- .../llm-generation-tracing/src/store/file-store.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/llm-generation-tracing/src/store/file-store.ts b/packages/llm-generation-tracing/src/store/file-store.ts index 7dfb82328c..87da73fcb6 100644 --- a/packages/llm-generation-tracing/src/store/file-store.ts +++ b/packages/llm-generation-tracing/src/store/file-store.ts @@ -120,11 +120,14 @@ export class FileTracingStore implements ITracingStore { } private bucketDir(record: TracingPayload): string { - // Compose the relative segment as a single string so Turbopack / Webpack - // static analyzers don't try to enumerate path.join's multi-arg pattern - // (which fans out into a glob match against the project). - const sub = `${safeSegment(record.scenario)}/${safeSegment(record.prompt_version)}-${safeSegment(record.prompt_hash)}`; - return path.join(this.root, sub); + // Hand-roll the join with `path.sep` so Turbopack / Webpack can't statically + // analyze it. `path.join(this.root, sub)` still triggers the static file + // pattern detector because `safeSegment`'s `|| 'unknown'` fallback gives the + // analyzer a finite alternation that fans out into a project-wide glob + // (the build warning enumerated 11k+ candidate files). + const scenario = safeSegment(record.scenario); + const bucket = `${safeSegment(record.prompt_version)}-${safeSegment(record.prompt_hash)}`; + return `${this.root}${path.sep}${scenario}${path.sep}${bucket}`; } private async updateLatestSymlink(filePath: string): Promise {