fix: suppress legacy warnings in machine JSON paths

This commit is contained in:
2026-08-11 05:50:06 +02:00
parent 554de4ff2f
commit d5f752dd7b
3 changed files with 62 additions and 4 deletions
+14 -4
View File
@@ -1,5 +1,6 @@
# ruff: noqa: BLE001, S110, B008
import logging
import warnings
from pathlib import Path
from typing import TypedDict
@@ -143,10 +144,19 @@ def _schema_json(payload: dict) -> None:
def _machine_config(config: Path):
try:
return load_config(config)
except ConfigError:
raise _MachineSchemaError("invalid_configuration") from None
# Legacy resource keys remain accepted, but their deprecation warning is not part of
# the JSON machine contract. Keep this filter scoped to this call so human commands
# (and unrelated warnings/errors) retain their existing behavior.
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message=r"^DEPRECATION: legacy workspace resource keys are deprecated;",
category=FutureWarning,
)
try:
return load_config(config)
except ConfigError:
raise _MachineSchemaError("invalid_configuration") from None
def _physical_or_error(cfg):