BE-590: hgraph: Refactor entity query handlers into entity/query submodule#8840
Conversation
chore: add new dependency chore: format feat: error module feat: introduce hashql_eval interner chore: checkpoint feat: checkpoint feat: checkpoint chore: remove old value module feat: checkpoint feat: checkpoint feat: checkpoint feat: checkpoint feat: checkpoint chore: checkpoint feat: move entity query into its own modul fix: query request feat: checkpoint (it compiles!) feat: checkpoint feat: checkpoint feat: checkpoint fix: issue around cached thunking feat: covariance for opaque inners fix: cfgattr serde chore: remove graph module fix: merge fuckup
PR SummaryMedium Risk Overview API contract: Runtime: Handlers no longer prime a HashQL heap, compile queries, or honor Reviewed by Cursor Bugbot for commit 82d14fd. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## bm/be-587-hashql-eval-interner-and-context-restructuring #8840 +/- ##
=========================================================================================
Coverage 59.58% 59.58%
=========================================================================================
Files 1349 1349
Lines 131875 131875
Branches 5946 5946
=========================================================================================
Hits 78574 78574
Misses 52393 52393
Partials 908 908
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Refactors the entity query REST API by moving query request types and handlers into a dedicated rest/entity/query submodule, while removing the legacy entity_query_request.rs module (including dead/unused HashQL-related code paths). This simplifies the request shapes (direct filter struct field; two-variant subgraph request) and updates benchmarks accordingly.
Changes:
- Extracts entity query handlers to
libs/@local/graph/api/src/rest/entity/query/mod.rsand request types (plus deserialization tests) to.../entity/query/request.rs. - Removes
libs/@local/graph/api/src/rest/entity_query_request.rsand theInteractiveheader from entity query OpenAPI definitions/handlers. - Updates manual benchmark scaffolding to use the new request types and APIs directly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/graph/benches/manual_queries/entity_queries/mod.rs | Updates benchmarks to use the refactored request types and the new into_*params APIs. |
| libs/@local/graph/api/src/rest/mod.rs | Drops the old entity_query_request module inclusion. |
| libs/@local/graph/api/src/rest/entity/query/request.rs | Introduces simplified request types and adds unit tests for deserialization/variant disambiguation. |
| libs/@local/graph/api/src/rest/entity/query/mod.rs | Adds extracted handlers and updated OpenAPI path definitions without the Interactive header. |
| libs/@local/graph/api/src/rest/entity/mod.rs | Wires the new submodule into routing and OpenAPI, removing the inlined legacy handlers/types. |
| libs/@local/graph/api/src/rest/entity_query_request.rs | Removes the legacy request module (dead HashQL/proxy-related code). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
044a4ff to
c1e8a90
Compare
8af8844 to
82bb954
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8a4c804. Configure here.
8a4c804 to
877c368
Compare
90ab940 to
7cb3ed3
Compare
877c368 to
3de4e61
Compare
7cb3ed3 to
233e8eb
Compare
3de4e61 to
5ac6afb
Compare
233e8eb to
0f62210
Compare
0f62210 to
e9a1230
Compare
5ac6afb to
7083934
Compare
| params( | ||
| ("X-Authenticated-User-Actor-Id" = ActorEntityUuid, Header, description = "The ID of the actor which is used to authorize the request"), | ||
| ("after" = Option<String>, Query, description = "The cursor to start reading from"), | ||
| ("limit" = Option<usize>, Query, description = "The maximum number of entities to read"), | ||
| ), |
| params( | ||
| ("X-Authenticated-User-Actor-Id" = ActorEntityUuid, Header, description = "The ID of the actor which is used to authorize the request"), | ||
| ("after" = Option<String>, Query, description = "The cursor to start reading from"), | ||
| ("limit" = Option<usize>, Query, description = "The maximum number of entities to read"), | ||
| ), |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
libs/@local/graph/api/src/rest/entity/mod.rs:4
- This refactor moves
QueryEntitiesRequest/QueryEntitySubgraphRequestunderentity::query, but the previous public re-exports fromhash_graph_api::rest::entity::*are gone. Sincehash-graph-apiis a published crate, this is a breaking Rust API change for downstream users even though HTTP behavior is unchanged.
Consider re-exporting the request/error types from entity to preserve the old import path (or add a deprecation cycle if you want to force the new path).


🌟 What is the purpose of this PR?
The entity query request types and their associated HTTP handler functions have been refactored out of a single flat module into a dedicated
entity/querysubmodule hierarchy. As part of this, the oldentity_query_request.rsfile — which contained a large amount of dead code related to a planned HashQL integration, proxy deserialization structs, and a four-variant subgraph enum — has been removed entirely.The new
QueryEntitiesRequestandQueryEntitySubgraphRequesttypes are simpler:QueryEntitiesRequestis now a plain struct with afilterfield directly (noEntityQueryenum wrapping a filter or raw HashQL value), andQueryEntitySubgraphRequestis a two-variant untagged enum (Paths/ResolveDepths) rather than four variants. Theinto_paramsandinto_traversal_paramsmethods are now on the request types themselves rather than on a separateEntityQueryOptionsstruct, removing an intermediate layer.The
Interactiveheader parameter has also been removed from thequery_entitiesandquery_entity_subgraphOpenAPI path definitions, as it was only relevant to the HashQL compilation path that no longer exists in these handlers.🔗 Related links
🔍 What does this change?
entity.rsintoentity/mod.rsand extracts query handlers intoentity/query/mod.rsand request types intoentity/query/request.rs.entity_query_request.rsand all dead code it contained:EntityQuery,EntityQueryOptions,FlatQueryEntitiesRequestData,CompilationOptions, HashQL diagnostic rendering, and the four-variantQueryEntitySubgraphRequest.EntityQuery::Filter/EntityQuery::Querysplit with a directfilter: Filter<'q, Entity>field onQueryEntitiesRequest.into_paramsandinto_traversal_paramsontoQueryEntitiesRequestandQueryEntitySubgraphRequestrespectively, eliminatingEntityQueryOptionsas a separate type.Interactiveheader fromquery_entitiesandquery_entity_subgraphhandler signatures and OpenAPI docs.tests/graph/benchesto use the simplified request types directly, removing theinto_parts/from_partsround-trips that previously extracted anEntityQueryandEntityQueryOptions.entity/query/request.rscovering deserialization of both request types, including required-field validation and correct disambiguation of thePathsvsResolveDepthssubgraph variants.🛡 What tests cover this?
libs/@local/graph/api/src/rest/entity/query/request.rscovering minimal and fully-populatedQueryEntitiesRequestdeserialization, rejection of missing required fields, and correct parsing of bothQueryEntitySubgraphRequestvariants including edge cases around ontology vs entity traversal edges.❓ How to test this?
cargo testinlibs/@local/graph/api./entities/query,/entities/query/subgraph, and/entities/query/countendpoints and confirm they behave as before.