Skip to content

feat(gooddata-sdk): [AUTO] Add alert trigger ONCE_PER_INTERVAL with interval granularity field#1568

Open
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C002-20260420-r82171
Open

feat(gooddata-sdk): [AUTO] Add alert trigger ONCE_PER_INTERVAL with interval granularity field#1568
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C002-20260420-r82171

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added CatalogAutomationAlert SDK wrapper class with new interval field and ONCE_PER_INTERVAL trigger support. Added alert field to CatalogDeclarativeAutomation. Exported CatalogAutomationAlert from the public API surface. Two unit tests added (no cassettes required).

Impact: new_feature | Services: gooddata-automation-client, gooddata-metadata-client

Files changed

  • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/catalog/test_catalog_workspace.py

Agent decisions

Decisions (4)

condition and execution field types — Use dict[str, Any] for condition and execution in CatalogAutomationAlert

  • Alternatives: Create full CatalogAutomationAlertCondition and CatalogAlertAfm wrapper classes, Use Any type
  • Why: AutomationAlertCondition is a complex discriminated union; AlertAfm is a complex AFM object. The SDK already uses dict for comparably complex nested fields (e.g., metadata: dict | None in CatalogDeclarativeAutomation). Using dict avoids a large scope expansion while still allowing full round-trip serialization via AutomationAlert.from_dict.

where to add CatalogAutomationAlert — Add CatalogAutomationAlert to existing automation.py alongside the other CatalogAutomation* classes

  • Alternatives: Create a separate alert.py file
  • Why: All automation-related wrapper classes live in automation.py; keeping CatalogAutomationAlert there maintains cohesion.

alert field previously absent from CatalogDeclarativeAutomation — Add alert: CatalogAutomationAlert | None = None to CatalogDeclarativeAutomation

  • Alternatives: Leave alert field absent and only update the API client
  • Why: The OpenAPI diff sdk_impact is 'new_feature'. Without exposing alert in the SDK, users cannot set trigger=ONCE_PER_INTERVAL or interval on their alerts. The alert field was silently dropped on round-trip before this change.

from future import annotations — Added to automation.py (was missing before)

  • Why: Required by SDK coding standards; also needed for the forward reference to CatalogAutomationAlert inside CatalogDeclarativeAutomation.
Assumptions to verify (2)
  • AutomationAlert.from_dict() accepts plain Python dicts for condition and execution — consistent with how DeclarativeAutomation handles metadata: dict, but not confirmed by running tests due to environment restrictions.
  • The alert field in DeclarativeAutomation was intentionally omitted in the SDK previously (not a pre-existing bug).
Risks (2)
  • If AutomationAlert.from_dict() strictly type-checks condition as AutomationAlertCondition and rejects plain dicts, test_catalog_automation_alert_once_per_interval will fail at to_api(). Fix: override to_api() to pass _check_type=False to AutomationAlert constructor.
  • The existing test_layout_automations cassette does not include an alert field; re-recording would be needed for a full alert round-trip integration test.
Layers touched (3)
  • declarative_model — Added CatalogAutomationAlert class; added alert field to CatalogDeclarativeAutomation
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py
  • public_api — Exported CatalogAutomationAlert
    • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • tests — Added two unit tests for CatalogAutomationAlert (no cassette needed)
    • packages/gooddata-sdk/tests/catalog/test_catalog_workspace.py

Source commits (gdc-nas)

  • fd55e3f Merge pull request #22089 from Tjev/cq-2090
OpenAPI diff
+                  "interval": {
+                    "description": "Date granularity for the interval of ONCE_PER_INTERVAL trigger. Supported granularities: DAY, WEEK, MONTH, QUARTER, YEAR.",
+                    "enum": [
+                      "DAY",
+                      "WEEK",
+                      "MONTH",
+                      "QUARTER",
+                      "YEAR"
+                    ],
+                    "type": "string"
+                  },
                   "trigger": {
                     "default": "ALWAYS",
-                    "description": "Trigger behavior for the alert.\nALWAYS...\nONCE...",
+                    "description": "Trigger behavior for the alert.\nALWAYS...\nONCE...\nONCE_PER_INTERVAL - alert is triggered when the condition is met, then suppressed for the interval.",
                     "enum": [
                       "ALWAYS",
-                      "ONCE"
+                      "ONCE",
+                      "ONCE_PER_INTERVAL"
                     ]

Workflow run


Generated by SDK OpenAPI Sync workflow

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