Skip to content

Commit cee4ecc

Browse files
yuranichcursoragent
andcommitted
test: cover worker startup stderr
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 6d808c5 commit cee4ecc

3 files changed

Lines changed: 56 additions & 86 deletions

File tree

.cursor/skills/qv-sdk-pr-create/SKILL.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ TICKET prefix[tags]: subject
7777
7878
## PR Body
7979
```markdown
80-
**Note**: be concise and prefer bullet points.
81-
8280
## 🎯 What problem does this PR solve?
8381
...
8482
```
@@ -174,6 +172,7 @@ Before outputting the PR description, verify:
174172
- [ ] `[api]` tag has usage example
175173
- [ ] `[mod]` tag has Added/Removed models list
176174
- [ ] Description is concise - bullet points, no fluff
175+
- [ ] Generated helper notes, template instructions, and tool footers are removed from the PR body
177176
- [ ] If diff touches `packages/sdk/package.json` deps/version, the sync skill ran (or `--no-sync` was set with a reminder emitted), and `check:deps-vs-sdk` passes
178177
- [ ] If base is `release-<pkg>-<x.y.z>`, the dual-PR flow ran (or `--no-backmerge` was set), and both PR URLs are reported
179178

packages/sdk/scripts/repro-worker-startup-error.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import test from "brittle";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
5+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
6+
const nativeLoadErrorMarker = "QVAC_REPRO_NATIVE_LOAD_ERROR";
7+
8+
function collectErrorDetails(error: Error | undefined) {
9+
if (!error) return "";
10+
11+
const cause = (error as { cause?: unknown }).cause;
12+
const causeMessage = cause instanceof Error ? cause.message : "";
13+
return `${error.message}\n${causeMessage}`;
14+
}
15+
16+
test("loadModel() startup failure includes worker stderr in RPC init error cause", async function (t) {
17+
t.timeout(15_000);
18+
19+
process.env["QVAC_WORKER_PATH"] = path.resolve(
20+
__dirname,
21+
"fixtures/native-load-failure-worker.mjs",
22+
);
23+
24+
const { loadModel } = await import("@/client/api/load-model");
25+
const { close } = await import("@/client/rpc/rpc-client");
26+
27+
t.teardown(async () => {
28+
try {
29+
await close();
30+
} catch {}
31+
delete process.env["QVAC_WORKER_PATH"];
32+
});
33+
34+
let startupError: Error | undefined;
35+
try {
36+
await loadModel({
37+
modelSrc: "/tmp/qvac-repro-model.gguf",
38+
modelType: "llamacpp-completion",
39+
});
40+
t.fail("loadModel() resolved unexpectedly - expected worker startup failure");
41+
} catch (error) {
42+
startupError = error as Error;
43+
}
44+
45+
t.ok(startupError, "expected loadModel() to reject");
46+
t.is(
47+
(startupError as { name?: string } | undefined)?.name,
48+
"RPC_INIT_TIMEOUT",
49+
`expected RPC_INIT_TIMEOUT, got name=${(startupError as { name?: string } | undefined)?.name}`,
50+
);
51+
t.ok(
52+
collectErrorDetails(startupError).includes(nativeLoadErrorMarker),
53+
"expected SDK error details to include worker stderr",
54+
);
55+
});

0 commit comments

Comments
 (0)