Repository navigation
Validate edge schema before bulk encoding - #379
Merged
Merged
Conversation
#377) Add Edge.validateAgainstSchema(EdgeSchema) which rejects: - required (nullable=false) fields that are missing or null - any field with a value that cannot be cast to its declared type (prevents the silent null coercion in DataType.cast()) Call validateAgainstSchema in BulkEdgeEncoder.bulkEncodeAll for active edges immediately after ensureType and before any byte serialization. Inactive (tombstone) edges skip validation since their properties are irrelevant for key-based deletion. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
Member
Author
|
Follow-up: the same silent null coercion affects the DML write path (nullable field type mismatch in |
5 tasks
…move continue - Rename Edge.validateAgainstSchema(EdgeSchema) to Edge.validate(EdgeSchema) for brevity; argument type already conveys what is validated against. - Replace the early-continue guard with an if/else-if block to eliminate the mid-loop control flow jump. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
em3s
removed their request for review
June 15, 2026 03:58
Contributor
|
Post-review refactoring (09c8e09):
|
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
Add schema validation in
codec-javabefore bulk encoding. Edges that violate the schema are now rejected with a descriptive error instead of being silently written as invalid active data.Closes #377
Changes
Edge.validate(EdgeSchema)(new method): iterates all declared schema fields and rejects:nullable=false) fields that are missing or nullnullcoercion inDataType.cast())BulkEdgeEncoder.bulkEncodeAll: callsvalidatefor active edges immediately afterensureTypeand before any byte encoding. Inactive (tombstone) edges skip validation since property values are irrelevant for key-based deletion.EdgeValidationTest(new): unit tests covering required-missing, required-null, required-type-mismatch, nullable-type-mismatch, and happy-path cases.BulkEdgeEncoderTests: two integration tests verifying the bulk path rejects required-null and required-missing edges end-to-end.How to Test
All existing tests continue to pass (no regression). New tests cover the failure cases from #377.
AI Assistance