Skip to content

[Bug][GitHub] Extract Issues succeeds without extracting when the issue regexes or milestones can't be loaded #9358

Closed

Description

@ShivamSharma43

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

The GitHub extractApiIssues and GitHub GraphQL extractIssues subtasks report success without extracting anything when their setup fails.

Both drop the error from NewIssueRegexes, which compiles the issue regexes from the scope config (plugins/github/tasks/issue_extractor.go, plugins/github_graphql/tasks/issue_extractor.go):

issueRegexes, err := NewIssueRegexes(config)
if err != nil {
	return nil
}

The GraphQL extractor does the same with the error from getMilestoneMap, which reads _tool_github_milestones:

milestoneMap, err := getMilestoneMap(db, data.Options.GithubId, data.Options.ConnectionId)
if err != nil {
	return nil
}

So an invalid regex in the scope config (for example issueSeverity: "severity/(.*") or a failed milestone query makes the subtask return nil. The pipeline marks it successful, _tool_github_issues isn't updated, and the converters run on old data. No error is logged, so the user doesn't learn that the regex is wrong.

The PR extractors of both plugins return the same kind of error (regexp Compile prType failed), and so does the GitLab issue extractor.

What do you expect to happen

The subtask fails with the setup error, e.g. regexp Compile issueSeverity failed, like the PR extractors.

How to reproduce

Set an invalid regex such as severity/(.* as issueSeverity in a GitHub scope config and collect the repo. Extract Issues succeeds and no issues are extracted. A unit test that calls ExtractApiIssues or ExtractIssues with that scope config gets nil back.

Anything else

Proposed fix (I have a PR ready): return err instead of return nil in the three places.

Version

main

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions