-
Notifications
You must be signed in to change notification settings - Fork 88
GO-5981: Add uniqueness constraint for ApiObjectKey during type/rel/opt creation #2603
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: develop
Are you sure you want to change the base?
GO-5981: Add uniqueness constraint for ApiObjectKey during type/rel/opt creation #2603
Conversation
…d max iteration error handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a uniqueness constraint for ApiObjectKey during the creation of object types, relations, and relation options. The implementation replaces simple key injection with a uniqueness checking mechanism that automatically appends sequential suffixes when conflicts are detected.
Key changes:
- Replaced
injectApiObjectKeywithinjectAndEnsureUniqueApiObjectKeythat validates uniqueness - Added
ensureUniqueApiObjectKeymethod with conflict resolution logic - Updated creation methods for object types, relations, and relation options to use the new uniqueness-aware function
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core/block/object/objectcreator/util.go | Implements new uniqueness checking logic with sequential suffix generation |
| core/block/object/objectcreator/util_test.go | Comprehensive test coverage for the new uniqueness functionality |
| core/block/object/objectcreator/object_type.go | Updates object type creation to use uniqueness-aware key injection |
| core/block/object/objectcreator/relation.go | Updates relation creation to use uniqueness-aware key injection |
| core/block/object/objectcreator/relation_option.go | Updates relation option creation to use uniqueness-aware key injection |
Comments suppressed due to low confidence (1)
core/block/object/objectcreator/util.go:103
- [nitpick] The error message could be more actionable by suggesting potential solutions, such as 'Consider using a different base key or cleaning up unused objects with similar keys'.
return fmt.Errorf("failed to find unique apiObjectKey after %d attempts for key: %s", maxIterations, baseKey)
Coverage provided by https://github.com/seriousben/go-patch-cover-action |
…and improve batch query behavior
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
injectApiObjectKeyfunction withinjectAndEnsureUniqueApiObjectKey, which ensures that theApiObjectKeyis unique by appending sequential suffixes if necessary.createObjectType,createRelation, andcreateRelationOptionfunctions.