cmux-cloud-client: unique fallback idempotency keys; test openapi.json against tags.txt

Merged
TE
2d ago
+58-8

Follow-ups from the review of #36041 (cmux-cloud-client), part of moving NEXT's Cloud client into Rust. Leo (2026-11-04): "and moving off swift into rust for next's cloud".

  • client_key fallback: if the OS random source fails, the fallback key bytes now include a per-process counter as well as the clock and the pid. Two keys from one process can't repeat within one clock tick, so separate mutations are never mistaken for retries. A test makes 1000 fallback keys and checks they're all different.

  • tags.txt drift: a test now checks that openapi.json is exactly the selection tags.txt names. Every operation's first tag must be listed in tags.txt, and every listed tag must appear in the spec.
    A tag added to or dropped from tags.txt without running scripts/update-spec.sh now fails cargo test.

Verified on the fleet: cmux-cloud-client's 13 tests pass, clippy -D warnings is clean, and rustfmt is clean.

🤖 Generated with Claude Code

Agent session: agent session


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes fallback idempotency key generation in cmux-cloud-client and adds a test keeping the vendored openapi.json consistent with tags.txt.

  • When the OS random source fails, fallback keys now merge a per-process counter with the clock and PID, so two keys from one process can't repeat in a single clock tick (previously they could) and separate mutations aren't mistaken for retries; a test verifies 1000 fallback keys are unique.
  • A test now checks that every operation's first tag in openapi.json appears in tags.txt and vice versa, so a tag added or dropped there without running scripts/update-spec.sh fails cargo test.