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 shape changes: Handlers no longer prime a HashQL heap or compile queries; they deserialize and call the store directly. Benchmarks and imports are updated for the new types; unit tests cover deserialization and subgraph variant disambiguation. Reviewed by Cursor Bugbot for commit d9ee377. 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.
2 Skipped Deployments
|
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 044a4ff. Configure here.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## bm/be-587-hashql-eval-interner-and-context-restructuring #8840 +/- ##
============================================================================================
+ Coverage 59.55% 59.73% +0.18%
============================================================================================
Files 1348 1349 +1
Lines 130870 130919 +49
Branches 5884 5891 +7
============================================================================================
+ Hits 77942 78210 +268
+ Misses 52021 51795 -226
- Partials 907 914 +7
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
82bb954 to
fa1c26d
Compare
c1e8a90 to
80d6c3c
Compare
fa1c26d to
e8db60a
Compare
80d6c3c to
710b403
Compare
e8db60a to
4a8d4fd
Compare
710b403 to
287c5b6
Compare
287c5b6 to
673f589
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tests/graph/benches/manual_queries/entity_queries/mod.rs:357
into_traversal_params_uncheckedreturnsQueryEntitySubgraphParams(not aResult), so the.expect(...)won’t compile. Use the checkedinto_traversal_paramshere if you want to preserve limit + traversal validation.
.expect("failed to read entity subgraph from store");
}
}
}


🌟 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.