Skip to content

feat(events): subscribe board.whiteboard.updated_v1 #1265

Merged
qinxiaoyun merged 1 commit into
mainfrom
feat/board-whiteboard-updated-preconsume
Jun 5, 2026
Merged

feat(events): subscribe board.whiteboard.updated_v1 #1265
qinxiaoyun merged 1 commit into
mainfrom
feat/board-whiteboard-updated-preconsume

Conversation

@qinxiaoyun

@qinxiaoyun qinxiaoyun commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wire the board.whiteboard.updated_v1 EventKey into the consume pipeline so that lark-cli event consume automatically calls the per-whiteboard subscribe / unsubscribe OAPIs instead of requiring callers to manage server-side subscriptions out-of-band.

Changes

  • events/board: add PreConsume hook that posts to /open-apis/board/v1/whiteboards/{whiteboard_id}/subscribe on startup and the matching /unsubscribe on cleanup; declare whiteboard_id as a required string param on the EventKey.
  • events/register.go: register the board domain alongside im/minutes/vc.
  • skills/lark-event: link a new references/lark-event-whiteboard.md describing the per-whiteboard subscription model and payload field reference.

Test Plan

  • Unit tests pass

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Support for whiteboard update events (board.whiteboard.updated_v1) with per-whiteboard subscription and automatic unsubscribe on exit.
    • Subscription requires a whiteboard_id parameter and ensures proper path-encoding for identifiers.
  • Documentation

    • Added comprehensive docs and CLI examples for consuming whiteboard events, obtaining tokens, required scopes/auth, payload field mappings, and subscription lifecycle/cleanup guidance.

@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/L Large or sensitive change across domains or core paths label Jun 4, 2026
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds support for consuming board.whiteboard.updated_v1: defines payload structs, implements per-whiteboard subscribe/unsubscribe pre-consume lifecycle with tests, registers the event key and integrates it into event registration, and documents the feature in SKILL.md and a reference guide.

Changes

Whiteboard Event Support

Layer / File(s) Summary
Event payload schema
events/whiteboard/native.go
Defines BoardWhiteboardUpdatedV1Data and OperatorID structs with JSON tags for event payload deserialization.
Pre-consume subscription lifecycle
events/whiteboard/preconsume.go, events/whiteboard/preconsume_test.go
whiteboardSubscriptionPreConsume validates the runtime API client and required whiteboard_id, path-encodes the ID, POSTs to the subscribe endpoint with event_type, and returns a cleanup that unsubscribes. Tests cover missing param, nil client, subscribe failure, success path (subscribe + unsubscribe), encoding of special chars, and registry presence.
Event registration and integration
events/whiteboard/register.go, events/register.go
Registers board.whiteboard.updated_v1 key with required whiteboard_id param, schema binding to BoardWhiteboardUpdatedV1Data, field path overrides, PreConsume hook, required console event, scopes, and auth types. Integrates keys via blank import and global registration list.
Skill documentation
skills/lark-event/SKILL.md, skills/lark-event/references/lark-event-whiteboard.md
Updates SKILL.md description and topic index; adds a full reference doc describing the event key, per-whiteboard subscription workflow and token, field mappings, lifecycle notes (unsubscribe behavior), and CLI examples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • larksuite/cli#1113: Modifies events/register.go to register domain Keys() entries (similar registry wiring changes).

Suggested labels

enhancement, feature

Suggested reviewers

  • syh-cpdsss
  • zhangjun-bytedance
  • zkh-bytedance

Poem

🐰 I hopped to the board where whiteboards sing,
Subscribed per token, events take wing.
IDs encoded, operators in view,
A cleanup hops back when the session is through. 🎨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.45% 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
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.
Description check ✅ Passed The PR description follows the required template with all main sections completed: Summary clearly describes the motivation, Changes lists the main modifications across multiple files, and Test Plan indicates unit tests pass.
Title check ✅ Passed The PR title accurately and concisely describes the main change: adding subscription support for the board.whiteboard.updated_v1 event, which is the primary objective across all modified files.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/board-whiteboard-updated-preconsume

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 commented Jun 4, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@74aaad87aa9816ccf5373483751b11d57ebfdeaf

🧩 Skill update

npx skills add larksuite/cli#feat/board-whiteboard-updated-preconsume -y -g

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.35%. Comparing base (ac116e7) to head (74aaad8).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1265      +/-   ##
==========================================
+ Coverage   70.18%   70.35%   +0.17%     
==========================================
  Files         671      674       +3     
  Lines       65240    65368     +128     
==========================================
+ Hits        45786    45987     +201     
+ Misses      15783    15728      -55     
+ Partials     3671     3653      -18     

☔ 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/board/preconsume_test.go`:
- Around line 39-162: Add environment isolation by calling
t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) at the start of each
whiteboard preconsume test (e.g.
TestWhiteboardSubscriptionPreConsume_MissingWhiteboardID,
TestWhiteboardSubscriptionPreConsume_NilRuntime,
TestWhiteboardSubscriptionPreConsume_SubscribeError,
TestWhiteboardSubscriptionPreConsume_SubscribeAndCleanup,
TestWhiteboardSubscriptionPreConsume_PathSegmentEncoded, and
TestWhiteboardUpdatedV1HasPreConsume) or in a small shared helper invoked from
each test; place the call as the first statement in each test so each run uses
its own config dir and avoids config-state bleed.
🪄 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: 99037ed2-2e76-4d09-ae77-d7845ad564db

📥 Commits

Reviewing files that changed from the base of the PR and between c000dc3 and afebae8.

📒 Files selected for processing (8)
  • events/board/native.go
  • events/board/preconsume.go
  • events/board/preconsume_test.go
  • events/board/register.go
  • events/register.go
  • skills/lark-board/SKILL.md
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-board.md

Comment thread events/whiteboard/preconsume_test.go
@qinxiaoyun
qinxiaoyun force-pushed the feat/board-whiteboard-updated-preconsume branch from afebae8 to 4db118a Compare June 4, 2026 13:23
@github-actions github-actions Bot added the domain/ccm PR touches the ccm domain label Jun 4, 2026
@qinxiaoyun
qinxiaoyun force-pushed the feat/board-whiteboard-updated-preconsume branch from 4db118a to 28b0ac9 Compare June 4, 2026 13:28

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
shortcuts/whiteboard/whiteboard_query_test.go (1)

157-201: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Dry-run endpoint expectations are declared but never asserted.

At Lines 171/180/189, wantMethod and wantPath are set, but the test only checks dryRun != nil at Lines 197-199. This won’t catch endpoint-regression in dry-run output.

🤖 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 `@shortcuts/whiteboard/whiteboard_query_test.go` around lines 157 - 201, The
test builds table-driven cases with wantMethod/wantPath but never asserts them;
update the subtest body that calls WhiteboardQuery.DryRun(ctx, rt) to first
assert dryRun is non-nil and then compare dryRun.Method and dryRun.Path (or the
actual fields/nested values returned by WhiteboardQuery.DryRun) against
tt.wantMethod and tt.wantPath, failing the test with t.Fatalf or t.Errorf when
they differ; use the existing tt, rt, dryRun and newTestRuntime symbols to
locate and implement these assertions so endpoint-regression is detected.
🤖 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/whiteboard/register.go`:
- Around line 14-24: The constant eventTypeWhiteboardUpdated is set to
"whiteboard.whiteboard.updated_v1" which mismatches the expected namespace and
breaks subscriptions; update the value of eventTypeWhiteboardUpdated to
"board.whiteboard.updated_v1" and ensure all uses inside Keys() (the Key and
EventType fields of the event.KeyDefinition, and any RequiredConsoleEvents or
subscribe/event_type references) rely on that corrected constant so the runtime
will subscribe and consume the intended event.

In `@shortcuts/whiteboard/whiteboard_query.go`:
- Around line 172-176: The ApiPath in fetchWhiteboardNodes interpolates wbToken
without path-segment encoding; update the ApiPath construction in
fetchWhiteboardNodes to path-escape wbToken the same way used elsewhere (e.g.,
use url.PathEscape on wbToken) before formatting into fmt.Sprintf so reserved
characters like '/' or '?' cannot alter the request path.

---

Outside diff comments:
In `@shortcuts/whiteboard/whiteboard_query_test.go`:
- Around line 157-201: The test builds table-driven cases with
wantMethod/wantPath but never asserts them; update the subtest body that calls
WhiteboardQuery.DryRun(ctx, rt) to first assert dryRun is non-nil and then
compare dryRun.Method and dryRun.Path (or the actual fields/nested values
returned by WhiteboardQuery.DryRun) against tt.wantMethod and tt.wantPath,
failing the test with t.Fatalf or t.Errorf when they differ; use the existing
tt, rt, dryRun and newTestRuntime symbols to locate and implement these
assertions so endpoint-regression is detected.
🪄 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: afe6ce33-ded8-427f-9d70-2666b944c9de

📥 Commits

Reviewing files that changed from the base of the PR and between afebae8 and 4db118a.

📒 Files selected for processing (13)
  • cmd/auth/login_test.go
  • events/register.go
  • events/whiteboard/native.go
  • events/whiteboard/preconsume.go
  • events/whiteboard/preconsume_test.go
  • events/whiteboard/register.go
  • shortcuts/doc/doc_media_download.go
  • shortcuts/whiteboard/whiteboard_query.go
  • shortcuts/whiteboard/whiteboard_query_test.go
  • shortcuts/whiteboard/whiteboard_update.go
  • shortcuts/whiteboard/whiteboard_update_test.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-whiteboard.md
✅ Files skipped from review due to trivial changes (2)
  • skills/lark-event/references/lark-event-whiteboard.md
  • skills/lark-event/SKILL.md

Comment thread events/whiteboard/register.go Outdated
Comment thread shortcuts/whiteboard/whiteboard_query.go
@qinxiaoyun
qinxiaoyun force-pushed the feat/board-whiteboard-updated-preconsume branch from 28b0ac9 to e01f470 Compare June 4, 2026 13:39

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

🧹 Nitpick comments (1)
shortcuts/doc/doc_media_download.go (1)

38-38: ⚡ Quick win

Add targeted tests for the migrated whiteboard endpoint branches.

These new whiteboard-path branches are currently uncovered; please add/adjust tests that assert both DryRun and Execute use /open-apis/whiteboard/v1/whiteboards/{token}/download_as_image for --type=whiteboard.

Also applies to: 66-66

🤖 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 `@shortcuts/doc/doc_media_download.go` at line 38, Tests need to be
added/updated to cover the new whiteboard endpoint branches so both DryRun and
Execute use the migrated path string
GET("/open-apis/whiteboard/v1/whiteboards/:token/download_as_image") when
invoked with --type=whiteboard; update or add unit tests that call the command
handler (invoke the DryRun and Execute methods) with the --type=whiteboard flag
and assert the outgoing request path equals
/open-apis/whiteboard/v1/whiteboards/{token}/download_as_image (verify both
branch behaviors), and include assertions for both DryRun and Execute code paths
to ensure the new branch is exercised.
🤖 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.

Nitpick comments:
In `@shortcuts/doc/doc_media_download.go`:
- Line 38: Tests need to be added/updated to cover the new whiteboard endpoint
branches so both DryRun and Execute use the migrated path string
GET("/open-apis/whiteboard/v1/whiteboards/:token/download_as_image") when
invoked with --type=whiteboard; update or add unit tests that call the command
handler (invoke the DryRun and Execute methods) with the --type=whiteboard flag
and assert the outgoing request path equals
/open-apis/whiteboard/v1/whiteboards/{token}/download_as_image (verify both
branch behaviors), and include assertions for both DryRun and Execute code paths
to ensure the new branch is exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72213397-3725-49d7-b8d3-a965a5540a65

📥 Commits

Reviewing files that changed from the base of the PR and between 4db118a and 28b0ac9.

📒 Files selected for processing (13)
  • cmd/auth/login_test.go
  • events/register.go
  • events/whiteboard/native.go
  • events/whiteboard/preconsume.go
  • events/whiteboard/preconsume_test.go
  • events/whiteboard/register.go
  • shortcuts/doc/doc_media_download.go
  • shortcuts/whiteboard/whiteboard_query.go
  • shortcuts/whiteboard/whiteboard_query_test.go
  • shortcuts/whiteboard/whiteboard_update.go
  • shortcuts/whiteboard/whiteboard_update_test.go
  • skills/lark-event/SKILL.md
  • skills/lark-event/references/lark-event-whiteboard.md
✅ Files skipped from review due to trivial changes (3)
  • skills/lark-event/SKILL.md
  • shortcuts/whiteboard/whiteboard_update_test.go
  • skills/lark-event/references/lark-event-whiteboard.md
🚧 Files skipped from review as they are similar to previous changes (9)
  • events/whiteboard/native.go
  • events/register.go
  • events/whiteboard/register.go
  • events/whiteboard/preconsume.go
  • shortcuts/whiteboard/whiteboard_query_test.go
  • events/whiteboard/preconsume_test.go
  • shortcuts/whiteboard/whiteboard_update.go
  • shortcuts/whiteboard/whiteboard_query.go
  • cmd/auth/login_test.go

@github-actions github-actions Bot added size/M Single-domain feat or fix with limited business impact and removed domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths labels Jun 4, 2026
@qinxiaoyun
qinxiaoyun force-pushed the feat/board-whiteboard-updated-preconsume branch 4 times, most recently from 4aa2dd5 to 3c951fc Compare June 5, 2026 03:42
@qinxiaoyun qinxiaoyun changed the title feat(board): subscribe board.whiteboard.updated_v1 feat(events): subscribe board.whiteboard.updated_v1 Jun 5, 2026
@qinxiaoyun
qinxiaoyun force-pushed the feat/board-whiteboard-updated-preconsume branch from 3c951fc to f03fa17 Compare June 5, 2026 03:45
Wire the board.whiteboard.updated_v1 EventKey into the consume pipeline so that lark-cli event consume automatically calls the per-whiteboard subscribe / unsubscribe OAPIs instead of requiring callers to manage server-side subscriptions out-of-band.

Change-Id: I94323807e8dc649d3296f6922311d2acaf92284e
@qinxiaoyun
qinxiaoyun force-pushed the feat/board-whiteboard-updated-preconsume branch from f03fa17 to 74aaad8 Compare June 5, 2026 06:04

@syh-cpdsss syh-cpdsss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@qinxiaoyun
qinxiaoyun merged commit 37b17f3 into main Jun 5, 2026
20 of 21 checks passed
@qinxiaoyun
qinxiaoyun deleted the feat/board-whiteboard-updated-preconsume branch June 5, 2026 09:09
tuxedomm pushed a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
…larksuite#1265)

Wire the board.whiteboard.updated_v1 EventKey into the consume pipeline so that lark-cli event consume automatically calls the per-whiteboard subscribe / unsubscribe OAPIs instead of requiring callers to manage server-side subscriptions out-of-band.

Change-Id: I94323807e8dc649d3296f6922311d2acaf92284e
SunPeiYang996 pushed a commit that referenced this pull request Jun 8, 2026
…#1265)

Wire the board.whiteboard.updated_v1 EventKey into the consume pipeline so that lark-cli event consume automatically calls the per-whiteboard subscribe / unsubscribe OAPIs instead of requiring callers to manage server-side subscriptions out-of-band.

Change-Id: I94323807e8dc649d3296f6922311d2acaf92284e
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.

3 participants