Skip to content

feat: refactor is_valid_expression to support AhbContext#751

Merged
hf-kklein merged 1 commit into
mainfrom
feature/remove-inject-from-evaluators
Apr 12, 2026
Merged

feat: refactor is_valid_expression to support AhbContext#751
hf-kklein merged 1 commit into
mainfrom
feature/remove-inject-from-evaluators

Conversation

@hf-kklein
Copy link
Copy Markdown
Contributor

Summary

  • is_valid_expression() now supports two modes:
    1. (New) Pass edifact_format + edifact_format_version — a fresh AhbContext is built per CER iteration automatically. No inject needed.
    2. (Legacy) Pass content_evaluation_result_setter callback — uses inject. Still works but deprecated.
  • Test file test_validity_check.py rewritten to use the new AhbContext path — removes all inject setup from these tests
  • Deprecation warnings dropped from 1560 to 96 across the full test suite

Why this matters

is_valid_expression was the last function that required inject because it iterates over all possible CERs and evaluates each one. With this change, it builds a fresh AhbContext per iteration instead of mutating global state via a setter callback.

This unblocks PR 12 (remove python-inject entirely).

Test plan

  • All 13 validity check tests pass with AhbContext path (zero inject warnings)
  • 539 total tests pass
  • pylint 10/10, isort/black clean

🤖 Generated with Claude Code

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>
@hf-kklein hf-kklein merged commit 045805d into main Apr 12, 2026
14 of 17 checks passed
@hf-kklein hf-kklein deleted the feature/remove-inject-from-evaluators branch April 12, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant