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

Merged
hugo0024 merged 1 commit from upstream-pr/685 into main 2026-11-24 13:09:40 +00:00
hugo0024 commented 2026-11-24 11:57:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by hugo0024 on 2026-11-24T11:57:52Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5471675686 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/685). Originally posted by [hugo0024](https://github.com/hugo0024) on 2026-11-24T11:57:52Z. --- 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 commented 2026-11-24 12:04:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-24T12:04:08Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6038849399 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/685#pullrequestreview-6038849399). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-24T12:04:08Z. **Review:** COMMENTED --- 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 commented 2026-11-24 12:18:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:18:25Z.

Review: APPROVED


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!

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6039056715 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/685#pullrequestreview-6039056715). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:18:25Z. **Review:** APPROVED --- ### 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wanchudao on 2026-11-24T15:39:54Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7136405748 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/685#issuecomment-7136405748). Originally posted by [wanchudao](https://github.com/wanchudao) on 2026-11-24T15:39:54Z. --- 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 reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!685
No description provided.