Skip to content

feat(semantic-layer): define credential readiness and backend errors in the SDK - #45554

Open
mikebridge wants to merge 32 commits into
apache:masterfrom
mikebridge:sc-127360-provider-sdk-boundary
Open

mikebridge wants to merge 32 commits into
apache:masterfrom
mikebridge:sc-127360-provider-sdk-boundary

Conversation

@mikebridge

Copy link
Copy Markdown
Contributor

SUMMARY

Builds on #45553; review that first. This PR includes its commits until it merges.

TL;DR: Give providers explicit credential readiness and a typed backend-failure contract.

Background and problem: Semantic providers currently have to recognize the host's secret placeholder to decide whether schema discovery is safe, and lack an SDK error for backend execution faults. This change adds a required SemanticCredentialReadiness enum to both schema hooks and a fixed-message SemanticBackendError.

What this changes: The host derives readiness from raw configuration before partial validation can discard unresolved fields. Preview payloads cannot assert readiness or recover saved credentials. Transport errors are reconstructed from validated failure/status fields and a freshly sanitized label; subclass formatters cannot supply public text. Typed backend failures return generic guidance without logging their causes or tracebacks. Unknown exceptions retain their type at ERROR and full diagnostic chain at DEBUG in server logs only.

Host and provider schema overrides must upgrade together. UPDATING.md and the provider author guide describe the required arguments and error contract. The translation template also includes two strings already introduced by the transport prerequisite.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable: SDK and backend boundary changes only.

TESTING INSTRUCTIONS

With the repository Python environment and local superset-core/src on PYTHONPATH:

CI=1 PYTHONPATH=.:superset-core/src python -m pytest -q -o addopts= \
  tests/unit_tests/semantic_layers superset-core/tests \
  tests/unit_tests/mcp_service/test_tool_inventory.py \
  tests/unit_tests/mcp_service/test_chart_tool_inventory.py \
  tests/unit_tests/mcp_service/test_mcp_tool_registration.py \
  tests/unit_tests/mcp_service/test_native_tool_surface.py \
  tests/unit_tests/mcp_service/semantic_layer/tool/test_get_table.py
CI=1 PYTHONPATH=.:superset-core/src python -m pytest -q -o addopts= \
  tests/unit_tests/commands/semantic_layer
python scripts/translations/check_pot_drift.py

Final candidate results: 1,958 semantic-layer tests passed at 100.00% coverage, 635 supplemental SDK/command/network/MCP tests passed, and 13 SDK conformance tests passed. Changed-file pre-commit (including MyPy) passed; POT drift passed before the merge. The independent macOS export run needed a test-only sentinel rename because the word "private" also matches /private/tmp traceback paths; the author checkout passed unchanged. This test portability follow-up remains open. Added cases cover masked nested preview configuration, spoofed readiness, saved-runtime authority, required SDK arguments, safe transport errors, suppressed sensitive causes, chart cache admission, values lookup and the MCP error envelope.

No live provider or deployment validation is claimed. Provider schema overrides must be updated together with the host.

Follow-ups: prove each provider blocks discovery for unresolved readiness; consider rejecting literal secret placeholders during create/import; validate status fields in the transport SDK constructor in addition to host boundary validation. Also make malformed transport-error handling explicit at metadata endpoints so it does not rely on the outer error wrapper and produce an extra host-only ERROR traceback. These follow-ups are not implemented by this PR.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: existing SEMANTIC_LAYERS
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API: required SDK readiness keyword and backend error type
  • Removes existing feature or API

@github-actions github-actions Bot added i18n Namespace | Anything related to localization api Related to the REST API doc Namespace | Anything related to documentation labels Oct 21, 2026
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.46835% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.78%. Comparing base (7f2b04f) to head (09b8d45).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
superset/utils/network.py 89.79% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45554      +/-   ##
==========================================
+ Coverage   84.73%   84.78%   +0.04%     
==========================================
  Files        3069     3075       +6     
  Lines      205819   206892    +1073     
  Branches    48408    48475      +67     
==========================================
+ Hits       174403   175409    +1006     
- Misses      28122    28179      +57     
- Partials     3294     3304      +10     
Flag Coverage Δ
hive 34.48% <30.37%> (-0.02%) ⬇️
mysql 52.53% <31.89%> (?)
postgres 52.55% <31.89%> (-0.06%) ⬇️
presto 36.20% <30.37%> (-0.03%) ⬇️
python 87.79% <97.46%> (+0.03%) ⬆️
sqlite 52.30% <31.89%> (-0.07%) ⬇️
superset-extensions-cli 91.24% <ø> (?)
unit 82.57% <97.46%> (+0.05%) ⬆️

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.

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 09b8d45
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae55a73c59ce91c75ded705
😎 Deploy Preview https://deploy-preview-45554--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 21, 2026
Keep bulk-validation uniqueness assertions and transport error coverage together. Move the transport contract into master's consolidated provider guide and update its isolated schema example.
Preserve bounded bulk-validation assertions alongside typed provider failures. Carry transport and readiness contracts into the consolidated extension guide, including an explicitly unresolved static-schema test.
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 23, 2026
@mikebridge
mikebridge marked this pull request as ready for review October 23, 2026 23:35
Keep the provider transport upgrade note and both incoming MCP notes.
Comment thread superset/semantic_layers/exceptions.py Resolved
Reject userinfo in prepared redirect destinations before Requests can replace the caller Authorization header. Keep configured first-hop handling unchanged and verify the original headers at the HTTP adapter.
Retain safe typed transport messages alongside generic metadata error masking; preserve incoming namespace bootstrap changes.
@github-actions github-actions Bot removed the i18n Namespace | Anything related to localization label Oct 26, 2026
Exercise hostless URL preparation and missing preparation output before adapter I/O. Pin the invalid-url category and early rejection so the provider transport coverage gate covers both defensive branches.
Comment thread superset/semantic_layers/transport.py Resolved
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 27, 2026
…vidence

Bring the parent transport fixes into the SDK boundary branch for Joe's redirect review (4383703142). Retain readiness and safe schema errors when merging. Capture typed failures at DEBUG (4383703150) while preserving the separate unknown-fault diagnostic policy, and document the required factory transport argument (4383703155).
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 27, 2026
Comment thread superset/semantic_layers/masking.py Resolved
Merge Apache master acd92db, retaining injected provider transport and typed-error normalization through discovery classification. Treat an empty saved configuration as resolved; required fields remain provider validation, with red-first runtime choices coverage for Joe's r4394388612.

Replace broad private log assertions with exact injected sentinels for r4394388617. Require TLS 1.2 in the remaining test context and explicitly annotate the schema configuration local.
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 28, 2026
Treat an explicit empty configuration object like equivalent default-only settings while retaining dictionary validation and write permission checks. Cover writer/read-only, empty/nonempty objects and non-object payloads through the preview route, without saved-secret lookup. Addresses review thread r4397335672.
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 28, 2026
Comment thread superset/semantic_layers/api.py Resolved
Address review thread r4405395077: retain the view id and layer UUID in structure/runtime failure events so operators can locate the failing object without logging configuration. Preview has no persisted target and records absent identifiers explicitly. Preserve typed-failure secrecy and unknown-fault DEBUG diagnostics, with route-level regression coverage.
Preserve the conformance-kit documentation alongside transport and readiness guidance. Adapt the newly merged static-schema isolation probe to the required SDK keywords, with an inert transport and a caught-I/O regression test. Retain upstream connection metadata and the existing provider failure protections.
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 29, 2026
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 29, 2026
@github-actions github-actions Bot added requires:rebase Requires rebasing on top of current master and removed requires:rebase Requires rebasing on top of current master labels Oct 30, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the REST API doc Namespace | Anything related to documentation size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants