Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves error handling for invalid entities by collecting and surfacing validation failures instead of throwing errors. The core changes include:
- Introduced structured error tracking with
InvalidEntityandInvalidRelationEntitytypes that include both raw payload and decode errors - Modified
findOnePublicto return{ entity, invalidEntity, invalidRelationEntities }instead of throwing on validation failures - Enhanced
findManyPublicandsearchManyPublicto collect invalid entities and invalid relation entities - Added a
logInvalidResultstoggle (defaulting totrue) at both SDK and React provider levels to control console warning output - Updated React hooks to expose
invalidEntityandinvalidRelationEntitiesalongside entity data
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/hypergraph/src/utils/convert-relations.ts |
Core logic to validate relation entities during decoding and collect invalid relations instead of including them in results |
packages/hypergraph/src/entity/find-one-public.ts |
Changed to return structured result with entity/invalidEntity/invalidRelationEntities instead of throwing; added logInvalidResults parameter |
packages/hypergraph/src/entity/find-many-public.ts |
Added InvalidEntity type, enhanced parseResult to track invalid entities and relations, added logInvalidResults parameter |
packages/hypergraph/src/entity/search-many-public.ts |
Updated to return invalidRelationEntities alongside existing fields |
packages/hypergraph-react/src/HypergraphAppContext.tsx |
Added logInvalidResults prop to provider context for global configuration |
packages/hypergraph-react/src/hooks/use-entity.tsx |
Enhanced to accept and propagate logInvalidResults, returns invalidEntity and invalidRelationEntities |
packages/hypergraph-react/src/hooks/use-entities.tsx |
Enhanced to accept and propagate logInvalidResults parameter |
packages/hypergraph-react/src/hooks/use-entities-public-infinite.ts |
Added logInvalidResults parameter support |
packages/hypergraph-react/src/internal/use-entity-public.tsx |
Updated to destructure and return invalidEntity and invalidRelationEntities from findOnePublic result |
packages/hypergraph-react/src/internal/use-entity-private.tsx |
Updated type definition to use Entity.InvalidEntity |
packages/hypergraph-react/src/internal/use-entities-public.tsx |
Added logInvalidResults parameter and returns invalidRelationEntities |
packages/hypergraph/test/entity/find-one-public.test.ts |
New comprehensive tests for invalid entity and invalid relation entity handling |
packages/hypergraph/test/entity/find-many-public.test.ts |
New tests for parseResult with invalid entities and relations |
packages/hypergraph-react/test/HypergraphSpaceContext.test.tsx |
Updated tests to use waitFor for proper async assertion timing |
packages/hypergraph-react/test/HypergraphAppContext.test.tsx |
Replaced setTimeout with waitFor for more reliable test assertions |
packages/hypergraph-react/vitest.config.ts |
Added explicit test file patterns and exclusions |
docs/docs/query-public-data.md |
Updated documentation to describe invalidEntities and invalidRelationEntities return values |
docs/docs/query-private-data.md |
Updated documentation to clarify invalidEntities structure |
apps/events/src/routes/podcasts.lazy.tsx |
Uncommented example code demonstrating usage of invalidEntity and invalidRelationEntities |
.changeset/*.md |
Added changesets documenting the breaking and feature changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
No description provided.