feature_scan: ask report_paths for the report-path guard (FEATURE-SCAN-SHARED-REPORT-PATH) #1216

Manually merged
github merged 2 commits from gh-pr/1216/head into gh-pr/1216/base 2026-11-26 09:43:12 +00:00
Owner

@⁠breachato on GitHub · 2026-11-24 20:26 UTC · original
breachato:feature-scan-shared-report-path → main · +35 −13 · 2 files · 2 commits · merged 2026-11-25 02:36 UTC

Claimed in the coordination issue as: FEATURE-SCAN-SHARED-REPORT-PATH (#14)

Depends on: none

Fixes: none

What and why

tools/feature_scan.py carried its own same_path (:532, abspath + normcase + samefile) for the --out
guard at :573, which refuses a report written over dxbc/index.json or spirv/index.json: files the scan
reads on the next run. That is the answer tools/report_paths.same_report_path exists to give, and
CONTRIBUTING.md asks a report writer to call it rather than derive it again.

The private copy also missed that helper's folding-volume probe, so on a Linux mount that ignores case (vfat,
exFAT, CIFS) --out INDEX.json passed as another path and replaced the index the scan reads.

The duplicated logic goes (2 insertions, 13 deletions). The tool already puts its own folder on sys.path for
shader_carve, so the import is one line; nothing else in the repository imports feature_scan.same_path, so
the name goes with the duplication. inside_dir keeps its own check: containment in a folder is a different
question from two paths naming one file, and report_paths does not answer it.

Tested

  • tests/test_feature_scan.py, tests/test_feature_scan_bad_index.py, tests/test_feature_scan_code_base.py,
    tests/test_feature_scan_order.py and tests/test_cpu_feature_scan.py: 42 passed, 10 subtests passed.
  • python -I tools/feature_scan.py --help: prints its usage (the import works under -I).
  • python -m compileall -q tools/feature_scan.py: clean.
  • Not tested: the folding-volume case this fixes, which needs a case-folding mount (vfat/exFAT/CIFS); this
    machine is NTFS, where normcase already folds case. tests/test_report_paths.py covers the helper's own
    folding-volume answer.
  • No game files, no GPU; nothing was built.

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)
**@⁠breachato** on GitHub · 2026-11-24 20:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1216) `breachato:feature-scan-shared-report-path` → `main` · +35 −13 · 2 files · 2 commits · merged 2026-11-25 02:36 UTC Claimed in the coordination issue as: FEATURE-SCAN-SHARED-REPORT-PATH (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Depends on: none Fixes: none ### What and why `tools/feature_scan.py` carried its own `same_path` (`:532`, abspath + normcase + samefile) for the `--out` guard at `:573`, which refuses a report written over `dxbc/index.json` or `spirv/index.json`: files the scan reads on the next run. That is the answer `tools/report_paths.same_report_path` exists to give, and CONTRIBUTING.md asks a report writer to call it rather than derive it again. The private copy also missed that helper's folding-volume probe, so on a Linux mount that ignores case (vfat, exFAT, CIFS) `--out INDEX.json` passed as another path and replaced the index the scan reads. The duplicated logic goes (2 insertions, 13 deletions). The tool already puts its own folder on `sys.path` for `shader_carve`, so the import is one line; nothing else in the repository imports `feature_scan.same_path`, so the name goes with the duplication. `inside_dir` keeps its own check: containment in a folder is a different question from two paths naming one file, and `report_paths` does not answer it. ### Tested - `tests/test_feature_scan.py`, `tests/test_feature_scan_bad_index.py`, `tests/test_feature_scan_code_base.py`, `tests/test_feature_scan_order.py` and `tests/test_cpu_feature_scan.py`: **42 passed**, 10 subtests passed. - `python -I tools/feature_scan.py --help`: prints its usage (the import works under `-I`). - `python -m compileall -q tools/feature_scan.py`: clean. - **Not tested:** the folding-volume case this fixes, which needs a case-folding mount (vfat/exFAT/CIFS); this machine is NTFS, where `normcase` already folds case. `tests/test_report_paths.py` covers the helper's own folding-volume answer. - No game files, no GPU; nothing was built. 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:10 +00:00
github manually merged commit 495ff9e3ec into gh-pr/1216/base 2026-11-26 09:43:12 +00:00
Author
Owner

@⁠titoreinaldo on GitHub · 2026-11-24 20:46 UTC · original

I checked the CLI with synthetic data: an empty DXBC index, a spirv directory without its optional index, and --out spirv/INDEX.json. With only the helper’s temporary case-folding lookup simulated on Linux, base writes the report (exit 0) and head 772efbb1 rejects it without writing (exit 2). Both write successfully with case-sensitive lookups. This could be a command-level regression test for the optional SPIR-V index, in addition to the helper tests. Not verified on a physical case-folding mount. AI-assisted.

**@⁠titoreinaldo** on GitHub · 2026-11-24 20:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7144042779) I checked the CLI with synthetic data: an empty DXBC index, a `spirv` directory without its optional index, and `--out spirv/INDEX.json`. With only the helper’s temporary case-folding lookup simulated on Linux, base writes the report (exit 0) and head `772efbb1` rejects it without writing (exit 2). Both write successfully with case-sensitive lookups. This could be a command-level regression test for the optional SPIR-V index, in addition to the helper tests. Not verified on a physical case-folding mount. AI-assisted.
Author
Owner

@⁠breachato on GitHub · 2026-11-24 20:48 UTC · original

@⁠titoreinaldo thanks, that is exactly the behaviour change, and I have added the command-level test you suggested.

tests/test_feature_scan.py::test_out_named_like_the_optional_spirv_index builds a shaders folder, removes the optional spirv/index.json, and calls the tool in-process with --out spirv/INDEX.json. It asserts exit 2, that the refusal names spirv/index.json, and that nothing is written. Since only the volume probe can tell INDEX.json from index.json on Linux, and a real case-folding mount (vfat/exFAT/CIFS) is not available in CI or on this machine, the probe is simulated by patching report_paths._same_resolved_name with "same folder and a name that differs only by case is one file" - the two checks the helper makes before it creates its scratch entry. On Windows the name comparison already folds case, so the test holds there too; what it pins is that the CLI refuses the pair on both paths, which the old private same_path did not.

Your other two cases stay covered where they belong: the empty/missing index inputs by test_bad_shaders_folder_is_one_line, and the existing spirv/index.json by test_out_inside_corpus_is_a_usage_error. tests/test_feature_scan.py is 13 passed, the plain-script run is OK, and the other four feature_scan suites are 30 passed, 10 subtests.

**@⁠breachato** on GitHub · 2026-11-24 20:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7144088138) @⁠titoreinaldo thanks, that is exactly the behaviour change, and I have added the command-level test you suggested. `tests/test_feature_scan.py::test_out_named_like_the_optional_spirv_index` builds a shaders folder, removes the optional `spirv/index.json`, and calls the tool in-process with `--out spirv/INDEX.json`. It asserts exit 2, that the refusal names `spirv/index.json`, and that nothing is written. Since only the volume probe can tell `INDEX.json` from `index.json` on Linux, and a real case-folding mount (vfat/exFAT/CIFS) is not available in CI or on this machine, the probe is simulated by patching `report_paths._same_resolved_name` with "same folder and a name that differs only by case is one file" - the two checks the helper makes before it creates its scratch entry. On Windows the name comparison already folds case, so the test holds there too; what it pins is that the CLI refuses the pair on both paths, which the old private `same_path` did not. Your other two cases stay covered where they belong: the empty/missing index inputs by `test_bad_shaders_folder_is_one_line`, and the existing `spirv/index.json` by `test_out_inside_corpus_is_a_usage_error`. `tests/test_feature_scan.py` is 13 passed, the plain-script run is OK, and the other four feature_scan suites are 30 passed, 10 subtests.
Author
Owner

@⁠titoreinaldo on GitHub · 2026-11-24 21:26 UTC · original

Thanks for adding the test. I ran 495ff9e3 on Windows 11 Pro 26H2 build 26300.9974. On this NTFS volume, os.path.samefile confirmed that two names differing only in case identify the same file. I removed the optional index from a fresh synthetic fixture and ran the real tools/feature_scan.py <shaders> --out <shaders>/spirv/INDEX.json command without mocks. It returned 2, named spirv/index.json in stderr, and left the output absent.

python -I -m pytest -q tests/test_feature_scan.py passed all 13 tests. This run exercised Windows’ native path comparison. Codex-assisted.

**@⁠titoreinaldo** on GitHub · 2026-11-24 21:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7144932207) Thanks for adding the test. I ran `495ff9e3` on Windows 11 Pro 26H2 build 26300.9974. On this NTFS volume, `os.path.samefile` confirmed that two names differing only in case identify the same file. I removed the optional index from a fresh synthetic fixture and ran the real `tools/feature_scan.py <shaders> --out <shaders>/spirv/INDEX.json` command without mocks. It returned 2, named `spirv/index.json` in stderr, and left the output absent. `python -I -m pytest -q tests/test_feature_scan.py` passed all 13 tests. This run exercised Windows’ native path comparison. Codex-assisted.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 02:36 UTC · original

Merging.

Why merged: feature_scan uses the shared report_paths guard instead of its own same_path, which had no other callers.

Why it's good: Own tests: 45 passed, 1 skipped.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main b4b7756e8. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 3ff2a2adc (after #984): no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

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

**@⁠QemmHD** on GitHub · 2026-11-25 02:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7150941816) Merging. **Why merged:** feature_scan uses the shared report_paths guard instead of its own same_path, which had no other callers. **Why it's good:** Own tests: 45 passed, 1 skipped. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main b4b7756e8. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 3ff2a2adc (after #984): no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.