-
Notifications
You must be signed in to change notification settings - Fork 1.6k
FIX #24374 - Data Contract at Data Product level #25314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
TypeScript types have been updated based on the JSON schema changes in the PR |
Code Review 👍 Approved with suggestions 11 resolved / 14 findingsWell-implemented data contract inheritance feature with comprehensive tests. The previous findings related to TypeScript type assertions and semantic rule deduplication by name remain unresolved. Suggestions 💡 3 suggestionsQuality: Type assertion cascades weaken TypeScript safety📄 openmetadata-ui/src/main/resources/ui/src/components/DataContract/AddDataContract/AddDataContract.tsx:1887 📄 openmetadata-ui/src/main/resources/ui/src/components/DataContract/AddDataContract/AddDataContract.tsx:1907 The frontend code uses multiple const ruleWithInherited = rule as unknown as { inherited?: boolean };
const securityWithInherited = contract.security as unknown as { inherited?: boolean };
result.termsOfUse = filteredTermsOfUse; // Implicit type assertionThese assertions bypass TypeScript's type checking and could hide bugs if the API response structure changes. Impact: If the Suggested fix: Update the generated TypeScript types to include the function hasInheritedFlag(obj: unknown): obj is { inherited?: boolean } {
return typeof obj === 'object' && obj !== null && 'inherited' in obj;
}Quality: Multiple type assertions through `unknown` reduce TypeScript safetyThe code uses (formValues.termsOfUse as unknown as { content?: string })?.content
(formValues.termsOfUse as unknown as string)While type guards are used to validate fields before accessing them, these assertions bypass TypeScript's type checking. Consider:
This would make the code more maintainable and catch type errors at compile time. Edge Case: Semantic rules deduplication uses name only, ignoring rule content📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.java In If an entity has a rule named "DataQuality" with one definition, and the data product has a rule named "DataQuality" with a different definition, the entity's rule wins entirely. This may be the intended behavior (as stated in the PR - "asset rules take precedence"), but there's no way to detect or warn about this conflict. Consider logging when a rule name collision is detected so administrators can understand why certain data product rules aren't being applied. Resolved ✅ 11 resolvedEdge Case: Unreachable code in data product iteration loop
Edge Case: DataProduct itself may call getEffectiveDataContract recursively
Bug: Missing null check for contract.termsOfUse in frontend filtering
Bug: Backend modifies entityContract directly in mergeContracts
Bug: formValues initialized once but filteredContract can change
...and 6 more from earlier reviews What Works WellStrong architecture for contract inheritance with clear separation between inherited and materialized contracts. Thorough test coverage including edge cases like multi-data-product scenarios and execution status isolation. Good UX with visual inheritance indicators and proper filtering of inherited fields during editing. Options ✅ Auto-apply✅ Auto-apply is on Gitar will commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | This comment will update automatically (Docs) |
|



Describe your changes:
FIX #24374
Untitled.mov
I worked on ... because ...
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>Summary by Gitar
termsOfUse,security, andslainherited only if empty in asset contractinheritedboolean flag toDataContract,termsOfUse,security,sla, andSemanticsRuletermsOfUsefrom string to object withcontentandinheritedfieldsgetEffectiveDataContract()inDataContractRepositorycomputes inherited contract/dataContracts/entityendpoint returns effective contract with inherited propertiesContractDetail,ContractSemantics,ContractSLAThis will update automatically on new commits.