Skip to content

core: version entrypoint modules via dang.toml - #14902

Merged
vito merged 13 commits into
naming/core-renames-graphql-casingfrom
naming/entrypoint-dang-toml-version
Nov 5, 2026
Merged

vito merged 13 commits into
naming/core-renames-graphql-casingfrom
naming/entrypoint-dang-toml-version

Conversation

@vito

@vito vito commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Manifest-v2 entrypoint modules declare their Dagger API version and Dang language version in dang.toml. Undeclared entrypoints default to v1.0.0-beta.25, preserving their pre-cut naming and API view when the beta.26 casing changes ship.

What it does

A manifest-v2 module (dagger-module.toml with an [entrypoint] table) has no manifest engineVersion. Previously its entrypoint followed the running engine's version, so an engine upgrade could change the API names expected by existing generated source. This PR gives the entrypoint an explicit version source and a stable pre-cut default.

The engine reads the governing dang.toml:

dang = "2.1"

[imports.Dagger]
dagger = "v1.0.0-beta.26"
  • [imports.Dagger] dagger becomes ModuleSource.EngineVersion: API view, naming (NamingView()), default function caching, dependency/core schema view, min/max checks. The sources member, which runs before the module exists, is served at the same view.
  • dang picks the Dang language version (dang.ContextWithVersion, also for the sources scan).
  • Versionless entrypoints (no dang.toml, no Dagger import, or dagger = true) get v1.0.0-beta.25, the last release before the cut. They keep the old core names and the strcase naming, so beta.26 can ship the renames without breaking existing entrypoints, and they keep the API main shipped from v1.0.0-beta.22 on. Dang defaults to DefaultVersion (2.1).
  • Which dang.toml: for a local entrypoint, the nearest one from the entrypoint directory up to the module directory (never above it); for a module reference/address, the named directory's own.
  • Both versions key SourceImplementationDigest for entrypoints, so cached typedefs built under one version never answer for another.
  • Entrypoints use the shared minimum supported module version, not an additional entrypoint-specific floor.
  • withEngineVersion is an in-memory API-version override; it does not write a new value to dang.toml or the manifest.

A declared version newer than the running engine uses the engine's available API view. Base-version compatibility checks still apply, as for legacy module manifests; this does not promise support for a newer engine release's features.

Boundaries and known limitations

  • Remote entrypoints are resolved eagerly to read their config before module naming and schema construction. A missing or unreachable remote can prevent loading—and generation that would otherwise replace the entrypoint—until the manifest is corrected.
  • The remote entrypoint owns its version. Its directory's dang.toml controls the entrypoint's API/language versions. Changing that file on a moving remote ref can change consuming modules' names. This PR does not add a separate version pin in the consuming manifest; whether to add one is a separate design question.
  • dagger = true can disagree with standalone tooling. The engine uses the pinned beta.25 default, while Dang CLI/LSP tooling without an explicit version can use the running CLI's API. Explicit version strings avoid that ambiguity. This PR documents the difference rather than rejecting true.
  • SDKs own generated entrypoint configuration. To target a newer API, the generator writes dang.toml beside the entrypoint. The engine reads it; it does not generate that file. Undeclared entrypoints remain on the pre-cut default.

Validation

Existing integration coverage includes:

  • TestModule/TestDangModuleEntrypointEngineVersion: defaults, nearest config, module-directory boundaries, Directory sources and module-reference entrypoints.
  • TestModule/TestDangModuleEntrypointDeclaredAPIView: declared API views during module loading.
  • TestModule/TestDangModuleEntrypointSourcesAtDeclaredView: declared API and language versions during sources scanning; default and Dang 2.0 cases read the generated context file to prove the scan actually ran.
  • TestModule/TestDangModuleEntrypointDangVersion: declared, undeclared and unsupported Dang language versions through the real loader.
  • TestModule/TestDangModuleEntrypointNamingCut and TestModule/TestDangModuleEntrypointVersionlessCachePolicies: naming/API cut and versionless cache-policy compatibility.

