Repository navigation
test(inspector): normalize isolated dir tmpdir with underscores for the cancellation fixture - #10456
LexLuthorPrimero wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Low impact] The PR appears safe to merge, with two previously reported, non-blocking fixture concerns still open. FindingsFix with agent prompt### Issue 1
src/inspector/JavaScriptRuntimeScope.cancellation.test.ts:115-117
If `TMPDIR=/home/test_user/tmp` and the developer cannot write to `/home`, this helper changes the base to `/home/test-user/tmp` and fails when creating it. All five tests then fail during setup, leaving the underscore-path fix incomplete. Choose an existing writable, underscore-free base rather than assuming the renamed path is writable.
### Issue 2
src/inspector/JavaScriptRuntimeScope.cancellation.test.ts:undefined-117
The directory created by `mkdir` is never registered for cleanup. `roots` contains only the children created by `mkdtemp`, so tests leave the sanitized base and any newly created parents behind. Track which directories this helper creates and remove only those owned directories after their fixtures are gone.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryChanges the cancellation test fixture to replace underscores in its temporary base path before creating files.
Reviews (2) · Last reviewed commit: "test(inspector): normalize isolated dir ..." · Reviewed by Greptile |
| const sanitized = tmpdir().replace(/_/g, "-"); | ||
| if (sanitized === tmpdir()) return tmpdir(); | ||
| await mkdir(sanitized, { recursive: true }); |
There was a problem hiding this comment.
Renamed parents may be unwritable
If TMPDIR=/home/test_user/tmp and the developer cannot write to /home, this helper changes the base to /home/test-user/tmp and fails when creating it. All five tests then fail during setup, leaving the underscore-path fix incomplete. Choose an existing writable, underscore-free base rather than assuming the renamed path is writable.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/inspector/JavaScriptRuntimeScope.cancellation.test.ts
Line: 115-117
Comment:
**Renamed parents may be unwritable**
If `TMPDIR=/home/test_user/tmp` and the developer cannot write to `/home`, this helper changes the base to `/home/test-user/tmp` and fails when creating it. All five tests then fail during setup, leaving the underscore-path fix incomplete. Choose an existing writable, underscore-free base rather than assuming the renamed path is writable.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| // without underscores rather than changing that intentional behavior. | ||
| const sanitized = tmpdir().replace(/_/g, "-"); | ||
| if (sanitized === tmpdir()) return tmpdir(); | ||
| await mkdir(sanitized, { recursive: true }); |
There was a problem hiding this comment.
Created parents are never removed
The directory created by mkdir is never registered for cleanup. roots contains only the children created by mkdtemp, so tests leave the sanitized base and any newly created parents behind. Track which directories this helper creates and remove only those owned directories after their fixtures are gone.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/inspector/JavaScriptRuntimeScope.cancellation.test.ts
Line: 117
Comment:
**Created parents are never removed**
The directory created by `mkdir` is never registered for cleanup. `roots` contains only the children created by `mkdtemp`, so tests leave the sanitized base and any newly created parents behind. Track which directories this helper creates and remove only those owned directories after their fixtures are gone.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Fixes #9996.
The Inspector cancellation regression test creates its file under
tmpdir(), which inherits the host's TMPDIR (e.g.bad_root). Node's lossy discovery metadata concatenates the pathname and replaces"and\with underscores, so any remaining_on POSIX paths marks the path unresolvable and the location guard intentionally refuses to stat it — the provider then finishes without the abort hook firing, and the test hangs or misses its cancellation assertion.Change and scope
src/inspector/JavaScriptRuntimeScope.cancellation.test.ts— derive the fixture's working base by stripping underscores fromtmpdir()(replace(/_/g, "-")), recreating the directory when the sanitized spelling differs, and use it unchanged otherwise. Behavior unchanged when TMPDIR contains no underscores; deterministic when it does. No production code is changed.Evidence and regression coverage
npm run test:local -- src/inspector/JavaScriptRuntimeScope.cancellation.test.tson a temp root with an underscore (TMPDIR=/tmp/opencode/rea_bad_root) — 5 passed.npm run test:local -- src/inspector/JavaScriptRuntimeScope.cancellation.test.tson the default TMPDIR — 5 passed.npm run typecheck— passed.npm run format:check— passed.npm run lint— passed.Remaining proof gaps
dist-built CLI package ([email protected]) was not re-executed under macOS.JavaScriptRuntimeScope.tsper the issue's explicit guidance.Compatibility, safety, and release
Author readiness
Human owner: @LexLuthorPrimero