Conversation
…#85) UpdateDescription hardcoded editableDatasetProperties, causing writes to fail for non-dataset entities. Now resolves the correct aspect name and field name from a mapping table based on the entity type in the URN.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 89.36% 89.30% -0.06%
==========================================
Files 47 47
Lines 3290 3309 +19
==========================================
+ Hits 2940 2955 +15
- Misses 226 228 +2
- Partials 124 126 +2 🚀 New features to boost your workflow:
|
- Rename editablePropertiesAspect to descriptionAspect (handles non-editable aspects too) - Use errors.New for ErrUnsupportedEntityType sentinel - Add UnmarshalJSON for symmetric serialization - Strengthen test assertions to verify preserved field values, not just existence - Document intentionally excluded entity types
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.
Closes #85.
Problem
UpdateDescription()hardcodededitableDatasetPropertiesas the aspect name (line 59) andreadEditableProperties()used the same hardcoded value (line 67). This caused DataHub to reject writes for any non-dataset entity — dashboards, glossary terms, domains, data products, containers, charts, data flows, and data jobs all failed.This blocked
apply_knowledgein mcp-data-platform from updating descriptions on non-dataset entities.Solution
Introduced a mapping table (
descriptionAspectMap) that resolves the correct aspect name and field name for each entity type extracted from the URN:editableDatasetPropertiesdescriptioneditableDashboardPropertiesdescriptioneditableChartPropertiesdescriptioneditableDataFlowPropertiesdescriptioneditableDataJobPropertiesdescriptioneditableContainerPropertiesdescriptiondataProductPropertiesdescriptiondomainPropertiesdescriptionglossaryTermInfodefinitionglossaryNodeInfodefinitionSpecial cases handled
definition, notdescription— the mapping resolves this automatically.editableprefix).tag): Return a clearErrUnsupportedEntityTypesentinel error.Key design decision
Changed
editablePropertiesAspectfrom a fixed struct to amap[string]json.RawMessagewrapper. This preserves all existing fields during read-modify-write regardless of which aspect is being updated — critical because different aspects have different schemas (e.g.,glossaryTermInfohastermSource,name,sourceRef, etc. alongsidedefinition).Changes
pkg/client/write.godescriptionAspectInfostruct anddescriptionAspectMap(10 entity types)ErrUnsupportedEntityTypesentinel errorlookupDescriptionAspect()resolver functioneditablePropertiesAspectstruct with map-based implementation +MarshalJSON()andsetDescription()methodsUpdateDescription()now resolves aspect/field vialookupDescriptionAspect()readEditableProperties()now acceptsaspectNameparameterpkg/client/write_test.goTestLookupDescriptionAspect— 12 cases covering all 10 supported types + 2 unsupportedTestUpdateDescription_EntityTypes— 5 entity types verify correct aspect name, entity type, and field name in the wire formatTestUpdateDescription_UnsupportedEntityType— verifiesErrUnsupportedEntityTypesentinelTestUpdateDescription_GlossaryTermPreservesExistingFields— verifiesdefinitionfield is used and sibling fields (termSource,name) are preserved through read-modify-writeVerification
-race -shuffle=on