mikebridge opened a new pull request, #44834:
URL: https://github.com/apache/superset/pull/44834
### SUMMARY
First PR in a small stack that replaces #44808 (semantic-view metadata
refresh), split so each piece can be reviewed on its own. This PR adds **only
an optional SDK contract** to `superset-core`. It has no host storage, API, UI
or provider changes, and no runtime behaviour changes for any existing provider.
What it adds (`superset_core/semantic_layers/metadata.py` plus optional
defaults on the existing bases):
- `CatalogSnapshot`: an immutable, validated catalog observation (`payload`,
opaque scope-qualified `cache_token`, `observed_at`).
- `MetadataRefreshResult` (`changed` / `unchanged`) and
`MetadataRefreshError`, with a fixed set of safe categories. No raw vendor
messages.
- `MetadataSnapshotStore` and `MetadataRefreshAdapter` protocols. The loader
receives the caller's **remaining deadline**, so a provider can bound its own
upstream calls within one request budget.
- Optional defaults that keep existing providers unchanged:
- `SemanticLayer.supports_metadata_refresh()` returns `False`;
- `SemanticLayer.metadata_refresh` returns `None`;
- `SemanticView.metadata_cache_token` returns `None`.
Contract notes that the later PRs rely on:
- Every successful publication rotates `cache_token`, even when discovery
content is unchanged, because content equality can't prove unchanged query
meaning.
- The token is captured with the snapshot, and the follow-up PR includes it
in compatibility and query-result cache keys (the issue raised on #44808).
- The SDK is UI-independent. The host owns scope, authorization and
coordinated publication; the provider owns bounded acquisition and validation.
Planned follow-ups: host store and cache identity (including the result-key
fix and bounded cold-read behaviour), then the refresh command/API, then the UI.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (SDK only).
### TESTING INSTRUCTIONS
`pytest tests/unit_tests/semantic_layers/metadata_contract_test.py`. That's
31 contract tests: legacy provider unchanged, opted-in in-memory provider,
immutability and identity, error categories, deadline propagation and expiry. A
fresh-process check confirms the SDK module imports without Flask/Redis/host
modules.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
Open questions for committers: whether this additive, optional
`superset-core` API needs a SIP, and how `superset-core` versioning should be
sequenced before a provider can declare a minimum version. The docs are in
`docs/developer_docs/semantic-metadata-contract.md`.
--
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]