Repository navigation
core: version Dang modules via dang.toml, one Dang library - #14958
Merged
vito merged 13 commits intoNov 5, 2026
Merged
Conversation
vito
added a commit
that referenced
this pull request
Oct 29, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
marked this pull request as ready for review
October 29, 2026 14:25
vito
added a commit
that referenced
this pull request
Oct 29, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
October 29, 2026 19:11
310fe48 to
3ca1149
Compare
vito
force-pushed
the
naming/single-dang-sdk
branch
from
October 29, 2026 22:07
3ca1149 to
1f66cdb
Compare
vito
added a commit
that referenced
this pull request
Nov 2, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 2, 2026 15:57
1f66cdb to
2a576c0
Compare
eunomie
added a commit
to dagger/go-sdk
that referenced
this pull request
Nov 4, 2026
Released engines ignore the file, so only the dagger/dagger#14958 stack can show that the generated declaration takes effect. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
added a commit
to dagger/go-sdk
that referenced
this pull request
Nov 4, 2026
* go: default new modules to a pre-cut target An engine with dagger/dagger#14902 serves an entrypoint module at the release its dang.toml declares, else v1.0.0-beta.24, so bindings from a running v1.0.0-beta.25 engine would use names that view lacks. Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Yves Brissaud <[email protected]> * go: document versions served to pre-cut modules Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Yves Brissaud <[email protected]> * deps: bump sdk-helpers to v1.0.8 The dang.toml writer calls loadDangConfig, which first ships in v1.0.8. Signed-off-by: Yves Brissaud <[email protected]> * feat(go): write dang.toml for generated entrypoints dagger/dagger#14902 reads the entrypoint's Dagger import to choose the version it serves the module at. Signed-off-by: Yves Brissaud <[email protected]> * test(go): check the engine serves the dang.toml version Released engines ignore the file, so only the dagger/dagger#14958 stack can show that the generated declaration takes effect. Signed-off-by: Yves Brissaud <[email protected]> * docs(go): explain the generated dang.toml Signed-off-by: Yves Brissaud <[email protected]> --------- Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Yves Brissaud <[email protected]> Co-authored-by: Yves Brissaud <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 4, 2026 16:29
2a576c0 to
b604cb5
Compare
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 4, 2026 19:05
7d8964a to
a33a182
Compare
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 5, 2026 00:05
a8a4997 to
6aa6526
Compare
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 5, 2026 00:14
6aa6526 to
735890a
Compare
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 5, 2026 03:38
735890a to
aa85b3d
Compare
A Dang SDK module's dang.toml was ignored: the runtime presets its Dagger import, so Dang never reads the file, and its `dagger` and `dang` keys did nothing. Its engine version came only from dagger.json, and its Dang version only from that engine version. The engine now reads the dang.toml governing a Dang SDK module, as #14902 does for entrypoints, with the same resolution code (dangv2.ResolveModuleVersions beside ResolveEntrypointVersions): the nearest one walking up from the source directory to the module directory, never above it, as for an entrypoint. - `[imports.Dagger] dagger` wins over dagger.json's engineVersion: view, naming, default caching, compat checks. The engine warns, in its log and on a span of its own, when the two disagree. `dagger = true` keeps the engineVersion, as the Dang CLI reads it. - `dang` is the Dang version. Without one, a module before v0.21.5 is Dang 1.0 and a later one is left to Dang, as before; the Dang major is now picked by that version rather than by the engine version. - Both key SourceImplementationDigest for every Dang module (the resolved Dang version can follow the engine's Dang, whatever the source), and the engine's own parses of the source (declared type names, object directives) parse it as its version. - A `dang` version newer than the engine's Dang says to upgrade Dagger, not Dang. ModuleSource.EntrypointDangVersion becomes DangVersion. Signed-off-by: Alex Suraci <[email protected]>
A dang.toml's Dagger version replaced ModuleSource.EngineVersion, which every config write (develop, install, generate) copied into dagger.json, silently rewriting the manifest's engineVersion and hiding the mismatch warning from then on. The caching default it decides leaked the same way: a dang.toml before v0.19.4 added `disableDefaultFunctionCaching: true`, which later loads read as explicit. ModuleSource.ConfigEngineVersion and ConfigDisableDefaultFunctionCaching keep the manifest's own for config writes. withEngineVersion sets the former too, and recomputes the default Dang version of a Dang module whose dang.toml declares none, as loading does (ModuleSource.DangVersionDeclared). Also restores version.go doc comments that the previous commit reverted to older wording. Signed-off-by: Alex Suraci <[email protected]>
Dang walks up from a module's source to a .git for the dang.toml that decides its version, past the module directory the engine stops at, so a dang.toml above it in the module context (a directory source's parent) could still decide the syntax. Such a source now runs from an isolated copy of its .dang files, so the versions the engine resolved decide. A source without a Dang version (one given the Dang SDK by withSDK) gets the default for its engine version. Tests cover config writes keeping engineVersion and the caching default, a `dang` version above a directory source's module, and a Dang 1.0 module with fields typed by their values. Signed-off-by: Alex Suraci <[email protected]>
The Dang module skill said engineVersion alone picks the Dang major. A dang.toml now declares both versions and wins over dagger.json. Signed-off-by: Alex Suraci <[email protected]>
The engine linked two Dang libraries, the v1 line for Dang 1.0 modules (by default, an engineVersion before v0.21.5) and the v2 line for the rest, with core/sdk/dang/v1 a frozen copy of the SDK glue. The split was a stopgap for versioning, which `dang = "1.0"` now covers. Dang v2 parses every Dang language version since 1.0 into the same AST, gating changed syntax, so a Dang 1.0 module now runs on the v2 line in Dang 1.0 mode: ModuleSource.DangVersion is already "1.0" for it. As the SDK of the v1 line did, a Dang 1.0 module builds its types with full inference (dang.RunDir) unless it enables self calls itself; declaring alone would leave a `pub` field with no annotation and a computed value untyped. Against the Dang v1.0.1 language suite (233 programs, with its GraphQL test server), v2.2.0 in 1.0 mode gives the same outcome and output for each. Two known gaps remain, documented in the README and changelog, with a fix in progress in vito/dang: `rescue` is reserved in every version, and the `loop` builtin takes precedence over a module's own `loop` binding. Drops core/sdk/dang/v1 and github.com/vito/dang v1. Signed-off-by: Alex Suraci <[email protected]>
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
Dang v2.3.0 (vito/dang#212) reserves `rescue` only from Dang 2.1 and lets a module's own declarations shadow builtins in every version, so a Dang 1.0 module that names something `rescue` or defines its own `loop` runs as it did on the Dang v1 line. That closes the two known gaps of Dang 1.0 mode; the README and changelog no longer list them. Its language versions are unchanged (CurrentVersion and DefaultVersion stay 2.1), and no engine call site changed. Unit and integration tests cover a Dang 1.0 module using both names. Signed-off-by: Alex Suraci <[email protected]>
Use main's context-aware parser for versioned source reads so prepared compilation and the shared syntax cache remain intact. Adapt the existing version assertions to pass the grammar version through context. Signed-off-by: Alex Suraci <[email protected]>
Keep manifest fallbacks, optional caching configuration, and explicit withEngineVersion provenance separate from resolved values. Source and SDK changes recompute versions from raw context before evaluating entrypoint sources; API-chain overrides survive, but fresh loads read dang.toml again. Cover construction order, declared/default grammar, SDK removal, config writes, entrypoint reload ordering, cloning and persistence with finite regressions. Signed-off-by: Alex Suraci <[email protected]>
Equal effective versions can still behave differently after source/SDK mutations. Include manifest fallback, explicit override and optional caching provenance in the implementation digest used by source and module scopes, so warming one variant cannot erase another's override. Signed-off-by: Alex Suraci <[email protected]>
Exercise source and SDK changes with real module loads, including equal-valued engine overrides, declared versus default grammar, and config-write reloads. Clarify the explicit override exception in the existing SDK documentation. Query both legacy rescue and loop behavior through the engine and remove the now-redundant interpreter-only test. Keep the distinct provenance, persistence, and caching invariant units. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 5, 2026 16:28
aa85b3d to
34ef8d7
Compare
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the dang.toml and single Dang library fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 5, 2026 17:36
34ef8d7 to
9fa6864
Compare
vito
force-pushed
the
naming/single-dang-sdk
branch
from
November 5, 2026 20:06
9fa6864 to
635d012
Compare
The sparse workspace config reader only needs the populated module source. Ignore the parsed config now returned by initFromModConfig and retain the existing error handling so the caller matches the updated signature. Signed-off-by: Alex Suraci <[email protected]>
grouville
approved these changes
Nov 5, 2026
Address golangci-lint findings: initFromModConfig no longer returns the parsed config no caller used (unparam), the test's path if/else chain is a tagged switch (QF1003), and the unused entrypointDangVersion helper is removed. Signed-off-by: Alex Suraci <[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.
This PR makes
dang.tomlauthoritative for regular Dang modules and runs all supported Dang language versions through one library. It removescore/sdk/dang/v1and the v1 dependency; older modules run on the v2 library in Dang 1.0 mode.Source and SDK mutations re-resolve the governing configuration while preserving explicit API-chain overrides and their cache identity.
Version selection
Regular Dang SDK modules (
sdk = "dang"or[runtime] source = "dang") now use the same configuration-resolution mechanism as entrypoints:[imports.Dagger] dagger = "vX.Y.Z"selects the module's API view, naming rules, caching defaults and compatibility checks. On a fresh load it takes precedence over the manifest'sengineVersion, with a warning if they disagree.dang.toml, regular modules retain the manifest version.dagger = truealso retains it; entrypoints keep their separate pinned beta.25 default.dang = "X.Y"explicitly selects the language version, independently of the Dagger API version. Without it, modules targeting an engine before v0.21.5 default to Dang 1.0. Later modules use the linked library's current version when there is no config, or its default version when a config omits the key; both are currently 2.1.Configuration and mutations
dang.tomlfrom the source directory up to the module directory, never above it. Source context includes those config paths. Where Dang's own discovery would escape that boundary, source isolation prevents the parent config from changing the engine-selected versions.warning: dang.toml overrides engineVersionin progress output and the engine log. It is load-time output, not repeated on cached loads.engineVersionand optional caching setting unless an explicitwithEngineVersionsupplies the version to write. The resolveddang.tomlversion is not copied back into the manifest, and the engine does not writedang.toml. Entrypoint overrides remain chain-only.sources. An explicit engine-version override survives the API chain, including an override equal to the previous effective value. It changes an undeclared grammar's default, not an explicitdangdeclaration. A fresh load reads the config again.One Dang runtime
All language modes now run on the pinned
vito/dang/v2library. Dang 1.0 modules retain full type inference unless they enable self-calls.The linked runtime includes the language-version fixes for
rescueand shadowing theloopbuiltin. Existing integration coverage exercises a legacy module with its ownloop, arescuefield and arescueargument.Historical differential testing against Dang v1's language suite found matching successful-program outcomes, but v2 accepted three programs from v1's error corpus because of type widening. This is not a claim that every v1 rejection is preserved.
Out of scope
dang.tomlimports in-engine, such as local paths and services; that still needs a separate design.dang.toml. This PR changes engine reading and execution, not SDK configuration generation.Validation
Existing integration coverage in
core/integration/module_dang_toml_test.goincludes:TestDangTomlEngineVersion: config precedence/defaults, discovery boundaries, source subdirectories, Directory sources, config writes, version rejection and mismatch warnings.TestDangTomlNamingCut: module naming selected throughdang.toml.TestDangTomlDangVersion: language defaults/overrides, unsupported versions, parent-config isolation, inference and legacy-language constructs. The legacyloop/rescuecase asserts both the function result and field value.TestDangTomlVersionMutations: real public source/SDK mutation chains and module loads, including equal-valued overrides, config writes, fresh loads, declared/default grammar and receiver immutability.Focused units cover version resolution, engine-side parsing, source isolation, implementation digests, source/SDK mutations, explicit override ordering, raw optional caching settings, persistence and warmed-scope provenance.
Fresh source-engine validation passed 30 cases selected by
^TestDang$/^TestDangToml(VersionMutations|DangVersion|EngineVersion|NamingCut)$, plus focused version/provenance units. Disabling version re-resolution inwithSourceSubpathmade three new cases fail, including a real grammar load; restoring it passed again. The duplicate legacy-language unit was removed after its remaining field assertion moved into integration coverage.Earlier revisions passed targeted Dang, entrypoint, workspace and module-loading integrations. The original mutation/provenance fixes had bounded unit coverage; the public-API integration above now supplements it. Historical build/vet passed with pre-existing
lostcancelwarnings disabled and schema regeneration was clean. No broader integration or historical differential suite was rerun for this cleanup.API changes
go -C hack/sdl-diff run . 8fbb7504a2c34632efdaf2a4b5a7a6fcc3d712e8:docs/docs-graphql/schema.graphqls aa85b3d92685835af7e516378673514e43742b7b:docs/docs-graphql/schema.graphqlsNo semantic API changes.