mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #941] Reject unmatched --import/--dll selectors in import_fail_fast (FAIL-FAST-SELECTORS) #978
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#978
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/941
Author: @TheGeogeo
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/fail-fast-selectors📝 Commits (2)
a8e334eReject unmatched --import/--dll selectors in import_fail_fast0718a8atests: expect an unmatched --dll to be refused in the documented JSON case (FAIL-FAST-SELECTORS)📊 Changes
2 files changed (+63 additions, -5 deletions)
View changed files
📝
tests/test_import_fail_fast.py(+54 -2)📝
tools/import_fail_fast.py(+9 -3)📄 Description
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).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.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.