Minimum-version rejection, future same-base view capping, import conflicts/aliases and implementation-digest isolation have focused unit coverage rather than dedicated entrypoint integration cases.

Fresh targeted validation passed all five subcases of TestModule/TestDangModuleEntrypoint(SourcesAtDeclaredView|DangVersion)$, plus retained parser/scanner units. Forcing the scanner to use the default grammar made only the declared Dang 2.0 case fail; restoring the implementation passed again. Two equivalent syntax unit cases were removed in favor of real-loader coverage.

Earlier revisions reported passing unit packages, build/vet and targeted development-engine integrations (77 entrypoint cases and 58 naming/loading/check cases). The beta.26 restack checked build, vet with pre-existing lostcancel warnings disabled, and schema regeneration. These are historical results, not a claim that all suites were rerun on the current head.

API changes

go -C hack/sdl-diff run . 3f7f7fa2f515812cc011ff73e41ae06550cd92f2:docs/docs-graphql/schema.graphqls 8fbb7504a2c34632efdaf2a4b5a7a6fcc3d712e8:docs/docs-graphql/schema.graphqls

No semantic API changes.

@vito
vito added this pull request to stack #14901 October 28, 2026 14:05
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from 825a060 to 2a84d67 Compare October 28, 2026 16:35
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from 2a84d67 to 909d499 Compare October 28, 2026 17:08
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from efeeed8 to b941d4c Compare October 29, 2026 01:21
@vito
vito marked this pull request as ready for review October 29, 2026 01:24
@vito

vito commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

🤖 (posted on behalf of @vito)

@eunomie @TomChv, following up on your discussion with Solomon: "dang.toml's dagger field is a native Dagger concept the engine reads when loading Dang entrypoints" is what this PR implements. We'd love your review, especially on the lookup rules, since every SDK's entrypoint will rely on them.

How the engine reads it

  • [imports.Dagger] dagger = "vX" becomes the module's EngineVersion. That sets the API view, the naming of the module's declarations, compat checks and default caching. dang = "X.Y" picks the Dang language version.
  • Which file counts:
    • local entrypoint: the nearest dang.toml walking up from the entrypoint's directory, but never above the module directory. A dang.toml next to the generated internal/dagger/entrypoint/main.dang therefore governs it.
    • module ref or address: only that directory's own dang.toml.
  • No dang.toml, no Dagger import, or dagger = true gives v1.0.0-beta.20. That's the pre-cut view, so existing generated entrypoints keep working on beta.22.
  • A version past the engine's is served at the engine's view (capped). Only a newer base version is refused, the same as engineVersion.

Proposal for the SDK side

  1. Every SDK that generates a .dang entrypoint also generates a dang.toml next to it with dagger = "<target>". Should this go in sdk-helpers, which already writes the manifest that names the entrypoint, so every SDK gets it at once? And should it also write dang = "X.Y"?
  2. With the whole module served at the target T, module code that doesn't declare a version already sees T. Does that make DAGGER_CLIENT_VERSION=T, and the pub targetVersion member and its older-engine refusal (typescript-sdk#119, python-sdk#66), redundant? The engine's version check on the declared version already refuses older engines.

Gaps for beta.22 (the identifier-casing cut)

  • go-sdk: default init (Dang entrypoint + unified clients) targets beta.21, which is fine. The opt-outs (dangEntrypoint = false, fat, template: legacy, unifiedClients = false) still stage new modules at the running engine's version, which is post-cut on beta.22. One case we suspect but haven't verified: an entrypoint module with embedded bindings gets bindings from the beta.22 schema, but without a dang.toml it's served at beta.20. Writing dang.toml (item 1) would fix that.
  • java-sdk#42 fixes the entrypoint, but the runtime seed still stages at the running engine's version.
  • cli: default targetVersion to the engine at module init #14862: module init writing targetVersion = the running engine (beta.22 on a beta.22 engine) would then be rejected by go-sdk#85 and java-sdk#42, since it's newer than the SDK's target.

Happy to adjust any of the engine-side rules if they don't fit what you had in mind.

@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from b941d4c to 27f40d2 Compare October 29, 2026 02:06
vito added a commit that referenced this pull request Oct 29, 2026
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
The comment added before PrerequisiteSHAs splits the struct's alignment
block, so gofmt realigns the fields above it. golangci-lint reported it
on #14902's CI; #14895's own lint run was OOM-killed before reporting.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from 1c7c7b2 to acf75d4 Compare October 29, 2026 03:05
vito added a commit that referenced this pull request Oct 29, 2026
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
The comment added before PrerequisiteSHAs splits the struct's alignment
block, so gofmt realigns the fields above it. golangci-lint reported it
on #14902's CI; #14895's own lint run was OOM-killed before reporting.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
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]>
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from acf75d4 to 3e318dd Compare October 29, 2026 19:11
@vito
vito requested review from a team as code owners October 29, 2026 19:11
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from e209877 to e1da14e Compare November 5, 2026 00:04
vito added a commit that referenced this pull request Nov 5, 2026
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
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]>
vito added a commit that referenced this pull request Nov 5, 2026
The comment added before PrerequisiteSHAs splits the struct's alignment
block, so gofmt realigns the fields above it. golangci-lint reported it
on #14902's CI; #14895's own lint run was OOM-killed before reporting.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from e1da14e to f34ecfe Compare November 5, 2026 00:13
vito added a commit that referenced this pull request Nov 5, 2026
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
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]>
@vito vito changed the title core: version entrypoint modules via dang.toml (beta.22 stack) core: version entrypoint modules via dang.toml Nov 5, 2026
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from f34ecfe to 8fbb750 Compare November 5, 2026 03:36
vito added a commit that referenced this pull request Nov 5, 2026
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
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]>
vito added 13 commits November 5, 2026 11:28
A manifest v2 module had no engine version: it was served at the running
engine's own version and always parsed as the latest Dang, with the minimum and
maximum version checks skipped. Core API view changes, Dang language changes and
the naming cut would all reach existing entrypoints silently.

The engine now reads the dang.toml governing the entrypoint, with Dang's own
types: the nearest one walking up from the entrypoint directory to the module
directory (never above it, so the result does not depend on how the module was
loaded), or the named directory's own for a module reference or address.

- `[imports.Dagger] dagger = "vX.Y.Z"` is the module's engine version: its API
  view (through engine.ModuleAPIViewVersion, like a dagger.json engineVersion),
  naming rules, default caching and dependency schema. It gets the same minimum
  and maximum checks as an engineVersion, at load and in
  loadModuleSourceConfig. The sources member, which runs before the module
  exists, is served at that view too, as types and call are.
- `dang = "X.Y"` is the Dang version the entrypoint is parsed as, set with
  dang.ContextWithVersion (and when scanning for a sources member).

With no Dagger version declared, the engine version is v1.0.0-beta.20, the last
release before the naming cut and the shared pre-cut view, which existing
entrypoints were written against; with no Dang version, Dang's DefaultVersion
(2.1). Both are pinned so an entrypoint that declares nothing keeps its meaning
across engine releases.

Both versions key SourceImplementationDigest, so results such as the persisted
_moduleTypesDefinition built under one version never answer for another, even
when the dang.toml lies outside the module context.

Signed-off-by: Alex Suraci <[email protected]>
Covers the default (v1.0.0-beta.20 with no dang.toml, no Dagger import or
`dagger = true`), a version or prerelease declared in or above the entrypoint
directory and in a module reference, a dang.toml above the module directory
ignored however the module is loaded, the declared API view gating
Workspace.resolve and serving sources, a too-new version refused with "module
requires dagger ...", the declared Dang version, and a versionless entrypoint
that spells the pre-cut FunctionCachePolicy values.

Signed-off-by: Alex Suraci <[email protected]>
The manifest v2 spec gains a Versions section: the dang.toml keys, which
dang.toml the engine reads, the defaults and why they are pinned. The identifier
casing design records that entrypoints pin their naming through it.

Signed-off-by: Alex Suraci <[email protected]>
The pre-cut view moved: the naming cut is now v1.0.0-beta.22, and every
v1.0.0 prerelease before it, beta.21 included, shares one view. The
v1.0.0-beta.20 default still lands on it. A declared version past the
engine's own is served the engine's view (engine.ModuleAPIViewVersion caps
it), so say that, and check it, instead of implying it is refused.

Signed-off-by: Alex Suraci <[email protected]>
The Dang entrypoint fixtures that declare no version are served the
shared pre-cut view now, like the generated entrypoints they stand for,
so they spell the cache policies Never, PerSession and Default again.

TestDangModuleEntrypointNamingCut checks both sides of the cut: a
versionless entrypoint gets the old FunctionCachePolicy members and the
legacy naming (TinyHttpClient), one whose dang.toml declares
engine.IdentifierCasingVersion gets the new members and naming
(TinyHTTPClient), and neither accepts the other's spelling.

Signed-off-by: Alex Suraci <[email protected]>
The manifest v2 spec's Versions section names the beta.22 cut and the
cap on views past the engine's; the identifier-casing plan lists
entrypoint versioning as a step and drops it from what is not done; the
version-gating notes say where a manifest v2 module's version comes
from.

Signed-off-by: Alex Suraci <[email protected]>
From review: the identifier-casing doc still recommended an [entrypoint]
key and argued a remote entrypoint can only pin through the module's
manifest, against the outcome below it. Say what the outcome means for a
module using a shared remote entrypoint: its author picks the version.

The manifest v2 spec now says a withEngineVersion override of an
entrypoint module is not written back, and that Dang's tooling type
checks `dagger = true` against the CLI's API while the engine serves the
pinned pre-cut view.

Signed-off-by: Alex Suraci <[email protected]>
Changie fragments for the identifier-casing stack: prerelease-granular API
views (#14810), module naming by GraphQL casing (#14891), the core API renames
(#14895, breaking), and entrypoint engine versions from dang.toml (#14902).

Signed-off-by: Alex Suraci <[email protected]>
Follow the identifier casing cut to v1.0.0-beta.25 in the entrypoint version
docs, the Dang SDK's version tests and the changelog fragments. The releases
undeclared entrypoints ran on now reach v1.0.0-beta.24.

Signed-off-by: Alex Suraci <[email protected]>
An entrypoint whose dang.toml declares no Dagger version was pinned to
v1.0.0-beta.20, the view every v1.0.0 prerelease before prerelease views
shares. Entrypoints written while v1.0.0-beta.22 to beta.24 were current ran
at those releases' own views, past the gates main shipped in them (such as
Container's sourceDateEpoch and collection item checks), which the pinned
default hid. Pin them to v1.0.0-beta.24 instead, the last release before
the casing cut: it keeps that API and still has the old core names and
naming rules.

Signed-off-by: Alex Suraci <[email protected]>
Move entrypoint defaults and cut documentation forward after beta.25
shipped. Keep main's Dang pin: 00dc380 contains v2.3.0 and its versioned
grammar along with main's prepared compilation changes.

Signed-off-by: Alex Suraci <[email protected]>
Keep the version-gating guide's default consistent with the entrypoint
resolver and manifest specification.

Signed-off-by: Alex Suraci <[email protected]>
Exercise Dang 2.0 sources through the module loader and inspect the returned
context file so silently skipping the scan cannot pass. Keep the existing API
view assertion and drop two parser unit cases already covered by the declared
and undeclared language-version integration tests.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/entrypoint-dang-toml-version branch from 8fbb750 to e7ce834 Compare November 5, 2026 16:28
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.

2 participants