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

   ### Summary
   
   The GitHub `extractApiIssues` and GitHub GraphQL `extractIssues` subtasks 
returned `nil` when their setup failed, so they were marked successful without 
extracting anything and the error was lost.
   
   Both extractors did this after `NewIssueRegexes`, and the GraphQL extractor 
did it again after `getMilestoneMap`:
   
   ```go
   if err != nil {
        return nil
   }
   ```
   
   `NewIssueRegexes` fails when a scope config regex (`issueSeverity`, 
`issuePriority`, `issueTypeBug`, ...) doesn't compile. `getMilestoneMap` fails 
when the `_tool_github_milestones` query fails. The pipeline then went on to 
convert whatever was already in `_tool_github_issues`, and the user wasn't told 
that the regex was invalid.
   
   Changes:
   
   - `plugins/github/tasks/issue_extractor.go`, 
`plugins/github_graphql/tasks/issue_extractor.go`: `return err`, like the PR 
extractors of both plugins.
   - `plugins/github/tasks/issue_extractor_test.go`: 
`TestExtractApiIssuesReturnsIssueRegexError` passes a scope config with an 
invalid `issueSeverity` regex and checks that `ExtractApiIssues` returns the 
error.
   - `plugins/github_graphql/tasks/issue_extractor_test.go` (new): the same 
regex test for `ExtractIssues`, plus 
`TestExtractIssuesReturnsMilestoneQueryError`, which makes the milestone query 
fail through a mocked `dal.Dal`.
   
   ### Does this close any open issues?
   
   Closes #9358
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   - `go test ./plugins/github/tasks/ ./plugins/github_graphql/tasks/`: pass. 
The three new tests fail on `main` (the extractors return `nil`).
   - `go build`, `go vet`, `gofmt` and `golangci-lint run ./plugins/github/... 
./plugins/github_graphql/...`: clean. The github and github_graphql e2e tests 
need `E2E_DB_URL`, which I didn't run locally; their scope configs have valid 
regexes, so they don't reach these error paths.
   - No other plugin's extractor has this `return nil` after its setup. The 
GitLab issue extractor already returns its regex errors.
   - No open PR touches these files.
   - 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