Skip to content

test(core): skip prompt-loading symlink tests when symlinks are unavailable - #40405

Open
Vijay Biradar (iam-kira) wants to merge 1 commit into
langchain-ai:masterfrom
iam-kira:fix/skip-prompt-loading-symlink-tests-on-windows
Open

Vijay Biradar (iam-kira) wants to merge 1 commit into
langchain-ai:masterfrom
iam-kira:fix/skip-prompt-loading-symlink-tests-on-windows

Conversation

@iam-kira

Copy link
Copy Markdown

Fixes #40241

Three prompt-loading security tests in libs/core created symlinks with no guard, so anyone running the core suite on non-elevated Windows got 3 failures (WinError 1314) before touching any code. This skips them there using the same guard test_file_search.py already uses; nothing changes wherever symlinks work.

How did you verify your code works?

On Windows 11, non-elevated, Developer Mode off: test_loading.py went from 3 failed / 23 passed to 23 passed / 3 skipped. ruff check and ruff format --check pass. Rebased on current master (67ee6cb).

…ilable

Three tests in tests/unit_tests/prompts/test_loading.py create symlinks with no
guard, so they fail on Windows for any user who is not elevated and does not have
Developer Mode enabled:

    OSError: [WinError 1314] A required privilege is not held by the client

    FAILED test_symlink_txt_to_py_is_blocked
    FAILED test_symlink_jinja2_rce_is_blocked
    FAILED test_save_symlink_to_py_is_blocked

No workflow runs the suite on Windows, so nothing upstream could have caught it.

This reuses the guard already used for the same problem in
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py,
where five symlink-based security tests skip the same way. These are unit tests
on tmp_path, so the only realistic failure is the platform being unable to create
a symlink at all -- which is exactly what the skip is for.

Where symlinks work, behaviour is unchanged.

test_loading.py on Windows: 3 failed / 23 passed -> 0 failed / 23 passed, 3 skipped.
@github-actions github-actions Bot added core `langchain-core` package issues & PRs size: XS < 50 LOC tests PRs made that add, modify, or remove tests labels Sep 11, 2026
@codspeed

codspeed Bot commented Sep 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 15 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing iam-kira:fix/skip-prompt-loading-symlink-tests-on-windows (fdb9709) with master (c3acb40)2

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on master (67ee6cb) during the generation of this report, so c3acb40 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@Ayushdevo Ayush Tiwari (Ayushdevo) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head fdb9709 independently.

I ran the complete prompt-loading test module on Linux/Python 3.12.14 with sockets disabled: 26 passed. The new try/except covers only symlink creation, so successful creation still reaches the existing extension-resolution and Jinja2 rejection assertions; those security checks are not swallowed by the skip. This preserves the useful Linux coverage while permitting environments without symlink privileges to skip the setup-dependent cases. I have not exercised Windows privilege handling, so the cross-platform part remains a CI validation item rather than a claimed result. No blocking finding in this test-only diff. AI-assisted review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs external new-contributor size: XS < 50 LOC tests PRs made that add, modify, or remove tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: three prompt-loading symlink tests fail on Windows without symlink privilege

2 participants