Skip to content

BE-537, BE-537: hgraph: REST /hashql endpoint with E2E tests#8827

Open
indietyp wants to merge 10 commits into
bm/be-592-hashql-remove-old-eval-graph-path-and-core-value-typesfrom
bm/be-537-hashql-remove-old-backend-wire-up-hashql-in-the-api
Open

BE-537, BE-537: hgraph: REST /hashql endpoint with E2E tests#8827
indietyp wants to merge 10 commits into
bm/be-592-hashql-remove-old-eval-graph-path-and-core-value-typesfrom
bm/be-537-hashql-remove-old-backend-wire-up-hashql-in-the-api

Conversation

@indietyp

@indietyp indietyp commented Jun 4, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

Add first-class /hashql POST endpoint. HashQlResource with OpenApi integration. CompilerContext with HeapPool/ScratchPool for memory management. CLI-configurable pool sizes via CompilerConfig with PoolSize newtype. PostgresStorePool extraction pattern. Interactive and Json-Compat header support. E2E tests via httpYac.

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

Copilot AI review requested due to automatic review settings June 4, 2026 16:33
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

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

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

@cursor

cursor Bot commented Jun 4, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
New query surface executes compiled SQL against Postgres with configurable resource pools; misconfiguration or compiler bugs could affect availability, though inputs are restricted and errors are structured.

Overview
Adds a POST /hashql route that accepts a JExpr query body, runs the full HashQL pipeline (parse through Postgres codegen), executes via the eval orchestrator, and returns structured success/advisory or diagnostic errors.

Server wiring: Startup builds a shared CompilerContext (bounded/unbounded heap and scratch pools plus a LocalPoolHandle for !Send work on pinned threads). New CLI/env flags CompilerConfig / PoolSize control memory and exec pool sizes. The REST router gets extensions for PostgresStorePool, the compiler context, and OpenAPI documents the endpoint. Temporal host is ignored when empty.

API behavior: Request requires query and an empty inputs array for now. Optional Interactive (HTML error rendering) and Json-Compat (plain JSON values in the envelope) headers mirror existing REST patterns. PostgresStore gains AsRef<Client> for HashQL execution; sym::main is registered for lowering.

Tests: tests/hashql.http and test.sh cover happy path, parse errors, validation, json-compat, and interactive HTML errors.

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

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) 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/apps area/apps > hash-graph labels Jun 4, 2026
@indietyp indietyp marked this pull request as draft June 4, 2026 16:34
Copilot AI review requested due to automatic review settings June 9, 2026 09:48
@indietyp indietyp force-pushed the bm/be-592-hashql-remove-old-eval-graph-path-and-core-value-types branch from ffd1eee to c4c66ca Compare June 9, 2026 09:48
@indietyp indietyp force-pushed the bm/be-537-hashql-remove-old-backend-wire-up-hashql-in-the-api branch from 15bfd71 to 29a5989 Compare June 9, 2026 09:48
@indietyp indietyp force-pushed the bm/be-592-hashql-remove-old-eval-graph-path-and-core-value-types branch from c4c66ca to b71a649 Compare June 9, 2026 09:50

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.

