Fix ClassCastException in ConstraintChecker.STORAGE_READER_CONSTRAINT_BUILDER#37
Open
tsetso-spread wants to merge 3 commits intoDozerDB:neo4j-5.26.8from
Open
Conversation
…_BUILDER Cast constraintDescriptor.schema() instead of constraintDescriptor itself to LabelSchemaDescriptor/RelationTypeSchemaDescriptor. The previous code threw ClassCastException at transaction commit time for any database with property existence constraints, since ConstraintDescriptorImplementation is not a LabelSchemaDescriptor or RelationTypeSchemaDescriptor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… enforcement Use SchemaDescriptors/ConstraintDescriptorFactory instead of mocks for schema and constraint descriptors. Add tests for checkNode violation detection, positive pass-through, label mismatch, and non-existence constraint filtering. Switch assertions to AssertJ for codebase consistency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Hey @jmsuhy , found this issue, but not sure exactly to which branch I have to merge it. Could you direct me here? |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
ClassCastExceptioninSTORAGE_READER_CONSTRAINT_BUILDERby castingconstraintDescriptor.schema()instead ofconstraintDescriptortoLabelSchemaDescriptor/RelationTypeSchemaDescriptorDetails
In
ConstraintChecker.javalines 82 and 86, the code was castingconstraintDescriptor(aConstraintDescriptorImplementation) directly toLabelSchemaDescriptor/RelationTypeSchemaDescriptor, when it should be castingconstraintDescriptor.schema()which actually returns the schema descriptor.Test plan
testStorageReaderConstraintBuilder_NodePropertyExistenceConstraint— verifies node property existence constraints don't throwClassCastExceptionand correctly populate the checkertestStorageReaderConstraintBuilder_RelPropertyExistenceConstraint— same for relationship property existence constraintsmvnw test -pl core -Dtest=ConstraintCheckerTest— 4/4 pass)🤖 Generated with Claude Code