Skip to content

fix(im): reject non-opus audio messages - #1271

Merged
YangJunzhou-01 merged 1 commit into
larksuite:mainfrom
chenxingtong-bytedance:fix/audio_message_only_opus
Jun 24, 2026
Merged

fix(im): reject non-opus audio messages#1271
YangJunzhou-01 merged 1 commit into
larksuite:mainfrom
chenxingtong-bytedance:fix/audio_message_only_opus

Conversation

@chenxingtong-bytedance

@chenxingtong-bytedance chenxingtong-bytedance commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix IM shortcut behavior for audio messages to match the Feishu/Lark file upload API: --audio is for voice messages and supports only Opus audio. Non-Opus local/URL inputs such as mp3 and wav are now rejected before upload with an actionable typed validation error. Users can still send those files as attachments with --file.

Changes

  • Add --audio validation for im +messages-send and im +messages-reply.
  • Allow .opus and Ogg Opus .ogg inputs for audio messages.
  • Reject non-Opus audio such as .mp3 / .wav with param=--audio and recovery guidance.
  • Clarify --audio help text and IM skill docs, including the --file fallback path.
  • Add unit coverage and dry-run E2E coverage for the validation behavior.

Related Issues

Test Plan

  • go test ./shortcuts/im
  • go test ./tests/cli_e2e/im -run TestIM_MessagesSendAudioDryRunRejectsNonOpus -count=1
  • make build
  • Manual verification with the built binary:
    • normal file message sends successfully
    • mp3 file sends successfully via --file
    • Opus voice message sends successfully via --audio
    • mp3 voice message via --audio is blocked before upload with typed validation and recovery guidance

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds an "Audio Messages" section to the Lark IM skill guide, stating that --audio supports only Opus-format files for sending and replying with audio messages.

Changes

Audio Messages documentation

Layer / File(s) Summary
Audio Messages section
skills/lark-im/SKILL.md
Adds an "Audio Messages" subsection that limits --audio to Opus-format files for send and reply operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • haozhenghua-code
  • liangshuo-1

Poem

🐰 I found a note in skillful trails,
Where audio hops with Opus tales.
.opus and .ogg now softly sing,
A tiny doc change with a tidy spring.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'fix(im): reject non-opus audio messages' is misleading - the changeset only adds documentation clarifying Opus audio requirements, with no runtime behavior changes to reject non-Opus files. Update the title to reflect the actual change: 'docs(im): clarify audio message opus requirement' or similar, as this is a documentation-only update with no code-level rejection logic.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 description follows the required template with Summary, Changes, Related Issues, and Test Plan, and clearly explains scope and verification.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 domain/im PR touches the im domain size/M Single-domain feat or fix with limited business impact labels Jun 4, 2026

@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 `@skills/lark-im/SKILL.md`:
- Line 60: Update the `--audio` flag documentation to state that it accepts
Opus-format files and explicitly list supported extensions by name (e.g.,
".opus" and ".ogg") to match runtime behavior; reference the `--audio` flag text
in SKILL.md and replace the sentence "only Opus-format files" with a clarified
line like "Opus-format files (e.g., .opus and .ogg) are supported" so users know
.ogg is mapped to Opus at runtime.
🪄 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: ff3f36db-a871-4396-8e06-7357f0c2e183

📥 Commits

Reviewing files that changed from the base of the PR and between ac116e7 and 7cfb2b5.

📒 Files selected for processing (1)
  • skills/lark-im/SKILL.md

Comment thread skills/lark-im/SKILL.md Outdated
@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@55706cea70181d765b37c3a8e5d5f347a45d694f

🧩 Skill update

npx skills add chenxingtong-bytedance/cli#fix/audio_message_only_opus -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.18%. Comparing base (abc0553) to head (7cfb2b5).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1271      +/-   ##
==========================================
+ Coverage   69.84%   70.18%   +0.33%     
==========================================
  Files         666      671       +5     
  Lines       64451    65240     +789     
==========================================
+ Hits        45019    45786     +767     
+ Misses      15812    15783      -29     
- Partials     3620     3671      +51     

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

@chenxingtong-bytedance
chenxingtong-bytedance force-pushed the fix/audio_message_only_opus branch from 7cfb2b5 to 4416f80 Compare June 4, 2026 13:33
@chenxingtong-bytedance
chenxingtong-bytedance force-pushed the fix/audio_message_only_opus branch from 4416f80 to ca7297a Compare June 12, 2026 09:30
@chenxingtong-bytedance
chenxingtong-bytedance force-pushed the fix/audio_message_only_opus branch 3 times, most recently from 92cb705 to 8faed2d Compare June 23, 2026 07:59
@chenxingtong-bytedance chenxingtong-bytedance changed the title docs(im): clarify audio message opus requirement fix(im): reject non-opus audio messages Jun 23, 2026
@chenxingtong-bytedance
chenxingtong-bytedance force-pushed the fix/audio_message_only_opus branch 2 times, most recently from 42538be to 9accbd7 Compare June 23, 2026 08:37
Change-Id: I48efb309b6222b16f39f18bbb8be039d06c0087c
@chenxingtong-bytedance
chenxingtong-bytedance force-pushed the fix/audio_message_only_opus branch from 9accbd7 to 55706ce Compare June 23, 2026 08:44

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

LGTM

@YangJunzhou-01
YangJunzhou-01 merged commit d71bab0 into larksuite:main Jun 24, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/im PR touches the im domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] lark-cli 7.28: --audio flag fails with error 230055 for mp3 files

3 participants