mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-13 07:01:55 +00:00
* test(sdk): align tool-control E2E with prior-read enforcement
Three tests in tool-control.test.ts broke deterministically after the
prior-read enforcement landed. Each seeded test.txt then prompted a
direct write — the new guard now rejects the write before canUseTool
fires, with "File X has not been fully read in this session...".
- updatedInput-application + allowedTools-bypass tests: drop the seed
so write_file takes the new-file path (exempt from enforcement).
- asyncGenerator-deny test: keep seed (assertion requires unchanged
content), rewrite prompt to "Read X then write Y" — the pattern
used by 27 passing tests in the same file. Also fix a latent bug
where canUseTool returned `updatedInput: {}` for non-write tools,
which would erase file_path on read_file (SDK `?? toolInput` only
catches nullish, not empty objects).
* test(sdk): address self-review on #3898
- Fix the same `updatedInput: {}` reverse-pattern at line 1545 in
the multi-turn asyncGenerator test. The CLI side at
permissionController.ts:444 does `if (updatedInput && typeof
updatedInput === 'object')` — an empty object is truthy, so it
silently replaces args. Mirror the pass-through fix from line ~1457.
- In the deny test, add `expect(toolNames).toContain('read_file')`
before the canUseTool-deny assertion. If the model skips the
read-first instruction, prior-read enforcement would surface
EDIT_REQUIRES_PRIOR_READ rather than the canUseTool deny message,
causing a confusing toContain mismatch. Fail fast with a clear
signal instead.
|
||
|---|---|---|
| .. | ||
| 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 | ||