Repository navigation
chore: clean up the module surface and broaden e2e coverage - #14
Merged
Merged
Conversation
Drop the `pub` keyword now that dang defaults field forms carrying a
disambiguating token (`:` type, `(args)`, `{ block }`) to public, matching
what go-sdk already did.
Split the e2e module by SDK surface: main.dang exposes one check group per
file (sdk, lookup, discovery, init, config, generate, client), sharing the
assertions and fixture paths in util.dang. Check names become
`e-2-e:<group>:<check>`, so a group can be run on its own.
Fixes found while writing the new checks:
- ModConfig resolved package.json/deno.json against the directory holding
the module config, but the TypeScript runtime reads them from the module
source subpath. A module config carrying `source = "../.."` — the layout
workspace migration writes — made config reads report an unconfigured
module and config edits write a stray package.json the engine never looks
at. Mod.sourcePath now resolves through the engine.
- generateAllClient regenerated every workspace client regardless of the
caller's location. Nested under the engine's per-dependency generation the
cwd is the dependency, so staging a client from elsewhere in the workspace
failed outright ("outside changeset root") as soon as a managed module had
a managed dependency. It is now cwd-scoped like generateAllModule.
- An unnamed init template resolved to the templates/ directory itself,
which exists, so it passed the unknown-template guard and rendered every
starter as a subdirectory of the new module. It now means the default,
as the docstring already claimed.
generateAllModule folds each module's changes with map + withChangesets
instead of a sequential reduce, so managed modules generate concurrently.
New coverage: a relocated module source (config in .dagger/modules/app,
code in ci/) across discovery and config; a managed module and its managed
local dependency, generated one at a time and all at once; generate-all
scoping; init rejections; initClient; template listing; contradictory
Deno/Node layouts; and lookups that must fail.
Docs: document each initModule/initClient/generateClient/mod argument, so
`dagger sdk module-options typescript` describes its flags instead of
printing a column of dashes. README corrects the polyfill link, the install
form that actually registers the SDK as `typescript`, the helper module
name, the generate-all function names, and the stale claim that discovery
scans legacy dagger.json files; it also covers client generation, cwd
scoping and relocated sources.
Signed-off-by: Tom Chauveau <[email protected]>
tiborvass
approved these changes
Jul 30, 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.
Cleanup pass over the SDK module plus a wider e2e suite: 20 checks → 29, all green.
Cleanup
Drop
pub. dang defaults field forms with a disambiguating token (:type,(args),{ block }) to public, so the keyword is noise. Matches what go-sdk already did.Split the e2e module by SDK surface.
main.dangwent from 631 lines to one check group per file —sdk,lookup,discovery,init,config,generate,client— sharing the assertions and fixture paths inutil.dang. Check names becomee-2-e:<group>:<check>, sodagger check "e-2-e:config:*"runs a group on its own.Fixes
Three of these were found by writing the new checks.
ModConfigread the wrong directory. It resolvedpackage.json/deno.jsonagainst the directory holding the module config, but the TypeScript runtime reads them from the module's source subpath. A module config carryingsource = "../.."— the layout workspace migration writes, config in.dagger/modules/<name>/pointing back at pre-existing code — madeconfig package-managerreport an unconfigured module, andconfig setwrite a straypackage.jsonnext todagger-module.tomlwhere the engine never looks.Mod.sourcePathnow resolves through the engine.generateAllClientignored the caller's location. It regenerated every workspace client unconditionally. Nested under the engine's per-dependency generation the cwd is the dependency, so staging a client from elsewhere in the workspace failed outright:That fires as soon as a managed module has a managed local dependency. It is now cwd-scoped like
generateAllModule.--template ""produced a broken module. The empty name resolved to thetemplates/directory itself, which exists — so it passed the unknown-template guard and rendered every starter as a subdirectory of the new module. It now means the default, which is what the docstring already claimed.generateAllModulegenerated sequentially. Now folds withmap+withChangesetsso managed modules generate concurrently.Coverage
New fixture
parent-source/reproduces the migrated layout (config in.dagger/modules/app, code inci/,source = "../../../ci"), covered across discovery and config.generate-deps/{app,dep}are now both workspace-managed, so generation is checked one module at a time and all at once — the dependent's changeset carries its dependency's bindings without leaking the dependency's own files, and the two changesets merge cleanly.Also added: generate-all scoping, init rejections (path escape, unknown template,
--package-manageron a runtime that bundles its own),initClient, template listing, contradictory Deno/Node layouts, and lookups that must fail.Docs
Each
initModule/initClient/generateClient/modargument is now documented, sodagger sdk module-options typescriptdescribes its flags instead of printing a column of dashes:README corrections: the polyfill link (
dagger/polyfill, notsdk-sdk/polyfill);dagger sdk install typescript, since the ref form registers the SDK astypescript-sdk, nottypescript; the helper module name (dagger-typescript-sdk);generate-all→generate-all-module/generate-all-client; and the stale note claiming discovery scans legacydagger.jsonfiles. Adds client generation, cwd scoping, relocated sources, and a Development section.Known gaps
--root <config dir>, so output landing inci/is dropped. Already fixed on an unpushed polyfill branch (switching tocore.generatedContextChangeset);origin/mainis still our pin, so the parent-source checks deliberately cover discovery and config only. The check docstring says why.dagger generatefromci/is a no-op. Same in go-sdk and python-sdk; the fix belongs in the shared convention. Pinned by a test so a change is deliberate.helperTestsCheckstill skipshelpers/module-config(which has tests that never run) andhelpers/render-template(which has none).Test
dagger check— 29 passed.dagger generate --no-applyverified end to end against the expanded fixture set.