Repository navigation
querybuilder: run a query's receiver while its arguments get their IDs - #308
Merged
Merged
Conversation
A query can only be sent once every object argument in it is an ID, and
getting an ID can mean running that object's own chain, such as a call
into another module. So in a chain like
slowBase.withFile(path: "/a", source: slowBuild)
the arguments got their IDs first, at the same time as each other, and
only then was the query sent, starting with slowBase. The receiver and
the arguments never overlapped, although neither depends on the other.
Now, when a step's arguments still need a request for their IDs, and
Dang marks the step's receiver as an object node(id:) can load, the chain
up to the receiver runs at the same time, ending in its ID. The rest of
the query is then selected from that ID. A query whose arguments are all
known IDs is sent whole, as before. So is a chain off a mutation, which
would run twice, and a receiver that may be null, which has no ID.
The first failure stops the other side and is the one returned. An
argument's marshal cut short by that cancellation is no longer kept, so
a later run of the same chain tries it again.
Signed-off-by: Erik Sipsma <[email protected]>
Two gaps in running a query's receiver ahead of its arguments: - Only the first step whose arguments need requests split the chain. In base.withDir(src).withExec(...).withFile(build), withExec still waited for build. The chain now splits at the last such step, and the chain up to it, run through Execute too, splits again at the one before, so every receiver runs while the arguments after it resolve. - A chain run again after its arguments got their IDs still split, adding a request: whether an argument needs one is now read from its marshalled state, not only from its value. Signed-off-by: Erik Sipsma <[email protected]>
vito
approved these changes
Nov 12, 2026
vito
left a comment
Owner
There was a problem hiding this comment.
Nice, makes sense! A little bit trickier for sure, but easy to explain at a high level: the receiver is just another input, so it should be evaluated at the same time as the rest.
sipsma
added a commit
to dagger/dagger
that referenced
this pull request
Nov 12, 2026
It brings vito/dang#308: a Dang query runs its receiver while its arguments get their IDs, so code that chains calls with arguments built from other calls no longer waits on each in turn. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
to dagger/dagger
that referenced
this pull request
Nov 13, 2026
It brings vito/dang#308: a Dang query runs its receiver while its arguments get their IDs, so code that chains calls with arguments built from other calls no longer waits on each in turn. Signed-off-by: Erik Sipsma <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 13, 2026
Hints for common mistakes get a section, with two errors as printed. Faster Dagger modules, failed declarations reported once and the GraphQL object list hint join the smaller changes. Go embedders learn that Dang no longer needs cgo, and about LoadTreeSitter. The lede and sources cover them, verified at 2918064. Signed-off-by: Alex Suraci <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A query can only be sent once every object argument in it is an ID, and getting an ID can mean running that object's own chain: for a Dagger module function, running the function. So in
the arguments got their IDs first, at the same time as each other, and only then was the query sent, starting with
wolfi.container. The receiver never overlapped its arguments, although neither depends on the other.Now, when a call has an argument whose ID still needs a request, and its receiver is an object
node(id:)can load, the chain up to the receiver runs at the same time as the arguments, ending in its ID. The rest of the query is then selected from that ID, the way a handle loaded after.syncis. With several such steps, the chain splits at the last one, and the part before it splits again, so every receiver runs ahead of the arguments after it. Everything else is sent whole, as before: a query whose arguments are already IDs, a chain off a mutation (it would run twice), and a receiver that may be null (it has no ID).The first failure stops the other side and is the one returned. An argument whose ID request was cut short by that cancellation is no longer remembered as failed, so a later run of the same chain asks again.
Measured on a Dagger module that installs system packages while it builds four Go tools, on a fresh engine: 37.4 s before, 27.2 s after (medians of four).