Skip to content

test: windows fixture can read an empty state.json after a timed-out focus #399

Closed

Description

@ElbertePlinio

Problem

packages/mcp-server/test/desktop-windows.test.ts > "records timeout and human-control failures without permitting mutation during takeover" can fail with SyntaxError: Unexpected end of JSON input at packages/desktop-linux/test/windows-fixture.ts:44.

The fixture keeps fake window state in state.json. The fake xdotool windowfocus and the test's state() helper both rewrite it with fs.writeFileSync, which truncates the file before it writes. The test runs desktop_focus with timeoutMs: 150. On a slow runner the fake can be killed between truncate and write, or still be writing, so the next read sees an empty file.

Seen in the release workflow dry run for 0.7.1 (run 40741753333, Lab gates). The same code passed on the v0.7.0 tag run.

Acceptance criteria

  • Writers of the fixture state replace the file atomically, so a reader never sees a partial or empty file.
  • The test passes repeatedly.

Checklist

  • Write the state through a temp file and rename in the fake and the helper
  • Run the test file repeatedly

Activity

  1. added a commit that references this issue on Oct 28, 2026
    c85cf42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions