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-1978, H-1979, H-2013, H-2014: Update type icons, labels, dataTypes #5982

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

Conversation

CiaranMn
Copy link
Member

@CiaranMn CiaranMn commented Dec 20, 2024

🌟 What is the purpose of this PR?

This PR contains a list of changes to:

  1. Entity type icons
  2. Entity type pluralTitle and inverse titles
  3. Expected data type for some data types (e.g. replace Text with URI or DateTime where appropriate)
  4. Rename a couple of types (Image -> Image File, Quick Note –> Note)
  5. Default provenance information for entities that might not have it

It also contains the necessary TS type changes and where we specify a dataTypeId to make sure it is correct.

The list of changes in the two files is intended for conversion into a migration script to overwrite types in the production db directly, to avoid the migration effort involved in updating all of these types to new versions (which would be significantly more complicated, given the dependency graph).

apps/hash-api/src/graph/ensure-system-graph-is-initialized/labels-icons-data-types.ts
apps/hash-api/src/graph/ensure-system-graph-is-initialized/provenance-defaults.ts

Deployment of this requires discussion as we need to coordinate the deployment of the Node API and frontend with the changes to types in the prod db, particurlarly due to:

  1. Renaming entity types: the entity types in the db need to match the types being specified by the clients
  2. Changing expected data type for some properties: the dataTypeId specified by the clients needs to match that expected by the API

🚫 Blocked by

  • Switch local BP type in HASH to use HASH URI data type rather than BP one
  • Check what happens if a user enters an invalid URL in the early access form and show an inline message on the input rather than whatever less user-friendly thing happens will likely happen currently
  • H-3847: discuss coordination
  • H-3848: Merging this PR is blocked by a new eslint error created by an update to json-schema-to-typescript which is generating data type enums differently

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

🐾 Next steps

Discuss coordination of changes.

@github-actions github-actions bot added area/apps > hash* Affects HASH (a `hash-*` app) area/infra Relates to version control, CI, CD or IaC (area) 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 Dec 20, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

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

Project coverage is 21.68%. Comparing base (e2b947d) to head (4ecd4fc).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...system-graph-is-initialized/provenance-defaults.ts 0.00% 8 Missing ⚠️
...-from-document-action/generate-property-patches.ts 0.00% 7 Missing ⚠️
...em-graph-is-initialized/labels-icons-data-types.ts 0.00% 5 Missing ⚠️
...ations/003-create-linear-system-types.migration.ts 0.00% 4 Missing ⚠️
.../hash-api/src/graph/knowledge/system-types/file.ts 0.00% 4 Missing ⚠️
...grations/001-create-hash-system-types.migration.ts 0.00% 3 Missing ⚠️
...s/hash-api/src/graph/knowledge/system-types/org.ts 0.00% 3 Missing ⚠️
...ns/000-create-first-custom-data-types.migration.ts 0.00% 2 Missing ⚠️
.../019-add-doc-company-and-person-types.migration.ts 0.00% 2 Missing ⚠️
...m-graph-is-initialized/system-webs-and-entities.ts 0.00% 2 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5982      +/-   ##
==========================================
- Coverage   21.73%   21.68%   -0.06%     
==========================================
  Files         566      568       +2     
  Lines       19159    19176      +17     
  Branches     2755     2755              
==========================================
- Hits         4165     4158       -7     
- Misses      14942    14966      +24     
  Partials       52       52              
Flag Coverage Δ
apps.hash-api 1.15% <0.00%> (-0.01%) ⬇️

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
Contributor

Benchmark results

@rust/hash-graph-benches – Integrations

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$15.7 \mathrm{ms} \pm 174 \mathrm{μs}\left({\color{lightgreen}-32.556 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$16.3 \mathrm{ms} \pm 140 \mathrm{μs}\left({\color{gray}4.34 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$16.5 \mathrm{ms} \pm 173 \mathrm{μs}\left({\color{red}6.17 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$15.6 \mathrm{ms} \pm 171 \mathrm{μs}\left({\color{lightgreen}-6.682 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$16.5 \mathrm{ms} \pm 184 \mathrm{μs}\left({\color{gray}-0.106 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$16.2 \mathrm{ms} \pm 165 \mathrm{μs}\left({\color{gray}-0.057 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$16.2 \mathrm{ms} \pm 183 \mathrm{μs}\left({\color{gray}3.78 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$15.5 \mathrm{ms} \pm 176 \mathrm{μs}\left({\color{lightgreen}-35.415 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$16.2 \mathrm{ms} \pm 180 \mathrm{μs}\left({\color{lightgreen}-31.064 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$64.2 \mathrm{ms} \pm 214 \mathrm{μs}\left({\color{gray}-0.070 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$37.7 \mathrm{ms} \pm 236 \mathrm{μs}\left({\color{gray}-1.205 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$55.0 \mathrm{ms} \pm 227 \mathrm{μs}\left({\color{gray}-0.761 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$42.2 \mathrm{ms} \pm 300 \mathrm{μs}\left({\color{gray}1.52 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$47.1 \mathrm{ms} \pm 231 \mathrm{μs}\left({\color{gray}0.452 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$52.3 \mathrm{ms} \pm 225 \mathrm{μs}\left({\color{gray}1.59 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$96.6 \mathrm{ms} \pm 310 \mathrm{μs}\left({\color{gray}-1.297 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$36.5 \mathrm{ms} \pm 172 \mathrm{μs}\left({\color{gray}-1.036 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$89.1 \mathrm{ms} \pm 573 \mathrm{μs}\left({\color{gray}0.684 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$71.7 \mathrm{ms} \pm 312 \mathrm{μs}\left({\color{gray}-0.123 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$81.1 \mathrm{ms} \pm 246 \mathrm{μs}\left({\color{gray}1.19 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$85.1 \mathrm{ms} \pm 475 \mathrm{μs}\left({\color{gray}0.518 \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.12 \mathrm{ms} \pm 11.5 \mathrm{μs}\left({\color{gray}-0.061 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$5.35 \mathrm{s} \pm 539 \mathrm{ms}\left({\color{gray}-1.268 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$27.0 \mathrm{ms} \pm 108 \mathrm{μs}\left({\color{gray}0.487 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$20.6 \mathrm{ms} \pm 62.7 \mathrm{μs}\left({\color{gray}-1.103 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$31.3 \mathrm{ms} \pm 169 \mathrm{μs}\left({\color{lightgreen}-45.050 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$179 \mathrm{ms} \pm 560 \mathrm{μs}\left({\color{gray}0.994 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$1.96 \mathrm{ms} \pm 5.30 \mathrm{μs}\left({\color{gray}-2.585 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.08 \mathrm{ms} \pm 6.48 \mathrm{μs}\left({\color{gray}-1.401 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.01 \mathrm{ms} \pm 9.68 \mathrm{μs}\left({\color{gray}-1.077 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$2.89 \mathrm{ms} \pm 8.60 \mathrm{μs}\left({\color{gray}-0.034 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$9.41 \mathrm{ms} \pm 93.6 \mathrm{μs}\left({\color{lightgreen}-30.630 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$4.22 \mathrm{ms} \pm 18.0 \mathrm{μs}\left({\color{gray}0.744 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$1.98 \mathrm{ms} \pm 7.02 \mathrm{μs}\left({\color{gray}-1.951 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.97 \mathrm{ms} \pm 8.63 \mathrm{μs}\left({\color{gray}-2.714 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.09 \mathrm{ms} \pm 9.53 \mathrm{μs}\left({\color{lightgreen}-5.603 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$3.35 \mathrm{ms} \pm 17.5 \mathrm{μs}\left({\color{gray}-3.006 \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/blocks Relates to first-party blocks (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright 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.

1 participant