fix(build,denoise): gate node leak, postMessage origin, fail-hard patch, CDN dedup (N124/N125/N128/N120)

- N124: denoise shim cleanup() now disconnects the noise gate AudioWorkletNode
  (var-scoped, guarded), releasing the gate processor thread instead of leaking
  it on every getUserMedia within a session.
- N125: denoise-status postMessage now targets the parent origin (derived from
  the parentUrl widget param via new URL(...).origin, falling back to this
  frame's origin) instead of broadcasting with '*'.
- N128: patch-folds.mjs fails hard (process.exit(1)) when the patch target is
  missing, so an unpatched folds can't silently ship. The idempotent
  "already applied" path still exits 0 (verified by re-run).
- N120: the avatar-decoration CDN URL is now single-sourced in
  avatarDecorations.ts (DECORATION_CDN); syncDecorations.mjs extracts it by
  regex (can't import across the build/app boundary) and fails hard if renamed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 10:55:19 -04:00
parent 19feca4964
commit ce8a03ab16
4 changed files with 52 additions and 6 deletions
+17 -2
View File
@@ -21,10 +21,25 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
const root = join(__dirname, '..');
const catalogPath = join(root, 'src', 'app', 'features', 'lotus', 'avatarDecorations.ts');
const CDN = 'https://drive.lotusguild.org/public.php/dav/files/bHswJ9pNKp2t26N/cinny-decorations';
// Single source of truth: the CDN base URL lives in avatarDecorations.ts as
// `export const DECORATION_CDN`. We extract it from there at runtime rather than
// re-declaring it here, so the build script and the app can never drift. This
// .mjs script can't cleanly import the browser-side .ts module (it's outside the
// Vite/TS app graph), so we parse the constant out of the file text instead.
// If you migrate the CDN, change it ONLY in avatarDecorations.ts.
const catalog = readFileSync(catalogPath, 'utf8');
const cdnMatch = catalog.match(/export const DECORATION_CDN\s*=\s*['"]([^'"]+)['"]/);
if (!cdnMatch) {
console.error(
'Could not find `export const DECORATION_CDN` in avatarDecorations.ts — ' +
'the constant may have been renamed. Update scripts/syncDecorations.mjs.',
);
process.exit(1);
}
const CDN = cdnMatch[1];
// Extract all slugs from the catalog file
const catalog = readFileSync(catalogPath, 'utf8');
const slugMatches = [...catalog.matchAll(/slug: '([^']+)'/g)].map((m) => m[1]);
if (slugMatches.length === 0) {