Skip to content

Correctly handle invalid dates on Merge Request Analytics page

What does this MR do and why?

This MR handle correctly invalid dates on Merge Request Analytics page. If we type an invalid start_date or end_date in the Merge Request Analytics URL, the system will show an alert and fallback to default range of 365 days: start_date equals to today - 365 days and end_date equals to today.

Currently, if we type an invalid start_date or end_date in the Merge Request Analytics URL (e.g.: /analytics/merge_request_analytics?start_date=2022-15-09&end_date=2023-15-09) the page is not rendered properly and no errors messages are displayed.

See here the BUG: #413974 (comment 1462806914)

Screenshots or screen recordings

When access the menu "Merge request analytics"

Expected behaviour: the default range of 365 days is used without show any alert (existing behavior).

0-default-range

When "end_date" is not informed

Expected behaviour: the default range of 365 days is used and an alert is shown with the text: Invalid dates set, defaulting to 365 days..

1-no-end-date

When "start_date" is not informed

Expected behaviour: the default range of 365 days is used and an alert is shown with the text: Invalid dates set, defaulting to 365 days..

2-no-start-date

When "start_date" or "end_date" is invalid

Expected behaviour: the default range of 365 days is used and an alert is shown with the text: Invalid dates set, defaulting to 365 days..

3-invalid-date

When "end_date" is greater than "start_date"

Expected behaviour: the default range of 365 days is used and an alert is shown with the text: Invalid dates set, defaulting to 365 days..

4-end-gt-start-date

When the range of dates is larger than 365 days

Expected behaviour: the default range of 365 days is used and an alert is shown with the text: Date range too large, defaulting to 365 days..

5-large-range

How to set up and validate locally

You will need a GitLab Ultimate license

  1. Create a group
  2. Seed cycle analytics data
  3. Seed dora metrics data
  4. Seed MRs in the merged state - see this note for some hints
  5. Visit the Value streams dashboard

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #413974 (closed)

Edited by Dannyel Cardoso da Fonseca

Merge request reports