Skip to content

version: a dang.toml without a version is current - #287

Merged
vito merged 4 commits into
mainfrom
drop-default-version
Nov 10, 2026
Merged

vito merged 4 commits into
mainfrom
drop-default-version

Conversation

@vito

@vito vito commented Nov 9, 2026

Copy link
Copy Markdown
Owner

A dang.toml without a dang key now means CurrentVersion, exactly like source no dang.toml governs. DefaultVersion, which pinned keyless projects at 2.1 forever, is gone: projects roll forward with Dang unless they pin a version (dang = "X.Y", which dang init writes).

On main CurrentVersion is still 2.1, which is what DefaultVersion was, so nothing changes behavior today. The difference shows up at the next bump (#286 moves to 2.4).

What changed

  • pkg/dang/version.go, project.go: DefaultVersion and ProjectConfig.EffectiveVersion are removed. VersionForConfig treats a keyless config like no config: it returns VersionFromContext (the embedder's pin, or CurrentVersion).
  • dang init: stamps CurrentVersion into a keyless dang.toml. That is the version it already means, so nothing changes meaning; it just stops rolling forward.
  • dang migrate / PlanMigrations: --from (MigrateOptions.UndeclaredFrom) now applies uniformly to all source whose version nothing declares under the given directories. That covers ungoverned source and every keyless dang.toml, nested ones included. The old scoping is gone: --from used to apply only to root's own project, and nested keyless projects were listed in Undeclared and reported as "declares no Dang version, so --from doesn't apply".
  • New: a hint without --from. Once CurrentVersion moves, a keyless project written for the older version reads as the new one, and migrate would just say "nothing to migrate". So MigrationPlan.Undeclared now lists the projects that declare no version. Without --from, dang migrate names each one as read in this Dang's version, with a hint to pass --from. Previewing a single file prints the same hint.
  • Overlapping directory arguments (migrate a a/sub) are planned once. Before, an inner argument's ungoverned source became a second project and got its own dang.toml. The reviewer reproduced this.
  • Help text (init, migrate), the CLI and dang.toml docs, the dang-language skill, and the language-versions skill. The skill's invariant "DefaultVersion is pinned forever" is now "undeclared means current", and its checklist notes that bumping CurrentVersion moves every unpinned project.

Choices worth a look

  • ContextWithVersion is unchanged. It still applies under a keyless dang.toml, and through bindContextVersion/importContextVersion it still carries into imports the same keyless dang.toml governs. It is still meaningful: an embedder that knows a module's version some other way (Dagger pinning by engine version) decides it for an import-only dang.toml. Removing it would make that embedder unable to pin such modules, and it isn't simpler to drop: the carry is the only thing keeping a pinned module's own path imports on the same version.
  • --from applies to nested keyless projects too. Every keyless project now means the same thing (current), so there is no reason to treat root's own differently. The cost is that migrate -w --from 2.0 . on a repo also rewrites a nested keyless project that was really written for the current version. For example, a case without else gains a raising else. That's deliberate: run --from on just the directories written for that version, or pin the nested project first (dang init). The hint lists the projects so you can see what --from will touch.

Embedders

Dagger's Dang SDK (core/sdk/dang/v2/version.go) references dang.DefaultVersion: for entrypoints with no dang.toml, for empty ModuleSource.DangVersion, and in tests. Its comments rely on keyless meaning 2.1. When it bumps its dang dependency past this PR, it needs to use dang.Version2_1 (or its own constant) where it means "the version entrypoints/modules were pinned to". It also needs to decide whether post-v2 modules with an import-only keyless dang.toml should roll forward with the engine's Dang, or be pinned via ContextWithVersion.

Release note

A dang.toml without a dang key now follows the running Dang, like source with no dang.toml. Pin with dang = "x.y" (or dang init) to keep a version. To move a keyless project written for an older Dang, use dang migrate --from x.y; without --from, dang migrate now lists projects that declare no version.

vito added 3 commits November 9, 2026 21:05
A dang.toml without a `dang` key now means CurrentVersion, like source no
dang.toml governs, instead of a DefaultVersion pinned at 2.1: projects roll
forward with Dang unless they pin a version, which `dang init` does.

DefaultVersion and ProjectConfig.EffectiveVersion are gone. `dang init`
stamps CurrentVersion into a keyless dang.toml. `dang migrate --from` (and
MigrateOptions.UndeclaredFrom) now applies uniformly to all source whose
version nothing declares under the given directories, nested keyless
projects included, so MigrationPlan.Undeclared and its "--from doesn't
apply" report are gone too.

ContextWithVersion keeps applying under a keyless dang.toml and carrying
into imports the same dang.toml governs: an embedder pinning a module's
version still decides it for an import-only dang.toml.

Signed-off-by: Alex Suraci <[email protected]>
Once CurrentVersion moves on, a keyless project written for the older
version reads as the new one and `dang migrate` finds nothing to migrate.
Without --from, PlanMigrations now lists the projects whose version
nothing declares (MigrationPlan.Undeclared), and `dang migrate` names
them, read as this Dang's version, with a hint to pass --from; previewing
a file does the same.

Signed-off-by: Alex Suraci <[email protected]>
A directory argument inside another one (with no repository boundary
between them) is now left to the outer one. Planned on its own, its
ungoverned source became a second project keyed by its own dang.toml, so
`migrate -w --from 2.0 a a/sub` rewrote a/sub's files twice and wrote an
extra a/sub/dang.toml, and the undeclared hint named it twice.

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

cloudflare-workers-and-pages Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Deploying dang with  Cloudflare Pages  Cloudflare Pages

Latest commit: 67ac851
Status: ✅  Deploy successful!
Preview URL: https://294236f5.dang-3kk.pages.dev
Branch Preview URL: https://drop-default-version.dang-3kk.pages.dev

View logs

Describe a dang.toml without a `dang` key by what it means, without
referring to the default version it replaced or how init's pinning
differs from before.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito merged commit 9316388 into main Nov 10, 2026
9 checks passed
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