Repository navigation
test: fix cross-platform unit failures - #41075
Merged
Merged
Conversation
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
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.
What
Fixes the two unrelated unit failures exposed by GitHub Actions run 31186266648 after #40922 merged:
Before / After
Before: TUI fixtures destroyed the renderer and removed temporary directories without a reliable persistence drain. A queued write could observe no lock during cleanup, then enter
Flock.withLockafter the lock parent was gone, producingENOENT. The cwd-scope test also asserted the absence of independently hydrated title metadata, so network/write scheduling could add a title and fail the exact object comparison.After: storage tracks every accepted write and exposes a drain that waits for all writes and reports failures. TUI fixtures destroy the renderer, flush storage, and only then dispose their temporary directory. The cwd test asserts its actual contract: one cwd-scoped session tab, regardless of optional hydrated title metadata.
Before: Windows returned
two\r\nthreefrom the line-limit command while the assertion requiredtwo\nthree.After: the assertion normalizes CRLF before checking which lines survived truncation; production shell output remains unchanged.
How
packages/tui/src/context/storage.tsxtracks pending writes and addsStorage.flush().packages/tui/test/context/session-tabs.test.tsxandpackages/tui/test/cli/tui/dialog-open.test.tsxawait the drain before disposing shared async temp fixtures.packages/core/test/tool-shell.test.tsnormalizes line endings only in the line-limit assertion.The complete failed logs for both attempts of run 31186266648 showed no additional failing root cause. Other error/warning output was emitted by passing negative-path tests.
Scope
No production shell-output normalization and no changes to file-lock retry semantics. Retrying the missing lock parent would recreate state after fixture teardown and hide the lifecycle race.
Testing
bun run test test/tool-shell.test.tsfrompackages/core: 19 passbun typecheckfrompackages/core: passbun run testfrompackages/tui: 600 pass, 5 skipbun run test --rerun-each 20 test/context/session-tabs.test.tsx test/cli/tui/dialog-open.test.tsxfrompackages/tui: 160 pass with no persistence errorsbun typecheckfrompackages/tui: passbun turbo typecheck --concurrency=3: 32 packages passoxlint: 0 errors; only pre-existing warningsA full local core suite run reached 1573 passing tests but was not clean because
LocationServiceMap > keeps flush open while later hot reload runstimed out andPluginSupervisor config > logs invalid packages and continues loadingread two plugins from the user's global config. The changed ShellTool test passes independently.