Skip to content

Serve modules from the client that holds them, and read a directory module's default paths from its directory - #15124

Merged
sipsma merged 4 commits into
mainfrom
sipsma/module-defaults-and-wolfi
Nov 10, 2026
Merged

sipsma merged 4 commits into
mainfrom
sipsma/module-defaults-and-wolfi

Conversation

@sipsma

@sipsma sipsma commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

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

  1. 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.

  2. 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 lstat error 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.

  3. 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 +defaultPath arguments 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 no sources member or include list is unchanged.

    One behaviour change: a directory module whose directory holds a .git now gets its Git repository default even when its file list leaves .git out.

    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.

  4. 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.

@sipsma
sipsma requested a review from a team as a code owner November 10, 2026 00:51
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
sipsma force-pushed the sipsma/module-defaults-and-wolfi branch from b0ffa9e to ec7c378 Compare November 10, 2026 01:51
@sipsma
sipsma merged commit 9f15293 into main Nov 10, 2026
97 checks passed
@sipsma
sipsma deleted the sipsma/module-defaults-and-wolfi branch November 10, 2026 02:15
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.

2 participants