From c309a772a2f4f8dae92e970e1fd8607b707813a9 Mon Sep 17 00:00:00 2001 From: notgitika Date: Sun, 21 Jun 2026 23:01:10 -0400 Subject: [PATCH] fix(run-insights): reject empty --name "" instead of auto-generating Passing an explicit empty string for --name silently fell through to the auto-generation path. Reject it with a ValidationError so the user gets a clear "must not be empty" error instead of an opaque success with a random name. Also tightens the lookback-days error message to match the existing service-side `^[a-zA-Z][a-zA-Z0-9_]{0,47}$` BatchEvaluationName contract. --- src/cli/commands/run/command.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/run/command.tsx b/src/cli/commands/run/command.tsx index db036ce8d..fcea6b2f2 100644 --- a/src/cli/commands/run/command.tsx +++ b/src/cli/commands/run/command.tsx @@ -398,13 +398,17 @@ export const registerRun = (program: Command) => { if (!cliOptions.json) console.log(message); }; + if (cliOptions.name?.trim() === '') { + throw new ValidationError('--name must not be empty. Omit the flag to auto-generate a name.'); + } + await runCliCommand('run.job', !!cliOptions.json, async () => { const engine = createJobEngine(new ConfigIO()); const insightIds = cliOptions.insights ?? ['Builtin.Insight.FailureAnalysis']; const lookbackDays = cliOptions.lookbackDays ? parseInt(cliOptions.lookbackDays, 10) : undefined; if (lookbackDays !== undefined && (isNaN(lookbackDays) || lookbackDays < 1 || lookbackDays > 90)) { - throw new Error('--lookback-days must be between 1 and 90'); + throw new ValidationError('--lookback-days must be a positive integer between 1 and 90.'); } const startResult = await engine.start('insights', {