Repository navigation
version: a dang.toml without a version is current - #287
Merged
Merged
Conversation
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]>
Deploying dang with
|
| 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 |
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]>
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.
A
dang.tomlwithout adangkey now meansCurrentVersion, exactly like source nodang.tomlgoverns.DefaultVersion, which pinned keyless projects at 2.1 forever, is gone: projects roll forward with Dang unless they pin a version (dang = "X.Y", whichdang initwrites).On main
CurrentVersionis still 2.1, which is whatDefaultVersionwas, 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:DefaultVersionandProjectConfig.EffectiveVersionare removed.VersionForConfigtreats a keyless config like no config: it returnsVersionFromContext(the embedder's pin, orCurrentVersion).dang init: stampsCurrentVersioninto a keylessdang.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 keylessdang.toml, nested ones included. The old scoping is gone:--fromused to apply only to root's own project, and nested keyless projects were listed inUndeclaredand reported as "declares no Dang version, so --from doesn't apply".--from. OnceCurrentVersionmoves, a keyless project written for the older version reads as the new one, andmigratewould just say "nothing to migrate". SoMigrationPlan.Undeclarednow lists the projects that declare no version. Without--from,dang migratenames each one as read in this Dang's version, with a hint to pass--from. Previewing a single file prints the same hint.migrate a a/sub) are planned once. Before, an inner argument's ungoverned source became a second project and got its owndang.toml. The reviewer reproduced this.init,migrate), the CLI anddang.tomldocs, thedang-languageskill, and thelanguage-versionsskill. The skill's invariant "DefaultVersionis pinned forever" is now "undeclared means current", and its checklist notes that bumpingCurrentVersionmoves every unpinned project.Choices worth a look
ContextWithVersionis unchanged. It still applies under a keylessdang.toml, and throughbindContextVersion/importContextVersionit still carries into imports the same keylessdang.tomlgoverns. 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-onlydang.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.--fromapplies 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 thatmigrate -w --from 2.0 .on a repo also rewrites a nested keyless project that was really written for the current version. For example, acasewithoutelsegains a raisingelse. That's deliberate: run--fromon 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--fromwill touch.Embedders
Dagger's Dang SDK (
core/sdk/dang/v2/version.go) referencesdang.DefaultVersion: for entrypoints with nodang.toml, for emptyModuleSource.DangVersion, and in tests. Its comments rely on keyless meaning 2.1. When it bumps itsdangdependency past this PR, it needs to usedang.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 keylessdang.tomlshould roll forward with the engine's Dang, or be pinned viaContextWithVersion.Release note