Skip to content

test(x509): cover params helpers and clone-share invariants#742

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/cover-x509-params-helpers
May 16, 2026
Merged

test(x509): cover params helpers and clone-share invariants#742
EffortlessSteven merged 2 commits into
mainfrom
claude/cover-x509-params-helpers

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Adds a single new test file crates/uselesskey-x509/tests/params_helper_coverage.rs (11 small tests, ~370 lines) that fills focused gaps in uselesskey-x509:

cert/params.rs helper branches

  • apply_not_before(DaysFromNow) on a positive (non-negative) fixture — the existing tests only exercise DaysFromNow indirectly via the NotYetValid negative variant.
  • add_sorted_dns_sans dedup observable in the actual generated cert (currently only the stable_bytes dedup is asserted).
  • ca_constraint true arm via with_is_ca(true) alone — separate from self_signed_ca which flips both is_ca and key_usage.
  • key_usage_purposes empty-vec branch when every KeyUsage bit is false.

chain/params.rs builder branches

  • with_intermediate_validity_days and with_intermediate_not_before actually reach the generated intermediate cert.
  • intermediate_is_ca(Some(true)) keeps the CA flag — the explicit Some(true) arm of unwrap_or(true) (the None arm is covered by every good-chain test).

Derived-trait and clone invariants

  • X509Negative / ChainNegative round-trip through HashMap / HashSet (Eq / Hash / Clone / Debug), including HostnameMismatch field equality.
  • NotBeforeOffset::default() == DaysAgo(1).
  • X509Cert::clone and X509Chain::clone share the underlying Arc<Inner> buffers (verified via slice pointer equality on cert_der() / cert_pem()).

Uses uselesskey_test_support::{ensure, ensure_eq, require_ok, require_some} — no .unwrap() or .expect() in tests, no new no-panic-family debt introduced.

Test plan

  • cargo test -p uselesskey-x509 --test params_helper_coverage (11/11 pass)
  • cargo test -p uselesskey-x509 (full suite, all targets pass)
  • cargo clippy -p uselesskey-x509 --all-targets -- -D warnings
  • cargo xtask check-no-panic-family — new file introduces no new debt (the 3 new-debt sites flagged by the tool are pre-existing in src/cert.rs:486, src/cert/material.rs:18, src/cert/params.rs:96 on origin/main from the SRP refactor; not touched by this PR).

https://claude.ai/code/session_0116SGvHnLaoXXd6wz2U9SvM


Generated by Claude Code

Add focused unit-test coverage for under-tested paths in uselesskey-x509:

- cert/params.rs: DaysFromNow not_before path on positive fixtures, SAN
  dedup observable in the generated cert, with_is_ca(true) alone, and
  the all-false key_usage_purposes branch.
- chain/params.rs: intermediate validity / not_before overrides reach the
  cert, and intermediate_is_ca(Some(true)) keeps the CA flag and CA key
  usage (the explicit-true arm of unwrap_or(true)).
- Derived-trait invariants: X509Negative / ChainNegative round-trip
  through HashMap / HashSet (Eq / Hash / Clone / Debug), and the
  NotBeforeOffset default value.
- Arc sharing: X509Cert::clone and X509Chain::clone reuse the same
  underlying buffers, verified via slice pointer equality.

Uses uselesskey_test_support::{ensure, ensure_eq, require_ok,
require_some} throughout to avoid new no-panic-family debt.

https://claude.ai/code/session_0116SGvHnLaoXXd6wz2U9SvM
@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 28 minutes and 21 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: 0c9e3543-0d43-41aa-8f15-fde108295347

📥 Commits

Reviewing files that changed from the base of the PR and between ac9aba2 and ccf86e3.

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

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 09:45
@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.

@EffortlessSteven EffortlessSteven merged commit 6b94086 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