fix(bundler): reject falsy non-mapping requires/provides in manifest from_dict#3661
Open
jawwad-ali wants to merge 2 commits into
Open
fix(bundler): reject falsy non-mapping requires/provides in manifest from_dict#3661jawwad-ali wants to merge 2 commits into
jawwad-ali wants to merge 2 commits into
Conversation
…from_dict
BundleManifest.from_dict used `data.get("requires") or {}` and
`data.get("provides") or {}`, so a FALSY non-mapping value ([], '', 0,
false) was coerced to {} BEFORE the isinstance guard — a malformed manifest
passed validation as one that requires/provides nothing. Only a truthy
non-mapping (e.g. "extensions") was rejected.
Handle None explicitly (default to {}) and reject every other non-mapping,
matching the sibling 'integration' guard added in github#3629. Absent fields still
parse to the empty default.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
BundleManifest.from_dictuseddata.get("requires") or {}anddata.get("provides") or {}. Theor {}coerces a falsy non-mapping value ([],'',0,false) to{}before theisinstanceguard runs — so a malformed manifest silently passed validation as one that requires/provides nothing. Only a truthy non-mapping (e.g.provides: "extensions") reached the guard and raised.The sibling
integrationguard (added in #3629) already does this correctly with an explicitis not Nonecheck;requires/provideswere the remaining holes.Fix
Handle
Noneexplicitly (default to{}) and reject every other non-mapping:…and the same for
provides. Absent fields still parse to the empty default.Tests
tests/contract/test_manifest_schema.py:test_non_mapping_provides_rejected_including_falsyandtest_non_mapping_requires_rejected_including_falsy— parametrized over[],'',0,False, and a truthy string; all raise after the fix (the falsy ones passed silently before)test_absent_provides_and_requires_do_not_raise_mapping_error— absent (None) optional mappings still parse without tripping the guardruffclean; all 28 contract tests pass.AI-assisted: authored with Claude Code. Verified the falsy-coercion hole against the merged
integrationguard (#3629) and confirmed fail-before/pass-after.