Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-4017: Implement types to define policies in Rust #6355

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

To store the policies in our own datastore we need to define the types for them alongside logic to serialize/deserialize them.

🔗 Related links

  • ...

🚫 Blocked by

  • ...

🔍 What does this change?

  • ...

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
  • modifies an npm-publishable library and I have added a changeset file(s)
  • modifies a Cargo-publishable library and I have amended the version
  • modifies a Cargo-publishable library, but it is not yet ready to publish
  • modifies a block that will need publishing via GitHub action once merged
  • I am unsure / need advice

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change
  • are in a state where docs changes are not yet required but will be
  • require changes to docs which are made as part of this PR
  • require changes to docs which are not made in this PR
    • Provide more detail here
  • I am unsure / need advice

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

The changes in this PR:

  • do not affect the execution graph
  • affected the execution graph, and the turbo.json's have been updated to reflect this
  • I am unsure / need advice

⚠️ Known issues

🐾 Next steps

🛡 What tests cover this?

❓ How to test this?

  1. Checkout the branch / view the deployment
  2. Try X
  3. Confirm that Y

📹 Demo

@TimDiekmann TimDiekmann self-assigned this Feb 6, 2025
@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 labels Feb 6, 2025
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 21.19%. Comparing base (d8a63f9) to head (5987f96).
Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6355      +/-   ##
==========================================
- Coverage   21.22%   21.19%   -0.04%     
==========================================
  Files         580      580              
  Lines       19841    19879      +38     
  Branches     2943     2951       +8     
==========================================
+ Hits         4212     4213       +1     
- Misses      15572    15609      +37     
  Partials       57       57              
Flag Coverage Δ
apps.hash-ai-worker-ts 1.34% <ø> (ø)
apps.hash-api 1.14% <ø> (-0.01%) ⬇️
local.hash-backend-utils 8.81% <ø> (ø)
local.hash-graph-sdk 58.62% <ø> (ø)
local.hash-isomorphic-utils 0.89% <ø> (-0.02%) ⬇️
local.hash-subgraph 24.54% <ø> (ø)

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.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

github-actions bot commented Feb 7, 2025

Benchmark results

@rust/hash-graph-benches – Integrations

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 25 entities $$3.39 \mathrm{ms} \pm 14.1 \mathrm{μs}\left({\color{gray}0.310 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$2.01 \mathrm{ms} \pm 8.76 \mathrm{μs}\left({\color{gray}0.327 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$2.01 \mathrm{ms} \pm 6.67 \mathrm{μs}\left({\color{gray}-0.786 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.22 \mathrm{ms} \pm 8.16 \mathrm{μs}\left({\color{gray}4.46 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$3.96 \mathrm{ms} \pm 17.9 \mathrm{μs}\left({\color{gray}-2.856 \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 $$16.8 \mathrm{ms} \pm 176 \mathrm{μs}\left({\color{lightgreen}-27.041 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$17.0 \mathrm{ms} \pm 214 \mathrm{μs}\left({\color{lightgreen}-26.048 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$16.6 \mathrm{ms} \pm 192 \mathrm{μs}\left({\color{gray}2.97 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$16.5 \mathrm{ms} \pm 200 \mathrm{μs}\left({\color{gray}3.08 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$16.3 \mathrm{ms} \pm 216 \mathrm{μs}\left({\color{red}7.29 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$16.8 \mathrm{ms} \pm 206 \mathrm{μs}\left({\color{red}8.40 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$15.7 \mathrm{ms} \pm 156 \mathrm{μs}\left({\color{gray}-4.909 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$16.7 \mathrm{ms} \pm 198 \mathrm{μs}\left({\color{gray}-4.089 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$16.8 \mathrm{ms} \pm 164 \mathrm{μs}\left({\color{gray}3.35 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: d4e16033-c281-4cde-aa35-9085bf2e7579 $$2.16 \mathrm{ms} \pm 7.86 \mathrm{μs}\left({\color{gray}1.17 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$86.3 \mathrm{ms} \pm 240 \mathrm{μs}\left({\color{gray}0.308 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$81.9 \mathrm{ms} \pm 512 \mathrm{μs}\left({\color{gray}0.458 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$73.2 \mathrm{ms} \pm 437 \mathrm{μs}\left({\color{gray}0.117 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$89.8 \mathrm{ms} \pm 302 \mathrm{μs}\left({\color{gray}-0.509 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$98.6 \mathrm{ms} \pm 507 \mathrm{μs}\left({\color{gray}0.002 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$37.7 \mathrm{ms} \pm 133 \mathrm{μs}\left({\color{gray}0.150 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$52.8 \mathrm{ms} \pm 236 \mathrm{μs}\left({\color{gray}-0.933 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$48.4 \mathrm{ms} \pm 224 \mathrm{μs}\left({\color{gray}-1.343 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$43.0 \mathrm{ms} \pm 241 \mathrm{μs}\left({\color{gray}-0.521 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$56.5 \mathrm{ms} \pm 379 \mathrm{μs}\left({\color{gray}-0.691 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$66.1 \mathrm{ms} \pm 240 \mathrm{μs}\left({\color{gray}-0.238 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$38.6 \mathrm{ms} \pm 238 \mathrm{μs}\left({\color{gray}-0.738 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 25 entities $$178 \mathrm{ms} \pm 661 \mathrm{μs}\left({\color{gray}-0.865 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$21.0 \mathrm{ms} \pm 112 \mathrm{μs}\left({\color{gray}-0.075 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$27.1 \mathrm{ms} \pm 113 \mathrm{μs}\left({\color{gray}0.143 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$55.5 \mathrm{ms} \pm 2.15 \mathrm{ms}\left({\color{red}25.1 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$267 \mathrm{ms} \pm 2.37 \mathrm{ms}\left({\color{gray}-2.033 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 100 entities $$2.21 \mathrm{ms} \pm 12.3 \mathrm{μs}\left({\color{gray}3.61 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$3.21 \mathrm{ms} \pm 20.7 \mathrm{μs}\left({\color{red}8.26 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$13.7 \mathrm{ms} \pm 58.1 \mathrm{μs}\left({\color{gray}0.971 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$2.01 \mathrm{ms} \pm 7.13 \mathrm{μs}\left({\color{gray}0.665 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.03 \mathrm{ms} \pm 8.44 \mathrm{μs}\left({\color{gray}0.278 \mathrm{\%}}\right) $$ Flame Graph

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) type/eng > backend Owned by the @backend team
Development

Successfully merging this pull request may close these issues.

1 participant