Fix accessing nodes (check, generate) from objects#11902
Merged
eunomie merged 2 commits intodagger:mainfrom Feb 24, 2026
Merged
Fix accessing nodes (check, generate) from objects#11902eunomie merged 2 commits intodagger:mainfrom
eunomie merged 2 commits intodagger:mainfrom
Conversation
Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
vito
approved these changes
Feb 24, 2026
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.
Note
This is a follow up to #11827 that was (partially) solving #11811
Problem | State
checkandgeneratefunctions must be listed and callable.When
checkandgeneratefunctions are defined on the main object of a module, it's working.#11827 was solving the case where
checkandgeneratefunctions are defined on a different object of a module. But this was working only on the "main" dagger module and not when defined in toolchain modules.Fix
The core change is to replace
node.Module.Toolchains.Get(name)bynode.Module.Toolchains.GetByFieldName(name)to access to the right module defining the object returned by a function. In case of a toolchain, the toolchain's object is returned by the root module, that is different than the toolchain's module. This toolchain's module is required to get access to the right type.Example:
Let's say we have a root module, defining a toolchain
python-sdk. This toolchain has a functiontestsreturning an objectPythonTeststhat contains twocheckfunctions calledslowandunit.When we will walk the dag of functions:
pythonSdkthat returns aPythonSdktype (the toolchain)rootNode.Module.Toolchains.Get("pythonSdk")will return thePythonSdktoolchain moduleObjectByNameon this module will allow to return the rightpythonSdktype that can be exploredPythonSdktype, there's atestsfunction returning an object of typePythonSdkPythonTests(because of nesting namespace)ObjectByNameon thePythonSdkmodule and not the root module onePythonSdkPythonTests, we can see the twocheckfunctionsslowandunitPreviously, the way we access the "original module" was wrong. It was working outside of a toolchain because there's only one module, so it didn't matter. This fix ensures the right module is returned and so the types are correctly inspected.
This also includes a small fix to ensure we are not duplicating the nodes, one from the root module, one from the toolchain module.
The
TestChecksAsToolchainhas been extended to ensure we can readcheckfunctions from object from toolchain.Real use case
As a real world example, this allows for instance to explode a test matrix in objects and functions.
Note
This will be available in a follow up PR but sharing it here to show, outside of the bug fix, the possibilities
Previously:
This check function will run, in parallel, the same test functions on multiple python versions. That's great but it means if we only need to run the tests on a single version (for quick feedback), it's not available by default. Or hidden behind an argument meaning we need to move away from
dagger checktodagger callwith arguments.In that case, all the specific test functions are exposed. A specific one can be called (
dagger check "python-sdk:python-314:unit"), or all unit test functions at once (dagger check "python-sdk:**:unit"), or all test functions for a specific python (dagger check "python-sdk:python-312"). This brings more clarity and possibilities for the user while still having the same final result (meaning all tests are run)