Skip to content

test: guard the POSIX 0600 assertions that cannot hold on Windows - #118

Merged
abrichr merged 1 commit into
mainfrom
fix/desktop-windows-mode-bits
Aug 19, 2026
Merged

test: guard the POSIX 0600 assertions that cannot hold on Windows#118
abrichr merged 1 commit into
mainfrom
fix/desktop-windows-mode-bits

Conversation

@abrichr

@abrichr abrichr commented Aug 19, 2026

Copy link
Copy Markdown
Member

What

Guard the two stat.S_IMODE(...) == 0o600 assertions added in #116 so they run
on POSIX only, matching the convention already used in
tests/test_engine/test_private_flow_config.py.

Why

main went red immediately after #116 merged:

FAILED tests/test_engine/test_push_result_contract.py::test_handoff_persists_exact_server_id_with_private_permissions - AssertionError: assert 438 == 384
FAILED tests/test_engine/test_runner_loop.py::TestHappyPath::test_register_poll_lease_execute_callback_ack - AssertionError: assert 438 == 384

Windows does not expose POSIX owner/group bits. os.chmod there only toggles
the read-only flag, and st_mode reports 0o666 (438) for a writable file, so
the exact 0o600 (384) comparison can never hold. Both tests failed on
windows-latest for Python 3.11 and 3.12.

test.yml runs the Linux lane only for pull requests and the full
Linux/macOS/Windows matrix on exact main, so the exact-head PR checks on #116
could not see this.

How

Keep the exact 0o600 assertion on POSIX. On Windows assert the file exists and
comment why the mode bits are unavailable. The POSIX assertion is unchanged, and
no test is skipped or weakened.

Tests

  • tests/test_engine/test_push_result_contract.py and
    tests/test_engine/test_runner_loop.py: 65 passed.
  • ruff check engine/ tests/ scripts/: passed.

🤖 Generated with Claude Code

The two private-permission assertions added in #116 compare
`stat.S_IMODE(...) == 0o600` unconditionally. Windows does not expose POSIX
owner/group bits: `os.chmod` there only toggles the read-only flag, and
`st_mode` reports 0o666 for a writable file. Both tests therefore failed on
`windows-latest` for Python 3.11 and 3.12 and turned `main` red. Pull-request
CI runs the Linux lane only, so the exact-head PR checks could not see it.

Apply the convention this repository already uses in
`tests/test_engine/test_private_flow_config.py`: keep the exact 0o600
assertion on POSIX and assert the file exists on Windows, with a comment
naming why the mode bits are unavailable there. The POSIX assertion is not
weakened and no test is skipped.

Tests: tests/test_engine/test_push_result_contract.py and
tests/test_engine/test_runner_loop.py -- 65 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrichr
abrichr merged commit 38b17ac into main Aug 19, 2026
17 checks passed
@abrichr
abrichr deleted the fix/desktop-windows-mode-bits branch August 19, 2026 21:57
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.

1 participant