Skip to content

feat(generate): do not fail on non-loadable modules - #13575

Merged
vito merged 6 commits into
dagger:mainfrom
eunomie:generate-resilient-design-ba5bc1d3
Jul 15, 2026
Merged

vito merged 6 commits into
dagger:mainfrom
eunomie:generate-resilient-design-ba5bc1d3

Conversation

@eunomie

@eunomie eunomie commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Builds on the best-effort workspace module load for generators that landed on main (44dd632): dagger generate skips a workspace module that can't load and generates the rest, instead of aborting — so it can regenerate the very files a module needs to load. check/up stay strict.

This PR layers on top of that:

  • Skipped modules reported like a failing check. A module that can't load is surfaced as its own span — a concise red row named by the module, with the load error nested — instead of a verbose console line. It's revealed into the generators view during the run, and persisted at the end in a dedicated "SKIPPED MODULES" report section (the generate analogue of the "CHECKS" section), so it survives the pretty TUI collapsing completed output on a successful (exit-0) run.
  • GeneratorGroup.loadFailures: [String!]! — the collected per-module load errors for the modules that were skipped (empty when all loaded). New public workspace API, gated View(AfterVersion("v1.0.0-0")) and kept out of base_schema.json.
  • dagger generate --require-load — opt back into strict: fail if any workspace module could not be loaded, instead of skipping it. Default stays best-effort.

Generator-execution failures (a module loads but its generator fails) remain fatal in both modes.

Design doc: hack/designs/done/generate-resilient-module-loading.md

@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch 5 times, most recently from f39a96d to 323fa97 Compare July 13, 2026 16:59
@eunomie
eunomie marked this pull request as ready for review July 13, 2026 17:17
@eunomie
eunomie requested review from a team as code owners July 13, 2026 17:17
@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch from 323fa97 to bf212db Compare July 13, 2026 17:23
@eunomie eunomie changed the title design: resilient dagger generate on module load failures feat(generate): --require-load opt-out and GeneratorGroup.loadFailures Jul 13, 2026
@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch from bf212db to eb6e1b0 Compare July 15, 2026 07:50
@eunomie eunomie changed the title feat(generate): --require-load opt-out and GeneratorGroup.loadFailures feat(generate): do not fail on non-loadable modules Jul 15, 2026
@eunomie eunomie added this to the v1.0.0 milestone Jul 15, 2026
@eunomie eunomie self-assigned this Jul 15, 2026
@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch from 4267d9b to aacea18 Compare July 15, 2026 10:33
@TomChv

TomChv commented Jul 15, 2026

Copy link
Copy Markdown
Member

There's an big panic in test-split:test-call-and-shell: https://dagger.cloud/dagger/checks/github.com/dagger/dagger@75278e896bfc4e0cda98d26b49e32576855cc2be?check=test-split:test-call-and-shell

I think it could be related to the changes done in that PR since I've never seen an error like that happening before.

@eunomie

eunomie commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

The different outputs

List generate functions, with one failing module:
image

Generate, with one failing module:
image
image

Generate, everything's fine:
image

@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch 2 times, most recently from e44023e to c0601e7 Compare July 15, 2026 13:17
@eunomie

eunomie commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch from c0601e7 to 984598b Compare July 15, 2026 14:06
eunomie added 4 commits July 15, 2026 17:19
Builds on main's best-effort workspace module load for generators
(44dd632): an unscoped 'dagger generate' already skips a module that
cannot load with a warning instead of aborting. This adds an opt-out and
surfaces the collected failures on the API.

- engine: ensureModulesLoadedMode / EnsureWorkspaceModules now return the
  best-effort skipped-module messages ([]string) alongside the error; the
  strict path returns (nil, err) unchanged.
- resolver: the generators resolver captures those messages and sets them
  on GeneratorGroup.LoadFailures. Loading stays always best-effort (as on
  main); checks/up stay strict and ignore the slice.
- api: GeneratorGroup.loadFailures ([String!]!), gated AfterVersion(v1.0.0-0)
  and kept out of base_schema.json; carried through Clone and persistence.
- cli: --require-load turns tolerated load failures fatal (enforced CLI-side,
  before running or applying). The per-module skip warning is emitted engine
  side (console + slog.Warn), so the CLI does not double-warn.

Signed-off-by: Yves Brissaud <[email protected]>
Run 'dagger --x-release=v1.0.0-beta.5 generate -y' to refresh the committed
generated artifacts (SDK clients for go/python/typescript/elixir/php/rust, the
GraphQL schema doc, and the CLI reference) for the new
GeneratorGroup.loadFailures field and the generate --require-load flag.

Signed-off-by: Yves Brissaud <[email protected]>
Best-effort `dagger generate` skips a workspace module that fails to load
and generates the rest. Report each skip the way the TUI reports a check
that did not pass: reportSkippedModule opens a short span named by the
module, marked failed and revealed, so it renders as a concise red row
with the load error nested — lifted into the zoomed generators view —
instead of the verbose console/log line it replaces. The CLI keeps reading
loadFailures only to enforce --require-load, whose error is now a terse
count since the per-module detail is in the spans.

Signed-off-by: Yves Brissaud <[email protected]>
A successful `dagger generate` (best-effort skips don't fail it) collapses its
completed telemetry when the pretty TUI exits, so the live skip rows vanish
after the Apply prompt. Mirror the checks machinery with a dedicated generate
report: tag each skipped-module span with GenerateSkippedAttr, gate the final
render on DB.HasGenerateReport(), and render a persisted "SKIPPED MODULES"
section listing each skipped module with its load error -- so the user still
sees what was left out on exit 0.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie force-pushed the generate-resilient-design-ba5bc1d3 branch from 984598b to 32d30ff Compare July 15, 2026 15:29
@shykes

shykes commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@eunomie
eunomie requested a review from a team as a code owner July 15, 2026 16:51
}
}
rows := strings.Split(strings.TrimSuffix(buf.String(), "\n"), "\n")
return append([]string{reportHeadingLine(out, "SKIPPED MODULES")}, rows...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CHECKS header carries a ✘ N failed tally (checksHeaderLine); consider giving this one ✘ N skipped for parity, since every row here is a failure.

@TomChv TomChv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice — the checks-report analogue for skipped modules is a clean fit and the engine plumbing is tidy.

Pretty-TUI coverage: the SKIPPED MODULES final render is only covered by a unit test with a hand-built non-zoomed DB; the integration tests use --progress=plain and skip FinalRender. Since generateReport returns nil when zoomed, did you confirm end-to-end that a plain (pretty) dagger generate exit-0 run actually shows the section? (I expect yes — checksReport uses the same guard and works — just want to be sure.)

@vito
vito merged commit 4cda5cb into dagger:main Jul 15, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants