From 2a29125fb79f71d9ea74091d76470611fd7db5b8 Mon Sep 17 00:00:00 2001 From: caballeto Date: Wed, 22 Apr 2026 11:34:46 +0200 Subject: [PATCH] fix: drop bogus Incidents.delete and add StatusPages.reorder_layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two surface-parity gaps surfaced by `tests/surfaces/parity/`: 1. **Drop `Incidents.delete()`** — the underlying API endpoint `DELETE /api/v1/incidents/{id}` does not exist; calling this method would always return a 404. The method was a leftover from earlier API experimentation and was missing from sdk-js / mcp-server / cli, so the parity check (rightly) flagged sdk-python as out of sync. Removing it here is the canonical decision: incidents are auto-resolved or manually resolved via `incidents.resolve(...)`, never deleted. This is technically a breaking change to the `devhelm` Python package public API, but no real consumers exist (the method has never produced a successful response). Captured in the version bump for the next release. 2. **Add `StatusPages.reorder_layout(id, body)`** — hits the existing `PUT /api/v1/status-pages/{id}/layout/reorder` endpoint, mirroring `sdk-js.StatusPages.reorderLayout`. Wires through the `ReorderPageLayoutRequest` model (already in `_generated.py`); also re-exports it from the top-level `devhelm` package and `devhelm.types`, plus a harness entry for the surface-test suite. Synced uv.lock to match `devhelm` 0.2.0 already in pyproject.toml. Verified locally: - `pytest tests/` — 707 passed - `mypy src/` — clean - `ruff format` / `ruff check` — clean - `make test-surface SURFACE=sdk_python` (against test API) — 174 passed, 1 skipped Made-with: Cursor --- src/devhelm/__init__.py | 2 ++ src/devhelm/resources/incidents.py | 6 +----- src/devhelm/resources/status_pages.py | 14 ++++++++++++++ src/devhelm/types.py | 2 ++ tests/run_sdk.py | 9 ++++++--- uv.lock | 2 +- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/devhelm/__init__.py b/src/devhelm/__init__.py index 65b21d3..ab7b959 100644 --- a/src/devhelm/__init__.py +++ b/src/devhelm/__init__.py @@ -82,6 +82,7 @@ NotificationPolicyDto, PublishIncidentStatus, ReorderComponentsRequest, + ReorderPageLayoutRequest, ResolveIncidentRequest, ResourceGroupDto, ResourceGroupHealthStatus, @@ -204,6 +205,7 @@ "AddCustomDomainRequest", "AdminAddSubscriberRequest", "ReorderComponentsRequest", + "ReorderPageLayoutRequest", "CreateMonitorRequest", "UpdateMonitorRequest", "CreateManualIncidentRequest", diff --git a/src/devhelm/resources/incidents.py b/src/devhelm/resources/incidents.py index fb05577..78903d6 100644 --- a/src/devhelm/resources/incidents.py +++ b/src/devhelm/resources/incidents.py @@ -8,7 +8,7 @@ IncidentDto, ResolveIncidentRequest, ) -from devhelm._http import api_delete, api_get, api_post, path_param +from devhelm._http import api_get, api_post, path_param from devhelm._pagination import Page, fetch_all_pages, fetch_page from devhelm._validation import RequestBody, parse_single, validate_request @@ -57,7 +57,3 @@ def resolve( api_post(self._client, f"/api/v1/incidents/{path_param(id)}/resolve", body), f"POST /api/v1/incidents/{id}/resolve", ) - - def delete(self, id: int | str) -> None: - """Delete an incident.""" - api_delete(self._client, f"/api/v1/incidents/{path_param(id)}") diff --git a/src/devhelm/resources/status_pages.py b/src/devhelm/resources/status_pages.py index e066d93..d3db582 100644 --- a/src/devhelm/resources/status_pages.py +++ b/src/devhelm/resources/status_pages.py @@ -11,6 +11,7 @@ CreateStatusPageIncidentUpdateRequest, CreateStatusPageRequest, ReorderComponentsRequest, + ReorderPageLayoutRequest, StatusPageComponentDto, StatusPageComponentGroupDto, StatusPageCustomDomainDto, @@ -392,3 +393,16 @@ def update( def delete(self, id: int | str) -> None: """Delete a status page.""" api_delete(self._client, _page_path(id)) + + def reorder_layout( + self, id: int | str, body: RequestBody[ReorderPageLayoutRequest] + ) -> None: + """Batch-reorder the page layout: top-level sections (groups + + ungrouped components) and, optionally, within-group component ordering. + + Returns 204 No Content on success. + """ + body = validate_request( + ReorderPageLayoutRequest, body, "statusPages.reorderLayout" + ) + api_put(self._client, f"{_page_path(id)}/layout/reorder", body) diff --git a/src/devhelm/types.py b/src/devhelm/types.py index 7852f44..8206ce7 100644 --- a/src/devhelm/types.py +++ b/src/devhelm/types.py @@ -81,6 +81,7 @@ PublishStatusPageIncidentRequest, RecordType, ReorderComponentsRequest, + ReorderPageLayoutRequest, ResolutionReason, ResolveIncidentRequest, ResourceGroupDto, @@ -250,6 +251,7 @@ "NotificationPolicyDto", "PublishStatusPageIncidentRequest", "ReorderComponentsRequest", + "ReorderPageLayoutRequest", "ResolveIncidentRequest", "ResourceGroupDto", "ResourceGroupMemberDto", diff --git a/tests/run_sdk.py b/tests/run_sdk.py index 717372a..37a2d64 100644 --- a/tests/run_sdk.py +++ b/tests/run_sdk.py @@ -39,6 +39,7 @@ Devhelm, DevhelmError, ReorderComponentsRequest, + ReorderPageLayoutRequest, ResolveIncidentRequest, UpdateAlertChannelRequest, UpdateEnvironmentRequest, @@ -137,9 +138,6 @@ def run(client: Devhelm, resource: str, action: str, rest: list[str]) -> Any: # else None ) return client.incidents.resolve(rest[0], body) - if op == "incidents.delete": - client.incidents.delete(rest[0]) - return None # -- Alert Channels -- if op == "alert-channels.list": @@ -311,6 +309,11 @@ def run(client: Devhelm, resource: str, action: str, rest: list[str]) -> Any: # if op == "status-pages.delete": client.status_pages.delete(rest[0]) return None + if op == "status-pages.reorder-layout": + client.status_pages.reorder_layout( + rest[0], _parse(ReorderPageLayoutRequest, rest[1]) + ) + return None # -- Status Page Components -- if op == "status-pages.components.list": diff --git a/uv.lock b/uv.lock index 29f7416..88df424 100644 --- a/uv.lock +++ b/uv.lock @@ -331,7 +331,7 @@ wheels = [ [[package]] name = "devhelm" -version = "0.1.3" +version = "0.2.0" source = { editable = "." } dependencies = [ { name = "httpx" },