tests: test_mesh_alloc_single_writer inserts 'tools' by __file__, not cwd (TEST-MESHALLOC-SYSPATH) #1421

Merged
thiefyzheng merged 1 commit from upstream-pr/1421 into main 2026-11-29 15:45:20 +00:00
thiefyzheng commented 2026-11-24 23:50:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-24T23:50:36Z.


What

One line: tests/test_mesh_alloc_single_writer.py inserted 'tools' on sys.path relative to the process working directory (sys.path.insert(0, 'tools'), the only relative insert in tests/), so import rdna2spirv on the next line worked only when the cwd was the repository root. It now derives the path from __file__, the same idiom the neighbouring test files use (e.g. tests/test_f32_fuzz.py, tests/test_psin_names.py).

Claimed as TEST-MESHALLOC-SYSPATH on #14 (the finding is @GTAVIB4GTAVI's, at 23:47:17Z).

Why

python -I tests/test_mesh_alloc_single_writer.py from the repo root passes, but the same command from any other cwd fails with ModuleNotFoundError: No module named 'rdna2spirv' — and it is the one ImportError in a run_semantic_tests.py tests run, because that runner starts each child with cwd=<suite folder> (scripts/run_semantic_tests.py:117).

What I ran (Linux, CPython 3.12, no GPU, synthetic only)

  • Before, current main at 364ab4eab: from the worktree root the file passes; from an unrelated cwd (/tmp, absolute path invocation) → ModuleNotFoundError: No module named 'rdna2spirv' (reproduced, quoted in the claim thread).
  • After (this branch): both cwd shapes → Ran 1 test in 0.001s ... OK; python3 -m unittest tests.test_mesh_alloc_single_writer -v also passes.
  • grep over tests/ and scripts/: no other file references this file's path behavior.
  • scripts/check_no_game_data.py exit 0.

Not run

Not run on Windows (the change has no platform-specific behavior: both sides are pure os.path); not run under CI — workflows will cover the file.

AI-assisted: a pi coding agent operated by the repo contributor ran the verification and built the single-file diff; the finding is @GTAVIB4GTAVI's.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5482344406 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1421). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-24T23:50:36Z. --- ## What One line: `tests/test_mesh_alloc_single_writer.py` inserted `'tools'` on `sys.path` relative to the process working directory (`sys.path.insert(0, 'tools')`, the only relative insert in `tests/`), so `import rdna2spirv` on the next line worked only when the cwd was the repository root. It now derives the path from `__file__`, the same idiom the neighbouring test files use (e.g. `tests/test_f32_fuzz.py`, `tests/test_psin_names.py`). Claimed as **TEST-MESHALLOC-SYSPATH** on #14 (the finding is @GTAVIB4GTAVI's, at 23:47:17Z). ## Why `python -I tests/test_mesh_alloc_single_writer.py` from the repo root passes, but the same command from any other cwd fails with `ModuleNotFoundError: No module named 'rdna2spirv'` — and it is the one `ImportError` in a `run_semantic_tests.py tests` run, because that runner starts each child with `cwd=<suite folder>` (scripts/run_semantic_tests.py:117). ## What I ran (Linux, CPython 3.12, no GPU, synthetic only) - Before, current main at `364ab4eab`: from the worktree root the file passes; from an unrelated cwd (`/tmp`, absolute path invocation) → `ModuleNotFoundError: No module named 'rdna2spirv'` (reproduced, quoted in the claim thread). - After (this branch): both cwd shapes → `Ran 1 test in 0.001s ... OK`; `python3 -m unittest tests.test_mesh_alloc_single_writer -v` also passes. - `grep` over tests/ and scripts/: no other file references this file's path behavior. - `scripts/check_no_game_data.py` exit 0. ## Not run Not run on Windows (the change has no platform-specific behavior: both sides are pure `os.path`); not run under CI — workflows will cover the file. **AI-assisted**: a pi coding agent operated by the repo contributor ran the verification and built the single-file diff; the finding is @GTAVIB4GTAVI's.
PierreEbele commented 2026-11-25 10:34:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T10:34:53Z.


