feature_scan: ask report_paths for the report-path guard (FEATURE-SCAN-SHARED-REPORT-PATH) #1216
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1216"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.pycarried its ownsame_path(:532, abspath + normcase + samefile) for the--outguard at
:573, which refuses a report written overdxbc/index.jsonorspirv/index.json: files the scanreads on the next run. That is the answer
tools/report_paths.same_report_pathexists to give, andCONTRIBUTING.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.jsonpassed 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.pathforshader_carve, so the import is one line; nothing else in the repository importsfeature_scan.same_path, sothe name goes with the duplication.
inside_dirkeeps its own check: containment in a folder is a differentquestion from two paths naming one file, and
report_pathsdoes 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.pyandtests/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.machine is NTFS, where
normcasealready folds case.tests/test_report_paths.pycovers the helper's ownfolding-volume answer.
GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)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
spirvdirectory 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 head772efbb1rejects 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.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_indexbuilds a shaders folder, removes the optionalspirv/index.json, and calls the tool in-process with--out spirv/INDEX.json. It asserts exit 2, that the refusal namesspirv/index.json, and that nothing is written. Since only the volume probe can tellINDEX.jsonfromindex.jsonon Linux, and a real case-folding mount (vfat/exFAT/CIFS) is not available in CI or on this machine, the probe is simulated by patchingreport_paths._same_resolved_namewith "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 privatesame_pathdid 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 existingspirv/index.jsonbytest_out_inside_corpus_is_a_usage_error.tests/test_feature_scan.pyis 13 passed, the plain-script run is OK, and the other four feature_scan suites are 30 passed, 10 subtests.Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T21:26:25Z.
Thanks for adding the test. I ran
495ff9e3on Windows 11 Pro 26H2 build 26300.9974. On this NTFS volume,os.path.samefileconfirmed that two names differing only in case identify the same file. I removed the optional index from a fresh synthetic fixture and ran the realtools/feature_scan.py <shaders> --out <shaders>/spirv/INDEX.jsoncommand without mocks. It returned 2, namedspirv/index.jsonin stderr, and left the output absent.python -I -m pytest -q tests/test_feature_scan.pypassed all 13 tests. This run exercised Windows’ native path comparison. Codex-assisted.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 main3ff2a2adc(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).