Repository navigation
Conversation
…port Both import guards said 'not installed' for any ImportError. In darnitdevorg#573 the packages were installed: one release shipped without its module, and the other could not import a dependency. The message and its install advice pointed at the wrong cause. Say 'could not be imported' and include the original error text. Signed-off-by: Marc-cn <130138935+Marc-cn@users.noreply.github.com> Assisted-by: Claude:claude-fable-5-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two import guards report "not installed" for any
ImportError. While working on #573 that pointed at the wrong cause twice:tree-sitter-language-pack1.6.3 was installed, but its module was missingcel-pythonwas installed;celpy.c7nlibcould not importpackagingIn both cases the package was installed and the advice was wrong. This keeps the original error text:
darnit_baseline/threat_model/parsing.py: the fallbackget_language/get_parserraise "tree-sitter-language-pack could not be imported: ".darnit/sieve/cel_evaluator.py: the three guards raise "cel-python could not be imported: ".Same failures, new messages:
Follow-up to the note in #573 ("Including the original exception text in the message would help. Not changed here.").
Type of Change
Framework Changes Checklist
docs/architecture/framework-design.md) if behavior changed (message text only)uv run python scripts/validate_sync.py --verboseand it passesTesting
Tests pass locally (
uv run pytest tests/ -v): 5139 passed, 26 skipped (main: 5138)Added tests for new functionality (if applicable)
Linting passes (
uv run ruff check .)New
tests/darnit/sieve/test_cel_import_failure.py: makesimport celpyfail with a specific error and asserts the raisedCELCompilationErrorcarries it and no longer says "not installed". It fails without the fix.The parsing guard has no automated test. Its branch is marked
# pragma: no cover, and exercising it means failing a module import and reloading the module inside the test session. I checked it by hand: withtree_sitter_language_packblocked insys.modules, the message is "tree-sitter-language-pack could not be imported: import of tree_sitter_language_pack halted; None in sys.modules".No existing test asserts on the old wording.
AI assistance
Claude Fable 5.1 wrote the changes and drafted this description. I ran every command and checked the results myself. The commit carries an `Assisted-by: Claude:claude-fable-5-1 trailer.
Additional Notes
I only changed the two guards I hit and read. There may be others with the same pattern elsewhere; I did not do a full sweep.