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

validate that mappings only set valid fields #1455

Closed
azf20 opened this issue Sep 18, 2023 · 1 comment
Closed

validate that mappings only set valid fields #1455

azf20 opened this issue Sep 18, 2023 · 1 comment
Assignees
Labels
area/cli enhancement New feature or request

Comments

@azf20
Copy link
Contributor

azf20 commented Sep 18, 2023

Previously using store.set you could set non-existent fields on an entity. This is a determinism bug (depending on whether the entity is fetched from the cache or the store). This was fixed in graphprotocol/graph-node#4807. We should ideally catch this behaviour at build time, rather than failing at runtime.

@saihaj saihaj added this to Tooling Sep 18, 2023
@saihaj saihaj moved this to 🔖 Next in Tooling Sep 18, 2023
@saihaj saihaj added enhancement New feature or request area/cli labels Sep 18, 2023
@saihaj saihaj self-assigned this Sep 18, 2023
@theguild-bot theguild-bot mentioned this issue Oct 31, 2023
26 tasks
@saihaj
Copy link
Member

saihaj commented Dec 6, 2023

after some more thought and discussions internally. This is great idea, there are few ways we could go about and none of them are reasonable as of now:

  1. At AssmeblyScript level if generic types were possible similar to how in TypeScript we can write some generics and let structural typings and rely on TS complier. But sadly we can't use the Typescript generics example I shared in AssemblyScript.
  2. We can try to do this validation at a pre-build step. Which is computationally expensive and we will end up building our custom type checker which is much more involved project and not sure how much benefit there is given this is a rare case we are helping avoid developers
  3. AssemblyScript doesn't have protected or private class members, that would have been simplest way where we force users to always use Entities and set values on the field instead of being able to call arbitrary .set() on an entity which could avoid lot of these issues.

Maybe if this becomes too big of an issue we should considerer re-opening and maybe by then there are some improvements in AssmeblyScript that we can build on top of.

@saihaj saihaj closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
@github-project-automation github-project-automation bot moved this from 🔖 Next to ✅ Done in Tooling Dec 6, 2023
This was referenced Apr 30, 2024
This was referenced May 7, 2024
@theguild-bot theguild-bot mentioned this issue Oct 15, 2024
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants