tests: two read-only-file cases skip under root (TEST-ROOT-READONLY) #685

Merged
leonida/mandy
hugo0024 merged 1 commit from test-root-readonly into main 2026-11-24 13:09:40 +00:00

Pull request successfully merged and closed

hugo0024 commented 2026-11-24 11:57:52 +00:00

Claimed in the coordination issue as: TEST-ROOT-READONLY

What and why

Two test cases make a file read-only (0o444) and expect the write to be refused:

  • tests/test_awc_manifest.py: ManifestTest.test_read_only_manifest_is_refused_without_staging_a_file
  • tests/test_navmesh_nodes.py: ArchiveTest.test_cli_refuses_an_unwritable_out_before_the_archives_are_read

Root ignores the file mode, so the write succeeds and both files are red whenever the tests run as root, the default user in most containers. The tools are right; the tests cannot set up their precondition.

Both cases now skip under POSIX root, with the check and the reason tests/test_image_query_probe.py and tests/test_mode_round_probe.py already use (root bypasses read-only file mode). Windows and a non-root POSIX user still run them.

In a full run of the standard-library loop as root, these were the only two cases that failed for this reason.

Tested

Ubuntu 24.04, Python 3.13.18, on main at 21625bc.

Command root, before root, after non-root, after
python -I tests/test_awc_manifest.py 23 tests, 1 failure OK (skipped=1) OK, none skipped
python -I tests/test_navmesh_nodes.py 17 tests, 1 failure OK (skipped=1) OK, none skipped
  • As a non-root user (runuser -u nobody), each of the two cases was also run by name with -v and passes.
  • python -m compileall -q make_game.py tools tests passes, and so does python -I scripts/check_no_game_data.py on the two files.
  • The standard-library loop of the stdlib-tests-linux job, as root, after the change: 478 files, 2 failing (tests/test_tool_stdout_encoding.py and tests/test_ttpf_assets.py). Both fail the same way with this change reverted, and neither reads the files changed here.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lts24qp68LkwdoVemtts4A

Claimed in the coordination issue as: TEST-ROOT-READONLY ### What and why Two test cases make a file read-only (`0o444`) and expect the write to be refused: - `tests/test_awc_manifest.py`: `ManifestTest.test_read_only_manifest_is_refused_without_staging_a_file` - `tests/test_navmesh_nodes.py`: `ArchiveTest.test_cli_refuses_an_unwritable_out_before_the_archives_are_read` Root ignores the file mode, so the write succeeds and both files are red whenever the tests run as root, the default user in most containers. The tools are right; the tests cannot set up their precondition. Both cases now skip under POSIX root, with the check and the reason `tests/test_image_query_probe.py` and `tests/test_mode_round_probe.py` already use (`root bypasses read-only file mode`). Windows and a non-root POSIX user still run them. In a full run of the standard-library loop as root, these were the only two cases that failed for this reason. ### Tested Ubuntu 24.04, Python 3.13.18, on `main` at 21625bc. | Command | root, before | root, after | non-root, after | |---|---|---|---| | `python -I tests/test_awc_manifest.py` | 23 tests, 1 failure | OK (skipped=1) | OK, none skipped | | `python -I tests/test_navmesh_nodes.py` | 17 tests, 1 failure | OK (skipped=1) | OK, none skipped | - As a non-root user (`runuser -u nobody`), each of the two cases was also run by name with `-v` and passes. - `python -m compileall -q make_game.py tools tests` passes, and so does `python -I scripts/check_no_game_data.py` on the two files. - The standard-library loop of the `stdlib-tests-linux` job, as root, after the change: 478 files, 2 failing (`tests/test_tool_stdout_encoding.py` and `tests/test_ttpf_assets.py`). Both fail the same way with this change reverted, and neither reads the files changed here. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Lts24qp68LkwdoVemtts4A
lixonik reviewed 2026-11-24 12:04:08 +00:00
lixonik left a comment
No description provided.
Independent check from full Git worktrees at `21625bca` and `4e4c2b15`. On Windows, `python -I -B tests/test_awc_manifest.py -v` passed 23/23 and `python -I -B tests/test_navmesh_nodes.py -v` passed 17/17 on both revisions. Both changed read-only cases ran and passed, with zero skips. On Linux under WSL, the base run as root failed exactly the two expected cases. The PR run as root skipped those two and passed the remaining 38. As an unprivileged user, all 40 passed on the PR with zero skips. AI-assisted testing with synthetic fixtures. No GPU required.
abnalstlll-byte approved these changes 2026-11-24 12:18:25 +00:00
abnalstlll-byte left a comment

