Review/1360 reserve manifest paths #1380

Closed
leonida/mandy
xel1uz wants to merge 0 commits from review/1360-reserve-manifest-paths into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

xel1uz commented 2026-11-24 22:56:56 +00:00

Claimed in the coordination issue as: ROOTSIG-CENSUS-JSON-GUARD (original claim by @JesusACD).

Depends on: #1360. This branch includes @JesusACD's output-path checks and adds a fix for a manifest that does not exist yet.

What and why

With an empty root/ directory, running python -I tools/rootsig_census.py root --json root/index.json twice gave different results. The first run exited 0 and wrote a census report to the manifest path. The identical second run exited 2 because index.json now existed. The same sequence occurred with --disasm disasm --json disasm/index.json.

This change reserves both manifest paths before the first write. The command now exits 2 and leaves the path empty in both cases. The reproduction on #1360 records the original behavior.

Tested

  • On the original PR at 8270eaea, both subcases of the new regression test failed: the command returned 0 and created the report.
  • On 6c85fbae, python -I tests/test_rootsig_census.py passed all 30 tests on Windows. The new test checks both the exit code and that neither manifest file was created.
  • git diff --check and scripts/check_no_game_data.py passed for the changed files.

GPUs tested: n/a (filesystem and CLI behavior; synthetic directories).

AI-assisted: yes, OpenAI Codex.

Checklist

  • Verified a clean merge against upstream main at 28a32e19.
  • One topic: protect the census input manifest paths from --json output.
  • No game data, keys or decryption.
  • Translator contract table: n/a. No translator rule changed.
Claimed in the coordination issue as: [ROOTSIG-CENSUS-JSON-GUARD](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146264254) (original claim by @JesusACD). Depends on: #1360. This branch includes @JesusACD's output-path checks and adds a fix for a manifest that does not exist yet. ### What and why With an empty `root/` directory, running `python -I tools/rootsig_census.py root --json root/index.json` twice gave different results. The first run exited 0 and wrote a census report to the manifest path. The identical second run exited 2 because `index.json` now existed. The same sequence occurred with `--disasm disasm --json disasm/index.json`. This change reserves both manifest paths before the first write. The command now exits 2 and leaves the path empty in both cases. The [reproduction on #1360](https://github.com/ubiquitarianism/leonida/pull/1360#issuecomment-7146694792) records the original behavior. ### Tested - On the original PR at `8270eaea`, both subcases of the new regression test failed: the command returned 0 and created the report. - On `6c85fbae`, `python -I tests/test_rootsig_census.py` passed all 30 tests on Windows. The new test checks both the exit code and that neither manifest file was created. - `git diff --check` and `scripts/check_no_game_data.py` passed for the changed files. GPUs tested: n/a (filesystem and CLI behavior; synthetic directories). AI-assisted: yes, OpenAI Codex. ### Checklist - [x] Verified a clean merge against upstream `main` at `28a32e19`. - [x] One topic: protect the census input manifest paths from `--json` output. - [x] No game data, keys or decryption. - Translator contract table: n/a. No translator rule changed.
PierreEbele commented 2026-11-25 15:13:58 +00:00

Reviewed 6c85fbaeb: ran tests/test_rootsig_census.py on the PR (30/30 OK) and on main with the PR's tests copied in (9 failures + 1 error, so the tests do exercise the new guard), plus test_report_paths.py/test_report_path_case.py on both trees (unchanged, pass), --help, compileall and check_no_game_data.py (clean). A probe over both trees with a hand-built fspx fixture reproduces the main-branch behavior this fixes: --json into sig.dxbc, fspx/sig.json, index.json or disasm/sig.s silently overwrites the input with exit 0; on the PR each is refused with exit 2 and byte-identical inputs afterwards. Directory/nested/unwritable targets go from tracebacks to clean exit-2 errors, ordinary reports still write (including nested parents), symlinked input aliases are refused, and case-differing names are still allowed on case-sensitive volumes. No findings. Nothing here needs GPU/Windows/MSVC or game files.

AI-assisted review.

Recommendation: Merge

