Repository navigation
fix(sdk-generator): Rust channel leave collision and SSE enum clippy lint - #117
Merged
Merged
Conversation
…lint Regenerating archastro-rust from the refreshed platform spec failed to compile: - The Artifact channel's client 'leave' event became a second `pub async fn leave` next to the lifecycle leave() (E0592). This is the Rust half of 9ed4a9b. The message method is now `leave_message`, using the same rule as TypeScript and Python. The SDK and contract-test emitters share rustChannelMessageMethodName / rustChannelJoinMethodName. - Version modules now hold SSE event enums that wrap whole models (GetApiV1AgentSessionsAgentSessionStreamEvent), which trips clippy::large_enum_variant under -D warnings. Version modules now carry the same allow as types.rs. Co-Authored-By: Claude Opus 5.5 (1M context) <[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.
Review on ArchCode
Problem and author intent
After the spec refresh (#116) and generator v0.11.12,
regenerate-sdk.ymlin archastro-rust produced archastro-rust#9, which fails both CI jobs:error[E0592]: duplicate definitions with name 'leave'insrc/generated/channels.rs. The Artifact channel has a client-to-serverleaveevent, and the Rust emitter turned it into a secondpub async fn leavenext to the lifecycleleave(). fix(sdk-generator): rename channel message methods that collide with leave() #114 fixed this collision for TypeScript and Python only.cargo clippy -D warningsfailed withlarge_enum_variantonGetApiV1AgentSessionsAgentSessionStreamEventinv1.rs. SSE event enums wrap whole models, andtypes.rsalready allows this lint, but the version modules did not.The goal is that the Rust SDK regenerates from the current spec and passes CI.
What changed
rust/identifiers.ts: addsrustChannelJoinMethodNameandrustChannelMessageMethodName. A message event that matchesleaveor one of the channel's join constructors gets a_messagesuffix (leave_message), the same rule as fix(sdk-generator): rename channel message methods that collide with leave() #114. The wire event stays"leave".rust/index.ts) and the contract-test emitter (contract-tests/rust-emitter.ts) both use these helpers, so the generated contract tests call the renamed method.emitVersionadds#![allow(clippy::large_enum_variant)], asemitTypesalready does.Scope: generator only. The Rust SDK output changes; the other languages do not.
Risk: low. Naming changes only for events that would otherwise not compile.
User impact: Rust users call
ApiArtifactChannel::leave_message()to push theleaveevent.leave()still leaves the channel.Testing
__tests__/backends/rust.test.ts, under "rust channel leave collision" and "allows large enum variants in version modules". The two collision tests fail without the fix.npm test: 431 + 74 pass.npm run buildandnpm run lintare clean.scripts/regenerate_sdk.sh --local <this branch>against the merged spec. Thencargo fmt --check,cargo clippy --all-features --all-targets -D warnings,cargo check --locked --no-default-features --features rustls-tls(the msrv job's command) andcargo test --all-featuresall pass. The harness-gated contract tests are#[ignore]there, as they are in CI.leavecollision. That is a follow-up.🤖 Generated with Claude Code