Repository navigation
Name identifiers through the engine - #72
Merged
Merged
Conversation
vito
force-pushed
the
format-identifiers
branch
5 times, most recently
from
November 4, 2026 20:59
ba59016 to
b9994f7
Compare
eunomie
force-pushed
the
format-identifiers
branch
from
November 5, 2026 13:48
b9994f7 to
917b459
Compare
vito
force-pushed
the
format-identifiers
branch
from
November 6, 2026 17:59
997b0a6 to
154cbf9
Compare
A call through one of the module's own interfaces binds its arguments by their Python names, but looked their schema names up by the API name, so an argument renamed with Name() or a trailing underscore (from_) failed with a KeyError. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
Calls through the module's own interfaces select the schema names the engine gave the module's declarations, which the runtime used to guess: the main class's name followed by the interface's, function and argument names camelCased by snake_to_camel, and the module's enum members by their Python names. The engine names them by the rules of the version it names the module by, so the guesses were wrong past the identifier casing cut (NamingAppHTTPFetcher, ARM64) and before it too (strcase writes e2e_test e2ETest, arm64 ARM_64, FooHTTPClient FooHttpclient). Now the runtime asks: one CurrentModule.naming query per call, before anything is invoked, for the interfaces' type names, their functions' and arguments' names, and the members of the module's enums. A module without interfaces asks nothing. A name the engine wasn't asked about, or can't name, fails the call. Own enum members go over the wire by the engine's names and come back by them. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The generator spelled Python names with a converter of its own: acronym runs title-cased, then graphql-core's camel_to_snake, which cuts experimentalWithAllGPUs into experimental_with_all_gp_us. The engine knows where its names' words are, so it spells them now: formatIdentifiers(casing: SNAKE) at the schema's version, asked once up front for every type, field, argument and input field name of the schema, and directly for any other name the generator styles (a name a deprecation notice refers to). A name the engine can't format fails the generation. No converter is kept, so schemas before the identifier casing cut get the engine's spelling too (experimental_with_all_gpus): an intended break of 1.0. The generator reaches the engine as a nested client of the session, with the standard library's HTTP client, so the codegen execs run with experimentalPrivilegedNesting. The keyword and builtin suffix stays the SDK's. The unit tests style made-up schemas with a stand-in, since they run no engine; the e2e checks generate with one. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
Generation asks the engine how to spell the schema's Python names (formatIdentifiers) and a module asks it what it named its own declarations (CurrentModule.naming). v1.0.0-beta.26, the floor dagger-module.toml already declares, is the first release that answers both. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
naming-check generates naming-app, a static entrypoint module with an own interface and enum whose schema names differ between the legacy rules and the engine's identifier naming rules, without a dang.toml (named by v1.0.0-beta.20) and with one pinning v1.0.0-beta.22. It generates naming-caller with a client of it, checks the Python names generation wrote and the names the client has for naming-app's declarations, and runs naming-caller's check, which calls naming-app through its client so that naming-app's runtime calls its own interface by the names the engine gave it. The caller is a second module, as a module calls itself through a client of its own. The interface takes no own enum: the engine refuses an own interface whose function takes one in the module's own session, so the module could not load its schema at all. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The runtime picked the main class by a strcase port, in Dang, of the engine's builtin Python runtime: DAGGER_MAIN_OBJECT, the module's name converted with strcase.ToCamel. Which class is the main object is the engine's to say, by the naming rules it names the module by, so the runtime asks it (ModuleNaming.mainObject), with every object type the module's code registers as a candidate, in the query that asks for its interfaces' names: one query per call. A module the engine names no main object for fails to load, saying which classes it had. The module is the one the runtime runs in (CurrentModule.naming), except when generation renders a module's static entrypoint, which runs in the SDK's own module: mod.dang hands the renderer, as a nested client, the ID of the module source the engine will name (ModuleSource.naming). It is asked from Python so that this module, which an engine before the floor still loads in order to refuse it, names no field such an engine lacks. The code is imported as the default package, or through a configured entry point, without a class name to import. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
A client's schema was read with withEngineVersion(view), which makes the module declare the scope's version, and since the identifier casing cut that also names its declarations by that version's rules: the client of a module the engine names by v1.0.0-beta.22 had NamingAppHttpFetcher where the engine serves NamingAppHTTPFetcher. clientSchemaIntrospectionJson's clientVersion describes core at the scope's view and leaves the module at the version it declares. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
A new module's main class was named with strcase.ToCamel of the module's name, a casing converter of the SDK's own. The engine spells it now (formatIdentifiers, PASCAL), asked by the template renderer as a nested client: k8s-tools is K8sTools, as the engine's naming rules name it. The unused ModuleImport (strcase.ToKebab) and mod._utils.to_pascal_case go too. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The query builder derived an input field's GraphQL name from its Python name with snake_to_camel, and the generator recorded only the names that conversion missed. Python names are the engine's spelling now, so nothing converts them back: the generator records every field's GraphQL name and the query builder sends that one, refusing a field without one. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The runtime declares engineVersion v1.0.0-beta.26, as the SDK already does, and both declare it in dang.toml, which decides a Dang module's version. The SDK's own engine refusal and its check go: no engine that loads the SDK is below the floor. engineFloor becomes targetFloor, the oldest release a targetVersion pin may name, and moves to v1.0.0-beta.26: the generated entrypoint needs ModuleNaming, which an older view does not serve. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The Python runtime asked the engine for the main object itself, which only an SDK new enough to ask could do: a module vendoring an older SDK reads DAGGER_MAIN_OBJECT and found it unset. The build sets it again, for every SDK version, from ModuleNaming.mainObject over the classes the module's source decorates with @object_type, which a short ast script lists without importing the module. The build fails when the engine takes none of them. The naming is the module's: the runtime's modSource.naming, the entrypoints' currentModule.naming, and at generation the naming of the source generation writes, through the runtime's new installed function. The Python side goes back to asking only for its interfaces' names, and generation no longer hands the renderer a module source ID. The e2e module declares engineVersion v1.0.0-beta.26: a released engine hides ModuleNaming, which the runtime's functions now take, from a module that declares an older version. At that version it reads clientSchemaIntrospectionJSON as clientSchemaIntrospectionJson. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
- The code generator reaches its session without a proxy: urllib honored the HTTP_PROXY an exec inherits, and a non-JSON error reply escaped as a traceback. - The main object scan skips a file this Python can't parse, which the module may never import. - experimentalPrivilegedNesting goes from the execs that reach the session: nesting is the default of the v1 API, which ignores the flag. - The generated entrypoint's header names the beta.22 floor, and the README says which rules name a module's own declarations. - A comment no longer points at the deleted engine refusal. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The template named a new module's class with formatIdentifiers, which spells by the newest rules whatever the version. A new module has no dang.toml, so the engine names it by v1.0.0-beta.20's legacy rules, and takes HTTPServer, the class of `http-server`, for no main object: the module did not load. Generation now asks the engine how it will name the module (ModuleNaming.typeNames of the module name), of the manifest it writes, before the template renders, and hands the name to render-template. init-naming-check generates http-server without a version and pinned past the cut, and loads it. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The shared entrypoint and the runtime name a new module by its manifest alone, a path of generation's main class naming that no other init check took. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
The engine, from dagger/dagger 9e25570 on, names a module's main object pre-cut by what typeNames answers, so init-naming-check now takes k8s-tools and e2e-test, which strcase spells differently on a second read, on both sides of the cut. Interface members are named once there, so the naming check's note about the legacy double normalization goes. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
Beta.22 to beta.25 ship without the naming APIs. Move the entrypoint header, goldens and e2e naming pins to beta.26, and document beta.25 as the unpinned entrypoint fallback. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
dagger#14996 moved formatIdentifiers under Query.naming(version:), so the
generator now asks naming(version: $v) { formatIdentifiers(...) }, or naming
without a version where it passed none.
Signed-off-by: Alex Suraci <alex@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
eunomie
force-pushed
the
format-identifiers
branch
from
November 18, 2026 09:13
154cbf9 to
f7f2908
Compare
Integrate the naming port with generated dang.toml and targetVersion. Stage the final manifest and config before main-class selection and entrypoint rendering, while retaining a runtime staging source for the build. Exercise new configs, the released target, a pin at the beta.26 floor and owned-config upgrades without resurrecting removed shared settings. Signed-off-by: Alex Suraci <alex@dagger.io> Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
eunomie
force-pushed
the
format-identifiers
branch
from
November 18, 2026 09:28
f7f2908 to
2b1b950
Compare
eunomie
marked this pull request as ready for review
November 18, 2026 10:33
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.
What
The Python SDK names identifiers the way the engine does, by asking it, with no casing converters of its own. Follows dagger/go-sdk#90 and dagger/typescript-sdk#120. Supersedes #62.
naming(version:) { formatIdentifiers(casing: SNAKE) }at the schema's version: one call up front for every name in the schema, then a direct call for any name not in that map. No converter is kept, even for schemas before the cut:experimental_with_all_gp_usbecomingexperimental_with_all_gpusis an intended 1.0 break. The codegen execs reach the session as nested clients.CurrentModule.naming(core: add ModuleSource.naming for SDK codegen dagger#14996), once per call, for the names of its own interfaces, their functions and arguments, and its enum members. Those are the names that calls through its own interfaces select. No prediction mirror is kept.DAGGER_MAIN_OBJECT, for every SDK version a module vendors, fromModuleNaming.mainObjectover the classes its source decorates with@object_type. A shortastscript lists those classes without importing the module. The build fails when the engine takes none of them. The naming used ismodSource.namingin the runtime,currentModule.namingin the generated entrypoint, and at generation the naming of the source generation writes (the runtime's newinstalledfunction). The final generated config and manifest are staged before main-class selection and entrypoint rendering, including direct generation. No naming ID crosses into the Python exec. The strcasemainObjectNameis gone.dagger module initnames a new module's class withModuleNaming.typeNamesof the module as generation writes it, sohttp-servergetsHTTPServer.clientSchemaIntrospectionJson(clientVersion:).withEngineVersionrenamed a module's own declarations: a pinned module's client saidNamingAppHttpFetcherwhere the engine servesNamingAppHTTPFetcher.from_or aName()override raisedKeyError.packageNameForinruntime/build.dang,packageNamein render-template,partition.package_namein codegen). These are Python package names, not schema identifiers.Pin range decision
v1.0.0-beta.26, the first release that answersformatIdentifiers,CurrentModule.namingandModuleNaming. It is declared, not checked:engineVersionin the SDK's, the runtime's and the e2e module's manifests, and[imports.Dagger] daggerin the SDK's and the runtime'sdang.toml. The SDK's own engine refusal (engineRefusal,checkEngine) andengine-floor-refusal-checkare removed. An engine fromv1.0.0-beta.18tov1.0.0-beta.25fails while it loads the SDK, before generation writes anything. Users on those engines pinv1.8.0; users onv1.0.0-beta.14tov1.0.0-beta.17pinv1.1.1.v1.0.0-beta.26or later to run, like generation: it hands the buildcurrentModule.naming. Its header says so.targetVersionmay namev1.0.0-beta.26tov1.0.0-beta.27; main allowsv1.0.0-beta.18and later. A released engine servesModuleNamingonly to a module that declaresv1.0.0-beta.26or later (AfterVersion("v1.0.0-beta.26")in dagger/daggercore/schema/modulenaming.go). A pinned module'sdang.tomldeclares its pin, so a module pinned belowv1.0.0-beta.26could not load its generated entrypoint.targetFloorinpython-sdk.dang(formerlyengineFloor) is nowv1.0.0-beta.26. Generation refuses a lower pin before it writes anything;target-version-checkcovers that withv1.0.0-beta.25.v1.0.0-beta.27. Both allowed releases are past the identifier casing cut, so modules and their clients get the new names (HTTPServer,NamingAppHTTPFetcher,ARM64). On av1.0.0-beta.27engine, core reads the same in both views: no field is gated onv1.0.0-beta.27.v1.0.0-beta.26so that it can load the SDK and the runtime, whose functions take aModuleNaming. At that version it readsModuleSource.clientSchemaIntrospectionJson.Testing
On the released
v1.0.0-beta.27engine and CLI:cd sdk && uv run --frozen pytest -q -m "not slow": 581 passed.dagger check -m .dagger/modules/e2e <check>, one at a time, all pass:init-naming-check,naming-check,dang-config-check,target-version-check,target-version-cli-check,generate-scope-pins-check,generate-scope-stale-target-check,generate-scope-view-check,generate-scope-init-check,runtime-call-check,sdk-test-check,remote-entrypoint-replaced-check,resources-generate-check,static-scope-init-check,generate-scope-clients-check,generate-scope-existing-check,entrypoint-client-call-check,root-init-ignores-check,client-target-manifest-check,collections-check,collection-kinds-check,collections-client-check,cli-sdk-check.cli-sdk-checkexpectsclass SDKSettings:for a module namedsdk-settings, as the engine names it past the identifier casing cut; main expectsSdkSettings.Several checks finished in seconds, so cached steps cannot be ruled out.
Before merge
dagger checkpasses onv1.0.0-beta.27.Known limitations
runtime/build.dangscans only decorators literally namedobject_type, so an aliased decorator (from dagger import object_type as obj) fails main-object selection.sdk/src/dagger/client/gen.pyhas no_graphql_names, so serializing an input such asBuildArgraises until it is regenerated on the floor engine.Engine issues (not worked around)
core/interface.go:369). Enum conversion through interfaces is covered by unit tests only.Naming.formatIdentifiersstyles with the engine's rules on both sides of the cut: every v1 prerelease shares one naming dictionary, soversion:doesn't bring back the old rules. Sodagger module initnames a new module's class withtypeNamesof the module as generation writes it.If the floor moves
dagger-module.toml,dang.toml,runtime/dagger-module.toml,runtime/dang.toml,.dagger/modules/e2e/dagger.json.targetFloorinpython-sdk.dang,floorVersionin.dagger/modules/e2e/main.dang.sdk/src/dagger/mod/_entrypoint.py: the generated entrypoint's header, and the goldens undersdk/tests/mod/golden/.README.md,docs/collections.md, and cut comments inpython-sdk.dangandsdk/tests/mod/test_naming.py.