Skip to content

feat: support speaker list and nolark speaker replace - #1594

Merged
zhangjun-bytedance merged 1 commit into
mainfrom
feat/speaker_support_nolark
Jun 26, 2026
Merged

feat: support speaker list and nolark speaker replace#1594
zhangjun-bytedance merged 1 commit into
mainfrom
feat/speaker_support_nolark

Conversation

@zhangjun-bytedance

@zhangjun-bytedance zhangjun-bytedance commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • minutes +speaker-replace now uses --from-speaker-id as the primary source-speaker input, including speakerlist-based name resolution.
    • Dry-run reflects the resolved source speaker details (including from_speaker_input when applicable).
  • Bug Fixes

    • Improved validation and error/hint messaging for missing, duplicate, or invalid source speakers, updated to reference --from-speaker-id.
  • Documentation

    • Updated minutes skill and reference docs to use the speakerlist-first workflow and --from-speaker-id.
  • Tests

    • Added unit and CLI e2e coverage for --from-speaker-id resolution and output.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e4b4fa2f-de06-49d3-a5b0-38fde76802fd

📥 Commits

Reviewing files that changed from the base of the PR and between ea316b5 and 0c906f9.

📒 Files selected for processing (8)
  • shortcuts/minutes/minutes_speaker_replace.go
  • shortcuts/minutes/minutes_speaker_replace_test.go
  • shortcuts/minutes/minutes_speakers.go
  • shortcuts/minutes/minutes_speakers_test.go
  • skills/lark-minutes/SKILL.md
  • skills/lark-minutes/references/lark-minutes-speaker-replace.md
  • tests/cli_e2e/minutes/minutes_speaker_replace_test.go
  • tests/cli_e2e/sheets/sheets_table_put_typed_workflow_test.go
✅ Files skipped from review due to trivial changes (1)
  • skills/lark-minutes/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • shortcuts/minutes/minutes_speakers_test.go
  • tests/cli_e2e/minutes/minutes_speaker_replace_test.go
  • shortcuts/minutes/minutes_speakers.go
  • shortcuts/minutes/minutes_speaker_replace_test.go
  • shortcuts/minutes/minutes_speaker_replace.go

📝 Walkthrough

Walkthrough

minutes +speaker-replace now resolves the source speaker from --from-speaker-id or legacy --from-user-id, fetches transcript speaker lists when needed, updates request payloads and error messages, and refreshes related tests and skill documentation.

Changes

Minutes speaker replacement

Layer / File(s) Summary
Command contract and validation
shortcuts/minutes/minutes_speaker_replace.go, shortcuts/minutes/minutes_speaker_replace_test.go
The shortcut scopes, flags, and empty-input validation switch to --from-speaker-id, while the validation and hint tests update the expected error text.
Speaker resolution helpers
shortcuts/minutes/minutes_speakers.go, shortcuts/minutes/minutes_speakers_test.go
A speaker-list fetcher, exact-name resolver, direct speaker_id matcher, and from-value resolver are added with unit coverage for unique, missing, and duplicate names.
Replace execution and payloads
shortcuts/minutes/minutes_speaker_replace.go, shortcuts/minutes/minutes_speaker_replace_test.go, tests/cli_e2e/minutes/minutes_speaker_replace_test.go
The command resolves the source speaker before the PUT request, sends user_id_type: "open_id", updates the not-found message, and extends dry-run, execute, and e2e tests for from_speaker_id and speaker-list lookup.
Skill guidance updates
skills/lark-minutes/SKILL.md, skills/lark-minutes/references/lark-minutes-speaker-replace.md
The speaker-replace docs now describe the speakerlist-first workflow, --from-speaker-id, the legacy fallback flag, required scopes, and the updated output fields.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • larksuite/cli#1036: This earlier PR changed the same minutes +speaker-replace path and speaker-identifier handling, so the implementation and test updates are directly related.

Suggested labels

domain/vc

Suggested reviewers

  • zhaoleibd
  • hugang-lark

Poem

