fix: prompt module hardening — null guard, token preflight, dead code removal#708
Merged
Conversation
… removal - Raise ConfigValidationError on prompt:null for LLM actions (was silent fallback) - Token overflow guard always runs with default 128K limit when model unknown - Wrap skipped-dep re-render in try/except for proper TemplateVariableError - Raise ConfigurationError on seed namespace collision (was warn+overwrite) - Remove dead code: _enrich_source_namespace (zero callers) - Remove dead code: replace_field_references and helpers (zero callers)
dict.get() requires str key but model_name is str | None. Use conditional expression to handle None explicitly.
…en guard - service.py: Remove try/except around re-render — inner TemplateVariableError was caught by outer except Exception handler, double-wrapping the error. UndefinedError now propagates to the rich diagnostics handler directly. - message_builder.py: Collapse 4-line ternary to single line (dict.get handles None key correctly, ternary only needed for mypy). - scope_application.py: Shorten 4-line comment to 1-line.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
ConfigValidationErroronprompt: nullfor LLM actions — was silently falling back to generic "Process the following content" promptmodel_namenot provided — previously Groq, Cohere, Gemini, and all non-json paths bypassed the check entirelyTemplateVariableError— secondUndefinedErrorwas surfacing as misleading template blameConfigurationErroron seed namespace collision — was logging warning then silently overwriting action output with static seed data_enrich_source_namespace(zero production callers, confirmed by grep)replace_field_references,resolve_field_reference,parse_field_references(zero production callers — Jinja2 templating replaced this)Verification
ruff format --check+ruff check: cleanpytest: 7483 passed, 2 skipped