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

Surface selector check errors to handlers #4021

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Jul 27, 2024

Summary

This is a minimal patch to surface selector errors through profile
handlers to clients. It does not expose the structured data (e.g. which
line and which column did the error occur at). I started working on
that, but realized that that's a bigger endevor that ought to be
implemented separately.

Fixes: #3987

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

by calling the profile handlers, both grpc through the minder client and HTTP through curl:

curl -vv -H "Authorization: Bearer $MINDER_BEARER_TOKEN" 'http://localhost:8080/api/v1/profile' --data-binary @/Users/jakub/devel/playground/ghas-selectors-check-error.json

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@jhrozek jhrozek requested a review from a team as a code owner July 27, 2024 08:36
We had a bug in the CheckSelector method where if we passed in an entity
string representation that doesn't correspond to an entity (aka
garbage), we would convert that to UNSPECIFIED as if the user had
selected 'entity' in the selector.
Turns out our handler tests used malformed selectors. We didn't know
because we didn't check the syntax previously.
@coveralls
Copy link

Coverage Status

coverage: 54.652% (+0.2%) from 54.497%
when pulling ef6981b on jhrozek:selectors_err_msg_simple
into 95535e5 on stacklok:main.

@JAORMX JAORMX merged commit 832c599 into stacklok:main Jul 29, 2024
21 checks passed
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.

Profile selectors handlers: expose errors to the user when submitting the selector
5 participants