Skip to content

core: add clientVersion to client schemas - #14959

Merged
vito merged 9 commits into
naming/single-dang-sdkfrom
naming/client-version-arg
Nov 5, 2026
Merged

vito merged 9 commits into
naming/single-dang-sdkfrom
naming/client-version-arg

Conversation

@vito

@vito vito commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds clientVersion to dependency-client schema introspection, so SDKs can select the consumer's core API view without changing the dependency's declared version or names. Refs #13668.

Why

Dependency clients need two versions to remain distinct:

  • The dependency's declared version determines its module names.
  • The consumer's version determines the core API its generated client should use.

Using source.withEngineVersion(consumerVersion) before introspection changes both. For example, a pre-cut dependency served as BeforeHttpClient can be described as BeforeHTTPClient when overridden to the beta.26 view. The generated client then selects names the dependency does not expose. The reverse mismatch occurs for a post-cut dependency and pre-cut consumer.

API

extend type ModuleSource {
  clientSchemaIntrospectionJson(clientVersion: String = ""): File!
}

Pre-cut callers use the existing clientSchemaIntrospectionJSON spelling; the argument is available on both view-gated spellings.

  • clientVersion selects core's view, using declared-version normalization and capping it at the engine's view. latest selects the engine version.
  • The dependency is loaded at its own declared version and keeps its own naming rules.
  • Omitting the argument or passing "" uses the dependency's version, preserving the previous default—not the calling client's version.

withEngineVersion still changes the dependency's declared version, including its names. SDK generation should use source.clientSchemaIntrospectionJSON(clientVersion: v) instead of overriding the source solely to select core's view. SDK call-site changes belong in their own repositories.

Version normalization

This argument follows the existing declared-engine-version rules. An unrecognized non-semver value is not newly rejected; it uses the existing v0.11.9 compatibility fallback. This PR does not introduce a different validation policy for client versions.

Validation

Existing TestModuleNaming/TestClientSchemaVersion exercises both sides of engine.IdentifierCasingVersion (currently beta.26):

  • A pre-cut dependency with a post-cut client schema: core exposes File.asJson, while the module remains BeforeHttpClient.
  • A post-cut dependency with a pre-cut client schema: core exposes asJSON, while the module remains AfterHTTPClient.
  • Omitted arguments preserve each dependency's own version.
  • A comparison using withEngineVersion demonstrates why overriding the dependency produces different module names.
  • Real beta.20 and beta.25 callers invoke the legacy field spelling with explicit and omitted clientVersion. The test verifies the caller's actual schema version and the public nullable String argument with its "" default.

All six integration rows passed on a source-built engine. Ignoring clientVersion made the new beta.20 caller case fail on the returned schema version; restoring the resolver passed again. The redundant registration/default unit was removed because those assertions now run through public integration paths. TestTypeDefNamingCacheIdentity also passed; focused review found nothing to fix.

Earlier validation also passed TestGenerators/TestClientSchemaIntrospectionJSON; the SDL and six in-repo SDK clients were regenerated. The beta.26 restack checked build/vet (with pre-existing lostcancel warnings disabled) and schema regeneration. These latter results are historical, not a claim of a fresh full-suite run.

API changes

go -C hack/sdl-diff run . aa85b3d92685835af7e516378673514e43742b7b:docs/docs-graphql/schema.graphqls c7dd6e602e731e793522f5c977d168715f8614aa:docs/docs-graphql/schema.graphqls

extend type ModuleSource {
  # Changed: previously clientSchemaIntrospectionJson: File!
  """
  The client-facing introspection schema JSON file for this module source.

  This is the schema consumed by client codegen: unlike introspectionSchemaJson
  (the module-facing schema), it hides no core types and installs this module
  (reached via dag.<moduleName>) so a generated client can bind it. The module's
  dependencies are excluded: a client is generated for a single module plus
  core, not its dependency graph.
  """
  clientSchemaIntrospectionJson(
    """
    The engine version of the client the schema is generated for, e.g. the
    engineVersion of the module that depends on this one: core is described as
    that client sees it, capped at this engine's version.
    
    This module is still loaded at the engine version it declares, and so named
    by its own naming rules, as the engine serves it to such a client. Defaults
    to this module's own engine version.
    
    Use this rather than withEngineVersion, which makes this module declare another version and so changes its names.
    """
    clientVersion: String = ""
  ): File!
}
Detailed diff
 extend type ModuleSource {
   """
   The client-facing introspection schema JSON file for this module source.
   
   This is the schema consumed by client codegen: unlike introspectionSchemaJson
   (the module-facing schema), it hides no core types and installs this module
   (reached via dag.<moduleName>) so a generated client can bind it. The module's
   dependencies are excluded: a client is generated for a single module plus
   core, not its dependency graph.
   """
-  clientSchemaIntrospectionJson: File!
+  clientSchemaIntrospectionJson(
+    """
+    The engine version of the client the schema is generated for, e.g. the
+    engineVersion of the module that depends on this one: core is described as
+    that client sees it, capped at this engine's version.
+    
+    This module is still loaded at the engine version it declares, and so named
+    by its own naming rules, as the engine serves it to such a client. Defaults
+    to this module's own engine version.
+    
+    Use this rather than withEngineVersion, which makes this module declare another version and so changes its names.
+    """
+    clientVersion: String = ""
+  ): File!
 }

vito added a commit that referenced this pull request Oct 29, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito added this pull request to stack #14901 October 29, 2026 16:57
@vito
vito marked this pull request as ready for review October 29, 2026 17:14
@vito
vito requested review from a team as code owners October 29, 2026 17:14
vito added a commit that referenced this pull request Oct 29, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch 2 times, most recently from 6d9ced1 to 441d95c Compare October 29, 2026 19:11
@vito
vito requested a review from a team as a code owner October 29, 2026 19:11
vito added a commit that referenced this pull request Oct 29, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from 441d95c to 168f78a Compare October 29, 2026 22:07
vito added a commit that referenced this pull request Nov 2, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from 168f78a to 20b139e Compare November 2, 2026 15:58
vito added a commit that referenced this pull request Nov 4, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from 20b139e to b309a67 Compare November 4, 2026 16:29
vito added a commit that referenced this pull request Nov 4, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from b309a67 to 0c0f1c3 Compare November 4, 2026 18:57
vito added a commit that referenced this pull request Nov 4, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from 987c7da to 9fc5c1f Compare November 5, 2026 00:06
vito added a commit that referenced this pull request Nov 5, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from 9fc5c1f to 48b81ef Compare November 5, 2026 00:15
vito added a commit that referenced this pull request Nov 5, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from 48b81ef to c7dd6e6 Compare November 5, 2026 03:40
vito added 9 commits November 5, 2026 11:28
SDKs generate a dependency's client from
ModuleSource.clientSchemaIntrospectionJSON, and pick the core view they need
with withEngineVersion(<their client's version>). Since modules are named by
the engine version they declare, that override also renames the dependency:
one that declares v1.0.0-beta.20 got a client with the new spellings while the
engine serves it with the old ones, and the reverse across the cut.

clientSchemaIntrospectionJSON(clientVersion:) describes core at the view of
that client's engine version, capped at the engine's, and loads the module at
the version it declares, the way the engine serves a dependency to a
consumer. It defaults to the module's own version, so existing callers are
unchanged, and is in every view since the SDK modules calling it are pinned
pre-cut. withEngineVersion keeps meaning "this module now declares another
version".

Signed-off-by: Alex Suraci <[email protected]>
A beta.20 and a beta.22 Dang module: clientVersion describes core at the
client's view and keeps each module's own names; the default is the module's
own version; withEngineVersion still renames the module.

Signed-off-by: Alex Suraci <[email protected]>
Regenerate the API reference schema and the in-repo SDK clients for
ModuleSource.clientSchemaIntrospectionJSON(clientVersion:).

Signed-off-by: Alex Suraci <[email protected]>
The PR number is filled in once the PR is open.

Signed-off-by: Alex Suraci <[email protected]>
The identifier-casing design listed a version argument for client schemas as
an open follow-up; it now names clientVersion, and leaves the SDKs switching
to it as not done. Two other design docs pointed at the removed
loadDefaultSchemaBuilder.

Signed-off-by: Alex Suraci <[email protected]>
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
With the identifier casing cut at v1.0.0-beta.25, v1.0.0-beta.24 is the
last release before it, with a view of its own: check that it still has
clientSchemaIntrospectionJSON's old spelling and its clientVersion argument.

Signed-off-by: Alex Suraci <[email protected]>
Keep the explicit last-pre-cut clientVersion case current while preserving
the existing beta.20 fixture.

Signed-off-by: Alex Suraci <[email protected]>
Check clientVersion through the public API from beta.20 and beta.25 callers,
including the legacy spelling, independent consumer view, and omitted default.
Assert the caller view and optional argument metadata through introspection,
replacing the redundant schema registration unit while retaining mixed-version
module naming and withEngineVersion comparisons.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from c7dd6e6 to bc29b4f Compare November 5, 2026 16:28
vito added a commit that referenced this pull request Nov 5, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from bc29b4f to de20bfa Compare November 5, 2026 17:37
vito added a commit that referenced this pull request Nov 5, 2026
Fill in the PR number of the clientVersion fragment.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the naming/client-version-arg branch from de20bfa to be19105 Compare November 5, 2026 20:07
@vito
vito force-pushed the naming/client-version-arg branch from be19105 to 963e22a Compare November 5, 2026 20:56
@vito
vito merged commit 7e9eaac into main Nov 5, 2026
95 checks passed
@vito
vito deleted the naming/client-version-arg branch November 5, 2026 21:43
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.

2 participants