Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error message on malformed selectors #4125

Closed
jhrozek opened this issue Aug 12, 2024 · 8 comments
Closed

Unhelpful error message on malformed selectors #4125

jhrozek opened this issue Aug 12, 2024 · 8 comments
Assignees
Labels
bug Something isn't working P1 Fix Soon: High priority items that should be considered in the next Sprint planning cycle

Comments

@jhrozek
Copy link
Contributor

jhrozek commented Aug 12, 2024

@eleftherias found two examples:

  • repository.name = 'test/test'
  • repository.isFork == true
@jhrozek jhrozek added the bug Something isn't working label Aug 12, 2024
@jhrozek
Copy link
Contributor Author

jhrozek commented Aug 12, 2024

@eleftherias I tried to reproduce the issue but I couldn't, with a minder instance running locally from main. I tried with these selectors:

selection:
  - description: repro
    entity: repository
    selector: repository.name = 'test/test'

And I get:

Details: selector failed to parse: Syntax error: token recognition error at: '= '

For the isFork one:

selection:
  - description: repro
    entity: repository
    selector: repository.isFork != 'jakubtestorg/bad-go'

I get:

Details: selector is invalid: undefined field 'isFork'

Would you mind showing me how to reproduce better? Did you test with CLI or the UI?

@eleftherias
Copy link
Contributor

@jhrozek I should have clarified, this is in the UI.

Image

@jhrozek
Copy link
Contributor Author

jhrozek commented Aug 13, 2024

@davolokh @kantord any chance the UI is not displaying the error the back end sends?

@davolokh davolokh self-assigned this Aug 13, 2024
@davolokh davolokh added the P1 Fix Soon: High priority items that should be considered in the next Sprint planning cycle label Aug 15, 2024
@davolokh davolokh assigned samuv and unassigned davolokh Aug 20, 2024
@samuv
Copy link

samuv commented Aug 22, 2024

hey @jhrozek I just checked in sandbox and it seems that the BE return a 500 with that specific error message that we show

response:

{
[0]     status: 'error',
[0]     data: undefined,
[0]     error: {
[0]       message: 'Internal errors. Means some invariants expected by underlying\n' +
[0]         'system has been broken.\n' +
[0]         'Please check with the server team.',
[0]       stack: 'ApiError: Internal Server Error\n' +
[0]         '    at catchErrorCodes (webpack-internal:///(rsc)/./src/types/minder/generated/core/request.ts:225:15)\n' +
[0]         '    at eval (webpack-internal:///(rsc)/./src/types/minder/generated/core/request.ts:264:17)\n' +
[0]         '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
[0]       name: 'ApiError',
[0]       status: 500,
[0]       statusText: 'Internal Server Error'
[0]     }
[0]   }

@jhrozek
Copy link
Contributor Author

jhrozek commented Aug 22, 2024

A 500 is not expected. Let's try to debug it tomorrow together, because that's not what I saw locally - but we might have broken things in the meantime.

@samuv
Copy link

samuv commented Aug 30, 2024

thank you @jhrozek, sorry for the delay, I reach out on slack but I will put some context in here too

the API that is called when we click on save is /api/v1/profile with a PUT

the body example of the call:

{"profile":{"context":{"project":"be4cab47-0817-4bd8-b8fc-f63487ba4aba"},"id":"43ee4c22-c230-40c7-8930-6baac95d1d43","name":"test","labels":[],"repository":[{"type":"stacklok/actions_check_pinned_tags","params":{},"def":{},"name":"stacklok/actions_check_pinned_tags"},{"type":"stacklok/branch_protection_enabled","params":{"branch":"main"},"def":{},"name":"stacklok/branch_protection_enabled"},{"type":"stacklok/branch_protection_allow_deletions","params":{"branch":"main"},"def":{},"name":"stacklok/branch_protection_allow_deletions"}],"buildEnvironment":[],"artifact":[],"pullRequest":[],"release":[],"pipelineRun":[],"taskRun":[],"build":[],"selection":[{"entity":"repository","selector":"test/test"}],"remediate":"off","alert":"on","type":"","version":"","displayName":"Test","selectorType":"all","rulesCount":3}}

In this case the response is a 500, the env that I tested is sandbox and staging

@jhrozek jhrozek self-assigned this Aug 30, 2024
@jhrozek
Copy link
Contributor Author

jhrozek commented Aug 30, 2024

This ended up being a bug on the BE side (thanks @samuv for the help with debugging!). Unfortunately GH doesn't seem to be able to move the issue back from the private FE repo to the public minder repo, so I'm just going to link the PR: #4334
and close.

@jhrozek jhrozek closed this as completed Aug 30, 2024
@samuv
Copy link

samuv commented Aug 30, 2024

@jhrozek has found the issue and the fix has landed staging

Tested in staging, and now the toast has the correct message
Screenshot 2024-08-30 at 15.43.17.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Fix Soon: High priority items that should be considered in the next Sprint planning cycle
Projects
None yet
Development

No branches or pull requests

4 participants