Skip to content

test(jsonwebtoken): cover header kid/alg/typ round-trips and Validation knobs#741

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/cover-jsonwebtoken-header-validation
May 16, 2026
Merged

test(jsonwebtoken): cover header kid/alg/typ round-trips and Validation knobs#741
EffortlessSteven merged 1 commit into
mainfrom
claude/cover-jsonwebtoken-header-validation

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Add a focused, no-panic-style test file to uselesskey-jsonwebtoken covering paths that the existing tests do not exercise:

  • Header.kid/alg/typ round-tripping through encode -> decode_header -> decode, for every JwtKeyExt impl (RSA, ECDSA, Ed25519, HMAC).
  • Validation::set_issuer accept and reject branches (InvalidIssuer).
  • Validation::validate_nbf rejecting not-yet-valid tokens (ImmatureSignature).
  • Validation::set_required_spec_claims rejecting tokens missing a required claim (MissingRequiredClaim).
  • Validation::leeway = 0 vs leeway = 600 around jsonwebtoken's default 60s leeway (ExpiredSignature).

All assertions use uselesskey_test_support::{ensure, ensure_eq, require_ok}; no .unwrap() / .expect() is introduced. cargo xtask check-no-panic-family reports the same 3 pre-existing x509 debt sites it does on origin/main -- the new test file adds zero new debt.

Files

  • crates/uselesskey-jsonwebtoken/tests/header_and_validation.rs (new, 9 tests)
  • crates/uselesskey-jsonwebtoken/Cargo.toml (+1 dev-dep on uselesskey-test-support)
  • Cargo.lock (lockfile update for the dev-dep)

Test plan

  • cargo test -p uselesskey-jsonwebtoken --test header_and_validation --features all -> 9 passed
  • cargo test -p uselesskey-jsonwebtoken --all-features -> all suites green
  • cargo clippy -p uselesskey-jsonwebtoken --all-targets --all-features -- -D warnings -> clean
  • cargo xtask check-no-panic-family -> no new debt attributable to this PR

https://claude.ai/code/session_0116SGvHnLaoXXd6wz2U9SvM


Generated by Claude Code

…on knobs

Pin adapter behaviour for code paths the existing tests don't exercise:
Header.kid/alg/typ surviving encode -> decode_header -> decode for every
JwtKeyExt impl (RSA/ECDSA/Ed25519/HMAC), and the Validation knobs for
issuer, validate_nbf, set_required_spec_claims, and leeway. Uses the
uselesskey_test_support helpers so no new no-panic-family debt is added.

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 49 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: 4f93d01d-7045-417e-ad0b-c4f2ab7d622a

📥 Commits

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

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

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:44
@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 24b3231 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