Skip to content

test(core): align tool contract expectations - #39172

Merged
kitlangton merged 5 commits into
v2from
v2-unit-failures
Jul 28, 2026
Merged

test(core): align tool contract expectations#39172
kitlangton merged 5 commits into
v2from
v2-unit-failures

Conversation

@kitlangton

@kitlangton kitlangton commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What

Restore the V2 unit suite after the consolidated tool architecture changed the runner request envelope, tool result shape, and required test services.

Before / After

Before: Core tests expected direct tool definitions without the built-in Code Mode execute tool or empty-catalog guidance, asserted removed result status fields and legacy tool.unknown errors, and built Code Mode fixtures without the now-required Location service. This produced 29 consistent core failures on Linux and Windows.

After: Runner tests isolate their subject from the orthogonal Code Mode envelope, assertions use the canonical tool result and tool.execution contracts, obsolete tests for deleted injection/persistence seams are removed, and Code Mode fixtures provide Location. The full core suite passes.

How

  • Normalize captured requests in session-runner.test.ts by removing only the built-in empty Code Mode guidance and execute definition before runner-specific assertions.
  • Update tool hook, Promise plugin, and unknown-tool expectations to match the consolidated Tool contract.
  • Bind a deterministic /project Location in standalone Code Mode test layers.
  • Remove runner cases that depended on the deleted failure-metadata injection and tool-output persistence seams.

Scope

  • Test-only changes; no runtime behavior or public API changes.
  • Leaves dedicated Code Mode tests responsible for validating the execute definition and catalog guidance.

Testing

  • env OPENCODE_CONFIG_DIR=/tmp/opencode-v2-unit-config OPENCODE_TEST_HOME=/tmp/opencode-v2-unit-home bun run test from packages/core (1472 pass, 6 skip, 0 fail)
  • bun typecheck from packages/core
  • Push hook repository typecheck (32 successful, 32 total)

Update after rebase onto latest v2

Rebased onto 4333a44e65 and added two commits for failures the rebase exposed (base CI stops at core:test, so these were masked until this PR made core green):

  • fix(core): omit undefined exit from shell tool outputfix(core): simplify tool schemas #39184 changed the shell Output schema to Schema.optionalKey, which rejects a present-but-undefined exit key; a timed-out command finishes with exit: undefined, so output encoding failed and ShellTool > returns a useful timeout outcome broke on base. The tool now omits exit when the process has no exit code.

  • test(cli): use read tool path input in acp fixturesfeat(core): improve read tool parity #39126 renamed the read tool input from filePath to path but left the synthetic read fixtures in test/acp/event-behavior.test.ts and test/acp/permission-behavior.test.ts on the old key, so toLocations derived empty locations.

  • chore(sdk): regenerate promise client types and chore(www): regenerate openapi documents — the Check generated client / Check generated documentation steps were also masked on base for the same reason; upstream schema changes (LLMToolContentToolContent, nullable file name, new /api/agent/{agentID} endpoint) left the generated surfaces stale. Regenerated via bun run generate, updated the two type-only consumers in packages/cli.

Local: packages/core 1478 pass / 0 fail, packages/cli 161 pass / 0 fail, bun typecheck clean in core, cli, and client.

@kitlangton
kitlangton enabled auto-merge (squash) July 27, 2026 19:36
@kitlangton
kitlangton merged commit 470e360 into v2 Jul 28, 2026
10 checks passed
@kitlangton
kitlangton deleted the v2-unit-failures branch July 28, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant