Repository navigation
core: add formatIdentifiers naming API - #14667
Merged
Merged
Conversation
This was referenced Oct 14, 2026
This was referenced Oct 14, 2026
vito
marked this pull request as ready for review
October 14, 2026 14:44
sipsma
approved these changes
Oct 14, 2026
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]>
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]>
vito
force-pushed
the
naming/2-identifier-api
branch
from
October 14, 2026 23:28
90158af to
0aa9651
Compare
engine/naming now orders a suffix as digits then a plural "s" (HTTP+"2s"), so describe IdentifierWord.suffix that way, and regenerate the schema snapshot and the SDK clients that carry the description. engine/naming also rejects names over 256 bytes; cover that error in the API's error tests, for Query.identifier and Query.formatIdentifiers. Signed-off-by: Alex Suraci <[email protected]>
Query.identifier listed its errors as non-ASCII input and input with no letters or digits; it now also rejects names over 256 bytes. Say so, in the API, the design doc's schema sketch, and the regenerated schema snapshot and SDK clients. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Oct 22, 2026
Released beta.19 and beta.20 engines already serve Query.formatIdentifiers on v1 views (dagger/dagger#14667 shipped in beta.20) but still name modules with strcase, and their __schemaVersion ("v1.0.0") compares past the cut, so neither tells them apart from beta.21. The SDK registry resolves this SDK to @main, so those engines run this codegen. Engine naming now needs both: the schema has formatIdentifiers AND the engine's own version (Query.version, build metadata ignored, dev builds as their release) is v1.0.0-beta.21 or later. Codegen is engine-free, so the Dang layer reads `version` in its session and passes --engine-version to codegen module, client, entrypoint (both modes), and the packager's library step. An empty or unparseable version keeps the legacy names. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Oct 22, 2026
Released v1.0.0-beta.19 and v1.0.0-beta.20 engines already serve Query.formatIdentifiers at every v1.0.0 view (dagger/dagger#14667), but still name modules with strcase, and report each of those views as v1.0.0, so neither the field nor the schema version can tell them apart. Since the SDK registry resolves the SDK at main, old engines run this codegen. Identifiers now follow the engine's rules only when the schema has formatIdentifiers and the engine that served it (Query.version, without build metadata, dev builds as their release) is v1.0.0-beta.21 or later; an unknown engine keeps the legacy names. The generators run without an engine, so go-sdk.dang passes Dagger.version as --engine-version to module-codegen and the client generator; the core generator queries its engine. This replaces the schema-version check and NamingVersion. The source-link catalog now names declarations with the generator's own configuration, so it no longer drifts from the generated code, and unified clients keep core's legacy names without a special configuration. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Oct 28, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Oct 28, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Oct 28, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Oct 29, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Oct 29, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 2, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
#14669 moved Query.identifier, formatIdentifiers, namingDictionary and their types to the views that name modules by engine/naming (beta.21+), so SDK codegen could gate on the field's presence. SDKs will instead gate on the version the target module declares plus the engine's version, and call formatIdentifiers themselves from their generator execs, which may run at a pre-cut view. So restore the visibility #14667 shipped: from v1.0.0-0 on. formatIdentifiers' version argument still selects the dictionary, and module naming keeps its own gate (core.IdentifierNamingView, beta.21). Refs #13668 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 2/N of the stack splitting #14501 (identifier casing). Plan: #14501 (comment)
Refs #13668
Stacked on #14659, now merged; this PR targets main.
What's in it
@experimental, served at v1.0.0 views only, prereleases included):Query.identifier(name): parse a name in any casing intoIdentifier { name, words, format(casing, acronyms) }, withIdentifierWord { text, suffix, kind, term }.Query.formatIdentifiers(names, casing, acronyms, version): format many names at once and return plain strings in input order. This is the call SDK codegen will use.versionpicks the naming dictionary of the schema being generated, and defaults to the caller's. It'sDoNotCache: formatting ~960 names takes about a millisecond, but publishing a result with a list argument that big to the cache took over 200 ms.Query.namingDictionary: the acronyms and terms (NamingTerm { spelling, capitalized }) of the caller's dictionary.Casing,AcronymStyleandIdentifierWordKind.dagql: render leaf list elements directly, cherry-picked from Centralize identifier casing in the engine and SDKs #14501): a list of plain values whose elements are query leaves is now rendered straight from the list. Before, each element got its own result: a deep copy of the list's call frame, plus a cache entry per element when the list was cached. That cost grows quadratically with a large list argument, and a ~1000-nameformatIdentifierscall took ~780 ms instead of ~11 ms.No behaviour change for existing names
This PR adds API and renames nothing.
core.IdentifierNamingVersion(v1.0.0-0) andcore.CallerViewsit incore/gqlformat.go, where the final tree has them, but here they only gate and parameterize the new API. Module naming (core.Namer) comes later in the stack.Left for later PRs: hidden transition aliases (PR 3), engine module naming (PR 4), SDK codegen that uses
formatIdentifiers(PRs 5x), and core renames (PR 6).Release ordering
This should ship in an engine release, together with PR 3 (hidden aliases), before the rest of the stack. The external SDK ports can start once that release is out. SDK codegen only formats names through the engine when the schema it generates from has
Query.formatIdentifiers, and otherwise falls back to its old converter.Testing
go build,go vet;go test ./dagql/... ./core/schema/ ./engine/naming/..., plus the persisted-metadata tests in./coreTestLeafListElements(dagql): leaf list elements render correctly, nulls included, and add no cache entriesTestFormatIdentifiersVersion(core/schema): theversionargumentTestIdentifierintegration suite: words, format,formatIdentifiers, errors (non-ASCII, no letters or digits, over 256 bytes), the dictionary, v0.21.0 clients not seeing the API, and every core schema name formatting the same way asengine/naminggolangci-lint/lint-allAPI changes
go -C hack/sdl-diff run . 4e1042289bc6ed9fe44b440703fe49d379c285ec:docs/docs-graphql/schema.graphqls 0aa86018c35403febf5ebabe7ef72653f7b260d2:docs/docs-graphql/schema.graphqlsDetailed diff