Skip to content

fix(extensions): log extension-init failures via the logger, not print()#41304

Open
rusackas wants to merge 2 commits into
masterfrom
fix/extension-init-logging
Open

fix(extensions): log extension-init failures via the logger, not print()#41304
rusackas wants to merge 2 commits into
masterfrom
fix/extension-init-logging

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

init_extensions caught extension-initialization exceptions and emitted them via print(ex) to stdout, bypassing the configured structured logging pipeline (formatting, severity levels, configured destinations). Initialization failures were therefore invisible to operators relying on log aggregation.

This routes those failures through logger.exception(...), which records the failing extension id and a full traceback at error level through the standard logger.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — logging behavior.

TESTING INSTRUCTIONS

Unit test added in tests/unit_tests/test_init_extensions_logging.py: an extension entrypoint that raises during init is logged via logger.exception, and the failing extension id is included in the log args.

Run: pytest tests/unit_tests/test_init_extensions_logging.py

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

init_extensions caught extension-initialization exceptions and wrote them to
stdout via print(), bypassing the structured logging pipeline so the failures
were invisible to operators relying on log aggregation.

Route these through logger.exception (with the failing extension id and a
traceback) so they reach the configured logging destinations.

Adds a unit test asserting an extension entrypoint failure is logged via
logger.exception including the extension id.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rusackas rusackas added the asvs label Jun 23, 2026
@dosubot dosubot Bot added the logging Creates a UI or API endpoint that could benefit from logging. label Jun 23, 2026
@bito-code-review

bito-code-review Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #37e6ab

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 156e2ed..156e2ed
    • superset/initialization/__init__.py
    • tests/unit_tests/test_init_extensions_logging.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread tests/unit_tests/test_init_extensions_logging.py Outdated
Comment thread tests/unit_tests/test_init_extensions_logging.py Outdated
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.34%. Comparing base (3b46a5f) to head (8226eff).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
superset/initialization/__init__.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41304      +/-   ##
==========================================
- Coverage   64.34%   64.34%   -0.01%     
==========================================
  Files        2653     2653              
  Lines      144952   144952              
  Branches    33433    33433              
==========================================
- Hits        93273    93268       -5     
- Misses      49995    49998       +3     
- Partials     1684     1686       +2     
Flag Coverage Δ
hive 39.27% <0.00%> (ø)
mysql 58.00% <0.00%> (ø)
postgres 58.06% <0.00%> (-0.01%) ⬇️
presto 40.86% <0.00%> (ø)
python 59.50% <0.00%> (-0.01%) ⬇️
sqlite 57.72% <0.00%> (ø)
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asvs logging Creates a UI or API endpoint that could benefit from logging. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants