Skip to content

BE-311: Implement entity deletion with multi-level scoping and provenance#8494

Open
TimDiekmann wants to merge 9 commits intomainfrom
t/be-311-implement-deletion-for-entities
Open

BE-311: Implement entity deletion with multi-level scoping and provenance#8494
TimDiekmann wants to merge 9 commits intomainfrom
t/be-311-implement-deletion-for-entities

Conversation

@TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

Implements filter-based entity deletion for the graph store with two scopes (Purge and Erase), draft/published partitioning, link constraint validation, temporal provenance, and concurrency-safe locking.

🔗 Related links

🔍 What does this change?

Core API

  • DeleteEntitiesParams accepts a Filter<Entity>, DeletionScope, LinkDeletionBehavior, optional decision_time, and include_drafts
  • Purge scope tombstones entity_ids with EntityDeletionProvenance (soft delete)
  • Erase scope removes entity_ids entirely (hard delete, no trace)
  • Entities matched by filter are partitioned into full targets vs draft-only targets via select_entities_for_deletion + promote_draft_only_entities
  • Satellite tables deleted in FK-safe order: entity_is_of_typeentity_embeddingsentity_temporal_metadataentity_editionsentity_draftsentity_edgeentity_ids

Concurrency safety

  • collect_entity_edition_ids acquires FOR UPDATE on entity_temporal_metadata, serializing with concurrent patch_entity (which uses FOR NO KEY UPDATE NOWAIT)
  • lock_entity_ids_for_erase acquires FOR UPDATE on entity_ids (erase only), blocking concurrent link creation via FK KEY SHARE conflict
  • All deletion methods bound to PostgresStore<Transaction<'_>> — enforced at the type level

Error variants

  • DeletionError::InvalidDecisionTime — decision time exceeds transaction time
  • DeletionError::IncomingLinksExist — incoming links block deletion
  • DeletionError::InconsistentEntityIds — entity_ids row count mismatch
  • DeletionError::Store — generic database failure

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

53 integration tests across 5 modules:

  • purge (20): basic deletion, history, batches, cross-web, drafts, tombstone provenance, archived entities, filter-by-type, large batch
  • erase (7): entity_ids removal, satellite cleanup, history, double-deletion, UUID reuse, promoted draft-only, partial draft preservation
  • links (12): incoming link blocking, cascade behavior, self-referential batches, erase-specific link handling
  • drafts (9): draft-only deletion, promotion logic, mixed targets, partial matches
  • validation (5): decision_time guards, past/future/default timestamps, temporal edition coverage

❓ How to test this?

  1. cargo test --package hash-graph-postgres-store --test deletion
  2. Confirm 53/53 tests pass

🐾 Next steps

  • Authorization check via PolicyComponents (TODO in delete_entities)
  • Consider ON DELETE CASCADE on entity_editions FKs to simplify satellite cleanup for erase scope

@vercel
Copy link

vercel bot commented Feb 27, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Feb 28, 2026 2:01pm
petrinaut Error Error Comment Feb 28, 2026 2:01pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview Feb 28, 2026 2:01pm
hashdotdesign-tokens Ignored Ignored Preview Feb 28, 2026 2:01pm

@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 Feb 27, 2026
@cursor
Copy link

cursor bot commented Feb 27, 2026

PR Summary

Medium Risk
Adds new deletion paths that physically remove entity records/edges and can erase entity_ids, so mistakes could cause data loss or FK/locking issues under concurrency despite extensive test coverage.

Overview
Implements a new filter-based entity deletion API (delete_entities) with scopes: Purge (delete all entity satellite data but keep an entity_ids tombstone) and Erase (fully remove entity_ids as well), plus include_drafts handling and a DeletionSummary response.

Adds Postgres-backed deletion execution that partitions matches into full vs draft-only targets, deletes dependent tables in FK-safe order, validates incoming-link constraints (based on LinkDeletionBehavior / scope), and uses transaction-scoped locks to serialize with concurrent patches and link creation.

Extends entity provenance with optional flattened EntityDeletionProvenance (including OpenAPI/TypeScript schema fixes), updates generated openapi.json, and adds a large integration test suite covering purge/erase/drafts/links/temporal validation plus shared DB test utilities and dependencies.

Written by Cursor Bugbot for commit 46a1015. This will update automatically on new commits. Configure here.

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 0% with 490 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.80%. Comparing base (ef314c5) to head (46a1015).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...tore/src/store/postgres/knowledge/entity/delete.rs 0.00% 483 Missing ⚠️
...s-store/src/store/postgres/knowledge/entity/mod.rs 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8494      +/-   ##
==========================================
- Coverage   63.03%   62.80%   -0.23%     
==========================================
  Files        1302     1303       +1     
  Lines      132960   133446     +486     
  Branches     5509     5509              
==========================================
+ Hits        83808    83811       +3     
- Misses      48238    48721     +483     
  Partials      914      914              
Flag Coverage Δ
apps.hash-ai-worker-ts 1.40% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-graph-sdk 7.73% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.85% <ø> (ø)
rust.hash-graph-postgres-store 26.69% <0.00%> (-0.79%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@augmentcode
Copy link

augmentcode bot commented Feb 27, 2026

🤖 Augment PR Summary

Summary: This PR adds filter-based entity deletion to the Postgres graph store, supporting both soft deletion (tombstone) and hard deletion (erase), with draft-aware behavior and provenance stamping.

Changes:

  • Introduced `DeletionScope`, `LinkDeletionBehavior`, `DeleteEntitiesParams`, and `DeletionSummary` in the store API.
  • Added `EntityDeletionProvenance` and extended `InferredEntityProvenance` to optionally include deletion actor + timestamps.
  • Implemented transactional deletion logic in the Postgres store, including FK-safe satellite table cleanup and optional removal of `entity_ids` (erase).
  • Added link-constraint validation (incoming link counting) and erase-specific locking on `entity_ids` to avoid TOCTOU FK violations.
  • Added extensive Postgres integration tests covering purge/erase semantics, links, drafts, and decision-time validation.
  • Refactored test DB setup into a shared wrapper and renamed the “delete all entities” helper.

Technical Notes: Uses row-level locks (FOR UPDATE) on entity_temporal_metadata (to serialize with concurrent patches) and on entity_ids for erase scope (to serialize with concurrent edge inserts), and merges deletion provenance into entity_ids.provenance JSONB for tombstones.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 27, 2026

Merging this PR will not alter performance

✅ 68 untouched benchmarks
🗄️ 12 archived benchmarks run1


Comparing t/be-311-implement-deletion-for-entities (46a1015) with main (ef314c5)2

Open in CodSpeed

Footnotes

  1. 12 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them.

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

…eduplicate draft IDs

- Bound deletion impl to `PostgresStore<Transaction<'_>>` to enforce
  transactional locking at the type level
- Add `FOR UPDATE` to `collect_entity_edition_ids` to serialize with
  concurrent `patch_entity` calls (`FOR NO KEY UPDATE NOWAIT` conflict)
- Keep `lock_entity_ids_for_erase` for concurrent link creation (erase only)
- Register `EntityDeletionProvenance` in OpenAPI schema components
- Deduplicate draft IDs in `select_entities_for_deletion` to prevent
  inflated `DeletionSummary.draft_deletions` counts from join duplicates
- Unify SQL string indentation
- Manual `ToSchema` impl for `InferredEntityProvenance` so utoipa
  correctly represents flattened `Option<EntityDeletionProvenance>`
  fields as optional instead of required.
- tsify patch module to generate a clean `interface` instead of a
  complex type alias (`& (EntityDeletionProvenance | {})`) that
  breaks `extends` in `EntityProvenance`.
- Use `DISTINCT ON` in `select_entities_for_deletion` via
  `SelectCompiler::add_distinct_selection_with_ordering` instead
  of manual draft ID deduplication.
Copy link

@cursor cursor bot left a comment

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.

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

serde does not support deny_unknown_fields in combination with
flatten. The nested flatten chain (EntityProvenance → InferredEntity
Provenance → EntityDeletionProvenance) caused "unknown field
createdById" during snapshot restore deserialization.
@github-actions
Copy link
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.6 \mathrm{ms} \pm 171 \mathrm{μs}\left({\color{gray}-0.629 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.60 \mathrm{ms} \pm 23.8 \mathrm{μs}\left({\color{gray}-3.193 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$13.7 \mathrm{ms} \pm 79.3 \mathrm{μs}\left({\color{gray}-4.185 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$46.3 \mathrm{ms} \pm 383 \mathrm{μs}\left({\color{gray}0.327 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$16.6 \mathrm{ms} \pm 151 \mathrm{μs}\left({\color{red}5.15 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$26.8 \mathrm{ms} \pm 226 \mathrm{μs}\left({\color{gray}3.40 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$30.1 \mathrm{ms} \pm 189 \mathrm{μs}\left({\color{gray}0.908 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$4.00 \mathrm{ms} \pm 27.1 \mathrm{μs}\left({\color{gray}1.33 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$15.1 \mathrm{ms} \pm 110 \mathrm{μs}\left({\color{gray}0.842 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$4.21 \mathrm{ms} \pm 38.4 \mathrm{μs}\left({\color{gray}4.04 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.59 \mathrm{ms} \pm 34.9 \mathrm{μs}\left({\color{red}10.9 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.72 \mathrm{ms} \pm 34.8 \mathrm{μs}\left({\color{gray}4.31 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$6.64 \mathrm{ms} \pm 57.0 \mathrm{μs}\left({\color{red}19.9 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.91 \mathrm{ms} \pm 24.9 \mathrm{μs}\left({\color{gray}1.54 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.51 \mathrm{ms} \pm 32.3 \mathrm{μs}\left({\color{gray}-0.064 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.83 \mathrm{ms} \pm 45.3 \mathrm{μs}\left({\color{gray}0.607 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.89 \mathrm{ms} \pm 34.1 \mathrm{μs}\left({\color{red}5.38 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.44 \mathrm{ms} \pm 32.1 \mathrm{μs}\left({\color{gray}1.15 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.89 \mathrm{ms} \pm 15.9 \mathrm{μs}\left({\color{gray}-1.131 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.89 \mathrm{ms} \pm 15.0 \mathrm{μs}\left({\color{gray}-0.934 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.98 \mathrm{ms} \pm 13.7 \mathrm{μs}\left({\color{gray}-2.855 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$3.24 \mathrm{ms} \pm 20.5 \mathrm{μs}\left({\color{gray}-0.796 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.04 \mathrm{ms} \pm 18.9 \mathrm{μs}\left({\color{gray}-1.909 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$3.33 \mathrm{ms} \pm 18.4 \mathrm{μs}\left({\color{gray}-2.442 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.40 \mathrm{ms} \pm 20.5 \mathrm{μs}\left({\color{gray}1.99 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.01 \mathrm{ms} \pm 16.2 \mathrm{μs}\left({\color{gray}-0.579 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$3.24 \mathrm{ms} \pm 19.5 \mathrm{μs}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.79 \mathrm{ms} \pm 21.6 \mathrm{μs}\left({\color{gray}-0.472 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.31 \mathrm{ms} \pm 19.6 \mathrm{μs}\left({\color{gray}-0.643 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.65 \mathrm{ms} \pm 22.5 \mathrm{μs}\left({\color{gray}2.97 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.79 \mathrm{ms} \pm 24.6 \mathrm{μs}\left({\color{gray}1.10 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.40 \mathrm{ms} \pm 23.2 \mathrm{μs}\left({\color{gray}2.32 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.76 \mathrm{ms} \pm 23.4 \mathrm{μs}\left({\color{gray}3.87 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$44.8 \mathrm{ms} \pm 225 \mathrm{μs}\left({\color{gray}2.25 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$84.5 \mathrm{ms} \pm 446 \mathrm{μs}\left({\color{gray}3.30 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$50.3 \mathrm{ms} \pm 325 \mathrm{μs}\left({\color{gray}4.54 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$52.0 \mathrm{ms} \pm 309 \mathrm{μs}\left({\color{gray}2.23 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$61.5 \mathrm{ms} \pm 438 \mathrm{μs}\left({\color{gray}1.05 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$46.4 \mathrm{ms} \pm 232 \mathrm{μs}\left({\color{gray}0.809 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$433 \mathrm{ms} \pm 1.06 \mathrm{ms}\left({\color{gray}2.98 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$95.6 \mathrm{ms} \pm 463 \mathrm{μs}\left({\color{lightgreen}-5.805 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$92.6 \mathrm{ms} \pm 370 \mathrm{μs}\left({\color{gray}2.73 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$294 \mathrm{ms} \pm 964 \mathrm{μs}\left({\color{gray}0.495 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$16.9 \mathrm{ms} \pm 84.9 \mathrm{μs}\left({\color{gray}1.91 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$16.6 \mathrm{ms} \pm 91.5 \mathrm{μs}\left({\color{gray}-0.544 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$17.0 \mathrm{ms} \pm 106 \mathrm{μs}\left({\color{gray}0.059 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$16.6 \mathrm{ms} \pm 87.0 \mathrm{μs}\left({\color{gray}0.895 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$19.9 \mathrm{ms} \pm 120 \mathrm{μs}\left({\color{gray}-1.230 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$16.6 \mathrm{ms} \pm 83.7 \mathrm{μs}\left({\color{gray}-2.629 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$16.3 \mathrm{ms} \pm 88.2 \mathrm{μs}\left({\color{gray}-3.850 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$16.4 \mathrm{ms} \pm 82.4 \mathrm{μs}\left({\color{gray}-3.260 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$17.0 \mathrm{ms} \pm 98.2 \mathrm{μs}\left({\color{gray}-2.955 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$24.6 \mathrm{ms} \pm 169 \mathrm{μs}\left({\color{gray}-3.419 \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 $$33.6 \mathrm{ms} \pm 397 \mathrm{μs}\left({\color{gray}2.38 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$32.1 \mathrm{ms} \pm 352 \mathrm{μs}\left({\color{gray}0.908 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$32.7 \mathrm{ms} \pm 340 \mathrm{μs}\left({\color{gray}1.00 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$33.7 \mathrm{ms} \pm 305 \mathrm{μs}\left({\color{red}6.29 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$32.6 \mathrm{ms} \pm 309 \mathrm{μs}\left({\color{gray}-2.385 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$32.8 \mathrm{ms} \pm 298 \mathrm{μs}\left({\color{gray}-0.846 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$33.2 \mathrm{ms} \pm 315 \mathrm{μs}\left({\color{gray}0.195 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$32.3 \mathrm{ms} \pm 280 \mathrm{μs}\left({\color{gray}-3.330 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$32.3 \mathrm{ms} \pm 280 \mathrm{μs}\left({\color{gray}-1.748 \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 $$9.19 \mathrm{ms} \pm 56.6 \mathrm{μs}\left({\color{gray}-2.834 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$97.6 \mathrm{ms} \pm 525 \mathrm{μs}\left({\color{gray}-1.478 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$152 \mathrm{ms} \pm 710 \mathrm{μs}\left({\color{gray}0.679 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$103 \mathrm{ms} \pm 515 \mathrm{μs}\left({\color{gray}-1.769 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$111 \mathrm{ms} \pm 550 \mathrm{μs}\left({\color{gray}-1.641 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$121 \mathrm{ms} \pm 573 \mathrm{μs}\left({\color{gray}-1.035 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$130 \mathrm{ms} \pm 651 \mathrm{μs}\left({\color{gray}1.22 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$93.5 \mathrm{ms} \pm 490 \mathrm{μs}\left({\color{gray}2.47 \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 $$125 \mathrm{ms} \pm 534 \mathrm{μs}\left({\color{gray}1.52 \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 $$100 \mathrm{ms} \pm 687 \mathrm{μs}\left({\color{gray}1.21 \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 $$108 \mathrm{ms} \pm 530 \mathrm{μs}\left({\color{gray}-0.109 \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 $$111 \mathrm{ms} \pm 636 \mathrm{μs}\left({\color{gray}0.939 \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 $$111 \mathrm{ms} \pm 595 \mathrm{μs}\left({\color{gray}-0.117 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$142 \mathrm{ms} \pm 539 \mathrm{μs}\left({\color{gray}4.32 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$141 \mathrm{ms} \pm 574 \mathrm{μs}\left({\color{red}5.06 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$127 \mathrm{ms} \pm 592 \mathrm{μs}\left({\color{red}18.4 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$585 \mathrm{ms} \pm 1.12 \mathrm{ms}\left({\color{gray}-4.942 \mathrm{\%}}\right) $$ Flame Graph

@graphite-app graphite-app bot requested review from a team February 28, 2026 18:46
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 New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

1 participant