From f6fc7e90a3cd6644ab28c16a4b359d1bebf07abc Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Thu, 13 Aug 2026 00:27:34 -0700 Subject: [PATCH] fix(studio-server): fingerprint the proactive waveform cache key too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The route already keys the waveform cache on the asset's size and mtime as well as its path, so a rebuilt-in-place file gets fresh peaks instead of stale ones. generateWaveformCache — the proactive path that runs on upload — still called buildWaveformCacheKey with the path alone, so it wrote to a different key than the route reads from (making the pre-generated cache never found) and kept the exact collision bug this fingerprint exists to fix on its own path. Review by Miga (PR #3211). --- packages/studio-server/src/helpers/waveform.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/studio-server/src/helpers/waveform.ts b/packages/studio-server/src/helpers/waveform.ts index 79e3f1ca47..6bf020e77a 100644 --- a/packages/studio-server/src/helpers/waveform.ts +++ b/packages/studio-server/src/helpers/waveform.ts @@ -1,5 +1,5 @@ import { spawn } from "node:child_process"; -import { existsSync, writeFileSync, mkdirSync } from "node:fs"; +import { existsSync, writeFileSync, mkdirSync, statSync } from "node:fs"; import { join } from "node:path"; import { findFfBinary } from "@hyperframes/parsers/ff-binaries"; @@ -94,8 +94,9 @@ export async function generateWaveformCache(projectDir: string, assetPath: strin const audioPath = join(projectDir, assetPath); if (!existsSync(audioPath)) return; + const stats = statSync(audioPath); const cacheDir = join(projectDir, ".waveform-cache"); - const cachePath = join(cacheDir, buildWaveformCacheKey(assetPath)); + const cachePath = join(cacheDir, buildWaveformCacheKey(assetPath, stats)); if (existsSync(cachePath)) return; const peaks = await decodeAudioPeaks(audioPath);