The incident was caused by a logic error in the a_primitive? method that breaks handling of nil values.
Old logic (working):
elsif usage_schema.is_a?(Maestro::Runtime::Usage::Primitive) &&
[Hash, Array].exclude?(json_response.class) &&
!json_response.nil?
return json_responseNew logic (broken):
def a_primitive?(json_response)
json_response.present? && NON_PRIMITIVE_TYPES.exclude?(json_response.class)
end- Old code: Used
!json_response.nil?- returnsfalseonly fornil - New code: Uses
json_response.present?- returnsfalsefornil,false, empty string"", empty array[], etc.
When a primitive field has a false boolean value:
- Old code: Would correctly identify
falseas a primitive and return it - New code:
false.present?returnsfalse, soa_primitive?(false)returnsfalse - This causes the code to fall through to
raise_value_type_mismatch - Result: Raises
ValueTypeMismatchexception when processing booleanfalsevalues
# Workflow returns: { "return_value" => { "is_enabled" => false } }
# With usage_schema expecting a boolean primitive
# New code flow:
1. traverse_usage_schema called with (Primitive::Boolean, false)
2. a_primitive?(false) returns false because false.present? is false
3. Falls through to raise_value_type_mismatch
4. Raises: "Value false is of type FalseClass but should be of type Maestro::Runtime::Usage::Primitive::Boolean"Any workflow that:
- Returns a boolean
falsevalue - Or returns an empty string
"" - Or any other "falsy" value that fails the
present?check
Would immediately start failing with ValueTypeMismatch exceptions, breaking production workflows.
Replace:
def a_primitive?(json_response)
json_response.present? && NON_PRIMITIVE_TYPES.exclude?(json_response.class)
endWith:
def a_primitive?(json_response)
!json_response.nil? && NON_PRIMITIVE_TYPES.exclude?(json_response.class)
endOr even simpler:
def a_primitive?(json_response)
NON_PRIMITIVE_TYPES.exclude?(json_response.class) && !json_response.nil?
endThis preserves the original logic that only excludes nil values, not all falsy values.