Skip to content

[Bug]: Extra run configuration properties not ignored when parsing #4096

Description

@jvstme

Steps to reproduce

Run the snippet:

from dstack._internal.core.models.common import validate_extra_ignore
from dstack._internal.core.models.runs import RunSpec

run_spec = {
    "configuration": {
        "type": "dev-environment",
        "new_prop": 123,
    }
}

print(validate_extra_ignore(RunSpec, run_spec))

Actual behaviour

Traceback (most recent call last):
  File "/dstack/test.py", line 11, in <module>
    print(validate_extra_ignore(RunSpec, run_spec))
  File "/dstack/src/dstack/_internal/core/models/common.py", line 86, in validate_extra_ignore
    return _get_type_adapter(tp).validate_python(obj, extra="ignore")
  File "/dstack/.venv/lib64/python3.10/site-packages/pydantic/type_adapter.py", line 441, in validate_python
    return self.validator.validate_python(
pydantic_core._pydantic_core.ValidationError: 1 validation error for RunSpec
dev-environment.new_prop
  Extra inputs are not permitted [type=extra_forbidden, input_value=123, input_type=int]
    For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden

Expected behaviour

The extra "new_prop" property is ignored, considering that validate_extra_ignore is used. The snippet exits cleanly.

dstack version

master

Server logs

Additional information

Presumably introduced by #4077.

Implications

  • The current client is incompatible with any upcoming server versions that add a new run configuration property.
  • Dropping an existing run configuration property breaks the current server, which fails to read older configurations from the database.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmajor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions