feat(checks): cover workspace configs in a git subdirectory - #17
Merged
Conversation
TomChv
force-pushed
the
monorepo-subdir-config-checks
branch
from
August 13, 2026 12:28
e75bffb to
9781f84
Compare
Every workspace the checks built put dagger.toml at the git root, so nothing covered the monorepo layout where several project workspaces sit in subdirectories of one repository. That is the shape dagger/dagger#13889 is about: the workspace root is the git root, so the caller's cwd sits below it and module paths cross the engine <-> SDK boundary root-relative while the selected config reads them relative to itself. Add a `monorepo` group building a third workspace: dagger.toml in `common/`, the SDK vendored under it, every command driven from `common/`. - installs-from-subdir-config: `sdk install` registers the SDK in common/dagger.toml. - scaffolds-module-from-subdir-config: `module init` writes common/.dagger/modules/subdir-mod/dagger-module.toml. - keeps-module-under-subdir-config: `module init` writes nothing outside the module directory. - subdir-module-loads: the scaffolded module generates and serves its API. - explicit-path-keeps-module-whole: `module init --path` writes the module config at the requested path and nothing outside it. The --path check asserts co-location, not installation. The engine gates the [modules.<name>] entry on `usingDefaultPath`, so an explicit path authors a module without installing it — the same at a git-root workspace, so it is not a monorepo defect. What the issue reports there is a split: the engine's module config and the SDK's files landing in two different directories. Two of the five pass. The other three are one engine defect and stay red until it is fixed: initModuleChanges computes relPath workspace-root-relative, writes the module's dagger-module.toml there, then records `source = relPath` in a config whose sources resolve relative to its own directory. They assert the contract, not a convention, so they hold whichever side is reconciled. sdk-sdk stages files without the cwd-scoped polyfill fork, so it shows the failure the issue does not: `module init` raises nothing and writes the whole module — config and sources — at the git root, while common/dagger.toml registers it at common/.dagger/modules/subdir-mod. Every later command that loads the workspace fails. No SDK-side fix reaches this; prefixing the SDK's changeset with ws.cwd moves only its half and splits the module, leaving the engine's dagger-module.toml stranded at the git root. Signed-off-by: Tom Chauveau <tom@dagger.io>
dagger/dagger#13890 landed in 1.0.0-beta.10 and fixes the three checks this group added red: init changesets are now applied at the workspace root with the SDK shown a matching cwd, and the default module path is anchored at the directory holding the dagger.toml being edited. It also changed `module init --path` deliberately. The path now resolves against the caller's cwd, with a leading slash meaning the workspace root, like every other workspace path a user types. explicit-path-keeps-module-whole passed a workspace-root-relative path naming the config directory, which under the new resolver means a directory of that name *below* the config directory, so it asserted the old spelling. Pass a relative path instead and assert it lands under the caller's cwd. Add rooted-path-anchors-module-at-root for the other half of the resolver. With the default path now anchored beside its dagger.toml and a relative --path resolved against the caller, a leading slash is the only remaining way to hand the SDK a module path the caller's cwd does not contain — the shape a cwd-scoped SDK cannot stage at all. beta.9 rejected it outright as absolute. Five of the six now fail on beta.9 and all six pass on beta.10. Signed-off-by: Tom Chauveau <tom@dagger.io>
TomChv
force-pushed
the
monorepo-subdir-config-checks
branch
from
August 20, 2026 16:12
9781f84 to
4185901
Compare
eunomie
added a commit
to grouville/php-sdk
that referenced
this pull request
Aug 21, 2026
The committed lock was still in the v1 format, whose `float` entry the current CLI no longer honors: every run silently re-resolved sdk-sdk to whatever main pointed at and rewrote the file. Recording it in v2 makes the revision the checks actually run against explicit again. Pinning it here also matters for what it contains. The old entry named `e1747f4`, which still declared `daggerCliVersion = "1.0.0-beta.9"`, and a beta.9 CLI cannot drive a beta.10 engine — beta.10 moved registering a function's required `Workspace` argument as a CLI flag out of the engine and into the CLI, so the older CLI never sees `initModule` and the contract checks fail with `unknown command "init-module"`. dagger/sdk-sdk#14 fixed that pin, and dagger/sdk-sdk#17 then added the `monorepo` group, which drives a workspace whose dagger.toml sits in a git subdirectory — the layout where module paths cross the engine/SDK boundary root-relative while the selected config reads them relative to itself. That is exactly what this module's path anchoring has to get right, so it is worth being on. Signed-off-by: Yves Brissaud <yves@dagger.io>
eunomie
added a commit
to grouville/php-sdk
that referenced
this pull request
Aug 21, 2026
The committed lock was still in the v1 format, whose `float` entry the current CLI no longer honors: every run silently re-resolved sdk-sdk to whatever main pointed at and rewrote the file. Recording it in v2 makes the revision the checks actually run against explicit again. Pinning it here also matters for what it contains. The old entry named `e1747f4`, which still declared `daggerCliVersion = "1.0.0-beta.9"`, and a beta.9 CLI cannot drive a beta.10 engine — beta.10 moved registering a function's required `Workspace` argument as a CLI flag out of the engine and into the CLI, so the older CLI never sees `initModule` and the contract checks fail with `unknown command "init-module"`. dagger/sdk-sdk#14 fixed that pin, and dagger/sdk-sdk#17 then added the `monorepo` group, which drives a workspace whose dagger.toml sits in a git subdirectory — the layout where module paths cross the engine/SDK boundary root-relative while the selected config reads them relative to itself. That is exactly what this module's path anchoring has to get right, so it is worth being on. Signed-off-by: Yves Brissaud <yves@dagger.io>
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.
Every workspace the checks built put
dagger.tomlat the git root, so nothing covered the monorepo layout where several project workspaces sit in subdirectories of one repository. That is the shape dagger/dagger#13889 is about: the workspace root is the git root, so the caller's cwd sits below it, init changesets are applied at the root, and module paths reach the SDK relative to that root.Adds a
monorepogroup building a third workspace —dagger.tomlincommon/, the SDK vendored under it, every command driven fromcommon/.Rebased on main, which drives
1.0.0-beta.10.Checks
installs-from-subdir-configsdk installregisters the SDK incommon/dagger.tomlscaffolds-module-from-subdir-configmodule initwritescommon/.dagger/modules/subdir-mod/dagger-module.tomlkeeps-module-under-subdir-configmodule initwrites nothing outside the module directorysubdir-module-loadsexplicit-path-keeps-module-wholemodule init --pathkeeps the module whole under the caller's cwdrooted-path-anchors-module-at-root--path /<name>anchors the module at the workspace rootFive of the six fail on the pre-fix engine and all six pass on beta.10, so none of them are vacuous. The full suite is green: 31 checks.
What the engine fix changed
dagger/dagger#13890 closes the defect this branch opened red. Init now applies both changesets at the workspace root and hands the SDK a workspace whose cwd matches, so the two halves of a new module stop landing in different directories, and the default module path is anchored at the directory holding the
dagger.tomlbeing edited rather than at the workspace root — which is what[modules.<name>].sourcewas already resolved against.That fixes
scaffolds-module-from-subdir-config,keeps-module-under-subdir-configandsubdir-module-loadsunchanged. On beta.9 they still fail exactly as this branch described:The
--pathchecks movedThe fix also changed
module init --pathdeliberately: it now resolves against the caller's cwd, with a leading/meaning the workspace root, like every other workspace path a user types. It used to be workspace-root-relative.explicit-path-keeps-module-wholepassedcommon/subdir-path-mod— a root-relative path naming the config directory. Under the new resolver that means acommon/belowcommon/, so the check was asserting the old spelling and failed on beta.10 by landing the module atcommon/common/subdir-path-mod. It now passes a relative path and asserts the module lands under the caller's cwd. Note this flips its beta.9 result: in its old form it passed there, because the old spelling was the correct one for the old resolver.rooted-path-anchors-module-at-rootis new, and covers the other half of the resolver. With the default path now anchored beside itsdagger.tomland a relative--pathresolved against the caller, a leading/is the only remaining way to hand the SDK a module path the caller's cwd does not contain — the shape a cwd-scoped SDK cannot stage at all. beta.9 rejected it outright:Note on
--pathUnchanged by the fix: an explicit
--pathdeliberately skips the[modules.<name>]entry —usingDefaultPathstill gates it — so the module is authored rather than installed and there is nothing to load by name. Both--pathchecks therefore assert co-location rather than installation, which is what the issue actually reports there: the engine's module config and the SDK's files landing in two different directories.