Repository navigation
test(inspector): keep the target cancellation fixture path exactly reported - #7056
RishTheFish21 wants to merge 5 commits into
Conversation
Codex Review SummaryThis 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; no actionable issues were found. SummaryThe PR shares a temporary-directory helper across Inspector tests so fixture paths remain exactly reportable on macOS.
Reviews (5) · Last reviewed commit: "ci: rerun on current main" · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 320e072d98
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // usually contain `_`; use a root that Node reports exactly. | ||
| const exactlyReportedRoot = async (): Promise<string> => { | ||
| const temporary = await realpath(tmpdir()); | ||
| return /[_"\\]/u.test(temporary) ? await realpath("/tmp") : temporary; |
There was a problem hiding this comment.
Leave Windows fixtures on the platform temp root
On a native Windows checkout with a normal C:\... temp path, the regex always takes this branch and realpath("/tmp") targets a drive-root tmp directory that generally does not exist, so targetFile() rejects before the test body runs. This is broader than the unsupported Node-target scenario: the four Electron/file-authorization tests later in this file all share targetFile() and previously used the valid result of tmpdir(), so focused Windows runs lose those cancellation, shutdown, and authorization regressions. Gate this fallback to POSIX and handle or skip only the Node-target case on Windows.
AGENTS.md reference: AGENTS.md:L83-L83
Useful? React with 👍 / 👎.
320e072 to
fdb39c2
Compare
|
Thanks for diagnosing the macOS cancellation fixture failure. #4484 addresses the same lossy Node discovery paths in other inspector tests and proposes a shared temporary-directory helper. Could you coordinate on using one fixture owner while keeping this distinct cancellation regression? Both PRs remain open. |
… dirs authorizeRuntimeTargetLocation treats a Node-reported POSIX path containing '_', '"' or '\' as unverifiable, because Node's Inspector discovery metadata replaces quotes and backslashes with underscores. The javascriptRuntimeObservation and javascriptRuntimeTargetLocations fixtures were created under realpath(os.tmpdir()). On macOS that is a per-user directory of the shape /private/var/folders/<x>/<y>/T, where <y> often contains '_', so four tests could never verify their own fixture there; Linux's /tmp has no such characters. createNodeDiscoveryTempDirectory uses the canonical temporary directory when it is free of those characters, otherwise the canonical /tmp, and fails when neither is. Windows keeps createTestTempDirectory. No assertion changes; the product rule that such paths are unverifiable is unchanged and still tested. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolving realpath("/tmp") unconditionally rejects on a POSIX host without
/tmp even when tmpdir() is clean, failing both inspector test files before
they create a fixture. Resolve the primary first and fall back to /tmp only
when it contains '_', '"' or '\'.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main replaced the fixture module's local prefix check with normalizeTestTemporaryPrefix, so the Node discovery helper uses it too and keeps the same owned rea- naming as createTestTempDirectory.
…ported Node discovery reports file paths with quotes, backslashes and underscores replaced by `_`, so on POSIX REA leaves such a target unresolved without a stat. The Inspector target cancellation test built its fixture under tmpdir(), which on macOS is a per-user directory that usually contains `_`. No stat ran, the cancellation never fired, and the test failed on macOS. Build the fixture with createNodeDiscoveryTempDirectory, and skip the Node-target case on Windows, where REA never stats a Node discovery path.
5eca3e5 to
defd961
Compare
|
Thanks. Agreed, there should be a single fixture owner. I’ve reworked this PR to stack on #4484:
Once #4484 merges, this PR reduces to that last commit. If #4484’s author would rather rebase it themselves, I’ll rebase onto their branch instead. The cancellation regression stays separate either way. Validation at defd961 (macOS arm64, Node 24.22.1): npm run test:focused on the cancellation test and both #4484 inspector files passed; check:fast and format:check passed. |
|
Thank you @RishTheFish21! This fix has already landed on |
Summary
src/inspector/JavaScriptRuntimeScope.cancellation.test.ts› "stops Inspector target authorization after the current stat settles" fails on every macOS run ofnpm run test:fast.Node's Inspector discovery reports a target's file path lossily: quotes, backslashes and underscores all come back as
_. SoauthorizeRuntimeTargetLocationonly stats a reported path that contains none of them, and otherwise records the target asunresolved(unverifiable-file-location) without touching the filesystem. The test builds its fixture undertmpdir(). On macOS that's a per-user directory like/var/folders/w3/_ypt96s55rl6vspl_7d6yjnw0000gn/T/, which contains underscores. Neither target is stat'ed, so the abort the test schedules on the second stat never fires, andlistTargetssucceeds.The fix builds the fixture under a root that Node reports exactly:
tmpdir()when it has none of those characters (Linux, unchanged), otherwise/tmp(/private/tmpon macOS).No issue is linked. I found this running
npm run test:faston macOS.Problem and expected behavior
Before, on macOS arm64 at main
MAIN_SHA:Expected: the test exercises what it names, on any POSIX host. The second target's stat settles, the abort lands, and the result is an
AnalysisCancelledErrorcarrying the one-target partial inventory.Change and scope
JavaScriptRuntimeScope.tsis intentional (seetests/boundary/inspector/javascriptRuntimeTargetLocations.test.ts), and so is the rest of the product code.Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope).
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
src/inspector/JavaScriptRuntimeScope.cancellation.test.ts. No product stage changes.rea-prefix and removed inafterEach.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): None.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/inspector/JavaScriptRuntimeScope.cancellation.test.ts(fixture root only).npm run test:faston macOS arm64. The cause follows fromauthorizeRuntimeTargetLocation, which checks/[_"\\]/ubefore stating a reported Node path, and from the macOStmpdir()shown above.tmpdir()normally has no underscores, so the fixture root is unchanged there.For evidence-bearing changes:
Validation performed
macOS arm64, Node 24.22.1:
npm run test:focused -- src/inspector/JavaScriptRuntimeScope.cancellation.test.tson main: RESULT_BEFOREnpm run check:fast: RESULTnpm run format:check: RESULTCompatibility, safety, and release
Author readiness
Human owner: @RishTheFish21
Before merge
type(scope): outcome.