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

Subgraph composition query execution #12

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Jan 15, 2020


@vercel
Copy link

vercel bot commented Jan 15, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/graphprotocol/rfcs/jq1e55ivb
✅ Preview: https://rfcs-git-subgraph-composition-query-execution.graphprotocol1.now.sh

@vercel vercel bot temporarily deployed to Preview January 16, 2020 15:26 Inactive
@Jannis
Copy link
Contributor

Jannis commented Jan 17, 2020

Until #6 is merged, this PR should probably be against #6 instead of master, so it only includes the query execution changes.

<dd><a href="../rfcs/0001-subgraph-composition.md">RFC-0001 Subgraph Composition</a></dd>

<dt>Engineering Plan pull request</dt>
<dd><a href="">Engineering Plan PR</a></dd>
Copy link
Contributor

Choose a reason for hiding this comment

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

We can add https://github.com/graphprotocol/rfcs/pull/12 as the href URL now.


## Summary

Since subgraph composition allows a subgraph to import types from another subgraph, GraphQL query execution will need to traverse a subgraph's import graph to resolve concrete types.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's always good to provide some context / what this plan is about before diving straight into details. A brief paragraph saying that this plan covers the query execution part of the Subgraph Composition RFC would be good.


Since subgraph composition allows a subgraph to import types from another subgraph, GraphQL query execution will need to traverse a subgraph's import graph to resolve concrete types.
Because imported schemas/types are loosely coupled, query execution also needs to address missing types in the api schema during resolution.
In addition, imported types which have been renamed need to be mapped back to their original name so that queries can resolve correctly.
Copy link
Contributor

Choose a reason for hiding this comment

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

renamed -> imported with an alias

Comment on lines +35 to +38
1. Support Custom Type Names: Ensure @originalName directives on the imported types are used to query the correct sql tables.
2. Codify New Query Runtime Errors: Ensure @placeholder types are acknowledged and proper errors are returned during query execution when a type's subgraph is not deployed to the graph-node resolving the query.
3. Query Correct Subgraph: Ensure that @subgraphId directives on imported types are used correctly in all cases.
4. Add Subgraph Composition Feature Flag: Ensure subgraphs JSONB storage can not use subgraph composition.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's escape directive names with backticks here to render them as inline code.

1. Support Custom Type Names: Ensure @originalName directives on the imported types are used to query the correct sql tables.
2. Codify New Query Runtime Errors: Ensure @placeholder types are acknowledged and proper errors are returned during query execution when a type's subgraph is not deployed to the graph-node resolving the query.
3. Query Correct Subgraph: Ensure that @subgraphId directives on imported types are used correctly in all cases.
4. Add Subgraph Composition Feature Flag: Ensure subgraphs JSONB storage can not use subgraph composition.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this isn't really a feature flag. Since no new subgraphs will be deployed using the JSONB schema and composition isn't yet possible, I think an unreachable!() in the right place may suffice.

Comment on lines +94 to +96
### Add Subgraph Composition Feature Flag

Do not allow subgraph composition for subgraphs which use the JSONB storage engine.
Copy link
Contributor

Choose a reason for hiding this comment

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

Like I pointed out, I don't think this is a feature flag?

Comment on lines +98 to +101
## Tests

### Unit Tests:

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing


### Integration Tests:

1. Querying an A || [A] with an imported field B || [B] with an imported field C
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what this means.

We have support for integration tests via graph test now. I'd say we want a few tests that deploy and query subgraphs that use composition. Tests that involve imported subgraphs being either absent or present. I can help with writing those tests (since this will be new to you), but an overview of the tests that we'd want should be written down here.

Comment on lines +118 to +121
- Support custom type names (1d)
- Codify new query execution runtime errors (1d)
- Add subgraph composition feature flag (1d)
- Ensure correct subgraph is queried during single object resolution and prefetch paths (3d)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing:

  • Integration tests (estimate?)

And I'm not sure the feature flag thing is accurate.

- Add subgraph composition feature flag (1d)
- Ensure correct subgraph is queried during single object resolution and prefetch paths (3d)

## Open Questions
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are none, either put a paragraph below saying None or drop the section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant