Runtime hook for breadth execution patterns #5425
Open
+331
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a hook into the execution runtime that allows an evaluated selection to exit with its resolved inner value. This allows a breadth-first execution process to run a single generation of resolvers at a time across a set of objects, ex:
This general breadth capability relies on two runtime methods:
evaluate_selection(result_key, ast_nodes, selections_result)
exit_with_inner_result?(inner_result, result_name, selection_result)
The expected capabilities are covered by a simple example of a breadth-based runtime in tests. This is still an experimental workflow, so it seems worthwhile to keep the new code footprint minimal for the time being (just
exit_with_inner_result?
) and in a state that can be backed out easily.In the future, we'd ideally formalize a structure like this
SimpleBreadthRuntime
as a supported library feature. The actual breadth prototype I have in the works uses this same basic design while caching breadth objects across fields and consolidating the lazy hooks across scopes. It appears capable of passing some existing test suites while running slightly faster than native depth execution.