I hopped through speaker lists at dawn,
and found the right ids before the yawn.
speaker_id twitched beneath the dew,
then open_id made the PUT sail through.
🐰 Hop, hop—minutes sing anew!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only the untouched template and lacks actual summary, changes, test plan, and issue details. Replace the template placeholders with a real Summary, Changes, Test Plan, and Related Issues section filled with PR-specific details.
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change set around speaker list support and speaker replacement.
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.
✨ 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/speaker_support_nolark

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 markdownlint-cli2 (0.22.1)
skills/lark-minutes/SKILL.md

markdownlint-cli2 wrapper config was not available before execution

skills/lark-minutes/references/lark-minutes-speaker-replace.md

markdownlint-cli2 wrapper config was not available before execution


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.

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

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@0c906f958fc98049071ebbe51a1e8735c3f4e90a

🧩 Skill update

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

Caution

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

⚠️ Outside diff range comments (1)
skills/lark-minutes/SKILL.md (1)

220-220: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Stale description contradicts new speaker-id workflow.

Line 220 still reads "了解参数和限制(仅支持用户 ID,不支持姓名)" which is outdated. The new workflow uses --from-speaker-id with speaker_id (not user ID), and the restriction is about display names vs. speaker IDs, not user IDs vs. names. Update to reflect the current parameter model.

🤖 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-minutes/SKILL.md` at line 220, Update the `+speaker-replace`
documentation in `SKILL.md` to match the current speaker-id workflow. The stale
note about “仅支持用户 ID,不支持姓名” is outdated; revise it to reference the
`--from-speaker-id` / `speaker_id` model and clarify the actual restriction is
about display names versus speaker IDs. Keep the instruction aligned with the
existing `+speaker-replace` guidance and
`references/lark-minutes-speaker-replace.md`.
🧹 Nitpick comments (1)
skills/lark-minutes/references/lark-minutes-speaker-replace.md (1)

92-103: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider documenting the conditional from_speaker_input output field.

When --from-speaker-id is a display name that gets resolved to a speaker_id, the output also includes from_speaker_input showing the original input. This is helpful for debugging resolution. Consider adding it to the output table with a note that it appears only when resolution occurred.

🤖 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-minutes/references/lark-minutes-speaker-replace.md` around lines
92 - 103, Add the conditional `from_speaker_input` field to the output table in
the `lark-minutes-speaker-replace` reference, alongside `minute_token`,
`from_speaker_id`, and `to_user_id`. Document that `from_speaker_input`
preserves the original `--from-speaker-id` value and is only present when the
input was resolved from a display name to a `speaker_id`, so readers can
understand when and why it appears.
🤖 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 `@shortcuts/minutes/minutes_speaker_replace_test.go`:
- Around line 35-38: The missing-from-speaker test expectation is stale because
MinutesSpeakerReplace.Validate now returns a typed validation error instead of
the old “required flag(s) ...” text. Update the test in MinutesSpeakerReplace
test cases to assert the typed error via errors.As into the validation error
type and verify the Param field is "--from-speaker-id", rather than matching the
malformed substring. Use the existing MinutesSpeakerReplace.Validate path and
keep the assertion on the error metadata, since errs.ProblemOf does not expose
Param.

In `@shortcuts/minutes/minutes_speaker_replace.go`:
- Around line 33-34: The flag help for minutes speaker replacement is out of
sync with the actual lookup behavior: `from-speaker-id` currently resolves both
opaque speaker IDs and display names through the speaker list, so the
description should be updated to match what `Run` and the new
resolution/not-found path actually accept. Change the help text in
`minutes_speaker_replace.go` so `--from-speaker-id` is described as preferring
an opaque `speaker_id` but also allowing a display name to be resolved, and keep
`from-user-id` clearly marked as deprecated.

In `@shortcuts/minutes/minutes_speakers_test.go`:
- Around line 26-44: The speaker-resolution test is missing an assertion for the
typed validation metadata on both error paths. Update minutes_speakers_test.go
in the resolveSpeakerIDByName test cases to verify the unwrapped
*errs.ValidationError from errors.As has Param set to "--from-speaker-id" for
both the not-found and duplicate-name branches, alongside the existing subtype
and hint checks.

In `@shortcuts/minutes/minutes_speakers.go`:
- Around line 96-103: `resolveSpeakerReplaceFrom()` is still prioritizing the
deprecated `from-user-id` flag over `from-speaker-id`, which makes `Execute`
diverge from `Validate` and `buildSpeakerReplaceRequestBodyResolved()`. Update
the fallback logic so the new `from-speaker-id` takes precedence when both are
set, and only fall back to `from-user-id` when the new flag is absent. Keep the
behavior consistent with the speaker replacement flow in `minutes_speakers.go`
and the request-building code in `minutes_speaker_replace.go`.

---

Outside diff comments:
In `@skills/lark-minutes/SKILL.md`:
- Line 220: Update the `+speaker-replace` documentation in `SKILL.md` to match
the current speaker-id workflow. The stale note about “仅支持用户 ID,不支持姓名” is
outdated; revise it to reference the `--from-speaker-id` / `speaker_id` model
and clarify the actual restriction is about display names versus speaker IDs.
Keep the instruction aligned with the existing `+speaker-replace` guidance and
`references/lark-minutes-speaker-replace.md`.

---

Nitpick comments:
In `@skills/lark-minutes/references/lark-minutes-speaker-replace.md`:
- Around line 92-103: Add the conditional `from_speaker_input` field to the
output table in the `lark-minutes-speaker-replace` reference, alongside
`minute_token`, `from_speaker_id`, and `to_user_id`. Document that
`from_speaker_input` preserves the original `--from-speaker-id` value and is
only present when the input was resolved from a display name to a `speaker_id`,
so readers can understand when and why it appears.
🪄 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: 7cc25fea-8c77-41b5-8564-2a922bad83c1

📥 Commits

Reviewing files that changed from the base of the PR and between 40a09c8 and 7122a76.

📒 Files selected for processing (7)
  • shortcuts/minutes/minutes_speaker_replace.go
  • shortcuts/minutes/minutes_speaker_replace_test.go
  • shortcuts/minutes/minutes_speakers.go
  • shortcuts/minutes/minutes_speakers_test.go
  • skills/lark-minutes/SKILL.md
  • skills/lark-minutes/references/lark-minutes-speaker-replace.md
  • tests/cli_e2e/minutes/minutes_speaker_replace_test.go

Comment thread shortcuts/minutes/minutes_speaker_replace_test.go
Comment thread shortcuts/minutes/minutes_speaker_replace.go
Comment thread shortcuts/minutes/minutes_speakers_test.go
Comment thread shortcuts/minutes/minutes_speakers.go
@zhangjun-bytedance
zhangjun-bytedance force-pushed the feat/speaker_support_nolark branch from 7122a76 to ea316b5 Compare June 26, 2026 03:10

@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

Caution

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

⚠️ Outside diff range comments (1)
shortcuts/minutes/minutes_speaker_replace.go (1)

45-64: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject ambiguous source flags before executing the write.

When both --from-speaker-id and deprecated --from-user-id are provided, validation passes and later code silently prefers from_speaker_id. For a transcript-mutating command, require exactly one source identifier so users do not replace the wrong speaker by accident.

Proposed fix
 		fromSpeakerID := strings.TrimSpace(runtime.Str("from-speaker-id"))
 		fromUserID := strings.TrimSpace(runtime.Str("from-user-id"))
 		if fromSpeakerID == "" && fromUserID == "" {
 			return errs.NewValidationError(errs.SubtypeInvalidArgument, "--from-speaker-id is required").WithParam("--from-speaker-id")
 		}
+		if fromSpeakerID != "" && fromUserID != "" {
+			return errs.NewValidationError(errs.SubtypeInvalidArgument, "--from-speaker-id and --from-user-id cannot be used together").
+				WithParam("--from-user-id").
+				WithHint("Remove deprecated --from-user-id when --from-speaker-id is provided.")
+		}
🤖 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/minutes/minutes_speaker_replace.go` around lines 45 - 64, The
MinutesSpeakerReplace command currently accepts both source flags and then
silently prefers fromSpeakerID over fromUserID, which can cause the wrong
speaker to be replaced. Update the validation in the command flow that reads
runtime.Str for --from-speaker-id and --from-user-id so exactly one source
identifier is allowed before any write path runs, and return a validation error
when both are set or when neither is set. Keep the existing
common.ValidateUserIDTyped checks in the same MinutesSpeakerReplace logic, but
apply them only after the source flag ambiguity is rejected.
🤖 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 `@shortcuts/minutes/minutes_speaker_replace.go`:
- Around line 67-75: In minutes_speaker_replace.go, the DryRun path in the
minute speaker replace command is leaking the raw display name into the planned
PUT body via buildSpeakerReplaceRequestBody, while Execute resolves it first.
Update the DryRunAPI flow so the resolved-id case is represented with a
placeholder or resolved-id value instead of the original display name, keeping
the GET lookup from minuteTranscriptSpeakerlistPath as the source of resolution
and ensuring the PUT preview matches what Execute will actually send.

---

Outside diff comments:
In `@shortcuts/minutes/minutes_speaker_replace.go`:
- Around line 45-64: The MinutesSpeakerReplace command currently accepts both
source flags and then silently prefers fromSpeakerID over fromUserID, which can
cause the wrong speaker to be replaced. Update the validation in the command
flow that reads runtime.Str for --from-speaker-id and --from-user-id so exactly
one source identifier is allowed before any write path runs, and return a
validation error when both are set or when neither is set. Keep the existing
common.ValidateUserIDTyped checks in the same MinutesSpeakerReplace logic, but
apply them only after the source flag ambiguity is rejected.
🪄 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: c07f6df9-1870-48d2-bd85-8dd9ba8a5334

📥 Commits

Reviewing files that changed from the base of the PR and between 7122a76 and ea316b5.

📒 Files selected for processing (7)
  • shortcuts/minutes/minutes_speaker_replace.go
  • shortcuts/minutes/minutes_speaker_replace_test.go
  • shortcuts/minutes/minutes_speakers.go
  • shortcuts/minutes/minutes_speakers_test.go
  • skills/lark-minutes/SKILL.md
  • skills/lark-minutes/references/lark-minutes-speaker-replace.md
  • tests/cli_e2e/minutes/minutes_speaker_replace_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • shortcuts/minutes/minutes_speakers_test.go
  • shortcuts/minutes/minutes_speakers.go
  • tests/cli_e2e/minutes/minutes_speaker_replace_test.go
  • skills/lark-minutes/SKILL.md
  • shortcuts/minutes/minutes_speaker_replace_test.go

Comment thread shortcuts/minutes/minutes_speaker_replace.go
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.78378% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.75%. Comparing base (40a09c8) to head (0c906f9).

Files with missing lines Patch % Lines
shortcuts/minutes/minutes_speakers.go 78.94% 6 Missing and 6 partials ⚠️
shortcuts/minutes/minutes_speaker_replace.go 88.88% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1594   +/-   ##
=======================================
  Coverage   74.74%   74.75%           
=======================================
  Files         799      800    +1     
  Lines       80380    80459   +79     
=======================================
+ Hits        60084    60147   +63     
- Misses      15849    15857    +8     
- Partials     4447     4455    +8     

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

@zhangjun-bytedance
zhangjun-bytedance force-pushed the feat/speaker_support_nolark branch from ea316b5 to 0c906f9 Compare June 26, 2026 03:26
@zhangjun-bytedance
zhangjun-bytedance merged commit ba51d48 into main Jun 26, 2026
38 checks passed
@zhangjun-bytedance
zhangjun-bytedance deleted the feat/speaker_support_nolark branch June 26, 2026 03:41
@coderabbitai coderabbitai Bot mentioned this pull request Jul 3, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants