Repository navigation
fix: diagnose naive identifiers on graph templates at create - #191
Open
dex0shubham wants to merge 2 commits into
Open
dex0shubham wants to merge 2 commits into
dex0shubham wants to merge 2 commits into
Conversation
This branch has not been deployed
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
validate_identifiers_fieldsaccepts either identifier schema (NaiveIdentifierSchema | GraphIdentifiersSchema), but after the autotype gate it readsidentifiers.entity_idunguarded.NaiveIdentifierSchemaonly carriesitem_id, so a graph-family template that uses the naive block dies with a bare attribute error:That is the same unhelpful-crash shape the 0.10.5 load-time check was added to replace — the author of the template gets no hint about what to change.
The right diagnosis already exists in the template validator (
_check_identifiers, HE-T003: " templates require entity_id, relation_id, and relation_members (not item_id)"), buthe template validateis opt-in whileTemplate.createis on every path.Fix
Guard the graph field checks with an
isinstancetest and raise the HE-T003 wording as aValueError. One check in the shared validator covers all five graph-family creators.Verified every template in the Gallery still constructs (0 failures).
Tests
tests/template_engine/test_parser_identifiers.py::TestGraphTemplateWithNaiveIdentifiers:test_naive_identifiers_rejected_with_guidance— naive identifiers on a graph type raise the guidance message (fails pre-fix withAttributeError).test_graph_identifiers_still_accepted— a well-formed graph block still passes, so the guard cannot over-reject.ruff check/ruff format --checkclean;tests/template_engine/105 passed, full suite 724 passed (the 3TestGoogleGeminiProviderfailures are pre-existing onmainwithout the optionalgoogleextra).