Repository navigation
Conversation
dagger-codegen takes the schema's names as the engine formats them (a names file from `codegen introspect --names-out`, with PASCAL:CAPITALIZED for types and enum variants and SNAKE:UPPERCASE for functions, arguments and fields), so acronyms and dictionary terms stay whole: `prerequisiteSHAs` becomes `prerequisite_shas`, not `prerequisite_sh_as`. - `dagger-bootstrap generate --names <file>` passes the names file in. - A schema without Query.formatIdentifiers, an empty names file, or a name missing from it keeps the convert_case converter, so older schemas generate the same code. - Methods and options structs whose Rust name changed keep their old name as a #[deprecated] alias; input object fields keep their old serde wire name. Signed-off-by: Alex Suraci <[email protected]>
Generate the Rust client with the names file from EngineDev.introspectionNames, in the formats Rust codegen uses. Signed-off-by: Alex Suraci <[email protected]>
experimental_with_all_gp_us and prerequisite_sh_as become experimental_with_all_gpus and prerequisite_shas; the old names stay as deprecated aliases. Signed-off-by: Alex Suraci <[email protected]>
This was referenced Oct 14, 2026
Contributor
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Contributor
|
This PR was closed because it has been stalled for 7 days with no activity. |
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 5d/N of the stack splitting #14501 (identifier casing): the Rust SDK. Plan: #14501 (comment)
Refs #13668
Stacked on #14673 (shared
cmd/codegeninfra:codegen introspect --names-out,EngineDev.introspectionNames).What it does
Rust codegen stops guessing word boundaries with
convert_caseand uses the names the engine formats withQuery.formatIdentifiers. Acronyms and dictionary terms stay whole:Container.experimentalWithAllGPUsexperimental_with_all_gp_usexperimental_with_all_gpusGitBundle.prerequisiteSHAsprerequisite_sh_asprerequisite_shasJSONValue,LLMTokenUsageJsonValue,LlmTokenUsageTypes and enum variants use
PASCAL:CAPITALIZED, which matches whatconvert_casealready produced for every core type and enum value. Functions, arguments and fields useSNAKE:UPPERCASE. So the regenerated core client changes only the two methods above.How
codegen introspect --names-outwrites (codegen: name Go identifiers via formatIdentifiers #14673).dagger-bootstrap generate <introspection.json> --names <names.json>passes it in.rust-client-devproduces it withEngineDev.introspectionNames(["PASCAL:CAPITALIZED", "SNAKE:UPPERCASE"]).Query.formatIdentifiers(older engines, pre-v1 views), a missing--names, or a name missing from the file all fall back to theconvert_caseconverter. Older schemas generate byte-identical code (dagger-codegen/src/naming.rs).#[deprecated(note = "use …")]method that forwards to the new one (with an_optsvariant where there is one). When an options struct's name changes, the old name stays as a#[deprecated]type alias.#[serde(rename)]to the schema value, and input object fields whose Rust name changes get a#[serde(rename)]that keeps the wire name they had before.Breaking changes (for maintainers to decide)
dagger-sdkusers: nothing breaks at compile time.experimental_with_all_gp_usandprerequisite_sh_asstill work, but now emit deprecation warnings, which fail builds that use#![deny(warnings)]. Proposed: keep the aliases through 1.0.Not covered by aliases (no current instances): types and enum variants whose Pascal name changes would get no alias. A type alias works for structs, but enum variants can't be aliased. No core type or enum value changes today, but a later dictionary addition could change one.
dagger-codegencrate (published): its public API changes:RustGeneratorgains anamesfield, so theRustGenerator {}literal no longer compiles. UseRustGenerator::default()orRustGenerator::with_names(..)instead.FormatTypeFuncis no longer a unit struct. UseFormatTypeFunc::new(names).templates::*::render_*functions take&CommonFunctions.enum_tmpl::format_nameis removed.Only
dagger-bootstrapis known to use these.Not in it
callID,shortSHA,parentSHAs,filterURI, …) and the Rust "old schema names" table that keeps those methods' Rust names (RENAMED_CORE_FIELDSin the final tree) are left to PR 6. This PR's generator doesn't need it, because those fields still have their old schema names here.engineVersionbump or runtime-side name formatting.Testing
rust-client/test, which runs the newdagger-codegentests:formatIdentifiersor without names.rust-client/cargo-checkandrust-client/cargo-fmt.rust-client/apiclient/stale:gen.rswas regenerated against a dev engine built from this branch.