Reviewed 80d1424: ran python -I tests/test_mesh_alloc_single_writer.py in the sandbox on both trees. It
passes from the repo root on both; from any other cwd it fails on main (ModuleNotFoundError) and passes
with the PR, which is the intended fix and the idiom all neighbouring tests use — this file held the last
cwd-relative 'tools' insert. The PR's test file also passes copied onto main's tree, so the SHADER-766
assertions are unchanged. No findings.
AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7159890769 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1421#issuecomment-7159890769). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T10:34:53Z. --- Reviewed 80d1424: ran `python -I tests/test_mesh_alloc_single_writer.py` in the sandbox on both trees. It passes from the repo root on both; from any other cwd it fails on main (ModuleNotFoundError) and passes with the PR, which is the intended fix and the idiom all neighbouring tests use — this file held the last cwd-relative 'tools' insert. The PR's test file also passes copied onto main's tree, so the SHADER-766 assertions are unchanged. No findings. AI-assisted review. **Recommendation:** Merge
OreoFR commented 2026-11-28 21:50:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:50:13Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head 80d142496
  • Test: python -I tests/test_mesh_alloc_single_writer.py
  • Red on main: 1 OK
  • Green with the PR: 1 OK
  • Verdict: NO RED (run from the repository root: the other-working-directory case is not exercised)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246309326 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1421#issuecomment-7246309326). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:50:13Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `80d142496` - Test: `python -I tests/test_mesh_alloc_single_writer.py` - Red on main: 1 OK - Green with the PR: 1 OK - Verdict: NO RED (run from the repository root: the other-working-directory case is not exercised) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:12:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:12:26Z.


