Skip to content

Conversation

@sfc-gh-lwilby
Copy link
Collaborator

@sfc-gh-lwilby sfc-gh-lwilby commented Oct 16, 2025

Describe your changes

Fixes a bug where deprecation warnings were always shown in the browser regardless of the client.showErrorDetails config value. The issue was that _error_details_in_browser_enabled() used bool() coercion, which treats all non-empty strings as True, causing "stacktrace", "type", and "none" to incorrectly show deprecation warnings.

Changes Made:

  • Fixed _error_details_in_browser_enabled(): Updated to properly check if value equals "full" or is a legacy True variation, matching the pattern used in exception.py
  • Added comprehensive tests: New parameterized tests covering all config values ("full", "stacktrace", "type", "none", and legacy True/False variations)
  • Updated docstring: Clarified which config values show deprecation warnings in browser vs console only
  • Preserved backward compatibility: Legacy boolean values (True/False) continue to work as documented

Expected Behavior (now fixed):

  • "full" or True: ✅ Show deprecation warnings in browser
  • "stacktrace", "type", "none", or False: ❌ Hide deprecation warnings in browser (console only)
Screenshot 2025-10-16 at 6 09 06 PM Screenshot 2025-10-16 at 6 09 24 PM

GitHub Issue Link (if applicable)

Fixes #12743

Testing Plan

  • Unit Tests (Python) - Added 10 new parameterized test cases covering all showErrorDetails config values
  • Manual testing - Created test app in st-issues repo with multiple deprecation scenarios (manual triggers, st.cache, query params) and verified behavior with all config values

Manual 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.py file was not updated at that time to handle the new string values. The fix follows the same pattern already implemented in lib/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.

- 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
@sfc-gh-lwilby sfc-gh-lwilby added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Oct 16, 2025
@snyk-io
Copy link
Contributor

snyk-io bot commented Oct 16, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12794/streamlit-1.50.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12794.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-lwilby sfc-gh-lwilby changed the title Fix showErrorDetails config parsing for deprecation warnings [fix] showErrorDetails config parsing for deprecation warnings Oct 16, 2025
@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review October 16, 2025 15:10
@mayagbarnes mayagbarnes requested a review from Copilot October 16, 2025 19:53
Copy link
Contributor

Copilot AI left a 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 legacy True variations
  • 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

Copy link
Collaborator

@mayagbarnes mayagbarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sfc-gh-lwilby sfc-gh-lwilby merged commit da68ecd into develop Oct 16, 2025
37 checks passed
@sfc-gh-lwilby sfc-gh-lwilby deleted the fix/showErrorDetails-deprecation-warnings branch October 16, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config option client.showErrorDetails doesn't properly parse string properties for deprecation warnings

3 participants