Repository navigation
Conversation
A list of plain values (Array, DynamicArrayOutput) gave each element a result of its own when resolving the response: a deep copy of the list's call frame, and for a cached list, a cache entry per element. For a call with a large list argument that is quadratic: formatIdentifiers with the core schema's 961 names spent ~250ms on per-element cache entries, and ~100ms copying frames when uncached. Leaf elements need no result, so read them straight from the list. 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]>
Expose engine/naming through Query.identifier, Query.formatIdentifiers and Query.namingDictionary, with the Identifier, IdentifierWord, NamingTerm, IdentifierWordKind, Casing and AcronymStyle types. The API is experimental and only served at v1.0.0 views (IdentifierNamingVersion, v1.0.0-0), prereleases included. formatIdentifiers returns plain strings so SDK codegen can format thousands of names in one round trip, takes the engine version whose dictionary to use (codegen passes the __schemaVersion it generates for), and skips the cache: formatting is far cheaper than publishing a result with a large list argument. Identifiers persist their words rather than re-parsing, so a cached value keeps formatting the same way if the dictionary changes. Signed-off-by: Alex Suraci <[email protected]>
Add the identifier casing API to the GraphQL schema snapshot and the API reference pages. Signed-off-by: Alex Suraci <[email protected]>
Pure additions: the Go, Python, TypeScript, Rust, Elixir and PHP core bindings for Query.identifier, Query.formatIdentifiers, Query.namingDictionary and their types. Signed-off-by: Alex Suraci <[email protected]>
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]>
Modules that declare engine version v1.0.0-0 or later (every v1.0.0 prerelease, since the gate is a view and views are base-version granular), and manifest v2 entrypoints, which are served at the engine's own version, now get their schema names from engine/naming instead of strcase: HTTPClient stays HTTPClient instead of Httpclient, e2eTest is no longer E_2_E_TEST, and so on. Older modules keep the strcase rules byte for byte. core.Namer carries the choice. The typedef constructors (function, withArg, withObject, withField, withEnumMember, ...) record the caller's view and normalize with NamerFromContext, so a module's runtime names by the version it declares; the in-engine Dang runtime stamps that view on the selectors it makes (dangshared.NamingSelectors). Constructors, namespacing, CLI paths, include patterns and artifact paths follow the owning module's Namer, and lookups of user-typed names try both spellings. Every name the new rules changed keeps its legacy spelling as a hidden alias, accepted on every view (ModuleNameAliases): constructors, types, functions, fields, arguments and enum members (decoded by the enum, via EnumMemberTypeDef.LegacyName). A module's names follow its own version, not its caller's, so callers generated against the old names keep working. Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
The CLI derives command, flag and type names from schema names. It now spells them by the naming rules of the engine version it ships with (e2eTest is --e2e-test, not --e-2-e-test): the typedefs it loads don't say which engine version each module declares, and a client follows the version it connects with. What users type still resolves by the legacy rules too: legacy flag spellings normalize to the current ones, legacy command spellings are cobra aliases and are matched by the shell and sibling-entrypoint lookups (fn-2 for fn2), and module constructors and type names match either spelling. Enum flags and collection keys take a member in any case, or else the single member that matches once '_' and '-' are ignored, so legacy member spellings (ARM_64 for ARM64), which the engine only knows as hidden aliases, still work; the CLI sends the canonical name. Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
The Go SDK computes the schema names of a module's own types, fields and arguments itself: in the introspection JSON it merges into the schema for self-call bindings, and in the queries of interface implementations. They must match the engine's or references break, so they now follow the same gate: engine/naming for modules at v1.0.0-0 and up (the schema version is the module's view), strcase before. References to core and dependency types resolve like the engine's depTypeReference fallback does. cmd/codegen can't import core, so moduleNamer (module_naming.go) mirrors core.Namer. Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
Go modules regenerate their bindings at every load, so a dependency module renamed by the new naming rules (daggerCli is daggerCLI, DaggerCli is DaggerCLI) would break their build on engine upgrade. Keep the old identifiers as deprecated aliases: wrapper methods, type aliases, option struct aliases, extra option struct fields and enum constants, also re-exported from internal/dagger. The schema hides the engine's aliases, so a module's old schema names are recovered by applying the legacy strcase namer to the current ones. Core declarations' names didn't change, so the core output is unchanged. This is the module-only part of the Go alias machinery (naming.go, FieldLegacyWrapper, LegacyFieldOptionsName, ...): the Go client codegen change that formats names through the engine extends it to core names. Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
ModuleNamingSuite covers a Go module at the current engine version (acronym types, fields and arguments keep their casing; references to JSONValue, LLMMessage and LLMTokenUsage resolve to the core types; legacy field, argument, type and enum member spellings are still accepted, in queries and in dagger call), the same module at v1.0.0 prereleases (new names) and before v1.0.0 (strcase names, byte for byte), a Python module naming its types like the Go one, and the CLI flag for an E2E-style argument under both. TestModuleEntrypointLegacyNameAliases covers a manifest v2 entrypoint, which is served at the engine's version, answering to its legacy names. Existing expectations follow the new names: comURL for a Python com_url argument, and the dagger functions table padded to experimental-with-all-gpus. Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
cmd/codegen's Go generator now imports engine/naming (moduleNamer), so generating the Go SDK client failed to build codegen without it. Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
Add the shared codegen side of identifier casing: introspection.FormatNames and Schema.LoadFormattedNames ask Query.formatIdentifiers to format every schema name, with the naming dictionary of the schema's own version, and keep the results on the schema for FormattedName. A schema without Query.formatIdentifiers formats nothing, so generators keep their legacy converters and older schemas generate the same code. - codegen connects to the engine whenever the schema it generates from has Query.formatIdentifiers. - `codegen introspect --names-out names.json --names SNAKE:UPPERCASE,...` writes the formatted names as a sidecar for SDK codegen that runs without an engine, and engine-dev gains IntrospectionNames to produce it. - cmd/codegen/internal/testnames formats names like the engine, for generator tests without one. - TestIdentifier/TestCodegenFormatNames covers the gate and the formatting against a live engine. Signed-off-by: Alex Suraci <[email protected]>
Go codegen now loads the schema's names formatted by the engine (PASCAL:UPPERCASE for types, methods, option fields and enum values, CAMEL:UPPERCASE for parameters) and uses them for every Go identifier. Schemas without Query.formatIdentifiers keep golint's initialisms and strcase exactly as before, so older engines and module views generate byte-identical code. Wire names never change. The module-only alias machinery from module naming now covers every identifier the engine's formatting renamed, core included: a renamed method keeps a deprecated wrapper, a renamed type or options struct a deprecated alias, and a renamed enum value a deprecated constant (Sha -> SHA, NetworkProtocolTcp -> NetworkProtocolTCP). moduleNamer now gates on Query.formatIdentifiers being in the schema, like the generators and module runtimes, instead of comparing the schema version against v1.0.0-0 itself. Signed-off-by: Alex Suraci <[email protected]>
Regenerate the Go client from a schema with Query.formatIdentifiers, so its identifiers follow engine/naming: Sha is SHA, ParentShas ParentSHAs, SshfsVolume SSHFSVolume, Workspace.Sdks SDKs, NetworkProtocolTcp NetworkProtocolTCP, ImageMediaTypesOcimediaTypes ImageMediaTypesOCIMediaTypes, and so on. Every old name stays as a deprecated alias, so existing code keeps compiling. Move the repo's own callers to the new names, since staticcheck flags the deprecated ones. Signed-off-by: Alex Suraci <[email protected]>
Add IntrospectionNames to the committed engine-dev bindings of the modules that depend on it (docs-dev, release, and the php, python and rust client toolchains), as their codegen would, so the SDK PRs that use it don't each have to touch them. Signed-off-by: Alex Suraci <[email protected]>
This was referenced Oct 14, 2026
vito
force-pushed
the
naming/4-module-naming
branch
from
October 14, 2026 23:28
d7ecd2b to
3c3a690
Compare
Contributor
Author
|
🤖 Closing: the in-repo SDKs are now legacy. The module-codegen naming work here (Go codegen via |
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Oct 22, 2026
When the schema being generated has Query.formatIdentifiers (engine API views from v1.0.0-beta.21), Go identifiers follow the engine's naming rules for the schema's version: PASCAL:UPPERCASE for types, methods, option fields and enum values, CAMEL:UPPERCASE for parameters (ShortSha -> ShortSHA, NetworkProtocolTcp -> NetworkProtocolTCP, SshfsVolume -> SSHFSVolume). A schema without the field keeps golint's initialisms and strcase byte for byte, whatever version it claims. Wire names never change. The names are formatted with the vendored rules rather than by asking the engine: the generators run without an engine connection. Ported from dagger/dagger#14673 (c7582fd) without its deprecated aliases for renamed identifiers. Names only change when a module or client declares beta.21 or later, so that is an opt-in, not an engine upgrade. 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.
Part 5a/N of the stack splitting #14501 (identifier casing). Plan: #14501 (comment)
Refs #13668
Stacked on #14669.
What it does
Go codegen names Go identifiers with the engine's
Query.formatIdentifiersinstead of golint's initialisms and strcase. Schemas without that field keep the old converters, so older engines and pre-v1 module views generate byte-identical code. Wire names (selected fields, argument names, enum values, GraphQL type names) never change.This PR has two parts. The first commit is shared
cmd/codegeninfrastructure, and the other SDK PRs (5b–5h) build on it.Shared codegen infrastructure (
941227d)cmd/codegen/introspection/names.go:Schema.HasFormatIdentifiersis the gate.Schema.Namescollects every type, field, argument, input field and enum value name, leaving out introspection names and names the engine can't parse (_).FormatNames/Schema.LoadFormattedNamesbatch the names throughformatIdentifierswith the schema's own__schemaVersiondictionary, andSchema.FormattedNamelooks them up.NameFormatis aCASING:ACRONYMSpair.Include/Excludekeep the loaded names.codegen introspect --names-out names.json --names SNAKE:UPPERCASE,PASCAL:CAPITALIZED: writes the formatted names as a sidecar, for SDK codegen that runs without an engine. A schema without the API gets{}.formatIdentifiers.engine-dev: a newIntrospectionNames(formats)function produces the sidecar. The committed engine-dev bindings of docs-dev, release and the php/python/rust client toolchains are updated in504b460.cmd/codegen/internal/testnames: formats names like the engine does, for generator tests that run without one.TestIdentifier/TestCodegenFormatNames(deferred from core: add formatIdentifiers naming API #14667) replacesTestViewsandTestFormatSchemaNames. It covers the gate on__schemaJSONFileand live introspection at current and v0.21.0, and formats every core name against engine/naming.Go
PASCAL:UPPERCASEfor types, methods, option struct fields and enum value suffixes.CAMEL:UPPERCASEfor parameters.generateCodeandGenerateModule, before anything formats a name.legacyMethodName,FieldLegacyWrapper,InterfaceClientLegacyWrapper,LegacyFieldOptionsName, legacy enum constants) now covers every identifier whose Go spelling changed:UnmarshalJSONcases keep the legacy deduplication, so no wire name loses its case.moduleNamergate: it now checks forQuery.formatIdentifiersin the schema, the same gate the generators and runtimes use, instead of comparing the schema version againstv1.0.0-0.sdk/go. The repo's own callers move to the new names, because staticcheck flags the deprecated ones.Changes for Go users
No hard breaks. Every renamed identifier keeps its old name as a
// Deprecated:alias. Code that uses the old names keeps compiling, but staticcheck/SA1019will warn. The renames in the core client:GitCommit.Sha,ShortSha,ParentShasSHA,ShortSHA,ParentSHAsGitBundleRef.Sha,GitPushResult.ShaSHAGeneratedCode.VcsGeneratedPaths,VcsIgnoredPathsVCSGeneratedPaths,VCSIgnoredPathsWorkspace.SdksSDKsSshfsVolume,SshfsVolumeOptsSSHFSVolume,SSHFSVolumeOptsNetworkProtocolTcp/UdpNetworkProtocolTCP/UDPRegistryProtocolHttp/HttpsRegistryProtocolHTTP/HTTPSImageLayerCompressionEstarGzImageLayerCompressionEStarGZImageMediaTypesOcimediaTypes/OciImageMediaTypesOCIMediaTypes/OCIParameter names change too (
callId→callID), which doesn't affect callers. Go modules get the same treatment at codegen time when their schema hasformatIdentifiers(engine v1 views).Not in it
callID,pushURL,shortSHA, ...), and with them the old-schema-names table (cmd/codegen/introspection/renamed.go) and its uses inlegacyFieldSchemaName/legacyArgSchemaName. Core legacy names here come only from Go formatting changes.dagger.gen.go: not regenerated (decision 22).go-sdk/generate/stalewas not run.Testing
go build ./...,go vet(main module,sdk/go, the touched toolchain modules)go test ./cmd/codegen/...:moduleNamergategolangci-lint/lint-all,go-client/generate/stale,go-client/testTestIdentifierTestModuleNamingTestModule/TestModuleEntrypointLegacyNameAliasesTestGoTestModule/(TestModuleEnum*|TestSelfCalls*|TestUseLocalDependency*|TestModuleDeprecation*)TestGit/(TestGitCommit|TestGitLog|TestGitBundlePreservesAnnotatedTag)TestContainer/(TestMediaTypes|TestForceCompression)TestVolume/TestSSHFS*