AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Test_mset_chmod Fails On Windows Due To Unsupported Chmod Permission Bits

The unit test test_mset_chmod in tests/unit_tests/storage/test_filesystem.py fails on Windows because Windows does not support POSIX-style group and other chmod permission bits, causing assertion mismatches for modes 0o770 and 0o700.

mediumConfidence 90%LangchainRetrieversChat ModelsMemoryAffected V1.0.8

Origin Analysis

On Windows, os.chmod only enforces the read-only attribute (S_IWRITE). Group and other permission bits are ignored. The test asserts exact POSIX mode bits returned by os.stat, which on Windows reports a synthetic mode (often 0o777) that does not match the requested chmod value, leading to assertion failures.
cd libs/langchain uv sync --all-groups uv run --group test pytest tests/unit_tests/storage/test_filesystem.py -v

Fixing Code Block

import os import stat import sys import tempfile import pytest from langchain_classic.storage.file_system import LocalFileStore @pytest.mark.skipif( sys.platform == "win32", reason="POSIX chmod permissions are not supported on Windows", ) @pytest.mark.parametrize( "chmod_val, expected", [(0o770, 0o660), (0o700, 0o600)], ) def test_mset_chmod(chmod_val, expected): with tempfile.TemporaryDirectory() as temp_dir: store = LocalFileStore(temp_dir, chmod=chmod_val) store.mset([("key1", b"value1")]) file_path = os.path.join(temp_dir, "key1") file_mode = stat.S_IMODE(os.stat(file_path).st_mode) assert file_mode == expected
The test is skipped on Windows because the underlying OS does not implement POSIX group/other permission bits; asserting exact octal modes is meaningless on that platform. The skip prevents false failures while preserving full coverage on Unix-like systems.

Edge Case Audit

This change only affects test execution on Windows; production code is unchanged. If a future Windows version adds POSIX permission support, the skip may hide real regressions. No rollback risk, but if the test suite is used to enforce chmod behavior across platforms, consider adding a separate Windows-specific test that checks only the read-only flag.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state