Reviewed 6c85fbaeb: ran `tests/test_rootsig_census.py` on the PR (30/30 OK) and on main with the PR's tests copied in (9 failures + 1 error, so the tests do exercise the new guard), plus `test_report_paths.py`/`test_report_path_case.py` on both trees (unchanged, pass), `--help`, compileall and `check_no_game_data.py` (clean). A probe over both trees with a hand-built fspx fixture reproduces the main-branch behavior this fixes: `--json` into `sig.dxbc`, `fspx/sig.json`, `index.json` or `disasm/sig.s` silently overwrites the input with exit 0; on the PR each is refused with exit 2 and byte-identical inputs afterwards. Directory/nested/unwritable targets go from tracebacks to clean exit-2 errors, ordinary reports still write (including nested parents), symlinked input aliases are refused, and case-differing names are still allowed on case-sensitive volumes. No findings. Nothing here needs GPU/Windows/MSVC or game files. AI-assisted review. **Recommendation:** Merge
OreoFR commented 2026-11-28 21:49:21 +00:00

Verified by OreoFR

  • Base: main 3408969a7 + PR head 6c85fbaeb
  • Test: python -I tests/test_rootsig_census.py
  • Red on main: 30 OK
  • Green with the PR: 30 OK
  • Verdict: NO RED
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

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

**Verified by OreoFR** - Base: main `3408969a7` + PR head `6c85fbaeb` - Test: `python -I tests/test_rootsig_census.py` - Red on main: 30 OK - Green with the PR: 30 OK - Verdict: NO RED - 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:19:31 +00:00

Independent verification on Windows 11 (10.0.26200, x64, Python 3.12.10 & Python 3.14.5) against origin/main (5825b02ff8):

  • Already landed on main (0-byte net merge diff):
    • Commit 85b44dd10 (rootsig_census: reserve root and disasm index.json paths before first write (ROOTSIG-CENSUS-JSON-GUARD)) already landed the exact tools/rootsig_census.py and tests/test_rootsig_census.py changes on main.
    • git merge-tree --write-tree origin/main 6c85fbaebf produces tree 1960b9caf9bad67df5576bf9b3ca385340f8c8ca, identical to origin/main^{tree} (0 changed files when merged), which explains why python -I tests/test_rootsig_census.py passes 30/30 on both origin/main and the merge (1.62 s on Python 3.12.10, 2.63 s on Python 3.14.5). This PR can be closed as already incorporated on main.
  • Native NTFS alias check: verified both case-insensitive INDEX.JSON (rc=2) and mklink /J directory-junction root_junc/index.json (rc=2) are refused before index.json exists (exists == False).

AI-assisted.

Independent verification on Windows 11 (`10.0.26200`, x64, `Python 3.12.10` & `Python 3.14.5`) against `origin/main` (`5825b02ff8`): - **Already landed on `main` (`0`-byte net merge diff)**: - Commit `85b44dd10` (`rootsig_census: reserve root and disasm index.json paths before first write (ROOTSIG-CENSUS-JSON-GUARD)`) already landed the exact `tools/rootsig_census.py` and `tests/test_rootsig_census.py` changes on `main`. - `git merge-tree --write-tree origin/main 6c85fbaebf` produces tree `1960b9caf9bad67df5576bf9b3ca385340f8c8ca`, identical to `origin/main^{tree}` (`0` changed files when merged), which explains why `python -I tests/test_rootsig_census.py` passes `30/30` on both `origin/main` and the merge (`1.62 s` on `Python 3.12.10`, `2.63 s` on `Python 3.14.5`). This PR can be closed as already incorporated on `main`. - **Native NTFS alias check**: verified both case-insensitive `INDEX.JSON` (`rc=2`) and `mklink /J` directory-junction `root_junc/index.json` (`rc=2`) are refused before `index.json` exists (`exists == False`). AI-assisted.
MoonEyes commented 2026-11-29 14:51:12 +00:00

Thanks @xel1uz! Both files of this PR are now byte-identical on main (landed with #1360, merge 6a1da58aa), so the net diff is empty. Closing as already on main; reopen if something is still missing.

AI-assisted: yes (checked blob by blob against main).

Thanks @xel1uz! Both files of this PR are now byte-identical on `main` (landed with #1360, merge 6a1da58aa), so the net diff is empty. Closing as already on main; reopen if something is still missing. AI-assisted: yes (checked blob by blob against main).
Sign in to join this conversation.
No description provided.