feat: support vc,minute event#1113
Conversation
📝 WalkthroughWalkthroughAdds 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. ChangesEvent Domains: Minutes and VC
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@62ea584385a0c3ee4607d22a64bd5078fc9ec9a3🧩 Skill updatenpx skills add larksuite/cli#feat/vc_event_v3 -y -g |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
events/minutes/minute_generated_test.go (1)
72-137: ⚡ Quick winAdd explicit tests for the two remaining degradation branches.
Please add cases for: (1) empty
header.event_typefalling back toraw.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
📒 Files selected for processing (13)
events/minutes/minute_generated.goevents/minutes/minute_generated_test.goevents/minutes/preconsume.goevents/minutes/register.goevents/register.goevents/vc/participant_meeting_ended.goevents/vc/participant_meeting_ended_test.goevents/vc/preconsume.goevents/vc/register.goevents/vc/test_helpers_test.goskills/lark-event/SKILL.mdskills/lark-event/references/lark-event-minutes.mdskills/lark-event/references/lark-event-vc.md
4d420a2 to
62ea584
Compare
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
📒 Files selected for processing (13)
events/minutes/minute_generated.goevents/minutes/minute_generated_test.goevents/minutes/preconsume.goevents/minutes/register.goevents/register.goevents/vc/participant_meeting_ended.goevents/vc/participant_meeting_ended_test.goevents/vc/preconsume.goevents/vc/register.goevents/vc/test_helpers_test.goskills/lark-event/SKILL.mdskills/lark-event/references/lark-event-minutes.mdskills/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
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
Test Plan
Related Issues
Summary by CodeRabbit
New Features
Tests
Documentation