Skip to content

feat: commit generated Rust SDK at crates/client for downstream consumers#14

Merged
tsdk02 merged 6 commits into
mainfrom
feat/commit-rust-sdk
May 5, 2026
Merged

feat: commit generated Rust SDK at crates/client for downstream consumers#14
tsdk02 merged 6 commits into
mainfrom
feat/commit-rust-sdk

Conversation

@tsdk02

@tsdk02 tsdk02 commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #13

Summary

  • Commits the smithy-rs generated kronos_sdk crate at a stable path (sdks/rust/) so downstream Rust services (e.g. aarokya) can depend on it via a Cargo git dep — no Smithy CLI, JVM, or Juspay Maven mirror required on the consumer side.
  • Restructures the Smithy section of the justfile into a one-command flow (just smithy-build = validate → generate → sync), matching the pattern already used in the purpose-bound-account repo.
  • Adds a CI drift guard so the committed SDK can never silently lie about the model.

Changes

sdks/rust/

  • 216 generated files — full kronos_sdk v0.1.0, MSRV 1.82, 24 operations under src/operation/, plus client/, types/, config/, primitives/, protocol_serde/.
  • sdks/rust/README.md — DO NOT EDIT warning + regeneration instructions.
  • Path is generator-agnostic: if smithy-rs reorganizes its output layout in a future version, downstream Cargo.toml files don't need to change.

Cargo.toml

  • [workspace] exclude = ["sdks/rust"] — keeps the SDK out of the server build graph. The SDK targets MSRV 1.82 and pulls a heavy AWS smithy runtime stack that server crates (MSRV 1.75) don't need; verified via cargo metadata that only the 5 server crates remain workspace members.

justfile

  • just smithy-validate — validate models in isolation; surfaces clean errors before regeneration.
  • just smithy-build — now does validate → smithy build → wipe sdks/rust/ (preserving README.md) → copy regenerated sources. One command, the common case. build-sdk, cli-install, and sdk-refresh transitively get validation for free.
  • just smithy-check — runs smithy-build, then git diff --exit-code -- sdks/rust to fail on drift.

.github/workflows/smithy-check.yml

  • Runs just smithy-check on any PR that touches smithy/, sdks/rust/, or the justfile. Sets up JDK 17, installs Smithy CLI 1.55.0, installs just, then runs the drift guard.

Why this approach (vs alternatives)

  • vs vendor in aarokya: the SDK becomes reviewable in Kronos PRs, so contract changes show their full blast radius (model + generated client) in one diff. No stale-vendor problem.
  • vs separate kronos-rust-sdk repo: premature with one consumer; easy to split later without changing aarokya's call sites — only the dep declaration changes.
  • vs crates/kronos_sdk/ (PBA-style): Kronos server doesn't consume its own SDK, so it doesn't need to be a workspace member. sdks/ namespace also scales cleanly when other languages get committed (sdks/openapi/, sdks/python/, etc.).
  • Why not just unignore smithy/build/.../rust-client-codegen/? Would either expose all gitignored build outputs (TS, Haskell, OpenAPI) or require a fragile negation rule. Leaks generator internals into consumer-visible paths.

Test plan

  • cargo check --workspace — server build unaffected (verified locally; only 5 server crates in workspace per cargo metadata).
  • just smithy-build — completes without errors, produces no diff in sdks/rust/ (verified locally — round-trip is clean).
  • just smithy-check — passes on the current commit.
  • just smithy-validate — runs in isolation.
  • git status after just smithy-build is clean (sdks/rust/README.md survives the wipe).
  • Smithy drift CI workflow runs and passes on this PR.
  • Smoke-test from aarokya: add kronos_sdk = { git = "ssh://git@github.com/juspay/kronos.git", rev = "<merge-sha>" } and confirm cargo build resolves without needing Smithy/JVM toolchain. (Will be done in the aarokya integration PR.)

Follow-ups

  • Tagged SDK releases (sdk-rust-v0.1.0, …) so consumers pin to tags rather than floating SHAs.
  • Add a real .github/PULL_REQUEST_TEMPLATE.md to standardize PR structure.
  • When a second service depends on kronos_sdk, evaluate splitting into a dedicated SDK repo or publishing to a private Cargo registry.

tsdk02 added 2 commits May 5, 2026 12:35
Adds the smithy-rs generated kronos_sdk crate at a stable path so external
Rust services (e.g. aarokya) can depend on it via a Cargo git dep without
needing the Smithy CLI, JVM, or Juspay's Maven mirror in their build.

- sdks/rust/: 216 generated files (kronos_sdk v0.1.0, MSRV 1.82)
- Cargo.toml: exclude sdks/rust from workspace (different MSRV + heavy AWS
  smithy runtime stack that server crates do not need)
- justfile: smithy-build now validates, regenerates, and syncs sdks/rust in
  one command; new smithy-validate and smithy-check (CI drift guard) recipes
- sdks/rust/README.md: DO NOT EDIT warning + regeneration instructions
Runs 'just smithy-check' (validate + regenerate + git diff guard) on any PR
that touches smithy/, sdks/rust/, or the justfile. Fails the build if the
committed Rust SDK has drifted from the model — eliminates the 'forgot to
regenerate' footgun.
@tsdk02 tsdk02 self-assigned this May 5, 2026
@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 220 files, which is 70 over the limit of 150.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 47f14407-efc7-41bc-bf37-e4878d209099

📥 Commits

Reviewing files that changed from the base of the PR and between d4db3f5 and 0f7a23d.

📒 Files selected for processing (220)
  • Cargo.toml
  • crates/client/Cargo.toml
  • crates/client/README.md
  • crates/client/src/auth_plugin.rs
  • crates/client/src/client.rs
  • crates/client/src/client/cancel_execution.rs
  • crates/client/src/client/cancel_job.rs
  • crates/client/src/client/create_endpoint.rs
  • crates/client/src/client/create_job.rs
  • crates/client/src/client/create_payload_spec.rs
  • crates/client/src/client/customize.rs
  • crates/client/src/client/customize/internal.rs
  • crates/client/src/client/delete_endpoint.rs
  • crates/client/src/client/delete_payload_spec.rs
  • crates/client/src/client/get_endpoint.rs
  • crates/client/src/client/get_execution.rs
  • crates/client/src/client/get_job.rs
  • crates/client/src/client/get_job_status.rs
  • crates/client/src/client/get_job_versions.rs
  • crates/client/src/client/get_payload_spec.rs
  • crates/client/src/client/list_endpoints.rs
  • crates/client/src/client/list_execution_attempts.rs
  • crates/client/src/client/list_execution_logs.rs
  • crates/client/src/client/list_job_executions.rs
  • crates/client/src/client/list_jobs.rs
  • crates/client/src/client/list_payload_specs.rs
  • crates/client/src/client/update_endpoint.rs
  • crates/client/src/client/update_job.rs
  • crates/client/src/client/update_payload_spec.rs
  • crates/client/src/config.rs
  • crates/client/src/config/endpoint.rs
  • crates/client/src/config/http.rs
  • crates/client/src/config/interceptors.rs
  • crates/client/src/config/retry.rs
  • crates/client/src/config/timeout.rs
  • crates/client/src/error.rs
  • crates/client/src/error/sealed_unhandled.rs
  • crates/client/src/error_meta.rs
  • crates/client/src/json_errors.rs
  • crates/client/src/lib.rs
  • crates/client/src/meta.rs
  • crates/client/src/operation.rs
  • crates/client/src/operation/cancel_execution.rs
  • crates/client/src/operation/cancel_execution/_cancel_execution_input.rs
  • crates/client/src/operation/cancel_execution/_cancel_execution_output.rs
  • crates/client/src/operation/cancel_execution/builders.rs
  • crates/client/src/operation/cancel_job.rs
  • crates/client/src/operation/cancel_job/_cancel_job_input.rs
  • crates/client/src/operation/cancel_job/_cancel_job_output.rs
  • crates/client/src/operation/cancel_job/builders.rs
  • crates/client/src/operation/create_endpoint.rs
  • crates/client/src/operation/create_endpoint/_create_endpoint_input.rs
  • crates/client/src/operation/create_endpoint/_create_endpoint_output.rs
  • crates/client/src/operation/create_endpoint/builders.rs
  • crates/client/src/operation/create_job.rs
  • crates/client/src/operation/create_job/_create_job_input.rs
  • crates/client/src/operation/create_job/_create_job_output.rs
  • crates/client/src/operation/create_job/builders.rs
  • crates/client/src/operation/create_payload_spec.rs
  • crates/client/src/operation/create_payload_spec/_create_payload_spec_input.rs
  • crates/client/src/operation/create_payload_spec/_create_payload_spec_output.rs
  • crates/client/src/operation/create_payload_spec/builders.rs
  • crates/client/src/operation/delete_endpoint.rs
  • crates/client/src/operation/delete_endpoint/_delete_endpoint_input.rs
  • crates/client/src/operation/delete_endpoint/_delete_endpoint_output.rs
  • crates/client/src/operation/delete_endpoint/builders.rs
  • crates/client/src/operation/delete_payload_spec.rs
  • crates/client/src/operation/delete_payload_spec/_delete_payload_spec_input.rs
  • crates/client/src/operation/delete_payload_spec/_delete_payload_spec_output.rs
  • crates/client/src/operation/delete_payload_spec/builders.rs
  • crates/client/src/operation/get_endpoint.rs
  • crates/client/src/operation/get_endpoint/_get_endpoint_input.rs
  • crates/client/src/operation/get_endpoint/_get_endpoint_output.rs
  • crates/client/src/operation/get_endpoint/builders.rs
  • crates/client/src/operation/get_execution.rs
  • crates/client/src/operation/get_execution/_get_execution_input.rs
  • crates/client/src/operation/get_execution/_get_execution_output.rs
  • crates/client/src/operation/get_execution/builders.rs
  • crates/client/src/operation/get_job.rs
  • crates/client/src/operation/get_job/_get_job_input.rs
  • crates/client/src/operation/get_job/_get_job_output.rs
  • crates/client/src/operation/get_job/builders.rs
  • crates/client/src/operation/get_job_status.rs
  • crates/client/src/operation/get_job_status/_get_job_status_input.rs
  • crates/client/src/operation/get_job_status/_get_job_status_output.rs
  • crates/client/src/operation/get_job_status/builders.rs
  • crates/client/src/operation/get_job_versions.rs
  • crates/client/src/operation/get_job_versions/_get_job_versions_input.rs
  • crates/client/src/operation/get_job_versions/_get_job_versions_output.rs
  • crates/client/src/operation/get_job_versions/builders.rs
  • crates/client/src/operation/get_payload_spec.rs
  • crates/client/src/operation/get_payload_spec/_get_payload_spec_input.rs
  • crates/client/src/operation/get_payload_spec/_get_payload_spec_output.rs
  • crates/client/src/operation/get_payload_spec/builders.rs
  • crates/client/src/operation/list_endpoints.rs
  • crates/client/src/operation/list_endpoints/_list_endpoints_input.rs
  • crates/client/src/operation/list_endpoints/_list_endpoints_output.rs
  • crates/client/src/operation/list_endpoints/builders.rs
  • crates/client/src/operation/list_execution_attempts.rs
  • crates/client/src/operation/list_execution_attempts/_list_execution_attempts_input.rs
  • crates/client/src/operation/list_execution_attempts/_list_execution_attempts_output.rs
  • crates/client/src/operation/list_execution_attempts/builders.rs
  • crates/client/src/operation/list_execution_logs.rs
  • crates/client/src/operation/list_execution_logs/_list_execution_logs_input.rs
  • crates/client/src/operation/list_execution_logs/_list_execution_logs_output.rs
  • crates/client/src/operation/list_execution_logs/builders.rs
  • crates/client/src/operation/list_job_executions.rs
  • crates/client/src/operation/list_job_executions/_list_job_executions_input.rs
  • crates/client/src/operation/list_job_executions/_list_job_executions_output.rs
  • crates/client/src/operation/list_job_executions/builders.rs
  • crates/client/src/operation/list_jobs.rs
  • crates/client/src/operation/list_jobs/_list_jobs_input.rs
  • crates/client/src/operation/list_jobs/_list_jobs_output.rs
  • crates/client/src/operation/list_jobs/builders.rs
  • crates/client/src/operation/list_payload_specs.rs
  • crates/client/src/operation/list_payload_specs/_list_payload_specs_input.rs
  • crates/client/src/operation/list_payload_specs/_list_payload_specs_output.rs
  • crates/client/src/operation/list_payload_specs/builders.rs
  • crates/client/src/operation/update_endpoint.rs
  • crates/client/src/operation/update_endpoint/_update_endpoint_input.rs
  • crates/client/src/operation/update_endpoint/_update_endpoint_output.rs
  • crates/client/src/operation/update_endpoint/builders.rs
  • crates/client/src/operation/update_job.rs
  • crates/client/src/operation/update_job/_update_job_input.rs
  • crates/client/src/operation/update_job/_update_job_output.rs
  • crates/client/src/operation/update_job/builders.rs
  • crates/client/src/operation/update_payload_spec.rs
  • crates/client/src/operation/update_payload_spec/_update_payload_spec_input.rs
  • crates/client/src/operation/update_payload_spec/_update_payload_spec_output.rs
  • crates/client/src/operation/update_payload_spec/builders.rs
  • crates/client/src/primitives.rs
  • crates/client/src/primitives/event_stream.rs
  • crates/client/src/primitives/sealed_enum_unknown.rs
  • crates/client/src/protocol_serde.rs
  • crates/client/src/protocol_serde/shape_attempt_resource.rs
  • crates/client/src/protocol_serde/shape_attempt_resource_list.rs
  • crates/client/src/protocol_serde/shape_cancel_execution.rs
  • crates/client/src/protocol_serde/shape_cancel_job.rs
  • crates/client/src/protocol_serde/shape_conflict_error.rs
  • crates/client/src/protocol_serde/shape_create_endpoint.rs
  • crates/client/src/protocol_serde/shape_create_endpoint_input.rs
  • crates/client/src/protocol_serde/shape_create_job.rs
  • crates/client/src/protocol_serde/shape_create_job_input.rs
  • crates/client/src/protocol_serde/shape_create_payload_spec.rs
  • crates/client/src/protocol_serde/shape_create_payload_spec_input.rs
  • crates/client/src/protocol_serde/shape_delete_endpoint.rs
  • crates/client/src/protocol_serde/shape_delete_payload_spec.rs
  • crates/client/src/protocol_serde/shape_endpoint_list.rs
  • crates/client/src/protocol_serde/shape_endpoint_resource.rs
  • crates/client/src/protocol_serde/shape_error_detail.rs
  • crates/client/src/protocol_serde/shape_execution_log_list.rs
  • crates/client/src/protocol_serde/shape_execution_log_resource.rs
  • crates/client/src/protocol_serde/shape_execution_resource.rs
  • crates/client/src/protocol_serde/shape_execution_resource_list.rs
  • crates/client/src/protocol_serde/shape_execution_summary.rs
  • crates/client/src/protocol_serde/shape_get_endpoint.rs
  • crates/client/src/protocol_serde/shape_get_execution.rs
  • crates/client/src/protocol_serde/shape_get_job.rs
  • crates/client/src/protocol_serde/shape_get_job_status.rs
  • crates/client/src/protocol_serde/shape_get_job_versions.rs
  • crates/client/src/protocol_serde/shape_get_payload_spec.rs
  • crates/client/src/protocol_serde/shape_internal_error.rs
  • crates/client/src/protocol_serde/shape_invalid_request_error.rs
  • crates/client/src/protocol_serde/shape_job_resource.rs
  • crates/client/src/protocol_serde/shape_job_status_response.rs
  • crates/client/src/protocol_serde/shape_job_summary.rs
  • crates/client/src/protocol_serde/shape_job_summary_list.rs
  • crates/client/src/protocol_serde/shape_job_version_list.rs
  • crates/client/src/protocol_serde/shape_list_endpoints.rs
  • crates/client/src/protocol_serde/shape_list_execution_attempts.rs
  • crates/client/src/protocol_serde/shape_list_execution_logs.rs
  • crates/client/src/protocol_serde/shape_list_job_executions.rs
  • crates/client/src/protocol_serde/shape_list_jobs.rs
  • crates/client/src/protocol_serde/shape_list_payload_specs.rs
  • crates/client/src/protocol_serde/shape_not_found_error.rs
  • crates/client/src/protocol_serde/shape_payload_spec_list.rs
  • crates/client/src/protocol_serde/shape_payload_spec_resource.rs
  • crates/client/src/protocol_serde/shape_rate_limited_error.rs
  • crates/client/src/protocol_serde/shape_retry_policy.rs
  • crates/client/src/protocol_serde/shape_unauthorized_error.rs
  • crates/client/src/protocol_serde/shape_unprocessable_entity_error.rs
  • crates/client/src/protocol_serde/shape_update_endpoint.rs
  • crates/client/src/protocol_serde/shape_update_endpoint_input.rs
  • crates/client/src/protocol_serde/shape_update_job.rs
  • crates/client/src/protocol_serde/shape_update_job_input.rs
  • crates/client/src/protocol_serde/shape_update_payload_spec.rs
  • crates/client/src/protocol_serde/shape_update_payload_spec_input.rs
  • crates/client/src/sdk_feature_tracker.rs
  • crates/client/src/serde_util.rs
  • crates/client/src/serialization_settings.rs
  • crates/client/src/types.rs
  • crates/client/src/types/_attempt_resource.rs
  • crates/client/src/types/_attempt_status_enum.rs
  • crates/client/src/types/_backoff_type_enum.rs
  • crates/client/src/types/_endpoint_resource.rs
  • crates/client/src/types/_endpoint_type_enum.rs
  • crates/client/src/types/_error_detail.rs
  • crates/client/src/types/_execution_log_resource.rs
  • crates/client/src/types/_execution_resource.rs
  • crates/client/src/types/_execution_status_enum.rs
  • crates/client/src/types/_execution_summary.rs
  • crates/client/src/types/_job_resource.rs
  • crates/client/src/types/_job_status_enum.rs
  • crates/client/src/types/_job_status_response.rs
  • crates/client/src/types/_job_summary.rs
  • crates/client/src/types/_log_level_enum.rs
  • crates/client/src/types/_payload_spec_resource.rs
  • crates/client/src/types/_retry_policy.rs
  • crates/client/src/types/_trigger_type_enum.rs
  • crates/client/src/types/builders.rs
  • crates/client/src/types/error.rs
  • crates/client/src/types/error/_conflict_error.rs
  • crates/client/src/types/error/_internal_error.rs
  • crates/client/src/types/error/_invalid_request_error.rs
  • crates/client/src/types/error/_not_found_error.rs
  • crates/client/src/types/error/_rate_limited_error.rs
  • crates/client/src/types/error/_unauthorized_error.rs
  • crates/client/src/types/error/_unprocessable_entity_error.rs
  • crates/client/src/types/error/builders.rs
  • justfile

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/commit-rust-sdk

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

tsdk02 added 2 commits May 5, 2026 12:45
smithy-rs emits the `pub use` re-exports in sdks/rust/src/types/error.rs and
sdks/rust/src/types/error/builders.rs in JVM HashMap iteration order, which
differs across processes due to randomized hash seeds. CI regeneration
produced a different ordering than local generation, failing the drift guard.

Inline 3-command pipeline (head + grep|sort|sed + sed) in just smithy-build
sorts only those two known-affected files; other generated files (operation
unions, error_meta enum) are already model-driven and stable.
smithy-rs emits pub use blocks in error mod files (and on closer inspection,
operation/*.rs and types.rs) in JVM HashMap iteration order — non-stable
across processes. A naive git diff drift check produces false positives on
every regeneration on a different machine.

Removing the CI guard and the inline canonicalization for now:
- .github/workflows/smithy-check.yml deleted
- 'just smithy-check' recipe removed from justfile
- Inline sort pipeline removed from 'just smithy-build'
- sdks/rust/{types/error.rs,types/error/builders.rs} re-regenerated cleanly
  (smithy-rs natural output, no post-processing)
- sdks/rust/README.md updated to flag the missing drift guard

Will add a proper canonicalization helper + CI guard in a follow-up.
Comment thread Cargo.toml Outdated
# Generated client SDK — committed for downstream consumers (e.g. aarokya)
# to depend on via `git`. Pins a different MSRV (1.82) and runtime stack
# than the server workspace, so it stays out of the workspace build graph.
"sdks/rust",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the sdk in crates/sdk or crates/client

Comment thread justfile Outdated
Comment on lines +82 to +85
# Wipe everything except README.md (which warns "DO NOT EDIT" and must survive regeneration)
find sdks/rust -mindepth 1 -maxdepth 1 ! -name 'README.md' -exec rm -rf {} +
cp -R smithy/build/smithy/source/rust-client-codegen/. sdks/rust/
@echo "Regenerated sdks/rust. Review with: git diff -- sdks/rust"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also consider doing something like:
remove the folder, git revert readme and then continue with generation

tsdk02 added 2 commits May 5, 2026 15:41
Review feedback:
1. SDKs alongside other Rust crates rather than a separate sdks/ tree.
   sdks/rust/ -> crates/client/ (git mv preserves history). Cargo.toml
   workspace exclude updated accordingly.
2. Cleaner regeneration recipe — replace the 'find ... ! -name README.md'
   wipe with 'rm -rf crates/client; cp ...; git checkout -- README.md'.
   Intent is obvious; the README is restored from the index, so it works
   pre- and post-commit and protects against accidental hand-edits.

README and Cargo.toml workspace exclude updated to reference crates/client.
The previous commit (3abcd78) used 'git add -A' which swept in two files
that shouldn't be in the kronos repo:
- .claude/plans/aarokya-integration.md (local AI tooling artifact)
- kronos.postman_collection.json (local dev artifact)

Removing both. They remain in the working tree as untracked.
@tsdk02 tsdk02 changed the title feat: commit generated Rust SDK at sdks/rust for downstream consumers feat: commit generated Rust SDK at crates/client for downstream consumers May 5, 2026
@tsdk02 tsdk02 merged commit 17e77d2 into main May 5, 2026
3 checks passed
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.

Commit generated Rust SDK at sdks/rust for downstream Rust consumers

2 participants