Skip to content

Fix: default interval on AnalyticsTrendsParameter to satisfy live API - #631

Merged
diemol merged 1 commit into
mainfrom
fix-analytics-trends-required-interval
Sep 16, 2026
Merged

diemol merged 1 commit into
mainfrom
fix-analytics-trends-required-interval

Conversation

@diemol

@diemol diemol commented Sep 16, 2026

Copy link
Copy Markdown
Member

Description

GET /v1/analytics/trends/tests (InsightsEndpoint.getTestTrends, AnalyticsTrendsParameter) rejects requests with 422 Unprocessable Entity when interval isn't set:

{"detail":[{"type":"missing","loc":["query","interval"],"msg":"Field required","input":null}]}

...despite the Insights API docs listing interval as optional with a default of 1d. This PR defaults it client-side in AnalyticsTrendsParameter.Builder.build() when not explicitly set, the same way TestResultParameter.Builder.build() already defaults size to 10.

Motivation and Context

This is currently failing CI's live "Integration Tests" job on every PR (introduced in #629, the Insights API PR): InsightsEndpointTest.getTestTrendsTest fails on both US_WEST and EU_CENTRAL with the 422 above. I found it while checking CI status on an unrelated PR (#630) and confirmed the root cause and the fix against the live API with curl.

How Has This Been Tested?

  • Reproduced the 422 directly against https://api.us-west-1.saucelabs.com/v1/analytics/trends/tests with curl, using real credentials, both with and without interval — confirmed adding interval=1d resolves it.
  • mvn test -Dtest=AnalyticsTrendsParameterTest — added a regression test (testToMapDefaultsIntervalWhenNotSet) plus the existing tests, all pass.
  • mvn test -Dtest=InsightsEndpointTest#getTestTrendsTest — the live integration test that was failing now passes against both US_WEST and EU_CENTRAL.
  • mvn test -Dtest=com.saucelabs.saucerest.unit.** — full unit suite passes.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (change which improves current code base; please describe the change)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Screenshots (if appropriate):

N/A

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests passed locally
  • I have added necessary documentation (if appropriate)

Further comments

Filed as its own small PR rather than folding it into #630, since it's an unrelated pre-existing bug on main rather than part of the Performance API work.

🤖 Generated with Claude Code

GET /v1/analytics/trends/tests rejects requests with a 422 when
`interval` is omitted, even though the docs list it as optional
with a default of 1d. Default it client-side to match the documented
behavior, the same way TestResultParameter.Builder already defaults
`size`.

Verified against the live API (both start/end and time_range paths);
this was breaking the getTestTrendsTest integration test in CI on
every PR since #629 merged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@diemol
diemol enabled auto-merge (squash) September 16, 2026 14:39
@diemol
diemol disabled auto-merge September 16, 2026 14:39
@diemol
diemol merged commit be96032 into main Sep 16, 2026
12 checks passed
@diemol
diemol deleted the fix-analytics-trends-required-interval branch September 16, 2026 14:39
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.

1 participant