feat: refactor is_valid_expression to support AhbContext#751
Merged
Conversation
is_valid_expression now builds a fresh AhbContext per CER iteration when edifact_format and edifact_format_version are provided, eliminating the need for inject + setter callback for this function. The legacy setter-based path is preserved for backward compatibility but is no longer used by the updated tests. This removes the last inject usage from the test suite's validity checks, reducing deprecation warnings from 1560 to 96 (only remaining inject-based tests in other files). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
is_valid_expression()now supports two modes:edifact_format+edifact_format_version— a freshAhbContextis built per CER iteration automatically. No inject needed.content_evaluation_result_settercallback — uses inject. Still works but deprecated.test_validity_check.pyrewritten to use the new AhbContext path — removes all inject setup from these testsWhy this matters
is_valid_expressionwas the last function that required inject because it iterates over all possible CERs and evaluates each one. With this change, it builds a freshAhbContextper iteration instead of mutating global state via a setter callback.This unblocks PR 12 (remove python-inject entirely).
Test plan
🤖 Generated with Claude Code