Adapt fork tests + run.ts to 1.17.14 APIs

Merged
KE
3mo ago
+124-139

Small adaptations of fork-owned code and tests to APIs that changed upstream between 1.17.9 and 1.17.14. Stacked on #16 (merge of upstream v1.17.14); auto-retargets to dev when #16 lands. 7 files, +34/āˆ’47.

  • Tests → LayerNode composition: upstream replaced per-module defaultLayer/layer exports with the LayerNode graph; fork tests now compose via LayerNode.compile/group + AppNodeBuilder.build, mirroring upstream siblings (skill.test.ts, plugin/trigger.test.ts). Grouping [X.node, Config.node] in one compile preserves the shared-Config-singleton semantics the reload tests assert.
  • refresh-headers test rebuilt mock-free: bun's mock.module is process-global and permanent, so mocking the MCP SDK here leaked fake transports into 26 other MCP tests in the shared suite process (the first CI run's failures). Now uses the same real streamable-HTTP server harness as headers.test.ts and asserts the rotated Authorization lands on the wire over the SAME transport — a stronger check than the old mock-object inspection. The harness-reload MCP stub separately gains the new instructions/resourceTemplates interface members.
  • run.ts: upstream's new CLI call site used Filesystem.stat, which our REPL-28760 event-loop patch renamed to statSync; adapted (one-shot CLI arg-validation path, sync is fine).

Testing Done

Tip tree is byte-identical to the branch that ran the full verification suite (see #16): typecheck + 176 targeted tests green under pinned bun 1.3.14, release build verified, production-sandbox soak + A/B.

šŸ¤– Generated with Claude Code


Summary by cubic

Adapted tests and CLI to upstream 1.17.14 APIs. Reload tests now use LayerNode + AppNodeBuilder with a shared Config, and the MCP refresh-headers test uses a real @modelcontextprotocol/sdk server to prove on-wire header rotation without reconnects.

  • Refactors

    • Migrated reload tests to LayerNode.compile/group + AppNodeBuilder.build (group [X.node, Config.node]) to mirror upstream and preserve the shared Config singleton across plugin/skill/instance-store/harness tests.
    • Rewrote packages/opencode/test/mcp/refresh-headers.test.ts to use a real @modelcontextprotocol/sdk Server + WebStandardStreamableHTTPServerTransport, capture request headers, assert rotated Authorization on the same transport, and confirm no eager MCP connection when unused.
    • Updated harness MCP stubs to include instructions and resourceTemplates.
  • Bug Fixes

    • Replaced Filesystem.stat with Filesystem.statSync in packages/opencode/src/cli/cmd/run.ts for one-shot CLI validation.
    • Dropped process-global MCP SDK mocks from refresh-headers to prevent leakage into other tests.
    • Increased time budget in packages/opencode/test/cli/run/run-process.test.ts for the unknown-model fast-fail guard to reduce CI flakiness (timeout 30s, harness 60s).