Skip to content

H-4727: Remove usage of viewer and viewFromWeb relationships #7351

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

TimDiekmann
Copy link
Member

@TimDiekmann TimDiekmann commented Jun 6, 2025

🌟 What is the purpose of this PR?

When the new policy engine is used, we don't need the old relationships. However, this was not done in a single PR so we have some time where both, the policies and relationships are maintained. In the case something goes wrong with the policies and we need to revert the policy PR, we still have a working permission system.

🚫 Blockers

🔍 What does this change?

Remove

  • viewer and viewFromWeb entity relationships
  • modification of entity owner/admins
  • reading entity relationships

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

@TimDiekmann TimDiekmann self-assigned this Jun 6, 2025
@github-actions github-actions bot added area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/tests New or updated tests area/tests > integration New or updated integration tests area/apps labels Jun 6, 2025
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 52.57%. Comparing base (f732535) to head (e3da6c8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...i/src/graphql/resolvers/knowledge/entity/entity.ts 0.00% 6 Missing ⚠️
apps/hash-api/src/graphql/resolvers/index.ts 0.00% 5 Missing ⚠️
libs/@local/graph/api/src/rest/entity.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7351      +/-   ##
==========================================
- Coverage   53.14%   52.57%   -0.57%     
==========================================
  Files        1080     1078       -2     
  Lines       95837    94685    -1152     
  Branches     4439     4395      -44     
==========================================
- Hits        50930    49783    -1147     
- Misses      43949    43971      +22     
+ Partials      958      931      -27     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.32% <ø> (+<0.01%) ⬆️
apps.hash-api 0.00% <0.00%> (ø)
local.hash-backend-utils 3.68% <ø> (ø)
local.hash-graph-sdk 0.00% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 3.61% <0.00%> (+0.17%) ⬆️
rust.hash-graph-authorization 32.70% <ø> (+0.37%) ⬆️
rust.hash-graph-postgres-store 20.03% <ø> (ø)
rust.hash-graph-store 36.79% <ø> (ø)
rust.hash-graph-validation 83.30% <ø> (ø)

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.

Base automatically changed from t/h-4726-fix-inconsistencies-between-viewer-relationship-and to main June 11, 2025 13:41
@github-actions github-actions bot added the area/infra Relates to version control, CI, CD or IaC (area) label Jun 11, 2025
@TimDiekmann TimDiekmann requested a review from CiaranMn June 11, 2025 15:48
CiaranMn
CiaranMn previously approved these changes Jun 11, 2025
@TimDiekmann TimDiekmann force-pushed the t/h-4727-remove-usage-of-viewer-and-viewfromweb branch from 90f2582 to 7db8e49 Compare June 13, 2025 11:44
@github-actions github-actions bot removed the area/infra Relates to version control, CI, CD or IaC (area) label Jun 13, 2025
@TimDiekmann TimDiekmann force-pushed the t/h-4727-remove-usage-of-viewer-and-viewfromweb branch from 7db8e49 to 7fd79cc Compare June 13, 2025 11:44
@TimDiekmann TimDiekmann requested a review from CiaranMn June 27, 2025 23:34
Copy link
Contributor

Benchmark results

@rust/hash-graph-benches – Integrations

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$15.7 \mathrm{ms} \pm 69.7 \mathrm{μs}\left({\color{gray}0.645 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$15.7 \mathrm{ms} \pm 64.2 \mathrm{μs}\left({\color{gray}0.683 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$22.8 \mathrm{ms} \pm 138 \mathrm{μs}\left({\color{gray}1.81 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$14.9 \mathrm{ms} \pm 76.6 \mathrm{μs}\left({\color{gray}-0.123 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$15.4 \mathrm{ms} \pm 72.5 \mathrm{μs}\left({\color{gray}-0.783 \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 $$5.93 \mathrm{ms} \pm 19.8 \mathrm{μs}\left({\color{gray}-0.752 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$121 \mathrm{ms} \pm 641 \mathrm{μs}\left({\color{gray}0.357 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$112 \mathrm{ms} \pm 630 \mathrm{μs}\left({\color{gray}-0.685 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$106 \mathrm{ms} \pm 416 \mathrm{μs}\left({\color{gray}-2.226 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$96.5 \mathrm{ms} \pm 568 \mathrm{μs}\left({\color{gray}-0.923 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$133 \mathrm{ms} \pm 608 \mathrm{μs}\left({\color{gray}-1.075 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$122 \mathrm{ms} \pm 763 \mathrm{μs}\left({\color{gray}-0.614 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$212 \mathrm{ms} \pm 1.17 \mathrm{ms}\left({\color{gray}-0.909 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$205 \mathrm{ms} \pm 943 \mathrm{μs}\left({\color{gray}-1.765 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$198 \mathrm{ms} \pm 1.22 \mathrm{ms}\left({\color{gray}-1.234 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$146 \mathrm{ms} \pm 625 \mathrm{μs}\left({\color{gray}-1.940 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$229 \mathrm{ms} \pm 1.50 \mathrm{ms}\left({\color{gray}-0.209 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$215 \mathrm{ms} \pm 892 \mathrm{μs}\left({\color{gray}-1.447 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$5.28 \mathrm{s} \pm 588 \mathrm{ms}\left({\color{red}1348 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$72.3 \mathrm{ms} \pm 436 \mathrm{μs}\left({\color{gray}-0.415 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$117 \mathrm{ms} \pm 383 \mathrm{μs}\left({\color{gray}-1.198 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$85.5 \mathrm{ms} \pm 909 \mathrm{μs}\left({\color{gray}2.26 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$248 \mathrm{ms} \pm 1.42 \mathrm{ms}\left({\color{gray}-2.267 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$18.7 \mathrm{ms} \pm 77.6 \mathrm{μs}\left({\color{red}9.12 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$15.6 \mathrm{ms} \pm 70.3 \mathrm{μs}\left({\color{gray}-0.492 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$15.7 \mathrm{ms} \pm 94.5 \mathrm{μs}\left({\color{gray}0.797 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$14.8 \mathrm{ms} \pm 68.4 \mathrm{μs}\left({\color{gray}0.510 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$16.5 \mathrm{ms} \pm 79.4 \mathrm{μs}\left({\color{gray}-4.761 \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/building/v/1 $$30.4 \mathrm{ms} \pm 308 \mathrm{μs}\left({\color{gray}2.56 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$29.6 \mathrm{ms} \pm 294 \mathrm{μs}\left({\color{gray}-3.104 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$30.1 \mathrm{ms} \pm 261 \mathrm{μs}\left({\color{gray}-0.356 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$29.7 \mathrm{ms} \pm 314 \mathrm{μs}\left({\color{gray}-1.326 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$30.1 \mathrm{ms} \pm 249 \mathrm{μs}\left({\color{gray}1.36 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$29.8 \mathrm{ms} \pm 256 \mathrm{μs}\left({\color{gray}-0.227 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$29.7 \mathrm{ms} \pm 276 \mathrm{μs}\left({\color{gray}0.315 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$28.9 \mathrm{ms} \pm 241 \mathrm{μs}\left({\color{lightgreen}-5.354 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$29.2 \mathrm{ms} \pm 260 \mathrm{μs}\left({\color{gray}-2.873 \mathrm{\%}}\right) $$ Flame Graph

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-api Affects the HASH API (app) area/apps area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests area/tests New or updated tests type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team
Development

Successfully merging this pull request may close these issues.

2 participants