Skip to content

BE-500: HashQL: Unify mixed parameter resolution in data dependency analysis#8607

Draft
indietyp wants to merge 2 commits intobm/be-494-hashql-scc-loop-breaker-inliningfrom
bm/be-500-hashql-forward-substitution-unified-param-resolution
Draft

BE-500: HashQL: Unify mixed parameter resolution in data dependency analysis#8607
indietyp wants to merge 2 commits intobm/be-494-hashql-scc-loop-breaker-inliningfrom
bm/be-500-hashql-forward-substitution-unified-param-resolution

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented Apr 5, 2026

🌟 What is the purpose of this PR?

This PR consolidates the parameter resolution logic in the data dependency analysis by unifying the handling of graph edges and constant bindings. Previously, these two sources of parameter values were handled by separate functions, but now they are processed together in a single unified approach that can handle mixed scenarios where parameters come from both sources.

🔍 What does this change?

  • Removes the resolve_params_const function and merges its functionality into resolve_params
  • Updates resolve_params to handle both graph edges and constant bindings simultaneously using try_reduce for consensus checking
  • Adds support for the iterator_try_reduce and maybe_uninit_uninit_array_transpose library features
  • Removes the unused assert_matches feature from multiple library modules
  • Adds a new test case load_param_mixed that validates parameter resolution when predecessors provide a mix of constants and projections
  • Improves documentation to clarify that parameter resolution now handles both graph edges and constant bindings

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?

  • New test case load_param_mixed validates the unified parameter resolution logic
  • Existing data dependency analysis tests continue to cover the refactored functionality

❓ How to test this?

  1. Checkout the branch
  2. Run the data dependency analysis tests
  3. Confirm that the new load_param_mixed test passes and validates mixed parameter resolution

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 5, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Apr 5, 2026 7:51pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview Apr 5, 2026 7:51pm
hashdotdesign-tokens Ignored Ignored Preview Apr 5, 2026 7:51pm
petrinaut Skipped Skipped Apr 5, 2026 7:51pm

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 5, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 56 skipped benchmarks1


Comparing bm/be-500-hashql-forward-substitution-unified-param-resolution (9297e69) with bm/be-494-hashql-scc-loop-breaker-inlining (5012bc6)

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.

@vercel vercel bot temporarily deployed to Preview – petrinaut April 5, 2026 19:43 Inactive
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 96.22642% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.70%. Comparing base (5012bc6) to head (9297e69).

Files with missing lines Patch % Lines
...l/mir/src/pass/analysis/data_dependency/resolve.rs 92.00% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@                              Coverage Diff                               @@
##           bm/be-494-hashql-scc-loop-breaker-inlining    #8607      +/-   ##
==============================================================================
+ Coverage                                       64.64%   71.70%   +7.06%     
==============================================================================
  Files                                             891     1047     +156     
  Lines                                           76997   104228   +27231     
  Branches                                         4035     4664     +629     
==============================================================================
+ Hits                                            49774    74739   +24965     
- Misses                                          26676    28714    +2038     
- Partials                                          547      775     +228     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.40% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-graph-sdk 9.63% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.52% <ø> (ø)
rust.hashql-compiletest 28.31% <ø> (ø)
rust.hashql-mir 91.67% <96.22%> (?)

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

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 $$25.4 \mathrm{ms} \pm 158 \mathrm{μs}\left({\color{gray}-1.663 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.76 \mathrm{ms} \pm 14.6 \mathrm{μs}\left({\color{gray}-0.876 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$11.1 \mathrm{ms} \pm 68.2 \mathrm{μs}\left({\color{gray}-4.196 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$37.6 \mathrm{ms} \pm 438 \mathrm{μs}\left({\color{gray}0.141 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$11.2 \mathrm{ms} \pm 85.0 \mathrm{μs}\left({\color{gray}-2.024 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$19.8 \mathrm{ms} \pm 130 \mathrm{μs}\left({\color{gray}-3.504 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$25.9 \mathrm{ms} \pm 198 \mathrm{μs}\left({\color{gray}-3.211 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.03 \mathrm{ms} \pm 16.6 \mathrm{μs}\left({\color{gray}-0.504 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$11.9 \mathrm{ms} \pm 70.7 \mathrm{μs}\left({\color{gray}-3.895 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.09 \mathrm{ms} \pm 14.6 \mathrm{μs}\left({\color{gray}-0.065 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.35 \mathrm{ms} \pm 10.6 \mathrm{μs}\left({\color{gray}-0.910 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$2.68 \mathrm{ms} \pm 14.6 \mathrm{μs}\left({\color{gray}0.206 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$4.34 \mathrm{ms} \pm 25.8 \mathrm{μs}\left({\color{gray}0.172 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.84 \mathrm{ms} \pm 11.8 \mathrm{μs}\left({\color{gray}-1.011 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$3.37 \mathrm{ms} \pm 14.9 \mathrm{μs}\left({\color{gray}-0.439 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$3.78 \mathrm{ms} \pm 23.1 \mathrm{μs}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.79 \mathrm{ms} \pm 11.5 \mathrm{μs}\left({\color{gray}-0.695 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$3.34 \mathrm{ms} \pm 19.4 \mathrm{μs}\left({\color{gray}1.06 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.19 \mathrm{ms} \pm 13.8 \mathrm{μs}\left({\color{gray}2.20 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.13 \mathrm{ms} \pm 9.13 \mathrm{μs}\left({\color{gray}0.388 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.24 \mathrm{ms} \pm 10.5 \mathrm{μs}\left({\color{gray}1.52 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.44 \mathrm{ms} \pm 13.9 \mathrm{μs}\left({\color{gray}1.90 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.31 \mathrm{ms} \pm 12.7 \mathrm{μs}\left({\color{gray}2.38 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.52 \mathrm{ms} \pm 11.1 \mathrm{μs}\left({\color{gray}2.23 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$2.49 \mathrm{ms} \pm 14.2 \mathrm{μs}\left({\color{gray}2.00 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.24 \mathrm{ms} \pm 11.4 \mathrm{μs}\left({\color{gray}-0.177 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.37 \mathrm{ms} \pm 13.1 \mathrm{μs}\left({\color{gray}0.247 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$2.80 \mathrm{ms} \pm 12.5 \mathrm{μs}\left({\color{gray}-1.271 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.47 \mathrm{ms} \pm 12.7 \mathrm{μs}\left({\color{gray}0.400 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$2.63 \mathrm{ms} \pm 12.1 \mathrm{μs}\left({\color{gray}-0.051 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$2.74 \mathrm{ms} \pm 11.1 \mathrm{μs}\left({\color{gray}0.318 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.46 \mathrm{ms} \pm 12.9 \mathrm{μs}\left({\color{gray}2.69 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$2.67 \mathrm{ms} \pm 16.4 \mathrm{μs}\left({\color{gray}0.966 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$37.4 \mathrm{ms} \pm 150 \mathrm{μs}\left({\color{gray}-1.798 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$73.6 \mathrm{ms} \pm 286 \mathrm{μs}\left({\color{lightgreen}-5.785 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$41.3 \mathrm{ms} \pm 139 \mathrm{μs}\left({\color{gray}-3.290 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$44.9 \mathrm{ms} \pm 133 \mathrm{μs}\left({\color{gray}-3.891 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$51.2 \mathrm{ms} \pm 277 \mathrm{μs}\left({\color{lightgreen}-6.529 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$39.2 \mathrm{ms} \pm 144 \mathrm{μs}\left({\color{gray}-3.462 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$408 \mathrm{ms} \pm 841 \mathrm{μs}\left({\color{gray}-2.708 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$81.8 \mathrm{ms} \pm 428 \mathrm{μs}\left({\color{lightgreen}-9.992 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$87.3 \mathrm{ms} \pm 367 \mathrm{μs}\left({\color{gray}-4.597 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$251 \mathrm{ms} \pm 680 \mathrm{μs}\left({\color{gray}-3.041 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$16.3 \mathrm{ms} \pm 74.0 \mathrm{μs}\left({\color{gray}-3.627 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$16.8 \mathrm{ms} \pm 69.8 \mathrm{μs}\left({\color{gray}-4.290 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$16.9 \mathrm{ms} \pm 75.7 \mathrm{μs}\left({\color{lightgreen}-5.293 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$16.8 \mathrm{ms} \pm 68.7 \mathrm{μs}\left({\color{gray}-4.780 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$20.6 \mathrm{ms} \pm 100 \mathrm{μs}\left({\color{gray}-4.439 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$16.0 \mathrm{ms} \pm 71.0 \mathrm{μs}\left({\color{lightgreen}-6.481 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$16.1 \mathrm{ms} \pm 73.8 \mathrm{μs}\left({\color{gray}-4.484 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$16.1 \mathrm{ms} \pm 58.0 \mathrm{μs}\left({\color{gray}-3.266 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$16.5 \mathrm{ms} \pm 98.0 \mathrm{μs}\left({\color{gray}-3.865 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$22.7 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{gray}-1.597 \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 $$30.1 \mathrm{ms} \pm 272 \mathrm{μs}\left({\color{gray}1.84 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$30.5 \mathrm{ms} \pm 308 \mathrm{μs}\left({\color{gray}1.67 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$29.6 \mathrm{ms} \pm 296 \mathrm{μs}\left({\color{lightgreen}-5.449 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$30.7 \mathrm{ms} \pm 323 \mathrm{μs}\left({\color{gray}-1.047 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$29.9 \mathrm{ms} \pm 278 \mathrm{μs}\left({\color{gray}-4.408 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$31.5 \mathrm{ms} \pm 282 \mathrm{μs}\left({\color{gray}-4.605 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$30.0 \mathrm{ms} \pm 254 \mathrm{μs}\left({\color{gray}-4.595 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$29.4 \mathrm{ms} \pm 262 \mathrm{μs}\left({\color{gray}-3.237 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$29.7 \mathrm{ms} \pm 277 \mathrm{μs}\left({\color{lightgreen}-5.281 \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.69 \mathrm{ms} \pm 29.7 \mathrm{μs}\left({\color{gray}-1.086 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$87.5 \mathrm{ms} \pm 415 \mathrm{μs}\left({\color{lightgreen}-5.410 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$129 \mathrm{ms} \pm 395 \mathrm{μs}\left({\color{gray}-2.874 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$92.7 \mathrm{ms} \pm 380 \mathrm{μs}\left({\color{gray}-4.780 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$100 \mathrm{ms} \pm 458 \mathrm{μs}\left({\color{gray}-4.647 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$107 \mathrm{ms} \pm 354 \mathrm{μs}\left({\color{gray}-4.921 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$113 \mathrm{ms} \pm 371 \mathrm{μs}\left({\color{lightgreen}-5.171 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$95.1 \mathrm{ms} \pm 397 \mathrm{μs}\left({\color{gray}-1.967 \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 $$117 \mathrm{ms} \pm 439 \mathrm{μs}\left({\color{gray}-2.317 \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 373 \mathrm{μs}\left({\color{gray}-3.026 \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 353 \mathrm{μs}\left({\color{gray}-1.986 \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 $$109 \mathrm{ms} \pm 408 \mathrm{μs}\left({\color{gray}-2.206 \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 $$109 \mathrm{ms} \pm 431 \mathrm{μs}\left({\color{gray}-2.009 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$130 \mathrm{ms} \pm 389 \mathrm{μs}\left({\color{red}6.75 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$137 \mathrm{ms} \pm 600 \mathrm{μs}\left({\color{gray}2.58 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$89.0 \mathrm{ms} \pm 371 \mathrm{μs}\left({\color{gray}-1.496 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$516 \mathrm{ms} \pm 2.80 \mathrm{ms}\left({\color{gray}-1.034 \mathrm{\%}}\right) $$ Flame Graph

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.

1 participant