diff --git a/.claude/skills/verify/features/transcripts.md b/.claude/skills/verify/features/transcripts.md index a63dda42..26efa401 100644 --- a/.claude/skills/verify/features/transcripts.md +++ b/.claude/skills/verify/features/transcripts.md @@ -55,7 +55,7 @@ Preconditions: - **OpenRouter.** Choose `OpenRouter` with its fake key. The notes read as for ElevenLabs. - Scribe v2, public. Choose `ElevenLabs Scribe v2`, play `Fixture Episode 1` of `PodNotes Fixture` and run the audio command. `$NET log` shows the catalog `GET`, then one `POST https://openrouter.ai/api/v1/audio/transcriptions` with `contentType` `application/json`, under 1,000 `uploadBytes` and the episode's address as `sourceUrl`, and no request for `/episode-1.wav` after the command. - Grok STT 2.0. On `Recommended (Grok STT 2.0)`, play `Fixtures/Local Fixture.wav` and run the audio command. The `POST` is `application/json` with about 4/3 of the file's bytes, its audio in base64, and no `sourceUrl`. - - In parts. Write a 70 min MP3 of two voices, a 300 Hz tone and a 700 Hz tone that take turns every 45 s: `ffmpeg -f lavfi -i "aevalsrc='0.5*sin(2*PI*if(lt(mod(t\,90)\,45)\,300\,700)*t)':s=8000:d=4200" -ac 1 -ar 8000 -b:a 8k "$VAULT/Fixtures/Two Voices.mp3"`. Play it and run the audio command on Grok. `$NET log` shows three `POST https://openrouter.ai/api/v1/audio/transcriptions` entries of about 1.9 MB each, one after the other, then the speaker reel, one of about 82 KB whose `decodedSeconds` is `61.56`: six 9 s clips with 1.5 s of silence between two. The fixture numbers the voices in the order they sound in each request, so the second part, which starts with the high tone, numbers them the other way. The note still numbers the low voice `1` and the high voice `2` throughout, the paragraph at `00:23:15` runs on across the first part boundary, and the progress notice ends with `Transcription completed and saved.` With `ElevenLabs Scribe v2` the parts go as multipart, no reel follows, each part's fixed answer numbers two more speakers, and the notice ends with `OpenRouter transcribed this episode in 3 parts, and speaker labels restart in each, so one person can have several labels.` + - In parts. Write a 70 min MP3 of two voices, a 300 Hz tone and a 700 Hz tone that take turns every 45 s: `ffmpeg -f lavfi -i "aevalsrc='0.5*sin(2*PI*if(lt(mod(t\,90)\,45)\,300\,700)*t)':s=8000:d=4200" -ac 1 -ar 8000 -b:a 8k "$VAULT/Fixtures/Two Voices.mp3"`. Play it and run the audio command on Grok. `$NET log` shows three `POST https://openrouter.ai/api/v1/audio/transcriptions` entries of about 1.9 MB each, one after the other, then the speaker reel, one of about 82 KB whose `decodedSeconds` is `61.56`: six 9 s clips with 1.5 s of silence between two. The fixture numbers the voices in the order they sound in each request, so the second part, which starts with the high tone, numbers them the other way. The note still numbers the low voice `1` and the high voice `2` throughout, the paragraph at `00:23:15` runs on across the first part boundary, and the progress notice ends with `Transcription completed and saved.` With `ElevenLabs Scribe v2` the parts go as multipart, no reel follows, each part's fixed answer numbers two more speakers, and the notice ends with `OpenRouter transcribed this episode in 3 parts. Speakers not matched across parts got new numbers, so one person can have more than one.` - Voxtral Mini Transcribe 3 and Qwen3 ASR 1.7B. With `Speaker labels` on, choose each in `Model`. The `Speaker labels` row reads ` does not label speakers.` Play `Two Voices.mp3` and run the audio command. `$NET log` shows five `multipart/form-data` `POST https://openrouter.ai/api/v1/audio/transcriptions` entries of about 840 KB, one after the other, and no reel. Qwen3 ASR's are about 98 bytes larger, its `timestamp_granularities[]` field. The fixture answers Voxtral with segments, and with a 400 if it asks for word times. The note has `[00:00:00](...) This text came from the fixture provider.` and `[00:00:12](...) A second speaker answers.` for each part, at `00:14:00`, `00:28:00`, `00:42:00` and `00:56:00` with links to `time=840.096` and on, with no `**1:**`. The progress notice ends with `Saved without speaker labels, because does not label speakers. These providers do: ElevenLabs, Deepgram, OpenRouter.` - **OpenAI.** Choose `OpenAI` with its fake key. `Untranscribed Episode` downloads its WAV and `$NET log` shows a `POST https://api.openai.com/v1/audio/transcriptions` answered by the fixture provider. The note holds the fixture text with no timestamps. - In parts. Write an MP3 longer than 2,070 s into the vault, for example 70 min in 4 MB: `ffmpeg -f lavfi -i sine=frequency=440:duration=4200 -ac 1 -ar 8000 -b:a 8k "$VAULT/Fixtures/Long Fixture.mp3"`. Play it ([local-files.md](./local-files.md)) and run the audio command. `$NET log` shows three `POST https://api.openai.com/v1/audio/transcriptions` entries of about 1.4 MB each, one after the other, and the note holds the fixture text three times with no timestamps. diff --git a/AGENTS.md b/AGENTS.md index ee4472f9..6386769a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,7 +63,7 @@ svelte-check's native API path passes when a tsconfig matches no files, which `check:a11y` in temporary workspaces and requires it to fail on that case and when the native compiler cannot start. -After `npm run build`, `npm run size` enforces 334,091 raw bytes and 109,234 gzip bytes at level 9 for root `main.js` in the Test workflow's Build and sizes worker. `npm run size:data` reports a synthetic v2 stress library with 50 feeds, 2,000 history entries, and 200 saved episodes from frozen NPR metadata, including duplicated snapshots. Its 1.5 MB document goal is advisory. Pass an additive candidate JSON path to report optional-field overhead without changing existing data. In the isolated Obsidian instance, `npm run count:writes -- start`, `report`, and `stop` record writes to PodNotes' exact `data.json` path. Stop the recorder before stopping the instance, because recorder commands start a stopped instance; plugin reloads invalidate its counts. +After `npm run build`, `npm run size` enforces 334,105 raw bytes and 109,240 gzip bytes at level 9 for root `main.js` in the Test workflow's Build and sizes worker. `npm run size:data` reports a synthetic v2 stress library with 50 feeds, 2,000 history entries, and 200 saved episodes from frozen NPR metadata, including duplicated snapshots. Its 1.5 MB document goal is advisory. Pass an additive candidate JSON path to report optional-field overhead without changing existing data. In the isolated Obsidian instance, `npm run count:writes -- start`, `report`, and `stop` record writes to PodNotes' exact `data.json` path. Stop the recorder before stopping the instance, because recorder commands start a stopped instance; plugin reloads invalidate its counts. Before opening a PR or cutting a release, run the CI-equivalent checks locally: diff --git a/scripts/size-baseline.md b/scripts/size-baseline.md index 6fc18ca4..72a47c69 100644 --- a/scripts/size-baseline.md +++ b/scripts/size-baseline.md @@ -12,7 +12,7 @@ main.js raw: 307131 bytes; budget 330000 bytes; 22869 bytes remaining main.js gzip (level 9): 97161 bytes; budget 100000 bytes; 2839 bytes remaining ``` -The gzip budget is now 109,234 bytes, and the raw budget 334,091. On 2026-10-14 it rose from 100,000 for +The gzip budget is now 109,240 bytes, and the raw budget 334,105. On 2026-10-14 it rose from 100,000 for the full player's Transcript panel, which the owner approved at about 1.9 KB and which measured 2,576 bytes. The coordinator set 103,000 to keep the panel's Find and Follow chip and to leave room for fixes in flight. The @@ -100,6 +100,15 @@ main.js raw: 334091 bytes; budget 334091 bytes; 0 bytes remaining main.js gzip (level 9): 109234 bytes; budget 109234 bytes; 0 bytes remaining ``` +On 2026-11-20 both rose for the warning after a transcript in parts, which now +says that speakers not matched across parts got new numbers: from 334,091 raw by +14 bytes, and from 109,234 gzip by 6 bytes. With it: + +```text +main.js raw: 334105 bytes; budget 334105 bytes; 0 bytes remaining +main.js gzip (level 9): 109240 bytes; budget 109240 bytes; 0 bytes remaining +``` + Gzip uses Node's `gzipSync` at level 9, without a filename or timestamp. Budgets use decimal bytes. The brief's 96,533-byte reference is unexplained. This report fixes the compressor instead of comparing compressed sizes across diff --git a/scripts/size.mjs b/scripts/size.mjs index c883ce78..a10767a2 100644 --- a/scripts/size.mjs +++ b/scripts/size.mjs @@ -9,8 +9,8 @@ try { const bundle = readFileSync(path); if (!bundle.length) throw new Error(`${path} is empty. Run npm run build first.`); const measurements = [ - { name: "raw", bytes: bundle.length, budget: 334_091 }, - { name: "gzip (level 9)", bytes: gzipSync(bundle, { level: 9 }).length, budget: 109_234 }, + { name: "raw", bytes: bundle.length, budget: 334_105 }, + { name: "gzip (level 9)", bytes: gzipSync(bundle, { level: 9 }).length, budget: 109_240 }, ]; const rows = measurements.map(({ name, bytes, budget }) => { const overage = Math.max(0, bytes - budget); diff --git a/scripts/size.test.ts b/scripts/size.test.ts index 9ecc9e7f..d725e70a 100644 --- a/scripts/size.test.ts +++ b/scripts/size.test.ts @@ -20,19 +20,19 @@ function check(name: string, contents: string | Buffer) { describe("bundle budget CLI", () => { it("allows the raw budget boundary and rejects one extra byte", () => { - expect(check("boundary.js", "a".repeat(334_091)).status).toBe(0); - const result = check("over.js", "a".repeat(334_092)); + expect(check("boundary.js", "a".repeat(334_105)).status).toBe(0); + const result = check("over.js", "a".repeat(334_106)); expect(result.status).toBe(1); - expect(result.stdout).toContain("budget 334091 bytes; OVER by 1 bytes"); + expect(result.stdout).toContain("budget 334105 bytes; OVER by 1 bytes"); }); it("rejects gzip growth even when raw bytes fit", () => { const result = check("gzip.js", randomBytes(110_000)); expect(result.status).toBe(1); expect(result.stdout).toMatch( - /gzip \(level 9\): \d+ bytes; budget 109234 bytes; OVER by \d+ bytes/, + /gzip \(level 9\): \d+ bytes; budget 109240 bytes; OVER by \d+ bytes/, ); - expect(result.stdout).toContain("budget 334091 bytes; 224091 bytes remaining"); + expect(result.stdout).toContain("budget 334105 bytes; 224105 bytes remaining"); }); it("fails on absent or empty artifacts instead of reporting a small build", () => { diff --git a/src/services/TranscriptionService.test.ts b/src/services/TranscriptionService.test.ts index 64bebb4f..feb157b4 100644 --- a/src/services/TranscriptionService.test.ts +++ b/src/services/TranscriptionService.test.ts @@ -2028,8 +2028,8 @@ describe("TranscriptionService", () => { openRouterKey: "openrouter-key", speakers: true, }); - const RESTART = - "OpenRouter transcribed this episode in 2 parts, and speaker labels restart in each, so one person can have several labels."; + const UNMATCHED = + "OpenRouter transcribed this episode in 2 parts. Speakers not matched across parts got new numbers, so one person can have more than one."; test("Grok STT 2.0 numbers each voice once across two parts that label them in the other order", async () => { getEpisodeAudioBufferMock.mockResolvedValue(episode()); @@ -2130,7 +2130,7 @@ describe("TranscriptionService", () => { expect(sent()).toHaveLength(3); }); - test("a voice whose turns are all under 2.6 s gets no clip, keeps its own number, and the notice says labels restart in each", async () => { + test("a voice whose turns are all under 2.6 s gets no clip, keeps its own number, and the notice says unmatched speakers got new numbers", async () => { // Cy speaks 2.016 s, after Ann in the second part. getEpisodeAudioBufferMock.mockResolvedValue( episode([...TURNS, { voice: CY, from: 23_334, to: 23_362 }]), @@ -2147,7 +2147,7 @@ describe("TranscriptionService", () => { "1 Ann", "3 Cy", ]); - expect(notice).toBe(RESTART); + expect(notice).toBe(UNMATCHED); expect(sent()).toHaveLength(3); const reelVoices = framesOf(await sentAudio(sent()[2])).map((frame) => frame === "silence" ? 0 : frame.voice, @@ -2179,10 +2179,10 @@ describe("TranscriptionService", () => { expect(sent()).toHaveLength(3); expect(spoken(savedNote(plugin))).toEqual(["1 Ann", "2 Cy", "1 Ann"]); - expect(notice).toBe(RESTART); + expect(notice).toBe(UNMATCHED); }); - test("a reel OpenRouter refuses keeps the parts' labels, saves the note and says labels restart", async () => { + test("a reel OpenRouter refuses keeps the parts' labels, saves the note and says unmatched speakers got new numbers", async () => { getEpisodeAudioBufferMock.mockResolvedValue(episode()); hearing(() => Response.json( @@ -2192,14 +2192,14 @@ describe("TranscriptionService", () => { ); const plugin = grok(); - await expect(finalNotice(plugin)).resolves.toBe(RESTART); + await expect(finalNotice(plugin)).resolves.toBe(UNMATCHED); expect(sent()).toHaveLength(3); expect(spoken(savedNote(plugin))).toEqual(["1 Ann", "2 Bob", "3 Bob", "4 Ann"]); }); test.each(["elevenlabs/scribe-v2", "microsoft/mai-transcribe-2"])( - "%s sends no reel: labels from two parts never name the same speaker, and the notice says labels restart in each", + "%s sends no reel: labels from two parts never name the same speaker, and the notice says unmatched speakers got new numbers", async (model) => { getEpisodeAudioBufferMock.mockResolvedValue(episode()); hearing(); @@ -2210,7 +2210,7 @@ describe("TranscriptionService", () => { model, }); - await expect(finalNotice(plugin)).resolves.toBe(RESTART); + await expect(finalNotice(plugin)).resolves.toBe(UNMATCHED); expect(sent()).toHaveLength(2); expect(spoken(savedNote(plugin))).toEqual(["1 Ann", "2 Bob", "3 Bob", "4 Ann"]); diff --git a/src/services/transcription/transcribe.ts b/src/services/transcription/transcribe.ts index 5082adea..ca2d73e8 100644 --- a/src/services/transcription/transcribe.ts +++ b/src/services/transcription/transcribe.ts @@ -172,7 +172,7 @@ export async function transcribe(job: TranscriptionJob): Promise { // A label the reel did not hear can name a voice that another part labels too. if (speakers && parts.length > 1 && [...labels].some((label) => !sameSpeaker?.has(label))) { warnings.push( - `${choice.label} transcribed this episode in ${parts.length} parts, and speaker labels restart in each, so one person can have several labels.`, + `${choice.label} transcribed this episode in ${parts.length} parts. Speakers not matched across parts got new numbers, so one person can have more than one.`, ); } return { content, warnings };