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

Check for non-empty length of previous metadata #4182

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented Aug 16, 2024

If there is no prior alert state for a rule/entity pair, an empty db result struct is passed around in the evaluation context. Due to a change from an inner join to a left join, the field's type changed from a pointer to a byte slice to just a byte slice. In the empty case, this means that the alert metadata is represented by an empty byte slice instead of a nil. Change the code to check for empty length in addition to nil-ness.

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes #(related issue)

Change Type

Mark the type of change your PR introduces:

  • 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

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

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.

@dmjb dmjb requested a review from a team as a code owner August 16, 2024 13:06
If there is no prior alert state for a rule/entity pair, an empty
db result struct is passed around in the evaluation context. Due to a
change from an inner join to a left join, the field's type changed from
a pointer to a byte slice to just a byte slice. In the empty case, this
means that the alert metadata is represented by an empty byte slice
instead of a nil. Change the code to check for empty length in addition
to nil-ness.
@dmjb dmjb merged commit 2fddec5 into main Aug 16, 2024
21 checks passed
@dmjb dmjb deleted the fix-alert-metadata-issue branch August 16, 2024 13:39
rdimitrov added a commit that referenced this pull request Aug 19, 2024
JAORMX pushed a commit that referenced this pull request Aug 19, 2024
…4195)

* Revert "Fix issue with Alert URLs for pull requests and artifacts (#4183)"

This reverts commit f5bd045.

* Revert "Check for non-empty length of previous metadata (#4182)"

This reverts commit 2fddec5.

* Revert "Change profile/rule status queries to use evaluation history table (#4089)"

This reverts commit 2137ce8.
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.

2 participants