[fix] Add defensive check in Manifest Scanner#13612
Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom Jan 16, 2026
Merged
Conversation
Contributor
✅ PR preview is ready!
|
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds defensive handling for distributions with missing or invalid names in the component manifest scanner. The fix prevents potential runtime errors when the scanner encounters malformed distribution metadata during package scanning.
Changes:
- Added a defensive check in
_is_likely_streamlit_component_package()to validate thatdist.nameexists and is a non-empty string before attempting to process it - Added a unit test to verify that distributions with
Noneor invalid names are properly skipped during scanning
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/streamlit/components/v2/manifest_scanner.py | Added defensive check to validate dist.name is a valid string before processing in the filter function |
| lib/tests/streamlit/components/v2/test_manifest_scanner.py | Added test case verifying distributions without valid names are skipped and valid distributions are still processed |
Comments suppressed due to low confidence (1)
lib/tests/streamlit/components/v2/test_manifest_scanner.py:320
- The test doesn't cover the type check portion of the defensive logic (
not isinstance(dist_name, str)). Consider adding a test case wheredist.nameis set to an integer or other non-string type to verify that branch of the condition is also working correctly.
nameless_dist = Mock()
nameless_dist.name = None
32417c6 to
defa929
Compare
defa929 to
f04e9f4
Compare
Contributor
📉 Frontend coverage change detectedThe frontend unit test (vitest) coverage has decreased by 0.0500%
💡 Consider adding more unit tests to maintain or improve coverage. |
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.

Describe your changes
Added defensive handling for distributions without a valid name in the component manifest scanner. The scanner now properly skips distributions with missing or invalid names instead of potentially raising errors during processing.
This was raised in this comment: #13600 (comment)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.