clients/python: SDK methods for AcknowledgeAlarm + QueryActiveAlarms (PR E.3) #107

Merged
dohertj2 merged 1 commits from track-e3-python-alarm-sdk into main 2026-04-30 16:52:54 -04:00
Owner

Summary

Eighth PR of the alarms-over-gateway epic (docs/plans/alarms-over-gateway.md). Mirrors PR E.2's .NET surface on the Python async SDK. Depends on PR E.1 (#105, merged).

  • GatewayClient.acknowledge_alarm — async unary call routed through the existing _unary helper. ensure_protocol_success raises typed gateway errors for non-OK protocol statuses; map_rpc_error wraps RpcErrorMxGatewayAuthenticationError / MxGatewayAuthorizationError on Unauthenticated / PermissionDenied.
  • GatewayClient.query_active_alarms — async iterator over ActiveAlarmSnapshot. Mirrors stream_events_raw's cancel-on-close pattern via a dedicated _canceling_active_alarms_iterator.

CLI verb (alarms subscribe / acknowledge / query-active) deferred to a follow-up — the SDK surface is what consumers depend on; the CLI port shares the JSON output shape with E.2's .NET CLI for cross-language tooling.

Test plan

  • 6 new tests in tests/test_alarms.py — request shape, Unauthenticated + PermissionDenied mapping, snapshot streaming, filter prefix passthrough, cancel-on-aclose
  • Full Python test suite: 39 passed (was 33; 6 new)
## Summary Eighth PR of the **alarms-over-gateway** epic (docs/plans/alarms-over-gateway.md). Mirrors PR E.2's .NET surface on the Python async SDK. Depends on PR E.1 (#105, merged). - `GatewayClient.acknowledge_alarm` — async unary call routed through the existing `_unary` helper. `ensure_protocol_success` raises typed gateway errors for non-OK protocol statuses; `map_rpc_error` wraps `RpcError` → `MxGatewayAuthenticationError` / `MxGatewayAuthorizationError` on Unauthenticated / PermissionDenied. - `GatewayClient.query_active_alarms` — async iterator over `ActiveAlarmSnapshot`. Mirrors `stream_events_raw`'s cancel-on-close pattern via a dedicated `_canceling_active_alarms_iterator`. CLI verb (alarms subscribe / acknowledge / query-active) deferred to a follow-up — the SDK surface is what consumers depend on; the CLI port shares the JSON output shape with E.2's .NET CLI for cross-language tooling. ## Test plan - [x] 6 new tests in `tests/test_alarms.py` — request shape, Unauthenticated + PermissionDenied mapping, snapshot streaming, filter prefix passthrough, cancel-on-aclose - [x] Full Python test suite: 39 passed (was 33; 6 new)
dohertj2 added 1 commit 2026-04-30 16:52:52 -04:00
Eighth PR of the alarms-over-gateway epic
(docs/plans/alarms-over-gateway.md). Mirrors PR E.2's .NET surface
on the Python async SDK. Depends on PR E.1 (regen, merged).

- GatewayClient.acknowledge_alarm — async unary call routed through
  the existing _unary helper. ensure_protocol_success raises typed
  gateway errors for non-OK protocol statuses; map_rpc_error wraps
  RpcError → MxGatewayAuthenticationError /
  MxGatewayAuthorizationError on Unauthenticated /
  PermissionDenied responses.
- GatewayClient.query_active_alarms — async iterator over
  ActiveAlarmSnapshot. Mirrors stream_events_raw's cancel-on-close
  pattern via a dedicated _canceling_active_alarms_iterator (typed
  for ActiveAlarmSnapshot).

Tests:
- 6 new tests in test_alarms.py — request shape, Unauthenticated +
  PermissionDenied mapping, snapshot streaming, filter prefix
  passthrough, cancel-on-aclose semantics.
- Full Python test suite: 39 passed (was 33; 6 new).

CLI verb (alarms subscribe / acknowledge / query-active) deferred —
the SDK surface is what lmxopcua consumes; CLI follow-up shares the
JSON output shape with E.2's .NET CLI for cross-language tooling.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit 10004879f6 into main 2026-04-30 16:52:54 -04:00
dohertj2 deleted branch track-e3-python-alarm-sdk 2026-04-30 16:52:55 -04:00
Sign in to join this conversation.