Skip to content

fix(statuspage): parse live v2 shape; guard maintenance status-page overflow#51

Merged
KhaledSalhab-Develeap merged 3 commits into
mainfrom
fix/statuspage-model-subdomain-optional
Jul 14, 2026
Merged

fix(statuspage): parse live v2 shape; guard maintenance status-page overflow#51
KhaledSalhab-Develeap merged 3 commits into
mainfrom
fix/statuspage-model-subdomain-optional

Conversation

@KhaledSalhab-Develeap

@KhaledSalhab-Develeap KhaledSalhab-Develeap commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two live-API defects plus a chunking helper, found while wiring maintenance windows to all tenant status pages. All behaviour verified against the live Hyperping API on 2026-07-14.

1. list_status_pages() returned an empty list

The StatusPage model required a subdomain field, but the v2 API returns the hosted subdomain under hostedsubdomain and omits it for custom-domain pages. Every record failed validation and was silently skipped (list_status_pages()[]).

  • subdomain is now optional and aliased to hostedsubdomain; hostname and url are parsed.

2. create_maintenance() silently phantom-failed above 51 status pages

Hyperping's v1 maintenance-windows API accepts a create with a large statuspages array (returns {"uuid": ...}) but never persists the window — the follow-up GET 404s and it is absent from the list. The cutoff is exactly 51 (51 persists, 52+ vanishes), bracketed against the live API.

  • create_maintenance() (sync + async) now raises HyperpingValidationError above MAX_STATUSPAGES_PER_MAINTENANCE (51) instead of returning a phantom window.

3. create_maintenance_windows() — chunk large page sets

New sync + async helper that splits a large statuspages list into consecutive windows of ≤51 pages, so a caller (e.g. a broadcast-to-all-tenants command) can cover more pages than one window allows. Each window carries the full monitor set (the API requires ≥1 monitor per window; verified). MAX_STATUSPAGES_PER_MAINTENANCE is exported for callers that chunk themselves.

Tests

  • StatusPage: live-v2-shape parse + missing-subdomain parse.
  • Maintenance: >51 guard, chunk-splitting (60 pages → windows of 51 + 9), bad chunk_size.
  • test_statuspages.py + test_maintenance.py: 47 passed. ruff + mypy clean.

Version

1.8.0 → 1.8.1 (+ CHANGELOG).

Consumer note

hyp maintenance broadcast (hyperping-automation repo) passes all ~57 tenant pages in one call and must switch to create_maintenance_windows() after bumping this SDK to 1.8.1.

…verflow

list_status_pages() returned [] against the live v2 API: the StatusPage model
required 'subdomain', but the API returns the hosted subdomain under
'hostedsubdomain' (and omits it for custom-domain pages), so every record failed
validation and was silently dropped. Make subdomain optional + aliased to
hostedsubdomain; also parse hostname and url.

create_maintenance() silently phantom-failed with >51 status pages: the API
returns a uuid but never persists the window. Guard with a clear
HyperpingValidationError (MAX_STATUSPAGES_PER_MAINTENANCE=51, verified live).

Bump 1.8.0 -> 1.8.1; add tests for both.
…ages

Callers that need to cover more than 51 status pages (e.g. a broadcast to all
tenant status pages) hit the per-window limit that create_maintenance() now
rejects. create_maintenance_windows() splits the statuspages list into
consecutive windows of at most 51 pages, each carrying the full monitor set
(the API requires >=1 monitor per window). Added on both the sync and async
clients; MAX_STATUSPAGES_PER_MAINTENANCE is exported for callers that chunk
themselves. Also adds the >51 guard to the async create_maintenance for parity.
@KhaledSalhab-Develeap KhaledSalhab-Develeap merged commit cdb1126 into main Jul 14, 2026
3 checks passed
@KhaledSalhab-Develeap KhaledSalhab-Develeap deleted the fix/statuspage-model-subdomain-optional branch July 14, 2026 12:02
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