Skip to content

fix: preserve PR comments when Issues are disabled (#503) - #568

Open
eelasyot-spec wants to merge 2 commits into
chaoss:mainfrom
eelasyot-spec:fix/503-skip-unavailable-issue-comments
Open

eelasyot-spec wants to merge 2 commits into
chaoss:mainfrom
eelasyot-spec:fix/503-skip-unavailable-issue-comments

Conversation

@eelasyot-spec

Copy link
Copy Markdown

Summary

  • Fixes Core:Collect_github_messages error: UrlNotFoundException #503 (UrlNotFoundException on /issues/comments) without dropping PR conversation comments when Issues are disabled.
  • Small-repo path: catch 404 on the bulk /issues/comments endpoint and return [] (does not gate on has_issues alone).
  • Large-repo path: when has_issues is false, only fetch known PR comment URLs (GitHub shared issue/PR numberspace) to avoid burning API quota on predictable 404/410s for issue-only URLs.
  • check_issues_enabled re-raises repo metadata 404s (do not treat missing repos as “issues disabled”).
  • Updates resilience tests; removes the Core:Collect_github_messages error: UrlNotFoundException #503 xfail now that the crash path is fixed.

This differs from #554, which skipped all message collection on has_issues=false and dropped PR conversation comments (e.g. openshift/release).

Test plan

  • pytest tests/test_github_resilience — 23 passed
  • Live API: openshift/release (has_issues=false) still returns PR comments on /issues/comments
  • Live API: kubernetes/apiextensions-apiserver /issues/comments returns 404 (the Core:Collect_github_messages error: UrlNotFoundException #503 case)
  • CI green on this PR

Made with Cursor

eelasyot added 2 commits November 10, 2026 11:17
Avoid gating small-repo message collection on has_issues alone, which
dropped PR conversation comments. Catch 404 on /issues/comments instead.
On the large-repo path, when Issues are off only fetch known PR comment
URLs (shared issue/PR numberspace) to avoid burning API quota on 404/410s.
(select pr_comments_url from pull_requests WHERE repo_id={repo_id} AND pr_comments_url IS NOT NULL AND pr_updated_at > timestamptz(timestamp '{since}') order by pr_created_at desc)
UNION
(select comments_url as comment_url from issues WHERE repo_id={repo_id} AND comments_url IS NOT NULL AND updated_at > timestamptz(timestamp '{since}') order by created_at desc);
pr_query = text(f"""
AND pr_updated_at > timestamptz(timestamp '{since}')
order by pr_created_at desc
""")
issue_query = text(f"""
(select pr_comments_url from pull_requests WHERE repo_id={repo_id} AND pr_comments_url IS NOT NULL order by pr_created_at desc)
UNION
(select comments_url as comment_url from issues WHERE repo_id={repo_id} AND comments_url IS NOT NULL order by created_at desc);
pr_query = text(f"""
WHERE repo_id={repo_id} AND pr_comments_url IS NOT NULL
order by pr_created_at desc
""")
issue_query = text(f"""
@codecov

This comment has been minimized.

@MoralCode

MoralCode commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Small-repo path: catch 404 on the bulk /issues/comments endpoint and return [] (does not gate on has_issues alone).
Large-repo path: when has_issues is false, only fetch known PR comment URLs (GitHub shared issue/PR numberspace) to avoid burning API quota on predictable 404/410s for issue-only URLs.

Is there a particular way we are distinguishing small vs large repos?

Edit: saw your comment in the issue and think I understand what you mean

@MoralCode

MoralCode commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Also can you update the PR description to use the template?

also your commits need to be signed off (see CONTRIBUTING.md) so the DCO check passes

@MoralCode

Copy link
Copy Markdown
Contributor

the small/large check is being done by is_repo_small - its only use is also in the messages collection.

it determines whether we run fast_retrieve_all_pr_and_issue_messages or process_large_issue_and_pr_message_collection

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.

Core:Collect_github_messages error: UrlNotFoundException

3 participants