Flaky: daemon-update-status.test.js 'temp names differ every write' fails when the pid's digits appear in the random temp name
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, node.js
- Domain
- testing
Research direction
The assertion is at packages/server/tests/daemon-update-status.test.js:444 in 'temp names differ every write'; read it beside writeFileAtomic in src/utils/small-file.js to see what the name looks like. Replace the p.includes(String(process.pid)) check with a basename match: x.json.tmp- plus exactly sixteen hex characters, the two names differ, and neither is the old predictable name. Run node --test --test-name-pattern 'temp names differ every write' packages/server/tests/daemon-update-status.test.js; done when it passes and still fails after reverting writeFileAtomic to a fixed name.
Written by the indexing model from the issue text.
Description
Context
Filed from: #9273
Seen in CI on PR #9273, whose diff touches only packages/server/tests/freshness/ and cannot reach this file.
Symptom
Server Windows Tests failed once with a single failing test out of 15,915:
# Subtest: temp names differ every write
not ok 3 - temp names differ every write
location: '...\\packages\\server\\tests\\daemon-update-status.test.js:428:3'
error: 'no pid in the name'
code: 'ERR_ASSERTION'
expected: true
actual: false
not ok 985 - writes use unpredictable temp names (#8331)
Failing job. Every other check on that head passed, including Server Tests on Linux. The same check passed on main before and after, and on the three earlier pull requests that touched the same directory.
Cause
Read from the code; the log does not print the process id or the temp names, so the exact collision was not observed.
tests/daemon-update-status.test.js:444 asserts on the whole path:
assert.ok(seen.every((p) => !p.includes(String(process.pid))), 'no pid in the name')
Each path is <tmpdir>/chroxy-update-status-XXXXXX/x.json.tmp-<16 hex characters>: six random characters from mkdtempSync and sixteen from randomBytes(8).toString('hex') in src/utils/small-file.js (writeFileAtomic). The assertion fails whenever the digits of the process id happen to appear anywhere in those random characters, or in the temp directory's own path. writeFileAtomic does not put the process id in the name, so the failure says nothing about the code under test.
How often depends on the length of the process id. A quick simulation of the random part alone gives about 0.5% of runs for a three-digit id, 0.04% for four digits and 0.003% for five. The check runs on every pull request on Linux and on Windows.
What to change
Assert on the shape of the name instead of searching the path for digits. For example: the basename matches x.json.tmp- followed by exactly sixteen hex characters, the two names differ, and neither equals the old predictable name this test was written to rule out. That keeps the intent (no predictable temp name) without depending on which digits the random bytes produce.
Acceptance Criteria
-
temp names differ every writecannot fail because of the process id's digits appearing in a random suffix or in the temp directory path - The test still fails if
writeFileAtomicgoes back to a predictable temp name (shown once by reverting the helper locally) -
Server TestsandServer Windows Testspass
- Dominant language
- JavaScript
- Stars
- 7
- Forks
- 1
- Avg merge
- 2h 19m
- Merged PRs (30d)
- 263
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from blamechris/chroxy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
blamechris/chroxy#9272 ·
Maintainers usually reply within 1 day
-
complexity: low dashboard enhancement from-review
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
blamechris/chroxy#9271 ·
Maintainers usually reply within 1 day
-
bug server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blamechris/chroxy#9248 ·
Maintainers usually reply within 1 day
-
documentation from-review
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
blamechris/chroxy#9237 ·
Maintainers usually reply within 1 day
-
enhancement from-review
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
blamechris/chroxy#9232 ·
Maintainers usually reply within 1 day
All issues in blamechris/chroxy
Similar issues
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/playwright#44289 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Ionaru/easy-markdown-editor#657 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
TMHSDigital/Free-Game-Dev-Assets#320 ·
Maintainers usually reply within 1 day
-
area:webapp bug finding
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Long working directory path draws over the Console pane's buttons when the Console has no other tabsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day