Comment thread libs/@local/graph/api/src/rest/hashql/mod.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 $$26.6 \mathrm{ms} \pm 258 \mathrm{μs}\left({\color{gray}1.49 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.38 \mathrm{ms} \pm 15.4 \mathrm{μs}\left({\color{lightgreen}-6.315 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$12.9 \mathrm{ms} \pm 90.3 \mathrm{μs}\left({\color{gray}1.82 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$43.4 \mathrm{ms} \pm 370 \mathrm{μs}\left({\color{gray}-0.065 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$14.7 \mathrm{ms} \pm 99.8 \mathrm{μs}\left({\color{lightgreen}-6.061 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$24.5 \mathrm{ms} \pm 159 \mathrm{μs}\left({\color{gray}-1.791 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$26.8 \mathrm{ms} \pm 164 \mathrm{μs}\left({\color{gray}-1.081 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.75 \mathrm{ms} \pm 20.0 \mathrm{μs}\left({\color{gray}-4.900 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.2 \mathrm{ms} \pm 145 \mathrm{μs}\left({\color{gray}2.00 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.70 \mathrm{ms} \pm 23.4 \mathrm{μs}\left({\color{gray}-0.244 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.97 \mathrm{ms} \pm 15.2 \mathrm{μs}\left({\color{gray}-0.787 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.31 \mathrm{ms} \pm 18.5 \mathrm{μs}\left({\color{gray}-1.627 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.12 \mathrm{ms} \pm 35.0 \mathrm{μs}\left({\color{gray}-0.449 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.55 \mathrm{ms} \pm 26.1 \mathrm{μs}\left({\color{gray}0.170 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.06 \mathrm{ms} \pm 22.1 \mathrm{μs}\left({\color{gray}-0.879 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.32 \mathrm{ms} \pm 29.0 \mathrm{μs}\left({\color{gray}0.710 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.48 \mathrm{ms} \pm 23.2 \mathrm{μs}\left({\color{gray}0.754 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.11 \mathrm{ms} \pm 35.5 \mathrm{μs}\left({\color{gray}1.29 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.59 \mathrm{ms} \pm 18.5 \mathrm{μs}\left({\color{gray}-0.558 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.48 \mathrm{ms} \pm 12.1 \mathrm{μs}\left({\color{gray}-2.410 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.60 \mathrm{ms} \pm 24.1 \mathrm{μs}\left({\color{gray}1.55 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.85 \mathrm{ms} \pm 15.0 \mathrm{μs}\left({\color{gray}-1.140 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.63 \mathrm{ms} \pm 12.4 \mathrm{μs}\left({\color{gray}-0.164 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.85 \mathrm{ms} \pm 18.2 \mathrm{μs}\left({\color{gray}0.269 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$2.99 \mathrm{ms} \pm 19.3 \mathrm{μs}\left({\color{gray}0.411 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.71 \mathrm{ms} \pm 17.4 \mathrm{μs}\left({\color{gray}-1.209 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.96 \mathrm{ms} \pm 19.9 \mathrm{μs}\left({\color{gray}-0.574 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.34 \mathrm{ms} \pm 18.1 \mathrm{μs}\left({\color{gray}-0.915 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.95 \mathrm{ms} \pm 15.0 \mathrm{μs}\left({\color{gray}-1.230 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.25 \mathrm{ms} \pm 17.2 \mathrm{μs}\left({\color{gray}-0.684 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.31 \mathrm{ms} \pm 21.7 \mathrm{μs}\left({\color{gray}-0.250 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.93 \mathrm{ms} \pm 15.4 \mathrm{μs}\left({\color{gray}-0.921 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.30 \mathrm{ms} \pm 18.3 \mathrm{μs}\left({\color{gray}-0.965 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$54.1 \mathrm{ms} \pm 334 \mathrm{μs}\left({\color{gray}-2.846 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$47.0 \mathrm{ms} \pm 318 \mathrm{μs}\left({\color{gray}0.026 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$51.6 \mathrm{ms} \pm 283 \mathrm{μs}\left({\color{gray}-0.635 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$44.2 \mathrm{ms} \pm 215 \mathrm{μs}\left({\color{gray}-2.013 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$62.4 \mathrm{ms} \pm 368 \mathrm{μs}\left({\color{gray}-2.977 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$62.8 \mathrm{ms} \pm 399 \mathrm{μs}\left({\color{gray}0.384 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$57.1 \mathrm{ms} \pm 388 \mathrm{μs}\left({\color{gray}-0.720 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$105 \mathrm{ms} \pm 625 \mathrm{μs}\left({\color{gray}0.214 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$46.9 \mathrm{ms} \pm 225 \mathrm{μs}\left({\color{gray}-1.337 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$294 \mathrm{ms} \pm 870 \mathrm{μs}\left({\color{gray}0.549 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$19.1 \mathrm{ms} \pm 96.2 \mathrm{μs}\left({\color{gray}-2.617 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$20.0 \mathrm{ms} \pm 115 \mathrm{μs}\left({\color{gray}-1.585 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$20.8 \mathrm{ms} \pm 107 \mathrm{μs}\left({\color{gray}-0.221 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$19.3 \mathrm{ms} \pm 98.6 \mathrm{μs}\left({\color{gray}-4.921 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$24.6 \mathrm{ms} \pm 245 \mathrm{μs}\left({\color{gray}-4.935 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$19.1 \mathrm{ms} \pm 108 \mathrm{μs}\left({\color{gray}-1.352 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$19.7 \mathrm{ms} \pm 118 \mathrm{μs}\left({\color{gray}-0.806 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$19.6 \mathrm{ms} \pm 132 \mathrm{μs}\left({\color{gray}-0.512 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$20.4 \mathrm{ms} \pm 120 \mathrm{μs}\left({\color{gray}-0.487 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$26.5 \mathrm{ms} \pm 267 \mathrm{μs}\left({\color{gray}-2.394 \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 $$35.6 \mathrm{ms} \pm 298 \mathrm{μs}\left({\color{gray}2.28 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$35.2 \mathrm{ms} \pm 305 \mathrm{μs}\left({\color{gray}2.41 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$35.5 \mathrm{ms} \pm 296 \mathrm{μs}\left({\color{gray}2.68 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$34.4 \mathrm{ms} \pm 265 \mathrm{μs}\left({\color{gray}-2.758 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$34.8 \mathrm{ms} \pm 295 \mathrm{μs}\left({\color{gray}-3.186 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$34.7 \mathrm{ms} \pm 309 \mathrm{μs}\left({\color{gray}0.262 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$36.2 \mathrm{ms} \pm 301 \mathrm{μs}\left({\color{gray}2.27 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$35.7 \mathrm{ms} \pm 276 \mathrm{μs}\left({\color{gray}2.89 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$35.5 \mathrm{ms} \pm 259 \mathrm{μs}\left({\color{gray}0.818 \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 41.3 \mathrm{μs}\left({\color{gray}-1.378 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$92.3 \mathrm{ms} \pm 665 \mathrm{μs}\left({\color{gray}-0.301 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$148 \mathrm{ms} \pm 863 \mathrm{μs}\left({\color{gray}-0.997 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$99.7 \mathrm{ms} \pm 643 \mathrm{μs}\left({\color{gray}-0.431 \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 634 \mathrm{μs}\left({\color{gray}-0.299 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$117 \mathrm{ms} \pm 600 \mathrm{μs}\left({\color{gray}-1.247 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$125 \mathrm{ms} \pm 635 \mathrm{μs}\left({\color{gray}-1.635 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$103 \mathrm{ms} \pm 452 \mathrm{μs}\left({\color{gray}-0.551 \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 $$133 \mathrm{ms} \pm 636 \mathrm{μs}\left({\color{gray}-1.451 \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 $$111 \mathrm{ms} \pm 575 \mathrm{μs}\left({\color{gray}-0.228 \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 $$120 \mathrm{ms} \pm 644 \mathrm{μs}\left({\color{gray}-0.417 \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 $$122 \mathrm{ms} \pm 664 \mathrm{μs}\left({\color{gray}-0.514 \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 $$121 \mathrm{ms} \pm 606 \mathrm{μs}\left({\color{gray}-0.793 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$189 \mathrm{ms} \pm 777 \mathrm{μs}\left({\color{gray}0.133 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$150 \mathrm{ms} \pm 603 \mathrm{μs}\left({\color{gray}-3.399 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$40.5 \mathrm{ms} \pm 201 \mathrm{μs}\left({\color{gray}-2.510 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$582 \mathrm{ms} \pm 1.06 \mathrm{ms}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph

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 14 out of 16 changed files in this pull request and generated 2 comments.

Comment thread libs/@local/graph/api/src/rest/hashql/mod.rs
Comment thread apps/hash-graph/src/subcommand/server.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 14 out of 16 changed files in this pull request and generated 1 comment.

Comment on lines +202 to +207
/// Request body for the `/hashql` endpoint.
#[derive(serde::Deserialize, utoipa::ToSchema)]
pub(crate) struct HashQlRequest {
#[schema(value_type = serde_json::Value)]
query: Arc<RawValue>,
/// Input values for the query. Must be an empty list until input support ships.
Comment thread libs/@local/graph/api/src/rest/hashql/mod.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +125 to +138
let iter = btree_map
.iter()
.map(|(key, value)| (Self(key), Self(value)));

// If all the keys are strings we can collect a map, otherwise we must fallback
// to collecting as a sequence
if btree_map
.keys()
.all(|key| matches!(key, OwnedValue::String(_)))
{
serializer.collect_map(iter)
} else {
serializer.collect_seq(iter)
}
Comment on lines +97 to +107
let mut scratch = ctx.scratches.get();
let heap = ctx.heaps.get();

let inputs = Inputs::new(); // TODO: https://linear.app/hash/issue/BE-41/hashql-expose-input-in-graph-api

let Success {
value: compilation,
advisories,
} = Compilation::compile(&heap, &mut scratch, spans, query)?;

let context = compilation.context();

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 14 out of 16 changed files in this pull request and generated no new comments.

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

Comment on lines +12 to +15
#[expect(clippy::trivially_copy_pass_by_ref)]
fn serialize_num<S: serde::Serializer>(num: &Num, serializer: S) -> Result<S::Ok, S::Error> {
num.as_f64().serialize(serializer)
}

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Fix All in Cursor

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

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 90037e8. Configure here.

Comment thread libs/@local/graph/api/src/rest/hashql/value.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 14 out of 16 changed files in this pull request and generated 2 comments.

Comment on lines +216 to +229
#[utoipa::path(
post,
path = "/hashql",
request_body = HashQlRequest,
tag = "HashQL",
params(
("Interactive" = Option<bool>, Header, description = "When true, error responses are rendered as HTML instead of JSON"),
("Json-Compat" = Option<bool>, Header, description = "When true, serializes the result as plain JSON values, stripping HashQL-specific type wrappers"),
),
responses(
(status = 200, content_type = "application/json", description = "Query executed successfully"),
(status = 400, content_type = "application/json", description = "Query compilation or validation error"),
(status = 500, description = "Internal compiler or database error"),
)
Comment thread libs/@local/graph/api/src/rest/hashql/mod.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.

Comment on lines +118 to +120
client.assert(response.body.message !== undefined, "Expected error message");
client.assert(response.body.contents[0].Error.metadata.deserializationError.includes("inputs"),
"Expected error to mention missing 'inputs' field");
@@ -0,0 +1,191 @@
use hashql_ast::error::AstDiagnosticCategory;
use hashql_core::{

use axum::response::{Html, IntoResponse as _};
use hashql_ast::error::AstDiagnosticCategory;
use hashql_core::span::{SpanId, SpanTable};
use hash_graph_postgres_store::store::PostgresStorePool;
use hash_graph_store::pool::StorePool as _;
use hash_temporal_client::TemporalClient;
use hashql_core::{
use alloc::{collections::BTreeMap, sync::Arc};
use core::alloc::Allocator;

use hashql_core::id::Id as _;

#[expect(clippy::trivially_copy_pass_by_ref)]
fn serialize_ptr<S: serde::Serializer>(ptr: &Ptr, serializer: S) -> Result<S::Ok, S::Error> {
ptr.def().as_u32().serialize(serializer)

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 14 out of 16 changed files in this pull request and generated no new comments.

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

Labels

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

Development

Successfully merging this pull request may close these issues.

3 participants