Skip to content

test(cron): skip POSIX mode assertions on Windows - #71428

Open
cryptoyasenka wants to merge 1 commit into
NousResearch:mainfrom
cryptoyasenka:fix/windows-file-mode-tests
Open

test(cron): skip POSIX mode assertions on Windows#71428
cryptoyasenka wants to merge 1 commit into
NousResearch:mainfrom
cryptoyasenka:fix/windows-file-mode-tests

Conversation

@cryptoyasenka

@cryptoyasenka cryptoyasenka commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

tests/cron/test_file_permissions.py asserts exact POSIX modes (0o700 / 0o600). Windows chmod() only toggles the read-only bit, so os.stat() never reports those values and all six tests in the two permission classes fail on a Windows checkout.

Both classes assert nothing but modes, so they are gated at class level with the same idiom the suite already uses elsewhere: os.name == "nt" with reason POSIX mode bits not enforced on Windows. TestSecureHelpers is untouched and still runs everywhere.

Verified on Windows 11, Python 3.13, cherry-picked onto current main:

  • before: 6 failed, 1 passed
  • after: 1 passed, 6 skipped

Green ubuntu run for this head: https://github.com/cryptoyasenka/hermes-agent/actions/runs/31056703155

Test only, no source changes. ruff check clean.

@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Jul 25, 2026
@monerostar

Copy link
Copy Markdown
Contributor

Native Win11 verification (monerostar)

Host: Windows 11 build 10.0.26200, Hermes venv Python 3.11.15, pytest 9.1.1 (-o addopts=).

Compared current main vs this PR head for tests/cron/test_file_permissions.py only.

Results

Tree Result
main (d71033a40) 6 failed, 2 passed
this PR (1d3ba1837) 2 passed, 6 skipped

Failure shape on main (expected)

Mode assertions compare stat bits to POSIX targets; on NTFS chmod does not produce 0o700/0o600:

  • AssertionError: 511 != 448 (0o777 vs 0o700)
  • AssertionError: 438 != 384 (0o666-ish vs 0o600)

Failing classes: TestCronFilePermissions (3) + TestConfigFilePermissions (3). The two TestSecureHelpers cases still pass on both trees.

Notes

Verdict: correct, minimal, green on live Win11. Evidence only — not a maintainer approve.

@monerostar monerostar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

monerostar native Windows live-verify

Environment

  • Windows 11 native (Build 26200) · Python 3.11 hermes venv
  • Control: install tests/cron/test_file_permissions.py (no nt skip)
  • PR HEAD: 1d3ba1837 — worktree pr-71428
  • Note: no CI checks reported on this branch head (stale/behind?); local proof below

Why main fails here

Windows chmod only toggles the read-only bit. stat.S_IMODE never reports POSIX 0o700 / 0o600. Live on main:

pytest tests/cron/test_file_permissions.py -q -o addopts=
→ 6 failed, 2 passed

Failures are pure mode equality (511 != 448 = 0o777 vs 0o700, 438 != 384 = 0o666 vs 0o600). TestSecureHelpers (2 tests) still pass.

PR

Class-level @unittest.skipIf(os.name == "nt", "POSIX mode bits not enforced on Windows") on the two mode-asserting classes — same idiom used elsewhere in the suite.

pytest tests/cron/test_file_permissions.py -q -o addopts=   # PR tree
→ 2 passed, 6 skipped

Assessment

  • Correct test-portability fix; does not weaken production permission helpers on POSIX
  • +2/−0, focused
  • Optional follow-up (not blocking): Win-specific assertions on readonly bit if you want coverage rather than skip-only

Verdict: LGTM for landing so Windows contributors get a green local suite on this file.

Formal Approve: blocked for external collaborator — comment review only.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Windows test-portability fix. Current main still makes exact POSIX-mode assertions in tests/cron/test_file_permissions.py:37-40, :56-74, and :94-118; the two proposed class decorators guard exactly those mode-only classes. TestSecureHelpers remains outside both decorators at tests/cron/test_file_permissions.py:121.

This matches an existing suite convention at tests/test_honcho_client_config.py:74 and is a minimal salvage onto current main.

Automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users label Jul 30, 2026
@cryptoyasenka

Copy link
Copy Markdown
Contributor Author

@monerostar thanks for the native Win11 run here too, and for listing the actual assertion values rather than just a pass/fail count. Independent hardware evidence on these Windows PRs is exactly what they were missing.

On the nit: I kept os.name == "nt" because that is the idiom the surrounding suite already uses, for example tests/test_honcho_client_config.py, and switching only this file to sys.platform.startswith("win") would make it the odd one out. Happy to flip it if maintainers prefer the newer form.

No changes needed on this one after the review, and it still reports no conflict against current main.

@cryptoyasenka
cryptoyasenka force-pushed the fix/windows-file-mode-tests branch from 26cb308 to 591ff47 Compare August 5, 2026 20:01
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #60888 covers the same Windows cron permission-test family more broadly. This is the narrower class-level assertion gate, so retain both for maintainer comparison.

Windows chmod() only toggles the read-only bit, so os.stat() never reports
0o700 or 0o600 there and all six permission tests fail on a Windows checkout.
Both classes assert nothing but modes, so gate them the same way the rest of
the suite already gates POSIX-only checks.

Failures fixed on Windows (6, now skipped):
  tests/cron/test_file_permissions.py::TestCronFilePermissions
  tests/cron/test_file_permissions.py::TestConfigFilePermissions

The helpers in TestSecureHelpers still run everywhere.
@cryptoyasenka
cryptoyasenka force-pushed the fix/windows-file-mode-tests branch from 0e4e99b to ae79f56 Compare August 5, 2026 23:32
@cryptoyasenka cryptoyasenka changed the title tests: skip POSIX mode assertions on Windows test(cron): skip POSIX mode assertions on Windows Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants