From 65f7288cea031aec5efa5c00f410ce91678414ff Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Fri, 13 Nov 2026 20:14:49 -0600 Subject: [PATCH] fix(webui): template save maps the new template-exists refusal to 409, not outcome-unknown (#1873) f6c added template-exists for a save under a taken name. The template route had no entry for it, so a duplicate save answered 503 outcome-unknown. Map it to 409 and move the SP8 pin. --- packages/webui/src/template-http.mjs | 2 +- packages/webui/tests/template-http.test.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webui/src/template-http.mjs b/packages/webui/src/template-http.mjs index d0cca1232..591b3fc70 100644 --- a/packages/webui/src/template-http.mjs +++ b/packages/webui/src/template-http.mjs @@ -28,7 +28,7 @@ const LIMIT = 4096; const codes = { 'invalid-request': 400, 'template-secret-suspected': 400, 'starter-pack-invalid': 400, 'project-not-found': 404, - 'pack-plan-stale': 409, 'starter-pack-template-changed': 409, 'organization-busy': 409, + 'pack-plan-stale': 409, 'starter-pack-template-changed': 409, 'organization-busy': 409, 'template-exists': 409, 'human-required': 403, 'read-only': 403, 'not-configured': 503, 'no-bus-host': 503, }; diff --git a/packages/webui/tests/template-http.test.mjs b/packages/webui/tests/template-http.test.mjs index f67a1a7bb..2ed0fa693 100644 --- a/packages/webui/tests/template-http.test.mjs +++ b/packages/webui/tests/template-http.test.mjs @@ -85,7 +85,7 @@ test('SP8 the owner previews a template (nothing written), saves it with the dig assert.equal(readFileSync(f.saved('demo-shape'), 'utf8'), preview.json); assert.deepEqual(readFileSync(f.file), before, 'the organization file is unchanged'); const [again, againBody] = await call(f, `${ORG}/templates`, 'POST', { name: 'demo-shape', digest: preview.digest }); - assert.deepEqual([again, againBody.error], [400, 'invalid-request']); + assert.deepEqual([again, againBody.error], [409, 'template-exists']); const [, list] = await call(f, `${ORG}/templates`); assert.deepEqual(list.templates.map(x => [x.name, x.scope]), [['demo-shape', 'org']]); // The preview and the list went over the read; only the saves used the fenced writer.