mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-20 09:24:03 +00:00
Round-4 review caught one type-drift gap + a set of integration-test
assumptions that the §02 refactor invalidated.
**SDK type drift.** `DaemonCapabilities` in
`packages/sdk-typescript/src/daemon/types.ts` was the SDK-side mirror
of `CapabilitiesEnvelope` on the daemon side. The §02 PR added
`workspaceCwd: string` to the daemon envelope (and the round-3 doc
example reads `caps.workspaceCwd` off the SDK client) but the SDK
type wasn't updated. A TypeScript consumer copying the doc snippet
verbatim would hit `TS2339 'workspaceCwd' does not exist on type
'DaemonCapabilities'`. The wire field is present so JS consumers
wouldn't notice — but the SDK is marketed as a TypeScript quickstart,
so this is a real onboarding break.
Fix: add `workspaceCwd: string` to `DaemonCapabilities` (parallel to
`DaemonSession.workspaceCwd` which is already there). The SDK unit
test for `client.capabilities()` was updated to put the new field
in the mocked response.
**Integration tests.** `qwen-serve-routes.test.ts` spawns a real
`qwen serve` daemon in `beforeAll`. Three breakages exposed:
1. The daemon was launched without `--workspace`, so it inherited
the test runner's `cwd`. Tests then POST `workspaceCwd: REPO_ROOT`
assuming the daemon is bound to the repo root — true when run via
`npm test` from the repo, brittle from IDEs / launchers that have
a different `cwd`. Added `'--workspace', REPO_ROOT` to the spawn
args so the bound workspace is deterministic regardless of where
the test runner is launched.
2. The `bad modelServiceId` test used `cwd: '/tmp'`. Under §02 this
would now return 400 workspace_mismatch before the session was
spawned. Switched to `REPO_ROOT` and softened the `attached`
assertion (REPO_ROOT may already have a session from earlier
tests in the suite under sessionScope:single).
3. Added three new integration tests pinning the §02 surface
end-to-end through a real daemon process:
- `rejects cross-workspace cwd with 400 workspace_mismatch` —
posts `/tmp` and asserts the full structured error body
(`code`, `boundWorkspace`, `requestedWorkspace`).
- `omits cwd → falls back to bound workspace` — posts an empty
body and asserts the response's `workspaceCwd` matches REPO_ROOT
(verifies the runQwenServe → createServeApp → bridge fallback
plumbing).
- `GET /capabilities surfaces workspaceCwd` — asserts the new
SDK type field is populated correctly off the wire.
All 422 unit tests pass (cli serve + sdk). Integration tests
typecheck clean.
|
||
|---|---|---|
| .. | ||
| cli | ||
| concurrent-runner | ||
| fixtures/settings-migration | ||
| hook-integration | ||
| interactive | ||
| sdk-typescript | ||
| terminal-bench | ||
| terminal-capture | ||
| channel-plugin.test.ts | ||
| globalSetup.ts | ||
| test-helper.ts | ||
| test-mcp-server.ts | ||
| tsconfig.json | ||
| vitest.config.ts | ||
| vitest.terminal-bench.config.ts | ||