Skip to content

ci: extend antd-rust to sibling-repo parity (fmt + clippy + audit + doc)#111

Merged
Nic-dorman merged 4 commits into
mainfrom
nic/v2-338-antd-rust-ci-parity
May 20, 2026
Merged

ci: extend antd-rust to sibling-repo parity (fmt + clippy + audit + doc)#111
Nic-dorman merged 4 commits into
mainfrom
nic/v2-338-antd-rust-ci-parity

Conversation

@Nic-dorman
Copy link
Copy Markdown
Collaborator

Summary

antd-rust's CI ran only cargo test --locked — every sibling WithAutonomi Rust repo (ant-client, ant-node, ant-protocol) runs the full fmt + clippy + audit + doc playbook with Swatinem/rust-cache@v2. This PR brings antd-rust to that bar.

Stacked on top of #110 (Cargo.lock fix). Merge after #110.

Changes

.github/workflows/ci.yml restructure:

  • Renames contract-testsCheck (antd-rust) and adds cargo fmt --all -- --check, cargo clippy --all-targets --all-features --locked -- -D warnings, and cargo doc --locked --no-deps alongside the existing test step.
  • Consolidates the audit job to run cargo audit against both antd/ and antd-rust/.
  • Adds Swatinem/rust-cache@v2 to all three jobs.
  • Tightens the antd clippy flags to match siblings: --all-targets --all-features --locked -- -D warnings.

Lint-fix commits in antd-rust (because antd-rust has never had fmt/clippy enforcement, drift has accumulated):

  1. style(antd-rust): rustfmt baseline before CI enforcement — pure mechanical cargo fmt --all output across 9 files. Separated so reviewers don't have to filter cosmetic noise from logic.
  2. ci: extend antd-rust to sibling-repo parity (...) — the workflow change plus the 5 clippy hits the new depth surfaces:
    • src/client.rs: replace status < 200 || status >= 300 with !(200..300).contains(&status) (clippy::manual_range_contains).
    • src/client.rs: remove dead do_head helper (no call sites).
    • src/errors.rs: box the Grpc(tonic::Status) variant. tonic::Status is ~176 bytes, blowing up every Result<T, AntdError> (clippy::result_large_err). Manual From<tonic::Status> keeps ? ergonomic; match arms continue working via Box::Deref.
    • src/tests.rs, src/grpc_tests.rs: drop unused crate::models::* glob imports.

Test plan

  • cargo fmt --all -- --check clean in both crates
  • cargo clippy --all-targets --all-features --locked -- -D warnings clean in both crates
  • cargo doc --locked --no-deps clean in both crates
  • cargo test --locked — 56/56 pass in antd-rust, 37/37 in antd
  • cargo audit exits 0 in both crates (existing unmaintained-crate warnings are not introduced by this PR)
  • CI on this PR: all four jobs green (Check (antd), Check (antd-rust), Security audit)

Notes

  • cargo-audit is already installed on dev2 (0.22.1) so the existing sweep can reproduce CI audit findings locally.

Nic-dorman and others added 3 commits May 20, 2026 10:02
The alloy dev-dependency added for the 07-external-signer example
landed in Cargo.toml without a matching Cargo.lock refresh. The
`API contract tests (antd-rust)` job runs `cargo test --locked` and
has been failing on every push to main since then (and on every PR
that triggers the CI path filter) with:

    error: cannot update the lock file ... because --locked was passed

Regenerated Cargo.lock with `cargo update` (no flags) and verified
`cargo check --locked --all-targets` is now clean. Diff is large
(+310 packages) but mechanical — it's the alloy transitive graph
that should have been committed alongside the Cargo.toml change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
antd-rust has never had `cargo fmt --check` in CI, so style drift has
accumulated across most files (build.rs, both examples, client.rs,
discover.rs, grpc_client.rs, grpc_tests.rs, models.rs, tests.rs).

Pure mechanical rustfmt output. No behavioral changes. Separated
from the CI workflow change so the next commit's diff focuses on
the lint additions and bug fixes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…oc + rust-cache)

The antd-rust CI job ran only `cargo test --locked` while the sibling
WithAutonomi Rust repos (ant-client, ant-node, ant-protocol) all run
the full playbook: fmt + clippy + doc + audit, with Swatinem/rust-cache
for shared compile artifacts.

Brings antd-rust to that bar in one CI workflow:

- Renames the `contract-tests` job to `Check (antd-rust)` and adds
  `cargo fmt --all -- --check`, `cargo clippy --all-targets
  --all-features --locked -- -D warnings`, and `cargo doc --locked
  --no-deps` alongside the existing test step.
- Consolidates the security audit into a single job that runs
  `cargo audit` against both `antd/` and `antd-rust/`.
- Adds `Swatinem/rust-cache@v2` to all three jobs (rust-cache for
  the two per-directory crates; a dedicated `cargo-audit-tool` key
  for the audit job so the tool install survives invalidation).
- Tightens the antd clippy flags to match: `--all-targets
  --all-features --locked -- -D warnings` (was `--locked --`).

Fixes the clippy hits the new depth surfaces in antd-rust:

- `src/client.rs`: replace `status < 200 || status >= 300` with
  `!(200..300).contains(&status)` (clippy::manual_range_contains).
- `src/client.rs`: remove dead `do_head` helper (no call sites).
- `src/errors.rs`: box the `Grpc(tonic::Status)` variant. The status
  type is ~176 bytes, making `Result<T, AntdError>` heavy at every
  return site (clippy::result_large_err); a manual `From<tonic::Status>`
  preserves `?` ergonomics for callers, and existing match arms keep
  working via `Box`'s `Deref` to `tonic::Status`.
- `src/tests.rs`, `src/grpc_tests.rs`: drop unused `crate::models::*`
  glob imports (clippy::unused_imports).

Verified locally:
- `cargo fmt --all -- --check` clean in both crates
- `cargo clippy --all-targets --all-features --locked -- -D warnings`
  clean in both crates
- `cargo doc --locked --no-deps` clean in both crates
- `cargo test --locked` 56/56 pass in antd-rust, 37/37 in antd
- `cargo audit` exits 0 with the existing 5/2 advisory warnings
  (rustls-pemfile unmaintained, etc. — pre-existing, not introduced)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman Nic-dorman force-pushed the nic/v2-338-antd-rust-ci-parity branch from 9f25ab5 to 02b9aa8 Compare May 20, 2026 11:12
GitHub Actions only allows EITHER `paths` OR `paths-ignore` on a
trigger, not both — combining them silently rejects the workflow
("This run likely failed because of a workflow file issue", 0s).

Use a negation pattern inside `paths` instead: `"!**/*.md"`. A
spelling fix in any README/CHANGELOG/SECURITY.md anywhere in the
repo no longer drags the ~5-minute Rust compile/clippy/audit
pipeline along with it. PRs that touch both .md files and .rs
files still trigger CI normally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman Nic-dorman force-pushed the nic/v2-338-antd-rust-ci-parity branch from 02b9aa8 to 6e3c15b Compare May 20, 2026 11:17
@Nic-dorman Nic-dorman merged commit b60960f into main May 20, 2026
3 checks passed
@Nic-dorman Nic-dorman deleted the nic/v2-338-antd-rust-ci-parity branch May 20, 2026 11:19
Nic-dorman added a commit that referenced this pull request May 21, 2026
Cuts v0.8.0 atop v0.7.1. Substantial breaking-change roll-up of the
put/get rename, the private-file PUT/GET gap close, and several minor
surface cleanups -- bundled here so the v1.0 cut can ship stable on top.

## Breaking (antd daemon)

- feat(antd)!: bind to 127.0.0.1 by default on REST and gRPC (#107).
  Previously bound 0.0.0.0; use --bind-rest / --bind-grpc to override.
- chore: remove dead graph_entry surface from antd proto + 5 SDKs (#92).
  GraphService and its 4 RPCs are gone; REST mounts dropped.
- chore: remove dir_upload_public / dir_download_public surface (#95).
  Use file_put_public on a directory path instead; the daemon recurses.
- feat(antd)!: normalize put/get convention + close private-file PUT and
  GET gaps (#115). Method renames across proto + REST + SDKs:
    data_put_private    -> data_put
    data_get_private    -> data_get
    file_upload_public  -> file_put_public
    file_download_public -> file_get_public
  New: file_put / file_get for the private file path (previously only
  the public variant existed). New typed results: DataPutResult,
  DataPutPublicResult, FilePutResult, FilePutPublicResult; PutResult
  is now annotated as chunk_put only.

## Additive

- feat(antd): honor payment_mode on gRPC put/cost paths and REST cost
  endpoints (#114). Optional kwarg threaded through every put/cost
  signature; empty/omitted maps to "auto" so older clients keep working.
- feat: external-signer public uploads + single-chunk prepare/finalize
  across 15 SDKs (#90).
- docs+spec: openapi.yaml refreshed for the v1.0 surface, including
  POST /v1/chunks/prepare and /v1/chunks/finalize for single-chunk
  external-signer publish (#126).

## SDK fan-out (PaymentMode + put/get convention, all 15)

#116 antd-go, #117 antd-py/ruby/elixir, #118 antd-rust, #119 antd-csharp,
#120 antd-java, #121 antd-swift, #122 antd-dart, #123 antd-kotlin,
#124 antd-cpp, #125 antd-js/php/zig/lua, #127 antd-mcp.

## SDK example + build fixes

- fix(antd-go): make 03-files example self-contained and runnable (#91)
- fix(examples): make 04-files runnable across cpp/rust/elixir/lua/php/ruby/zig (#93)
- fix(examples): runnable dart 04_files + java Example03Files; add java Example03Chunks (#94)
- feat: gRPC transport example for antd-py and antd-rust (#113)
- feat(antd-py): 07_external_signer example + ant-dev dispatcher entry (#98)
- feat(antd-js): 07-external-signer example + antd-py empty-payments fix (#99)
- feat(rust/go): 07-external-signer examples (#100)
- feat(antd-csharp): 07_external_signer example (#101)
- feat(antd-java): 07_external_signer example (#102)
- feat(antd-kotlin): 07_external_signer example (#103)
- feat(antd-dart): 07_external_signer example (#104)
- feat(antd-ruby): 07_external_signer example (#105)
- feat(antd-php): 07_external_signer example (#106)
- chore(antd-kotlin): drop stale GraphDescendant from local proto copy (#108)

## Docs / infra

- docs: external-signer flow reference + ABI + python smoke test (#97)
- docs: add SECURITY.md with threat model and disclosure policy (#109)
- docs!: refresh per-SDK READMEs + llms-full.txt + openapi.yaml for v1.0 surface (#126)
- ci: add Go lint + test + vuln scanning for antd-go (#112)
- ci: extend antd-rust to sibling-repo parity (fmt + clippy + audit + doc) (#111)
- ci: skip antd/openapi.yaml and llms-full.txt from triggering CI (#128)
- chore(scripts): add full-stack + integration sweep helpers (#96)
- fix(antd-rust): regenerate Cargo.lock to unbreak --locked CI (#110)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant