Skip to content

Windows dev environment: 56 tests fail on POSIX assumptions — add platform markers and Windows-equivalent invariant checks #173

Description

@hellices

Problem

A full local test run on Windows fails 56 tests that all pass in CI (Linux). Verified identical on main — none are product regressions. They are test-environment assumptions, measured and classified:

Class Representative tests Mechanism (measured)
POSIX permission bits test_save_agent_config_preserves_restrictive_file_mode NTFS has no rwx bits: os.chmod(0o600) only toggles the read-only flag and stat.S_IMODE reads 0o666 for any writable file, so == 0o600 can never pass on Windows
Directory fsync tests/core/test_audit.py (test_append_fsyncs_before_returning, fail-closed tests) the audit trail expects file + directory fsync (>= 2 fsync calls); Windows cannot os.open a directory for fsync, so only one fsync is observed
Symlink privileges tests/core/test_transfer.py::TestPackExtract::test_pack_dereferences_symlink_source WinError 1314: creating symlinks requires admin rights or Developer Mode; Path.symlink_to() fails outright on a normal account
POSIX path semantics TestValidateSpec (/tmp/...), tilde-user expansion, Downloads assumptions /tmp does not exist on Windows (local directory does not exist: \tmp); ~user expansion differs
tty/subprocess semantics tests/ui/test_node_shell.py, shell-fallback tests in test_app.py kubectl attach/exec flows assume POSIX terminal suspend/restore

33 other tests already carry platform skip markers; these 56 are the remainder.

Why it matters

  • Local development on Windows cannot use pytest / --lf output as a signal: 56 permanent reds bury real regressions.
  • Contributors on Windows may misattribute these failures to their changes (this cost an investigation cycle in practice).

Proposal

Two-track, because a blanket skip would weaken security-invariant coverage:

  1. Environment-limitation tests → platform markers. Symlink creation, /tmp paths, ~user expansion, tty attach flows: pytest.mark.skipif(sys.platform == "win32", reason=...) (or a shared posix_only marker in conftest.py). These test POSIX behaviors korvid does not promise on Windows.
  2. Security-invariant tests → Windows-equivalent assertions, not skips. The audit fail-closed contract (design doc: if the audit entry cannot be written, the write is blocked) and the config file-mode restriction are invariants that must hold on Windows too:
    • audit: assert the file fsync happens and that a failed append still blocks the write on Windows (directory-fsync expectation becomes POSIX-conditional);
    • config mode: assert the POSIX bits on POSIX; on Windows assert what NTFS can express (e.g. the file is not world-readable via ACLs, or at minimum document the limitation explicitly in the test).

Acceptance criteria

  • uv run pytest on a clean Windows checkout reports 0 unexpected failures (only pass/skip).
  • No security-invariant test is skipped on Windows without a Windows-equivalent assertion or an explicit documented limitation.
  • A shared marker/helper exists so future POSIX-assuming tests opt in explicitly instead of failing by surprise.
  • CI (Linux) coverage is unchanged.

Metadata

Metadata

Assignees

Labels

concern: reliabilityGraceful degradation, lifecycle safety, and operational correctnessconcern: testingTest infrastructure, evaluation, and quality measurement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions