Repository navigation
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge, with no actionable findings from this re-review. SummaryThe PR resolves symlinks through the filesystem before recording their targets.
The current tree matches the previously reviewed tree. No previous finding threads were supplied, and no new actionable issues or repository-rule violations were found. The security check found no new issue; target lookup reads metadata, not target contents. Tests were not run during this review. Supersession could not be checked because GitHub access was unavailable. Reviews (10) · Last reviewed commit: "ci: recheck transient JavaScript recover..." · Reviewed by Greptile |
rahul05ranjan
left a comment
There was a problem hiding this comment.
Reviewed this against the PR head (single-file run of tests/boundary/filesystem/referenceSourceImport.test.ts: 19/19 pass, including the new link-target regression).
The ordering fix in resolveRoot is the right one, and the reasoning in the comment holds: stat(requestedRoot) already let the kernel resolve symlink parents, so the old resolve() before realpath() meant the directory check and the canonicalization could disagree about which tree was selected. With current -> actual/nested, current/../source stat'd the selected tree but imported the decoy. Passing the selected path straight to realpath makes both agree, and the new CLI case covering absolute, relative, and canonical spellings pins that down.
Same story in readSymlinkTarget: realpath(absolute) on the observed link instead of pre-normalizing the target is the correct order, since the lexical form of outward/../private.js or ../outside/back/actual/target.js names either the wrong file or the wrong side of the root boundary. Resolving the link itself classifies by actual destination, and since only metadata is resolved, the no-follow content guarantee holds (the OUTSIDE_NOT_READ assertion confirms it).
The unknown fallback is well-reasoned — once resolution fails you genuinely can't collapse .. or trailing-separator intent without risking naming a different file, and keeping the raw readlink spelling plus the errno in a limitation is the honest representation. I checked that the graph schema already had the target: null / target_state: "unknown" variant, so no schema change was needed, and the cross-field symlink validation skips null-target entries, so nothing else needed updating.
Two smaller things:
-
A broken link whose raw target points lexically outside the root (e.g.
../outside/absent.js) now recordsmissingwith a link-relative target where it previously recordedexternalwith an absolute path. The PR description calls this out, and it's defensible (an unresolved chain could loop back through a symlink, so a lexical external was always a guess), but any consumer that usedexternalto decide "this link leaves the root" now has to re-derive containment formissingentries from the link-relative spelling. Worth keeping in mind if anything downstream keys off that distinction. -
Spellings that fail realpath but are unambiguous, like
./absent.js, now degrade tounknown(normalize("./absent.js") !== "./absent.js" trips the guard) even though their intent —absent.jsnext to the link — is clear. Links written as./xdo occur in the wild. Emitting the normalized form with the raw spelling in a limitation would be an alternative if you ever see this in practice; not worth blocking on.
Minor: on POSIX the nativeTarget.endsWith(sep) check is redundant since normalize() already strips trailing separators and the inequality fires first — harmless given sep differs elsewhere, just noting it.
|
TL;DR: The fix works on Linux. On current main, the 2 new tests fail and the 19 older ones pass. With this PR applied, all 21 pass. Edit: I retested this PR on its new head, 9d81b1e, and posted the results here. Both fixes still hold on Node 22, 24 and 26, but GitHub now reports a merge conflict with main. ResultsThis PR is still open. Its head is 08e16bd. I ran the two test files named in the PR on current main (c7f6b8b), before and after applying the PR's diff.
The CLI case is Node 24.18.0 was used for both runs. Each run took about 4 seconds. Not run
The PR branched from 0f62373, and main has since moved. The diff still applied cleanly. One source file, No test in these two files makes a network call. Both build their folders and links in temporary directories. The setup step Thanks, shoyann, for the clear tests. CommandsExit codes: before 1 (2 failed, 19 passed), after 0 (21 passed). Test setup🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
…tibility Sync main to include native process-exit ownership fixes. Validate symlink targets with stat before realpath so macOS does not turn invalid directory components into internal-file observations. Keep the existing graph assertions and use native lookup as the failure oracle. Encode the Flutter ABI slash as a hex escape so advertised patterns remain valid in Unicode-set mode and survive lint --fix. Validated on macOS x64 with Node 24.18.0 / npm 11.16.0: 32 focused files, 170 passed and 2 existing skips; npm run check; npm run docs:check. Local provider/setup checks are limited by the installed Swift compiler/SDK mismatch.
|
Hey @morluto, could you take a look at this one when you get a chance? The bug still appears to be present on main. Happy to make any changes if needed. Thanks! |
|
TL;DR: At head 9d81b1e, both of my 15 Oct findings are still fixed on Node 22, 24 and 26. The 2 new tests fail on main and pass with this PR's changes. My main runs used a Node below main's new minimum, with npm's engine check off. But GitHub now says this PR conflicts with main, because a new main commit rewrites the same function. I tested head 9d81b1e as pushed (committed 23 Oct, 03:43 UTC). My last result was at 08e16bd6. Seven commits came after it. The only source change since then is one new call, Results
The two failing tests on main are the same two as on 15 Oct. On 15 Oct the two files held 21 tests; now they hold 28 (26 older ones plus the 2 new ones). I did not trace where the 7 extra older tests came from. The 2 skipped tests are Windows-only cases in
The merge conflictGitHub reports The Node problemMain now requires Node Comments since 15 OctOne comment came after mine: shoyann asking morluto to take a look. It does not ask me anything. There are no inline review threads on this PR. Greptile's summary comment gives 5/5 and no actionable issues. CI on 9d81b1e shows success for all 8 test shards, Source tests, Portable tests and Static checks. I read that from GitHub and did not run it. Not run
Thanks, shoyann, for the clear tests. CommandsExit codes: main before 1 on all three Nodes (2 failed, 26 passed). Main after 0. PR head 0, for both groups. The 30 other files: Test setup
Other test jobs may have run on this box. These are pass and fail results, so timing does not matter. 🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
Bring in the upstream Apple metadata error-contract tests (morluto#6945) and Webpack factory fixture correction (morluto#6951). Preserve the five-file physical symlink target fix relative to main.
Keep the tested tree unchanged. The first synchronized CI run encountered the same intermittent parent-result budget failure documented upstream in morluto#7029 and morluto#5672; main 1173c0a passes its selected CI. Repeat the existing checks once without changing runtime limits, fixture size, deadlines, or assertions.
Closed: core fix superseded upstream
Closing this PR without merging after verifying upstream main
a2e2c29b59e8775b0e6aedb09a9eb16adf32646bon 2026-10-27.The core physical symlink target fixes are now implemented upstream in 09acf217: preserve native path traversal, validate it with
statbeforerealpath, classify containment from the actual destination, and retain unresolved path spelling. The earlier selected-root issue was already fixed in 5e8f8b31.Supersession verification
Executed on macOS x64 with Node 24.22.1 / npm 11.16.0, using an isolated checkout of that upstream commit with no production changes:
unknown/nullexpectation. This is recorded as a failed run, not an unchanged-test pass.missingwith their uncollapsed absolute spelling. A separate contract-aligned replay verified those exact paths, confirmed that nativestatrejects both the links and returned paths, and checked partial inventory and schema validity. Every other original assertion remained: correct internal/external targets, external paths returning inside the root, ordinary and backslash-containing missing paths, the exact file inventory, and no outside-file contents.The core user-visible bug is therefore covered upstream. This does not claim the two implementations are identical in every representation choice. Linux, Windows, and the complete suite were not rerun for this closure; no new implementation was pushed.
Earlier proposal and validation, retained for history
Summary
Resolve imported symlinks through the filesystem before recording their target. With
current -> actual/nested, a link tocurrent/../target.jspoints toactual/target.js; main currently records the unrelatedtarget.js. The same premature normalization can misclassify targets as internal/external or make an invalid path appear valid.The reader validates native lookup with
stat, then resolves the observed link itself. Ordinary missing targets retain their spelling; paths whose intent cannot be preserved in a normalized identity remainunknownwith the original target and error code. Resolution reads metadata, not target contents. Existing identity checks, cleanup, and upstream raw-byte/UTF-8/BOM handling are retained.The diff against main is limited to five symlink implementation/test files. The selected-root fix is already upstream in 5e8f8b3. The race fixture timestamp adjustment makes directory replacement observable on coarse filesystems. No public schema or CLI/MCP option changes.
CI repair
Synced main
1173c0a9dc1b352a60943a491462294db8f353aeto include two upstream corrections for the previous CI failures:AnalysisArtifactChangedErrorcontract.No new production changes or weakened assertions were added for these failures.
Validation
Current head:
1a1955244869cfefdfde810a6b34013320163d5b(same tested tree asd43268de). Local macOS x64, Node 24.22.1, npm 11.16.0:Runtime build passed. 232 tests passed, 2 platform skips across 16 focused files (15 passed files, one platform-skipped file): reference reader/import/graph, filesystem imports and failures, symlink races, compiled CLI directory and UTF-8 cases, Apple metadata and real MCP bound-target recovery, and JavaScript factory export/index analysis.
npm run check,npm run check:fast, and diff whitespace checks passed. The normal pre-commit hook passed; its unrelated upstream import cleanups were excluded. The published tree exactly matches the focused-test and full-check tree.Independent review found no actionable integration issue in the retained five-file diff.
The complete
applicationWorkflowCli.test.tsrun could not finish locally because the host Swift SDK/compiler reports a duplicateSwiftBridgingmodule when compiling the process helper. This was reproduced with a direct compiler invocation; the affected run was stopped and the remaining 16 files were rerun successfully. Hosted Linux CI subsequently passed that complete CLI regression.Native Windows and the complete deterministic suite were not run locally.
The first synchronized CI run passed 18,921 source tests, static/build/native package checks, then failed one MCP recovery assertion in
javascriptAnalysisResources.test.ts:parent_result_budget_bytes: 0after retaining the oversized timeout observation. Other shards were cancelled by fail-fast. This is the intermittent parent-capacity failure also documented in test(mcp): verify recovery before reading retained views #7029 and fix(artifacts): handle ASAR cancellation before output consumption #5672; the same main1173c0a9has a successful selected CI run. The current empty verification commit triggers one controlled repeat with identical code, limits, fixtures, and assertions. The identical-tree repeat passed; this does not establish that the upstream flake is fixed.Final CI run 40257362462 passed on exact head
1a1955244869cfefdfde810a6b34013320163d5b: 33,855 tests passed, zero failed, 237 skipped, all eight built-test shards, source/static/build/native package checks,Portable tests, andCI requiredsucceeded. The Apple error-contract tests, complete application CLI suite (including the Webpack factory case), and the previously intermittent MCP timeout/recovery case passed. Runtime limits, deadlines, fixture sizes, and assertions remain unchanged.Author readiness
Human owner: @shoyann