Skip to content

fix(e2e): stop the shared profiles lock from killing tests - #393

Merged
jancurn merged 1 commit into
mainfrom
claude/peaceful-rubin-3zic0s
Sep 10, 2026
Merged

fix(e2e): stop the shared profiles lock from killing tests#393
jancurn merged 1 commit into
mainfrom
claude/peaceful-rubin-3zic0s

Conversation

@jancurn

@jancurn jancurn commented Sep 10, 2026

Copy link
Copy Markdown
Member

The E2E tests (Linux, Bun 1.4.x) job failed the 0.6.0 release run (run 34470529171) with basic/auth-errors dying on rm: cannot remove '.../profiles.lock': Is a directory, which gated the publish step. The mkdir lock that serialises profiles.json writes across tests sharing a home directory was released twice per acquisition — a trap ... RETURN also fires when the calling function returns — and released with rm -rf, which walks the path and fails with exactly that error when raced against another test's mkdir (reproducible on coreutils 9.4; under set -e it aborts the test). Bun 1.4 only shifted the timing.

  • Release the lock exactly once, explicitly, with rmdir instead of a RETURN trap and rm -rf.
  • Record write failures instead of aborting mid-critical-section, so the lock is never leaked.
  • Extract the duplicated profiles heredoc into _write_test_auth_profile.
  • Make run.sh's end-of-run cleanup best-effort so a stray bridge can't turn a green run red.

Verified with the full suite under Bun (--parallel 8, shared home): the only failure left is basic/remote-open, which needs outbound access to mcp.apify.com and fails the same way on main. An rm shim confirms zero rm calls against the lock, down from 2–6 per test.

🤖 Generated with Claude Code

https://claude.ai/code/session_019kKuHZzZddAKVu2MB5YoK2

The `E2E tests (Linux, Bun 1.4.x)` job failed the 0.6.0 release run with
`basic/auth-errors` dying 717ms in:

    rm: cannot remove '/tmp/mcpc-e2e-.../profiles.lock': Is a directory

Tests sharing a home directory serialise their profiles.json writes on a
mkdir lock directory, and the release side of that lock was broken twice
over:

- It released through a `trap ... RETURN`, which also fires when the
  *calling* function returns, so every acquisition released twice — the
  second removal deleting a lock another test already held.
- It released with `rm -rf`, which walks the path. Raced against another
  test's mkdir of the same lock, GNU rm reports "Is a directory" and
  exits 1, and under the framework's `set -e` that aborts the test.

Release exactly once with rmdir instead, record write failures rather
than aborting mid-critical-section (so the lock is never leaked), and
make run.sh's end-of-run cleanup best-effort so a stray bridge cannot
turn a green run red.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kKuHZzZddAKVu2MB5YoK2
@jancurn jancurn changed the title Fix race conditions in test auth profile locking fix(e2e): stop the shared profiles lock from killing tests Sep 10, 2026
@jancurn
jancurn merged commit ab880f9 into main Sep 10, 2026
8 checks passed
@jancurn
jancurn deleted the claude/peaceful-rubin-3zic0s branch September 10, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants