Repository navigation
fix: use GraphQL cache policy enum values in Dang entrypoints - #143
Merged
Merged
Conversation
A generated Dang entrypoint for a function with @func({ cache: "session" }) fails to load: `field "PerSession" not found in Dagger.FunctionCachePolicy`. The Dang renderer emitted the TypeScript client's member names; Dang names enum members by their GraphQL values. Emit PER_SESSION, NEVER and DEFAULT instead. Same change as dagger#142, which was closed unmerged. Signed-off-by: Alex Suraci <[email protected]>
This was referenced Nov 21, 2026
sipsma
approved these changes
Nov 24, 2026
vito
added a commit
to dagger/dagger
that referenced
this pull request
Nov 24, 2026
Add fixture modules built with the external, entrypoint-style SDKs (go, python, typescript, php, java, and dang), each with the same functions: one that logs and succeeds, one that logs and fails natively, one that exits with a code, a failing withExec left unhandled and caught-and-wrapped, and a call into a go-sdk dependency whose withExec fails. A copy of each fixture with a syntax error appended, made by the test, covers an SDK's own build or load failing before any function runs. The goldens pin today's output, warts and all, to plan fixes against; the fixture comments in golden_sdks_test.go name what is wrong per SDK. Each failing case also has a collapsed, quiet variant, as a user sees it. The fixtures are generated from viztest/sdks/dagger.toml, a workspace of their own so that regenerating them never touches the repository's config. Two SDKs are pinned to forks with fixes the fixtures need to run at all: php-sdk's sdk-helpers no longer compiles under current Dang (dagger/php-sdk#48), and typescript-sdk's Dang entrypoint misspells cache policies (dagger/typescript-sdk#143). Expanded reports elide what a module entrypoint evaluates: the Dang entrypoint runs it concurrently, so its order varies run to run. The suite's cleanup now removes the dagger.lock the fixtures' image pulls write. Signed-off-by: Alex Suraci <[email protected]>
TomChv
added a commit
that referenced
this pull request
Nov 25, 2026
`e2e/sdk/helper-tests-check` is red on main: `go test ./...` in helpers/codegen fails TestGenerateDangEntrypointCachePolicy (3 subtests) and TestGenerateEntrypointDispatchLoadsModuleCode. Neither is a regression in #120's code, and neither PR could have caught it. #120 made every generator that renders a module's own declarations ask the engine for their names, and added `Naming` to each test that builds a generator config. Its branch predates both of these tests: - dang_entrypoint_cache_policy_test.go arrived with #143. - TestGenerateEntrypointDispatchLoadsModuleCode arrived with #144. Both merged after #120's CI ran, git merged all three cleanly, and the combination was never tested. Without a naming context the dang entrypoint finds no main object among typedef_smoke.json's objects, and the dispatcher cannot name the fixture's own interface. Both now use `smokeNaming()`, as every other test on that fixture does. Signed-off-by: Tom Chauveau <[email protected]>
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.
A generated Dang entrypoint for a function with
@func({ cache: "session" })fails to load on current engines:The Dang renderer emitted the TypeScript client's enum member names (
PerSession,Never,Default); Dang names enum members by their GraphQL values. This emitsPER_SESSION,NEVERandDEFAULT, with a regression test over all three policies.Same change as #142, which was closed unmerged. Found while adding external-SDK golden tests to dagger/dagger's TUI suite.