Skip to content

BE-585, BE-591: HashQL: Add MIR interpreter test suite and refactor diagnostic categories#8837

Merged
indietyp merged 8 commits into
mainfrom
bm/be-585-hashql-split-mir-interpret-diagnostic-api
Jun 24, 2026
Merged

BE-585, BE-591: HashQL: Add MIR interpreter test suite and refactor diagnostic categories#8837
indietyp merged 8 commits into
mainfrom
bm/be-585-hashql-split-mir-interpret-diagnostic-api

Conversation

@indietyp

@indietyp indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

This PR wires up the MIR interpreter so it can be exercised end-to-end through the compiletest suite, and restructures the diagnostic category hierarchy so that interpreter errors and bridge (PostgreSQL suspension) errors are unified under a single OrchestratorDiagnosticCategory type rather than being conflated under InterpretDiagnosticCategory.

Previously, bridge errors (query execution failures, row decoding, parameter encoding, etc.) were emitted as InterpretDiagnostic values with a Suspension subcategory bolted onto InterpretDiagnosticCategory. This made it impossible for downstream consumers to distinguish interpreter ICEs from orchestrator bridge failures. The new OrchestratorDiagnosticCategory enum has two variants — Interpret (forwarding interpreter errors) and Bridge (wrapping suspension failures) — giving callers a coherent, single diagnostic type from the orchestration layer.

On the interpreter side, RuntimeError::into_diagnostic is split into into_diagnostic (same category, InterpretDiagnosticCategory) and into_diagnostic_with (maps the category through a caller-supplied closure), enabling the orchestrator to embed interpreter diagnostics inside its own hierarchy without losing information.

A new mir/interpret compiletest suite is added that runs the full pipeline through the MIR interpreter and captures the output, with an initial test demonstrating that field projection through an opaque wrapper is not yet supported.

Additionally, StructBuilder::finish now accepts &InternSet<[Symbol]> directly instead of &Interner, Struct::new_unchecked is marked unsafe with documented safety requirements, all interpreter diagnostic severities are migrated from Severity::Bug/Severity::Error to Critical::BUG/Critical::ERROR, and comprehensive doc-examples are added across the interpreter value types (Dict, List, Struct, Tuple, Opaque, Ptr, Str, Num).

🔍 What does this change?

  • Introduces OrchestratorDiagnosticCategory with Interpret and Bridge variants, replacing the previous use of InterpretDiagnosticCategory::Suspension for bridge errors.
  • Adds BridgeDiagnosticCategory as the subcategory for suspension-fulfillment failures, replacing SuspensionDiagnosticCategory.
  • Removes SuspensionDiagnosticCategory and the Suspension variant from InterpretDiagnosticCategory.
  • Splits RuntimeError::into_diagnostic into into_diagnostic (identity category mapping) and into_diagnostic_with (caller-supplied category mapping), allowing the orchestrator to lift interpreter diagnostics into its own hierarchy.
  • Changes InterpretDiagnostic default severity kind from Severity to Critical, and migrates all diagnostic constructors from Severity::Bug/Severity::Error to Critical::BUG/Critical::ERROR.
  • Makes Struct::new_unchecked unsafe, documenting that callers must ensure fields are sorted; updates all call sites with unsafe blocks and safety comments.
  • Strengthens Struct::new to also reject unsorted field slices.
  • Changes StructBuilder::finish to accept &InternSet<'heap, [Symbol<'heap>]> instead of &Interner, narrowing the dependency.
  • Adds a mir/interpret compiletest suite that runs the interpreter and captures MIR as a secondary output.
  • Adds an initial interpreter test (access-struct-through-opaque) that documents the current limitation of projecting through opaque wrappers.
  • Exposes ReifyDiagnosticCategory, ReifyDiagnostic, and ReifyDiagnosticIssues publicly and adds MirDiagnosticCategory::Reify variant.
  • Adds Opaque::into_value, From<Symbol> for Str, and TryCloneIn for Str.
  • Adds #[inline] annotations and comprehensive doc-examples across interpreter value types.

🛡 What tests cover this?

  • New mir/interpret compiletest suite with access-struct-through-opaque as the first test case, covering the interpreter pipeline end-to-end.
  • Existing StructBuilder unit tests updated to use the new finish signature.
  • Existing interpreter unit tests updated for unsafe Struct::new_unchecked call sites.

