Skip to content

test(hmac): cover label/spec/kid accessors and jwk use field across all specs#700

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/cov-hmac-spec-variants
May 16, 2026
Merged

test(hmac): cover label/spec/kid accessors and jwk use field across all specs#700
EffortlessSteven merged 1 commit into
mainfrom
claude/cov-hmac-spec-variants

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Closes accessor-coverage gaps in uselesskey-hmac where existing tests only exercised one HmacSpec variant. No production code changes.

Gaps closed

Area What was missing New test
label() / spec() accessors per variant Only HS512 was tested; HS256/HS384 were never read back accessors_round_trip_for_all_specs
secret_bytes().len() per variant Verified at the type level via doctest, but not in an end-to-end test that cycles through all three variants same
Clone on HmacSecret Derive present but never exercised; secret_bytes equality after clone never verified cloned_secret_preserves_bytes_and_accessors_for_all_specs
JWK use = "sig" per variant Only checked for HS512 jwk_use_field_is_sig_for_all_specs
kid() determinism per variant Only HS256 (via kid_is_deterministic) verified that two factories produced the same kid; HS384 and HS512 were untested kid_is_deterministic_for_all_specs
kid() distinctness across specs Same label + different spec → different kid (because secret_bytes length varies) was never verified kid_differs_across_specs_for_same_label

5 new tests, gated on #[cfg(feature = "jwk")] where appropriate. All tests use Factory::deterministic_from_str and avoid .expect()/.unwrap(), keeping the no-panic-family check at zero new debt.

Test plan

  • cargo test -p uselesskey-hmac --test accessors — 3/3 pass (default features)
  • cargo test -p uselesskey-hmac --test accessors --features jwk — 6/6 pass
  • cargo clippy -p uselesskey-hmac --tests --all-features -- -D warnings
  • cargo xtask check-no-panic-family — only the pre-existing xtask/src/user_path_smoke.rs:126 debt remains
  • cargo fmt --check -p uselesskey-hmac

https://claude.ai/code/session_01R9SN1o9XoVTaVxj9w4VMzD


Generated by Claude Code

…ll specs

Adds 5 tests to `crates/uselesskey-hmac/tests/accessors.rs` that close
coverage gaps where existing tests only exercised one HmacSpec variant
(usually HS512):

- `label`/`spec`/`secret_bytes()` accessors validated for HS256, HS384,
  HS512 with their expected byte lengths (32/48/64)
- `Clone` on `HmacSecret` preserves label, spec, and secret_bytes for
  every variant
- JWK `use` field is "sig" across all specs (only HS512 was checked)
- `kid()` is deterministic across separate factories for HS256/HS384/HS512
  (only HS256 was previously verified)
- `kid()` differs across specs for the same label, reflecting that the
  spec is part of the cache identity and the kid is derived from secret
  bytes whose length differs by spec

No production code changes. Tests use `Factory::deterministic_from_str`
and avoid `.expect()`/`.unwrap()` so no new no-panic-family debt.

https://claude.ai/code/session_01R9SN1o9XoVTaVxj9w4VMzD
@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 29 minutes and 19 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: ca0052b4-9a87-46d3-b412-afdbdb793fd4

📥 Commits

Reviewing files that changed from the base of the PR and between fad488d and 0811b02.

📒 Files selected for processing (1)
  • crates/uselesskey-hmac/tests/accessors.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/cov-hmac-spec-variants

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 02:40
@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 283e47c 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