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

Merged
breachato merged 2 commits from upstream-pr/1216 into main 2026-11-25 02:36:27 +00:00
breachato commented 2026-11-24 20:26:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by breachato on 2026-11-24T20:26:44Z.


Claimed in the coordination issue as: FEATURE-SCAN-SHARED-REPORT-PATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143542431)

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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5479769195 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1216). Originally posted by [breachato](https://github.com/breachato) on 2026-11-24T20:26:44Z. --- Claimed in the coordination issue as: FEATURE-SCAN-SHARED-REPORT-PATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143542431) 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)
titoreinaldo commented 2026-11-24 20:46:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T20:46:42Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7144042779 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7144042779). Originally posted by [titoreinaldo](https://github.com/titoreinaldo) on 2026-11-24T20:46:42Z. --- 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.
breachato commented 2026-11-24 20:48:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by breachato on 2026-11-24T20:48:43Z.


@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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7144088138 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7144088138). Originally posted by [breachato](https://github.com/breachato) on 2026-11-24T20:48:43Z. --- @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.
titoreinaldo commented 2026-11-24 21:26:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T21:26:25Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7144932207 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7144932207). Originally posted by [titoreinaldo](https://github.com/titoreinaldo) on 2026-11-24T21:26:25Z. --- 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.
QemmHD commented 2026-11-25 02:36:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T02:36:24Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7150941816 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1216#issuecomment-7150941816). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T02:36:24Z. --- 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).
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!1216
No description provided.