Skip to content

test: in-flight observation drain test races the 100 ms takeover poll #423

Closed

Description

@ElbertePlinio

test/security/security-takeover-observations.test.ts > "drains an in-flight cli window observation before granting control" failed once in CI on PR #418 (run 40778033723):

AssertionError: expected true to be false

The test publishes a human lease while a desktop wait sample holds its agent permit, sleeps 40 ms, and expects the lease to be still waiting. But stopOnTakeover in packages/desktop-linux/src/wait.ts polls for a lease every 100 ms (TAKEOVER_POLL_MS) and then cancels the sample on purpose, so its permit drains. When a poll lands in the 40 ms window and the fake xdotool exits fast, the lease is granted before the check. That is the designed behavior, so the assertion races the poll.

The same file passed 6 times in a row locally (48 cases). #418 does not change desktop wait or the lease drain.

  • Assert that the lease waits for the permit to drain without a fixed 40 ms window, for example by holding the sample until the test releases it, or by checking that the grant happens only after the sample ended
  • Keep all eight transport and kind cases
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