Skip to content

feat(base): improve workflow update execution guidance - #2126

Open
TanDianxiong wants to merge 1 commit into
larksuite:mainfrom
TanDianxiong:auto-research-sync/01KYP9Z4SKA4YTSR27AX864802/mr-1294-758485a5
Open

feat(base): improve workflow update execution guidance#2126
TanDianxiong wants to merge 1 commit into
larksuite:mainfrom
TanDianxiong:auto-research-sync/01KYP9Z4SKA4YTSR27AX864802/mr-1294-758485a5

Conversation

@TanDianxiong

@TanDianxiong TanDianxiong commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Improve Base workflow mutation reliability by making update payload input more flexible and clarifying the required write-and-verify flow.

Changes

  • Support relative JSON files and stdin for base +workflow-update payloads.
  • Add dry-run coverage for workflow update payloads read from stdin.
  • Clarify update, enable, and disable execution and verification guidance.
  • Document ReminderTrigger offset direction and safe handling of enable preconditions.

Test Plan

  • git diff --check (passed)

Related Issues

Auto research task: 01KYP9Z4SKA4YTSR27AX864802

Summary by CodeRabbit

  • New Features

    • +workflow-update --json now supports input from files or standard input.
    • Added clearer guidance for updating, enabling, disabling, verifying workflows, and interpreting reminder offsets.
  • Documentation

    • Documented an auditable workflow change process, including post-change verification and prerequisite handling.
    • Clarified that workflow updates replace the full definition and that each workflow has one trigger node.
  • Tests

    • Added coverage confirming workflow update payloads can be read from standard input during dry runs.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added domain/base PR touches the base domain size/M Single-domain feat or fix with limited business impact labels Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Workflow shortcuts now document explicit write operations, post-write verification, reminder offset direction, and JSON input from files or stdin. Lark Base workflow references and CLI tests were updated to reflect these rules.

Changes

Workflow guidance and validation

Layer / File(s) Summary
Shortcut inputs and operation guidance
shortcuts/base/workflow_*.go, shortcuts/base/base_shortcuts_test.go
Workflow update supports file or stdin JSON input, and shortcut tips cover explicit operations, verification, and reminder offset semantics.
Workflow rules and schema guidance
skills/lark-base/SKILL.md, skills/lark-base/references/lark-base-workflow-*.md
Documentation defines write-then-read verification, update replacement behavior, enable precondition handling, trigger constraints, and offset sign meanings.
Stdin dry-run validation
tests/cli_e2e/base/base_workflow_update_dryrun_test.go
Adds coverage for reading JSON from stdin and validating the generated dry-run PUT request and payload.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested labels: documentation

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main workflow guidance improvements in this PR.
Description check ✅ Passed The description includes the required Summary, Changes, Test Plan, and Related Issues sections and is mostly complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/lark-base/references/lark-base-workflow-schema.md`:
- Around line 238-239: Update the ReminderTrigger offset documentation to
explicitly define offset=0 as triggering at the referenced date/time, while
preserving the existing positive-before and negative-after semantics; only
remove zero from the allowed values if the service rejects it.

In `@tests/cli_e2e/base/base_workflow_update_dryrun_test.go`:
- Line 40: Update the assertion on DryRunGet("api.0.body.steps") to verify the
steps array has length zero, rather than only checking IsArray(), while
preserving the existing output context passed to the assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 68cc6e17-376d-416a-b8f8-61c20d21fad2

📥 Commits

Reviewing files that changed from the base of the PR and between fa9c30c and fe41c8f.

📒 Files selected for processing (8)
  • shortcuts/base/base_shortcuts_test.go
  • shortcuts/base/workflow_disable.go
  • shortcuts/base/workflow_enable.go
  • shortcuts/base/workflow_update.go
  • skills/lark-base/SKILL.md
  • skills/lark-base/references/lark-base-workflow-guide.md
  • skills/lark-base/references/lark-base-workflow-schema.md
  • tests/cli_e2e/base/base_workflow_update_dryrun_test.go

Comment on lines +238 to +239
> ⚠️ **先翻译方向,再填写数值:** `offset=N` 表示日期前 N 个单位触发(提前 N);`offset=-N` 表示日期后 N 个单位触发(延后 N)。提交和回读时都按这句自然语言复核,不要只比较绝对值。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 200

Repository: 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 200

Repository: larksuite/cli

Length of output: 270


Clarify the zero-offset semantics in ReminderTrigger.

MINUTE and DAY both allow offset=0, but the direction rule only defines positive offsets as “before” and negative offsets as “after.” Document that offset=0 means the referenced date/time, or remove it if the service rejects zero.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/lark-base/references/lark-base-workflow-schema.md` around lines 238 -
239, Update the ReminderTrigger offset documentation to explicitly define
offset=0 as triggering at the referenced date/time, while preserving the
existing positive-before and negative-after semantics; only remove zero from the
allowed values if the service rejects it.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that steps is empty, not merely an array.

IsArray() would pass if a regression replaced the stdin payload with any non-empty steps array. Assert length zero to verify the exact {"steps":[]} input is preserved.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
require.True(t, clie2e.DryRunGet(out, "api.0.body.steps").IsArray(), out)
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)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/cli_e2e/base/base_workflow_update_dryrun_test.go` at line 40, Update
the assertion on DryRunGet("api.0.body.steps") to verify the steps array has
length zero, rather than only checking IsArray(), while preserving the existing
output context passed to the assertion.

Source: Coding guidelines


1. 用 `+workflow-list` / `+workflow-get` 定位准确的 `workflow_id` 并读取现状。
2. **始终执行用户要求的写命令。** 预读结果已经符合目标,不代表本次显式请求已完成;`+workflow-enable`、`+workflow-disable` 和保持相同目标值的 `+workflow-update` 都应按请求执行。不要把这条规则扩展到重复 `+workflow-create`。
3. 写入成功后对同一个 `workflow_id` 执行 `+workflow-get`,逐项核对用户要求的状态或字段。不能只以 update/enable/disable 的成功回执作为最终证据。

@yballul-bytedance yballul-bytedance Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里面我感觉应该相信写操作返回的状态?如果 get 一次,其实耗 token 还挺大的,因为 workflow 配置可能比较复杂

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@fe41c8f3520bc8a1219f7caefd36d3390be2c2fe

🧩 Skill update

npx skills add TanDianxiong/cli#auto-research-sync/01KYP9Z4SKA4YTSR27AX864802/mr-1294-758485a5 -y -g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/base PR touches the base domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants