Skip to content

test(sdk): stabilize steering and isolate wire-test environments - #2637

Merged
jbeda merged 4 commits into
mainfrom
test/sdk-steer-barrier
Nov 1, 2026
Merged

jbeda merged 4 commits into
mainfrom
test/sdk-steer-barrier

Conversation

@jbeda

@jbeda jbeda commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stabilize the SDK run-controls append/retract checks by holding an unresolved Write permission ask instead of relying on a two-second mock response delay. Preserve exact accepted, appended, retracted, and none_pending assertions, then assert cancellation through the same event iterator.
  • Isolate spawn fixtures from operator HOME/XDG state. Resolve Bun's concrete executable in the caller's environment before launching it with isolated state, so runtime-manager shims do not lose their selection/trust configuration.
  • Document contributor tool-version targets and mise selection in CONTRIBUTING.md, linked from SDK development instructions. Distinguish SDK/docs Node 24 from Studio Node 26 and contributor targets from supported runtime minimums.

Refs #2327, item 6b's steer-outcome mismatch. This does not claim to resolve every historical premature-close variant or the entire umbrella issue.

Why

session.run() can return before the initial turn-boundary steer drain. Two sequential RPCs do not guarantee that the first steer remains pending when the second arrives; a second accepted outcome can therefore be correct. The provider delay occurs after the initial boundary and supplies only a timing window. An unresolved permission ask prevents further turn-boundary drains while the assertions execute.

The accepted/appended explanation is supported by current code, not an instrumented trace of the historical CI failure. A temporary 2.5-second pause between steer requests made the original test fail with stale-run control; the same pause passed with the barrier across all three transports. The final test contains no added pause.

During validation, unrelated local setup failures exposed incomplete fixture isolation and Bun shim resolution after XDG replacement. The regressions use synthetic caller state rather than inspecting operator settings or changing global trust.

Verification

  • Run-controls test: 10 consecutive passes, each covering gRPC TCP, gRPC UDS, and HTTP plus existing restart/cancellation controls.
  • Runtime-shim regression: the configuration-dependent wrapper resolves to actual Bun, which performs the original real-wire callback assertions. Reverting concrete executable resolution fails with runtime shim lost caller configuration.
  • Spawn isolation regression: poisoned synthetic ambient configuration is ignored by the clean fixture, but explicitly supplying that configuration fails startup. Removing the isolated environment fails the smoke test. Unexpected successful negative-control clients are closed.
  • SDK lint, typecheck, and unit suite: passed (392 tests).
  • Full offline SDK wire suite: passed (35 tests; macOS-only test skipped on Linux), including the documented command with Node 24, pnpm 12.15.0, and Bun 1.4.4. No outer HOME/XDG or BUN_BIN workaround required.
  • Full task test, task lint, task test:race, and offline demo: passed. Demo showed tool call/result, permission ask/approval, and terminal result.
  • task docs and task site:build: passed; generated references unchanged.
  • Independent focused reviews: no blocking or important findings; negative-control cleanup advisory addressed and smoke test rerun.
  • git diff --check: passed.

macOS runtime execution remains for CI; only its environment-isolation wiring was changed locally.

API compatibility

Tests, test infrastructure, and contributor documentation only. No production runtime, wire contract, API major/feature identifier, public Go/TypeScript API, or stored-data changes. No upgrade implications.

jbeda and others added 4 commits October 31, 2026 17:39
Replace the provider timing window with an unresolved Write ask so sequential append and retract controls cannot race a turn-boundary drain. Preserve exact outcome assertions and drain the owned iterator through cancellation.

Refs #2327

Co-authored-by: Mecatl <[email protected]>
Give spawned test daemons test-owned HOME and XDG roots. Resolve Bun under the caller environment before isolation, retaining real Bun callback coverage through a configuration-dependent shim regression. Add poisoned ambient configuration controls to the default spawn smoke test.

Co-authored-by: Mecatl <[email protected]>
Document CI-aligned tool targets, workspace-specific Node versions, and explicit runtime selection without changing personal defaults. Link SDK development instructions to the canonical contributor table.

Co-authored-by: Mecatl <[email protected]>
Create product fixture HOME/XDG roots and startup-failure state under Node's tmpdir so they honor managed TMPDIR leases. Preserve explicit cleanup and assert both temporary placement and removal for direct and runtime-helper fixtures.

Co-authored-by: Mecatl <[email protected]>
@jbeda
jbeda merged commit 2c64407 into main Nov 1, 2026
39 checks passed
@jbeda
jbeda deleted the test/sdk-steer-barrier branch November 1, 2026 01:10
@jbeda jbeda mentioned this pull request Nov 1, 2026
10 of 14 tasks
This was referenced Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant