Skip to content

[winml build] [P1] Config-schema validation fires *after* printing Setup banner and Stages header #517

@zhenchaoni

Description

@zhenchaoni

Severity: P1
Command: winml build


Category: Fail Fast — validation of all inputs (flags, files, config schema) must complete before any user-visible work or banner.

Repro:

'{ "this": "is not a valid build config" }' | Out-File temp\ux\malformed_cfg.json -Encoding ascii
uv run winml build -c temp\ux\malformed_cfg.json -m microsoft/resnet-50 -o temp\ux\bo2

Actual:

════════════════════════════════════════════════════════════
🔧 Setup — HuggingFace
════════════════════════════════════════════════════════════
   📦 Model:     microsoft/resnet-50  (pretrained)
   📁 Config:    malformed_cfg.json
   📂 Output:    temp\ux\bo2

════════════════════════════════════════════════════════════
🎯 Stages
════════════════════════════════════════════════════════════
Usage: winml build [OPTIONS]
Try 'winml build --help' for help.

Error: Config validation failed: Invalid WinMLBuildConfig:
  - loader.task is required for full model builds

The Setup banner and Stages header are printed before the config is validated. The same happens with an empty {} config. (Truncated/invalid JSON does fail fast — that path runs through Click's File(... json) decoder.)

Expected: Validate the config object against the WinMLBuildConfig schema as the first action inside the command callback (right after Click parses arguments), before printing any banner. On failure, exit with code 2 and the same error.

Why it matters: The banner implies work is starting. Users who passed the wrong file path or hand-edited a config will assume the build started and may wait. Worse, when validation runs late, partial scratch directories (temp\ux\bo2) may already have been created and need manual cleanup.

Metadata

Metadata

Labels

P1High — major feature broken or significant UX impactbugSomething isn't workingqualityUse for quality control related issuestriagedIssue has been triaged

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions