Compare commits

..

2 Commits

Author SHA1 Message Date
5595c0bbca refactor: handle PR comments only after marking issues as seen
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 26s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 22s
2025-04-23 22:25:47 +02:00
f9a13896f9 Initial ruff pass 2025-04-23 22:24:47 +02:00

View File

@ -495,9 +495,6 @@ def solve_issues_in_repository(
logger.info('No issues found for %s', repository_config.repo) logger.info('No issues found for %s', repository_config.repo)
return return
# batch up PRs to handle comments after all issues are resolved
jobs: list[tuple[str, str, str]] = []
for issue in issues: for issue in issues:
issue_url = issue.get('web_url') issue_url = issue.get('web_url')
issue_number = issue.get('number') issue_number = issue.get('number')
@ -518,9 +515,8 @@ def solve_issues_in_repository(
issue_number, issue_number,
client, client,
) )
if issue_resolution.success: if issue_resolution.success:
# defer comment handling until after all issues complete
jobs.append((issue_url, issue_resolution.pull_request_id, branch_name))
seen_issues_db.mark_as_seen(issue_url, str(issue_number)) seen_issues_db.mark_as_seen(issue_url, str(issue_number))
seen_issues_db.update_pr_info( seen_issues_db.update_pr_info(
issue_url, issue_url,
@ -532,15 +528,10 @@ def solve_issues_in_repository(
issue_resolution.pull_request_id, issue_resolution.pull_request_id,
issue_number, issue_number,
) )
# Handle unresolved pull request comments
# once all new issues are done, process any PR comments in batch
for issue_url, pr_id, branch_name in jobs:
with tempfile.TemporaryDirectory() as repository_path:
run_cmd(['git', 'clone', repository_config.repo_url(), repository_path])
run_cmd(['git', 'checkout', branch_name], repository_path)
handle_pr_comments( handle_pr_comments(
repository_config, repository_config,
pr_id, issue_resolution.pull_request_id,
branch_name, branch_name,
Path(repository_path), Path(repository_path),
client, client,