Skip to content

dagql: accept hidden transition aliases - #14668

Closed
vito wants to merge 3 commits into
mainfrom
naming/3-dagql-aliases
Closed

vito wants to merge 3 commits into
mainfrom
naming/3-dagql-aliases

Conversation

@vito

@vito vito commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Part 3/N of the stack splitting #14501 (identifier casing). Plan: #14501 (comment)

Refs #13668

Stacked on #14667.

Why aliases

The naming change renames names the engine already serves, and their users can't all update at the same moment as the engine. Without aliases, every rename breaks those users on engine upgrade. Aliases accept the old spellings for a transition window. Ending the window (after 1.0, Phase 5 of the #14501 Migration Plan) means deleting core.NameAliases, core.ModuleNameAliases and their callers.

The transitions they cover:

  1. v1 beta modules renamed on engine upgrade. The gate is base-version granular, so with PR 4 every v1.0.0-beta.* and v1.0.0-0 module gets the new rules: legacyJson → legacyJSON, and daggerCli → daggerCLI for a module named dagger-cli. Without aliases these callers break:
    • other modules' Dang code (go-sdk calls sdk-helpers' .generate(..., legacyJson: …));
    • committed generated bindings (dagger-module.toml modules build from code the external SDKs generated);
    • hand-written queries, scripts and CLI calls.
  2. Manifest v2 entrypoint modules. They declare no engineVersion and run at the engine's own version, so an engine upgrade renames them without any change of their own (getUrl → getURL, TinyHttpClient → TinyHTTPClient).
  3. Callers on older versions. A module's names follow its own engine version, not its caller's, so a pre-v1 caller of a renamed v1 module sees the new names too. That's why module aliases apply on every view, while core aliases apply only on v1 views.
  4. Core renames on v1 views. PR 6 renames callId → callID, shortSha → shortSHA, the FunctionCachePolicy values and a few others. That would break clients and bindings generated against the beta v1 schema.
  5. Renamed module enum members (ARM_64 → ARM64, GIT_HUB → GITHUB), given as literals, variables, CLI flags or JSON. These aliases are input only.
  6. External SDK repos (go-sdk, sdk-helpers, python-sdk, …) port on their own schedule. Until they do, their generated code and Dang call sites keep sending the old names.

Why this design:

  • Not a version gate. An earlier design gated on the full engineVersion and served older prereleases at views marked +legacy-naming. It couldn't work: external SDK modules that declare v1.0.0 (go-sdk, sdk-helpers) would have been renamed at release anyway. The marked views also fragmented the cache, and they had to hide formatIdentifiers and rewrite __schemaVersion.
  • Hidden, not visible deprecated duplicates. Visible duplicates collide in SDK generators: legacyJson/legacyJSON both become LegacyJSON in Go, and shortSha/shortSHA both become short_sha in Python. The external repos' forked generators can't be fixed at the same time as the engine. For enums, visible duplicates would also add noise to the schema and to every SDK.
  • No cache split. Aliases are canonicalized when the query is parsed or the input is decoded, so old and new spellings share IDs and cache entries.
  • Release ordering. Aliases must ship in the same engine release as the first rename, or an earlier one (see below).

What's in it

  • Hidden transition aliases in dagql (dagql/aliases.go): old spellings that queries can still use after a rename, optionally limited to some views. They cover:

    • Fields, arguments and types: Field.WithAliases, Argument.WithAliases, ClassOpts.Aliases, Interface.WithAliases. Type aliases match in fragment type conditions, including node(id:) { ... on OldName }.
    • Struct-tag fields: object types implementing FieldAliased.
    • Input object fields: input types implementing InputFieldAliased.
    • Enum values: EnumValues.WithAliases / EnumValueAliased. These are input only: responses always use the canonical name.
    • Per-view enum renames: EnumValues.RenameView gives a value a new name in some views, while older views keep the old one, which can stay accepted as an alias.
  • Only validation sees them. Queries are validated against SchemaWithAliasesForView, which is also what gqlgen's handler validates with. In it, each alias is a @deprecated copy of its canonical definition. Schema and SchemaForView never show aliases, so introspection, codegen and the schema JSON don't either: SDK generators would collide on them (legacyJson and legacyJSON both become LegacyJSON in a Go opts struct).

  • No cache split. Field, argument and type aliases are rewritten to the canonical name when the query is parsed. Enum value and input field aliases are resolved by the type's decoder, so literals, variables and CLI/JSON strings all decode to the canonical value. Either way, an aliased query makes the canonical calls, with the same IDs and cache keys. Giving something under both names is an error.

  • Telemetry: each use of an alias adds a dagger.io/dag.alias event to the current span (engine/telemetryattrs).

  • Conflicts: an alias that collides with a real name, or that two names claim, is ignored with a warning. Aliases count toward the schema digest.

  • Core helpers:

    • core.NameAliases builds aliases accepted only on v1 views, for core renames.
    • core.ModuleNameAliases builds aliases accepted on every view, for module renames: a module's names follow its own engine version, not its caller's.

    Every transition alias goes through one of them, so ending the transition means deleting them and their callers.

  • Dang: the in-engine Dang runtime typechecks callers against its dependencies' schema JSON, so a caller that uses an old name has to typecheck too. __schemaJSONFile gets an internal includeAliases argument that adds the field, argument and enum value aliases as deprecated entries. SchemaIntrospectionJSONFileForDang asks for it, and all Dang call sites use that. Type aliases stay out, because to Dang a copy of a type would be a different type. Other SDKs keep the alias-free JSON.

No behaviour change

Nothing registers an alias yet, apart from tests, and the public schema doesn't change (includeAliases is internal). Engine module naming (PR 4) and the core renames (PR 6) are the first users.

Release ordering

This should ship in the same engine release as #14667. Nothing may rename a name the engine serves until these aliases ship in that release or an earlier one: the aliases are what keep beta-era bindings working.

Known gaps

  • __typename always returns the canonical name, since the server can't know which spelling a client expects. Old Go bindings' Concrete() fails for a renamed implementation until the bindings are regenerated.
  • Recorded call IDs that use old names don't load: only queries and input decoders go through the aliases.
  • Dang annotations can't use old type names, because Dang's schema JSON has no type aliases.
  • Enum type names have no aliases. This only matters for queries that declare a variable of a renamed enum type.
  • Aliases can show up in validation's "Did you mean …" suggestions.
  • Aliases cover names on the wire, not the SDK identifiers derived from them. SDK-side deprecated aliases come with PR 4 and the 5x PRs.

Testing

  • go build, go vet; go test ./dagql/... ./core/ ./core/schema/ ./core/sdk/...
  • dagql tests:
    • aliases_test.go: fields, arguments, types, fragments, node(id:), collisions, views, digest, span events
    • enum_aliases_test.go: literals, variables, decoders, collisions
    • enum_rename_test.go: RenameView
    • input_aliases_test.go: input object and struct-tag fields
  • core/schema/aliases_test.go: the plain and Dang schema JSON, and aliased queries through core
  • Integration tests: TestModule/(TestBuiltinDangDependencyModules|TestBuiltinDangModuleEntrypoint|TestDangModuleEntrypointEnumRoundtrip)
  • golangci-lint/lint-all and docs/references/stale (the schema is unchanged)

@vito
vito added this pull request to stack #14670 October 14, 2026 02:32
@vito
vito force-pushed the naming/3-dagql-aliases branch from 0e52531 to 0b3be7b Compare October 14, 2026 23:28
Base automatically changed from naming/2-identifier-api to main October 15, 2026 20:39
vito added 3 commits October 15, 2026 16:39
Types, fields, arguments, input object fields, struct-tag fields and enum
values can declare Aliases: old spellings that queries may still use after a
rename, optionally limited to some views. They exist only in the schema
queries are validated against (SchemaWithAliasesForView, also what gqlgen's
handler validates with). Schema and SchemaForView, and so introspection,
codegen and the schema JSON, never show them: SDK generators would collide
on them (legacyJson and legacyJSON both become LegacyJSON in a Go opts
struct).

Field, argument and type aliases are rewritten to the canonical name when
the query is parsed, so an aliased query makes the canonical calls: same IDs,
same cache entries. Type aliases match in fragment type conditions,
including node(id:) { ... on OldName }. Enum value and input object field
aliases are input only: the enum's or input object's decoder resolves them,
so literals, variables and plain strings all decode to the canonical value.
EnumValues.RenameView gives a value a new name in some views, for renaming
a core enum's values on v1 views while older views keep the old names.

Each use adds a dagger.io/dag.alias event to the current span. Aliases
colliding with a real name, or claimed by two names, are ignored, and they
count toward the schema digest. Nothing registers an alias yet.

Refs #13668

Signed-off-by: Alex Suraci <[email protected]>
NameAliases builds the dagql.Aliases for an old spelling of a renamed core
type, field, argument or enum value, accepted only on the views with the new
naming rules (v1.0.0 and later). ModuleNameAliases is the same for a
module's declarations, accepted on every view: a module's names follow its
own engine version, not its caller's view. Every transition alias goes
through one of them, so ending the transition is deleting them and their
callers.

Nothing calls them yet.

Refs #13668

Signed-off-by: Alex Suraci <[email protected]>
The in-engine Dang runtime typechecks its callers against its dependencies'
schema JSON, so a Dang caller using an old name (like go-sdk's
.generate(legacyJson: ...)) would fail to typecheck even though the engine
accepts the alias. __schemaJSONFile gets an internal includeAliases argument
that adds the field, argument and enum value aliases, deprecated, and
SchemaIntrospectionJSONFileForDang asks for it. Type aliases stay out: a
copy of a type would be a different type to Dang. Other SDKs keep the
alias-free JSON, since their generators would collide on the aliases.

Refs #13668

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/3-dagql-aliases branch from 0b3be7b to dae8ed4 Compare October 15, 2026 20:39
@vito

vito commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Closing as superseded. The naming transition is now gated purely on schema views keyed on the declared engine version (cut at v1.0.0-beta.20, with prerelease-granular views for v1.0.0 betas), and entrypoint modules will declare their version via dang.toml. So the hidden-alias system isn't needed. #14669 and #14681 are being rebuilt without it. The branch is kept for reference.

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