fix(mapping): preserve excluded_attributes on update, backfill relationship source/target class - #178
Open
benoitcayladbx wants to merge 1 commit into
Conversation
…onship source/target class When updating an existing entity or relationship mapping, if the incoming payload omits excluded_attributes but the previous mapping had one, that list is now carried forward — previously only the general excluded flag was preserved, not the concrete list, so re-saving a mapping that had excluded attributes could silently re-include them. When resolving source_class/target_class for a relationship's consistency checks, if those fields are empty — as they always are for relationships saved via Manual Mapping, which never sends them — they're now backfilled from the corresponding ontology property's rdfs:domain/rdfs:range instead of being left empty. This is the backend counterpart to the companion Manual Mapping PR, which stops the gap from being created going forward; this fix handles mappings that already have it. Verified this applies cleanly on top of develop's schema-drift feature added to this file since 0.7.1 — the two are unrelated and don't overlap.
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.
Reopened against
0.9.0afterdevelopwas deleted. GitHub cannot reopen #152 (closed PR + missing base), so this is a successor of #152 with the same commits. Original author: @jeremiaspf. Please rebase onto current0.9.0before review — expect conflicts.What
Companion backend fix to #150 (the Manual Mapping save-state PR), in
src/back/objects/mapping/Mapping.py:excluded_attributesbut the previous mapping had one, that list is now carried forward. Previously only the generalexcludedflag was preserved this way, not the concreteexcluded_attributeslist — so re-saving a mapping that had excluded attributes could silently re-include them.source_class/target_classfor consistency checks, if those fields are empty — as they always are for relationships saved via Manual Mapping, which never sends them — they're now backfilled from the corresponding ontology property'srdfs:domain/rdfs:rangeinstead of being left empty.Why
#150 stops new Manual Mapping saves from losing
source_class/target_class/excluded_attributesgoing forward. This PR is the counterpart for mappings that already exist without them (created before #150, or from any other code path that doesn't send those fields) — the consistency check now recovers what it needs from the ontology itself rather than reporting incomplete data for an otherwise-correctly-configured relationship.A note on how this PR came together
This is a delayed follow-up to #146–#150: when we first put those together,
Mapping.pyhad since grown a substantial schema-drift feature ondevelopthat we hadn't checked our change against, so we held it back. We've now verified this patch applies cleanly on top of that feature with no overlap at all — the drift-detection code and this fix touch entirely different methods — so there was nothing to reconcile, just due diligence to do first.How to test
excluded_attributes(e.g. via a code path that omits it) — the attribute should stay excluded instead of reappearing.source_class/target_class), then run the mapping consistency check —source_class/target_classshould resolve from the property's domain/range instead of showing empty.