Skip to content

Refactor token JWT helper construction#769

Merged
EffortlessSteven merged 2 commits into
mainfrom
codex/refactor-code-for-dry-principles-djwsj9
May 17, 2026
Merged

Refactor token JWT helper construction#769
EffortlessSteven merged 2 commits into
mainfrom
codex/refactor-code-for-dry-principles-djwsj9

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Motivation

  • Remove repeated JWT segment destructuring and formatting to make negative-token generation more DRY and readable.
  • Centralize JWT segment/object mutations so future changes to token shape or encoding are localized.

Description

  • Introduce a small JwtParts helper (struct JwtParts { header, payload, signature }) with constructors and mutation helpers (generated, with_header_segment, with_payload_segment, with_header_object, with_payload_object, payload_object, into_token) in crates/uselesskey-token/src/srp/shape.rs.
  • Replace ad-hoc tuple destructuring/format! uses with JwtParts calls in negative-variant helpers such as malformed_jwt_segment_count, bad_base64url_segment, invalid_jwt_header_shape, missing_alg, mismatched_kid, not_yet_valid_claims, token_with_header_claim, and token_with_payload_claim.
  • Keep public behavior unchanged while reducing duplicated code paths and making header/payload manipulation explicit and composable.

Testing

  • Ran cargo test -p uselesskey-token to exercise the crate test suite.
  • All automated tests for the uselesskey-token crate passed (no failures).

Codex Task

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

@coderabbitai

coderabbitai Bot commented May 17, 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 40 minutes and 5 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: 0e170b36-99ca-4bd3-a325-9f2ce70a96fa

📥 Commits

Reviewing files that changed from the base of the PR and between e6c5229 and 18f17f4.

📒 Files selected for processing (1)
  • crates/uselesskey-token/src/srp/shape.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/refactor-code-for-dry-principles-djwsj9

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 merged commit 458b049 into main May 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant