Repository navigation
Conversation
A module served from its caller's tree is a Dir-kind source that keeps the identity of that tree, so its cache volumes match the module loaded directly. Its own local dependencies were loaded with Directory.asModuleSource on the parent's context directory without that origin, so they fell back to the content-digest namespace. A legacy module served by a migrated module then built its dependencies, such as the go module, from cold caches that also rotate with every change of their files. Pass the parent's origin to the dependency when the dependency lives in the same tree. Its namespace is then the one of the dependency loaded directly, and the implementation-scoped digests include it as they do for served modules. Sources without an origin select exactly what they did before. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
force-pushed
the
engine-dir-dependency-origin
branch
from
October 23, 2026 13:27
0946493 to
f9d27f3
Compare
This was referenced Oct 23, 2026
Contributor
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Contributor
|
This PR was closed because it has been stalled for 7 days with no activity. |
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.
Follow-up to #14813.
Problem
#14813 gives a module served from its caller's tree the identity of that tree, so its cache volumes match the same module loaded directly. That module's own local dependencies didn't inherit it.
ResolveDepToSourceloads a local dependency of a Dir-kind parent withDirectory.asModuleSourceon the parent's context directory and no origin. The dependency then falls back to the content-digest namespace.This shows up when a migrated module serves a legacy one. On #14840, a migrated module's client serves legacy
cmd/codegenandgo-client-dev, and their dependency on thegomodule creates its volumes inmod(goxxh3:ed7b24ab65610363):mod(gogithub.com/dagger/dagger/.dagger/modules/go).Five checks are hit, about 15 minutes of extra check time per event: 2117s against 1221s on main.
release/publish-with-mock-endpointspython-client/client-library/staleelixir-client/client-library/stalerust-client/apiclient/staledotnet-client/testFix
A local dependency of a Dir-kind source with an origin is loaded with the parent's origin root, when the dependency lives in the same tree. Its identity is the root plus its own path (
.dagger/modules/engine-dev+../gogives<root>/.dagger/modules/go), so its namespace is that of the dependency loaded directly. Dependencies of dependencies follow from the same rule. The implementation-scoped digests include the origin, as they do since #14813.Sources without an origin select exactly the same
asModuleSourcecall as before, so their IDs and caches don't change. A dependency path that leaves the tree gets no origin. No public API change.Tests
Unit:
TestDirDependencySourceArgscovers:../godependency under a Git root and under a local root;Integration:
TestServeModuleCallerTree/dependency_of_a_served_sibling_shares_the_caches_of_the_same_module_loaded_directly.Integration:
TestServeModuleCacheNamespaces, a table over these dimensions:Each cell writes to a cache volume through the module it reaches, then loads the module that owns the volume directly from the same path, and expects to find the write. This is the invariant behind core: serve the module to an entrypoint's call process #14767, core: same-repo modules and module entrypoints share their caches #14813 and this change, checked in one place.
On a dev engine built from this PR, all 12 cells and the dependency subtest pass. On v1.0.0-beta.21 the three "legacy module at depth 2" cells and the dependency subtest fail, and the other nine cells pass.
Limits
Related: #14813, #14840.