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-1755, H-3349, H-3351: Enable setting and using plural and inverse type names #5579

Merged
merged 8 commits into from
Nov 5, 2024

Conversation

CiaranMn
Copy link
Member

@CiaranMn CiaranMn commented Nov 4, 2024

🌟 What is the purpose of this PR?

This PR updates the frontend to allow users to set two additional properties on types:

  1. On entity and link types, set the 'plural' name that will be used when referring to multiple of that thing
  2. For link types, set the 'inverse' name that will be used when referring to the inverse of the relationship (e.g. 'Employed By' -> 'Employs').

It also adds endpoints to the Node API to have LLMs make suggestions for those based on the singular name, and provides those to the user when filling out the form.

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

📹 Demo

Kapture.2024-11-04.at.18.12.27.mp4
Kapture.2024-11-04.at.18.37.24.mp4

@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/blocks Relates to first-party blocks (area) 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/apps area/infra > terraform labels Nov 4, 2024
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

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

Project coverage is 20.09%. Comparing base (c76851c) to head (da7bb61).
Report is 59 commits behind head on main.

Files with missing lines Patch % Lines
...c/graphql/resolvers/generation/generate-inverse.ts 0.00% 16 Missing ⚠️
...rc/graphql/resolvers/generation/generate-plural.ts 0.00% 16 Missing ⚠️
...ql/resolvers/generation/is-generation-available.ts 0.00% 10 Missing ⚠️
...aphql/resolvers/generation/shared/openai-client.ts 0.00% 6 Missing ⚠️
...-utils/src/graphql/type-defs/generation.typedef.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5579      +/-   ##
==========================================
- Coverage   20.15%   20.09%   -0.06%     
==========================================
  Files         509      514       +5     
  Lines       17319    17368      +49     
  Branches     2538     2545       +7     
==========================================
  Hits         3490     3490              
- Misses      13791    13840      +49     
  Partials       38       38              
Flag Coverage Δ
apps.hash-api 1.17% <0.00%> (-0.02%) ⬇️

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.

@vilkinsons
Copy link
Member

@CiaranMn Please can we address the feedback from Slack? I'm not seeing this on the hash-az9qxxcz5.stage.hash.ai deployment.

@CiaranMn
Copy link
Member Author

CiaranMn commented Nov 5, 2024

@CiaranMn Please can we address the feedback from Slack? I'm not seeing this on the hash-az9qxxcz5.stage.hash.ai deployment.

This is implemented - the preview deployment does not have the API endpoints for generation so it should have the behaviour the same as when no API keys are available, ie. editing the fields is available as soon as a title is set

vilkinsons
vilkinsons previously approved these changes Nov 5, 2024
Copy link
Member

@vilkinsons vilkinsons left a comment

Choose a reason for hiding this comment

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

Ack. Ty!

@github-actions github-actions bot added area/tests New or updated tests area/tests > playwright New or updated Playwright tests labels Nov 5, 2024
@CiaranMn CiaranMn added this pull request to the merge queue Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

Benchmark results

@rust/graph-benches – Integrations

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 25 entities $$74.2 \mathrm{ms} \pm 404 \mathrm{μs}\left({\color{gray}0.294 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$24.6 \mathrm{ms} \pm 150 \mathrm{μs}\left({\color{gray}-2.499 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$19.7 \mathrm{ms} \pm 85.5 \mathrm{μs}\left({\color{gray}0.056 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$51.2 \mathrm{ms} \pm 215 \mathrm{μs}\left({\color{gray}0.036 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$556 \mathrm{ms} \pm 2.73 \mathrm{ms}\left({\color{red}105 \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 $$16.5 \mathrm{ms} \pm 175 \mathrm{μs}\left({\color{gray}-1.830 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$16.7 \mathrm{ms} \pm 221 \mathrm{μs}\left({\color{gray}-0.195 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$17.1 \mathrm{ms} \pm 238 \mathrm{μs}\left({\color{gray}0.055 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$16.7 \mathrm{ms} \pm 183 \mathrm{μs}\left({\color{gray}-3.716 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$16.6 \mathrm{ms} \pm 192 \mathrm{μs}\left({\color{gray}0.264 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$16.3 \mathrm{ms} \pm 180 \mathrm{μs}\left({\color{gray}-2.471 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$16.6 \mathrm{ms} \pm 213 \mathrm{μs}\left({\color{gray}0.227 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$16.5 \mathrm{ms} \pm 171 \mathrm{μs}\left({\color{gray}0.504 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$17.2 \mathrm{ms} \pm 230 \mathrm{μs}\left({\color{gray}3.58 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 25 entities $$3.26 \mathrm{ms} \pm 11.7 \mathrm{μs}\left({\color{red}18.7 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$1.94 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}0.940 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.86 \mathrm{ms} \pm 10.3 \mathrm{μs}\left({\color{gray}0.141 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.09 \mathrm{ms} \pm 8.14 \mathrm{μs}\left({\color{gray}-0.523 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$5.34 \mathrm{ms} \pm 39.2 \mathrm{μs}\left({\color{gray}2.01 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$1.85 \mathrm{ms} \pm 7.23 \mathrm{μs}\left({\color{gray}-0.649 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$13.5 \mathrm{ms} \pm 82.5 \mathrm{μs}\left({\color{gray}0.236 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.01 \mathrm{ms} \pm 9.54 \mathrm{μs}\left({\color{gray}2.09 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$2.75 \mathrm{ms} \pm 15.6 \mathrm{μs}\left({\color{gray}-4.601 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$1.87 \mathrm{ms} \pm 7.55 \mathrm{μs}\left({\color{gray}0.102 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$107 \mathrm{ms} \pm 497 \mathrm{μs}\left({\color{gray}0.218 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$89.3 \mathrm{ms} \pm 443 \mathrm{μs}\left({\color{gray}-0.033 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$98.2 \mathrm{ms} \pm 492 \mathrm{μs}\left({\color{gray}-0.516 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$42.6 \mathrm{ms} \pm 305 \mathrm{μs}\left({\color{gray}-0.900 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$94.5 \mathrm{ms} \pm 640 \mathrm{μs}\left({\color{gray}0.670 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$81.1 \mathrm{ms} \pm 486 \mathrm{μs}\left({\color{gray}-0.141 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$68.8 \mathrm{ms} \pm 367 \mathrm{μs}\left({\color{gray}0.429 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$49.4 \mathrm{ms} \pm 292 \mathrm{μs}\left({\color{gray}-0.877 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$58.6 \mathrm{ms} \pm 376 \mathrm{μs}\left({\color{gray}0.360 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$40.3 \mathrm{ms} \pm 153 \mathrm{μs}\left({\color{gray}0.201 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$54.3 \mathrm{ms} \pm 338 \mathrm{μs}\left({\color{gray}0.935 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$44.1 \mathrm{ms} \pm 315 \mathrm{μs}\left({\color{gray}0.177 \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 $$1.37 \mathrm{ms} \pm 4.58 \mathrm{μs}\left({\color{gray}-0.098 \mathrm{\%}}\right) $$ Flame Graph

Merged via the queue into main with commit 41f4fd2 Nov 5, 2024
164 checks passed
@CiaranMn CiaranMn deleted the cm/inverse-and-plural-type-titles branch November 5, 2024 17:54
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 > terraform area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) 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.

2 participants