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

ROVER-279 Funnels Errors from Supergraph Config Deserialisation to LSP #2345

Merged
merged 5 commits into from
Jan 20, 2025

Conversation

jonathanrainer
Copy link
Contributor

THIS CANNOT BE MERGED UNTIL ROVER-245 HAS

So the key observation here is that the LSP needs to get back the details of errors that occur when we try and deserialise the Supergraph YAML and before this it didn't, those errors were simply printed into the DEBUG logs and then thrown away. In order to do this I've had to add a few more concepts into the work done on Subtasks etc. because in order to do this properly we need a Subtask that can send events across to multiple places (with broadcast semantics).

So the key changes in this PR follow the 3 commits:

  1. Introduce the concept of a BroadcastSubtask, so this is a subtask which acts like an ordinary subtask, except that you can ask it for more streams of events and it will give them to you, via a .subscribe() method, which copies the interface of a tokio BroadcastStream. This does have consequences for the kind of data you can send out of these subtasks (i.e. all the data has to be Cloneable) but as this is a specific use-case I see no issue with this.
  2. Introduce a new concept of a FederationWatcher (I'm not entirely sold on this name, and if someone has a better one let me know!) - This is essentially a Subtask that also watches the events produced by the SupergraphConfigWatcher but acts differently depending on what those events are. Initially it just printed but in the future we can use this new Subtask to watch, and hopefully update, the supergraph binary we're using (which is work that will come down the track in short order)
  3. With all of that in mind, add the ability to feed those errors back into the LSP itself, so they display in the IDE, an example of which is shown below

Screenshot 2025-01-08 at 13 37 58

@jonathanrainer jonathanrainer requested a review from a team as a code owner January 8, 2025 13:38
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Jan 8, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 37742f44ef350d29f9e81f90

@jonathanrainer jonathanrainer force-pushed the jr/task/ROVER-245 branch 3 times, most recently from dcaa3a6 to 487336e Compare January 15, 2025 11:07
Copy link
Contributor

@aaronArinder aaronArinder left a comment

Choose a reason for hiding this comment

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

this would have been a lot without your demo/walkthrough, so thanks; broadcastsubtask is pretty sweet!

FsWriteFile::default(),
client_config.service()?,
fetch_remote_subgraph_factory.boxed_clone(),
1,
Copy link
Contributor

Choose a reason for hiding this comment

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

worth being a const? what does this 1 represent, threads or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it's the retry interval for introspection, but this is actually fixed in the ROVER-245 PR because it gets turned into a command line option, which is a lot clearer anyway!

src/composition/runner/mod.rs Outdated Show resolved Hide resolved
Base automatically changed from jr/task/ROVER-245 to main January 20, 2025 15:37
In order to route errors properly to the LSP we need to introduce
a new type of subtask which can broadcast out to multiple
receivers. This we have done, and have thus had to implement a few
changes to other underlying infrastructure, but not too much.
This probably needs renaming but the idea is that this is
also watching events that come from watching the SupergraphConfig
and will also react to them.
The handling is rudimentary at the minute, but it surfaces errors
properly, which is the key
@jonathanrainer jonathanrainer merged commit 30a53c2 into main Jan 20, 2025
32 checks passed
@jonathanrainer jonathanrainer deleted the jr/task/ROVER-279 branch January 20, 2025 16:08
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.

3 participants