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

[RAM] Remove third party RRule library, replace with own timezone-compliant lib #152873

Merged
merged 42 commits into from
Jul 2, 2023

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Mar 7, 2023

Summary

Closes #152630

Adds a fix for the weird UTC-but-not-really expected inputs in rrule.js

This PR removes the third-party rrule package and replaces it with @kbn/rrule.

The third party RRule library's functions produced different results depending on what system timezone you ran it in. It would output local timestamps in UTC, making it impossible to do reliable math on them. It's now replaced with our own library that passes all of our own tests for the limited cross-section of the RRule spec that we need to support. It's possible that it wouldn't stand up to the rigor of more complex RRule queries, but it supports the ones that our Recurrence Scheduler UI supports just fine.

Checklist

@Zacqary Zacqary added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesManagement Issues related to the Rules Management UX v8.8.0 labels Mar 7, 2023
JiaweiWu
JiaweiWu previously approved these changes Mar 8, 2023
Copy link
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

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

LGTM! I like the approach taken.

I wonder if there's a good way to notify people to not use the rrule library by itself.

packages/kbn-rrule/rrule.ts Outdated Show resolved Hide resolved
@Zacqary
Copy link
Contributor Author

Zacqary commented Mar 8, 2023

Ok so as you can see by the failing Jest test, the solution is not actually this simple as it turns out

Putting in the right timestamp doesn't get around the fact that the before function will return different results if you run it in a different system timezone

We can't just say "don't use timezones" because days of the week are timezone dependent

I might have to just rewrite this rrule library

@Zacqary Zacqary changed the title [RAM] Add timezone fix patch to RRule [RAM] Remove third party RRule library, replace with own timezone-compliant lib Mar 9, 2023
@JiaweiWu JiaweiWu requested review from JiaweiWu and removed request for JiaweiWu March 10, 2023 01:34
@Zacqary
Copy link
Contributor Author

Zacqary commented Mar 10, 2023

Noticed a bug in my RRule implementation when mixing byweekday positions such as "first tuesday of the month and last friday of the month", i.e. ['+1TU', '-2FR']

This configuration isn't currently supported in the Recurrence Scheduler UI so this is shippable as-is, but I do want to fix that.

EDIT: Fixed in 8cba1ed

@Zacqary Zacqary marked this pull request as ready for review March 10, 2023 23:47
@Zacqary Zacqary requested a review from a team as a code owner March 10, 2023 23:47
Copy link
Member

@sabarasaba sabarasaba left a comment

Choose a reason for hiding this comment

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

Heya! @elastic/platform-deployment-management got pinged for a small change removing an empty line at src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts, not sure thats needed? 🤔

@Zacqary
Copy link
Contributor Author

Zacqary commented May 8, 2023

@elasticmachine merge upstream

@Zacqary
Copy link
Contributor Author

Zacqary commented May 22, 2023

@elasticmachine merge upstream

@XavierM
Copy link
Contributor

XavierM commented Jul 2, 2023

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/rrule - 16 +16
alerting 611 595 -16
total -0

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
alerting 184.6KB 65.1KB -119.6KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/rrule - 1 +1
Unknown metric groups

API count

id before after diff
@kbn/rrule - 16 +16
alerting 635 619 -16
total -0

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 413 417 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 492 496 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Zacqary Zacqary merged commit e31ede2 into elastic:main Jul 2, 2023
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.9 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 152873

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 20, 2024
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 152873 locally

1 similar comment
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 152873 locally

@cnasikas cnasikas removed backport missing Added to PRs automatically when the are determined to be missing a backport. v8.9.0 labels Jul 19, 2024
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 22, 2024
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 152873 locally

3 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 152873 locally

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 152873 locally

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 152873 locally

@jbudz jbudz added the backport:skip This commit does not require backporting label Sep 30, 2024
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:fix Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RAM] Snooze end time shows 1 day ahead of actual end time
9 participants