-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] showErrorDetails config parsing for deprecation warnings #12794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] showErrorDetails config parsing for deprecation warnings #12794
Conversation
- Updated _error_details_in_browser_enabled() to properly check for 'full' or True variations - Fixed boolean coercion bug where all non-empty strings were treated as True - Added comprehensive tests for all showErrorDetails enum values - Updated docstring to accurately describe behavior Fixes #12743
✅ 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. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where deprecation warnings were incorrectly shown in the browser regardless of the client.showErrorDetails config value. The issue was that the function used boolean coercion which treated all non-empty strings as True, causing values like "stacktrace", "type", and "none" to show warnings when they shouldn't.
Key changes:
- Fixed
_error_details_in_browser_enabled()to properly check for"full"or legacyTruevariations - Added comprehensive parameterized tests covering all config values
- Updated documentation to clarify which config values show deprecation warnings
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/streamlit/deprecation_util.py | Fixed config parsing logic and updated docstrings to properly handle string enum values |
| lib/tests/streamlit/deprecation_util_test.py | Added comprehensive parameterized tests covering all showErrorDetails config values |
mayagbarnes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Describe your changes
Fixes a bug where deprecation warnings were always shown in the browser regardless of the
client.showErrorDetailsconfig value. The issue was that_error_details_in_browser_enabled()usedbool()coercion, which treats all non-empty strings asTrue, causing"stacktrace","type", and"none"to incorrectly show deprecation warnings.Changes Made:
_error_details_in_browser_enabled(): Updated to properly check if value equals"full"or is a legacyTruevariation, matching the pattern used inexception.py"full","stacktrace","type","none", and legacyTrue/Falsevariations)True/False) continue to work as documentedExpected Behavior (now fixed):
"full"orTrue: ✅ Show deprecation warnings in browser"stacktrace","type","none", orFalse: ❌ Hide deprecation warnings in browser (console only)GitHub Issue Link (if applicable)
Fixes #12743
Testing Plan
showErrorDetailsconfig valuesst.cache, query params) and verified behavior with all config valuesManual Testing Details:
Test app and implementation summary available at: https://github.com/streamlit/st-issues/tree/main/issues/gh-12743
Additional Notes:
This bug was present since v1.41.0 (December 2024) when the config option was migrated from boolean to string enum values in PR #9909. The
deprecation_util.pyfile was not updated at that time to handle the new string values. The fix follows the same pattern already implemented inlib/streamlit/elements/exception.py.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.