#1421 | head 80d1424960 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff in tests/test_mesh_alloc_single_writer.py resolving tools/ relative to os.path.abspath(__file__) instead of a relative 'tools' entry on sys.path. python -I scripts/check_no_game_data.py tests/test_mesh_alloc_single_writer.py passed (rc=0).
  • Red -> Green on Windows 11:
    • Red (origin/main 818d881b1f): Running python -I <repo>/tests/test_mesh_alloc_single_writer.py from outside the repository root (%TEMP% working directory) failed with ModuleNotFoundError: No module named 'rdna2spirv' (rc=1).
    • Green (#1421 + origin/main):
      • python -I <repo>/tests/test_mesh_alloc_single_writer.py from %TEMP% working directory -> 1/1 passed (OK, 0.001s)
      • python -I tests/test_mesh_alloc_single_writer.py from repository root -> 1/1 passed (OK, 0.001s).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248631186 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1421#issuecomment-7248631186). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:12:26Z. --- #1421 | head 80d1424960533b1edba2465f8998675a07b69d05 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff in `tests/test_mesh_alloc_single_writer.py` resolving `tools/` relative to `os.path.abspath(__file__)` instead of a relative `'tools'` entry on `sys.path`. `python -I scripts/check_no_game_data.py tests/test_mesh_alloc_single_writer.py` passed (`rc=0`). - **Red -> Green on Windows 11**: - **Red (`origin/main` `818d881b1f`)**: Running `python -I <repo>/tests/test_mesh_alloc_single_writer.py` from outside the repository root (`%TEMP%` working directory) failed with `ModuleNotFoundError: No module named 'rdna2spirv'` (`rc=1`). - **Green (`#1421 + origin/main`)**: - `python -I <repo>/tests/test_mesh_alloc_single_writer.py` from `%TEMP%` working directory -> `1/1` passed (`OK`, `0.001s`) - `python -I tests/test_mesh_alloc_single_writer.py` from repository root -> `1/1` passed (`OK`, `0.001s`).
TheGeogeo commented 2026-11-29 14:18:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:18:45Z.


Ready for testing: merges cleanly with main 3535eb5c4. Not in main yet: git cherry finds 1 commit(s) not there, and 0 of the 2 lines it adds are already present. No duplicate found: its claim TEST-MESHALLOC-SYSPATH appears in no other open pull request and in no main commit.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257204646 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1421#issuecomment-7257204646). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T14:18:45Z. --- Ready for testing: merges cleanly with `main` `3535eb5c4`. Not in `main` yet: `git cherry` finds 1 commit(s) not there, and 0 of the 2 lines it adds are already present. No duplicate found: its claim `TEST-MESHALLOC-SYSPATH` appears in no other open pull request and in no `main` commit. AI-assisted (Claude Code).
enlight3d commented 2026-11-29 15:22:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T15:22:05Z.


RUN of #1421 (red/green, python -I, no build, no game, no GPU)

Heads tested: PR head 80d142496053, origin/main c22a0a73228c; merged = main + PR head, git merge --no-ff, local only (merged cleanly, merge commit 5a770e4ab816).

The PR changes only the test file tests/test_mesh_alloc_single_writer.py (one line: sys.path.insert(0, 'tools') becomes a path built from __file__), so there is no non-test change to revert. The red is the main version of that test file against the same tree, run from a folder other than the repo root. Commands, one process each:
python -I tests/test_mesh_alloc_single_writer.py (cwd = repo root)
python -I test_mesh_alloc_single_writer.py (cwd = tests/)
python -I <abs path>/tests/test_mesh_alloc_single_writer.py (cwd = an unrelated folder)

  • Red (main's test file): from the repo root OK (1 test, which is why it went unnoticed); from tests/ and from an unrelated folder both exit 1, ModuleNotFoundError: No module named 'rdna2spirv'. This is a real red for the cwd dependence the PR fixes (behavioural: same code, other cwd), not a build failure.
  • Green at PR head: Ran 1 test, OK from all three folders.
  • Green merged into main: Ran 1 test, OK from all three folders.
  • Only this one test file is touched.

Machine: NVIDIA GeForce RTX 3090 (not used), Windows 11 Pro 10.0.26300, CPython 3.13.12.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258032936 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1421#issuecomment-7258032936). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T15:22:05Z. --- RUN of #1421 (red/green, `python -I`, no build, no game, no GPU) Heads tested: PR head `80d142496053`, origin/main `c22a0a73228c`; merged = main + PR head, `git merge --no-ff`, local only (merged cleanly, merge commit `5a770e4ab816`). The PR changes only the test file `tests/test_mesh_alloc_single_writer.py` (one line: `sys.path.insert(0, 'tools')` becomes a path built from `__file__`), so there is no non-test change to revert. The red is the main version of that test file against the same tree, run from a folder other than the repo root. Commands, one process each: `python -I tests/test_mesh_alloc_single_writer.py` (cwd = repo root) `python -I test_mesh_alloc_single_writer.py` (cwd = `tests/`) `python -I <abs path>/tests/test_mesh_alloc_single_writer.py` (cwd = an unrelated folder) - Red (main's test file): from the repo root OK (1 test, which is why it went unnoticed); from `tests/` and from an unrelated folder both exit 1, `ModuleNotFoundError: No module named 'rdna2spirv'`. This is a real red for the cwd dependence the PR fixes (behavioural: same code, other cwd), not a build failure. - Green at PR head: Ran 1 test, OK from all three folders. - Green merged into main: Ran 1 test, OK from all three folders. - Only this one test file is touched. Machine: NVIDIA GeForce RTX 3090 (not used), Windows 11 Pro 10.0.26300, CPython 3.13.12.
MoonEyes commented 2026-11-29 15:45:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T15:45:22Z.


Merged. Tested by @enlight3d on head 80d142496 (CPU only (Windows 11; RTX 3090 unused)): Red: main test fails from non-root cwd (ModuleNotFoundError rdna2spirv); green: OK from 3 folders. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @thiefyzheng!

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258341015 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1421#issuecomment-7258341015). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T15:45:22Z. --- Merged. Tested by @enlight3d on head 80d142496 (CPU only (Windows 11; RTX 3090 unused)): Red: main test fails from non-root cwd (ModuleNotFoundError rdna2spirv); green: OK from 3 folders. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @thiefyzheng! AI-assisted: yes
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!1421
No description provided.