test(build-context): skip symlink cases where the platform refuses symlinks - #501
Conversation
…mlinks The symlink rejection tests create their fixture with Path.symlink_to and let any OSError escape. On a platform that refuses symlink creation the error is raised during setup, so the test errors instead of reporting that the case could not run. Every other module that builds symlink fixtures already guards the creation call, and this file itself guards the dangling-symlink case the same way. Apply that guard to the five cases that were missed. Signed-off-by: kevin9327 <[email protected]>
|
Verified on Windows 11 without the symlink-creation privilege, which is the configuration this guards.
The five it resolves are exactly the ones that cannot run here: All five fail on They become One thing to discount if you see it. The remaining 8 failures are unrelated to this change and reproduce identically on |
…VIDIA#524 Raise reviewed_pr_through to 527 and reviewed_issue_through to 524 in tools/upstream_baseline.json (commit axis unchanged at 69dcdfb). Every item gets a verdict in docs/DECISIONS.md: NVIDIA#493/NVIDIA#507/NVIDIA#508/NVIDIA#511 verified via git merge-base --is-ancestor as already included through the 2.11.1/2.11.2 sync (including NVIDIA#521, which merged only into the still- open NVIDIA#516 stack, not main); the remaining 27 items stay "wait for upstream merge", none adopted now. Two items get dedicated comparison notes per docs/DIVERGENCE.md's static_runner.py and scripts/compare_scan_accuracy.py rows: NVIDIA#522 uses a different env var name and different default/semantics than this fork's SKILLSPECTOR_MAX_STATIC_SECONDS, so merging it cannot simply delete the divergence row and needs a downstream env var migration first; NVIDIA#490 extends this fork's own upstream PR NVIDIA#486 with a Python 3.14/POSIX edge case the fork's Windows environment does not hit, so NVIDIA#486 is left untouched pending upstream's own resolution. NVIDIA#501-NVIDIA#505 and NVIDIA#518 are also flagged as near-verbatim matches to this fork's existing Windows test divergence rows, worth revisiting for row deletion once merged. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: SanHsien <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Approved at head f7c24183bc34266defb20af8f2833edaec654251.
The tests now skip only when the platform actually refuses symlink creation, while continuing to exercise all original assertions when symlinks are available. The same-directory probe avoids cross-volume privilege differences, and required CI is green.
Merge gate: the PR is mergeable but BEHIND; update it to the protected branch's required head state before merging.
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Re-reviewed current head c9811c218e94a896e9096259c2c36869df8258c1 after the later main synchronizations. The sole PR-owned test blob is unchanged. Each guard remains scoped to fixture symlink creation, while all original security assertions still execute on platforms that support symlinks; the swap test retains its same-directory capability probe. I found no required change.
Merge gate: test-unit is still running on this head and GitHub reports mergeStateStatus=BLOCKED; wait for required checks to pass before merging.
Problem
Five symlink-rejection cases in
tests/nodes/test_build_context.pybuild their fixture withPath.symlink_toand let anyOSErrorescape:Creating a symlink is a privileged operation on Windows unless Developer Mode is on or the
process holds
SeCreateSymbolicLinkPrivilege. Where it is refused, the error is raised duringfixture setup, so the case reports as a failure rather than as a case that could not run. The
assertions it exists to make — that a symlinked component never reaches
components, neverreaches
file_cache, and never leaks its target's content — are never evaluated, and thefailure looks identical to a real regression in that rejection logic.
This is a gap against a guard the suite already applies everywhere else. Every other module
that builds a symlink fixture wraps the creation call:
tests/nodes/test_build_context.pyapplies the same guard to its dangling-symlink case(
test_build_context_excludes_dangling_symlink_from_scan_scope) and omits it from the otherfive.
Fix
Wrap the five unguarded
symlink_tocalls in the guard this file already uses, with the samewording as the existing one.
test_build_context_rejects_file_swapped_to_symlink_before_readcreates its symlink inside a monkeypatched open, where
build_contextcatchesOSErrorandrecords
read_errorinstead of the expectednot_regular_file; that case gets an equivalentup-front probe so the reason is "cannot run here" rather than a wrong reason code.
The
except OSErrorwraps only thesymlink_tocall, so on any platform that can createsymlinks — including
ubuntu-latest, which is what CI runs — every assertion executes exactlyas before. Nothing is skipped there.
Reproduction
Windows 11, Python 3.12.10, symlink creation not permitted for the process. Run against
unmodified
main(704bc95):WinError 1314isERROR_PRIVILEGE_NOT_HELD; the message text itself is locale-dependent andabsolute paths are elided above.
With this change, same command:
What must still hold
tests/nodes/test_build_context.pyas a whole, before and after — the count moves by exactlythese five and nothing else changes state:
The seven that remain are unrelated to symlinks and are not touched here.
ruff check src/ tests/—All checks passed!ruff format --check src/ tests/—223 files already formatted