Skip to content

Commit 0cf6b57

Browse files
committed
chore(forensics): refresh types after mono details JSONB + reason cleanup
Picks up the schema changes from devhelmhq/mono#316: - IncidentStateTransitionDto gains a `details: dict[str, Any]` field. User-driven transitions carry `details["source"] = "public-api"`; pipeline-driven ones carry `details["source"] = "pipeline"`. - Transition `reason` description aligns with what the engine actually writes (trigger | confirm | resolve | auto_clear | reopen). The earlier `manually_resolved` was a parallel reason value for the same logical edge — replaced by reason="resolve" + details.source="public-api". Pure regen via `./scripts/typegen.sh`. The mono PR also added `@Schema(additionalProperties = TRUE)` on the Java DTO so Springdoc emits `additionalProperties: true` instead of `additionalProperties: {type: "object"}`, yielding `dict[str, Any]` here instead of `dict[str, dict[str, Any]]`. Without that fix the Pydantic model would fail to parse real responses (`details.source` is a string, not a nested dict). Made-with: Cursor
1 parent 6681850 commit 0cf6b57

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

docs/openapi/monitoring-api.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25631,24 +25631,24 @@
2563125631
},
2563225632
"triggeringCheckId": {
2563325633
"type": "string",
25634-
"description": "Scheduler-minted check execution ID whose result confirmed this incident; joins to check_results, rule_evaluations, and incident_state_transitions",
25634+
"description": "Scheduler-minted check execution ID whose result confirmed this incident; joins to check_results, rule_evaluations, and incident_state_transitions. Omitted from JSON (undefined to SDKs) when null, treat missing as null.",
2563525635
"format": "uuid",
2563625636
"nullable": true
2563725637
},
2563825638
"triggeredByRuleSnapshotHashHex": {
2563925639
"type": "string",
25640-
"description": "Hex SHA-256 of the canonical policy snapshot that fired; combined with triggeredByRuleIndex points to the exact TriggerRule",
25640+
"description": "Hex SHA-256 of the canonical policy snapshot that fired; combined with triggeredByRuleIndex points to the exact TriggerRule. Omitted from JSON when null, treat missing as null.",
2564125641
"nullable": true
2564225642
},
2564325643
"triggeredByRuleIndex": {
2564425644
"type": "integer",
25645-
"description": "Index of the fired rule inside the policy's trigger_rules array",
25645+
"description": "Index of the fired rule inside the policy's trigger_rules array. Omitted from JSON when null, treat missing as null.",
2564625646
"format": "int32",
2564725647
"nullable": true
2564825648
},
2564925649
"engineVersion": {
2565025650
"type": "string",
25651-
"description": "Detection engine semver that evaluated the rule",
25651+
"description": "Detection engine semver that evaluated the rule. Omitted from JSON when null, treat missing as null.",
2565225652
"nullable": true
2565325653
}
2565425654
},
@@ -25864,6 +25864,7 @@
2586425864
"required": [
2586525865
"affectedRegions",
2586625866
"checkId",
25867+
"details",
2586725868
"engineVersion",
2586825869
"fromStatus",
2586925870
"id",
@@ -25910,7 +25911,7 @@
2591025911
"reason": {
2591125912
"minLength": 1,
2591225913
"type": "string",
25913-
"description": "Why the transition fired (rule_matched | confirmation_met | auto_cleared_by_timeout | recovery_met | reopened | manually_resolved | policy_changed)"
25914+
"description": "Why the transition fired (trigger | confirm | resolve | auto_clear | reopen)"
2591425915
},
2591525916
"triggeringEvaluationIds": {
2591625917
"type": "array",
@@ -25943,6 +25944,11 @@
2594325944
"type": "string",
2594425945
"description": "Scheduler-minted check execution ID (V92) of the triggering result",
2594525946
"format": "uuid"
25947+
},
25948+
"details": {
25949+
"type": "object",
25950+
"additionalProperties": true,
25951+
"description": "Free-form JSON metadata. Key `source` discriminates actor: 'pipeline' (default) vs 'public-api' (user-driven)"
2594625952
}
2594725953
},
2594825954
"description": "State-machine transitions this check caused (may be empty if nothing fired)"

src/devhelm/_generated.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: .openapi-preprocessed.json
3-
# timestamp: 2026-04-27T13:26:18+00:00
3+
# timestamp: 2026-04-29T16:35:27+00:00
44

55
from __future__ import annotations
66
from typing import Annotated, Any, Literal
@@ -2204,28 +2204,28 @@ class IncidentDto(BaseModel):
22042204
UUID | None,
22052205
Field(
22062206
alias="triggeringCheckId",
2207-
description="Scheduler-minted check execution ID whose result confirmed this incident; joins to check_results, rule_evaluations, and incident_state_transitions",
2207+
description="Scheduler-minted check execution ID whose result confirmed this incident; joins to check_results, rule_evaluations, and incident_state_transitions. Omitted from JSON (undefined to SDKs) when null, treat missing as null.",
22082208
),
22092209
] = None
22102210
triggered_by_rule_snapshot_hash_hex: Annotated[
22112211
str | None,
22122212
Field(
22132213
alias="triggeredByRuleSnapshotHashHex",
2214-
description="Hex SHA-256 of the canonical policy snapshot that fired; combined with triggeredByRuleIndex points to the exact TriggerRule",
2214+
description="Hex SHA-256 of the canonical policy snapshot that fired; combined with triggeredByRuleIndex points to the exact TriggerRule. Omitted from JSON when null, treat missing as null.",
22152215
),
22162216
] = None
22172217
triggered_by_rule_index: Annotated[
22182218
int | None,
22192219
Field(
22202220
alias="triggeredByRuleIndex",
2221-
description="Index of the fired rule inside the policy's trigger_rules array",
2221+
description="Index of the fired rule inside the policy's trigger_rules array. Omitted from JSON when null, treat missing as null.",
22222222
),
22232223
] = None
22242224
engine_version: Annotated[
22252225
str | None,
22262226
Field(
22272227
alias="engineVersion",
2228-
description="Detection engine semver that evaluated the rule",
2228+
description="Detection engine semver that evaluated the rule. Omitted from JSON when null, treat missing as null.",
22292229
),
22302230
] = None
22312231

@@ -2374,7 +2374,7 @@ class IncidentStateTransitionDto(BaseModel):
23742374
reason: Annotated[
23752375
str,
23762376
Field(
2377-
description="Why the transition fired (rule_matched | confirmation_met | auto_cleared_by_timeout | recovery_met | reopened | manually_resolved | policy_changed)",
2377+
description="Why the transition fired (trigger | confirm | resolve | auto_clear | reopen)",
23782378
min_length=1,
23792379
),
23802380
]
@@ -2415,6 +2415,12 @@ class IncidentStateTransitionDto(BaseModel):
24152415
description="Scheduler-minted check execution ID (V92) of the triggering result",
24162416
),
24172417
]
2418+
details: Annotated[
2419+
dict[str, Any],
2420+
Field(
2421+
description="Free-form JSON metadata. Key `source` discriminates actor: 'pipeline' (default) vs 'public-api' (user-driven)"
2422+
),
2423+
]
24182424

24192425

24202426
class OldStatus(StrEnum):

0 commit comments

Comments
 (0)