@openparachute/vault 0.7.9-rc.6 → 0.7.9-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/vault.test.ts CHANGED
@@ -17,6 +17,7 @@ import type { TagScopeCtx } from "./routes.ts";
17
17
  import { extractApiKey } from "./auth.ts";
18
18
  import { startTranscriptionWorker } from "./transcription-worker.ts";
19
19
  import { setTranscriptionWorker } from "./transcription-registry.ts";
20
+ import { clearScribeUrlCache } from "./scribe-discovery.ts";
20
21
  import type { Store } from "../core/src/types.ts";
21
22
 
22
23
  let db: Database;
@@ -3314,23 +3315,45 @@ describe("HTTP /notes", async () => {
3314
3315
  // left looking like an ordinary upload — it records WHY nothing happened.
3315
3316
  // It is still not `pending` (nothing was enqueued) and the note is still
3316
3317
  // untouched (no stub, since the caller never asked for one).
3317
- test("audio with no flag + no provider records the failure; note untouched", async () => {
3318
- await store.createNote("note body", { id: "v2" });
3319
- const res = await handleNotes(
3320
- mkReq("POST", "/notes/v2/attachments", {
3321
- path: "memos/memo-2.webm",
3322
- mimeType: "audio/webm",
3323
- }),
3324
- store,
3325
- "/v2/attachments",
3326
- );
3327
- expect(res.status).toBe(201);
3328
- const att = await res.json() as any;
3329
- expect(att.metadata?.transcribe_status).toBe("failed");
3330
- expect(att.metadata?.transcribe_error).toMatch(/no transcription provider configured/i);
3331
-
3332
- const note = await store.getNote("v2");
3333
- expect((note!.metadata as any)?.transcribe_stub).toBeUndefined();
3318
+ //
3319
+ // Fixture: select the remote provider so the presence/absence of a local
3320
+ // whisper-cpp install on the host cannot change the message. With no
3321
+ // SCRIBE_URL configured, auto-transcribe is still unavailable and reports
3322
+ // the same actionable no-provider error on every box.
3323
+ test("audio with no flag + scribe-http without URL records the failure; note untouched", async () => {
3324
+ const prevProvider = process.env.TRANSCRIPTION_PROVIDER;
3325
+ const prevScribeUrl = process.env.SCRIBE_URL;
3326
+ process.env.TRANSCRIPTION_PROVIDER = "scribe-http";
3327
+ delete process.env.SCRIBE_URL;
3328
+ clearScribeUrlCache();
3329
+ try {
3330
+ await store.createNote("note body", { id: "v2" });
3331
+ const res = await handleNotes(
3332
+ mkReq("POST", "/notes/v2/attachments", {
3333
+ path: "memos/memo-2.webm",
3334
+ mimeType: "audio/webm",
3335
+ }),
3336
+ store,
3337
+ "/v2/attachments",
3338
+ );
3339
+ expect(res.status).toBe(201);
3340
+ const att = await res.json() as any;
3341
+ expect(att.metadata?.transcribe_status).toBe("failed");
3342
+ expect(att.metadata?.transcribe_error).toMatch(/no transcription provider configured/i);
3343
+ expect(att.metadata?.transcribe_error).toMatch(/TRANSCRIPTION_PROVIDER/);
3344
+ expect(att.metadata?.transcribe_error).toMatch(/SCRIBE_URL/);
3345
+ expect(att.metadata?.transcribe_origin).toBe("auto");
3346
+
3347
+ const note = await store.getNote("v2");
3348
+ expect(note!.content).toBe("note body");
3349
+ expect((note!.metadata as any)?.transcribe_stub).toBeUndefined();
3350
+ } finally {
3351
+ if (prevProvider === undefined) delete process.env.TRANSCRIPTION_PROVIDER;
3352
+ else process.env.TRANSCRIPTION_PROVIDER = prevProvider;
3353
+ if (prevScribeUrl === undefined) delete process.env.SCRIBE_URL;
3354
+ else process.env.SCRIBE_URL = prevScribeUrl;
3355
+ clearScribeUrlCache();
3356
+ }
3334
3357
  });
3335
3358
 
3336
3359
  // The explicit opt-out. `transcribe: false` is a caller saying no, and it