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

   ## Summary
   
   Fixes the `collectApiTimelineRecords` subtask failing when the Azure DevOps
   Timeline API returns `204 No Content` for deleted or empty builds.
   
   ## Root Cause
   
   `ignoreInvalidTimelineResponse()` only guarded against `404 Not Found`.
   When a `204 No Content` response was received, execution fell through to
   `io.ReadAll(res.Body)` on an empty body. While the downstream empty-body
   check would eventually skip the record, reading the body of a `204` response
   before checking the status code is unsafe — some HTTP clients/proxies set
   `Body = nil` on `204`, which causes a nil-pointer panic.
   
   ## Fix
   
   Added an explicit `http.StatusNoContent` guard alongside the existing
   `http.StatusNotFound` check, **before** the body is ever read.
   
   ## Changes
   
   - `tasks/shared.go` — extend the status guard in 
`ignoreInvalidTimelineResponse`
     to include `204 No Content`
   - `tasks/shared_test.go` — add `TestIgnoreInvalidTimelineResponse_204` to
     cover the new guard
   
   ## Testing
   
   All existing tests continue to pass. New test 
`TestIgnoreInvalidTimelineResponse_204`
   verifies that a `204` response returns `api.ErrIgnoreAndContinue` without
   reading the body.
   
   ## Related
   
   Closes #8944


-- 
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