fix: require source/target roles in binary relation_members validation - #91
Merged
yifanfeng97 merged 2 commits intoSep 9, 2026
Conversation
Owner
|
Merged — thanks! 🎯 Verified locally: the runtime extractor does read This will ship in the next release. |
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.
Problem
For binary graph templates,
_check_relation_membersonly verifies that eachrelation_membersdict value names a valid edge field — it accepts arbitrary keys:But the runtime extractor (
parsers/identifiers.py) reads the roles by name:So a template like
relation_members: {from: source, to: target}(whose values are valid edge fields) passes validation and then raisesKeyError: 'source'at extraction time — precisely the failure the validator is meant to catch ahead of time.Fix
In the binary-graph branch, require the
relation_membersdict to define both asourceand atargetrole, emitting anHE-T003error for each missing one.Tests
tests/template_engine/test_validator.py: a graph template using non-standard role keys (from/to) with valid field values is now rejected withsource/targetdiagnostics. The full validator suite — includingTestPresetBootstrap, which validates every bundled preset clean — still passes (all presets already usesource/target). The new test fails on the pre-fix code.ruff check/ruff format --checkonhyperextractclean.