❓ How to test this?

  1. Run the compiletest suite targeting mir/interpret.
  2. Confirm the access-struct-through-opaque test produces the expected stderr output showing the interpret::type-invariant diagnostic.
  3. Run the existing MIR interpreter unit tests to confirm no regressions.

indietyp added 5 commits June 8, 2026 11:58
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
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

Medium Risk
Diagnostic type and category changes ripple through eval/orchestrator and compiletest; struct invariants and finish signature updates are widespread but mechanical.

Overview
Adds a mir/interpret compiletest suite that lowers through post-inline MIR, runs the interpreter (suspensions still unimplemented!()), and records MIR as a secondary artifact. The first UI test documents a known failure when projecting struct fields through an opaque wrapper.

Orchestrator diagnostics are split from interpreter diagnostics: bridge/PostgreSQL failures use OrchestratorDiagnosticCategory (Interpret vs Bridge) instead of InterpretDiagnosticCategory::Suspension. RuntimeError::into_diagnostic_with lets the orchestrator lift interpreter errors into that hierarchy; run_in now returns OrchestratorDiagnostic.

Interpreter ICEs move to Critical::BUG / Critical::ERROR. Struct::new_unchecked is unsafe with sorted-field invariants; StructBuilder::finish takes &InternSet (call sites use interner.symbols). Reify diagnostics are public under MirDiagnosticCategory::Reify, plus doc examples and small value-type API additions (Opaque::into_value, Str cloning).

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

@github-actions github-actions Bot added 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 Jun 8, 2026
@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 Jun 23, 2026 9:49am
petrinaut Ready Ready Preview Jun 23, 2026 9:49am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jun 23, 2026 9:49am

indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.46429% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.59%. Comparing base (da532c2) to head (1b21029).

Files with missing lines Patch % Lines
libs/@local/hashql/eval/src/orchestrator/error.rs 0.00% 56 Missing ⚠️
libs/@local/hashql/mir/src/interpret/error.rs 90.00% 10 Missing ⚠️
libs/@local/hashql/mir/src/interpret/value/str.rs 50.00% 10 Missing ⚠️
libs/@local/hashql/eval/src/orchestrator/mod.rs 33.33% 4 Missing ⚠️
...bs/@local/hashql/mir/src/interpret/value/struct.rs 96.82% 4 Missing ⚠️
...ibs/@local/hashql/eval/src/orchestrator/partial.rs 88.88% 1 Missing ⚠️
libs/@local/hashql/mir/src/error.rs 0.00% 1 Missing ⚠️
...ibs/@local/hashql/mir/src/interpret/value/tuple.rs 97.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8837      +/-   ##
==========================================
+ Coverage   59.25%   59.59%   +0.33%     
==========================================
  Files        1347     1348       +1     
  Lines      131082   131876     +794     
  Branches     5946     5946              
==========================================
+ Hits        77677    78587     +910     
+ Misses      52499    52384     -115     
+ Partials      906      905       -1     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.39% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-backend-utils 2.82% <ø> (ø)
local.hash-graph-sdk 9.63% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.52% <ø> (ø)
rust.hashql-compiletest 28.24% <ø> (ø)
rust.hashql-eval 75.23% <14.08%> (-0.49%) ⬇️
rust.hashql-mir 88.45% <94.68%> (+1.39%) ⬆️

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

This PR wires the MIR interpreter into the compiletest harness for end-to-end execution tests, and refactors diagnostic category/severity plumbing so orchestration-layer (“bridge”) errors are no longer conflated with interpreter diagnostics. It also tightens/clarifies interpreter value invariants (notably struct field ordering), adds an initial mir/interpret UI test, and expands docs/examples across interpreter value types.

Changes:

  • Add a new mir/interpret compiletest suite that runs MIR through the interpreter and emits MIR as a secondary .mir output.
  • Introduce an orchestrator-level diagnostic category (OrchestratorDiagnosticCategory) that cleanly distinguishes interpreter errors from bridge (PostgreSQL suspension) failures.
  • Harden interpreter value APIs (e.g., Struct::new_unchecked becomes unsafe, Struct::new rejects unsorted fields; StructBuilder::finish takes &InternSet<[Symbol]>) and expand doc-examples/inline hints.

Reviewed changes

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

Show a summary per file
File Description
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.stderr Expected stderr for the first MIR interpreter UI test.
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.jsonc New UI test case exercising interpreter end-to-end behavior.
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.aux.mir Secondary output snapshot of MIR for the UI test.
libs/@local/hashql/mir/tests/ui/interpret/.spec.toml Declares the new mir/interpret compiletest suite.
libs/@local/hashql/mir/src/reify/mod.rs Re-exports reify diagnostics publicly from the MIR crate.
libs/@local/hashql/mir/src/reify/error.rs Makes ReifyDiagnostic* type aliases public.
libs/@local/hashql/mir/src/interpret/value/tuple.rs Adds doc-examples and small API/inline tweaks for tuples.
libs/@local/hashql/mir/src/interpret/value/struct.rs Marks Struct::new_unchecked as unsafe, enforces sorted fields, refactors StructBuilder::finish signature, adds docs/examples.
libs/@local/hashql/mir/src/interpret/value/str.rs Adds From<Symbol> + TryCloneIn for Str and improves docs.
libs/@local/hashql/mir/src/interpret/value/ptr.rs Adds docs/examples and inline hints for function pointers.
libs/@local/hashql/mir/src/interpret/value/opaque.rs Adds Opaque::into_value and expands docs/examples.
libs/@local/hashql/mir/src/interpret/value/num.rs Expands docs/examples for total-order Num.
libs/@local/hashql/mir/src/interpret/value/mod.rs Adds/updates docs and examples for Value operations (type name, subscript, projection).
libs/@local/hashql/mir/src/interpret/value/list.rs Adds docs/examples for list behavior including negative indexing.
libs/@local/hashql/mir/src/interpret/value/dict.rs Adds docs/examples for ordered dict behavior.
libs/@local/hashql/mir/src/interpret/tests.rs Updates tests for unsafe struct construction and related safety comments.
libs/@local/hashql/mir/src/interpret/suspension/temporal.rs Small inline annotations for timestamp conversions.
libs/@local/hashql/mir/src/interpret/runtime.rs Minor inline change; runtime error-to-diagnostic wiring relies on updated severity/category APIs.
libs/@local/hashql/mir/src/interpret/locals.rs Updates struct construction call site for unsafe Struct::new_unchecked with safety justification.
libs/@local/hashql/mir/src/interpret/inputs.rs Adds inline on Default impl for inputs.
libs/@local/hashql/mir/src/interpret/error.rs Refactors interpreter diagnostics: removes suspension category from interpreter, switches default severity kind to Critical, adds category-lifting APIs.
libs/@local/hashql/mir/src/error.rs Adds a MIR diagnostic category variant for reify diagnostics.
libs/@local/hashql/eval/tests/orchestrator/execution.rs Adjusts error conversion for orchestrator diagnostics.
libs/@local/hashql/eval/src/orchestrator/partial.rs Updates call sites for StructBuilder::finish(&interner.symbols, ...).
libs/@local/hashql/eval/src/orchestrator/mod.rs Updates public API to return OrchestratorDiagnostic and uses category-lifting from interpreter errors.
libs/@local/hashql/eval/src/orchestrator/error.rs Introduces OrchestratorDiagnosticCategory with Interpret/Bridge variants and migrates bridge diagnostics to Critical.
libs/@local/hashql/compiletest/src/suite/mod.rs Registers the new mir/interpret suite.
libs/@local/hashql/compiletest/src/suite/mir_interpret.rs Implements the new mir/interpret suite runner.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/@local/hashql/compiletest/src/suite/mir_interpret.rs
Comment thread libs/@local/hashql/mir/src/interpret/error.rs
Comment thread libs/@local/hashql/eval/src/orchestrator/error.rs
Comment thread libs/@local/hashql/eval/src/orchestrator/mod.rs
Comment thread libs/@local/hashql/mir/src/interpret/tests.rs
@codspeed-hq

codspeed-hq Bot commented Jun 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 56 skipped benchmarks1


Comparing bm/be-585-hashql-split-mir-interpret-diagnostic-api (1b21029) with main (20bd860)2

Open in CodSpeed

Footnotes

  1. 56 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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

@vercel vercel Bot temporarily deployed to Preview – petrinaut June 8, 2026 11:55 Inactive

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 29 out of 29 changed files in this pull request and generated 1 comment.

Comment thread libs/@local/hashql/mir/src/interpret/error.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 29 out of 29 changed files in this pull request and generated 2 comments.

