test: Wave 10 - snapshot tests and facade integration tests#36
test: Wave 10 - snapshot tests and facade integration tests#36EffortlessSteven merged 9 commits intomainfrom
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (19)
📒 Files selected for processing (15)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Review Summary by QodoAdd snapshot and integration tests for untested crates (Wave 10)
WalkthroughsDescription• Add insta snapshot tests for RSA, ECDSA, Ed25519, HMAC, Token crates • Add integration tests for core-keypair, core-x509, core-x509-spec facades • Add insta and serde dev-dependencies to key type crates • Verify deterministic key generation and facade re-exports functionality Diagramflowchart LR
RSA["RSA Crate"]
ECDSA["ECDSA Crate"]
ED25519["Ed25519 Crate"]
HMAC["HMAC Crate"]
TOKEN["Token Crate"]
KEYPAIR["Core-Keypair Facade"]
X509["Core-X509 Facade"]
X509SPEC["Core-X509-Spec Facade"]
RSA -- "snapshot tests" --> SNAPSHOTS["Insta Snapshots"]
ECDSA -- "snapshot tests" --> SNAPSHOTS
ED25519 -- "snapshot tests" --> SNAPSHOTS
HMAC -- "snapshot tests" --> SNAPSHOTS
TOKEN -- "snapshot tests" --> SNAPSHOTS
KEYPAIR -- "integration tests" --> INTEGRATION["Integration Tests"]
X509 -- "integration tests" --> INTEGRATION
X509SPEC -- "integration tests" --> INTEGRATION
SNAPSHOTS -- "verify" --> DETERMINISM["Deterministic Generation"]
INTEGRATION -- "verify" --> REEXPORTS["Facade Re-exports"]
File Changes1. crates/uselesskey-rsa/tests/snapshots_rsa.rs
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
There was a problem hiding this comment.
Pull request overview
This PR adds snapshot tests (using insta) for the uselesskey-hmac, uselesskey-rsa, uselesskey-ed25519, uselesskey-ecdsa, and uselesskey-token crates, as well as integration ("facade") tests for uselesskey-core-keypair, uselesskey-core-x509, and uselesskey-core-x509-spec. These tests detect unintended changes in deterministic key/token generation and verify that re-exported public APIs are accessible and functional.
Changes:
- New
snapshots_*.rstest files for five algorithm/token crates, each capturing key/token metadata (lengths, PEM headers, algorithm labels) as insta YAML snapshots, with corresponding.snapfiles added. - New
*_facade_tests.rsandspec_integration_tests.rsintegration test files for three core facade crates, asserting correct behavior of re-exported types and builder APIs. Cargo.tomlandCargo.lockupdates to addinstaandserdeas dev-dependencies to the five snapshot-tested crates, plusrand_chacha/rand_coretouselesskey-core-x509.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
crates/uselesskey-token/tests/snapshots_token.rs |
Adds three snapshot tests for API key, bearer, and OAuth token shapes |
crates/uselesskey-token/tests/snapshots/*.snap |
Insta snapshot baselines for the three token shape tests |
crates/uselesskey-token/Cargo.toml |
Adds insta and serde dev-dependencies |
crates/uselesskey-rsa/tests/snapshots_rsa.rs |
Adds four snapshot tests for RSA 2048/4096 PEM shapes, key sizes, and corrupt PEM variants |
crates/uselesskey-rsa/tests/snapshots/*.snap |
Insta snapshot baselines for RSA tests |
crates/uselesskey-rsa/Cargo.toml |
Adds insta and serde dev-dependencies |
crates/uselesskey-hmac/tests/snapshots_hmac.rs |
Adds four snapshot tests for HMAC HS256/384/512 shapes and secret sizes |
crates/uselesskey-hmac/tests/snapshots/*.snap |
Insta snapshot baselines for HMAC tests |
crates/uselesskey-hmac/Cargo.toml |
Adds insta and serde dev-dependencies |
crates/uselesskey-ed25519/tests/snapshots_ed25519.rs |
Adds three snapshot tests for Ed25519 PEM shape, key sizes, and corrupt PEM variants |
crates/uselesskey-ed25519/tests/snapshots/*.snap |
Insta snapshot baselines for Ed25519 tests |
crates/uselesskey-ed25519/Cargo.toml |
Adds insta and serde dev-dependencies |
crates/uselesskey-ecdsa/tests/snapshots_ecdsa.rs |
Adds four snapshot tests for ECDSA P-256/P-384 PEM shapes, key sizes, and corrupt variants |
crates/uselesskey-ecdsa/tests/snapshots/*.snap |
Insta snapshot baselines for ECDSA tests |
crates/uselesskey-ecdsa/Cargo.toml |
Adds insta and serde dev-dependencies |
crates/uselesskey-core-x509/tests/x509_facade_tests.rs |
Integration tests verifying all X.509 negative/spec types and derive helpers are accessible |
crates/uselesskey-core-x509/Cargo.toml |
Adds rand_chacha and rand_core dev-dependencies |
crates/uselesskey-core-x509-spec/tests/spec_integration_tests.rs |
Integration tests for X509Spec, ChainSpec, KeyUsage, and NotBeforeOffset APIs |
crates/uselesskey-core-keypair/tests/keypair_facade_tests.rs |
Integration tests verifying Pkcs8SpkiKeyMaterial re-export is accessible and functional |
Cargo.lock |
Updated lock file reflecting new dev-dependency additions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| label: "snapshot-api-key", | ||
| kind: "api_key", | ||
| value_len: tok.value().len(), | ||
| value_prefix_len: tok.value().chars().take(4).count(), |
There was a problem hiding this comment.
The value_prefix_len field stores the result of tok.value().chars().take(4).count(), which will always return exactly 4 for any token with 4 or more characters. Since all generated tokens are much longer than 4 chars (value_len is 40 and 43 respectively), this field will never change and cannot detect any meaningful regression. Its name value_prefix_len is also misleading — it sounds like it should measure the length of a structural prefix (e.g., "uk_test_" is 8 chars), but it simply counts the first 4 characters.
Consider replacing this with a genuinely descriptive field such as prefix: tok.value()[..8].to_string() to snapshot the actual "uk_test_" prefix for API keys, or just removing the field.
| fn snapshot_bearer_shape() { | ||
| let fx = fx(); | ||
| let tok = fx.token("snapshot-bearer", TokenSpec::bearer()); | ||
|
|
There was a problem hiding this comment.
Same issue as in snapshot_api_key_shape: tok.value().chars().take(4).count() always returns 4 for any token longer than 4 characters (bearer tokens have value_len: 43). This field adds no regression-detection value.
add5bec to
e8ef4f0
Compare
- Add insta snapshot tests for RSA, ECDSA, Ed25519, HMAC, and Token crates - Add integration tests for core-keypair, core-x509, and core-x509-spec facades - Add insta and serde dev-dependencies to key type crates Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…h starts_with_uk_test The value_prefix_len field always returned 4 and provided no regression detection. Replaced with starts_with_uk_test (bool) which verifies the structural API key prefix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Snapshot files contain PEM header shapes for testing but not real secret material. Key bytes are redacted with [REDACTED]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When workspace crates haven't been published to crates.io yet, cargo package fails with 'no matching package named' errors. This is expected for a first publish. Treat these as warnings instead of failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…snapshots Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e8ef4f0 to
2e067ae
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds snapshot tests (insta) and integration tests for previously untested facade crates.