musicVideoSceneHooks test can leak its temp root past afterAll and fail the suite's temp-leak guard
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- testing
Research direction
Start with server/services/musicVideoSceneHooks.test.js and inspect its afterAll teardown, the event listeners, and the hook writes to music-video-projects.json. Trace how pending writes can be awaited, then run the file under 4 concurrent workers repeatedly and check for leaked mv-scene-hooks-test- entries. Done when 50 consecutive runs and the full server suite's temp-leak guard report no leak, with no assertions loosened.
Written by the indexing model from the issue text.
Description
Problem
server/services/musicVideoSceneHooks.test.js can leave its temp data root behind, and the run-wide temp-leak guard then fails the whole server suite even though every test passed:
⚠️ test temp leak: mv-scene-hooks-test- ×1
❌ test temp leak guard: failing the run with exit code 1 for 1 leaked entry under the run temp root
Evidence: observed once in two full local server runs (CI runner script, PORTOS_PREGATE_MAX_WORKERS=4, loaded machine). It did not recur in the second full run, nor in 7 isolated runs of the file (3 serial, 4 concurrent), so this is a suspected load-sensitive race, not a reproduced cause.
The file creates TEST_DATA_ROOT = mkdtempSync(join(tmpdir(), 'mv-scene-hooks-test-')) at import time and removes it in a single afterAll(() => rmSync(TEST_DATA_ROOT, { recursive: true, force: true })). The test's own comment says a hook "still settling from the previous test can emit after this test's listeners attach" — the same late completion can write the project store (music-video-projects.json, created by the atomic writer with its parent directories) after afterAll has already removed the root, which recreates the directory and leaks it. The earlier flake fix (#11839) addressed the sibling symptom (a take landing late) but not the teardown ordering.
Found while validating #12850; not caused by it (the change only moves log streams).
Decision
- In
afterAll, quiesce before removing: detach themediaJobEvents/musicVideoEventslisteners, then wait for the in-flight hook writes to settle (poll the project store until its mtime/contents stop changing, or expose and await the hook's pending-write promise if one exists), thenrmSync. - Remove the root a second time on a short retry if a late write recreated it, so a straggler cannot survive the file.
- Do not widen the guard or add the prefix to any allowlist.
Acceptance criteria
- 50 consecutive runs of the file under 4 concurrent workers leave no
mv-scene-hooks-test-entry. - The full server suite's temp-leak guard reports nothing for this file.
- No assertion in the file is loosened.
Related to #12850. Dispatch rationale: model:light — a teardown-ordering fix in one test file; effort:medium because the race has to be provoked before the fix can be trusted.
- Dominant language
- JavaScript
- Stars
- 38
- Forks
- 32
- Avg merge
- 36m
- Merged PRs (30d)
- 989
Getting set up
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 atomantic/PortOS
-
bug
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
GitHub inbox: Dependabot and Actions PRs count as outside, and Enterprise accounts cannot trust their own instancePossibly taken @atomantic claimed this today. Openarea:devtools effort:medium enhancement in-progress model:heavy plan
atomantic/PortOS#13203 · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
GitHub inbox: make triage suggestion pills actionable buttonsPossibly taken @atomantic claimed this today. Openarea:devtools effort:medium enhancement model:light plan ux
atomantic/PortOS#13193 · 1 assignee ·
Maintainers usually reply within 1 day
-
GitHub inbox: add an automation rule from any item so similar items are handled on AutopilotPossibly taken @atomantic claimed this today. Openarea:devtools effort:high enhancement model:heavy plan
atomantic/PortOS#13192 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in atomantic/PortOS
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rescript-lang/rescript#8996 ·
Maintainers usually reply within 1 day
-
check:passed logos:add
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
fossasia/visdom-dev#69 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
-
建议写成 1949-Open
Difficulty 1/5 Under an hour Newbie friendliness 62/100
DeanChensj/jiangshan-map#133 ·
Maintainers usually reply within 1 day