Validate the date range of the legacy project VSA JSON paths
What does this MR do and why?
MR 2 of https://gitlab.com/gitlab-org/gitlab/-/work_items/636168 (Project Bulkhead, Optimize row 3).
GET /<project>/-/value_stream_analytics.json and GET /<project>/-/value_stream_analytics/events/<stage>.json accept any date range and run the raw medians on the shared replicas. Most of this traffic is anonymous. They read their dates from the nested cycle_analytics[created_after|created_before] params, so validate_params (added to the summary endpoint in !266126 (merged)) would check the wrong values.
This adds validate_project_date_range to CycleAnalyticsParams. It checks the from/to that options(cycle_analytics_project_params) builds, using today as the end when created_before is missing, and returns 422 above 180 days with the same error as the summary endpoint. On show it only applies to JSON, because the HTML page doesn't run the query. The events actions build their query before respond_to, so they check every format.
The start_date presets (7/30/90 days) are within the limit, and nothing in the frontend calls these two paths.
How to set up and validate locally
Logged out, on a public project:
curl -s -o /dev/null -w '%{http_code}\n' 'http://gdk.test:3000/<ns>/<project>/-/value_stream_analytics.json?cycle_analytics[created_after]=2010-01-01' # 422
curl -s -o /dev/null -w '%{http_code}\n' 'http://gdk.test:3000/<ns>/<project>/-/value_stream_analytics/events/issue.json?cycle_analytics[created_after]=2010-01-01' # 422A 30-day range returns 200, and /-/value_stream_analytics (HTML) still loads.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist.
Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/636168