Reject unmatched --import/--dll selectors in import_fail_fast (FAIL-FAST-SELECTORS) #941
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/941"
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 TheGeogeo on 2026-11-24T15:23:32Z.
Claimed in the coordination issue as: FAIL-FAST-SELECTORS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135906432)
Depends on: #848 (merged). Its test
test_cli_dll_all_json_matches_documented_invocationexpected exit 0 for--dll other.dll --all --jsonon an image that does not import that DLL. This change refuses that selector with exit 2, so the second commit (0718a8a9,9eea92cabefore the rebase) updates that one expectation; the test's valid-selector checks are unchanged.What and why
tools/import_fail_fast.pypassed the raw--import/--dllvalues tofail_fast(). A selector that names nothing in the image printed0 of 0 import(s) called directlyand exited 0, and a typo beside a good selector was dropped without a word. Both read as "no call site stops the title".tools/import_call_sites.pyalready handles this, andimport_fail_fast.pyalready imports from it. This change reusesimport_selector,dll_selectorandunmatched_selectorsthe same way: a malformed selector is an argparse error (exit 2), and a well-formed selector that matches nothing printsno import matches --import .../--dll ...to stderr and returns 2 before any output.fail_fast()itself is unchanged (it still returns{}for an absent DLL).Command-line behaviour change: a malformed or unmatched
--import/--dllnow exits 2, with the error on stderr and nothing on stdout. Before, it exited 0 with the usual output.Tested
Head
0718a8a9, rebased onmaine18b59a5, same patch as9eea92ca(git range-diff); it merges cleanly withmain747809e7. Windows 11, Python 3.12.4:python -I -B tests/test_import_fail_fast.py: 14 OK;tests/test_import_call_sites.py: 21 OK. With these tests on the tool ofmaine48ff037, 4 of the 14 fail.tests/test_docs_cli_flags.py,tests/test_text_write_line_endings.py,tests/test_ctest_registration.py,tests/test_ci_registration.pyandtests/test_docs_links.py: OK.tests/test_tool_stdout_encoding.pyfails intest_every_main_block_reconfigures_stdout, as onmaine18b59a5alone (three tools this change does not touch).compileall,git diff --checkandpython -I scripts/check_no_game_data.pyon the two files: clean.Earlier head, on
main66d4f5aa, which contains #848 (9eea92ca; the tool change is the same patch as2054bc49), on Windows 11, Python 3.12.4:tests/test_import_fail_fast.py14 OK (1 failure of 14 without the updated expectation),tests/test_import_call_sites.py21 OK,tests/test_docs_links.py16 OK;test_docs_cli_flags.py,test_tool_stdout_encoding.pyandtest_text_write_line_endings.pyOK;git diff --checkand the no-game-data check clean.First run, before #848:
Run from the repository root on Windows:
python -I -B tests/test_import_fail_fast.py: 12 tests, OK (8 existing, 4 new: malformed selectors, absent selectors, a typo beside a good selector, valid selectors still exit 0).origin/main'stools/import_fail_fast.py(checked in a scratch copy with the new tests, confirmed the old tool file was the one loaded); the fourth (valid selectors) passes on both.python -I -B tests/test_import_call_sites.py: 21 tests, OK.python -m compileall -q tools/import_fail_fast.py tests/test_import_fail_fast.py: no output.git diff --check: clean.python -I scripts/check_no_game_data.py tools/import_fail_fast.py tests/test_import_fail_fast.py: exit 0.GPUs tested: n/a
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (Not applicable: no translator rule.)Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T15:26:22Z.
Review: CHANGES_REQUESTED
Reviewed exact head
2054bc4920de49959f10dae7e197903daf58d886. I reproduced the disclosed integration failure: merging #848 (f0c8d747) into this PR is textually clean, butpython3 -I tests/test_import_fail_fast.py -vthen runs 14 tests and failstest_cli_dll_all_json_matches_documented_invocation:--dll other.dll --all --jsonreturns exit 2 withno import matches --dll other.dll, while #848 asserts exit 0 and an empty imports object. This means the two open PRs cannot both merge unchanged. Please coordinate the intended empty-selector behavior with #848 and update the relevant test/docs or selector policy so the combined head passes. The isolated PR #941 tests may pass, but the combined change currently fails. No game data or GPU used.Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-24T20:52:39Z.
#848 is on
mainnow, so this branch is rebased on66d4f5aaand the conflict from the review is resolved in9eea92ca.import_call_sites.py.test_cli_dll_all_json_matches_documented_invocationnow expects that refusal for--dll other.dll --all --json. Its valid-selector checks are unchanged, anddocs/exe_fail_fast.mdonly documents a selector that matches.tests/test_import_fail_fast.pyhas 1 failure of 14 without this commit and 14 OK with it.tests/test_import_call_sites.py21 OK,tests/test_docs_links.py16 OK,test_docs_cli_flags.pyOK, data guard andgit diff --checkclean.AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-25T19:50:15Z.
Rebased from
9eea92cato0718a8a9onmaine18b59a5, same patch (git range-diff): the two commits are unchanged. The old base was whytest_ctest_registration.pyfailed in this pull request's CI (vk_host_region_import_test.cpp:341); it passes on the new base.Windows 11, Python 3.12.4:
test_import_fail_fast.py14,test_import_call_sites.py21,test_ctest_registration.py5,test_ci_registration.py16 andtest_docs_links.py16 pass,test_docs_cli_flags.pyandtest_text_write_line_endings.pytoo.test_tool_stdout_encoding.pyfails onmainalone as well (three tools this change does not touch), so the stdlib jobs may stay red for that. The changes requested in the 2026-11-24 review on2054bc49were already addressed in9eea92ca(now0718a8a9).AI-assisted: yes (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T19:42:33Z.
Merge test and review, taken from the pool PRs MoonEyes had not checked yet. Main
ec91d695cmerged without conflict; the PR's test files run with the pins oftests/requirements.txton Windows 11, Python 3.12 (venv). AI-assisted (Claude Code, Claude Opus 5.5).--import/--dllnow exits 2 with no output instead of 0. Worth a line in the description.Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T15:53:22Z.
No code change. I checked head
0718a8a9aagain against the currentmain.main, and9eea92ca(now0718a8a9) resolved it. A selector that matches nothing is refused with exit 2, the same as inimport_call_sites.py.test_cli_dll_all_json_matches_documented_invocationexpects that refusal for--dll other.dll --all --json, anddocs/exe_fail_fast.mddocuments only a selector that matches.--import/--dllexits 2, with the error on stderr and nothing on stdout. Before, it exited 0 with the usual output.Windows 11, Python 3.12.4:
python -I tests/test_import_fail_fast.pygave 14 OK.mainc1ecf04ed(clean,tools/import_fail_fast.pymerged automatically):test_import_fail_fast.py14 OKtest_import_call_sites.py26 OKtest_docs_links.py17 OKtest_docs_cli_flags.py4 OK@KernelSmoker, could you take another look?
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T00:27:04Z.
Verified by OreoFR
48bae6cad+ PR head0718a8a9a(mergegit merge --no-ff, clean)python -I tests/test_import_fail_fast.py--dll all --json)AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:22:25Z.
Merged after OreoFR's red/green check (check) (RTX 4070 Laptop, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto
main0a325350ewithout conflict, and its test file(s) (tests/test_import_fail_fast.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.