Skip to content

Skip the symlink guardrail tests when the platform refuses a symlink - #12

Closed
simin-yuan wants to merge 1 commit into
Neboy72:mainfrom
simin-yuan:fix/windows-symlink-tests
Closed

simin-yuan wants to merge 1 commit into
Neboy72:mainfrom
simin-yuan:fix/windows-symlink-tests

Conversation

@simin-yuan

Copy link
Copy Markdown
Contributor

What this changes

tests/test_guardrails.py now creates its symlinks through a small helper that skips the test
with the reason when the platform refuses to create a symlink, instead of letting the error fail
the test.

Why

On Windows, os.symlink raises OSError (WinError 1314, "a required privilege is not held by
the client") unless the account holds SeCreateSymbolicLinkPrivilege — developer mode or an
elevated shell. Both symlink tests were therefore erroring during setup rather than testing
anything:

tests/test_guardrails.py:231: OSError: [WinError 1314] ...
FAILED TestSymlinkResolution::test_symlink_normalization_matches_real_path
FAILED TestSymlinkResolution::test_symlink_alias_write_blocks

The skip is decided by attempting the call and catching OSError / NotImplementedError, not by
the platform name, so the tests still run on Windows wherever symlinks are permitted, and are
never skipped on macOS or Linux.

Test evidence

Windows 11, Python 3.11.16, pytest tests/test_guardrails.py -rs:

SKIPPED [1] tests/test_guardrails.py:229: cannot create a symlink here:
    [WinError 1314] A required privilege is not held by the client. (: '...real_secret.txt' -> '...alias.txt')
SKIPPED [1] tests/test_guardrails.py:229: cannot create a symlink here:
    [WinError 1314] A required privilege is not held by the client. (: '...config.yaml' -> '...alias.yaml')

Both entries are the two symlink tests; nothing else changes state in them. pytest tests/test_guardrails_linear.py → 30 passed, unchanged. No source files are touched, so no pin
change is involved.

Scope

Scope: the two symlink tests only. Files touched: tests/test_guardrails.py and a
CHANGELOG.md entry under [Unreleased]. Nothing in src/, so no pin change is involved.


I license this contribution under the MIT licence of this project.

…symlink

os.symlink raises OSError (WinError 1314) on Windows unless the account holds
SeCreateSymbolicLinkPrivilege, so the two symlink tests in tests/test_guardrails.py
errored instead of running. They now skip with the reason when creation is refused,
and still run wherever symlinks are permitted.
@simin-yuan
simin-yuan force-pushed the fix/windows-symlink-tests branch from 81d0a4c to a433151 Compare October 28, 2026 16:02
Neboy72 added a commit that referenced this pull request Oct 31, 2026
… link

Windows raises OSError (WinError 1314) from os.symlink unless the account holds
SeCreateSymbolicLinkPrivilege, so both symlink tests errored during setup
instead of testing anything. The new _link_or_skip helper creates the link and
skips the test with the reason when creation is actually refused, so the tests
still run where symlinks are permitted.

The suite now also runs on windows-latest. Until now it ran on ubuntu-latest
only, which is why this went unnoticed: a red Windows checkout looked like a
broken project rather than a gap in our CI.

Patch and tests by Simin Yuan (PR #12).
@Neboy72

Neboy72 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Your patch is on main and credited in the changelog: the two symlink tests in tests/test_guardrails.py skip with the reason where the platform refuses to create a link, and still run wherever symlinks are permitted. It is part of v0.22.44, released today: https://github.com/Neboy72/nexus-memory/releases/tag/v0.22.44

Thank you, closing as merged by hand.

@Neboy72 Neboy72 closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants