Repository navigation
Drop the polyfill for the engine's findRoots - #6
Merged
Merged
Conversation
The engine now ships Workspace.findRoots (dagger/dagger#13854): the same cwd-aware project discovery this module got from github.com/dagger/polyfill — same semantics, ported from the polyfill's own design and test matrix. Swap the call, drop the dependency, and require the engine release that ships it. The helper was called findConfigDirs while it was in review; it shipped in v1.0.0-beta.10 as findRoots, taking markers instead of filenames. The contract is unchanged: cwd-relative paths for the caller's own project and everything below it, plus the nearest enclosing project as a ".."-relative path, so inCone still tells the two apart. The engineVersion bump and the dependency removal have to land together: the version gate is what keeps the engine's new changeset behavior scoped to migrated modules. The e2e harness moves to the same version — it still declared v1.0.0-beta.6, which would have exercised the module under test through an older schema view than the one it ships against. Signed-off-by: Guillaume de Rouville <[email protected]> Signed-off-by: Tom Chauveau <[email protected]>
TomChv
marked this pull request as ready for review
August 26, 2026 11:22
TomChv
self-requested a review
August 26, 2026 11:22
findRoots answers relative to the caller — "." for its own directory, ".."
for an enclosing project — and the module read those back as if they were
workspace-root-relative. From anywhere but the workspace root that names a
directory that does not exist, so every command driving discovery or a
lookup failed:
$ cd .dagger/modules/e2e/modules
$ dagger -m ../../.. call project --path hello workspace-root
workspace directory ".dagger/modules/e2e/modules/.dagger/modules/e2e/modules/hello":
... no such file or directory
This predates the migration and reproduces identically on main at
v1.0.0-beta.6; the native call inherits the polyfill's contract, so fix it
where that contract is read. Discovery resolves each hit once, and reads go
through workspace-absolute paths, which is also what lets findWorkspaceRoot
walk above the caller: from inside a member the enclosing workspace root is
an ancestor, and only a walk terminating at "." can reach it. Discovery
alone never sees that root — it is out of range from below — so `projects`
resolves each project's workspace root by walking up rather than from the
roots it happened to discover. Without it a member is mounted as a
standalone project and its cross-member imports do not resolve.
The caller's location still decides one thing: the CLI applies a
generator's changeset from where the caller stands, so the generators key
their directories there instead of at the workspace root. Verified by
applying one from a subdirectory and confirming it landed on the intended
file.
subdir-discovery-check covers all of it from inside a workspace member: the
lookup, the root above the caller surviving being mounted (the cross-member
@ws/util import only resolves from there), the fan-out verbs, and the
changeset keying. It fails without this patch with "stat add/add: no such
file or directory".
Signed-off-by: Tom Chauveau <[email protected]>
TomChv
force-pushed
the
polyfill-removal
branch
from
August 26, 2026 11:34
166a80b to
51285af
Compare
v1.0.0-beta.10 writes lockfile format v2, so the first command run against the engine this module now requires rewrites dagger.lock. Landing it here keeps that churn out of the next unrelated change. The migration is not only a format bump. v1 recorded one floating git.head for dang-sdk; v2 records the resolved git.ref plus a digest for every container.from the checks reach, so the deno and debian base images are now pinned by digest rather than re-resolved per run. The dang-sdk entry moves from 6c63cd0 to 5da2636 because the old pin floated and 5da2636 is where main sits today. Generated by running dagger check, which reaches every lookup recorded here; a second run reproduces the file byte for byte. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
approved these changes
Aug 26, 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.
The Deno module uses
dagger/polyfillto choose projects and workspace members relative to where Dagger was started. From above a workspace it should see the members below; from inside a project it should select the nearest enclosing project.Workspace.findRootsin dagger/dagger#13854 is the native version of those rules, shipped inv1.0.0-beta.10. This PR uses it directly and removes the wrapper. Deno installation, permissions, formatting, and dependency behavior do not change.The helper was called
findConfigDirswhile it was in review; it shipped asfindRoots, takingmarkersinstead offilenames. The contract is unchanged.Three patches:
1. Drop the polyfill for the engine's findRoots. The call swap, the
engineVersionbump, and the dependency removal, together. The e2e harness moves to the same version — it still declaredv1.0.0-beta.6, so it would have exercised the module under test through an older schema view than the one it ships against.2. Resolve discovered project roots from the workspace root.
findRootsanswers relative to the caller —"."for its own directory,".."for an enclosing project — and the module read those back as if they were workspace-root-relative. From anywhere but the workspace root that names a directory that does not exist:This predates the migration and reproduces identically on
mainatv1.0.0-beta.6; it is fixed here because the native call inherits the same contract. Resolving discovery once is also what letsfindWorkspaceRootwalk above the caller: from inside a member the enclosing workspace root is an ancestor, and discovery never sees it from below, soprojectsresolves each project's workspace root by walking up rather than from the roots it happened to discover. Without that a member is mounted as a standalone project and its cross-member imports do not resolve.The caller's location still decides one thing: the CLI applies a generator's changeset from where the caller stands, so the generators key their directories there instead of at the workspace root.
3. Migrate the lockfile to the v2 format.
v1.0.0-beta.10writes lockfile format v2, so the first command run against the engine this module now requires rewritesdagger.lock. Landing it here keeps that churn out of the next unrelated change. It is not only a format bump: v1 recorded one floatinggit.headfor dang-sdk, while v2 records the resolvedgit.refplus a digest for everycontainer.fromthe checks reach, so the deno and debian base images are now pinned by digest rather than re-resolved per run. The dang-sdk entry moves from6c63cd0to5da2636because the old pin floated and5da2636is wheremainsits today.Test
dagger checkAll 17 checks pass, including workspaces, subdirectories, permissions, installs, formatting, dependencies, and legacy Deno versions.
subdir-discovery-checkis new and covers patch 2 from inside a workspace member: the lookup, the root above the caller surviving being mounted (the cross-member@ws/utilimport only resolves from there), the fan-out verbs, and the changeset keying. It fails without patch 2 withstat add/add: no such file or directory. The changeset-rooting behavior was confirmed against the CLI by applying aformatAllfrom a subdirectory and checking which file it landed on.The lockfile in patch 3 is what that same
dagger checkwrites; a second run reproduces it byte for byte.