event consume card.action.trigger 丢弃模板卡/卡片实体的事件(dropped: malformed payload)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 17.3k
- Forks
- 1.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 105
Description
现象
lark-cli event consume card.action.trigger --as bot 订阅后,模板卡(搭建工具发布的模板,用 type:"template" 发送)与卡片实体(type:"card" + card_id)上的按钮点击,事件一律被丢弃:
- stderr:
WARN: event <event_id> (card.action.trigger) dropped: malformed payload - stdout:无输出
同一个群里、同位置按钮,换成普通卡 JSON 发送的卡就正常收到事件。
与 #2740 提到的「关联现象(card):
card.action.trigger同 bus 出现过WARN: event <id> dropped: malformed payload」是同一现象 —— 本 issue 给出它的触发条件。
环境
- lark-cli 1.0.96(1.0.92 同样复现)
- Windows 11
- 订阅命令:
lark-cli event consume card.action.trigger --as bot
复现
lark-cli event consume card.action.trigger --as bot- 用
type:"template"发送一张搭建工具发布的模板卡 - 点击卡上带
callback的按钮 - 观察 stderr 的 WARN 与 stdout 的空输出
对照(同一订阅、同一应用、同一群)
| 发送方式 | 消息 content | 结果 |
|---|---|---|
| 普通卡 JSON | {schema, body, ...} |
✅ 正常输出事件 |
type:"template" 直发 |
{"type":"template","data":{...}} |
❌ malformed |
type:"card" 卡片实体 |
{"type":"card","data":{"card_id":"..."}} |
❌ malformed |
补充对照(排除 value 内容的影响):同一张模板卡上,循环外的按钮(value 不含换行)与循环内的可点容器(value 含 \n)都被丢弃 ⇒ 变量只剩「卡类型 / 消息 content 形态」这一个。
判断(推测,未看源码)
lark-cli event schema card.action.trigger 说明 consumer 会 auto-fetch card_content(原始卡 JSON)。上述两种卡片的消息 content 不是卡 JSON → 解析失败 → 整条事件被丢弃。
但同一 schema 明确 card_content 允许为空("empty if message_id absent or fetch fails")⇒ 期望 降级为空串并正常输出事件,而不是丢弃整条事件。
影响
循环容器(repeat)仅支持在卡片搭建工具上使用(无法通过卡片 JSON 代码构建)。因此「循环列表 + 按钮回调」这类场景,在这条链路上完全收不到事件。
补充:CLI 自身文档的设计取向
lark-cli skills read lark-im(内嵌技能,1.0.96)第 75 行:
Card messages (
interactivetype) are not yet supported for compact conversion in event subscriptions. The raw event data will be returned instead, with a hint printed to stderr.
(该句语境是消息事件,非本 issue 的 card.action.trigger —— 此处仅作设计取向佐证:CLI 遇到无法紧凑转换的场景时,取向是「退回原始数据」而非丢弃。
本次实测:提示打出了(即 stderr 的 WARN),原始数据没有退回(stdout 恒空)。)
期望
- 消息 content 无法解析为卡片 JSON 时,降级为
card_content="",正常输出事件; - 或提供关闭 auto-fetch 的开关(如
--no-card-content)。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the event consume card.action.trigger entry point and inspect the schema conversion and card_content auto-fetch path. Reproduce with type:"template" and type:"card" message content, then verify that an unparseable card payload emits the event with empty card_content instead of dropping it; add regression coverage for both forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100