Skip to content

Conversation

Perdiga
Copy link
Collaborator

@Perdiga Perdiga commented Jul 8, 2025

…e error handling for corrupted databases

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 23:03
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the database creation flow to automatically handle and recover from corrupted CodeQL database directories by removing and retrying creation, and updates the consumer code and tests to use the new combined create_and_analyze API.

  • Added retry logic in create_and_analyze to detect, remove, and recreate corrupted database directories.
  • Refactored the project analysis use case to replace separate create/analyze calls with the unified create_and_analyze method.
  • Updated tests to mock Path.exists, consolidate mocks for create_and_analyze, and refine assertions.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/test_codeql_runner.py Updated tests: added Path.exists mock, refined assertions in create_and_analyze tests
tests/test_codeql_analysis.py Consolidated separate create_database/analyze_database mocks into create_and_analyze
src/codeql_wrapper/infrastructure/codeql_runner.py Added corrupted-database detection and retry logic plus cleaned up imports
src/codeql_wrapper/domain/use_cases/codeql_analysis_use_case.py Switched to the robust create_and_analyze in the project analysis workflow
Comments suppressed due to low confidence (1)

tests/test_codeql_runner.py:518

  • There are no existing tests covering the corrupt-database retry branch in create_and_analyze. You should add a test that simulates a corrupted directory error and verifies that the directory is removed and creation is retried.
    @patch("pathlib.Path.exists")

@Perdiga Perdiga merged commit 5ea0f86 into main Jul 8, 2025
7 checks passed
@fernandosantos-br fernandosantos-br deleted the develop-fix-db-creation branch July 21, 2025 21:46
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.

1 participant