Skip to content

feat: support VC bot event consume#1589

Open
Ren1104 wants to merge 1 commit into
mainfrom
features/F-vc-meeting-contract
Open

feat: support VC bot event consume#1589
Ren1104 wants to merge 1 commit into
mainfrom
features/F-vc-meeting-contract

Conversation

@Ren1104

@Ren1104 Ren1104 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add raw-preserving vc.bot.* event processors and bot-only event registration
  • document bot/user/open meeting event boundaries and Feishu post emotion forwarding guidance

Validation

  • python3 tooling/scripts/limited_compile.py --cwd workspace/worktrees/F-vc-meeting-contract/larksuite-cli --label gate4-acceptance-vc-build -- go build ./events/vc
  • collector preflight passed before commit/push

Gate4 feature: F-vc-meeting-contract

Summary by CodeRabbit

  • New Features

    • Added support for three new VC bot event types: meeting invited, meeting event, and meeting ended.
    • Bot event results now include normalized details like event ID, timestamps, call/meeting info, activity type, and emoji-related data while preserving the original payload.
  • Bug Fixes

    • Improved handling of malformed bot meeting-event payloads so raw data is returned unchanged instead of failing.
  • Documentation

    • Updated VC event references and usage guidance to include the new bot event keys and bot-specific consumption patterns.

Source-Branch: features/F-vc-meeting-contract
Source-Commit: 40a09c8
Source-Subject: chore: release v1.0.58 (#1586)
Repo: larksuite-cli
Synced-By: bytedance
Timestamp: 20260625_190731Z
@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds bot VC event keys and handlers that normalize meeting payloads into VCBotEventOutput, preserve raw payloads on malformed input, and updates tests and VC event documentation for bot consumption and emotion forwarding.

Changes

VC bot event processing

Layer / File(s) Summary
Contract and registry wiring
events/vc/bot_events.go, events/vc/register.go
Adds VCBotEventOutput, bot meeting handler wrappers, new bot event type constants, and Keys() entries wired to the shared output schema with bot auth and console event requirements.
Payload normalization
events/vc/bot_events.go
Decodes raw bot payloads, extracts stable fields from nested structures, orders traversal, deduplicates emoji types, and converts JSON values to strings and string slices.
Tests and passthrough checks
events/vc/bot_events_test.go
Registers the new bot keys in tests, checks normalized output fields for invited, event, and ended payloads, and verifies malformed payload passthrough.
VC bot documentation
skills/lark-event/SKILL.md, skills/lark-event/references/lark-event-vc.md
Updates the VC topic index and reference guide for bot-observed keys, bot auth, raw_event handling, and emotion forwarding guidance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

enhancement, feature, domain/vc, size/L

Suggested reviewers

  • calendar-assistant

Poem

A rabbit hopped through event fields bright,
With bot keys twinkling in the night.
Raw payloads stayed snug in my shell,
And emoji carrots danced quite well. 🥕
Hop hop—VC events sing just right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and validation, but it omits the required Changes section and Related Issues entry. Add a Changes bullet list, fill in Test Plan as the template expects, and include the Related Issues section, even if it is None.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: adding VC bot event support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch features/F-vc-meeting-contract

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.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.15152% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.77%. Comparing base (40a09c8) to head (8581b1c).

Files with missing lines Patch % Lines
events/vc/bot_events.go 86.86% 11 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1589      +/-   ##
==========================================
+ Coverage   74.74%   74.77%   +0.02%     
==========================================
  Files         799      800       +1     
  Lines       80380    80512     +132     
==========================================
+ Hits        60084    60203     +119     
- Misses      15849    15860      +11     
- Partials     4447     4449       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#features/F-vc-meeting-contract -y -g

@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 `@events/vc/bot_events.go`:
- Around line 41-45: Treat payloads with trailing garbage as malformed in the
event parsing flow. In `decodeEvent` (and any shared path used by
`RawEvent`/`json.Marshal(out)`), after `decoder.Decode(&payload)` also verify
there is no extra non-whitespace data remaining in the decoder stream, and fall
back to the raw-passthrough return when any trailing bytes are present. Add a
test covering a valid JSON object followed by junk to ensure the
malformed-passthrough behavior stays covered.

In `@skills/lark-event/references/lark-event-vc.md`:
- Around line 21-27: The vc-event reference table currently mixes OAuth scopes
with Developer Console prerequisites for the bot events, which makes the Scope
column misleading. Update the markdown table in the lark-event-vc reference so
the bot rows for vc.bot.meeting_invited_v1, vc.bot.meeting_event_v1, and
vc.bot.meeting_ended_v1 clearly separate the Developer Console subscription
requirement from the OAuth Scope column, while keeping the user event rows
unchanged.
🪄 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

Run ID: a39f672a-63f4-4b8b-a0ba-a171ac37be89

📥 Commits

Reviewing files that changed from the base of the PR and between 40a09c8 and 8581b1c.

📒 Files selected for processing (5)
  • events/vc/bot_events.go
  • events/vc/bot_events_test.go
  • events/vc/register.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-vc.md

Comment thread events/vc/bot_events.go
Comment on lines +41 to +45
decoder := json.NewDecoder(bytes.NewReader(raw.Payload))
decoder.UseNumber()
if err := decoder.Decode(&payload); err != nil {
return raw.Payload, nil //nolint:nilerr // passthrough on malformed payload so consumers still see the event
}

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

Treat trailing bytes as malformed too.

json.Decoder.Decode only consumes the first JSON value. A payload like {"header":{...}} junk gets past Line 43, but RawEvent still contains invalid JSON, so the json.Marshal(out) at Line 62 fails and the consume loop drops the event instead of doing the intended raw passthrough.

Suggested fix
 import (
 	"bytes"
 	"context"
 	"encoding/json"
+	"io"
 	"sort"
@@
 	decoder := json.NewDecoder(bytes.NewReader(raw.Payload))
 	decoder.UseNumber()
 	if err := decoder.Decode(&payload); err != nil {
 		return raw.Payload, nil //nolint:nilerr // passthrough on malformed payload so consumers still see the event
 	}
+	var trailing any
+	if err := decoder.Decode(&trailing); err != io.EOF {
+		return raw.Payload, nil //nolint:nilerr // passthrough when extra trailing bytes make the payload malformed
+	}

Please add a test case for “valid JSON + trailing garbage” to keep the malformed-passthrough contract covered.

Also applies to: 54-62

🤖 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 `@events/vc/bot_events.go` around lines 41 - 45, Treat payloads with trailing
garbage as malformed in the event parsing flow. In `decodeEvent` (and any shared
path used by `RawEvent`/`json.Marshal(out)`), after `decoder.Decode(&payload)`
also verify there is no extra non-whitespace data remaining in the decoder
stream, and fall back to the raw-passthrough return when any trailing bytes are
present. Add a test covering a valid JSON object followed by junk to ensure the
malformed-passthrough behavior stays covered.

Comment on lines 21 to +27
| EventKey | Scope | Auth |
|---|---|---|
| `vc.meeting.participant_meeting_ended_v1` | `vc:meeting.meetingevent:read` | user |
| `vc.note.generated_v1` | `vc:note:read` | user |
| `vc.bot.meeting_invited_v1` | App event subscription in the Developer Console | bot |
| `vc.bot.meeting_event_v1` | App event subscription in the Developer Console | bot |
| `vc.bot.meeting_ended_v1` | App event subscription in the Developer Console | bot |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Separate the bot console prerequisite from the Scope column.

The bot rows are not OAuth scopes; they’re Developer Console subscription requirements. As written, this reads like a scope users should configure, which is misleading.

Suggested fix
-| EventKey | Scope | Auth |
+| EventKey | Scope / Console requirement | Auth |
@@
-| `vc.bot.meeting_invited_v1` | App event subscription in the Developer Console | bot |
-| `vc.bot.meeting_event_v1` | App event subscription in the Developer Console | bot |
-| `vc.bot.meeting_ended_v1` | App event subscription in the Developer Console | bot |
+| `vc.bot.meeting_invited_v1` | Developer Console app event subscription | bot |
+| `vc.bot.meeting_event_v1` | Developer Console app event subscription | bot |
+| `vc.bot.meeting_ended_v1` | Developer Console app event subscription | bot |
📝 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
| EventKey | Scope | Auth |
|---|---|---|
| `vc.meeting.participant_meeting_ended_v1` | `vc:meeting.meetingevent:read` | user |
| `vc.note.generated_v1` | `vc:note:read` | user |
| `vc.bot.meeting_invited_v1` | App event subscription in the Developer Console | bot |
| `vc.bot.meeting_event_v1` | App event subscription in the Developer Console | bot |
| `vc.bot.meeting_ended_v1` | App event subscription in the Developer Console | bot |
| EventKey | Scope / Console requirement | Auth |
|---|---|---|
| `vc.meeting.participant_meeting_ended_v1` | `vc:meeting.meetingevent:read` | user |
| `vc.note.generated_v1` | `vc:note:read` | user |
| `vc.bot.meeting_invited_v1` | Developer Console app event subscription | bot |
| `vc.bot.meeting_event_v1` | Developer Console app event subscription | bot |
| `vc.bot.meeting_ended_v1` | Developer Console app event subscription | bot |
🤖 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-event/references/lark-event-vc.md` around lines 21 - 27, The
vc-event reference table currently mixes OAuth scopes with Developer Console
prerequisites for the bot events, which makes the Scope column misleading.
Update the markdown table in the lark-event-vc reference so the bot rows for
vc.bot.meeting_invited_v1, vc.bot.meeting_event_v1, and vc.bot.meeting_ended_v1
clearly separate the Developer Console subscription requirement from the OAuth
Scope column, while keeping the user event rows unchanged.

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

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant