fix: final-review findings (median pass tick, R11 secondary metrics, R12 chord duration, render version, dsp resample)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Sonnet 5.5 committed 2026-10-30 05:55:04 +01:00
1 parent 2b7d5ffbeb
commit b631bd2c7e
16 files changed
+199 -48

No files matched your search

+25 -1
View File
@@ -2,7 +2,7 @@ import { test, expect } from "bun:test";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { buildSong, loadSongDir } from "../../src/bench/dataset.ts";
import { buildSong, loadSongDir, RENDER_VERSION } from "../../src/bench/dataset.ts";
test("buildSong writes all artefacts; loadSongDir reads them; stems sum to mix; idempotent", async () => {
const root = await mkdtemp(join(tmpdir(), "stsheets-ds-"));
@@ -55,3 +55,27 @@ test("multi-track t1b: stems on disk sum to mix.wav", async () => {
await rm(root, { recursive: true, force: true });
}
}, 120_000);
test("a dir built under an older/missing RENDER_VERSION is rebuilt", async () => {
const root = await mkdtemp(join(tmpdir(), "stsheets-ds-"));
try {
const dir = await buildSong("t1a", 2, root);
const mp3 = join(dir, "mix.mp3");
const v = Bun.file(join(dir, "render-version"));
expect((await v.text()).trim()).toBe(String(RENDER_VERSION));
const m0 = (await Bun.file(mp3).stat()).mtimeMs;
await Bun.write(join(dir, "render-version"), String(RENDER_VERSION - 1)); // simulate an old build
await Bun.sleep(20);
await buildSong("t1a", 2, root);
const m1 = (await Bun.file(mp3).stat()).mtimeMs;
expect(m1).toBeGreaterThan(m0);
expect((await Bun.file(join(dir, "render-version")).text()).trim()).toBe(String(RENDER_VERSION));
// missing marker file also rebuilds
await rm(join(dir, "render-version"));
await Bun.sleep(20);
await buildSong("t1a", 2, root);
expect((await Bun.file(mp3).stat()).mtimeMs).toBeGreaterThan(m1);
} finally {
await rm(root, { recursive: true, force: true });
}
}, 180_000);