You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2026/01/21 06:28:58 UTC

[PR] chore: add paths to backend extension stack traces [superset]

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

   ### SUMMARY
   Currently when backend extensions raise exceptions, they don't contain a reference to the actual file:
   
   ```python
   Traceback (most recent call last):
     File "/Users/ville/projects/superset/superset/tasks/executor.py", line 108, in execute_task
       executor_fn(*args, **kwargs)
     File "<string>", line 36, in my_task
   ZeroDivisionError: division by zero
   ```
   
   This makes it difficult to track down where the error actually occurred.
   
   In this PR, we propose stack traces will have a reference to the source file as follows:
   - For bundled `supx` extensions, the reference will be `supx://<extension-id>/file.py`
   - For local development extensions. the reference will be the pull path to the dist file: `.../dist/.../file.py`
   
   This will make stack traces more actionable, both when developing locally, and also when using bundled supx files.
   
   **Local extension after changes:**
   
   ```python
   Traceback (most recent call last):
     File "/Users/ville/projects/superset/superset/tasks/executor.py", line 108, in execute_task
       executor_fn(*args, **kwargs)
     File "/Users/ville/projects/superset-extensions/helloworld/dist/backend/src/helloworld/api.py", line 36, in my_task
       x = 120/0
   ZeroDivisionError: division by zero
   ```
   
   Notice that for local extensions, it's now showing the actual code that raised the error to help narrow down the problematic code.
   
   **supx bundle after changes:**
   
   ```python
   Traceback (most recent call last):
     File "/Users/ville/projects/superset/superset/tasks/executor.py", line 108, in execute_task
       executor_fn(*args, **kwargs)
     File "supx://helloworld/backend/src/helloworld/api.py", line 36, in my_task
   ZeroDivisionError: division by zero
   ```
   
   Here we're intentionally **not** showing the code, as we don't want to expose more of the internals than necessary (line number and method should be fine). We can add parity with local extensions for supx bundles, but IMO it's an unnecessary leak of extension internals, so I advise against it. It would also consume slightly more memory, as we'd have to load the supx code into [linecache](https://docs.python.org/3/library/linecache.html). While the memory overhead is arguably negligible, it's still IMO unnecessary.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37300:
URL: https://github.com/apache/superset/pull/37300#issuecomment-3776412602

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37300:
URL: https://github.com/apache/superset/pull/37300#issuecomment-3776440009

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/37300?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `25 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 48.04%. Comparing base ([`3fba967`](https://app.codecov.io/gh/apache/superset/commit/3fba9678565cbbffd048172eb3e01fac50ba31bc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`3295dc1`](https://app.codecov.io/gh/apache/superset/commit/3295dc1c84b890da86e13961b92a02110a69d791?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/37300?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/extensions/utils.py](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&filepath=superset%2Fextensions%2Futils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZXh0ZW5zaW9ucy91dGlscy5weQ==) | 0.00% | [13 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/extensions/discovery.py](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&filepath=superset%2Fextensions%2Fdiscovery.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZXh0ZW5zaW9ucy9kaXNjb3ZlcnkucHk=) | 0.00% | [10 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/extensions/types.py](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&filepath=superset%2Fextensions%2Ftypes.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZXh0ZW5zaW9ucy90eXBlcy5weQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/initialization/\_\_init\_\_.py](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&filepath=superset%2Finitialization%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvaW5pdGlhbGl6YXRpb24vX19pbml0X18ucHk=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #37300       +/-   ##
   ===========================================
   + Coverage        0   48.04%   +48.04%     
   ===========================================
     Files           0      644      +644     
     Lines           0    48309    +48309     
     Branches        0     5298     +5298     
   ===========================================
   + Hits            0    23211    +23211     
   - Misses          0    24435    +24435     
   - Partials        0      663      +663     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/37300/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage ฮ” | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/37300/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `42.68% <0.00%> (?)` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/37300/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `46.27% <0.00%> (?)` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/37300/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `48.04% <0.00%> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/37300/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <รธ> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/37300?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #37300:
URL: https://github.com/apache/superset/pull/37300#discussion_r2711192448


##########
superset/extensions/types.py:
##########
@@ -34,3 +34,6 @@ class LoadedExtension:
     frontend: dict[str, bytes]
     backend: dict[str, bytes]
     version: str
+    source_base_path: (
+        str  # Base path for traceback filenames (absolute path or supx:// URL)
+    )

Review Comment:
   Not an issue, as this feature is still in development



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37300:
URL: https://github.com/apache/superset/pull/37300#issuecomment-3776412467

   CodeAnt AI is reviewing your PR.
   
   ---
   
   ### Thanks for using CodeAnt! ๐ŸŽ‰
   
   We're free for open-source projects. if you're enjoying it, help us grow by sharing.
   
   [Share on X](https://twitter.com/intent/tweet?text=Just%20tried%20%40CodeAntAI%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A&url=https%3A//codeant.ai) ยท
   [Reddit](https://www.reddit.com/submit?title=Check%20out%20CodeAnt%20for%20automated%20code%20review&text=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A%20https%3A//codeant.ai) ยท
   [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcodeant.ai&mini=true&title=Check%20out%20CodeAnt%20for%20automated%20code%20review&summary=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos)
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #37300:
URL: https://github.com/apache/superset/pull/37300#discussion_r2711160194


##########
superset/extensions/types.py:
##########
@@ -34,3 +34,6 @@ class LoadedExtension:
     frontend: dict[str, bytes]
     backend: dict[str, bytes]
     version: str
+    source_base_path: (
+        str  # Base path for traceback filenames (absolute path or supx:// URL)
+    )

Review Comment:
   **Suggestion:** Breaking change: adding `source_base_path` as a required dataclass field (no default) will cause existing code that constructs `LoadedExtension` without this new argument to raise a TypeError at runtime. Make the field optional or provide a default to preserve backward compatibility. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Critical ๐Ÿšจ</summary>
   
   ```mdx
   - โŒ Extension loading fails with TypeError during instantiation.
   - โŒ Background tasks using extensions fail at startup/runtime.
   - โš ๏ธ Backwards compatibility for thirdโ€‘party extensions broken.
   ```
   </details>
   
   ```suggestion
       source_base_path: str = ""  # Base path for traceback filenames (absolute path or supx:// URL)
   ```
   <details>
   <summary><b>Steps of Reproduction โœ… </b></summary>
   
   ```mdx
   1. Open a Python REPL or run any process that imports the dataclass: `from
   superset.extensions.types import LoadedExtension` (file:
   `superset/extensions/types.py:30-39`).
   
   2. Instantiate the dataclass with the pre-PR argument set used across the codebase, e.g.:
   
      `LoadedExtension(id="ext1", name="ext", manifest=..., frontend={}, backend={},
      version="1.0")`
   
      (this mirrors how LoadedExtension objects were constructed before adding the new
      field).
   
   3. Observe Python raising a TypeError similar to:
   
      "TypeError: __init__() missing 1 required positional argument: 'source_base_path'"
   
      This is raised from the dataclass-generated __init__ defined by `LoadedExtension` (see
      `superset/extensions/types.py:30-39`).
   
   4. Runtime effect: any code path that previously constructed LoadedExtension without the
   new argument (e.g. extension registration/loader) will fail at instantiation time. Because
   the PR description and stacktrace examples reference extension execution, this will
   manifest when extensions are loaded or registered during startup or when tasks execute
   (see `superset/tasks/executor.py:108` in PR description).
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/extensions/types.py
   **Line:** 37:39
   **Comment:**
   	*Possible Bug: Breaking change: adding `source_base_path` as a required dataclass field (no default) will cause existing code that constructs `LoadedExtension` without this new argument to raise a TypeError at runtime. Make the field optional or provide a default to preserve backward compatibility.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   ```
   </details>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #37300:
URL: https://github.com/apache/superset/pull/37300#issuecomment-3776421224

   ### <span aria-hidden="true">โœ…</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">๐Ÿ”จ</span> Latest commit | 3295dc1c84b890da86e13961b92a02110a69d791 |
   |<span aria-hidden="true">๐Ÿ”</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6970722b84f331000808f943 |
   |<span aria-hidden="true">๐Ÿ˜Ž</span> Deploy Preview | [https://deploy-preview-37300--superset-docs-preview.netlify.app](https://deploy-preview-37300--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">๐Ÿ“ฑ</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTM3MzAwLS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.d1zBP3JZUBLii3Qst7elE-tvaywo_HKp0U554sTSIaA)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-37300--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37300:
URL: https://github.com/apache/superset/pull/37300#issuecomment-3776423137

   CodeAnt AI finished reviewing your PR.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: add paths to backend extension stack traces [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro merged PR #37300:
URL: https://github.com/apache/superset/pull/37300


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org