Skip to content

test: Wave 10 - snapshot tests and facade integration tests#36

Merged
EffortlessSteven merged 9 commits intomainfrom
wave-10/untested-crates
Mar 1, 2026
Merged

test: Wave 10 - snapshot tests and facade integration tests#36
EffortlessSteven merged 9 commits intomainfrom
wave-10/untested-crates

Conversation

@EffortlessSteven
Copy link
Copy Markdown
Member

Adds snapshot tests (insta) and integration tests for previously untested facade crates.

Copilot AI review requested due to automatic review settings March 1, 2026 04:24
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 1, 2026

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 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.

📥 Commits

Reviewing files that changed from the base of the PR and between bdfabd0 and e30ec75.

⛔ Files ignored due to path filters (19)
  • Cargo.lock is excluded by !**/*.lock
  • crates/uselesskey-ecdsa/tests/snapshots/snapshots_ecdsa__ecdsa_corrupt_pem_variants.snap is excluded by !**/*.snap
  • crates/uselesskey-ecdsa/tests/snapshots/snapshots_ecdsa__ecdsa_key_sizes.snap is excluded by !**/*.snap
  • crates/uselesskey-ecdsa/tests/snapshots/snapshots_ecdsa__ecdsa_p256_pem_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-ecdsa/tests/snapshots/snapshots_ecdsa__ecdsa_p384_pem_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-ed25519/tests/snapshots/snapshots_ed25519__ed25519_corrupt_pem_variants.snap is excluded by !**/*.snap
  • crates/uselesskey-ed25519/tests/snapshots/snapshots_ed25519__ed25519_key_sizes.snap is excluded by !**/*.snap
  • crates/uselesskey-ed25519/tests/snapshots/snapshots_ed25519__ed25519_pem_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-hmac/tests/snapshots/snapshots_hmac__hmac_hs256_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-hmac/tests/snapshots/snapshots_hmac__hmac_hs384_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-hmac/tests/snapshots/snapshots_hmac__hmac_hs512_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-hmac/tests/snapshots/snapshots_hmac__hmac_secret_sizes.snap is excluded by !**/*.snap
  • crates/uselesskey-rsa/tests/snapshots/snapshots_rsa__rsa_2048_pem_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-rsa/tests/snapshots/snapshots_rsa__rsa_4096_pem_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-rsa/tests/snapshots/snapshots_rsa__rsa_corrupt_pem_variants.snap is excluded by !**/*.snap
  • crates/uselesskey-rsa/tests/snapshots/snapshots_rsa__rsa_key_sizes.snap is excluded by !**/*.snap
  • crates/uselesskey-token/tests/snapshots/snapshots_token__token_api_key_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-token/tests/snapshots/snapshots_token__token_bearer_shape.snap is excluded by !**/*.snap
  • crates/uselesskey-token/tests/snapshots/snapshots_token__token_oauth_jwt_shape.snap is excluded by !**/*.snap
📒 Files selected for processing (15)
  • crates/uselesskey-core-keypair/tests/keypair_facade_tests.rs
  • crates/uselesskey-core-x509-spec/tests/spec_integration_tests.rs
  • crates/uselesskey-core-x509/Cargo.toml
  • crates/uselesskey-core-x509/tests/x509_facade_tests.rs
  • crates/uselesskey-ecdsa/Cargo.toml
  • crates/uselesskey-ecdsa/tests/snapshots_ecdsa.rs
  • crates/uselesskey-ed25519/Cargo.toml
  • crates/uselesskey-ed25519/tests/snapshots_ed25519.rs
  • crates/uselesskey-hmac/Cargo.toml
  • crates/uselesskey-hmac/tests/snapshots_hmac.rs
  • crates/uselesskey-rsa/Cargo.toml
  • crates/uselesskey-rsa/tests/snapshots_rsa.rs
  • crates/uselesskey-token/Cargo.toml
  • crates/uselesskey-token/tests/snapshots_token.rs
  • xtask/src/main.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wave-10/untested-crates

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.

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Add snapshot and integration tests for untested crates (Wave 10)

🧪 Tests

Grey Divider

Walkthroughs

Description
• 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
Diagram
flowchart 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"]
Loading

Grey Divider

File Changes

1. crates/uselesskey-rsa/tests/snapshots_rsa.rs 🧪 Tests +134/-0

Insta snapshot tests for RSA key generation

crates/uselesskey-rsa/tests/snapshots_rsa.rs


2. crates/uselesskey-ecdsa/tests/snapshots_ecdsa.rs 🧪 Tests +124/-0

Insta snapshot tests for ECDSA key generation

crates/uselesskey-ecdsa/tests/snapshots_ecdsa.rs


3. crates/uselesskey-ed25519/tests/snapshots_ed25519.rs 🧪 Tests +99/-0

Insta snapshot tests for Ed25519 key generation

crates/uselesskey-ed25519/tests/snapshots_ed25519.rs


View more (11)
4. crates/uselesskey-hmac/tests/snapshots_hmac.rs 🧪 Tests +99/-0

Insta snapshot tests for HMAC secret generation

crates/uselesskey-hmac/tests/snapshots_hmac.rs


5. crates/uselesskey-token/tests/snapshots_token.rs 🧪 Tests +76/-0

Insta snapshot tests for token generation

crates/uselesskey-token/tests/snapshots_token.rs


6. crates/uselesskey-core-keypair/tests/keypair_facade_tests.rs 🧪 Tests +60/-0

Integration tests for keypair facade re-exports

crates/uselesskey-core-keypair/tests/keypair_facade_tests.rs


7. crates/uselesskey-core-x509/tests/x509_facade_tests.rs 🧪 Tests +116/-0

Integration tests for X.509 facade re-exports

crates/uselesskey-core-x509/tests/x509_facade_tests.rs


8. crates/uselesskey-core-x509-spec/tests/spec_integration_tests.rs 🧪 Tests +110/-0

Integration tests for X.509 spec facade types

crates/uselesskey-core-x509-spec/tests/spec_integration_tests.rs


9. crates/uselesskey-rsa/Cargo.toml Dependencies +2/-0

Add insta and serde dev-dependencies

crates/uselesskey-rsa/Cargo.toml


10. crates/uselesskey-ecdsa/Cargo.toml Dependencies +3/-1

Add insta and serde dev-dependencies

crates/uselesskey-ecdsa/Cargo.toml


11. crates/uselesskey-ed25519/Cargo.toml Dependencies +3/-1

Add insta and serde dev-dependencies

crates/uselesskey-ed25519/Cargo.toml


12. crates/uselesskey-hmac/Cargo.toml Dependencies +2/-0

Add insta and serde dev-dependencies

crates/uselesskey-hmac/Cargo.toml


13. crates/uselesskey-token/Cargo.toml Dependencies +3/-1

Add insta and serde dev-dependencies

crates/uselesskey-token/Cargo.toml


14. crates/uselesskey-core-x509/Cargo.toml Dependencies +2/-0

Add rand_chacha and rand_core dev-dependencies

crates/uselesskey-core-x509/Cargo.toml


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Mar 1, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_*.rs test files for five algorithm/token crates, each capturing key/token metadata (lengths, PEM headers, algorithm labels) as insta YAML snapshots, with corresponding .snap files added.
  • New *_facade_tests.rs and spec_integration_tests.rs integration test files for three core facade crates, asserting correct behavior of re-exported types and builder APIs.
  • Cargo.toml and Cargo.lock updates to add insta and serde as dev-dependencies to the five snapshot-tested crates, plus rand_chacha/rand_core to uselesskey-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(),
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
fn snapshot_bearer_shape() {
let fx = fx();
let tok = fx.token("snapshot-bearer", TokenSpec::bearer());

Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@EffortlessSteven EffortlessSteven force-pushed the wave-10/untested-crates branch from add5bec to e8ef4f0 Compare March 1, 2026 17:13
EffortlessSteven and others added 8 commits March 1, 2026 12:20
- 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>
@EffortlessSteven EffortlessSteven force-pushed the wave-10/untested-crates branch from e8ef4f0 to 2e067ae Compare March 1, 2026 17:20
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@EffortlessSteven EffortlessSteven merged commit acdace2 into main Mar 1, 2026
4 checks passed
@EffortlessSteven EffortlessSteven deleted the wave-10/untested-crates branch March 5, 2026 15:12
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.

2 participants