Skip to content

test(pkcs11-mock): cover invalid-handle paths, domain constant, and copy/clone semantics#707

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/coverage-pkcs11-mock-Xmgd3
May 16, 2026
Merged

test(pkcs11-mock): cover invalid-handle paths, domain constant, and copy/clone semantics#707
EffortlessSteven merged 1 commit into
mainfrom
claude/coverage-pkcs11-mock-Xmgd3

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Closes inline test-coverage gaps in uselesskey-pkcs11-mock without touching production code.

  • Pin DOMAIN_PKCS11_MOCK = "uselesskey:pkcs11:mock:v1" so an accidental rename trips CI rather than silently drifting derived fixtures downstream.
  • Cover the None/false error paths on MockPkcs11Provider::sign, verify, certificate_der, and key_label with unknown KeyHandle values (below the 1-based range and above the populated range).
  • Assert KeyHandle Copy/Clone semantics: equal-comparing distinct values, usable as HashMap keys (insert via copy collides), and de-duplicated by HashSet.
  • Round-trip SlotTokenInfo through Clone, Debug, and equality; verify mutating the clone does not affect the original and that Debug names every field.
  • Multi-step monotonicity assertion for next_sign_count pinning the +1 semantic across five successive calls.

New tests use uselesskey_test_support::{TestResult, require_ok, require_some} per the no-panic-family policy; added uselesskey-test-support as a dev-dependency.

Test plan

  • cargo test -p uselesskey-pkcs11-mock (20 passed, 0 failed)
  • cargo clippy -p uselesskey-pkcs11-mock --all-targets -- -D warnings
  • cargo fmt -p uselesskey-pkcs11-mock

https://claude.ai/code/session_TODO

Co-authored-by: Claude noreply@anthropic.com


Generated by Claude Code

…opy/clone semantics

- Pin DOMAIN_PKCS11_MOCK to "uselesskey:pkcs11:mock:v1" so a rename trips CI.
- Cover sign/verify/certificate_der/key_label error paths with unknown KeyHandle values.
- Assert KeyHandle Copy/Clone produce equal-comparing values usable in HashMap/HashSet.
- Round-trip SlotTokenInfo through Clone, Debug, and equality (incl. divergence after mutation).
- Multi-step monotonicity assertion for next_sign_count pinning the +1 semantic.
- Add uselesskey-test-support dev-dep; new tests use TestResult/require_ok/require_some.

https://claude.ai/code/session_TODO

Co-authored-by: Claude <noreply@anthropic.com>
@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!

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8734ff47-24a4-4d41-b2d5-b3ea03ae06a4

📥 Commits

Reviewing files that changed from the base of the PR and between 5be9464 and 13c7980.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • crates/uselesskey-pkcs11-mock/Cargo.toml
  • crates/uselesskey-pkcs11-mock/src/lib.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/coverage-pkcs11-mock-Xmgd3

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.

@EffortlessSteven EffortlessSteven marked this pull request as ready for review May 16, 2026 07:45
@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.

@EffortlessSteven EffortlessSteven merged commit c88f0f9 into main May 16, 2026
6 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.

2 participants