test(jsonwebtoken): cover header kid/alg/typ round-trips and Validation knobs#741
Conversation
…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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Add a focused, no-panic-style test file to
uselesskey-jsonwebtokencovering paths that the existing tests do not exercise:Header.kid/alg/typround-tripping throughencode->decode_header->decode, for everyJwtKeyExtimpl (RSA, ECDSA, Ed25519, HMAC).Validation::set_issueraccept and reject branches (InvalidIssuer).Validation::validate_nbfrejecting not-yet-valid tokens (ImmatureSignature).Validation::set_required_spec_claimsrejecting tokens missing a required claim (MissingRequiredClaim).Validation::leeway = 0vsleeway = 600aroundjsonwebtoken'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-familyreports the same 3 pre-existing x509 debt sites it does onorigin/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 onuselesskey-test-support)Cargo.lock(lockfile update for the dev-dep)Test plan
cargo test -p uselesskey-jsonwebtoken --test header_and_validation --features all-> 9 passedcargo test -p uselesskey-jsonwebtoken --all-features-> all suites greencargo clippy -p uselesskey-jsonwebtoken --all-targets --all-features -- -D warnings-> cleancargo xtask check-no-panic-family-> no new debt attributable to this PRhttps://claude.ai/code/session_0116SGvHnLaoXXd6wz2U9SvM
Generated by Claude Code