fix(synthetics): tolerate null in downtime list - #725
Open
platinummonkey wants to merge 2 commits into
Open
Conversation
…tion fails The typed V2 client rejects successful responses containing null where an array is expected (issue #722). Fall back to the null-tolerant raw JSON:API body via raw_client::raw_get only on the Serde error path, preserving the existing behavior for healthy responses and genuine HTTP errors. Co-authored-by: platinummonkey <cody.lee@datadoghq.com>
|
I can only run on private repositories. |
Katomoto
reviewed
Aug 13, 2026
Katomoto
left a comment
There was a problem hiding this comment.
Logic looks correct. One suggestion: the early return on line prevents the cleanup function from running — worth adding a finally block.
Collaborator
Author
@Katomoto will do a bit of follow up work here since it's common with other tests right now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
pup synthetics downtime listfailing on a successful API response with:The typed
datadog-api-clientV2 model deserializes downtime responses strictly, so anullwhere it expects a JSON array aborts the whole listing. This change adds a targeted fallback indowntime_list(src/commands/synthetics.rs):list_synthetics_downtimescall for the happy path (unchanged output, zero regression risk).datadog::Error::Serde(_)— the exact failure mode in synthetics downtime list fails to deserialize response (invalid type: null, expected a sequence) #722, which per the reporter occurs solely on 2xx responses — re-fetch via the existing null-tolerantraw_client::raw_getagainst/api/v2/synthetics/downtimesand emit the raw JSON:API body.--filter-test-ids/--filter-activefilters are forwarded on the fallback path (filter[test_ids]/filter[active], matching the repo's existing V2 filter convention inapm.rs).Motivation
synthetics downtime listis completely unusable against any org whose downtime payload contains a null array field: the strict typed model turns an otherwise-valid 2xx response into a hard error. Reusing the project's existingraw_client(rather than patching the pinned SDK crate) restores the command while leaving healthy responses and real error responses untouched.Additional Notes
raw_client::raw_get(same pattern asapm.rs/change_stories.rs) instead of introducing new HTTP plumbing; no new imports or dependencies.Serdedeserialization variant, so it can never mask legitimate API errors.datadog-api-clientgit dependency could not be fetched through the environment's proxy allowlist, socargo build/cargo testcould not be run here. Verified withcargo fmt --check(passes) plus manual review. CI will run the full build/clippy/test matrix.Testing
Added two unit tests in the existing
mockito-based harness:test_synthetics_downtime_list_falls_back_on_deserialize_error— a 2xx body the typed model can't deserialize now yields output via the raw fallback instead of an error.test_synthetics_downtime_list_fallback_with_filters— the fallback path with both filters set.Existing tests remain valid:
test_synthetics_downtime_list(healthy{"data":[]}→ typed path) andtest_synthetics_downtime_list_error(403 → error) are unaffected.Checklist
Related Issues
Closes #722
PR by Bits - View session in Datadog
Comment @DataDog to request changes