F1a: user fixes

Keep the TrainingSource union named in OpenAPI and serialize the selected variant directly into the flat job config. Keep the inputs GET for file-type metadata and upload availability, and remove the listing and its description. Cover both job payloads, reject site-only extraneous fields, and verify upload validation.
This commit is contained in:
2026-12-01 11:32:48 -06:00
parent b4db5f9b2c
commit 82f7a18a9f
3 changed files with 58 additions and 14 deletions
+6 -5
View File
@@ -195,9 +195,9 @@ def _training_inputs(domain: Domain, name: str) -> tuple[InputSpec, Path]:
@router.get("/{domain}/{name}/inputs")
def training_inputs(domain: Domain, name: str) -> dict:
spec, root = _training_inputs(domain, name)
return {"description": spec.description, "allowed": spec.allowed, "sets": inputs.sets(root)}
def training_inputs(domain: Domain, name: str) -> dict[str, list[str]]:
spec, _ = _training_inputs(domain, name)
return {"allowed": spec.allowed}
@router.post("/{domain}/{name}/inputs/{set}/files")
@@ -256,10 +256,11 @@ def training_config(domain: Domain, name: str) -> TrainingConfig:
json_schema = TrainingForm.model_json_schema()
defaults = {"execution": {"mode": cluster.default_mode(), "scheduler": None}}
if domain == Domain.TEA:
defaults["source"] = {"kind": "site", "line_hz": 50}
defaults["source"] = {"kind": "site"}
else:
del json_schema["properties"]["source"]
del json_schema["$defs"]["TrainingSource"]
for definition in ("TrainingSource", "SiteTrainingSource", "FolderTrainingSource"):
del json_schema["$defs"][definition]
return TrainingConfig(
domain=domain.value, name=name, json_schema=json_schema, defaults=defaults
)