Comment thread libs/@local/hashql/mir/src/interpret/error.rs
Comment thread libs/@local/hashql/mir/src/interpret/error.rs
@github-actions

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 $$27.2 \mathrm{ms} \pm 223 \mathrm{μs}\left({\color{gray}3.49 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.78 \mathrm{ms} \pm 25.1 \mathrm{μs}\left({\color{red}10.5 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$13.5 \mathrm{ms} \pm 99.3 \mathrm{μs}\left({\color{gray}1.99 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$45.0 \mathrm{ms} \pm 396 \mathrm{μs}\left({\color{gray}1.29 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$16.9 \mathrm{ms} \pm 176 \mathrm{μs}\left({\color{red}14.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$26.5 \mathrm{ms} \pm 210 \mathrm{μs}\left({\color{red}8.02 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$27.9 \mathrm{ms} \pm 158 \mathrm{μs}\left({\color{gray}-0.547 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$4.10 \mathrm{ms} \pm 24.8 \mathrm{μs}\left({\color{red}9.18 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.5 \mathrm{ms} \pm 109 \mathrm{μs}\left({\color{gray}2.56 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.90 \mathrm{ms} \pm 32.5 \mathrm{μs}\left({\color{gray}3.30 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.11 \mathrm{ms} \pm 16.4 \mathrm{μs}\left({\color{gray}1.73 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.53 \mathrm{ms} \pm 23.7 \mathrm{μs}\left({\color{gray}0.618 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.46 \mathrm{ms} \pm 43.6 \mathrm{μs}\left({\color{red}5.57 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.84 \mathrm{ms} \pm 31.0 \mathrm{μs}\left({\color{red}6.76 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.48 \mathrm{ms} \pm 39.8 \mathrm{μs}\left({\color{red}6.62 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.57 \mathrm{ms} \pm 35.2 \mathrm{μs}\left({\color{gray}3.66 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.61 \mathrm{ms} \pm 20.9 \mathrm{μs}\left({\color{gray}0.778 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.29 \mathrm{ms} \pm 28.3 \mathrm{μs}\left({\color{gray}3.81 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.69 \mathrm{ms} \pm 14.1 \mathrm{μs}\left({\color{gray}1.60 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.56 \mathrm{ms} \pm 15.6 \mathrm{μs}\left({\color{gray}0.542 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.69 \mathrm{ms} \pm 15.4 \mathrm{μs}\left({\color{gray}1.78 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.99 \mathrm{ms} \pm 20.2 \mathrm{μs}\left({\color{gray}2.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.73 \mathrm{ms} \pm 12.1 \mathrm{μs}\left({\color{gray}0.899 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.97 \mathrm{ms} \pm 18.0 \mathrm{μs}\left({\color{gray}2.67 \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 21.9 \mathrm{μs}\left({\color{gray}4.37 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.95 \mathrm{ms} \pm 19.0 \mathrm{μs}\left({\color{red}5.51 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$3.20 \mathrm{ms} \pm 20.0 \mathrm{μs}\left({\color{red}5.80 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.62 \mathrm{ms} \pm 22.9 \mathrm{μs}\left({\color{red}5.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.13 \mathrm{ms} \pm 21.3 \mathrm{μs}\left({\color{gray}1.54 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.46 \mathrm{ms} \pm 20.3 \mathrm{μs}\left({\color{gray}3.08 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.52 \mathrm{ms} \pm 20.2 \mathrm{μs}\left({\color{red}5.89 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.18 \mathrm{ms} \pm 21.8 \mathrm{μs}\left({\color{gray}4.16 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.52 \mathrm{ms} \pm 25.0 \mathrm{μs}\left({\color{red}5.72 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$44.3 \mathrm{ms} \pm 201 \mathrm{μs}\left({\color{gray}2.08 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$35.2 \mathrm{ms} \pm 203 \mathrm{μs}\left({\color{gray}2.36 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$37.8 \mathrm{ms} \pm 235 \mathrm{μs}\left({\color{gray}2.07 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$32.7 \mathrm{ms} \pm 157 \mathrm{μs}\left({\color{lightgreen}-6.739 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$45.2 \mathrm{ms} \pm 274 \mathrm{μs}\left({\color{gray}-2.775 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$52.0 \mathrm{ms} \pm 353 \mathrm{μs}\left({\color{gray}3.70 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$42.4 \mathrm{ms} \pm 243 \mathrm{μs}\left({\color{gray}0.366 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$94.8 \mathrm{ms} \pm 480 \mathrm{μs}\left({\color{red}5.16 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$35.5 \mathrm{ms} \pm 245 \mathrm{μs}\left({\color{gray}1.38 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$286 \mathrm{ms} \pm 904 \mathrm{μs}\left({\color{lightgreen}-8.650 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$11.3 \mathrm{ms} \pm 74.6 \mathrm{μs}\left({\color{red}7.46 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$11.4 \mathrm{ms} \pm 76.5 \mathrm{μs}\left({\color{red}7.56 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$11.1 \mathrm{ms} \pm 53.2 \mathrm{μs}\left({\color{gray}4.38 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$11.2 \mathrm{ms} \pm 70.1 \mathrm{μs}\left({\color{red}5.32 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$11.4 \mathrm{ms} \pm 87.0 \mathrm{μs}\left({\color{red}5.96 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$10.9 \mathrm{ms} \pm 53.6 \mathrm{μs}\left({\color{gray}0.299 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$10.8 \mathrm{ms} \pm 57.4 \mathrm{μs}\left({\color{gray}1.31 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$11.1 \mathrm{ms} \pm 69.6 \mathrm{μs}\left({\color{gray}2.91 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$11.0 \mathrm{ms} \pm 68.4 \mathrm{μs}\left({\color{gray}-0.137 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$11.3 \mathrm{ms} \pm 70.6 \mathrm{μs}\left({\color{gray}3.08 \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 $$10.9 \mathrm{ms} \pm 65.7 \mathrm{μs}\left({\color{gray}-2.223 \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 56.9 \mathrm{μs}\left({\color{gray}0.899 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$11.5 \mathrm{ms} \pm 61.7 \mathrm{μs}\left({\color{gray}1.84 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$11.3 \mathrm{ms} \pm 58.0 \mathrm{μs}\left({\color{gray}0.577 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$11.4 \mathrm{ms} \pm 62.7 \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 $$11.9 \mathrm{ms} \pm 80.5 \mathrm{μs}\left({\color{gray}2.99 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$11.6 \mathrm{ms} \pm 79.7 \mathrm{μs}\left({\color{gray}3.49 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$11.4 \mathrm{ms} \pm 70.3 \mathrm{μs}\left({\color{gray}0.274 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$11.3 \mathrm{ms} \pm 72.6 \mathrm{μs}\left({\color{gray}0.608 \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.50 \mathrm{ms} \pm 58.9 \mathrm{μs}\left({\color{gray}-3.170 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$55.7 \mathrm{ms} \pm 412 \mathrm{μs}\left({\color{lightgreen}-11.999 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$105 \mathrm{ms} \pm 702 \mathrm{μs}\left({\color{lightgreen}-9.734 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$60.8 \mathrm{ms} \pm 370 \mathrm{μs}\left({\color{lightgreen}-10.561 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$71.5 \mathrm{ms} \pm 428 \mathrm{μs}\left({\color{lightgreen}-8.235 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$79.0 \mathrm{ms} \pm 428 \mathrm{μs}\left({\color{lightgreen}-10.361 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$85.1 \mathrm{ms} \pm 508 \mathrm{μs}\left({\color{lightgreen}-10.042 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$43.4 \mathrm{ms} \pm 258 \mathrm{μs}\left({\color{lightgreen}-8.579 \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 $$72.7 \mathrm{ms} \pm 394 \mathrm{μs}\left({\color{lightgreen}-5.087 \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.2 \mathrm{ms} \pm 312 \mathrm{μs}\left({\color{lightgreen}-6.769 \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 $$59.6 \mathrm{ms} \pm 315 \mathrm{μs}\left({\color{gray}-2.940 \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.1 \mathrm{ms} \pm 344 \mathrm{μs}\left({\color{gray}-4.537 \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.2 \mathrm{ms} \pm 314 \mathrm{μs}\left({\color{gray}-4.705 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$122 \mathrm{ms} \pm 631 \mathrm{μs}\left({\color{gray}2.17 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$135 \mathrm{ms} \pm 429 \mathrm{μs}\left({\color{gray}2.28 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$19.8 \mathrm{ms} \pm 113 \mathrm{μs}\left({\color{gray}4.35 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$557 \mathrm{ms} \pm 1.12 \mathrm{ms}\left({\color{gray}-0.839 \mathrm{\%}}\right) $$ Flame Graph

@indietyp indietyp added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit d145e88 Jun 24, 2026
85 checks passed
@indietyp indietyp deleted the bm/be-585-hashql-split-mir-interpret-diagnostic-api branch June 24, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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