Skip to content

[cross-cutting] [P2] No safe-overwrite control on any output-producing command #561

Description

@zhenchaoni

Severity: P1
Command: cross-cutting


Category: Output File Safety — destructive overwrite must be opt-in.

Repro: Run any output-producing command twice with the same -o:

uv run winml export -m microsoft/resnet-50 -o temp\ux\out.onnx
"hello world" | Out-File temp\ux\out.onnx -Force
uv run winml export -m microsoft/resnet-50 -o temp\ux\out.onnx
Get-Item temp\ux\out.onnx | Select-Object Length

Actual: The second invocation silently overwrites the file the user just wrote. No warning, no prompt, no --force requirement. Reproduced for: export, optimize, quantize, compile, perf -o, build -o, config -o, eval -o, analyze --output, hub -o. None of these commands have a --force flag.

Expected: Add a shared --force / -f flag (default False) to every output-producing command. At entry:

if output.exists() and not force:
    raise click.ClickException(
        f"Output '{output}' already exists. Re-run with --force to overwrite."
    )

Why it matters: Users keep multiple variant outputs in one folder (q1.onnx, q1_int8.onnx, etc.) and easily clobber yesterday's good model with today's broken one. There is no recovery — the old file is gone.

Metadata

Metadata

Labels

bugSomething isn't workingdev experienceDeveloper experience improvementsqualityUse 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