Files
ead30d9cfb fix(integrations): report a falsy non-mapping integration descriptor as a shape error (#4187)
* fix(integrations): report a falsy non-mapping integration descriptor as a shape error

`IntegrationDescriptor._load` did `yaml.safe_load(fh) or {}`. `_validate`
opens with an `isinstance(self.data, dict)` check, so a truthy non-mapping
(`- a`, `hello`) is reported correctly -- but `or {}` replaced the falsy
non-mappings with an empty mapping first, so those descriptors were
reported as "Missing required field: schema_version" instead of the wrong
shape:

  'false' -> Descriptor root must be a YAML mapping, got bool
  '0'     -> Descriptor root must be a YAML mapping, got int
  "''"    -> Descriptor root must be a YAML mapping, got str
  '[]'    -> Descriptor root must be a YAML mapping, got list

`safe_load` also returns None for an explicit null scalar (`null`, `~`,
`NULL`) as well as for an empty document, so those three hit the same
masking. Use `yaml.compose`, which yields no node only for a genuinely
empty document, to tell the two apart -- only an empty document still
normalizes to `{}` and reports its missing fields.

Same bug class just fixed in the sibling overlay-manifest loader
(upstream commit 39c36c4, PR #3884); this is the unfixed twin in the
integration catalog's descriptor loader.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-19 16:56:31 -05:00
..