Skip to content

BE-877: Add GET /entities/v1/{entityId} - #10046

Merged
TimDiekmann merged 16 commits into
mainfrom
t/be-877-api-endpoints-for-querying-entities
Oct 20, 2026
Merged

TimDiekmann merged 16 commits into
mainfrom
t/be-877-api-endpoints-for-querying-entities

Conversation

@TimDiekmann

@TimDiekmann TimDiekmann commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

🌟 Purpose

External clients need to read entities through the versioned public Graph API. This adds its first operation, GET /entities/v1/{entityId}, which returns the ID and the entity types of an entity the caller may view, and the groundwork further operations of the public and internal APIs build on.

🔍 Changes

  • Operations register through rest::routing, which admits only handlers answering with Json or a Rejection, and openapi::build accepts no other routes. It panics for two operations sharing an operationId, and drops component schemas nothing references.
  • Handlers read the store through State<ApiState>, which acquires it with the Temporal client.
  • get_entity_by_id returns None for a missing or hidden entity instead of an error, so the endpoint answers 404. An unreachable store answers 503 without naming the dependency.
  • get_entity_by_id reads through query_entities, so it masks protected properties as well and reads the policies and the entity in one read-only transaction. It now takes &mut self, as query_entities does.
  • The endpoint answers 400 for a draft's ID and 404 for an archived entity.
  • The public APIs require an API token: the middleware answers a request without a credential with 401 before a handler runs, and MaybeActor only compiles for the internal API's credentials. /entities/v1 no longer serves the caller endpoints, and /types/v1 keeps only /authenticated-caller.

⚠️ Known issues

  • The response carries only the entity's ID and its direct entity types. properties and the link endpoints follow once the encoding of link endpoints and direction is decided; adding fields later does not break clients.

@TimDiekmann TimDiekmann self-assigned this Oct 14, 2026
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hash Ready Ready Preview Oct 19, 2026 5:52pm UTC
hashdotdesign-tokens Ready Ready Preview Oct 19, 2026 5:52pm UTC
petrinaut Ready Ready Preview Oct 19, 2026 5:52pm UTC
petrinaut-docs Ready Ready Preview Oct 19, 2026 5:52pm UTC

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels Oct 14, 2026
@TimDiekmann
TimDiekmann deployed to pull-request October 14, 2026 20:26 — with GitHub Actions Active
@TimDiekmann
TimDiekmann deployed to pull-request October 14, 2026 20:26 — with GitHub Actions Active
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.48077% with 102 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.04%. Comparing base (5000b26) to head (742217e).

Files with missing lines Patch % Lines
...s-store/src/store/postgres/knowledge/entity/mod.rs 0.00% 28 Missing ⚠️
...al/graph/api/src/rest/public/entities/v1/entity.rs 75.29% 21 Missing ⚠️
libs/@local/graph/api/src/rest/router.rs 0.00% 16 Missing ⚠️
libs/@local/graph/store/rust/src/entity/store.rs 0.00% 16 Missing ⚠️
libs/@local/graph/api/src/rest/openapi/mod.rs 81.81% 7 Missing and 5 partials ⚠️
libs/@local/middleware/src/problem.rs 0.00% 6 Missing ⚠️
libs/@local/graph/api/src/rest/routing.rs 96.66% 2 Missing ⚠️
...ibs/@local/graph/api/src/rest/legacy/entity/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10046      +/-   ##
==========================================
+ Coverage   68.02%   68.04%   +0.01%     
==========================================
  Files        2000     2003       +3     
  Lines      205894   206203     +309     
  Branches     8782     8792      +10     
==========================================
+ Hits       140053   140301     +248     
- Misses      64176    64233      +57     
- Partials     1665     1669       +4     
Flag Coverage Δ
apps.hash-ai-worker-ts 6.86% <ø> (ø)
apps.hash-api 15.60% <ø> (ø)
durable-kernel 86.65% <ø> (-0.09%) ⬇️
error-stack 90.55% <ø> (ø)
harpc-codec 84.61% <ø> (ø)
harpc-net 96.26% <ø> (ø)
harpc-tower 67.11% <ø> (ø)
harpc-types 0.00% <ø> (ø)
harpc-wire-protocol 93.85% <ø> (ø)
hash-codec 72.09% <ø> (ø)
hash-config 83.57% <ø> (ø)
hash-graph 21.07% <ø> (ø)
hash-graph-api 39.82% <85.79%> (+1.97%) ⬆️
hash-graph-atlas 80.01% <ø> (+<0.01%) ⬆️
hash-graph-authentication 96.71% <ø> (ø)
hash-graph-authorization 68.47% <ø> (ø)
hash-graph-embeddings 91.92% <ø> (ø)
hash-graph-postgres-store 31.60% <0.00%> (-0.01%) ⬇️
hash-graph-store 50.82% <0.00%> (-0.12%) ⬇️
hash-graph-temporal-versioning 50.53% <ø> (ø)
hash-graph-types 0.00% <ø> (ø)
hash-graph-validation 85.37% <ø> (ø)
hash-integrations-definition 95.05% <ø> (ø)
hash-middleware 87.62% <0.00%> (-0.18%) ⬇️
hash-secret 99.50% <ø> (ø)
hashql-ast 90.01% <ø> (ø)
hashql-compiletest 28.71% <ø> (ø)
hashql-core 81.41% <ø> (ø)
hashql-diagnostics 72.85% <ø> (ø)
hashql-eval 81.55% <ø> (ø)
hashql-hir 89.10% <ø> (ø)
hashql-mir 87.22% <ø> (ø)
hashql-syntax-jexpr 94.77% <ø> (ø)
local.hash-backend-utils 6.23% <ø> (ø)
local.hash-graph-sdk 9.79% <ø> (ø)
local.hash-isomorphic-utils 31.94% <ø> (ø)
problematic 90.09% <ø> (ø)
railroad-plugin 45.28% <ø> (ø)

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.

@codspeed

codspeed Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 6 benchmarks measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. These results are not comparable, so they count as unchanged.

Preventing compiler optimizations

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 98 untouched benchmarks


Comparing t/be-877-api-endpoints-for-querying-entities (742217e) with main (d3c0347)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (5000b26) during the generation of this report, so d3c0347 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.

🔵 Needs a closer look

Shared authentication enforcement and transactional entity-read changes warrant final human review.

No open issues 🎉

What changed in this PR

Adds the first entity-read operation to the versioned public Graph API, returning an authorized entity’s ID and direct types.

Changes:

  • Adds token-authenticated entity reads with explicit draft, archive, and unavailable-store responses.
  • Routes ID lookups through permission-aware queries with protected-property masking.
  • Introduces shared API state, constrained route registration, and OpenAPI validation.
