Skip to content

fix(plugins): return the opsgenie and pagerduty incidents collector error - #9357

Open
ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/incident-collector-err
Open

ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/incident-collector-err

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

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:

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

…rror

CollectIncidents in both plugins returned nil when
NewStatefulApiCollectorForFinalizableEntity failed, e.g. when the
previous collector state couldn't be loaded or the cursor over
unfinished incidents failed. The subtask was marked successful without
collecting anything, and the error was lost. Return it, like the
Opsgenie teams and users collectors do.

Closes apache#9356

Generated-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

[Bug][Opsgenie][PagerDuty] collectIncidents succeeds without collecting when the collector can't be created

2 participants