Fixes #634
When fetch_and_notify_on_changes fails (e.g., network timeout), the repository path (directory or symbolic link) is left in a corrupted state, causing subsequent fetches to fail indefinitely.
try...except block that explicitly handles both os.unlink (for symlinks) and shutil.rmtree (for directories).GitPolicyFetcher.repos cache is cleared on failure.packages/opal-server/opal_server/tests/test_git_fetcher_cleanup.py) that mocks the failure and verifies filesystem cleanup. (Includes a Windows compatibility check for local dev).I have added a new test file. Run it with:
pytest packages/opal-server/opal_server/tests/test_git_fetcher_cleanup.py
/claim #634
Kesavaraja M
@Kesavaraja67
Permit.io
@Permitio