Skip to content

Conversation

v1bh0r
Copy link

@v1bh0r v1bh0r commented Oct 10, 2025

Summary

What does this PR do?

This PR fixes a case sensitivity issue in the Jira plugin's deployment type detection that caused API endpoint selection errors. The Jira API returns deployment types as "Cloud" or "Server" (capitalized), but the code was performing case-sensitive comparisons against lowercase constants, causing Jira Cloud instances to incorrectly use the deprecated v2 API endpoint instead of the v3 API.

Changes:

  • Updated all Jira collectors to perform case-insensitive deployment type comparisons using strings.ToLower()
  • Added missing strings import in issue_collector.go
  • Added comprehensive unit tests to verify case-insensitive matching works for all variations

Files Modified:

  • backend/plugins/jira/tasks/account_collector.go
  • backend/plugins/jira/tasks/epic_collector.go
  • backend/plugins/jira/tasks/issue_changelog_collector.go
  • backend/plugins/jira/tasks/issue_changelog_extractor.go
  • backend/plugins/jira/tasks/issue_collector.go
  • backend/plugins/jira/tasks/issue_comment_collector.go
  • backend/plugins/jira/tasks/issue_comment_extractor.go
  • backend/plugins/jira/tasks/issue_type_collector.go
  • backend/plugins/jira/tasks/sprint_extractor.go
  • backend/plugins/jira/tasks/deployment_type_test.go (new)

Does this close any open issues?

[Bug][Jira] V2 API removed #8563
Fixes the error: The requested API has been removed. Please migrate to the /rest/api/3/search/jql API when collecting Jira Cloud epics.

This error occurred because the deployment type comparison was case-sensitive, causing Jira Cloud instances (which return "Cloud") to be treated as Jira Server and use the deprecated /api/2/search endpoint instead of /api/3/search/jql.

Screenshots

N/A - This is a backend API endpoint selection fix.

Other Information

  • All tests pass successfully
  • The fix ensures backward compatibility with any existing deployment type values
  • Case-insensitive comparison handles: "Cloud", "cloud", "CLOUD", "Server", "server", "SERVER", etc.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug priority/high This issue is very important severity/p0 This bug blocks key user journey and function labels Oct 10, 2025
@GoSimplicity
Copy link
Contributor

Summary

What does this PR do?

This PR fixes a case sensitivity issue in the Jira plugin's deployment type detection that caused API endpoint selection errors. The Jira API returns deployment types as "Cloud" or "Server" (capitalized), but the code was performing case-sensitive comparisons against lowercase constants, causing Jira Cloud instances to incorrectly use the deprecated v2 API endpoint instead of the v3 API.

Changes:

  • Updated all Jira collectors to perform case-insensitive deployment type comparisons using strings.ToLower()
  • Added missing strings import in issue_collector.go
  • Added comprehensive unit tests to verify case-insensitive matching works for all variations

Files Modified:

  • backend/plugins/jira/tasks/account_collector.go
  • backend/plugins/jira/tasks/epic_collector.go
  • backend/plugins/jira/tasks/issue_changelog_collector.go
  • backend/plugins/jira/tasks/issue_changelog_extractor.go
  • backend/plugins/jira/tasks/issue_collector.go
  • backend/plugins/jira/tasks/issue_comment_collector.go
  • backend/plugins/jira/tasks/issue_comment_extractor.go
  • backend/plugins/jira/tasks/issue_type_collector.go
  • backend/plugins/jira/tasks/sprint_extractor.go
  • backend/plugins/jira/tasks/deployment_type_test.go (new)

Does this close any open issues?

[Bug][Jira] V2 API removed #8563 Fixes the error: The requested API has been removed. Please migrate to the /rest/api/3/search/jql API when collecting Jira Cloud epics.

This error occurred because the deployment type comparison was case-sensitive, causing Jira Cloud instances (which return "Cloud") to be treated as Jira Server and use the deprecated /api/2/search endpoint instead of /api/3/search/jql.

Screenshots

N/A - This is a backend API endpoint selection fix.

Other Information

  • All tests pass successfully
  • The fix ensures backward compatibility with any existing deployment type values
  • Case-insensitive comparison handles: "Cloud", "cloud", "CLOUD", "Server", "server", "SERVER", etc.

Thank you for the PR! However, during the testing process, I discovered a potential issue:
Your code only converts the left side, which might cause "server" == "Server" to be false in all cases. If possible, please use strings.EqualFold instead. If needed, I would be more than happy to assist!

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 13, 2025
…rison

- Replace strings.ToLower(deploymentType) == constant with strings.EqualFold
- Fixes issue where case-insensitive comparison was only converting one side
- Update tests to reflect the new comparison logic using strings.EqualFold
- Affects epic_collector.go and issue_collector.go
@v1bh0r
Copy link
Author

v1bh0r commented Oct 13, 2025

Thank you for catching it, @GoSimplicity. Please review again.

@GoSimplicity
Copy link
Contributor

LGTM

@GoSimplicity GoSimplicity self-requested a review October 13, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug priority/high This issue is very important severity/p0 This bug blocks key user journey and function size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants