loopx icon indicating copy to clipboard operation
loopx copied to clipboard

[Bug]: tests/architecture reports 12 host-dependent failures on native Windows (cp936 locale, no symlink privilege)

Open JasonBuildAI opened this issue 1 month ago • 0 comments

Preflight

  • [x] I searched existing issues and discussions for this behavior.
  • [x] This report is not an unpatched security vulnerability.
  • [x] The report and attachments contain no credentials or private/internal material.

Issue origin

Observed or reproduced in a real environment (native Windows source checkout, zh-CN system locale, no Developer Mode symlink privilege).

LoopX version or commit

43643a5e5 (main), source checkout with uv sync --extra test, Python 3.12 on Windows.

Host or runtime surface

Not host-specific (native Windows contributor checkout; reproducible for any Windows user whose ANSI code page is not UTF-8).

LoopX area

Build, packaging, installer, or CI

Problem

On a native Windows checkout whose system locale uses the legacy ANSI code page (cp936 / zh-CN, the Windows default for that locale) and where creating symlinks is not permitted (no Developer Mode, no elevation), pytest tests/architecture reports 12 failures that are unrelated to the semantics these tests assert. Each failure is a host-capability error, not a product regression:

  • test_semantic_production.py (4 tests): the fixtures read loopx/semantics/vocabulary_v0.json through Path.read_text() with no encoding, so Python decodes the file with the host codec and raises UnicodeDecodeError: 'gbk' codec can't decode byte 0x86 in position 2357.
  • test_contributor_task_board.py (5 tests): the negative control copies docs/architecture/rfcs/goal-direction-baseline-v0.md (Chinese content) and edits its status line with bare path.read_text() / path.write_text(), ending in the same UnicodeDecodeError at position 22180.
  • test_rfc_status_index.py (2 tests): the document() fixture writes a Chinese lifecycle header through bare write_text(), i.e. in the host codec; the generator under test correctly reads UTF-8, aborts with UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2, and the CLI regression assertions see a failing return code.
  • test_semantic_inventory.py (1 test): test_tracked_symlink_cannot_read_untracked_source calls Path.symlink_to directly and dies with OSError: [WinError 1314] A required privilege is not held by the client before reaching its assertion.

Why it matters: Windows is a supported first-class platform (the windows-powershell CI lane, Windows installer, and Windows setup docs), and these four files guard semantic vocabulary drift, contributor-board governance, and the RFC status index - the exact local signal a contributor should trust before pushing. The architecture suite runs on ubuntu-latest in CI, so this breakage is invisible there and surfaces only in the contributor's (or agent's) local run, as 12 red tests with a misleading cause. Repo precedent for treating this class as a real defect: the same host-codec and symlink-privilege classes were repaired in #6119, #6161, #6166, #6168, #6200, and #6204 in the 1.4.0 cycle, and a fix for this suite will follow as a pull request.

Minimal reproduction

On a native Windows host with a non-UTF-8 ANSI code page (e.g. zh-CN/cp936) and no symlink privilege:

  1. uv sync --extra test
  2. From the checkout root: uv run --extra test python -m pytest tests/architecture -q

Observe: 12 failed, 1421 passed. Restricting to the affected files: uv run --extra test python -m pytest tests/architecture/test_semantic_production.py tests/architecture/test_contributor_task_board.py tests/architecture/test_rfc_status_index.py tests/architecture/test_semantic_inventory.py -q -> 12 failed, 79 passed. The same commands pass on Linux/CI and on Windows with UTF-8 mode (PYTHONUTF8=1) except for the symlink test.

Expected behavior

pytest tests/architecture passes on a native Windows checkout without requiring the host locale to be UTF-8 or the process to hold the symlink privilege; the symlink-only test may skip with a clear reason when the host cannot create symlinks, matching the existing house pattern (except OSError: pytest.skip(...) in tests/control_plane/*).

Actual behavior

12 tests fail with UnicodeDecodeError (host codec decoding repo content written in UTF-8, or the fixture writing content in the host codec that the UTF-8 owner then rejects) or with WinError 1314 on the direct symlink_to call, none of them reaching the assertion they exist to check.

Sanitized diagnostics

FAILED tests/architecture/test_semantic_production.py::test_real_effect_adapters_are_observed_as_unresolved_passthrough
E   UnicodeDecodeError: 'gbk' codec can't decode byte 0x86 in position 2357: illegal multibyte sequence
FAILED tests/architecture/test_contributor_task_board.py::test_inactive_or_unmerged_design_cannot_be_available[Draft]
E   UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 22180: illegal multibyte sequence
FAILED tests/architecture/test_rfc_status_index.py::test_chinese_lifecycle_must_match_canonical_header
E   UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 28: invalid start byte
FAILED tests/architecture/test_semantic_inventory.py::test_tracked_symlink_cannot_read_untracked_source
E   OSError: [WinError 1314] A required privilege is not held by the client
12 failed, 1421 passed in 247.23s

python -c "import sys; print(sys.version)" -> 3.12.x on Windows (nt); sys.getdefaultencoding() is utf-8 while the locale codec is cp936.

Additional context

A fix pins the fixture text I/O to UTF-8 (matching the generators/owners under test, which already read and write UTF-8) and skips the symlink test only when the host cannot create the symlink. It will follow as a pull request referencing this issue. The audit is bounded to tests/architecture; other suites were not swept for the same host-codec pattern.

AI disclosure: this report was drafted with AI assistance at my request, under my direction and review.

JasonBuildAI avatar Oct 11 '26 11:10 JasonBuildAI