Repository navigation
Accept KR predicate_id compatibility alias - #297
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the generic KR materialisation guard to accept a compatibility alias (predicate_id) in relationship specs, canonicalising it to predicate at the guard boundary (with conflict detection) so downstream relationship resolution/assertion sees a consistent shape.
Changes:
- Add predicate alias canonicalisation logic (
predicate_id→predicate) for both plan and resolved-relationship phases, rejecting conflicting values. - Update guard validation to apply canonicalisation only after full-batch validation (avoiding partial mutations on rejection).
- Add focused tests covering alias normalisation and conflict rejection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/backend/test_kr_materialisation_guard_service.py | Adds tests for accepting predicate_id alias, canonicalising it to predicate, and rejecting conflicts. |
| src/backend/services/kr_materialisation_guard_service.py | Implements predicate_id compatibility alias handling and canonicalisation for relationship-spec validation in both phases. |
Comment on lines
+163
to
+185
|
|
||
| plan = validate_kr_materialisation_guard( | ||
| guard_contract=_guard(), | ||
| phase="plan", | ||
| concept_specs=_concept_specs(), | ||
| relationship_specs=relationship_specs, | ||
| ) | ||
| resolved = validate_kr_materialisation_guard( | ||
| guard_contract=_guard(), | ||
| phase="resolved_relationships", | ||
| concept_specs=_concept_specs(), | ||
| relationship_specs=relationship_specs, | ||
| concept_iteration_results=_concept_results(), | ||
| resolved_relationship_specs=resolved_relationship_specs, | ||
| ) | ||
|
|
||
| assert plan["guard_passed"] is True | ||
| assert resolved["guard_passed"] is True | ||
| assert relationship_specs[0]["predicate"] == "#V#has_doctoral_programme" | ||
| assert ( | ||
| resolved_relationship_specs[0]["predicate"] | ||
| == "#V#has_doctoral_programme" | ||
| ) |
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.
Outcome
Accept the model-facing
predicate_idcompatibility alias at the generic KR materialisation guard boundary and canonicalise it topredicatebefore downstream relationship resolution/assertion.Safety boundary
predicateandpredicate_idvalues.Validation
git diff --checkpasses.Jira: JVNAUTOSCI-2592