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

Manually merged
github merged 1 commit from gh-pr/685/head into gh-pr/685/base 2026-11-26 09:16:17 +00:00
Owner

@⁠hugo0024 on GitHub · 2026-11-24 11:57 UTC · original
hugo0024:test-root-readonly → main · +4 −0 · 2 files · 1 commits · merged 2026-11-24 13:09 UTC

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

**@⁠hugo0024** on GitHub · 2026-11-24 11:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/685) `hugo0024:test-root-readonly` → `main` · +4 −0 · 2 files · 1 commits · merged 2026-11-24 13:09 UTC 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
tests/test_awc_manifest.py and tests/test_navmesh_nodes.py each make a
file read-only (0o444) and expect the write to be refused. Root ignores
the mode, so both files are red when the suite runs as root, the default
user in most containers.

Skip those two cases under POSIX root, with the check and the reason
tests/test_image_query_probe.py and tests/test_mode_round_probe.py
already use. Windows and a normal POSIX user still run both cases.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Lts24qp68LkwdoVemtts4A
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:16:16 +00:00
github manually merged commit 4e4c2b15c9 into gh-pr/685/base 2026-11-26 09:16:17 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-24 12:04 UTC · original · reviewed

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.

**@⁠lixonik** on GitHub · 2026-11-24 12:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/685#pullrequestreview-6038849399) · **reviewed** 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.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 12:18 UTC · original · approved these changes

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!

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 12:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/685#pullrequestreview-6039056715) · **approved these changes** ### 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!
Author
Owner

@⁠wanchudao on GitHub · 2026-11-24 15:39 UTC · original

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.

**@⁠wanchudao** on GitHub · 2026-11-24 15:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/685#issuecomment-7136405748) 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.