mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* fix(core): use self-closing tags for empty XmlBuilder values XmlBuilder.elem(name, "") produced <name></name> for empty string values, which caused some XML consumers (e.g. Terraform AWS provider) to crash with nil pointer dereference. Now empty string values render as self-closing <name/> instead, which is semantically identical but avoids the parser crash. Null values remain skipped entirely. * fix(ec2): conditionally omit stateReason instead of self-closing empty tags The previous approach (self-closing tags for empty XmlBuilder values) was wrong for two reasons: 1. AWS emits <tag></tag> (paired tags), not <tag/> — verified against botocore rest-xml protocol fixtures (XmlEmptyStrings, XmlEmptyBlobs). 2. Go's encoding/xml tokenizes both forms identically (StartElement + EndElement, no CharData), so the Terraform crash persisted either way. Real fix: stop hardcoding <stateReason><code></code><message></message> in Ec2QueryHandler for every instance. AWS omits stateReason entirely when there is none (e.g. a running instance). Now it is only emitted when stateReasonCode or stateReasonMessage is present. XmlBuilder.elem() reverted to its original paired-tag behavior. Added Instance.stateReasonCode/stateReasonMessage model fields. Updated Ec2InstanceResponseShapeTest to assert null for running instances (matching real AWS behavior).