Skip to content

test: add comprehensive corruption validity tests for uselesskey-core-negative#173

Merged
EffortlessSteven merged 1 commit into
mainfrom
wave-148/impl
Mar 5, 2026
Merged

test: add comprehensive corruption validity tests for uselesskey-core-negative#173
EffortlessSteven merged 1 commit into
mainfrom
wave-148/impl

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Add 37 integration tests in crates/uselesskey-core-negative/tests/corruption_validity.rs that validate the structural correctness of negative fixtures produced by this facade crate.

What's tested

Category Tests
PEM structural invalidity All 5 CorruptPem variants produce output that fails PEM structure validation (header/footer mismatch, bad base64, blank lines)
Truncated DER is exact prefix Parameterized tests verify truncated output is byte-identical to the original prefix
flip_byte involution Double-flip restores original; XOR mask is exactly 0x01
All PEM label types Corruption tested across RSA PRIVATE KEY, PUBLIC KEY, EC PRIVATE KEY, CERTIFICATE, PRIVATE KEY
Deterministic variant isolation Different variants produce different outputs; same variant on different inputs differs
Stability across 1000 calls Both PEM and DER deterministic corruption is stable
Unicode safety CorruptPem::Truncate operates on chars, not bytes
Section preservation BadHeader preserves body+footer; BadFooter preserves header+body; etc.
DER corruption bounds Output never exceeds original length
All arms reachable All 5 PEM and all 3 DER deterministic dispatch arms are hit
Edge cases Zero/exact/beyond truncation, single-byte DER, two-byte DER

Validation

  • \cargo test -p uselesskey-core-negative --test corruption_validity\ — 37/37 pass
  • \cargo fmt --all\ — clean
  • \cargo clippy -p uselesskey-core-negative -- -D warnings\ — clean

@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 Mar 2, 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 9 minutes and 6 seconds before requesting another review.

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

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 04570162-2897-4b83-85d9-93242011b5e6

📥 Commits

Reviewing files that changed from the base of the PR and between 592629c and ee277bd.

📒 Files selected for processing (1)
  • crates/uselesskey-core-negative/tests/corruption_validity.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wave-148/impl

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 force-pushed the wave-148/impl branch 5 times, most recently from c1e595c to d9550ad Compare March 5, 2026 13:52
…-negative

Add 37 integration tests in corruption_validity.rs covering:

- All CorruptPem variants produce structurally invalid PEM (validated
  by checking header/footer mismatch, bad base64 chars, blank lines)
- Truncated DER outputs are exact byte-prefixes of the original
- flip_byte is involutory (double-flip restores original) with XOR 0x01
- Corruption works across all common PEM label types (RSA, EC, CERT, etc.)
- Deterministic corruption is isolated per-variant (no cross-talk)
- Deterministic stability verified across 1000 repeated calls
- CorruptPem::Truncate operates on chars, not bytes (Unicode safety)
- Each variant preserves untouched PEM sections (header/body/footer)
- DER corruption never exceeds original length
- All five PEM and all three DER deterministic arms are reachable
- Edge cases: zero/exact/beyond truncation, single-byte DER, two-byte DER

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@EffortlessSteven EffortlessSteven merged commit d25f442 into main Mar 5, 2026
3 of 4 checks passed
@EffortlessSteven EffortlessSteven deleted the wave-148/impl branch March 5, 2026 15:22
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