Skip to content

BE-875: Add POST /entities/v1 - #10102

Open
TimDiekmann wants to merge 2 commits into
mainfrom
t/be-875-api-endpoints-for-creatingupdating-entities
Open

TimDiekmann wants to merge 2 commits into
mainfrom
t/be-875-api-endpoints-for-creatingupdating-entities

Conversation

@TimDiekmann

@TimDiekmann TimDiekmann commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

🌟 Purpose

Clients of the public Graph API can read an entity, but they cannot create one. This adds POST /entities/v1, which creates one or more entities in one transaction and returns them in the shape GET /entities/v1/{entityId} uses.

Properties follow the shape agreed for the public API: properties is a plain property object, and propertyMetadata is a separate tree of the same shape that gives the data type of every value. GET now returns both.

🔍 Changes

  • Request: { "entities": [{ "webId", "entityTypeIds", "properties", "propertyMetadata" }] }. propertyMetadata is required and has to cover every value. A request whose metadata does not fit its properties, or with an empty entities or entityTypeIds, is rejected while it is parsed, with a 422 that names the path.
  • Errors: creating entities reports a typed EntityCreationError instead of InsertionError, and the endpoint maps it to problem details: 403 if the caller may not create an entity or instantiate one of its types, 422 for unknown, archived or incompatible entity types and for entities that do not match their types. An entity type the caller may not view is reported like one that does not exist. That check runs before the instantiation check, so a 403 does not reveal that a type exists.
  • Legacy API: keeps its status codes. Its error messages now name the failing types or entities, and two entity types that define a property differently, or an archived type, answer 400 instead of 500.
  • Store: a failure to start the embedding workflow after the commit is logged instead of failing a request whose entities already exist. Validation reports are logged.
  • Documentation: JSON schemas for property objects, base URLs and web IDs. Scalar is updated to 1.73, which renders the nested property schemas and their examples, and is served without the previous patch.

⚠️ Known issues

  • An entity type from another domain that the type fetcher cannot load still answers 500 (BE-1024).
  • Tests that send requests through the Graph router follow in a separate PR (BE-1027).

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

vercel Bot commented Oct 19, 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 20, 2026 9:18am UTC
petrinaut Ready Ready Preview Oct 20, 2026 9:18am UTC
petrinaut-docs Ready Ready Preview Oct 20, 2026 9:18am UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 20, 2026 9:18am 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 area/tests > integration New or updated integration tests labels Oct 19, 2026
@TimDiekmann
TimDiekmann deployed to pull-request October 19, 2026 20:42 — with GitHub Actions Active
@TimDiekmann
TimDiekmann deployed to pull-request October 19, 2026 20:42 — with GitHub Actions Active
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.01%. Comparing base (50e20dd) to head (28d9812).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10102      +/-   ##
==========================================
- Coverage   68.01%   68.01%   -0.01%     
==========================================
  Files        2003     2003              
  Lines      205820   205798      -22     
  Branches     8785     8785              
==========================================
- Hits       139997   139978      -19     
+ Misses      64158    64155       -3     
  Partials     1665     1665              
Flag Coverage Δ
apps.hash-ai-worker-ts 6.85% <ø> (ø)
apps.hash-api 15.59% <ø> (ø)
local.hash-backend-utils 6.21% <ø> (ø)
local.hash-graph-sdk 9.79% <ø> (ø)
local.hash-isomorphic-utils 32.01% <ø> (ø)

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 19, 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-875-api-endpoints-for-creatingupdating-entities (28d9812) with main (d3c0347)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (50e20dd) 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. ↩

@TimDiekmann
TimDiekmann marked this pull request as ready for review October 19, 2026 22:11
@TimDiekmann
TimDiekmann requested review from a team as code owners October 19, 2026 22:11
Copilot AI balanced review requested due to automatic review settings October 19, 2026 22:11
@cursor

cursor Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Introduces a new public write API and changes entity-creation authorization/validation behavior across the postgres store and policy layer, which can affect clients and error semantics even though transactional create semantics are preserved.

Overview
Adds POST /entities/v1 so clients can create one or more entities in a single transaction, with responses matching the expanded GET shape (properties plus a parallel propertyMetadata tree keyed by property-type base URLs).

Request parsing enforces non-empty entities / entityTypeIds, requires propertyMetadata to align with properties (shape, coverage, list lengths), and documents the payload via new schemars implementations on core type-system types (Property, PropertyObject, PropertyValue, BaseUrl, WebId). Entity creation in the store now returns a dedicated EntityCreationError (unknown/invisible/archived types, forbidden instantiate/create, incompatible multi-types, validation failures) instead of generic insertion errors; invisible entity types are treated as unknown before instantiation checks. Legacy/gRPC paths keep prior status semantics but get clearer messages; embedding workflow failures after commit are logged rather than failing the client.

Scalar is bumped to scalar_api_reference 0.2.12 and served without the old optional-auth JS patch. Integration tests cover the new error paths and permission-denied expectations.

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

@TimDiekmann
TimDiekmann added this pull request to stack #10108 October 19, 2026 22:12

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.

🟡 Changes recommended

Legacy errors still expose private type existence, and the new write endpoint lacks authenticated HTTP round-trip coverage.

2 open issues
What changed in this PR

Adds transactional entity creation to the public Graph API, sharing the property and metadata response shape with GET.

Changes:

  • Adds POST /entities/v1 with request validation and typed errors.
  • Updates store error handling and post-commit workflow behavior.
  • Expands schemas, documentation, and validation tests.
File Description
tests/​hash-backend-integration/​src/​tests/​graph/​knowledge/​primitive/​entity.test.ts Asserts permission error codes.
tests/​graph/​integration/​postgres/​multi_type.rs Tests creation failures and rollback.
tests/​graph/​integration/​postgres/​lib.rs Adapts the test store interface.
libs/​problematic/​rust/​src/​aide.rs Clarifies a schema-rendering comment.
libs/​@local/​graph/​type-fetcher/​src/​store.rs Propagates typed creation errors.
libs/​@local/​graph/​store/​rust/​src/​error.rs Defines entity creation errors.
libs/​@local/​graph/​store/​rust/​src/​entity/​store.rs Updates the creation contract.
libs/​@local/​graph/​postgres-store/​src/​store/​postgres/​knowledge/​entity/​mod.rs Implements checks and revised error handling.
libs/​@local/​graph/​postgres-store/​src/​lib.rs Removes an unused feature flag.
libs/​@local/​graph/​authorization/​rust/​src/​policies/​store/​error.rs Adds missing-type errors.
libs/​@local/​graph/​authorization/​rust/​src/​policies/​components.rs Classifies missing entity types.
libs/​@local/​graph/​api/​tests/​snapshots/​openapi/​entities-v1.snap.json Updates the API schema snapshot.
libs/​@local/​graph/​api/​src/​rest/​routing.rs Removes the POST dead-code exemption.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​v1/​property_metadata.rs Converts and validates property metadata.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​v1/​mod.rs Registers POST alongside GET.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​v1/​entity.rs Returns properties and metadata.
libs/​@local/​graph/​api/​src/​rest/​public/​entities/​v1/​create.rs Implements the public creation endpoint.
libs/​@local/​graph/​api/​src/​rest/​documentation/​scalar.rs Serves Scalar without patching.
libs/​@local/​graph/​api/​src/​rest/​documentation/​mod.rs Updates panic documentation.
libs/​@blockprotocol/​type-system/​rust/​src/​principal/​actor_group/​web.rs Adds the web ID schema.
libs/​@blockprotocol/​type-system/​rust/​src/​ontology/​id/​mod.rs Adds the base URL schema.
libs/​@blockprotocol/​type-system/​rust/​src/​knowledge/​value/​mod.rs Adds the property value schema.
libs/​@blockprotocol/​type-system/​rust/​src/​knowledge/​property/​object.rs Adds the property object schema.
libs/​@blockprotocol/​type-system/​rust/​src/​knowledge/​property/​mod.rs Adds recursive property schemas.
Cargo.toml Upgrades the Scalar dependency.
Cargo.lock Records the Scalar upgrade.

Review effort: Balanced

Comment thread libs/@local/graph/api/src/rest/public/entities/v1/create.rs
Comment thread libs/@local/graph/postgres-store/src/store/postgres/knowledge/entity/mod.rs Outdated
@TimDiekmann
TimDiekmann deployed to pull-request October 19, 2026 22:39 — with GitHub Actions Active
@TimDiekmann
TimDiekmann deployed to pull-request October 19, 2026 22:39 — with GitHub Actions Active
Base automatically changed from t/be-877-api-endpoints-for-querying-entities to main October 20, 2026 09:02
@TimDiekmann
TimDiekmann force-pushed the t/be-875-api-endpoints-for-creatingupdating-entities branch from f3ed3d3 to 28d9812 Compare October 20, 2026 09:02
@TimDiekmann
TimDiekmann deployed to pull-request October 20, 2026 09:03 — with GitHub Actions Active
@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 $$20.3 \mathrm{ms} \pm 134 \mathrm{μs}\left({\color{gray}-3.614 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.67 \mathrm{ms} \pm 18.5 \mathrm{μs}\left({\color{gray}-1.840 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$10.7 \mathrm{ms} \pm 116 \mathrm{μs}\left({\color{gray}-2.606 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$34.9 \mathrm{ms} \pm 331 \mathrm{μs}\left({\color{gray}0.321 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$12.0 \mathrm{ms} \pm 94.9 \mathrm{μs}\left({\color{gray}1.38 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$20.3 \mathrm{ms} \pm 216 \mathrm{μs}\left({\color{gray}-1.431 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$21.5 \mathrm{ms} \pm 195 \mathrm{μs}\left({\color{gray}2.94 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.90 \mathrm{ms} \pm 16.7 \mathrm{μs}\left({\color{lightgreen}-5.019 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$11.4 \mathrm{ms} \pm 105 \mathrm{μs}\left({\color{gray}-2.177 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.10 \mathrm{ms} \pm 32.4 \mathrm{μs}\left({\color{gray}2.72 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.46 \mathrm{ms} \pm 16.4 \mathrm{μs}\left({\color{red}5.69 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$2.79 \mathrm{ms} \pm 21.3 \mathrm{μs}\left({\color{red}7.33 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$4.35 \mathrm{ms} \pm 55.2 \mathrm{μs}\left({\color{red}6.67 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.92 \mathrm{ms} \pm 26.8 \mathrm{μs}\left({\color{red}6.26 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$3.51 \mathrm{ms} \pm 29.8 \mathrm{μs}\left({\color{red}6.27 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$3.64 \mathrm{ms} \pm 33.6 \mathrm{μs}\left({\color{red}6.82 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.88 \mathrm{ms} \pm 30.8 \mathrm{μs}\left({\color{red}6.30 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$3.41 \mathrm{ms} \pm 33.2 \mathrm{μs}\left({\color{red}7.86 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.14 \mathrm{ms} \pm 12.8 \mathrm{μs}\left({\color{gray}0.775 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.11 \mathrm{ms} \pm 17.5 \mathrm{μs}\left({\color{gray}0.678 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$2.20 \mathrm{ms} \pm 13.9 \mathrm{μs}\left({\color{gray}1.73 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.40 \mathrm{ms} \pm 17.9 \mathrm{μs}\left({\color{gray}-0.127 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.25 \mathrm{ms} \pm 16.9 \mathrm{μs}\left({\color{gray}1.73 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.47 \mathrm{ms} \pm 16.4 \mathrm{μs}\left({\color{gray}-0.366 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$2.44 \mathrm{ms} \pm 32.3 \mathrm{μs}\left({\color{gray}1.98 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.16 \mathrm{ms} \pm 14.6 \mathrm{μs}\left({\color{gray}-2.545 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$2.32 \mathrm{ms} \pm 14.3 \mathrm{μs}\left({\color{gray}0.248 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$2.75 \mathrm{ms} \pm 22.8 \mathrm{μs}\left({\color{gray}-0.120 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.40 \mathrm{ms} \pm 17.6 \mathrm{μs}\left({\color{gray}-0.183 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$2.56 \mathrm{ms} \pm 16.9 \mathrm{μs}\left({\color{gray}-0.971 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$2.70 \mathrm{ms} \pm 30.0 \mathrm{μs}\left({\color{gray}1.28 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.36 \mathrm{ms} \pm 14.4 \mathrm{μs}\left({\color{gray}-0.908 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$2.60 \mathrm{ms} \pm 17.6 \mathrm{μs}\left({\color{gray}-1.727 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$25.3 \mathrm{ms} \pm 170 \mathrm{μs}\left({\color{gray}-2.352 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$53.9 \mathrm{ms} \pm 385 \mathrm{μs}\left({\color{gray}-3.574 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$28.3 \mathrm{ms} \pm 190 \mathrm{μs}\left({\color{gray}-0.826 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$29.9 \mathrm{ms} \pm 192 \mathrm{μs}\left({\color{gray}-1.716 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$33.5 \mathrm{ms} \pm 203 \mathrm{μs}\left({\color{gray}-3.527 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$26.4 \mathrm{ms} \pm 166 \mathrm{μs}\left({\color{gray}-3.820 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$306 \mathrm{ms} \pm 1.14 \mathrm{ms}\left({\color{lightgreen}-5.290 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$72.5 \mathrm{ms} \pm 415 \mathrm{μs}\left({\color{gray}-2.817 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$56.2 \mathrm{ms} \pm 323 \mathrm{μs}\left({\color{gray}-2.157 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$217 \mathrm{ms} \pm 1.44 \mathrm{ms}\left({\color{gray}-0.761 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$8.10 \mathrm{ms} \pm 57.8 \mathrm{μs}\left({\color{gray}-3.276 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$8.15 \mathrm{ms} \pm 55.6 \mathrm{μs}\left({\color{lightgreen}-5.687 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$8.17 \mathrm{ms} \pm 55.5 \mathrm{μs}\left({\color{lightgreen}-5.767 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$8.14 \mathrm{ms} \pm 46.2 \mathrm{μs}\left({\color{lightgreen}-5.949 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$8.23 \mathrm{ms} \pm 53.3 \mathrm{μs}\left({\color{gray}-0.883 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$8.07 \mathrm{ms} \pm 56.8 \mathrm{μs}\left({\color{gray}-0.393 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$8.18 \mathrm{ms} \pm 59.6 \mathrm{μs}\left({\color{gray}0.739 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$8.04 \mathrm{ms} \pm 45.0 \mathrm{μs}\left({\color{gray}-1.148 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$8.32 \mathrm{ms} \pm 62.3 \mathrm{μs}\left({\color{gray}0.300 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$8.53 \mathrm{ms} \pm 132 \mathrm{μs}\left({\color{gray}-1.697 \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 $$8.61 \mathrm{ms} \pm 78.2 \mathrm{μs}\left({\color{gray}3.88 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$8.73 \mathrm{ms} \pm 74.0 \mathrm{μs}\left({\color{gray}0.891 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$8.66 \mathrm{ms} \pm 63.2 \mathrm{μs}\left({\color{gray}0.500 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$8.59 \mathrm{ms} \pm 51.5 \mathrm{μs}\left({\color{gray}-0.071 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$8.66 \mathrm{ms} \pm 55.8 \mathrm{μs}\left({\color{gray}0.805 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$8.77 \mathrm{ms} \pm 71.6 \mathrm{μs}\left({\color{gray}4.48 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$8.54 \mathrm{ms} \pm 54.4 \mathrm{μs}\left({\color{gray}2.15 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$8.59 \mathrm{ms} \pm 66.9 \mathrm{μs}\left({\color{gray}1.46 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$8.80 \mathrm{ms} \pm 69.6 \mathrm{μs}\left({\color{gray}4.03 \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 $$6.13 \mathrm{ms} \pm 38.1 \mathrm{μs}\left({\color{gray}-2.475 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$45.0 \mathrm{ms} \pm 349 \mathrm{μs}\left({\color{gray}-3.791 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$84.6 \mathrm{ms} \pm 495 \mathrm{μs}\left({\color{gray}-4.183 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$50.1 \mathrm{ms} \pm 337 \mathrm{μs}\left({\color{gray}-2.304 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$56.3 \mathrm{ms} \pm 434 \mathrm{μs}\left({\color{gray}-3.619 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$63.6 \mathrm{ms} \pm 549 \mathrm{μs}\left({\color{gray}-2.521 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$70.3 \mathrm{ms} \pm 478 \mathrm{μs}\left({\color{gray}-0.356 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$36.5 \mathrm{ms} \pm 237 \mathrm{μs}\left({\color{gray}-4.922 \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 $$57.2 \mathrm{ms} \pm 409 \mathrm{μs}\left({\color{lightgreen}-6.582 \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 $$41.3 \mathrm{ms} \pm 301 \mathrm{μs}\left({\color{lightgreen}-6.519 \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 $$47.7 \mathrm{ms} \pm 219 \mathrm{μs}\left({\color{lightgreen}-8.001 \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 $$50.1 \mathrm{ms} \pm 337 \mathrm{μs}\left({\color{gray}-4.891 \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 $$49.8 \mathrm{ms} \pm 276 \mathrm{μs}\left({\color{lightgreen}-5.631 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$87.8 \mathrm{ms} \pm 426 \mathrm{μs}\left({\color{gray}-3.911 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$97.7 \mathrm{ms} \pm 522 \mathrm{μs}\left({\color{gray}-2.663 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$15.6 \mathrm{ms} \pm 112 \mathrm{μs}\left({\color{red}10.9 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$394 \mathrm{ms} \pm 1.06 \mathrm{ms}\left({\color{gray}-2.528 \mathrm{\%}}\right) $$ Flame Graph

This branch was successfully deployed

4 active deployments
Preview – hash — 28d9812c Deployed Oct 20, 2026 by vercel[bot]
Preview – petrinaut-docs — 28d9812c Deployed Oct 20, 2026 by vercel[bot]
Preview – petrinaut — 28d9812c Deployed Oct 20, 2026 by vercel[bot]
pull-request — 28d9812c Deployed Oct 20, 2026 by TimDiekmann via Sourcemaps (@apps/hash-ai-worker-ts) #40563
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.

2 participants