Skip to content

ci: gate the Rust SDK on PRs (fmt, clippy, build, test)#35

Merged
graycyrus merged 2 commits into
tinyhumansai:mainfrom
graycyrus:ci/rust-pr-gating
Jun 16, 2026
Merged

ci: gate the Rust SDK on PRs (fmt, clippy, build, test)#35
graycyrus merged 2 commits into
tinyhumansai:mainfrom
graycyrus:ci/rust-pr-gating

Conversation

@graycyrus

@graycyrus graycyrus commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

Adds a rust-sdk job to ci.yml that runs on every PR (and push to main):

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo build --all-targets
  • cargo test

against sdk/rust/, with a Rust toolchain (dtolnay/rust-toolchain@stable + rustfmt/clippy) and Swatinem/rust-cache.

Why

The Rust crate was never built or tested on PRsci.yml covered only the TS SDK + website. publish-rust-sdk.yml runs the Rust checks, but only on push to main (post-merge), so regressions land undetected. This is exactly what happened: the crate is currently broken on main (#30 / fixed in #32). A PR gate would have blocked it.

Merge ordering

This should merge after #32 (the compile fix). Until the crate compiles on main, this job will (correctly) fail. Once #32 is in, this goes green and keeps the Rust SDK honest going forward.

Note: I validated the four commands locally (all green on the #32 branch). Because this PR comes from a fork, GitHub runs the base repo's workflow for pull_request, so the new job won't execute on this PR itself — it takes effect once merged.

Closes #14

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced continuous integration with automated Rust SDK validation and testing to maintain code quality standards.

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

@graycyrus is attempting to deploy a commit to the Vezures Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@graycyrus, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 10 minutes and 33 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6468dc4f-24ba-4615-9952-3457411487ee

📥 Commits

Reviewing files that changed from the base of the PR and between 2edf07c and 42d421e.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
📝 Walkthrough

Walkthrough

A new rust-sdk job is added to .github/workflows/ci.yml. It runs on ubuntu-latest, installs rustfmt and clippy components, enables dependency caching via Swatinem/rust-cache, and sequentially executes cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo build --all-targets, and cargo test, all within sdk/rust.

Changes

Rust SDK CI Job

Layer / File(s) Summary
rust-sdk CI job definition
.github/workflows/ci.yml
Adds a rust-sdk job with Rust toolchain setup (rustfmt, clippy), dependency caching, and four sequential cargo steps (fmt check, clippy, build, test) scoped to sdk/rust.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 A rabbit once said with a hop and a cheer,
"The Rust crate was hiding — now CI is here!
cargo fmt checks the style with a glance,
clippy corrects every wobbly stance.
Build and test, all four hundred green —
The tidiest SDK I have ever seen!" 🦀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: gate the Rust SDK on PRs (fmt, clippy, build, test)' directly and accurately summarizes the main change: adding CI gates for the Rust SDK with specific checks.
Linked Issues check ✅ Passed The PR fully satisfies the primary objective from issue #14: implementing a CI workflow for sdk/rust/ that runs cargo fmt, clippy, build, and test checks on PRs to main.
Out of Scope Changes check ✅ Passed The PR contains only the required CI workflow additions to .github/workflows/ci.yml with no extraneous changes beyond the scope of issue #14's first objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 139: The actions/checkout@v4 action currently uses default settings that
persist the GitHub token in the local git config, creating a security risk when
the job executes untrusted code via cargo build/cargo test. Add the
persist-credentials input parameter set to false to the checkout action to
disable token persistence and reduce token exposure.
- Around line 139-145: Replace the mutable version tags in the GitHub Actions
with full commit SHAs for immutability. Update the three uses directives:
actions/checkout@v4, dtolnay/rust-toolchain@stable, and Swatinem/rust-cache@v2
by replacing each mutable tag (v4, stable, v2) with their corresponding full
commit digest hashes to prevent supply-chain drift and ensure reproducible CI
runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8304a7ae-30a4-4efd-bf5b-b9267f42e9d6

📥 Commits

Reviewing files that changed from the base of the PR and between ac7981e and 2edf07c.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment on lines +139 to +145
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin newly added GitHub Actions to commit SHAs.

The new job uses mutable tags (@v4, @stable, @v2). If your CI policy requires immutable pinning, these should be pinned to full commit digests to prevent supply-chain drift.

Suggested patch shape
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@<full_commit_sha_for_v4>

-      - uses: dtolnay/rust-toolchain@stable
+      - uses: dtolnay/rust-toolchain@<full_commit_sha_for_stable_ref>

-      - uses: Swatinem/rust-cache@v2
+      - uses: Swatinem/rust-cache@<full_commit_sha_for_v2>
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 139-139: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 139-139: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 141-141: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 145-145: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 139 - 145, Replace the mutable version
tags in the GitHub Actions with full commit SHAs for immutability. Update the
three uses directives: actions/checkout@v4, dtolnay/rust-toolchain@stable, and
Swatinem/rust-cache@v2 by replacing each mutable tag (v4, stable, v2) with their
corresponding full commit digest hashes to prevent supply-chain drift and ensure
reproducible CI runs.

Source: Linters/SAST tools

The Rust crate was never built or tested on PRs — `ci.yml` covered only the
TS SDK + website. `publish-rust-sdk.yml` runs the Rust checks, but only on push
to main (post-merge), so build breaks land on main undetected.

Add a `rust-sdk` job running `cargo fmt --check`, `cargo clippy -D warnings`,
`cargo build`, and `cargo test` against `sdk/rust/` on every PR, with a Rust
toolchain + cache.

Closes #14

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@graycyrus
graycyrus force-pushed the ci/rust-pr-gating branch from 2edf07c to 51c0c35 Compare June 16, 2026 11:07
Addresses CodeRabbit/zizmor: the rust-sdk job runs repo code (cargo
build/test), so set persist-credentials: false to avoid leaving the token
in git config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@graycyrus

Copy link
Copy Markdown
Contributor Author

Thanks @coderabbitai. Addressed:

  • persist-credentials: added persist-credentials: false to the rust-sdk job's checkout (it runs repo code via cargo). ✅
  • Pin actions to commit SHAs: skipping for now — the rest of ci.yml (and the other workflows) all use mutable tags (@v4, etc.). Pinning only this one job to SHAs would be inconsistent; SHA-pinning is better done repo-wide as a separate policy change.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@graycyrus: Both points look good to me.

  • persist-credentials: false — great addition, that closes the credential-exposure risk for that job. ✅
  • SHA pinning deferral — the reasoning is solid. Pinning a single job while the rest of the repo stays on mutable tags would be inconsistent and give false assurance. A repo-wide sweep is the right approach; happy to help draft that as a follow-up issue if you'd like.

🐇

@graycyrus
graycyrus merged commit 5c7c706 into tinyhumansai:main Jun 16, 2026
8 of 9 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.

[Rust SDK] CI never builds or tests the Rust crate (no cargo workflow)

1 participant