Skip to content

test(core): expand TempArtifact unit coverage#824

Merged
EffortlessSteven merged 2 commits into
mainfrom
codex/improve-unit-testing-s1cho9
May 19, 2026
Merged

test(core): expand TempArtifact unit coverage#824
EffortlessSteven merged 2 commits into
mainfrom
codex/improve-unit-testing-s1cho9

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Motivation

  • Improve unit-test coverage for the public sink::TempArtifact wrapper to exercise lifecycle behavior and encoding edge-cases.
  • Ensure the wrapper's behavior mirrors the internal tempfile-backed implementation: file exists while the artifact lives and is deleted on drop, and read_to_string() preserves replacement-character semantics for invalid UTF-8.

Description

  • Added imports for std::thread and std::time::Duration to support polling of filesystem cleanup in tests.
  • Added temp_artifact_exposes_live_path_and_deletes_on_drop test that asserts TempArtifact::path() points to an existing file while alive and that the tempfile is removed after the wrapper is dropped.
  • Added temp_artifact_read_to_string_replaces_invalid_utf8 test that verifies read_to_string() surfaces the Unicode replacement character for invalid UTF-8 bytes via the public sink::TempArtifact API.
  • Kept existing round-trip tests (new_string and new_bytes) intact to preserve basic coverage.

Testing

  • Ran the targeted unit test with cargo test -p uselesskey-core temp_artifact_exposes_live_path_and_deletes_on_drop -- --nocapture, which passed.
  • Ran the module-level test filter with cargo test -p uselesskey-core sink::mod::tests -- --nocapture; the command executed in the CI-like workspace (initially produced zero selected tests due to filter matching), and the follow-up exact test run passed.

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!

@coderabbitai

coderabbitai Bot commented May 18, 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 43 minutes 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: 688fff84-1af3-4cf6-9ec3-9d70be5c6e0e

📥 Commits

Reviewing files that changed from the base of the PR and between 77f9f0b and b11627b.

📒 Files selected for processing (1)
  • crates/uselesskey-core/src/sink/mod.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/improve-unit-testing-s1cho9

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 50cf68e into main May 19, 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