Skip to content

Remove cache before loading the app#31

Merged
jpchauvel merged 2 commits intomainfrom
issue-6
Sep 5, 2025
Merged

Remove cache before loading the app#31
jpchauvel merged 2 commits intomainfrom
issue-6

Conversation

@jpchauvel
Copy link
Contributor

@jpchauvel jpchauvel commented Sep 5, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Forking a repository now always performs a clean fresh clone by removing any existing directory, preventing stale state issues.
  • Tests
    • Expanded test coverage to verify directory cleanup and cloning behavior for both existing and non-existing paths.
  • Chores
    • Added a test runner script to execute tests with coverage and display missing lines.
    • Added coverage tooling as a development dependency.

@coderabbitai
Copy link

coderabbitai bot commented Sep 5, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a test runner script using pytest with coverage, introduces pytest-cov as a dev dependency, modifies fork_repo to always perform a fresh clone by deleting existing repo directories, and updates related tests to reflect directory removal before cloning.

Changes

Cohort / File(s) Summary
Test tooling
bin/test.sh, pyproject.toml
Adds a shell script to run uv run pytest --cov=src --cov-report=term-missing. Adds pytest-cov>=6.2.1 to dev dependencies.
Repo clone behavior
src/edit_python_pe/utils.py
Updates fork_repo to always clone by deleting repo_path if it exists using shutil.rmtree, then cloning with callbacks.
Unit tests for repo clone
tests/test_utils.py
Adjusts tests to mock shutil.rmtree; verifies no removal when path absent and removal-before-clone when path exists; updates test names and signatures accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Utils as utils.fork_repo
  participant FS as Filesystem
  participant Git as Remote Repo

  Caller->>Utils: fork_repo(repo_path, ...)
  alt repo_path exists
    Utils->>FS: rmtree(repo_path)
    FS-->>Utils: removed
    Utils->>Git: clone_repository(..., repo_path)
    Git-->>Utils: forked_repo
  else repo_path absent
    Utils->>Git: clone_repository(..., repo_path)
    Git-->>Utils: forked_repo
  end
  Utils-->>Caller: (repo_path, forked_repo)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Add pytest-cov package and enable coverage run (#6)
Remove the cache before executing the app (#5) No cache-clearing logic added; no changes related to app initialization observed.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Change fork_repo to always delete existing repo directory before cloning (src/edit_python_pe/utils.py) Not related to adding pytest-cov or clearing app cache; alters repository cloning behavior beyond stated objectives.
Update tests to cover directory removal in fork_repo (tests/test_utils.py) Supports out-of-scope change to cloning behavior; unrelated to coverage setup or cache clearing.

Poem

I hop through repos, whiskers keen and bright,
A clean clone burrow, swept fresh each night.
Tests now count footprints, coverage on display,
uv hums softly—hip hooray!
No cache carrots yet, but soon we’ll nibble—
merge squeaks by with a happy quibble. 🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5d146f9 and 78bc5a5.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • bin/test.sh (1 hunks)
  • pyproject.toml (1 hunks)
  • src/edit_python_pe/utils.py (2 hunks)
  • tests/test_utils.py (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-6

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jpchauvel jpchauvel merged commit 366243f into main Sep 5, 2025
1 check was pending
@jpchauvel jpchauvel deleted the issue-6 branch September 5, 2025 08:55
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.

Add pytest-cov package Remove the cache before executing the app

1 participant