Repository navigation
go: start test sessions only when needed - #83
Merged
Merged
Conversation
tiborvass
added a commit
to dagger/dagger
that referenced
this pull request
Oct 27, 2026
Generated Go bindings read session settings at package load time. A test that only imports these bindings fails before any test can run. This forces the test runner to open a session for tests that never use Dagger. Read the settings on the first API request. Share one client between normal queries and handles decoded from JSON. Return an error for missing or invalid settings, and allow a later request to try again. Keep the client after the first successful configuration check. The regression test compiles both generated packages without a session. It checks handles created before session setup, configuration errors, concurrent requests, and authentication. The test fails with the original package initialization panic on the previous templates. Validation: GOFLAGS=-race go test ./cmd/codegen/generator/go/... Companion change: dagger/go#83 Signed-off-by: Tibor Vass <[email protected]>
tiborvass
force-pushed
the
codex/pr81-import-safe-codegen
branch
from
October 27, 2026 14:21
44f95f9 to
1404477
Compare
tiborvass
marked this pull request as draft
October 27, 2026 14:42
tiborvass
marked this pull request as ready for review
October 29, 2026 15:11
grouville
self-requested a review
November 1, 2026 07:54
grouville
approved these changes
Nov 1, 2026
The test runner opens a Dagger session for every test command. Generated bindings require this at package load time, even when the tests never call Dagger. The same wrapper also starts sessions for tests that do not import those bindings. Generate the gobuild bindings with the deferred session setup from dagger/dagger#14880. Run otelgotest without the session wrapper. Keep access to the mounted CLI so tests can start a session when they need one. Update the nesting test to open its own session and check workspace access. The engine used for generation must include dagger/dagger#14880. The released engine still writes the previous initializers, so the generated-file check fails until that dependency is available. Validation: gobuild tests passed without session settings. The single-module, skips-non-modules, tests-collection, and binary checks passed. Scanner tests also passed without session settings and with an invalid CLI path. Depends on: dagger/dagger#14880 Signed-off-by: Tibor Vass <[email protected]>
tiborvass
force-pushed
the
codex/pr81-import-safe-codegen
branch
from
November 2, 2026 19:04
1404477 to
f61b9f3
Compare
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.
Draft: waiting for the engine fix in dagger/dagger#14880 and a CI
upgrade to an engine version that includes it.
The test runner opens a Dagger session for every test command. Generated
bindings require this at package load time, even when the tests never
call Dagger. The same wrapper also starts sessions for tests that do not
import those bindings.
Generate the gobuild bindings with the engine fix in
dagger/dagger#14880. Run
otelgotestdirectly. KeepdaggerInDaggerNewSession: trueand the mounted CLI configuration.Tests that use Dagger can then open a session against their own
workspace. The nesting test checks this behavior.
Depends on: dagger/dagger#14880
CI must upgrade to an engine version that includes dagger/dagger#14880
before this PR is ready for review.
The current CI generator restores the package-level session setup in
both generated files. This causes go-sdk/generate/stale to fail. After
the CI engine upgrade, regenerate the bindings and rerun the check.
Validation:
go test ./...in gobuild passed without session or engine settings.path.
A local benchmark measured 3-7% shorter pure-Go test runs with warm
caches. Each workload used 12 pairs with alternating order and no
test-result cache. This measures the combined changes to codegen and the
test runner. It does not establish an improvement for the complete CI
run.