Skip to content

fix(bundler): reject falsy non-mapping requires/provides in CatalogEntry.from_dict#3667

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/catalog-entry-falsy-mapping-guard
Open

fix(bundler): reject falsy non-mapping requires/provides in CatalogEntry.from_dict#3667
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/catalog-entry-falsy-mapping-guard

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

CatalogEntry.from_dict used data.get("requires") or {} and data.get("provides") or {}. The or {} coerces a falsy non-mapping value ([], '', 0, false) to {} before the isinstance guard runs — so a corrupt catalog entry with e.g. requires: [] passed validation silently. Only a truthy non-mapping (e.g. provides: "extensions") reached the guard and raised.

This is the same falsy-coercion hole fixed for the bundle manifest in #3629 / #3661 and for records in a sibling PR — this closes it for catalog entries.

Fix

Handle None explicitly (default to {}) and reject every other non-mapping.

Tests

tests/contract/test_catalog_schema.py::test_catalog_entry_rejects_falsy_non_mapping — parametrized over requires/provides × []/''/0/False; all raise after the fix, all passed silently before. ruff clean; all 29 contract tests pass.


AI-assisted: authored with Claude Code. Verified against the merged manifest mapping guards and confirmed fail-before/pass-after.

…try.from_dict

CatalogEntry.from_dict used `data.get("requires") or {}` and
`data.get("provides") or {}`, so a FALSY non-mapping ([], '', 0, false) was
coerced to {} before the isinstance guard — a corrupt catalog entry passed
silently. Only a truthy non-mapping was rejected.

Handle None explicitly and reject every other non-mapping, mirroring the
merged manifest requires/provides/integration guards (github#3629, github#3661).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jawwad-ali
jawwad-ali requested a review from mnriem as a code owner July 22, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant