From dcf04317facbdbb76f722cadc59d07bf3ed2190d Mon Sep 17 00:00:00 2001 From: tiye Date: Sun, 15 Nov 2026 01:58:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=98=8E=E7=A1=AE=20Termina=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=9D=E5=A7=8B=E6=A8=A1=E6=9D=BF=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calcit.cirru | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calcit.cirru b/calcit.cirru index 00a0c3f..75415e8 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -2586,7 +2586,7 @@ :code $ quote $ def user {} (:name nil) (:id nil) (:nickname nil) (:avatar nil) (:password nil) :examples $ [] - :schema $ quote $ Map Tag Dynamic + :schema $ quote $ Map Tag Nil 'workflow $ %{} 'CodeEntry (:doc |) :code $ quote $ def workflow {} (:id nil) (:name nil) (:base-dir |~/) From 4f320b893eace4c960a344586f0606e052bbb607 Mon Sep 17 00:00:00 2001 From: tiye Date: Sun, 15 Nov 2026 09:09:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=8E=E8=B5=84=E6=96=99=E8=A7=86=E5=9B=BE=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calcit.cirru | 13 +++++++------ tests/components.test.mjs | 13 +++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/calcit.cirru b/calcit.cirru index 75415e8..30f51cb 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -179,9 +179,10 @@ -> Unit &doseq command $ .to-list $ .distinct-values - decode-map-as - .unwrap-or (get workflow :commands) ({}) - Map String $ Map Tag Dynamic + match (get workflow :commands) + (:some value) + decode-map-as value $ Map String $ Map Tag Dynamic + (:none) ({}) d! $ app.schema/Op :effect/run $ {} :command $ decode-map-as .unwrap $ get command :code @@ -199,7 +200,7 @@ .unwrap $ get workflow :name , 'String :examples $ [] - :schema $ quote $ Fn (Map Tag Dynamic) (-> respo.schema/Component) + :schema $ quote $ Fn (Map Tag V) (-> respo.schema/Component) (:generics V) 'comp-command-editor $ %{} 'CodeEntry (:doc |) :code $ quote $ defcomp comp-command-editor (states base-command on-submit) let @@ -1031,7 +1032,7 @@ {} $ :style $ {} (:font-family ui/font-code) <> $ str router :examples $ [] - :schema $ quote $ Fn (Map Tag Dynamic) (-> respo.schema/Component) + :schema $ quote $ Fn (Map Tag V) (-> respo.schema/Component) (:generics V) :ns $ %{} 'NsEntry (:doc |) :code $ quote $ ns app.comp.missing :require @@ -1678,7 +1679,7 @@ , &unit <> "|Log out" :examples $ [] - :schema $ quote $ Fn (Map Tag Dynamic) (Map String String) (-> respo.schema/Component) (:features :io) + :schema $ quote $ Fn (Map Tag V) (Map String String) (-> respo.schema/Component) (:generics V) (:features :io) 'refresh-page! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn refresh-page! () let diff --git a/tests/components.test.mjs b/tests/components.test.mjs index 5f05a08..88d4482 100644 --- a/tests/components.test.mjs +++ b/tests/components.test.mjs @@ -85,6 +85,19 @@ function elements(component) { const values = nodes => nodes.map(node => c.listToArray(read(node, 'attrs')).map(c.listToArray).find(([key]) => key.value === 'value')[1]); const attr = (node, name) => c.listToArray(read(node, 'attrs')).map(c.listToArray).find(([key]) => key.value === name)?.[1]; +test('workflow button treats absent commands as empty and rejects invalid commands', () => { + for (const [workflow, valid] of [ + [parse('{} (:name |Demo) (:base-dir |/synthetic)'), true], + [parse('{} (:name |Demo) (:base-dir |/synthetic) (:commands nil)'), false], + ]) { + const button = elements(comp_command_button(workflow))[0]; + const calls = []; + const click = () => read(read(button, 'event'), 'click')(parse('{}'), op => calls.push(op)); + if (valid) assert.doesNotThrow(click); else assert.throws(click); + assert.equal(calls.length, 0); + } +}); + test('workflow button preserves command paths and dispatches one Enum without running commands', () => { const workflow = parse(`{} :name |合成工作流