test: add unit tests for rate-limit artifact cleanup#33
Open
mtibbits wants to merge 1 commit into
Open
Conversation
3ba17c7 to
e78764a
Compare
Covers _cleanup_rate_limit_artifacts() and _do_cleanup_rate_limit_artifacts() from PR JCSnap#32. Uses tmp_path-based fake ~/.claude/ directories with Path.home() patched — no real filesystem state touched. Tests (CLN-001 through CLN-023): - Deletion of all four artifact types (JSONL, todo, debug, telemetry) - Preservation of old, large, non-empty, and uncorrelated files - Cleanup only triggered on rate-limit results (not success/failure) - Missing directories, per-file OSError isolation, top-level exception safety - Resolved working directory stashing, YAML non-persistence, fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Matthew Tibbits <mtibbits@users.noreply.github.com>
d5f281b to
a26198e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_cleanup_rate_limit_artifacts()and_do_cleanup_rate_limit_artifacts()from PR fix: clean up rate-limit artifacts on detection #32tmp_path-based fake~/.claude/directories withPath.home()patched — no real filesystem state touchedTest coverage
~/.claude/subdirectories don't existOSErroron one file doesn't block cleanup of others_process_execution_result()pipelinelast_executed, resolved working dir stashing, logging, early break, YAML non-persistence, fallback resolutionTest plan
pytest tests/test_cleanup.py -v)🤖 Generated with Claude Code