Skip to content

test: fix cross-platform unit failures - #41075

Merged
kitlangton merged 2 commits into
v2from
shell-test-crlf
Aug 7, 2026
Merged

kitlangton merged 2 commits into
v2from
shell-test-crlf

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes the two unrelated unit failures exposed by GitHub Actions run 31186266648 after #40922 merged:

  • TUI session-tab tests could delete temporary state while accepted persistence writes were still waiting to acquire their file lock.
  • The core ShellTool line-limit assertion assumed LF even when the Windows shell emitted CRLF.

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.withLock after the lock parent was gone, producing ENOENT. 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\nthree from the line-limit command while the assertion required two\nthree.

After: the assertion normalizes CRLF before checking which lines survived truncation; production shell output remains unchanged.

How

  • packages/tui/src/context/storage.tsx tracks pending writes and adds Storage.flush().
  • packages/tui/test/context/session-tabs.test.tsx and packages/tui/test/cli/tui/dialog-open.test.tsx await the drain before disposing shared async temp fixtures.
  • packages/core/test/tool-shell.test.ts normalizes 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.ts from packages/core: 19 pass
  • bun typecheck from packages/core: pass
  • bun run test from packages/tui: 600 pass, 5 skip
  • bun run test --rerun-each 20 test/context/session-tabs.test.tsx test/cli/tui/dialog-open.test.tsx from packages/tui: 160 pass with no persistence errors
  • bun typecheck from packages/tui: pass
  • pre-push bun turbo typecheck --concurrency=3: 32 packages pass
  • targeted oxlint: 0 errors; only pre-existing warnings

A full local core suite run reached 1573 passing tests but was not clean because LocationServiceMap > keeps flush open while later hot reload runs timed out and PluginSupervisor config > logs invalid packages and continues loading read two plugins from the user's global config. The changed ShellTool test passes independently.

@kitlangton kitlangton changed the title test(core): tolerate CRLF in shell line limit assertion test: fix cross-platform unit failures Aug 7, 2026
@kitlangton
kitlangton merged commit e6d2044 into v2 Aug 7, 2026
12 of 14 checks passed
@kitlangton
kitlangton deleted the shell-test-crlf branch August 7, 2026 14:53
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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