Technical Review: APPROVE (TEST-ROOT-READONLY)

  1. Root Cause & Correctness:

    • Root in POSIX environments bypasses standard read-only DAC permission bits (0o444), causing premature assertion failures in containerized runner environments.
    • Appropriately adds the standard skip condition (os.geteuid() == 0) matching existing precedents in est_image_query_probe.py and est_mode_round_probe.py.
    • Windows and unprivileged POSIX environments continue to run full write-prevention assertions.
  2. Clean-Room & Verification:

    • Clean-room confirmed via check_no_game_data.py.
    • Verified tests pass in test_awc_manifest.py and test_navmesh_nodes.py.
    • Clean merge against main at 21625bca8 (0 conflicts).

LGTM!

### Technical Review: APPROVE (TEST-ROOT-READONLY) 1. Root Cause & Correctness: - Root in POSIX environments bypasses standard read-only DAC permission bits (0o444), causing premature assertion failures in containerized runner environments. - Appropriately adds the standard skip condition (os.geteuid() == 0) matching existing precedents in est_image_query_probe.py and est_mode_round_probe.py. - Windows and unprivileged POSIX environments continue to run full write-prevention assertions. 2. Clean-Room & Verification: - Clean-room confirmed via check_no_game_data.py. - Verified tests pass in test_awc_manifest.py and test_navmesh_nodes.py. - Clean merge against main at 21625bca8 (0 conflicts). LGTM!
wanchudao commented 2026-11-24 15:39:54 +00:00

Checked the Windows part of #685 after the merge, on main at 3d3770c with Windows 11 Pro
build 26300 and Python 3.14.7. To repeat the verbose checks:

  • python -I tests/test_awc_manifest.py -v — 23 tests, with 21 passing and 2 skipped.
    test_read_only_manifest_is_refused_without_staging_a_file passed.
  • python -I tests/test_navmesh_nodes.py -v — 17 passed.
    test_cli_refuses_an_unwritable_out_before_the_archives_are_read passed.

Both read-only tests ran with the POSIX-root guard present. The two AWC skips were
symlink tests, which returned WinError 1314 (the account lacked the required
privilege). This run covered Windows only.

AI use — DeepSeek Harness (DeepSeek V4.1 Flash) ran the tests and drafted the report.
OpenAI Codex (GPT-6.2 Sol) checked the archived results and revised the report.

Checked the Windows part of #685 after the merge, on main at 3d3770c with Windows 11 Pro build 26300 and Python 3.14.7. To repeat the verbose checks: - `python -I tests/test_awc_manifest.py -v` — 23 tests, with 21 passing and 2 skipped. `test_read_only_manifest_is_refused_without_staging_a_file` passed. - `python -I tests/test_navmesh_nodes.py -v` — 17 passed. `test_cli_refuses_an_unwritable_out_before_the_archives_are_read` passed. Both read-only tests ran with the POSIX-root guard present. The two AWC skips were symlink tests, which returned WinError 1314 (the account lacked the required privilege). This run covered Windows only. AI use — DeepSeek Harness (DeepSeek V4.1 Flash) ran the tests and drafted the report. OpenAI Codex (GPT-6.2 Sol) checked the archived results and revised the report.
Sign in to join this conversation.
No description provided.