Skip to content

test(cli): cover materialize kinds and label-normalization edges#747

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/cli-materialize-kinds-coverage
May 16, 2026
Merged

test(cli): cover materialize kinds and label-normalization edges#747
EffortlessSteven merged 1 commit into
mainfrom
claude/cli-materialize-kinds-coverage

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Adds crates/uselesskey-cli/tests/materialize_kinds.rs exercising materialize paths that the existing binary-level tests do not reach.

Tests added (11):

Materialize kinds

  • PemBlockShape produces a valid -----BEGIN <LABEL>----- block with a base64 body
  • PemBlockShape with a label of only special chars normalizes to ___
  • PemBlockShape with label = None falls back to the file-stem-derived label (named.pemNAMED)
  • TokenApiKey produces a non-empty, dot-free token (distinguishes it from JWT shape)
  • TokenApiKey is deterministic across separate materialize runs
  • SshPublicKeyShape with label = None uses the sanitized file stem as the SSH comment
  • EntropyBytes defaults to 32 bytes when len is unset

Error paths

  • materialize_manifest_to_dir returns InvalidManifest on an empty manifest
  • emit_include_bytes_module returns InvalidManifest on an empty manifest
  • emit_include_bytes_module rejects two specs whose ids both normalize to KEY_A
  • emit_include_bytes_module prefixes _ for a digit-leading id (2fa-secret_2FA_SECRET)

Test plan

  • cargo test -p uselesskey-cli --test materialize_kinds — 11/11 pass
  • cargo clippy -p uselesskey-cli --tests --all-features — clean
  • cargo fmt --check

Generated by Claude Code

Add `tests/materialize_kinds.rs` exercising paths that the binary-level CLI
tests don't reach via the manifest CLI:

- `MaterializeKind::PemBlockShape` emits a valid base64 body inside the
  normalized BEGIN/END markers (including label fallback when `label = None`).
- `MaterializeKind::TokenApiKey` produces a non-empty, non-JWT-shaped token
  deterministically across runs.
- `MaterializeKind::EntropyBytes` defaults to 32 bytes when `len` is unset.
- `MaterializeKind::SshPublicKeyShape` falls back to the sanitized file stem
  as the SSH comment when `label = None`.
- `materialize_manifest_to_dir` and `emit_include_bytes_module` reject empty
  manifests with `InvalidManifest`.
- `emit_include_bytes_module` rejects two specs whose ids collide on the
  emitted constant name (`KEY_A`).
- `emit_include_bytes_module` prefixes `_` for digit-leading ids
  (`2fa-secret` → `_2FA_SECRET`).
@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 40 minutes and 15 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: 5ff5b415-0464-4f31-966d-b19ea1420827

📥 Commits

Reviewing files that changed from the base of the PR and between 89f7cad and bf255d0.

📒 Files selected for processing (1)
  • crates/uselesskey-cli/tests/materialize_kinds.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/cli-materialize-kinds-coverage

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 20:47
@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!

@EffortlessSteven EffortlessSteven merged commit 4c2da13 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