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

   ### Summary
   
   The Opsgenie and PagerDuty `collectIncidents` subtasks returned `nil` when 
their collector couldn't be created, so they were marked successful without 
collecting anything and the error was lost.
   
   Both `CollectIncidents` functions did this after 
`api.NewStatefulApiCollectorForFinalizableEntity`:
   
   ```go
   if err != nil {
        return nil
   }
   return collector.Execute()
   ```
   
   The constructor fails when, for example, it can't load the previous 
collector state from `_devlake_collector_latest_state`, or when the cursor over 
unfinished incidents fails in an incremental run. The pipeline then went on to 
extract and convert whatever raw data was already there.
   
   Changes:
   
   - `plugins/opsgenie/tasks/incidents_collector.go`, 
`plugins/pagerduty/tasks/incidents_collector.go`: `return err`, like the 
Opsgenie teams and users collectors.
   - `plugins/{opsgenie,pagerduty}/tasks/incidents_collector_test.go` (new): 
`TestCollectIncidentsReturnsCollectorSetupError` makes the collector state 
query fail through a mocked `dal.Dal` and checks that `CollectIncidents` 
returns the error.
   
   ### Does this close any open issues?
   
   Closes #9356
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   - `go test ./plugins/opsgenie/tasks/ ./plugins/pagerduty/tasks/`: pass. The 
new tests fail on `main` (`CollectIncidents` returns `nil`).
   - `go build`, `go vet`, `gofmt` and `golangci-lint run 
./plugins/opsgenie/... ./plugins/pagerduty/...`: clean. The pagerduty e2e tests 
need `E2E_DB_URL`, which I didn't run locally; they don't reach this error path.
   - No other plugin's collector has this `return nil` after building its 
collector.
   - No open PR touches the opsgenie or pagerduty plugins.
   - Suggested label: `pr-type/bug-fix`.
   - AI assistance disclosure: this change was prepared with the help of Claude 
Code (Claude Opus 5.5), and I reviewed the diff. The commit carries a 
`Generated-by:` trailer per the ASF generative tooling guidance.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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