From c17d5a3bdfc17a727e4bd0e083d86cc82c99119a Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Mon, 7 Sep 2026 12:11:23 +0200 Subject: [PATCH] fix(frontend): settle the username policy on failure instead of guessing it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `policyLoaded` was set in a `finally`, so a failed policy load unblocked the form with `automateUsername` still at its default — the exact submit the flag exists to prevent. The failure now hands over to the full form, which asks for a username outright rather than inferring one, so the flag is never true while the answer is still a guess. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_012fRjnaHLwjpHN84gNNxah9 --- .../workspaceSettings/SimpleCreateWorkspace.svelte | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte b/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte index 738707f56d..68465190aa 100644 --- a/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte +++ b/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte @@ -41,9 +41,11 @@ let automateUsername = $state(true) let suggestedUsername = $state(undefined) /** - * Whether the username policy has landed. Nothing may be submitted before it does: + * Whether the policy is settled, which is what this form may not submit without: * `automateUsername` starts at the common case, and posting that guess to an instance - * that derives no usernames sends none where one is required. + * that derives no usernames sends none where one is required. A load that fails settles + * it by handing over to the full form, which asks for a username outright instead of + * inferring one — so this is never true while the answer is still a guess. */ let policyLoaded = $state(false) /** Someone typed while the prefill was in flight; their name wins over the suggestion. */ @@ -56,10 +58,13 @@ automateUsername = policy.automate suggestedUsername = policy.suggested if (!policy.automate && !policy.suggested) advanced = true + policyLoaded = true } catch (error) { console.error('Could not prefill the workspace name:', error) if (!nameEdited) name = 'My workspace' - } finally { + // The policy is what failed, so there is nothing to submit against. The full form + // carries its own username field, which is the version that needs no policy. + advanced = true policyLoaded = true } }