Repository navigation
fix(native-dart)!: one shared AuthActionInput for every Auth block - #1599
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: f4c0b58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 17, 2026 17:42 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 18, 2026 00:19 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 18, 2026 00:19 — with
GitHub Actions
Inactive
ekjotmultani
temporarily deployed
to
agent-bench
November 18, 2026 00:55 — with
GitHub Actions
Inactive
An inline oneOf for a union declared as a type alias now carries x-blocks-type-name with the alias name, so native codegen can name the union after it. The union stays inline; generators that don't read the key are unaffected.
Codegen names a param union after its x-blocks-type-name, so every Auth namespace's setAuthState input is AuthActionInput instead of the first namespace's <Ns>SetAuthStateInput. Adding a second Auth block no longer renames the input. The old name stays as a deprecated typedef. When another type already has the name, the union keeps the old name. Refreshes fixtures 18 and 23 from the live Auth block, adds fixture 44 with two Auth namespaces, and regenerates the Dart, Swift and Kotlin goldens. With the hint in the spec, Swift now declares the shared AuthActionInput for fixtures 18 and 44, and its codegen tests that read fixture 18 expect it. The example's sign-up e2e uses AuthActionInput, and the sink-guard allowlist entry for the toString literal moves with its line.
2 of 3 tasks
A generic alias's symbol is the generic, so Result<string> and Result<number>, and TS utility types such as Partial<Action>, all got the generic's name in x-blocks-type-name. Write the key only for a non-generic alias.
…by key - A union the spec names keeps the arm and nested type names its old name gave it, so a name that doesn't end in Input renames nothing else. - Escape $ in the deprecated alias message (Map$, $Action). - Of distinct unions given one name, the one with the smallest canonical key keeps it, so spec order doesn't move the name.
Of union parameters of different shapes given one x-blocks-type-name, the shape of the one with the smallest <method>#param:<name> key may take the name, matching the Dart generator.
# Conflicts: # scripts/sink-guards/codegen.test.mjs
Fixture 23's spec loses the SignInResult type name, since SignInResult<O> is a generic alias. Fixture 44's Dart golden picks up main's single Api suffix for namespace classes.
2 of 3 tasks
thisisabhash
previously approved these changes
Nov 19, 2026
…n-input-name # Conflicts: # scripts/sink-guards/codegen.test.mjs
Two namespaces' copies of one spec-named union take their arm names from each namespace's old name, so when the param isn't `input` and an arm nests an enum, the copies don't merge and one falls back. The warning now says so instead of naming another type.
…n-input-name # Conflicts: # native/codegen-fixtures/23-cognito-nested-unions/dart/client.dart # native/codegen-fixtures/23-cognito-nested-unions/kotlin/Types.kt # native/codegen-fixtures/23-cognito-nested-unions/swift/Api.swift # native/codegen-fixtures/23-cognito-nested-unions/swift/Models.swift # native/dart/packages/blocks_codegen/CHANGELOG.md # native/dart/packages/blocks_codegen/lib/src/generator.dart # native/swift/Tests/BlocksCodegenTests/SendableModelTests.swift # scripts/sink-guards/codegen.test.mjs
thisisabhash
approved these changes
Nov 19, 2026
This was referenced Nov 19, 2026
This branch had an error being deployed
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.
Problem
The Dart codegen gives each Auth block namespace its own
setAuthStateinput type, named after the namespace. Every Auth block's state machine takes the same input shape, but an app with two Auth blocks gets two unrelated types, so code written for one doesn't work with the other. The type name is public API, so it has to settle before Dart 1.0.0.Changes
x-blocks-type-namehint. Generators can then emit one shared type instead of an inline one per method. Patch changeset.setAuthStatetakes one sharedAuthActionInput. Goldens regenerated in all three SDKs, and the example e2e usesAuthActionInput.fromJson.SetAuthState.Inputper namespace, which doesn't rename when a block is added, so Kotlin is unchanged here.Breaking
For Dart apps: the per-namespace
setAuthStateinput classes are replaced byAuthActionInput. Listed under## Unreleasedin the codegen CHANGELOG, for 1.0.0.Validation
extract-ts-typesandgenerate-spectests;lint,lint:deps,scripts/sink-guards.check-live-auth-fixturesagainst the live Auth block (fixtures 18, 23, 37 and thesetAuthStatemethods match).test-apps/native-bindings.Merge notes
generator.dart(keep both) and the sink-guard allowlist line; regenerate the fixture 23 and 44 goldens.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.