Skip to content

feat(api): add missing spec() and label() accessors#266

Merged
EffortlessSteven merged 2 commits into
mainfrom
feat/consistent-spec-label-accessors
Mar 17, 2026
Merged

feat(api): add missing spec() and label() accessors#266
EffortlessSteven merged 2 commits into
mainfrom
feat/consistent-spec-label-accessors

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

  • Fixture types inconsistently exposed their spec and label fields — some had accessors, some didn't
  • Added spec() and label() to RsaKeyPair, Ed25519KeyPair, HmacSecret, TokenFixture
  • Added label() to EcdsaKeyPair and PgpKeyPair (which already had spec())
  • All accessors follow the established pattern with doc comments and runnable examples

Test plan

  • cargo check --workspace --all-features passes
  • cargo test passes for all 6 affected crates including new doctests

Add spec() and label() accessor methods to fixture types that were
missing them, ensuring all fixture types expose a consistent API surface.
@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 Mar 15, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 93757ec2-3f46-4d8c-9881-3c1af63c12c4

📥 Commits

Reviewing files that changed from the base of the PR and between 080f104 and d149e10.

📒 Files selected for processing (13)
  • .cargo/mutants.toml
  • crates/uselesskey-ecdsa/src/keypair.rs
  • crates/uselesskey-ecdsa/tests/accessors.rs
  • crates/uselesskey-ed25519/src/keypair.rs
  • crates/uselesskey-ed25519/tests/accessors.rs
  • crates/uselesskey-hmac/src/secret.rs
  • crates/uselesskey-hmac/tests/accessors.rs
  • crates/uselesskey-pgp/src/keypair.rs
  • crates/uselesskey-pgp/tests/accessors.rs
  • crates/uselesskey-rsa/src/keypair.rs
  • crates/uselesskey-rsa/tests/accessors.rs
  • crates/uselesskey-token/src/token.rs
  • crates/uselesskey-token/tests/accessors.rs

Summary by CodeRabbit

  • New Features

    • Added public accessor methods across cryptographic key types: spec() to retrieve the spec configuration and label() to retrieve the label string for Ed25519, ECDSA, RSA, HMAC, PGP, and token fixtures.
  • Tests

    • Added comprehensive test coverage for the new accessor methods to verify round-trip consistency across all key types.
  • Chores

    • Updated mutation testing configuration to exclude equivalent mutation patterns.

Walkthrough

This PR adds public accessor methods (spec() and/or label()) across six cryptographic utility crates to expose previously internal keypair/secret metadata. Corresponding test files validate round-trip accessor functionality, and a mutation test exclusion is added to mark semantically equivalent Ed25519 mutations as unkillable.

Changes

Cohort / File(s) Summary
Mutation Testing Configuration
.cargo/mutants.toml
Adds exclusion rule for Ed25519KeyPair mutations equivalent to Default::default, mirroring existing singleton accessor patterns.
ECDSA Accessors
crates/uselesskey-ecdsa/src/keypair.rs, crates/uselesskey-ecdsa/tests/accessors.rs
Adds label() accessor to EcdsaKeyPair and introduces test validating spec and label round-tripping.
Ed25519 Accessors
crates/uselesskey-ed25519/src/keypair.rs, crates/uselesskey-ed25519/tests/accessors.rs
Adds spec() and label() accessors to Ed25519KeyPair with accompanying round-trip test.
HMAC Accessors
crates/uselesskey-hmac/src/secret.rs, crates/uselesskey-hmac/tests/accessors.rs
Adds spec() and label() accessors to HmacSecret and new test verifying accessor preservation.
PGP Accessors
crates/uselesskey-pgp/src/keypair.rs, crates/uselesskey-pgp/tests/accessors.rs
Adds label() accessor to PgpKeyPair with test validation for round-trip spec and label retrieval.
RSA Accessors
crates/uselesskey-rsa/src/keypair.rs, crates/uselesskey-rsa/tests/accessors.rs
Adds spec() and label() accessors to RsaKeyPair with test ensuring round-trip accessor accuracy.
Token Fixture Accessors
crates/uselesskey-token/src/token.rs, crates/uselesskey-token/tests/accessors.rs
Adds spec() and label() accessors to TokenFixture with test validating OAuth access token round-trip behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop, hop! New methods spring to light,
Accessor getters, oh what delight—
Specs and labels now exposed with care,
Each secret crate now lets tests compare,
Round-tripped values, perfectly fair! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(api): add missing spec() and label() accessors' directly and concisely describes the main change: adding spec() and label() accessor methods across multiple fixture types for API consistency.
Description check ✅ Passed The description clearly relates to the changeset by detailing which fixture types received spec() and label() accessors, following the established pattern, and including test coverage confirmation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/consistent-spec-label-accessors
📝 Coding Plan
  • Generate coding plan for human review comments

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 660cf42 into main Mar 17, 2026
2 of 4 checks passed
@EffortlessSteven EffortlessSteven deleted the feat/consistent-spec-label-accessors branch April 3, 2026 04:38
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.

1 participant