File Description
tests/​hash-backend-integration/​src/​tests/​graph/​authentication/​api-token.test.ts Tests entity access, archives, and revoked tokens.
tests/​graph/​integration/​postgres/​partial_updates.rs Adapts assertions to optional entity reads.
tests/​graph/​integration/​postgres/​lib.rs Updates the test store interface.
tests/​graph/​integration/​postgres/​entity.rs Tests missing and hidden entity reads.
tests/​graph/​integration/​postgres/​email_filter_protection.rs Tests email masking during ID lookup.
tests/​graph/​integration/​postgres/​drafts.rs Updates draft existence checks.
libs/​@local/​middleware/​src/​problem.rs Adds generic service-unavailable responses.
libs/​@local/​graph/​type-fetcher/​src/​store.rs Adapts delegated entity reads.
libs/​@local/​graph/​store/​rust/​src/​entity/​store.rs Updates read and diff contracts.
libs/​@local/​graph/​postgres-store/​tests/​deletion/​purge.rs Checks purged entities read as absent.
libs/​@local/​graph/​postgres-store/​src/​store/​postgres/​knowledge/​entity/​mod.rs Uses permission-aware queries for ID lookups.
libs/​@local/​graph/​api/​tests/​snapshots/​openapi/​types-v1.snap.json Removes anonymous caller documentation.
libs/​@local/​graph/​api/​tests/​snapshots/​openapi/​entities-v1.snap.json Documents the entity-read endpoint.
libs/​@local/​graph/​api/​src/​rest/​test_utils/​mod.rs Supplies state and unavailable-store fixtures.
libs/​@local/​graph/​api/​src/​rest/​test_utils/​authentication.rs Separates required and anonymous authentication tests.
libs/​@local/​graph/​api/​src/​rest/​state.rs Adds shared store and Temporal state.
libs/​@local/​graph/​api/​src/​rest/​routing.rs Constrains handler responses and route metadata.
libs/​@local/​graph/​api/​src/​rest/​router.rs Injects state into versioned APIs.
libs/​@local/​graph/​api/​src/​rest/​public/​types/​v1.rs Keeps only the authenticated caller route.
libs/​@local/​graph/​api/​src/​rest/​public/​types/​mod.rs Supports generic API state.
libs/​@local/​graph/​api/​src/​rest/​public/​mod.rs Threads store state through public APIs.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​v1/​mod.rs Registers entity routes.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​v1/​entity.rs Implements entity reads and response contracts.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​mod.rs Connects entity APIs to store state.
libs/​@local/​graph/​api/​src/​rest/​openapi/​tests.rs Tests operation IDs and schema pruning.
libs/​@local/​graph/​api/​src/​rest/​openapi/​mod.rs Validates routes and prunes unused schemas.
libs/​@local/​graph/​api/​src/​rest/​mod.rs Adds stateful API assembly.
libs/​@local/​graph/​api/​src/​rest/​middleware/​tests.rs Tests authentication, draft rejection, and store failures.
libs/​@local/​graph/​api/​src/​rest/​middleware/​mod.rs Requires authenticated public callers.
libs/​@local/​graph/​api/​src/​rest/​legacy/​entity/​mod.rs Uses mutable store access for diffs.
libs/​@local/​graph/​api/​src/​rest/​internal/​mod.rs Adopts stateful route construction.
libs/​@local/​graph/​api/​src/​rest/​internal/​credentials.rs Explicitly permits anonymous internal callers.
libs/​@local/​graph/​api/​src/​rest/​extract/​tests.rs Adopts constrained routing in tests.
libs/​@local/​graph/​api/​src/​rest/​extract/​snapshots/​extract-example.snap.json Removes unused parameter schemas.
libs/​@local/​graph/​api/​src/​rest/​extract/​query.rs Narrows the test-only annotation.
libs/​@local/​graph/​api/​src/​rest/​extract/​mod.rs Removes response-body tracking.
libs/​@local/​graph/​api/​src/​rest/​extract/​json.rs Delegates response enforcement to routing.
libs/​@local/​graph/​api/​src/​rest/​credentials.rs Restricts anonymous actor extraction.
libs/​@local/​graph/​api/​src/​rest/​caller.rs Splits authenticated and anonymous routes.
libs/​@local/​graph/​api/​Cargo.toml Adds schema-decoding and test dependencies.
libs/​@blockprotocol/​type-system/​rust/​src/​ontology/​id/​mod.rs Adds the versioned-URL JSON schema.
libs/​@blockprotocol/​type-system/​rust/​src/​knowledge/​entity/​id.rs Documents entity ID composition.
Cargo.toml Declares percent-encoding dependency.
Cargo.lock Records dependency updates.

Review effort: Balanced

Comment thread libs/@local/graph/api/src/rest/openapi/mod.rs
Comment thread libs/@local/graph/api/src/rest/extract/mod.rs
Comment thread libs/@local/graph/api/src/rest/extract/query.rs
Comment thread libs/@local/graph/api/src/rest/public/entities/v1/entity.rs Outdated
Comment thread libs/@local/graph/api/src/rest/state.rs
Comment thread libs/@local/graph/store/rust/src/entity/store.rs
@TimDiekmann
TimDiekmann requested a review from indietyp October 19, 2026 16:37
@TimDiekmann
TimDiekmann enabled stacked auto-merge October 19, 2026 16:37
indietyp
indietyp previously approved these changes Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

hash-graph-benches – Integrations

policy_resolution_large

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2002 $$29.4 \mathrm{ms} \pm 340 \mathrm{μs}\left({\color{gray}2.60 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.72 \mathrm{ms} \pm 32.8 \mathrm{μs}\left({\color{gray}4.57 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$13.5 \mathrm{ms} \pm 128 \mathrm{μs}\left({\color{gray}2.78 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$46.3 \mathrm{ms} \pm 561 \mathrm{μs}\left({\color{gray}1.35 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$16.3 \mathrm{ms} \pm 221 \mathrm{μs}\left({\color{red}7.56 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$25.5 \mathrm{ms} \pm 288 \mathrm{μs}\left({\color{gray}-0.377 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$30.5 \mathrm{ms} \pm 354 \mathrm{μs}\left({\color{red}5.35 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$4.06 \mathrm{ms} \pm 36.0 \mathrm{μs}\left({\color{gray}3.40 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.8 \mathrm{ms} \pm 166 \mathrm{μs}\left({\color{gray}3.51 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$4.01 \mathrm{ms} \pm 39.2 \mathrm{μs}\left({\color{gray}1.69 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.12 \mathrm{ms} \pm 26.5 \mathrm{μs}\left({\color{gray}0.029 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$3.50 \mathrm{ms} \pm 25.7 \mathrm{μs}\left({\color{gray}-0.298 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.41 \mathrm{ms} \pm 39.7 \mathrm{μs}\left({\color{gray}-0.560 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.70 \mathrm{ms} \pm 30.9 \mathrm{μs}\left({\color{gray}0.329 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$4.29 \mathrm{ms} \pm 34.5 \mathrm{μs}\left({\color{gray}-1.015 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.63 \mathrm{ms} \pm 42.6 \mathrm{μs}\left({\color{gray}0.986 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.61 \mathrm{ms} \pm 35.9 \mathrm{μs}\left({\color{gray}1.57 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.26 \mathrm{ms} \pm 47.4 \mathrm{μs}\left({\color{gray}0.817 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.80 \mathrm{ms} \pm 26.9 \mathrm{μs}\left({\color{gray}-0.619 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.61 \mathrm{ms} \pm 20.1 \mathrm{μs}\left({\color{gray}-1.102 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$2.77 \mathrm{ms} \pm 20.8 \mathrm{μs}\left({\color{gray}-0.219 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$3.05 \mathrm{ms} \pm 27.4 \mathrm{μs}\left({\color{gray}-0.969 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.83 \mathrm{ms} \pm 24.2 \mathrm{μs}\left({\color{gray}-1.132 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$3.04 \mathrm{ms} \pm 26.0 \mathrm{μs}\left({\color{gray}-0.003 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.20 \mathrm{ms} \pm 29.6 \mathrm{μs}\left({\color{gray}1.77 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.86 \mathrm{ms} \pm 28.2 \mathrm{μs}\left({\color{gray}0.012 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$3.11 \mathrm{ms} \pm 23.4 \mathrm{μs}\left({\color{gray}1.12 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.62 \mathrm{ms} \pm 37.6 \mathrm{μs}\left({\color{gray}1.36 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.14 \mathrm{ms} \pm 28.4 \mathrm{μs}\left({\color{gray}1.77 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$3.41 \mathrm{ms} \pm 32.9 \mathrm{μs}\left({\color{gray}0.180 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.53 \mathrm{ms} \pm 29.2 \mathrm{μs}\left({\color{gray}1.23 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.09 \mathrm{ms} \pm 28.9 \mathrm{μs}\left({\color{gray}-1.340 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.50 \mathrm{ms} \pm 34.9 \mathrm{μs}\left({\color{gray}1.78 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$43.6 \mathrm{ms} \pm 346 \mathrm{μs}\left({\color{gray}0.119 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$33.7 \mathrm{ms} \pm 262 \mathrm{μs}\left({\color{gray}-0.272 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$36.7 \mathrm{ms} \pm 343 \mathrm{μs}\left({\color{gray}-0.343 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$33.4 \mathrm{ms} \pm 297 \mathrm{μs}\left({\color{lightgreen}-23.598 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$44.3 \mathrm{ms} \pm 349 \mathrm{μs}\left({\color{gray}1.78 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$51.9 \mathrm{ms} \pm 511 \mathrm{μs}\left({\color{gray}0.417 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$41.9 \mathrm{ms} \pm 440 \mathrm{μs}\left({\color{gray}0.686 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$96.4 \mathrm{ms} \pm 1.16 \mathrm{ms}\left({\color{gray}1.25 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$34.8 \mathrm{ms} \pm 262 \mathrm{μs}\left({\color{lightgreen}-12.458 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$285 \mathrm{ms} \pm 2.00 \mathrm{ms}\left({\color{red}7.22 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$10.7 \mathrm{ms} \pm 107 \mathrm{μs}\left({\color{gray}-0.383 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$11.0 \mathrm{ms} \pm 139 \mathrm{μs}\left({\color{gray}0.713 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$11.1 \mathrm{ms} \pm 132 \mathrm{μs}\left({\color{gray}1.63 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$10.8 \mathrm{ms} \pm 115 \mathrm{μs}\left({\color{gray}-0.157 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$10.8 \mathrm{ms} \pm 97.2 \mathrm{μs}\left({\color{gray}-2.391 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$10.9 \mathrm{ms} \pm 120 \mathrm{μs}\left({\color{gray}0.697 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$10.9 \mathrm{ms} \pm 101 \mathrm{μs}\left({\color{gray}-0.227 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$11.0 \mathrm{ms} \pm 94.1 \mathrm{μs}\left({\color{gray}-0.555 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$11.0 \mathrm{ms} \pm 101 \mathrm{μs}\left({\color{gray}-0.163 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$11.2 \mathrm{ms} \pm 92.2 \mathrm{μs}\left({\color{gray}-0.631 \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.3 \mathrm{ms} \pm 104 \mathrm{μs}\left({\color{gray}-2.001 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$11.2 \mathrm{ms} \pm 84.3 \mathrm{μs}\left({\color{gray}-1.398 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$11.1 \mathrm{ms} \pm 85.7 \mathrm{μs}\left({\color{gray}0.450 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$11.1 \mathrm{ms} \pm 98.0 \mathrm{μs}\left({\color{gray}-1.403 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$11.2 \mathrm{ms} \pm 85.4 \mathrm{μs}\left({\color{gray}-1.077 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$11.1 \mathrm{ms} \pm 83.5 \mathrm{μs}\left({\color{gray}-0.737 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$11.2 \mathrm{ms} \pm 81.7 \mathrm{μs}\left({\color{gray}-0.174 \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 99.5 \mathrm{μs}\left({\color{gray}2.26 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$11.4 \mathrm{ms} \pm 112 \mathrm{μs}\left({\color{gray}0.107 \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.42 \mathrm{ms} \pm 70.5 \mathrm{μs}\left({\color{gray}0.274 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$59.2 \mathrm{ms} \pm 467 \mathrm{μs}\left({\color{gray}-0.598 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$115 \mathrm{ms} \pm 800 \mathrm{μs}\left({\color{gray}3.14 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$66.8 \mathrm{ms} \pm 594 \mathrm{μs}\left({\color{gray}2.09 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$76.9 \mathrm{ms} \pm 772 \mathrm{μs}\left({\color{gray}0.910 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$86.2 \mathrm{ms} \pm 798 \mathrm{μs}\left({\color{gray}2.12 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$91.9 \mathrm{ms} \pm 642 \mathrm{μs}\left({\color{gray}1.54 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$45.7 \mathrm{ms} \pm 342 \mathrm{μs}\left({\color{gray}2.32 \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.5 \mathrm{ms} \pm 776 \mathrm{μs}\left({\color{gray}1.08 \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 $$52.0 \mathrm{ms} \pm 461 \mathrm{μs}\left({\color{gray}0.596 \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 $$61.5 \mathrm{ms} \pm 502 \mathrm{μs}\left({\color{gray}-0.005 \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 $$63.7 \mathrm{ms} \pm 503 \mathrm{μs}\left({\color{gray}-0.026 \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 $$64.4 \mathrm{ms} \pm 621 \mathrm{μs}\left({\color{gray}0.176 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$112 \mathrm{ms} \pm 1.33 \mathrm{ms}\left({\color{lightgreen}-7.102 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$124 \mathrm{ms} \pm 1.23 \mathrm{ms}\left({\color{lightgreen}-6.051 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$22.0 \mathrm{ms} \pm 336 \mathrm{μs}\left({\color{red}14.0 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$521 \mathrm{ms} \pm 2.86 \mathrm{ms}\left({\color{gray}-4.598 \mathrm{\%}}\right) $$ Flame Graph

@TimDiekmann
TimDiekmann requested a review from indietyp October 19, 2026 19:48
@TimDiekmann
TimDiekmann disabled stacked auto-merge October 19, 2026 22:12
@TimDiekmann
TimDiekmann added this pull request to stack #10108 October 19, 2026 22:12
@TimDiekmann
TimDiekmann added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 50e20dd Oct 20, 2026
228 checks passed
@TimDiekmann
TimDiekmann deleted the t/be-877-api-endpoints-for-querying-entities branch October 20, 2026 09:02

This branch was successfully deployed

5 active deployments
Preview – hash — 742217e4 Deployed Oct 19, 2026 by vercel[bot]
Preview – petrinaut-docs — 742217e4 Deployed Oct 19, 2026 by vercel[bot]
Preview – hashdotdesign-tokens — 742217e4 Deployed Oct 19, 2026 by vercel[bot]
Preview – petrinaut — 742217e4 Deployed Oct 19, 2026 by vercel[bot]
pull-request — 742217e4 Deployed Oct 19, 2026 by TimDiekmann via Sourcemaps (@apps/hash-integration-worker) #40450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests 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