diff --git a/static/panels.js b/static/panels.js index f160ac42..f61144c6 100644 --- a/static/panels.js +++ b/static/panels.js @@ -2771,9 +2771,12 @@ async function submitKanbanTaskModal(){ if (titleEl) titleEl.focus(); return; } - // Validate workspace path for non-scratch workspace kinds + // Build payload — for create we omit defaulted fields so the backend chooses; + // for edit we send every field so users can clear assignee/tenant/body. + const isEdit = _kanbanTaskModalMode === 'edit'; + // Validate workspace path for non-scratch workspace kinds (create mode only) const workspaceKind = workspaceKindEl ? workspaceKindEl.value : 'scratch'; - if (workspaceKind !== 'scratch') { + if (!isEdit && workspaceKind !== 'scratch') { const workspacePath = workspacePathEl ? workspacePathEl.value.trim() : ''; if (!workspacePath) { if (errEl) errEl.textContent = t('kanban_workspace_path_required') || 'Workspace path is required for non-scratch workspaces.'; @@ -2781,9 +2784,6 @@ async function submitKanbanTaskModal(){ return; } } - // Build payload — for create we omit defaulted fields so the backend chooses; - // for edit we send every field so users can clear assignee/tenant/body. - const isEdit = _kanbanTaskModalMode === 'edit'; const payload = {title}; const bodyVal = bodyEl ? bodyEl.value : ''; const assigneeVal = assigneeEl ? assigneeEl.value.trim() : ''; diff --git a/tests/test_issue3797_kanban_cli_parity.py b/tests/test_issue3797_kanban_cli_parity.py index f604cdff..ff87df7c 100644 --- a/tests/test_issue3797_kanban_cli_parity.py +++ b/tests/test_issue3797_kanban_cli_parity.py @@ -54,18 +54,17 @@ class TestWorkspacePathValidation: """Test client-side validation of workspace paths.""" def test_submit_blocks_empty_worktree_path(self): - """submitKanbanTaskModal must reject non-scratch workspaces with empty paths.""" - # The function must check if workspace_kind is not 'scratch' and - # workspace_path is empty, then set error and return early - assert 'if (workspaceKind !== \'scratch\')' in PANELS_JS + """submitKanbanTaskModal must reject non-scratch workspaces with empty paths on create.""" + # The validation must skip edit mode and only fire on create + assert "workspaceKind !== 'scratch'" in PANELS_JS assert "kanban_workspace_path_required" in PANELS_JS # Must call focus() on the path input for UX assert "workspacePathEl.focus()" in PANELS_JS def test_submit_accepts_scratch_without_path(self): """submitKanbanTaskModal must accept scratch workspace even without a path.""" - # When workspace_kind === 'scratch', skip path validation - assert "if (workspaceKind !== 'scratch')" in PANELS_JS + # Validation is guarded by !isEdit so it only fires on create + assert "workspaceKind !== 'scratch'" in PANELS_JS def test_workspace_fields_sent_in_payload(self): """The create/edit payload must include workspace_kind and workspace_path on create only."""