Skip to content

feat: support note generated event#1159

Merged
hugang-lark merged 1 commit into
mainfrom
feat/vc_event
May 28, 2026
Merged

feat: support note generated event#1159
hugang-lark merged 1 commit into
mainfrom
feat/vc_event

Conversation

@hugang-lark
Copy link
Copy Markdown
Collaborator

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

Summary

Add vc.note.generated_v1 event listener in the VC domain. The event fires when a note is generated (meeting, recording, or local file upload). The Process hook enriches note_token, verbatim_token, and note_source via the note detail API.

Changes

  • Add vc.note.generated_v1 event: flatten payload, enrich note_token/verbatim_token/note_source via detail API.
  • Update skill docs: add vc.note.generated_v1 field reference, source type semantics, and examples

Test Plan

  • lark-cli event list shows vc.note.generated_v1
  • lark-cli event consume vc.note.generated_v1 --as user --max-events 1 --timeout 30s streams enriched note events

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Support for vc.note.generated_v1 events, emitting note IDs, document tokens, and meeting-source info when available; outputs may be enriched with note details.
  • Documentation

    • Added comprehensive event reference and examples for consuming, filtering, and enriching note generation events.
  • Tests

    • Added test coverage for processing, enrichment, retry/error scenarios, and malformed payload handling.

Review Change Stack

@hugang-lark hugang-lark added enhancement New feature or request feature labels May 28, 2026
@hugang-lark hugang-lark changed the title feat: support not generated event feat: support note generated event May 28, 2026
@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 the size/M Single-domain feat or fix with limited business impact label May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

Adds a new vc.note.generated_v1 event processor that flattens envelope metadata, optionally enriches outputs via a retried note-detail API call to extract note/verbatim tokens and source, registers the event with subscribe/unsubscribe PreConsume wiring, adds tests for success and failure/retry paths, and updates documentation.

Changes

VC Note Generated Event

Layer / File(s) Summary
Event processor and data types
events/vc/note_generated.go
Defines VCNoteGeneratedOutput and VCNoteSourceOutput. Implements processVCNoteGenerated to unmarshal envelope metadata, set Type preferring envelope header with fallback to raw.EventType, return original payload bytes on malformed JSON, and includes isLarkCode helper.
API enrichment with retry logic
events/vc/note_generated.go
Implements fillVCNoteGeneratedDetails to GET note details (built from note_id) with retry and fixed delay; treats a specific Lark "not found" code specially, retries on unmarshal/empty-token cases, extracts NoteToken (artifact type 1) and VerbatimToken (type 2), and conditionally sets NoteSource.
Event registration and wiring
events/vc/register.go
Adds pathNoteDetailFmt and registers vc.note.generated_v1 in Keys() with custom flat schema, Process and PreConsume handlers, subscribe/unsubscribe lifecycle wiring, vc:note:read scope, and user auth type.
Comprehensive test suite
events/vc/note_generated_test.go
Adds tests verifying registration, successful processing (tokens and source extraction), PreConsume subscribe/unsubscribe lifecycle, detail API failure fallback, retry success when tokens appear, retry exhaustion, malformed payload passthrough, and a helper to run processing.
Documentation and references
skills/lark-event/SKILL.md, skills/lark-event/references/lark-event-vc.md
Updates skill index and VC reference to include vc.note.generated_v1, clarifies shared custom schema and PreConsume auto-subscribe/unsubscribe behavior, documents output fields and conditional note_source, and provides lark-cli event consume examples showing jq-based filtering.

Sequence Diagram(s)

sequenceDiagram
  participant RawEvent
  participant Processor as processVCNoteGenerated
  participant APIClient as event.APIClient
  participant NoteAPI as Note Detail API
  RawEvent->>Processor: incoming envelope payload
  Processor->>Processor: unmarshal envelope, build VCNoteGeneratedOutput
  alt note_id present and APIClient provided
    Processor->>APIClient: CallAPI GET /note/{note_id}
    APIClient->>NoteAPI: HTTP GET note detail
    NoteAPI-->>APIClient: JSON response or error
    APIClient-->>Processor: response/error
    Processor->>Processor: parse artifacts, extract tokens and note_source
  end
  Processor->>RawEvent: return marshaled flat output (or passthrough bytes on malformed payload)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • larksuite/cli#1113: Introduces foundational VC event subscription PreConsume helper and initial VC registration that this PR extends with the note-generated key and processor.

Suggested labels

domain/vc

Suggested reviewers

  • zhangjun-bytedance
  • zhaoleibd

Poem

🐰 A note took shape in a flutter and hum,
Tokens sought sunlight, then quietly found,
Retries kept asking until answers come,
CLI now carries that enriched sound,
Hop, hop — the rabbit stamps the patch outbound.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% 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 accurately captures the main addition: support for a new note generated event in the VC domain.
Description check ✅ Passed The description covers all required template sections: Summary, Changes, Test Plan, and Related Issues, with complete details about the event implementation and documentation updates.
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

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.77%. Comparing base (893555a) to head (6fbdf24).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
events/vc/note_generated.go 86.66% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1159      +/-   ##
==========================================
+ Coverage   68.74%   68.77%   +0.03%     
==========================================
  Files         627      628       +1     
  Lines       58579    58670      +91     
==========================================
+ Hits        40269    40353      +84     
- Misses      15018    15021       +3     
- Partials     3292     3296       +4     

☔ View full report in Codecov by Sentry.
📢 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

github-actions Bot commented May 28, 2026

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/vc_event -y -g

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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/note_generated.go`:
- Around line 130-146: The code currently returns/continues early when both
noteToken and verbatimToken are empty, which skips assigning NoteSource; to fix,
check and assign resp.Data.Note.NoteSource into out.NoteSource (using
VCNoteSourceOutput with SourceType and SourceEntityID) before the early
continue/return so source metadata is preserved even if tokens are not ready
yet; specifically, in the block handling noteToken/verbatimToken (variables
noteToken, verbatimToken, out, resp.Data.Note.NoteSource, VCNoteSourceOutput)
move or duplicate the src check/assignment to run whether or not tokens are
present, then still continue/return when tokens are empty.
🪄 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: fcb9f404-b4a4-4057-a548-a128d87064fa

📥 Commits

Reviewing files that changed from the base of the PR and between 893555a and edd84e9.

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

Comment thread events/vc/note_generated.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@skills/lark-event/references/lark-event-vc.md`:
- Around line 70-72: The doc incorrectly states note_source is "only present
when source is a meeting"; update the wording to match the implementation in
fillVCNoteGeneratedDetails by saying note_source is present whenever
resp.Data.Note.NoteSource contains a non-empty source_type or source_entity_id
(i.e., when either field is set), or alternatively change the implementation to
enforce source_type == "meeting" before populating out.NoteSource; reference
fillVCNoteGeneratedDetails, resp.Data.Note.NoteSource and out.NoteSource to
locate the code to align docs with behavior.
🪄 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: 29b3207f-3909-47b7-a874-ffcb735c18e7

📥 Commits

Reviewing files that changed from the base of the PR and between edd84e9 and 6fbdf24.

📒 Files selected for processing (5)
  • events/vc/note_generated.go
  • events/vc/note_generated_test.go
  • events/vc/register.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-vc.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • events/vc/register.go
  • skills/lark-event/SKILL.md
  • events/vc/note_generated_test.go
  • events/vc/note_generated.go

Comment thread skills/lark-event/references/lark-event-vc.md
@hugang-lark hugang-lark merged commit 21998b9 into main May 28, 2026
21 of 22 checks passed
@hugang-lark hugang-lark deleted the feat/vc_event branch May 28, 2026 13:10
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/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