Skip to content

fix(downtime_schedules): request include=created_by on source fetches#628

Merged
riyazsh merged 6 commits into
mainfrom
riyaz/HAMR-392-downtime-obo-include-created-by
Jul 15, 2026
Merged

fix(downtime_schedules): request include=created_by on source fetches#628
riyazsh merged 6 commits into
mainfrom
riyaz/HAMR-392-downtime-obo-include-created-by

Conversation

@riyazsh

@riyazsh riyazsh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The v2 downtime API omits the relationships block on both LIST and per-id GET responses unless the caller passes include=created_by. Sync-cli currently doesn't pass it, so source-side state files have relationships.created_by.data.id empty. Any consumer that keys on that field (e.g. downstream tooling that routes each resource under its creator's identity for OBO'd writes) can't determine the creator.

Change

  • get_resources (LIST) and import_resource (per-id GET) now pass params={"include": "created_by"}.
  • Per-id GET unwraps the JSON:API envelope's data element so import_resource sees a bare resource object. Matches the sibling-resource convention (users.py, notebooks.py, service_level_objectives.py).

Test plan

  • 4 new unit tests: LIST include, per-id GET include, per-id GET envelope unwrap, pre-fetched resource pass-through.
  • Full unit suite green apart from 6 pre-existing failures in test_custom_client_trust_env.py (unrelated).
  • Integration cassettes re-recorded locally against EU1 source + US5 destination. CI playback may still fail if maintainer CI dev-orgs differ from my local dev-orgs (the recorded monitor body will be org-specific). Cassettes will likely need one more re-record on merge using the CI-owned dev-org credentials.
  • Pre-merge review applied (two independent prompts, structural + checklist). Findings addressed across commits.

LIST and per-id GET now pass `include=created_by`, so the response body
carries `relationships.created_by.data.id`. Without the include, the
`relationships` block is omitted entirely.

Per-id GET also unwraps the JSON:API envelope's `data` element so the
rest of `import_resource` sees a bare resource object either way (the
LIST path already unwraps via `paginated_request`).
@riyazsh riyazsh requested a review from a team as a code owner July 14, 2026 18:43
riyazsh added 4 commits July 14, 2026 14:46
Pre-merge review flagged that the defensive `envelope.get("data", envelope)`
form silently masks a list-shaped `data` field (would crash later inside
`resource["attributes"]` with a confusing TypeError). Peer resources
(`users.py`, `notebooks.py`, `service_level_objectives.py`) all use raw
`["data"]`, which fails loud on any unexpected shape. Match that.
michael-richey
michael-richey previously approved these changes Jul 14, 2026
@riyazsh riyazsh merged commit e5c800d into main Jul 15, 2026
11 of 12 checks passed
@riyazsh riyazsh deleted the riyaz/HAMR-392-downtime-obo-include-created-by branch July 15, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants