jobizzness / jobizzness/bench

Four test files hard-code a shared /tmp path as the daemon home

Open
#71 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
1h 21m
Merged PRs (30d)
41

Description

## Evidence

Found while reviewing #65, which fixed a different cause of the same class of flake. These pass a fixed, shared path as the daemon's `home` instead of a per-run `mkdtemp`:

```
tests/server.test.ts:171 home: "/tmp/bench"
tests/shutdown.test.ts:36 home: "/tmp/bench"
tests/remote-routes.test.ts:88 home: "/tmp/bench-remote-routes"
tests/remote-routes.test.ts:193 home: "/tmp/bench-bare"
tests/broadcast-route.test.ts:61 home: "/tmp/bench-broadcast-route"
```

Every other test in the suite uses `await mkdtemp(join(tmpdir(), "bench-home-"))`.

**This is latent, not active.** All five sites construct a server around a stub registry that never writes to that path, so nothing collides today and #65's flake was not caused by them — that one was a timing race, not shared directory state. Two `pnpm test` runs at once currently pass.

It is filed because the trap is one line away: the moment any of those tests exercises a code path that actually writes under `home`, two concurrent runs share a directory and produce exactly the intermittent failure #65 spent a ticket diagnosing. `/tmp/bench` in particular is a name a human might also create by hand.

## Acceptance criteria

- [ ] None of the five sites above passes a hard-coded path as `home`; each gets a directory unique to its run
- [ ] Each of the four files still passes in isolation and in a full run
- [ ] Two concurrent `pnpm test` runs both pass, still
- [ ] `pnpm typecheck` and `pnpm test` clean against the #50 baseline of 4 known failures

## Out of scope

- The `/tmp/plugin` and `/tmp` values passed as `pluginDir` and `projectsRoot` at the same sites. Those are read-only stand-ins, not directories anything writes to — leave them.
- Changing what any of these tests asserts. This is a fixture change only.
- The #50 four.

## Verification

```
pnpm typecheck
pnpm test
pnpm test & pnpm test; wait # both runs must pass
```

## Related

- #65 (the timing race, fixed and merged at `f6cd2ec`; this was found in its review)
- #50 (the 4-failure baseline)

Contributor guide

Open the contributing guide

Research direction

Start with the five hard-coded home sites in tests/server.test.ts, tests/shutdown.test.ts, tests/remote-routes.test.ts, and tests/broadcast-route.test.ts, comparing them with the suite's existing mkdtemp pattern. Run each affected test in isolation, then pnpm typecheck, pnpm test, and two concurrent pnpm test runs; done means the checks pass against the documented four-failure baseline without changing assertions or pluginDir/projectsRoot.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.