fix(test): update TerminalView write assertions and harden opencode serve port#388
Merged
danshapiro merged 1 commit intoJun 4, 2026
Merged
Conversation
…erve port The backpressure fix (dd12912) made TerminalView always pass a completeRenderedFrame callback as the second argument to term.write(). It updated lifecycle.test.tsx but missed the osc52 and renderer tests, which still asserted write() was called with `undefined`. Switch them to the established write.mock.calls.some(...) idiom that verifies the written data without pinning the now-present callback argument. The opencode real-provider contract test hardcoded serve port 46123. A leaked orphan `opencode serve` holding that port let the `--attach` run silently connect to the stranger (different XDG_DATA_HOME -> wrong DB), so the session never landed in the watched DB and the test timed out. Allocate a free ephemeral port via allocateLocalhostPort() and fail fast on serve startup errors through a new startOpencodeServe harness helper that mirrors startCodexAppServer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
glowforgedan
approved these changes
Jun 4, 2026
Contributor
glowforgedan
left a comment
There was a problem hiding this comment.
Test-only fixes verified green (full coordinated suite + typecheck). Stale write() assertions updated to match the backpressure callback change; opencode contract test moved off the hardcoded port to a free ephemeral port with fast-fail. LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two test-only fixes that bring the suite back to green.
1. TerminalView stale
write()assertions (3 assertions)The backpressure fix (
dd12912b) madeTerminalViewalways pass acompleteRenderedFramecallback as the second argument toterm.write(). That commit updatedlifecycle.test.tsxbut missedTerminalView.osc52.test.tsx(×2) andTerminalView.renderer.test.tsx(×1), which still assertedwrite()was called withundefined. Switched them to the establishedwrite.mock.calls.some((call) => call[0] === '…')idiom that verifies the written data without pinning the now-present callback argument.2. OpenCode real-provider contract test hardcoded serve port
coding-cli-session-contract.test.tshardcodedserve port 46123. A leaked orphanopencode serveholding that port let the--attachrun silently connect to the stranger (differentXDG_DATA_HOME→ wrong DB), so the session never landed in the watched DB and the test timed out.Fix: allocate a free ephemeral port via
allocateLocalhostPort()and fail fast on serve startup errors, through a newstartOpencodeServeharness helper that mirrors the existingstartCodexAppServerpattern.Test plan
npm test):full-suite success exit=0.npm run typecheck(client + server): clean.🤖 Generated with Claude Code