Thundercloud12 opened a new pull request, #9145:
URL: https://github.com/apache/devlake/pull/9145

   <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements. See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License. You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Summary
   
   When collecting unfinished pull request details (`CollectUnfinishedDetails` 
in `pr_collector.go`), DevLake iterates over previously collected open PRs 
(`state != 'closed' OR merged = false`) and queries:
   
   `GET /repos/{owner}/{repo}/pulls/{number}`
   
   If a PR has since been deleted, scrubbed (e.g., credential leak removal), or 
made inaccessible on GitHub, GitHub returns HTTP `404 Not Found`.
   
   Without an `AfterResponse` hook, `ApiAsyncClient` retries the endpoint 3 
times and then terminates the entire subtask with:
   
   `Retry exceeded 3 times...`
   
   Consequently, all subsequent syncs fail on the same unavailable PR, causing 
data collection for newer PRs to halt and repository dashboards to become stale.
   
   This PR adds `AfterResponse: ignoreHTTPStatus404` to 
`CollectUnfinishedDetails` in `pr_collector.go`. The hook returns 
`api.ErrIgnoreAndContinue` when GitHub responds with HTTP `404`, allowing the 
collector to gracefully skip unavailable PRs and continue collecting the 
remaining pull requests.
   
   ### Does this close any open issues?
   
   Closes #9140
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   * Follows the existing convention used across DevLake collectors (e.g., 
`cicd_job_collector.go`).
   * Added unit tests in `plugins/github/tasks/shared_test.go` covering 
`ignoreHTTPStatus404` and `ignoreHTTPStatus422`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to