Skip to content

Built-in check for generate functions#12923

Merged
eunomie merged 3 commits into
dagger:mainfrom
eunomie:generate-check
Apr 30, 2026
Merged

Built-in check for generate functions#12923
eunomie merged 3 commits into
dagger:mainfrom
eunomie:generate-check

Conversation

@eunomie
Copy link
Copy Markdown
Member

@eunomie eunomie commented Apr 8, 2026

Currently we have one single function in .dagger main module that runs all the generate functions and ensure the result is empty.
Those changes handle that in the engine: all generate functions are now automatically handled as a check function. When they are run, it will succeed if the resulting changeset is empty.

This allows to always ensure all generated functions are correctly run on CI, without to introduce a new module or concept.
Just declare your checks and generates and both dagger generate and dagger checks will work.

You can still use dagger check --no-generate if you don't want to include the generate functions.

$ dagger check -l

Name                                         Description
ci:bootstrap                                 Build dagger from source, and check that it can bootstrap its own CI
cli:release-dry-run                          Verify that the CLI builds without actually publishing anything
docs:lint-markdown                           Lint documentation files
elixir-sdk:codegen-test                      Run dagger_codegen tests
elixir-sdk:lint                              Lint the SDK
elixir-sdk:release-dry-run                   Test the publishing process
elixir-sdk:sdk-test                          Run the SDK tests
...
typescript-sdk:test-nodejs-lts               Test the SDK with LTS version of Node
typescript-sdk:test-nodejs-prev-lts          Test the SDK with previous LTS version of Node

Generators
changelog:generate                           Generate the changelog with 'changie merge'. Only run this manually, at release time.
docs:references                              Regenerate the API schema and CLI reference docs
engine-dev:generate                          Generate any engine-related files
go-sdk:generate                              Regenerate the Go SDK API
...

@eunomie eunomie requested review from a team as code owners April 8, 2026 10:43
@idlsoft
Copy link
Copy Markdown
Contributor

idlsoft commented Apr 8, 2026

If I understand it correctly this turns all +generate functions into +check functions.
It may be useful to have some granular control over it.
For example if generated files are not committed, a check would fail, right?

@eunomie
Copy link
Copy Markdown
Member Author

eunomie commented Apr 8, 2026

For example if generated files are not committed, a check would fail, right?

Yes, but that's exactly the purpose of generate functions, to generate files that should be committed.
On dagger/dagger for instance we always have a check that runs all the generate functions and check it's empty. It's just that but better, more explicit, and more control on top of it as it allows to dagger check my-generate-function as it wasn't possible previously.

Copy link
Copy Markdown
Contributor

@kpenfound kpenfound left a comment

Choose a reason for hiding this comment

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

LGTM. Some conflicts though

@eunomie eunomie force-pushed the generate-check branch 3 times, most recently from 0b57609 to ac214f6 Compare April 16, 2026 15:40
@eunomie eunomie requested a review from a team as a code owner April 16, 2026 15:40
@eunomie eunomie force-pushed the generate-check branch 3 times, most recently from 9cdb3a1 to 7b10400 Compare April 18, 2026 16:55
@eunomie eunomie force-pushed the generate-check branch 3 times, most recently from 971629e to 3537b00 Compare April 29, 2026 14:52
eunomie added 3 commits April 30, 2026 09:26
Extend check discovery to include +generate functions. When listing
or running checks, generator functions are automatically included.
A generate-as-check passes when the generator produces an empty
changeset and fails otherwise.

- Add IsGenerate field to Check, CheckType() returning "check"/"generate"
- Add RunGeneratorAsCheck on ModTreeNode with check telemetry spans
- Add scale-out support via tryRunGeneratorAsCheckScaleOut
- Add noGenerate param through Module.Checks, Env.Checks, and all
  schema resolvers (workspace, module, env)
- Add checkType GraphQL resolver on Check
- Add --no-generate CLI flag to dagger check
- Split check list output with dedicated "Generators" section
- Deduplicate when a function has both +check and +generate annotations
- ignoreChecks toolchain config also applies to generate-as-checks
- Add integration tests with Go test module, including ignoreChecks tests

Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
@eunomie
Copy link
Copy Markdown
Member Author

eunomie commented Apr 30, 2026

I'm merging the PR:

  • ✔️ cli:release-dry-run manually validated
  • ✔️ engine-dev:release-dry-run manually validated
  • ✔️ dagger-dev:generated manually validated

Once dagger cloud will run on a version including those changes, we will be able to fully remove the engine-dev:generated check as it will be a duplication of the built-in checks.

@eunomie eunomie merged commit 18733b3 into dagger:main Apr 30, 2026
61 of 64 checks passed
@eunomie eunomie deleted the generate-check branch April 30, 2026 09:35
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.

3 participants