-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate reserved metadata value types #26746
base: master
Are you sure you want to change the base?
Conversation
854f327
to
4755709
Compare
4755709
to
7ed489e
Compare
7ed489e
to
ebb59a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to worry at all about this being a breaking change for existing code / potentially start with a warning and roll this out in 1.10 if so? Or is it clearly an invalid state and this is basically just a bugfix?
IMO it's an invalid state and from backend search we know that it affects very few users. When users are emitting invalid metadata types like this they also can't see table schema metadata in the UI etc. so we should block this behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may want to reach out to the specific folks that triggered us noticing this so they don't get surprised when they upgrade, just as a courtesy
def test_error_on_invalid_reserved_metadata_value(): | ||
with pytest.raises( | ||
CheckError, match="Value for metadata key 'dagster/column_schema' must be a TableSchema" | ||
): | ||
|
||
@asset( | ||
metadata={ | ||
"dagster/column_schema": "invalid", | ||
} | ||
) | ||
def foo(): | ||
pass | ||
|
||
@asset() | ||
def bar(): | ||
yield MaterializeResult(metadata={"dagster/column_schema": "invalid"}) | ||
|
||
defs = Definitions(assets=[bar]) | ||
with pytest.raises( | ||
CheckError, match="Value for metadata key 'dagster/column_schema' must be a TableSchema" | ||
): | ||
defs.get_implicit_global_asset_job_def().execute_in_process() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we include tests that cover the other values we added validation for?
Summary & Motivation
Validate dagster-reserved metadata value types upon construction. Our code assumes that reserved metadata values have the correct type (i.e.
dagster/column_schema
is aTableSchema
object), let's enforce that.How I Tested These Changes
BK
Changelog
Adds type validation for reserved metadata keys defined in asset definitions and
MaterializeResult
.