Skip to content

Conversation

LucasSantos27
Copy link
Collaborator

@LucasSantos27 LucasSantos27 commented Aug 21, 2025

This PR updates the behavior of the issue filtering endpoint.
Previously, when no issues matched the given filters, the API returned a 500 Internal Server Error.
Now, it correctly returns a 200 OK response with a correct response.

Related Issue

How to test it

Using curl

curl -X 'GET' \
  'http://localhost:8000/api/issue/?interval_in_days=120&filter_origin=nonexistent' \
  -H 'accept: application/json'

Or via browser
<local_url>/issues?df|o|nonexistent=true

Expected behavior

  • Before (main branch):

Response: 500 Internal Server Error

  • After (this PR):
    Response: 200 OK

Body:

{"issues":[],"extras":{},"filters":{"origins":["maestro","redhat"],"culprits":["code","harness","tool"],"categories":[]}}

@LucasSantos27 LucasSantos27 self-assigned this Aug 21, 2025
Copy link
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

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

I think that it would be best if the endpoint returned the IssueListingResponse as usual, because it will have data there (even if 0 issues are returned)

@LucasSantos27 LucasSantos27 force-pushed the fix/issue-listing-should-not-break branch 2 times, most recently from e99f7e4 to 9618df6 Compare August 21, 2025 19:33
@LucasSantos27
Copy link
Collaborator Author

I think that it would be best if the endpoint returned the IssueListingResponse as usual, because it will have data there (even if 0 issues are returned)

@MarceloRobert Yeah, you're right. It's better if I process the extra_details when the filtered issues aren't empty.

I've just updated it.

Copy link
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

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

Interesting that the problem was in assign_issue_trees but assign_issue_first_seen was protected against this problem because it has a if not issue_id_list: return [].

The change you made here is great, but could you also add that condition to assign_issue_trees so that it becomes bulletproof in case someone wants to use just that function?

When filtering issues, the listing should return status 200 if empty

- closes #1381
@LucasSantos27 LucasSantos27 force-pushed the fix/issue-listing-should-not-break branch from 9618df6 to 5f6fcee Compare August 22, 2025 13:41
Copy link
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

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

Looks good to me

@LucasSantos27
Copy link
Collaborator Author

This PR was already merged via the command line, but it didn’t close automatically, so I closed it manually.

@MarceloRobert MarceloRobert deleted the fix/issue-listing-should-not-break branch September 2, 2025 16:28
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.

Issue listing breaks on 0 results
2 participants