From 6cfbdd649b6b2e1d5038c42e69f74e2c744d2bb4 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Thu, 12 Feb 2026 08:39:46 +0700 Subject: [PATCH] fix(cliproxy): address code review feedback (attempt 3/5) - Allow partial composite updates in PUT endpoint (|| -> &&) - Map service validation errors to 400 status, not 404 - Widen 4xx regex to cover full 400-499 range --- src/cliproxy/executor/retry-handler.ts | 2 +- src/web-server/routes/variant-routes.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cliproxy/executor/retry-handler.ts b/src/cliproxy/executor/retry-handler.ts index a0e4cfcc..dd850450 100644 --- a/src/cliproxy/executor/retry-handler.ts +++ b/src/cliproxy/executor/retry-handler.ts @@ -102,7 +102,7 @@ export async function handleQuotaCheck(provider: CLIProxyProvider): Promise { } if (existing.type === 'composite') { - if (!default_tier || !tiers) { - res.status(400).json({ error: 'Missing required fields for composite update' }); + if (!default_tier && !tiers) { + res.status(400).json({ error: 'Must provide at least default_tier or tiers' }); return; } @@ -182,7 +182,8 @@ router.put('/:name', (req: Request, res: Response): void => { const result = updateCompositeVariant(name, { defaultTier: default_tier, tiers }); if (!result.success) { - res.status(404).json({ error: result.error }); + const status = result.error?.includes('not found') ? 404 : 400; + res.status(status).json({ error: result.error }); return; }