Skip to content

BE-590: hgraph: Refactor entity query handlers into entity/query submodule#8840

Open
indietyp wants to merge 17 commits into
mainfrom
bm/be-590-hgraph-entity-query-request-refactor
Open

BE-590: hgraph: Refactor entity query handlers into entity/query submodule#8840
indietyp wants to merge 17 commits into
mainfrom
bm/be-590-hgraph-entity-query-request-refactor

Conversation

@indietyp

@indietyp indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

🌟 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/query submodule hierarchy. As part of this, the old entity_query_request.rs file — 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 QueryEntitiesRequest and QueryEntitySubgraphRequest types are simpler: QueryEntitiesRequest is now a plain struct with a filter field directly (no EntityQuery enum wrapping a filter or raw HashQL value), and QueryEntitySubgraphRequest is a two-variant untagged enum (Paths / ResolveDepths) rather than four variants. The into_params and into_traversal_params methods are now on the request types themselves rather than on a separate EntityQueryOptions struct, removing an intermediate layer.

The Interactive header parameter has also been removed from the query_entities and query_entity_subgraph OpenAPI 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?

  • Converts entity.rs into entity/mod.rs and extracts query handlers into entity/query/mod.rs and request types into entity/query/request.rs.
  • Removes entity_query_request.rs and all dead code it contained: EntityQuery, EntityQueryOptions, FlatQueryEntitiesRequestData, CompilationOptions, HashQL diagnostic rendering, and the four-variant QueryEntitySubgraphRequest.
  • Replaces the EntityQuery::Filter / EntityQuery::Query split with a direct filter: Filter<'q, Entity> field on QueryEntitiesRequest.
  • Moves into_params and into_traversal_params onto QueryEntitiesRequest and QueryEntitySubgraphRequest respectively, eliminating EntityQueryOptions as a separate type.
  • Removes the Interactive header from query_entities and query_entity_subgraph handler signatures and OpenAPI docs.
  • Updates benchmark code in tests/graph/benches to use the simplified request types directly, removing the into_parts / from_parts round-trips that previously extracted an EntityQuery and EntityQueryOptions.
  • Adds unit tests in entity/query/request.rs covering deserialization of both request types, including required-field validation and correct disambiguation of the Paths vs ResolveDepths subgraph variants.

🛡 What tests cover this?

  • New unit tests in libs/@local/graph/api/src/rest/entity/query/request.rs covering minimal and fully-populated QueryEntitiesRequest deserialization, rejection of missing required fields, and correct parsing of both QueryEntitySubgraphRequest variants including edge cases around ontology vs entity traversal edges.

❓ How to test this?

  1. Checkout the branch.
  2. Run cargo test in libs/@local/graph/api.
  3. Exercise the /entities/query, /entities/query/subgraph, and /entities/query/count endpoints and confirm they behave as before.

indietyp added 3 commits June 8, 2026 12:36
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
Copilot AI review requested due to automatic review settings June 8, 2026 11:41
@cursor

cursor Bot commented Jun 8, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Breaking HTTP/OpenAPI changes (required filter, removed query and Interactive/query pagination params) plus a large refactor of core entity query routes; clients and generated SDKs must be updated.

Overview
Refactors entity query, subgraph, and summarize HTTP handlers into entity/query/ and deletes entity_query_request.rs along with the unused HashQL compilation path (EntityQuery, EntityQueryOptions, proxy deserializers, diagnostic rendering).

API contract: QueryEntitiesRequest is now a single object with a required filter (no query / filter union). QueryEntitySubgraphRequest collapses to two untagged variants (Paths / ResolveDepths) that flatten the shared fields via QueryEntitiesRequest. into_params / into_traversal_params live on those types; subgraph traversal limits are validated in the new module. The Interactive header and OpenAPI query params after / limit on query/subgraph routes are removed—cursor and limit stay in the JSON body. Regenerated openapi.json drops EntityQueryOptions and reflects the flatter schemas.

Dependencies: hash-graph-api no longer depends on hashql-* crates (Cargo.toml, package.json, lockfiles); dependency diagrams are updated accordingly.

Other: Graph query benchmarks import the new request types and call into_params_unchecked / into_traversal_params_unchecked; SearchEntitiesRequest stays on entity/mod.rs. New deserialization tests cover required fields and subgraph variant disambiguation.

Reviewed by Cursor Bugbot for commit 6daec9b. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Jul 3, 2026 4:36pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jul 3, 2026 4:36pm
petrinaut Skipped Skipped Jul 3, 2026 4:36pm

indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.76316% with 348 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.74%. Comparing base (73c646e) to head (6daec9b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../@local/graph/api/src/rest/entity/query/request.rs 53.83% 216 Missing and 7 partials ⚠️
libs/@local/graph/api/src/rest/entity/query/mod.rs 0.00% 112 Missing ⚠️
libs/@local/graph/api/src/rest/entity/mod.rs 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8840      +/-   ##
==========================================
+ Coverage   59.61%   59.74%   +0.13%     
==========================================
  Files        1366     1368       +2     
  Lines      132649   132846     +197     
  Branches     6044     6052       +8     
==========================================
+ Hits        79078    79370     +292     
+ Misses      52637    52532     -105     
- Partials      934      944      +10     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.39% <ø> (ø)
apps.hash-api 6.39% <ø> (ø)
local.hash-backend-utils 2.81% <ø> (ø)
local.hash-graph-sdk 10.00% <ø> (ø)
local.hash-isomorphic-utils 0.18% <ø> (ø)
rust.harpc-net 96.23% <ø> (+0.03%) ⬆️
rust.harpc-tower 67.03% <ø> (ø)
rust.harpc-types 0.00% <ø> (ø)
rust.hash-codec 72.76% <ø> (ø)
rust.hash-graph-api 8.23% <42.76%> (+5.69%) ⬆️
rust.hashql-ast 87.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs and request types (plus deserialization tests) to .../entity/query/request.rs.
  • Removes libs/@local/graph/api/src/rest/entity_query_request.rs and the Interactive header 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.

Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs Outdated
Copilot AI review requested due to automatic review settings June 8, 2026 12:22
@indietyp indietyp force-pushed the bm/be-587-hashql-eval-interner-and-context-restructuring branch from 233e8eb to 0f62210 Compare June 22, 2026 10:51
@indietyp indietyp force-pushed the bm/be-587-hashql-eval-interner-and-context-restructuring branch from 0f62210 to e9a1230 Compare June 22, 2026 12:02
Copilot AI review requested due to automatic review settings June 22, 2026 12:02
@indietyp indietyp force-pushed the bm/be-590-hgraph-entity-query-request-refactor branch from 5ac6afb to 7083934 Compare June 22, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / QueryEntitySubgraphRequest under entity::query, but the previous public re-exports from hash_graph_api::rest::entity::* are gone. Since hash-graph-api is 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).

Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/mod.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs Fixed
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

libs/@local/graph/api/src/rest/entity/mod.rs:226

  • This router change removes previously-exposed endpoints (/entities/search and /entities/query/summarize) and introduces /entities/query/count, but the PR description frames this as a refactor of entity query handlers and says the endpoints should behave as before. Also, the checked-in OpenAPI snapshot still contains /entities/search and /entities/query/summarize and does not contain /entities/query/count (see libs/@local/graph/api/openapi/openapi.json around the paths section). Please confirm whether these endpoints were intended to be removed/added; if so, update/regenerate the OpenAPI accordingly, and if not, restore the routes/handlers.
    libs/@local/graph/api/openapi/openapi.json:1655
  • The OpenAPI snapshot appears out of sync with the current router/handler set: it still documents /entities/query/summarize and /entities/search (operationIds summarize_entities / search_entities), and it does not document the newly-added /entities/query/count endpoint. This will break client generation and makes it unclear what the supported API surface is. Regenerate/update openapi.json from the current utoipa definitions (or restore the removed endpoints if they are still intended to exist).
          {
            "name": "after",
            "in": "query",
            "description": "The cursor to start reading from",
            "required": false,

Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Outdated
@codspeed-hq

codspeed-hq Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 15.38%

❌ 2 regressed benchmarks
✅ 78 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
bit_matrix/dense/iter_row[64] 140.8 ns 170 ns -17.16%
bit_matrix/dense/iter_row[200] 185.8 ns 215 ns -13.57%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing bm/be-590-hgraph-entity-query-request-refactor (6daec9b) with main (7ce07e4)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (253c32d) during the generation of this report, so 7ce07e4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/openapi/openapi.json Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c65837f. Configure here.

Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

libs/@local/graph/api/src/rest/entity/mod.rs:440

  • This block isn’t rustfmt-formatted (the .change_context(...) call indentation is off). The repo’s Lint workflow runs just format --check for Rust packages (.github/workflows/lint.yml:132-136), so this is likely to fail CI.

Comment thread libs/@local/graph/api/Cargo.toml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.

Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Outdated
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs Outdated
Comment thread libs/@local/graph/api/src/rest/entity/query/mod.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 38 changed files in this pull request and generated 5 comments.

Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs
Comment thread libs/@local/graph/api/src/rest/entity/query/request.rs
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Benchmark results

@rust/hash-graph-benches – Integrations

policy_resolution_large

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2002 $$28.9 \mathrm{ms} \pm 219 \mathrm{μs}\left({\color{red}12.8 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.94 \mathrm{ms} \pm 37.2 \mathrm{μs}\left({\color{red}16.1 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$14.3 \mathrm{ms} \pm 155 \mathrm{μs}\left({\color{red}17.4 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$46.8 \mathrm{ms} \pm 477 \mathrm{μs}\left({\color{red}10.9 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$17.4 \mathrm{ms} \pm 158 \mathrm{μs}\left({\color{red}22.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$27.4 \mathrm{ms} \pm 214 \mathrm{μs}\left({\color{red}16.0 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$29.1 \mathrm{ms} \pm 202 \mathrm{μs}\left({\color{red}9.44 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$4.44 \mathrm{ms} \pm 33.2 \mathrm{μs}\left({\color{red}18.8 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.1 \mathrm{ms} \pm 152 \mathrm{μs}\left({\color{red}6.13 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$5.11 \mathrm{ms} \pm 52.1 \mathrm{μs}\left({\color{red}35.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.37 \mathrm{ms} \pm 28.3 \mathrm{μs}\left({\color{red}11.5 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$4.10 \mathrm{ms} \pm 36.9 \mathrm{μs}\left({\color{red}21.1 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$6.07 \mathrm{ms} \pm 63.5 \mathrm{μs}\left({\color{red}19.2 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.60 \mathrm{ms} \pm 20.4 \mathrm{μs}\left({\color{gray}1.08 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$4.41 \mathrm{ms} \pm 45.7 \mathrm{μs}\left({\color{red}7.98 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.66 \mathrm{ms} \pm 47.9 \mathrm{μs}\left({\color{gray}-3.548 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.82 \mathrm{ms} \pm 31.6 \mathrm{μs}\left({\color{gray}3.26 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.81 \mathrm{ms} \pm 51.9 \mathrm{μs}\left({\color{red}8.03 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.74 \mathrm{ms} \pm 17.4 \mathrm{μs}\left({\color{gray}2.36 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.82 \mathrm{ms} \pm 25.0 \mathrm{μs}\left({\color{red}11.9 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$3.02 \mathrm{ms} \pm 51.8 \mathrm{μs}\left({\color{red}13.4 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$3.18 \mathrm{ms} \pm 28.6 \mathrm{μs}\left({\color{red}7.68 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.78 \mathrm{ms} \pm 13.4 \mathrm{μs}\left({\color{gray}1.57 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$3.03 \mathrm{ms} \pm 23.3 \mathrm{μs}\left({\color{gray}3.70 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$4.10 \mathrm{ms} \pm 55.8 \mathrm{μs}\left({\color{red}35.8 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.83 \mathrm{ms} \pm 46.4 \mathrm{μs}\left({\color{red}37.3 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$3.86 \mathrm{ms} \pm 52.8 \mathrm{μs}\left({\color{red}29.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$4.40 \mathrm{ms} \pm 72.6 \mathrm{μs}\left({\color{red}29.0 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.08 \mathrm{ms} \pm 29.1 \mathrm{μs}\left({\color{gray}3.85 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$4.36 \mathrm{ms} \pm 51.3 \mathrm{μs}\left({\color{red}32.2 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$4.49 \mathrm{ms} \pm 60.9 \mathrm{μs}\left({\color{red}34.3 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.88 \mathrm{ms} \pm 53.1 \mathrm{μs}\left({\color{red}31.3 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$4.10 \mathrm{ms} \pm 60.5 \mathrm{μs}\left({\color{red}23.6 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$42.6 \mathrm{ms} \pm 373 \mathrm{μs}\left({\color{gray}3.33 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$32.7 \mathrm{ms} \pm 342 \mathrm{μs}\left({\color{gray}0.732 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$35.2 \mathrm{ms} \pm 207 \mathrm{μs}\left({\color{gray}-0.776 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$50.3 \mathrm{ms} \pm 1.22 \mathrm{ms}\left({\color{red}55.4 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$43.4 \mathrm{ms} \pm 219 \mathrm{μs}\left({\color{red}5.77 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$48.1 \mathrm{ms} \pm 202 \mathrm{μs}\left({\color{gray}-0.500 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$39.8 \mathrm{ms} \pm 214 \mathrm{μs}\left({\color{gray}-0.444 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$90.6 \mathrm{ms} \pm 691 \mathrm{μs}\left({\color{gray}-0.133 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$56.1 \mathrm{ms} \pm 4.97 \mathrm{ms}\left({\color{red}70.6 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$301 \mathrm{ms} \pm 682 \mathrm{μs}\left({\color{red}19.7 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$10.4 \mathrm{ms} \pm 62.8 \mathrm{μs}\left({\color{gray}0.254 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$10.4 \mathrm{ms} \pm 58.8 \mathrm{μs}\left({\color{gray}-2.383 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$10.9 \mathrm{ms} \pm 133 \mathrm{μs}\left({\color{gray}2.39 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$10.3 \mathrm{ms} \pm 48.6 \mathrm{μs}\left({\color{gray}-1.084 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$10.4 \mathrm{ms} \pm 50.1 \mathrm{μs}\left({\color{gray}-0.968 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$10.5 \mathrm{ms} \pm 61.1 \mathrm{μs}\left({\color{gray}-0.717 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$10.4 \mathrm{ms} \pm 54.4 \mathrm{μs}\left({\color{gray}-0.380 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$10.4 \mathrm{ms} \pm 51.9 \mathrm{μs}\left({\color{gray}-2.055 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$10.6 \mathrm{ms} \pm 86.9 \mathrm{μs}\left({\color{gray}0.875 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$10.6 \mathrm{ms} \pm 50.3 \mathrm{μs}\left({\color{gray}-1.255 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$11.0 \mathrm{ms} \pm 70.3 \mathrm{μs}\left({\color{gray}1.94 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$11.0 \mathrm{ms} \pm 58.3 \mathrm{μs}\left({\color{gray}1.83 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$10.8 \mathrm{ms} \pm 48.9 \mathrm{μs}\left({\color{gray}-0.114 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$11.0 \mathrm{ms} \pm 50.6 \mathrm{μs}\left({\color{gray}1.70 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$10.9 \mathrm{ms} \pm 53.9 \mathrm{μs}\left({\color{gray}0.720 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$10.8 \mathrm{ms} \pm 55.7 \mathrm{μs}\left({\color{gray}0.280 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$11.0 \mathrm{ms} \pm 89.5 \mathrm{μs}\left({\color{gray}1.92 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$11.3 \mathrm{ms} \pm 134 \mathrm{μs}\left({\color{gray}4.33 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$10.9 \mathrm{ms} \pm 65.2 \mathrm{μs}\left({\color{gray}1.02 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba $$8.49 \mathrm{ms} \pm 46.6 \mathrm{μs}\left({\color{gray}0.802 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$60.7 \mathrm{ms} \pm 415 \mathrm{μs}\left({\color{red}12.1 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$110 \mathrm{ms} \pm 568 \mathrm{μs}\left({\color{gray}1.09 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$63.9 \mathrm{ms} \pm 375 \mathrm{μs}\left({\color{red}6.58 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$73.4 \mathrm{ms} \pm 354 \mathrm{μs}\left({\color{red}5.51 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$82.7 \mathrm{ms} \pm 401 \mathrm{μs}\left({\color{gray}4.00 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$90.7 \mathrm{ms} \pm 522 \mathrm{μs}\left({\color{gray}3.42 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$43.9 \mathrm{ms} \pm 278 \mathrm{μs}\left({\color{gray}-3.132 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$75.9 \mathrm{ms} \pm 711 \mathrm{μs}\left({\color{lightgreen}-9.527 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$50.4 \mathrm{ms} \pm 330 \mathrm{μs}\left({\color{gray}-2.996 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$60.1 \mathrm{ms} \pm 348 \mathrm{μs}\left({\color{lightgreen}-6.808 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$62.5 \mathrm{ms} \pm 340 \mathrm{μs}\left({\color{lightgreen}-11.500 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$62.4 \mathrm{ms} \pm 336 \mathrm{μs}\left({\color{lightgreen}-11.216 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$133 \mathrm{ms} \pm 564 \mathrm{μs}\left({\color{red}10.3 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$146 \mathrm{ms} \pm 649 \mathrm{μs}\left({\color{red}9.12 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$24.5 \mathrm{ms} \pm 309 \mathrm{μs}\left({\color{red}36.0 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$547 \mathrm{ms} \pm 991 \mathrm{μs}\left({\color{gray}-1.169 \mathrm{\%}}\right) $$ Flame Graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-graph area/apps area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

3 participants