[PR #730] [MERGED] OLD-8645: restore old upstream PR 8645 - vs_layout_census: refuse a --json that is an input or a directory before survey() (BUILD-589) #768

Closed
opened 2026-11-26 20:18:59 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/730
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: build589-vs-layout-census-guard


📝 Commits (1)

  • ad136ff vs_layout_census: refuse a --json that is an input or a directory before survey() (BUILD-589)

📊 Changes

2 files changed (+151 additions, -7 deletions)

View changed files

📝 scripts/vs_layout_census.py (+33 -7)
📝 tests/test_vs_layout_census.py (+118 -0)

📄 Description

Claimed in the coordination issue as: OLD-8645 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7132204652

Restoration of my original pull request, old upstream PR 8645 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 51f3160923; the one commit cherry-picked cleanly and is unchanged. The tool is scripts/vs_layout_census.py, and it already uses the shared tools/report_paths.same_report_path guard that CONTRIBUTING.md names.

What and why

  • On main, --json is compared only with index.json, using a raw os.path.samefile (scripts/vs_layout_census.py:189).
  • So a --json that names an indexed .dxbc container or a disasm/<stem>.s listing overwrites that input.
  • A --json that is a directory runs survey() first (that includes llvm-mc on every unlisted payload) and fails only at the write.
  • main() now checks --json before survey() runs and refuses:
    • an existing directory;
    • any path that same_report_path matches to index.json or to a container or listing named in the index.
  • The list of inputs comes from the new input_paths(). It shares the new load_index() with survey(), so the guard and the census read the same index.
  • Each refusal prints one error line and exits with status 2. A separate --json path still runs as before.
  • Open PR #490 changes how report_paths works inside, without changing the call. It shares no files with this one and does not conflict.

Tested

Linux, Python 3.14.10, CPU only. All inputs are synthetic and built by the test: index.json, FSSM payloads in DXBC containers and hand-written .s listings. No game files.

  • python -I tests/test_vs_layout_census.py:
    • main plus only this pull request's test changes: 16 tests run, 8 of the 11 new ones fail (3 failures, 5 errors), 1 skipped;
    • this branch: 16 tests run, OK, 1 skipped.
  • The skipped test is the other-case spelling. It needs a case-folding volume, and this Linux filesystem keeps letter case apart.
  • python -I tests/test_report_paths.py: OK.
  • python -m compileall -q tools tests scripts: clean.
  • git diff --check: clean.
  • python -I scripts/check_no_game_data.py on both changed files: clean.

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)

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/730 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `build589-vs-layout-census-guard` --- ### 📝 Commits (1) - [`ad136ff`](https://github.com/ubiquitarianism/leonida/commit/ad136ffb9c8ab1b36cf4ccbe0ca72aecb50217b6) vs_layout_census: refuse a --json that is an input or a directory before survey() (BUILD-589) ### 📊 Changes **2 files changed** (+151 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `scripts/vs_layout_census.py` (+33 -7) 📝 `tests/test_vs_layout_census.py` (+118 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-8645 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7132204652 Restoration of my original pull request, old upstream PR 8645 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 51f31609236a952badeb9c9aba9efc2a6e4dc2ff; the one commit cherry-picked cleanly and is unchanged. The tool is `scripts/vs_layout_census.py`, and it already uses the shared `tools/report_paths.same_report_path` guard that CONTRIBUTING.md names. ### What and why - On main, `--json` is compared only with `index.json`, using a raw `os.path.samefile` (`scripts/vs_layout_census.py:189`). - So a `--json` that names an indexed `.dxbc` container or a `disasm/<stem>.s` listing overwrites that input. - A `--json` that is a directory runs `survey()` first (that includes llvm-mc on every unlisted payload) and fails only at the write. - `main()` now checks `--json` before `survey()` runs and refuses: - an existing directory; - any path that `same_report_path` matches to `index.json` or to a container or listing named in the index. - The list of inputs comes from the new `input_paths()`. It shares the new `load_index()` with `survey()`, so the guard and the census read the same index. - Each refusal prints one error line and exits with status 2. A separate `--json` path still runs as before. - Open PR #490 changes how `report_paths` works inside, without changing the call. It shares no files with this one and does not conflict. ### Tested Linux, Python 3.14.10, CPU only. All inputs are synthetic and built by the test: `index.json`, FSSM payloads in DXBC containers and hand-written `.s` listings. No game files. - `python -I tests/test_vs_layout_census.py`: - main plus only this pull request's test changes: 16 tests run, 8 of the 11 new ones fail (3 failures, 5 errors), 1 skipped; - this branch: 16 tests run, OK, 1 skipped. - The skipped test is the other-case spelling. It needs a case-folding volume, and this Linux filesystem keeps letter case apart. - `python -I tests/test_report_paths.py`: OK. - `python -m compileall -q tools tests scripts`: clean. - `git diff --check`: clean. - `python -I scripts/check_no_game_data.py` on both changed files: clean. 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) AI-assisted (Claude Code, Claude Opus 5.5). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:59 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#768
No description provided.