mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
* fix(cloudwatch): return DatapointsToAlarm from the JSON DescribeAlarms response The Query/XML handler has always written DatapointsToAlarm, TreatMissingData and Unit into its alarm element. The JSON/CBOR builder in CloudWatchMetricsJsonHandler.handleDescribeAlarms never emitted any of the three, so a client speaking smithy-rpc-v2-cbor or application/x-amz-json-1.0 to CloudWatch saw them missing from every DescribeAlarms response. Recent botocore and AWS CLI versions default to CBOR for this service, so that is the common path. PutMetricAlarm already parsed and stored all three on both protocols, so only the response builder needed the fields. * fix(cloudwatch): report DatapointsToAlarm only when the caller set one Review feedback on #3660. Emitting the field unconditionally broke Terraform idempotency, and native arm64 / compat-terraform caught it. PutMetricAlarm defaulted DatapointsToAlarm to EvaluationPeriods at storage time for the evaluator's M-out-of-N maths, and the primitive int on MetricAlarm left nothing to distinguish a caller's value from that default. Every alarm then reported a number nobody asked for, and compat-terraform's alarm, which sets no datapoints_to_alarm, drifted on every re-plan. MetricAlarm now holds a nullable Integer carrying only what the caller sent. AlarmEvaluator supplies EvaluationPeriods for the maths instead, so evaluation is unchanged. Both response builders emit the member only when it is set, which closes the same latent gap on the Query path. CloudWatchCfnProvisioner also minted a value from EvaluationPeriods, so a template that names no M now leaves the alarm without one. Its two tests move with it, and a third covers a template that does name one.