-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(base): improve workflow update execution guidance #2126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,6 +235,8 @@ | |
|
|
||
| ### ReminderTrigger | ||
|
|
||
| > ⚠️ **先翻译方向,再填写数值:** `offset=N` 表示日期前 N 个单位触发(提前 N);`offset=-N` 表示日期后 N 个单位触发(延后 N)。提交和回读时都按这句自然语言复核,不要只比较绝对值。 | ||
|
|
||
|
Comment on lines
+238
to
+239
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Locate target file:"
fd -a 'lark-base-workflow-schema\.md$' . || true
echo
echo "Relevant target section:"
if [ -f skills/lark-base/references/lark-base-workflow-schema.md ]; then
sed -n '220,270p' skills/lark-base/references/lark-base-workflow-schema.md | cat -n -v
else
echo "target file missing"
fi
echo
echo "Search ReminderTrigger/offset references in repo:"
rg -n "ReminderTrigger|offset|前 N 个单位|后 N 个单位|at the referenced date|referenced date|referenced date/time|日期前|日期后" skills/lark-base/references/lark-base-workflow-schema.md . --glob '!node_modules' --glob '!dist' --glob '!build' | head -n 200Repository: larksuite/cli Length of output: 32160 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Git status/diff summary:"
git diff --stat || true
echo
echo "Exact ReminderTrigger/offset text with line numbers:"
sed -n '236,262p' skills/lark-base/references/lark-base-workflow-schema.md | nl -ba -v236 | sed -e 's/\x0d$//' -e 's/\x00$//'
echo
echo "Related workflow/trigger implementation search:"
rg -n "ReminderTrigger|reminderTrigger|reminder_trigger|offset.*MINUTE|MINUTE|ReminderTrigger|triggerType|trigger" \
internal shortcuts tests . --glob '!node_modules' --glob '!dist' --glob '!build' --glob '!*.json' | head -n 200Repository: larksuite/cli Length of output: 270 Clarify the zero-offset semantics in
🤖 Prompt for AI Agents |
||
| ```json | ||
| { | ||
| "table_name": "项目表", | ||
|
|
@@ -252,7 +254,7 @@ | |
| | `table_name` | 是 | 数据表名 | | ||
| | `field_name` | 是 | 日期字段名(必须为 `datetime` / `created_at` / `formula` / `lookup` 类型) | | ||
| | `unit` | 是 | 偏移单位:`MINUTE` / `HOUR` / `DAY` / `WEEK` / `MONTH` | | ||
| | `offset` | 是 | 提前/延后的偏移量(正数=提前,负数=延后;范围由 `unit` 决定):`MINUTE` ∈ {0, 5, 15, 30, -5, -15, -30};`HOUR` ∈ [-6, -1] ∪ [1, 6];`DAY` ∈ [-7, 7];`WEEK` ∈ [-7, -1] ∪ [1, 7];`MONTH` ∈ [-7, -1] ∪ [1, 7] | | ||
| | `offset` | 是 | 偏移量:正数=日期前/提前,负数=日期后/延后;范围由 `unit` 决定:`MINUTE` ∈ {0, 5, 15, 30, -5, -15, -30};`HOUR` ∈ [-6, -1] ∪ [1, 6];`DAY` ∈ [-7, 7];`WEEK` ∈ [-7, -1] ∪ [1, 7];`MONTH` ∈ [-7, -1] ∪ [1, 7] | | ||
| | `hour` | 是 | 触发小时 (0-23),默认 9 | | ||
| | `minute` | 是 | 触发分钟 (0-59),默认 0 | | ||
| | `condition_list` | 否 | 过滤条件数组,数组中每个元素为 AndCondition 结构,多个 AndCondition 之间为 OR 关系 | | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||||
| // Copyright (c) 2026 Lark Technologies Pte. Ltd. | ||||||||
| // SPDX-License-Identifier: MIT | ||||||||
|
|
||||||||
| package base | ||||||||
|
|
||||||||
| import ( | ||||||||
| "context" | ||||||||
| "testing" | ||||||||
| "time" | ||||||||
|
|
||||||||
| clie2e "github.com/larksuite/cli/tests/cli_e2e" | ||||||||
| "github.com/stretchr/testify/require" | ||||||||
| ) | ||||||||
|
|
||||||||
| func TestBaseWorkflowUpdateDryRunReadsJSONFromStdin(t *testing.T) { | ||||||||
| setBaseDryRunConfigEnv(t) | ||||||||
|
|
||||||||
| ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) | ||||||||
| t.Cleanup(cancel) | ||||||||
|
|
||||||||
| result, err := clie2e.RunCmd(ctx, clie2e.Request{ | ||||||||
| Args: []string{ | ||||||||
| "base", "+workflow-update", | ||||||||
| "--base-token", "app_example", | ||||||||
| "--workflow-id", "wkf_example", | ||||||||
| "--json", "-", | ||||||||
| "--dry-run", | ||||||||
| }, | ||||||||
| Stdin: []byte(`{"title":"Updated workflow","status":"OFF","steps":[]}` + "\n"), | ||||||||
| DefaultAs: "bot", | ||||||||
| }) | ||||||||
| require.NoError(t, err) | ||||||||
| result.AssertExitCode(t, 0) | ||||||||
|
|
||||||||
| out := result.Stdout | ||||||||
| require.Equal(t, "PUT", clie2e.DryRunGet(out, "api.0.method").String(), out) | ||||||||
| require.Equal(t, "/open-apis/base/v3/bases/app_example/workflows/wkf_example", clie2e.DryRunGet(out, "api.0.url").String(), out) | ||||||||
| require.Equal(t, "Updated workflow", clie2e.DryRunGet(out, "api.0.body.title").String(), out) | ||||||||
| require.Equal(t, "OFF", clie2e.DryRunGet(out, "api.0.body.status").String(), out) | ||||||||
| require.True(t, clie2e.DryRunGet(out, "api.0.body.steps").IsArray(), out) | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert that
As per coding guidelines, contract tests must assert the changed field or behavior directly so reverting the implementation causes failure. Proposed assertion require.True(t, clie2e.DryRunGet(out, "api.0.body.steps").IsArray(), out)
+require.Len(t, clie2e.DryRunGet(out, "api.0.body.steps").Array(), 0, out)📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||
| } | ||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里面我感觉应该相信写操作返回的状态?如果 get 一次,其实耗 token 还挺大的,因为 workflow 配置可能比较复杂