Skip to content

greetings-api should pass dagger setup #13743

Closed

Description

@marcosnils

Problem

Running dagger setup and then dagger generate in the greetings-api repo (https://github.com/kpenfound/greetings-api)
doesn't work. Some related issues around that are #13641 and #13742.
There's probably some other things missing but this is required for a v1 release.

Solution

Make dagger setup && dagger generate work out of the box for greetings-api

Activity

  1. added this to the v1.0.0 milestone on Jul 27, 2026
  2. kpenfound commented on Jul 27, 2026

    @kpenfound
    Contributor

    Data point: I ran the full migration on this repo end-to-end with v1.0.0-beta.7 (DAGGER_X_RELEASE=v1.0.0-beta.7, go-sdk/typescript-sdk pinned to pre-asSDK(workspace:) commits since beta.7's engine predates today's SDK main). Final state: dagger functions lists everything and dagger call check passes (Go lint, backend+frontend unit tests, Cypress e2e, build). It was not out of the box — here's everything it took, with cross-refs:

    1. dagger setup -y — config conversion itself was accurate (deps, pins, disableDefaultFunctionCaching all carried over). Two side notes: -y also auto-installed recommended modules (eslint, go) unpinned, and no .dagger/migration-report.md was produced despite errors during the migration diff.
    2. Unpinned SDK modules broke within hours — setup wrote source = "github.com/dagger/go-sdk" unpinned; both SDK repos landed the asSDK(workspace:) change the same day, which needs a newer engine → Dang inference errors on every command. Had to pin both by commit in dagger.toml. (dagger.lock pinned github.com/dagger/go but not the SDK modules.)
    3. Legacy .gitignore rules hid the generated files — exactly Legacy .gitignore rules break trusted runtimes after module migration #13717. Files existed on disk after generate but the git-aware source loader filtered them; error says "run dagger generate" which can't help. Fixed by removing the v0-era ignore rules by hand.
    4. Generate bootstrap deadlock — v1 entrypoint modules break dagger generate #13742: dagger generate (even generate -l) loads all workspace modules first; modules can't load without bindings; bindings come from generate. Workaround each time: comment the module out of [modules.*] (keeping it in as-sdk.modules), generate, re-enable — once per dependency level (leaves → entrypoint).
    5. Destructive scaffold overwrite — the beta.7 setup layout (.dagger/modules/greetings/dagger-module.toml with source = "../..") makes the go-sdk generator treat the module as new and overwrite the real main.go with the init template, silently, exit 0. Details in the next comment — this is the one failure mode here that loses user code rather than just erroring.

    After restructuring to the in-place layout (.dagger/dagger-module.toml, which is what #13620 now produces), regeneration was fully clean: original go.mod module path preserved, bindings generated under the existing import path, zero modifications needed to any user .go file.

  3. kpenfound commented on Jul 27, 2026

    @kpenfound
    Contributor

    Detail: dagger generate overwrites existing module sources with the init template when the module config is detached from its source dir

    The worst failure mode I hit deserves its own writeup, since #13742/#13606 describe generate failing — this is generate succeeding while destroying source code (exit 0, no warning).

    Trigger. beta.7's setup migrated the root dagger.json ("source": ".dagger") into a detached config: .dagger/modules/greetings/dagger-module.toml with source = "../..". Config dir and Go sources live in different places (unlike backend/frontend/workspace, which were migrated in place).

    Observed. When the go-sdk generator runs against that detached config (workspace-module-generate --root . --cwd . --local .dagger/modules/greetings), it applies module init semantics to the resolved source dir .dagger/:

    • main.go (155 lines: constructor with +defaultPath/+ignore annotations, Check/Test/Lint/Build/Serve/Release) replaced with the ContainerEcho/GrepDir starter template
    • go.mod rewritten: module github.com/kpenfound/greetings-api/.dagger → template-style module dagger/greetings
    • dagger.gen.go + internal/ generated for the scaffold, not the real code
    • sibling files (debugger.go, develop.go, review.go, …) left in place → subsequent compile errors (g.Backend undefined, old self-import path gone)

    Repro matrix (same repo, same dagger generate -y):

    Config location bindings present before? Result
    .dagger/modules/greetings/ (detached) no scaffold clobber
    .dagger/modules/greetings/ (detached) yes (stale) scaffold clobber again
    .dagger/dagger-module.toml (in source dir) no correct codegen, sources intact
    in-source configs (backend/workspace/frontend) no correct codegen, sources intact

    So the discriminator is config/source separation, not presence/staleness of bindings (backend had no bindings either and was never scaffolded), and it's deterministic — hit it twice in a row. In the in-source layout the generator preserved the module path and generated bindings under the existing import path — user sources needed zero edits.

    Likely mechanism: the generator looks for module sources adjacent to the --local config path rather than at the config's resolved source dir; finding only dagger-module.toml, it takes the uninitialized-module branch and exports the init template into the resolved source root.

    Repro caveat: due to the generate deadlock (#13742), generate only completes on this repo with [modules.greetings] temporarily commented out of dagger.toml (still listed in as-sdk.modules). Both clobbers happened in that state; the registered state never reaches export.

    Why it still matters after #13620: in-place migration means fresh setups won't produce the detached layout, but #13620 explicitly leaves modules already under .dagger/modules/ as-is — so workspaces migrated by beta.7-era setup carry this forward, and the generator path itself remains reachable for any detached-config module.

    Suggested fixes: resolve sources via the config's source field before deciding init-vs-codegen; and/or never write the init template over a non-empty source directory without an explicit opt-in.

  4. kpenfound commented on Aug 4, 2026

    @kpenfound
    Contributor

    setup + generate is now seamless on beta.9 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions