Skip to content

Keep the prerelease of the declared Dagger version - #208

Merged
vito merged 7 commits into
mainfrom
dagger-version-prerelease
Oct 28, 2026
Merged

vito merged 7 commits into
mainfrom
dagger-version-prerelease

Conversation

@vito

@vito vito commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #206. dagger = "v1.0.0-beta.21" now reaches Dagger as v1.0.0-beta.21 instead of v1.0.0.

Why

Dagger is making API views prerelease-granular for the v1.0.0 betas, so naming/API changes can be gated on the declared version with a cut at v1.0.0-beta.22 (dagger#14810, engine.APIViewVersion; the cut moved from beta.21 after beta.21 shipped without it):

  • v1.0.0-0 … v1.0.0-beta.21 → one shared view, v1.0.0-beta.21 (what they all had before);
  • v1.0.0-beta.22 and later → their own version;
  • a prerelease mentioning dev (e.g. v1.0.0-dev-<commit>) → the release, v1.0.0;
  • v1.0.0 → v1.0.0; build metadata dropped; below v1 unchanged (the base release).

#206 dropped the prerelease ("What reaches Dagger: always vX.Y.Z"), so a module declaring v1.0.0-beta.19 would start dagger session --version v1.0.0 and be served the newest v1.0.0 view, past the cut.

Changes

  • Parsing: Version gains Prerelease (e.g. "beta.21"). parseVersion keeps it; build metadata is still dropped (no semver precedence, and Dagger ignores it for views). "0.19" still becomes v0.19.0, "1.0-beta.21" becomes v1.0.0-beta.21, "0.0.0-beta.1" is refused like "0.0".
  • Dang versions unchanged: ParseVersion drops the prerelease as it drops the patch ("2.1.0-rc.1" is 2.1).
  • Formatting: DaggerVersionString / DaggerSource.VersionString write vX.Y.Z[-prerelease], which is what dagger session --version, ModuleSource.withEngineVersion and the TOML/JSON encodings get.
  • Ordering: Version.Before uses semver precedence (beta.9 < beta.10 < rc.1 < release). Dang versions never have a prerelease, so their gates are unaffected.
  • Engine-older check (daggerEngineOlder): compares base versions (major.minor.patch; prerelease and build ignored), matching Dagger's CheckMaxVersionCompatibility: only a declared version of a later release is refused (v1.0.1 on a v1.0.0 engine, v0.20.0 on v0.19.3). A later prerelease of the engine's own release, or the release itself (beta.21 on a beta.20 engine, v1.0.0 on v1.0.0-rc.1 or v1.0.0-beta.22), passes: Dagger caps it at the engine's own view (ModuleAPIViewVersion, dagger#14810), the newest API the engine has, rather than refusing it. Dev builds count as their release, whether they report a prerelease mentioning dev (v1.0.0-dev-123, v0.19.3-250101120000-dev-<commit>) or their VERSION file plus build metadata (v1.0.0-beta.21+42424242.dirty). devel and other unparseable versions are still not compared. --version still sends the full prerelease.
  • __schemaVersion check (daggerServesVersion): no longer requires equality with the declared version, since a declared beta.19 is legitimately served v1.0.0-beta.21 (the shared view) and engines without prerelease views (beta.21 and older) echo v1.0.0 for every v1.0.0 prerelease. It requires a view of the same release that is not older than the declared version, or, for a capped session, not older than the engine's own view (the engine's version; a dev build's is its release): a v1.0.0-beta.22 engine may serve a declared v1.0.0 or v1.0.0-rc.1 at v1.0.0-beta.22, or echo it. With an unparseable engine version a cap can't be ruled out, so any same-release view passes. A view of another release (e.g. v0.21.6 for a declared v0.19.0) still fails as "the session ignored the version", as does a view older than both the declared version and the engine's.

Open questions

  1. The __schemaVersion check is lenient within a release: keep it. A session that ignored --version and serves its CLI's own newer prerelease view (declared beta.21, served beta.25) passes. Catching it would mean mirroring the engine's view mapping in Dang, keyed on the engine's version, and Dagger's cut points move (the cut already slipped from beta.21 to beta.22), so a mirror would go stale. The engine-older check still holds.
  2. A declared release on a prerelease engine: resolved, aligned with Dagger. dagger#14810 caps rather than refuses a module that declares a newer view than the engine (refusing broke modules that declare bare v1.0.0 on beta engines), so the engine-older check now compares base versions like Dagger does: a declared later prerelease or release of the engine's own version (dagger = "v1.0.0" on a v1.0.0-rc.1 or v1.0.0-beta.22 engine) passes and is served the engine's view, as under Declare the Dagger version in the dagger import #206. Only a later release (v1.0.1 on v1.0.0) fails. Dagger caps only clients in a module; a top-level dagger session --version v1.0.0 echoes v1.0.0 and gets the same newest API. The __schemaVersion check accepts both.

Tests

go test ./pkg/... ./cmd/... passes. New and updated cases:

  • TestDaggerSource: prerelease kept, build dropped, 1.0-beta.21, 0.0.0-beta.1 refused, JSON/TOML round trip of a prerelease;
  • TestDaggerVersionImport: --version v1.0.0-beta.21 from "v1.0.0-beta.21+abcdef12";
  • TestCheckDaggerVersion: prerelease engines older and newer (a later prerelease or the release on a same-release prerelease engine passes; a later patch, minor or release's prerelease fails), dev engines (new- and old-style), the shared beta.21 view, release-granular v1.0.0 views, capped views (v1.0.0 and v1.0.0-rc.1 served v1.0.0-beta.22 by a beta.22 engine, echoed v1.0.0, an unparseable engine), and views older than both the declared version and the engine's, or of another release;
  • TestDaggerModuleSchemaVersion: withEngineVersion("v1.0.0-beta.21");
  • TestVersionPrereleaseOrder: semver precedence, including numeric identifiers.

vito added 3 commits October 22, 2026 14:03
Dagger now gives its v1.0.0 prereleases their own API views: from
v1.0.0-beta.21 on, a view keeps the declared prerelease, and the earlier
prereleases share the v1.0.0-beta.20 view (engine.APIViewVersion). Dropping
the prerelease, as `dagger = "v1.0.0-beta.21"` did, sent `--version v1.0.0`
and so selected the newest v1.0.0 view instead of the declared one.

Version gains a Prerelease, which parseVersion keeps and Before orders by
semver precedence (beta.9 before beta.10, a prerelease before its release).
DaggerVersionString writes it, so it reaches `dagger session --version` and
ModuleSource.withEngineVersion as declared; "0.19" is still v0.19.0. Build
metadata is still dropped: it has no precedence, and Dagger ignores it for
views. A Dang version drops the prerelease as it drops the patch.

The engine check now compares prereleases too: a v1.0.0-beta.20 engine is
older than a declared v1.0.0-beta.21, and a v1.0.0-rc.1 engine older than
v1.0.0. A dev build counts as its release, as the engine treats it: one whose
prerelease mentions "dev" (v1.0.0-dev-123, or the older
v0.19.3-250101120000-dev-<commit>) satisfies every prerelease of its base.
Current dev builds report their VERSION file plus the commit as build
metadata (v1.0.0-beta.21+42424242), which compares as that prerelease.

__schemaVersion no longer has to equal the declared version, since a
v1.0.0-beta.19 is served the v1.0.0-beta.20 view, and engines before
beta.21 serve every v1.0.0 prerelease the v1.0.0 view. It must be a view of
the same release that is not older than the declared version; a view of
another release still means the session ignored the version.

Signed-off-by: Alex Suraci <[email protected]>
Say that a prerelease such as v1.0.0-beta.21 reaches Dagger as is and gets
that prerelease's API, that build metadata is dropped, and that an older
prerelease engine is too old.

Signed-off-by: Alex Suraci <[email protected]>
DaggerSource's MarshalTOML and MarshalJSON docs still said "vX.Y.Z".

Signed-off-by: Alex Suraci <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

@vito
vito added this pull request to stack #207 October 27, 2026 18:46
vito added a commit to dagger/dagger that referenced this pull request Oct 28, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/dagger that referenced this pull request Oct 28, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
vito added 4 commits October 28, 2026 17:25
An engine is now older than the declared version only when its base
version is (v1.0.0 for v1.0.1), as in Dagger's
CheckMaxVersionCompatibility. A later prerelease of the engine's own
release, or the release itself, is no longer refused: Dagger serves it
the engine's own view (ModuleAPIViewVersion caps it), so `dagger =
"v1.0.0"` works on beta and rc engines.

The __schemaVersion check accepts such a capped view: one older than the
declared version passes if it isn't older than the engine's own view.
A view of another release still fails.

Signed-off-by: Alex Suraci <[email protected]>
A later prerelease of the engine's release, or the release itself, gets
the engine's newest API instead of an error.

Signed-off-by: Alex Suraci <[email protected]>
The checkDaggerVersion comment and the skill's dang.toml reference still
said any older engine is refused. Also note why the capped view is
accepted for top-level sessions too: Dagger caps only module clients,
but a top-level session that ignored the version on a same-version CLI
serves the API a cap would.

Signed-off-by: Alex Suraci <[email protected]>
An engine before v1.0.0-beta.22 has no prerelease views: it serves every
v1.0.0 prerelease the v1.0.0 view, never the shared beta.21 one.

Signed-off-by: Alex Suraci <[email protected]>
Base automatically changed from dagger-view to main October 28, 2026 20:01
@vito
vito force-pushed the dagger-version-prerelease branch from 05cba40 to e780fdd Compare October 28, 2026 20:05
@vito
vito marked this pull request as ready for review October 28, 2026 20:06
@vito
vito merged commit 10fb92d into main Oct 28, 2026
9 checks passed
vito added a commit to dagger/dagger that referenced this pull request Oct 29, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/dagger that referenced this pull request Oct 29, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/dagger that referenced this pull request Oct 29, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/dagger that referenced this pull request Oct 29, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/dagger that referenced this pull request Nov 2, 2026
Pins github.com/vito/dang/v2 to the head of vito/dang#208, stacked on #206 and
#185. Together they add the `dang` and `[imports.Dagger] dagger` keys of
dang.toml, dang.ContextWithVersion and DaggerSource.VersionString, which keeps
a declared prerelease (v1.0.0-beta.19 stays as is rather than becoming v1.0.0,
past the naming cut). BurntSushi/toml becomes a direct dependency: the engine
decodes an entrypoint's dang.toml into Dang's own ProjectConfig.

This is a pseudo-version of an unmerged branch; re-bump it to a Dang release
before merging.

Signed-off-by: Alex Suraci <[email protected]>
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.

1 participant