Skip to content

Comments

[Response Ops][Reporting] Fixing next run calculation in list scheduled report API#227704

Merged
ymao1 merged 3 commits intoelastic:mainfrom
ymao1:scheduled-report-fix
Jul 15, 2025
Merged

[Response Ops][Reporting] Fixing next run calculation in list scheduled report API#227704
ymao1 merged 3 commits intoelastic:mainfrom
ymao1:scheduled-report-fix

Conversation

@ymao1
Copy link
Contributor

@ymao1 ymao1 commented Jul 11, 2025

Summary

Fixes a small bug in the next run calculation when using the list scheduled report API. This takes the rrule.dtstart into account if it is defined and in the future. If it is in the past, defaults to using Date.now() as before.

@ymao1 ymao1 force-pushed the scheduled-report-fix branch 2 times, most recently from 5253193 to 55f6fa4 Compare July 11, 2025 18:31
@ymao1 ymao1 force-pushed the scheduled-report-fix branch from 55f6fa4 to 62cff6e Compare July 11, 2025 18:32
@ymao1 ymao1 self-assigned this Jul 11, 2025
@ymao1 ymao1 added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Feature:Reporting:Framework Reporting issues pertaining to the overall framework v9.1.0 v8.19.0 v9.2.0 backport:version Backport to applied version labels labels Jul 11, 2025
@ymao1 ymao1 marked this pull request as ready for review July 11, 2025 20:15
@ymao1 ymao1 requested a review from a team as a code owner July 11, 2025 20:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@ymao1
Copy link
Contributor Author

ymao1 commented Jul 14, 2025

@elasticmachine merge upstream

@ymao1 ymao1 requested a review from js-jankisalvi July 14, 2025 21:36
Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

Verified locally with future start date and start date already passed scenario. Works as expected 👍

One thing which I think is not related to this PR.
I scheduled a report with now as start date which showed now in the schedules tab, but it wasn't visible in the exports tab.
After a minute passed, the next run changed to next schedule date but there was still no entry in Exports tab.
It feels bit confusing to let user select now in the start date.

report_now.mov

// start time is set to 2025-05-11T12:00:00.000Z (which is a Sunday)
// next run should be the next Friday after 2025-05-11T12:00:00.000Z which is 2025-05-16T17:00:00.000Z
// not the actual next friday which would be 2025-05-09T17:00:00.000Z
const dtstart = '2025-05-11T12:00:00.000Z';
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation! 😅

@ymao1
Copy link
Contributor Author

ymao1 commented Jul 15, 2025

@js-jankisalvi I opened this issue to address: #228059

I was trying to save another ES query for this API but I think the correct thing to do for the next run time is to get the actual value from the task document.

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #110 / serverless search UI Serverless Query Rules Overview Creating a query ruleset from an empty deployment should be able to create a new ruleset

Metrics [docs]

✅ unchanged

cc @ymao1

@ymao1 ymao1 merged commit a893aa7 into elastic:main Jul 15, 2025
12 checks passed
@ymao1 ymao1 deleted the scheduled-report-fix branch July 15, 2025 17:41
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16300382386

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2025
…ed report API (elastic#227704)

## Summary

Fixes a small bug in the next run calculation when using the list
scheduled report API. This takes the `rrule.dtstart` into account if it
is defined and in the future. If it is in the past, defaults to using
`Date.now()` as before.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit a893aa7)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2025
…ed report API (elastic#227704)

## Summary

Fixes a small bug in the next run calculation when using the list
scheduled report API. This takes the `rrule.dtstart` into account if it
is defined and in the future. If it is in the past, defaults to using
`Date.now()` as before.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit a893aa7)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

ymao1 added a commit that referenced this pull request Jul 16, 2025
…cheduled report API (#227704) (#228081)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Response Ops][Reporting] Fixing next run calculation in list
scheduled report API
(#227704)](#227704)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-07-15T17:41:53Z","message":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report API
(#227704)\n\n## Summary\n\nFixes a small bug in the next run calculation
when using the list\nscheduled report API. This takes the
`rrule.dtstart` into account if it\nis defined and in the future. If it
is in the past, defaults to using\n`Date.now()` as
before.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"a893aa7744848877c0922c5a2ba4b53f73ba4e5a","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Feature:Reporting:Framework","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report
API","number":227704,"url":"https://github.com/elastic/kibana/pull/227704","mergeCommit":{"message":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report API
(#227704)\n\n## Summary\n\nFixes a small bug in the next run calculation
when using the list\nscheduled report API. This takes the
`rrule.dtstart` into account if it\nis defined and in the future. If it
is in the past, defaults to using\n`Date.now()` as
before.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"a893aa7744848877c0922c5a2ba4b53f73ba4e5a"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227704","number":227704,"mergeCommit":{"message":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report API
(#227704)\n\n## Summary\n\nFixes a small bug in the next run calculation
when using the list\nscheduled report API. This takes the
`rrule.dtstart` into account if it\nis defined and in the future. If it
is in the past, defaults to using\n`Date.now()` as
before.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"a893aa7744848877c0922c5a2ba4b53f73ba4e5a"}}]}]
BACKPORT-->

---------

Co-authored-by: Ying Mao <ying.mao@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
ymao1 added a commit that referenced this pull request Jul 16, 2025
…scheduled report API (#227704) (#228080)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Response Ops][Reporting] Fixing next run calculation in list
scheduled report API
(#227704)](#227704)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-07-15T17:41:53Z","message":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report API
(#227704)\n\n## Summary\n\nFixes a small bug in the next run calculation
when using the list\nscheduled report API. This takes the
`rrule.dtstart` into account if it\nis defined and in the future. If it
is in the past, defaults to using\n`Date.now()` as
before.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"a893aa7744848877c0922c5a2ba4b53f73ba4e5a","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Feature:Reporting:Framework","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report
API","number":227704,"url":"https://github.com/elastic/kibana/pull/227704","mergeCommit":{"message":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report API
(#227704)\n\n## Summary\n\nFixes a small bug in the next run calculation
when using the list\nscheduled report API. This takes the
`rrule.dtstart` into account if it\nis defined and in the future. If it
is in the past, defaults to using\n`Date.now()` as
before.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"a893aa7744848877c0922c5a2ba4b53f73ba4e5a"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227704","number":227704,"mergeCommit":{"message":"[Response
Ops][Reporting] Fixing next run calculation in list scheduled report API
(#227704)\n\n## Summary\n\nFixes a small bug in the next run calculation
when using the list\nscheduled report API. This takes the
`rrule.dtstart` into account if it\nis defined and in the future. If it
is in the past, defaults to using\n`Date.now()` as
before.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"a893aa7744848877c0922c5a2ba4b53f73ba4e5a"}}]}]
BACKPORT-->

---------

Co-authored-by: Ying Mao <ying.mao@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
…ed report API (elastic#227704)

## Summary

Fixes a small bug in the next run calculation when using the list
scheduled report API. This takes the `rrule.dtstart` into account if it
is defined and in the future. If it is in the past, defaults to using
`Date.now()` as before.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…ed report API (elastic#227704)

## Summary

Fixes a small bug in the next run calculation when using the list
scheduled report API. This takes the `rrule.dtstart` into account if it
is defined and in the future. If it is in the past, defaults to using
`Date.now()` as before.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Reporting:Framework Reporting issues pertaining to the overall framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.19.0 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants