test(cli): gate only the POSIX mode-bit assertion on Windows - #59433
test(cli): gate only the POSIX mode-bit assertion on Windows#59433LceAn wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused Windows portability fix. The premise remains valid on current main: tests/hermes_cli/test_backup.py:2471 unconditionally checks 0o600, while hermes_cli/backup.py:599-604 writes the external file and applies os.chmod.
Problems
- The added method-level marker skips more than the POSIX-specific assertion. It also removes Windows coverage for the portable restore assertions at
tests/hermes_cli/test_backup.py:2467-2473: file existence, restored content, and preventing_externalfrom appearing underHERMES_HOME.
Suggested changes
- Keep the test running and guard only the mode-bit assertion at
tests/hermes_cli/test_backup.py:2471on Windows. This follows the linked #60888 discussion's stronger pattern of retaining meaningful Windows behavior coverage while excluding unsupported POSIX mode checks.
Automated hermes-sweeper review.
| @@ -2443,6 +2443,10 @@ def test_backup_skips_external_paths_outside_home(self, tmp_path, monkeypatch): | |||
| (outside / "leak.json").unlink() | |||
| outside.rmdir() | |||
|
|
|||
| @pytest.mark.skipif( | |||
There was a problem hiding this comment.
Skipping the entire method also drops Windows coverage of the portable restoration assertions below: file existence, contents, and no _external leak into HERMES_HOME. Keep the test enabled and condition only the POSIX-mode assertion.
|
Updated per review. The test now stays enabled on Windows and only the Validation: |
|
Maintenance update: rebuilt the same reviewed assertion-level fix on current |
Keep the restore, content, and no-leak assertions active on Windows while gating only the POSIX mode-bit check.
|
Second-pass maintenance: retained the reviewer-approved assertion-level gate after revalidation. Windows continues to cover restore path, content, and |
What & why
Native Windows does not expose POSIX permission bits from
os.chmod(..., 0o600), so the credential-shaped restore test failed onst_modeeven though restoration was correct.Change
Keep the test enabled on every platform and gate only the POSIX-specific
0o600assertion. Windows still verifies the restored home-relative path, file contents, and absence of_externalleakage underHERMES_HOME.Validation
ruffandgit diff --checkpass.This follows the reviewer-requested assertion-level scope and the repository precedent in #60888.