Skip to content

feat: support vc,minute event#1113

Merged
hugang-lark merged 1 commit into
mainfrom
feat/vc_event_v3
May 26, 2026
Merged

feat: support vc,minute event#1113
hugang-lark merged 1 commit into
mainfrom
feat/vc_event_v3

Conversation

@hugang-lark

@hugang-lark hugang-lark commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add two custom-flattened event listeners (vc.meeting.participant_meeting_ended_v1, minutes.minute.generated_v1) with PreConsume subscription lifecycle, detail API enrichment with graceful degradation.

Changes

  • Add vc.meeting.participant_meeting_ended_v1 event: flatten payload, convert unix timestamps to local RFC3339
  • Add minutes.minute.generated_v1 event: flatten payload + enrich title via detail API.
  • Implement PreConsume hooks for all three events: auto-subscribe on first consumer, best-effort unsubscribe on last consumer exit
  • Create skills/lark-event/references/lark-event-vc.md and lark-event-minutes.md with field reference, enrichment/degradation semantics, and jq examples
  • Update skills/lark-event/SKILL.md description and topic index to cover VC and Minutes domains

Test Plan

  • lark-cli event list shows all three new EventKeys
  • lark-cli event consume vc.meeting.participant_meeting_ended_v1 --as user --max-events 1 --timeout 30s streams enriched vc events
  • lark-cli event consume minutes.minute.generated_v1 --as user --max-events 1 --timeout 30s streams enriched minute events

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added support for Minutes-generated events with optional enrichment from the Minutes detail API.
    • Added support for VC meeting-ended events with localized start/end timestamp formatting.
  • Tests

    • Comprehensive tests for Minutes and VC processors, including subscription lifecycle, retry/fallback and malformed-payload handling.
  • Documentation

    • Added event reference docs and updated skill docs to include Minutes and VC event guidance.

Review Change Stack

@hugang-lark hugang-lark added enhancement New feature or request feature labels May 26, 2026
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds Minutes and VC event support: flattened output types and processors (Minutes enrichment via minutes detail API with retries; VC Unix-seconds → local RFC3339 conversion), pre-consume subscription helpers, registration into the global event registry, tests, and documentation.

Changes

Event Domains: Minutes and VC

Layer / File(s) Summary
Minutes event processor and schema
events/minutes/minute_generated.go
MinutesMinuteGeneratedOutput and MinutesMinuteSourceOutput types; processMinutesMinuteGenerated populates base fields and conditionally calls fillMinutesMinuteGeneratedDetails which retries GETs to the minutes detail endpoint and fills Title when present.
Minutes subscription lifecycle
events/minutes/preconsume.go
subscriptionPreConsume posts {event_type} to subscribePath and returns a cleanup closure that posts to unsubscribePath with a timeout-bound context.
Minutes event registration
events/minutes/register.go
Keys() exports the minutes.minute.generated_v1 event.KeyDefinition wired to schema, processor, preconsume, required scope, and auth type.
Minutes event tests
events/minutes/minute_generated_test.go
Tests key registration, processing (detail API GET path/method, field mapping), retry/fallback behavior for detail failures and empty titles, PreConsume lifecycle, and malformed-payload passthrough; includes test helpers.
VC event processor and schema
events/vc/participant_meeting_ended.go
VCParticipantMeetingEndedOutput defines flattened fields; processVCParticipantMeetingEnded maps fields and uses unixSecondsToLocalRFC3339 to convert start/end times to local RFC3339, returning original payload on parse error.
VC subscription lifecycle
events/vc/preconsume.go
subscriptionPreConsume posts subscription registration and returns an unsubscribe cleanup closure using a timeout-bounded context.
VC event registration
events/vc/register.go
Keys() returns the vc.meeting.participant_meeting_ended_v1 event.KeyDefinition wired to schema, processor, preconsume, required scope, and auth type.
VC event tests
events/vc/participant_meeting_ended_test.go, events/vc/test_helpers_test.go
Tests key registration, processing (field mapping and RFC3339 conversion), invalid time handling, PreConsume lifecycle subscribe/unsubscribe assertions, malformed-payload passthrough, and includes test helpers/stubs.
Global event registry integration
events/register.go
Imports minutes and vc packages and registers their Keys() in the global init alongside im.Keys().
Event documentation and skill updates
skills/lark-event/SKILL.md, skills/lark-event/references/lark-event-minutes.md, skills/lark-event/references/lark-event-vc.md
Broadens event consume description and adds reference docs for Minutes and VC describing scopes, output schemas, enrichment and time conversion behaviors, and CLI consume examples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

domain/vc

Suggested reviewers

  • zhaoleibd

Poem

🐇 New events hop into the glen,
Minutes fetch titles now and then,
VC times shape to local light,
CLI listens through the night,
Hooray — the rabbit stamps its pen!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'feat: support vc,minute event' partially describes the changeset but is incomplete and imprecise compared to the actual scope of changes. Clarify the title to more accurately reflect the additions: either expand to list all new events (vc and minutes) or rephrase to indicate the complete feature scope (e.g., 'feat: add VC and Minutes event listeners with pre-consume hooks and detail enrichment').
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description is complete and follows the template structure with Summary, Changes, Test Plan, and Related Issues sections. All required information is present and clearly documented.
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 feat/vc_event_v3

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 and usage tips.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label May 26, 2026
@CLAassistant

CLAassistant commented May 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/vc_event_v3 -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: 3

🧹 Nitpick comments (1)
events/minutes/minute_generated_test.go (1)

72-137: ⚡ Quick win

Add explicit tests for the two remaining degradation branches.

Please add cases for: (1) empty header.event_type falling back to raw.EventType (Line 63), and (2) detail API returning invalid JSON triggering retry/continue (Line 106).

Also applies to: 320-353

🤖 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/minutes/minute_generated_test.go` around lines 72 - 137, Add two new
subtests to TestProcessMinutesMinuteGenerated that exercise the fallback and
error-degrade paths: (1) send an event payload where header.event_type is an
empty string but event.schema/raw.EventType is set, call runMinuteGenerated and
assert the produced out.Type uses the raw EventType value (reference
TestProcessMinutesMinuteGenerated, runMinuteGenerated and
eventTypeMinuteGenerated); (2) simulate the detail API returning invalid JSON by
having stubAPIClient.callFn return a malformed JSON response (or an
unmarshalling error) on the GET for minutes detail and verify the processor
retries/continues as expected (assert no panic and appropriate out values or
error handling behavior), using the existing stubAPIClient.callFn hook to
control responses.
🤖 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/minutes/minute_generated.go`:
- Around line 94-107: The retry loop in fillMinutesMinuteGeneratedDetails
currently ignores context cancellation and will keep sleeping/ retrying; update
the loop to check ctx.Err() and return early when canceled (e.g., at the top of
each iteration and before sleeping) so retries stop on cancellation.
Specifically, inside the for attempt := 0; attempt <= minutesDetailMaxRetries;
attempt++ loop, verify ctx.Err() != nil and break/return rather than continuing,
and ensure the sleep using minutesDetailRetryDelay is skipped if the context is
canceled; make these checks around the calls to rt.CallAPI and before
json.Unmarshal to prevent unnecessary work when ctx is done.

In `@events/vc/participant_meeting_ended_test.go`:
- Around line 50-98: Add a test case that removes header.event_type to exercise
the fallback path where the processor sets out.Type = raw.EventType: in
events/vc/participant_meeting_ended_test.go create a test (or extend
TestProcessVCParticipantMeetingEnded) that calls runMeetingEnded with a payload
lacking "header.event_type" and assert that out.Type equals raw.EventType (and
keep other existing assertions like EventID/Timestamp/MeetingID as relevant);
this will cover the fallback branch in participant_meeting_ended.go.

In `@events/vc/register.go`:
- Line 22: Remove the unused constant pathNoteDetailFmt from the file (it's
declared as pathNoteDetailFmt = "/open-apis/vc/v1/notes/%s") to satisfy
golangci-lint unused checks; search for the identifier pathNoteDetailFmt in
register.go and delete its declaration (or replace with a used constant if
intended), making sure no other code references it afterwards.

---

Nitpick comments:
In `@events/minutes/minute_generated_test.go`:
- Around line 72-137: Add two new subtests to TestProcessMinutesMinuteGenerated
that exercise the fallback and error-degrade paths: (1) send an event payload
where header.event_type is an empty string but event.schema/raw.EventType is
set, call runMinuteGenerated and assert the produced out.Type uses the raw
EventType value (reference TestProcessMinutesMinuteGenerated, runMinuteGenerated
and eventTypeMinuteGenerated); (2) simulate the detail API returning invalid
JSON by having stubAPIClient.callFn return a malformed JSON response (or an
unmarshalling error) on the GET for minutes detail and verify the processor
retries/continues as expected (assert no panic and appropriate out values or
error handling behavior), using the existing stubAPIClient.callFn hook to
control responses.
🪄 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: aa582d19-485d-4adf-81aa-773f427ace0b

📥 Commits

Reviewing files that changed from the base of the PR and between 68d78d5 and 4d420a2.

📒 Files selected for processing (13)
  • events/minutes/minute_generated.go
  • events/minutes/minute_generated_test.go
  • events/minutes/preconsume.go
  • events/minutes/register.go
  • events/register.go
  • events/vc/participant_meeting_ended.go
  • events/vc/participant_meeting_ended_test.go
  • events/vc/preconsume.go
  • events/vc/register.go
  • events/vc/test_helpers_test.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-minutes.md
  • skills/lark-event/references/lark-event-vc.md

Comment thread events/minutes/minute_generated.go
Comment thread events/vc/participant_meeting_ended_test.go
Comment thread events/vc/register.go Outdated
@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.54248% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.08%. Comparing base (b9e5b50) to head (62ea584).
⚠️ Report is 215 commits behind head on main.

Files with missing lines Patch % Lines
events/minutes/minute_generated.go 88.67% 3 Missing and 3 partials ⚠️
events/minutes/preconsume.go 66.66% 2 Missing and 2 partials ⚠️
events/vc/preconsume.go 66.66% 2 Missing and 2 partials ⚠️
events/vc/participant_meeting_ended.go 95.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1113      +/-   ##
==========================================
+ Coverage   67.93%   68.08%   +0.15%     
==========================================
  Files         603      612       +9     
  Lines       55779    56336     +557     
==========================================
+ Hits        37894    38357     +463     
- Misses      14750    14805      +55     
- Partials     3135     3174      +39     

☔ 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.

@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: 1

🤖 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/register.go`:
- Around line 15-20: The three constants eventTypeNoteGenerated,
pathNoteSubscribe, and pathNoteUnsubscribe are declared but unused (causing
linter/CI failures); either remove these unused constants or wire them into the
Keys() implementation so they are referenced (e.g., add the note event and note
subscription paths to the slice/map returned by Keys()), referencing the
existing Keys() function and the constants eventTypeNoteGenerated,
pathNoteSubscribe, and pathNoteUnsubscribe.
🪄 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: 352f80c1-f1db-4f33-a9af-d3c150dac904

📥 Commits

Reviewing files that changed from the base of the PR and between 4d420a2 and 62ea584.

📒 Files selected for processing (13)
  • events/minutes/minute_generated.go
  • events/minutes/minute_generated_test.go
  • events/minutes/preconsume.go
  • events/minutes/register.go
  • events/register.go
  • events/vc/participant_meeting_ended.go
  • events/vc/participant_meeting_ended_test.go
  • events/vc/preconsume.go
  • events/vc/register.go
  • events/vc/test_helpers_test.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-minutes.md
  • skills/lark-event/references/lark-event-vc.md
✅ Files skipped from review due to trivial changes (4)
  • skills/lark-event/references/lark-event-minutes.md
  • events/minutes/preconsume.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-vc.md

Comment thread events/vc/register.go
@hugang-lark hugang-lark changed the title feat: support vc,note,minute event feat: support vc,minute event May 26, 2026
@hugang-lark
hugang-lark merged commit 367cfc9 into main May 26, 2026
22 of 23 checks passed
@hugang-lark
hugang-lark deleted the feat/vc_event_v3 branch May 26, 2026 14:17
tuxedomm pushed a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants