Repository navigation
Serve modules from the client that holds them, and read a directory module's default paths from its directory - #15124
Merged
Merged
Conversation
tiborvass
approved these changes
Nov 10, 2026
tiborvass
approved these changes
Nov 10, 2026
A module loaded from a local workspace has its files on the host of the client that supplied the workspace. Serving one of the module's same-tree clients, or reading its declared git clients, instead read the tree from the nearest non-module client above the module. When that client is nested in a container and loaded the module through a workspace it inherited, its container doesn't hold the files, so the call failed with "lstat <path>: no such file or directory". Read the tree through the workspace's client when the source came from a workspace, as the source's own file reads already do. Signed-off-by: Erik Sipsma <[email protected]>
An exec that a module entrypoint starts records the implementation-scoped copy of its module as its module context, so its key doesn't depend on where the module was loaded. That copy is shared by content across clients and sessions, and it keeps the source of whichever client created it first, including a local module's path on that client's host. The process ran as that copy, so when it served a client module from the module's own tree, it read another client's path: "lstat <path>: no such file or directory" on another host, or another checkout's files on the same one. Start the process as the current client's own installed module instead, found the way a schema recovered from a call's history finds it. The exec's key is unchanged, so the same module at two paths still shares the process. Signed-off-by: Erik Sipsma <[email protected]>
…ame from A module that another module serves from its own tree is loaded from that tree as a directory. Its +defaultPath arguments read the module's context, which a Dang entrypoint narrows to what its module builds from: what its sources member returns, or its manifest's include list. So, called from another module, cli-dev's default source "/" held go.mod, util/parallel and cli-dev's own files, without cmd/dagger, though called directly it holds the whole repository. Its callers passed it a source instead, filtered with a copy of its ignore list. Read a directory module's default directories and files from the directory it was loaded from, as a Git module reads them from its whole checkout and a local module from its host directory. A directory module without sources or include is unchanged: its context is that directory. Signed-off-by: Erik Sipsma <[email protected]>
wolfi moves to dagger/wolfi#7's merge and alpine to dagger/alpine#8's, in the workspace, dagger-dev and the two modules that still pin wolfi directly. wolfi is now written in Dang, with alpine as an ordinary dependency, and alpine unpacks packages only when an image's files are needed. The generated Go clients are regenerated: their APIs are the same, only their source links and the commits they name change. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/module-defaults-and-wolfi
branch
from
November 10, 2026 01:51
b0ffa9e to
ec7c378
Compare
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.
Three engine fixes for modules loaded from a directory or a local workspace, and this repository's move to the merged Dagger Wolfi and Alpine modules.
What each change does
Reading a module's local tree through the client that holds it. A module loaded from a local workspace has its files on the host of the client that supplied the workspace. Serving one of the module's same-tree clients, or reading its declared Git clients, read the tree from the nearest non-module client above it instead. When that client ran in a container and had inherited the workspace, the call failed with
lstat <path>: no such file or directory. The tree is now read through the workspace's client.Running a module's process as the client's own module. An exec a module entrypoint starts records a copy of its module that is shared across clients and sessions, and that copy keeps the source of whichever client created it first. A process serving a client module from its module's own tree could therefore read another client's path: an
lstaterror on another host, or another checkout's files on the same one. The process now starts as the current client's own installed module. The exec's cache key doesn't change, so the same module at two paths still shares the process.Reading a directory module's default paths from the directory it came from. A module that another module serves from its own tree is loaded as a directory. Its
+defaultPatharguments read the module's context, which a Dang entrypoint narrows to what the module builds from. So a default of/held only those files when the module was called from another module, though it held the whole repository when called directly. Default paths now read the directory the module was loaded from, as a Git module reads its whole checkout and a local module its host directory. A directory module with nosourcesmember orincludelist is unchanged.One behaviour change: a directory module whose directory holds a
.gitnow gets its Git repository default even when its file list leaves.gitout.The modules in this repository that work around this today, by passing a filtered source to their callees, keep doing so here. That cleanup follows in a later change, once released engines carry this fix.
Moving this repository to the merged Wolfi and Alpine modules (Write wolfi in Dang, calling alpine lazily wolfi#7 and Run alpine through a generated Dang entrypoint alpine#8). Wolfi is now written in Dang and no longer declares Alpine as a client, and Alpine unpacks packages only when an image's files are needed. The generated clients are regenerated: their APIs are the same, and only their source links and the commits they name change. This should reduce what CI does to load these modules. That is expected, not yet measured, and this PR's first run is where it gets checked.
Tests
TestModule/TestModuleEntrypointSourcesDefaultPathFromCaller: a directory module's default paths, called from another module.core/integration/module_serve_tree_test.go: a module served from its tree when it was cached from another host, another checkout or another session, with and without a Dang entrypoint, and a module a nested client loads through its workspace.