durgaprasadml opened a new pull request, #40481:
URL: https://github.com/apache/superset/pull/40481

   ## Summary
   
   Avoid warning log pollution when the default spinner SVG asset is 
unavailable in packaged/runtime environments.
   
   In production deployments, frontend source assets under superset-frontend/ 
are not packaged or shipped. The backend fallback helper 
get_default_spinner_svg() attempted to load the frontend source SVG directly, 
causing repeated warning logs when the file was missing:
   
   text id="fwbmtx" Could not load default spinner SVG: [Errno 2] No such file 
or directory ... 
   
   Since the spinner asset is optional and frontend production builds already 
package spinner assets separately, the warning was unnecessary and polluted 
logs in containerized/runtime deployments.
   
   This change:
   - checks whether the SVG file exists before attempting to read it
   - silently returns None when the file is absent
   - continues logging warnings for unexpected read failures such as OSError or 
UnicodeDecodeError
   
   ## Files Changed
   
   - superset/views/base.py
   - tests/unit_tests/views/test_base_theme_helpers.py
   
   ## Tests Added
   
   Added regression coverage for:
   - missing SVG file returns None without warning logs
   - unexpected read failures log warnings and return None
   - successful SVG reads return SVG contents correctly
   
   ## Validation
   
   Executed:
   
   bash id="9szt7w" PYTHONPATH=. pytest 
tests/unit_tests/views/test_base_theme_helpers.py 
   
   Result:
   
   text id="mzgw0c" 34 passed 
   
   Also executed:
   
   bash id="e98wjv" pre-commit run --files superset/views/base.py 
tests/unit_tests/views/test_base_theme_helpers.py 
   
   All checks passed.
   
   ## Edge Cases Considered
   
   - race conditions between existence check and file open
   - custom spinner overrides via brandSpinnerSvg / brandSpinnerUrl
   - production/container runtime environments without frontend source assets
   
   Fixes #40478


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to