Skip to content

Conversation

@XinxinAkuma
Copy link
Contributor

@XinxinAkuma XinxinAkuma commented Sep 23, 2025

Summary by CodeRabbit

  • 新功能
    • 创建招聘群聊的响应新增“添加失败成员ID列表”,便于快速定位失败原因并进行二次处理。
    • 变更向后兼容,不影响现有成功流程与接口调用方式。

@coderabbitai
Copy link

coderabbitai bot commented Sep 23, 2025

Walkthrough

consultingapis/dingtalk/v1/dingtalk.proto 中,为消息 CreateRecruitChatGroupResponse 新增字符串字段 failed_member_ids(tag: 4),用于返回创建招聘群时添加成员失败的成员标识。

Changes

Cohort / File(s) Summary
Proto: DingTalk v1
consultingapis/dingtalk/v1/dingtalk.proto
在消息 CreateRecruitChatGroupResponse 中新增字段:string failed_member_ids = 4

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client as Client
    participant Service as Recruit Service
    participant DingTalk as DingTalk API

    Client->>Service: CreateRecruitChatGroup(request: member_ids, ...)
    Service->>DingTalk: Create chat group + add members
    alt 部分成员添加失败
        DingTalk-->>Service: result + failed list
        Service-->>Client: CreateRecruitChatGroupResponse<br/>(..., failed_member_ids)
    else 全部成功
        DingTalk-->>Service: result (no failures)
        Service-->>Client: CreateRecruitChatGroupResponse<br/>(..., failed_member_ids="")
    end

    note over Client,Service: 新增响应字段 failed_member_ids(tag 4)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

小兔敲键把原型改,
回应多带失败名单来。
群组创建风不碍,
失败成员一目载。
耳朵一竖提交快,🥕
调试轻松心澎湃。

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed 标题 "feat: add failed_member_ids" 简洁明确地反映了主要变更:在 consultingapis/dingtalk/v1/dingtalk.proto 的 CreateRecruitChatGroupResponse 中新增 failed_member_ids 字段,使用常见的 feat 前缀且便于审阅与历史检索。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-ids

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.

@whxxxxxxxxxx whxxxxxxxxxx merged commit 0e530db into main Sep 23, 2025
0 of 2 checks passed
Copy link

@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

🧹 Nitpick comments (1)
consultingapis/dingtalk/v1/dingtalk.proto (1)

151-156: 可选:若需返回失败原因,补充结构化原因映射

若需要同时告知失败原因,建议新增结构化字段,避免日志/字符串拼接。

示例一(轻量):

 message CreateRecruitChatGroupResponse{
   string chat_id = 1;
   string openConversationId = 2;
   string invite_url = 3;
   repeated string failed_member_ids = 4;
+  map<string, string> failed_member_reasons = 5; // key: member_id, value: 失败原因
 }

示例二(更可拓展):

message FailedMember {
  string id = 1;
  string reason = 2;
}
message CreateRecruitChatGroupResponse{
  string chat_id = 1;
  string openConversationId = 2;
  string invite_url = 3;
  repeated string failed_member_ids = 4;
  repeated FailedMember failed_members = 5;
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 780aad3 and 8acdd2e.

📒 Files selected for processing (1)
  • consultingapis/dingtalk/v1/dingtalk.proto (1 hunks)

string chat_id = 1;
string openConversationId = 2;
string invite_url = 3;
string failed_member_ids = 4;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

🧩 Analysis chain

将 failed_member_ids 改为 repeated 字段,避免非结构化返回

该字段语义是“多个失败成员 ID”。用 string 会迫使客户端自行解析(逗号分隔/JSON 等),且与请求体里 Body.member_idrepeated string 不对称。建议直接返回列表,便于多语言 SDK 生成强类型集合。

应用如下变更:

-message CreateRecruitChatGroupResponse{
+message CreateRecruitChatGroupResponse{
   string chat_id = 1;
   string openConversationId = 2;
   string invite_url = 3;
-  string failed_member_ids = 4;
+  repeated string failed_member_ids = 4; // 添加失败的成员ID列表
 }

请在本仓库跑一遍代码生成并检索调用点,确认下游未假定为字符串:


🏁 Script executed:

#!/bin/bash
# 验证响应结构体/字段的使用点(Go/TS/Java 常见后缀做个基本覆盖)
rg -n -C2 'CreateRecruitChatGroupResponse|failed_member_ids' -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'

Length of output: 148


重新运行更全面的搜索并打印相关 proto 片段:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "工作目录: $(pwd)"
echo "---- 全库搜索 CreateRecruitChatGroupResponse / failed_member_ids ----"
rg -n -S --hidden --no-ignore-vcs 'CreateRecruitChatGroupResponse|failed_member_ids|failedMemberIds|FailedMemberIds' || true

echo "---- 打印 consultingapis/dingtalk/v1/dingtalk.proto(如存在,前 240 行) ----"
if [ -f consultingapis/dingtalk/v1/dingtalk.proto ]; then
  sed -n '1,240p' consultingapis/dingtalk/v1/dingtalk.proto || true
else
  echo "文件 consultingapis/dingtalk/v1/dingtalk.proto 未找到"
fi

echo "---- 在所有 .proto 中查找消息定义 ----"
rg -n --hidden --no-ignore-vcs 'message CreateRecruitChatGroupResponse' -g '**/*.proto' || true

echo "---- 在常见生成文件中查找字段用法(.pb.go, .ts, .java, .js) ----"
rg -n --hidden --no-ignore-vcs 'CreateRecruitChatGroupResponse|failed_member_ids|failedMemberIds|FailedMemberIds' -g '**/*.pb.go' -g '**/*.ts' -g '**/*.js' -g '**/*.java' || true

Length of output: 9098


将 failed_member_ids 改为 repeated string 并同步更新生成产物

理由:字段语义为“多个失败成员 ID”,应与请求体 Body.member_id (repeated string) 对齐,避免客户端自行解析。

仓库检索结果:该字段目前只出现在 consultingapis/dingtalk/v1/dingtalk.proto(当前为 string)及生成产物 consultingapis/dingtalk/v1/dingtalk.pb.go、consultingapis/dingtalk/v1/dingtalk_grpc.pb.go、docs/swagger/consultingapis/dingtalk/v1/dingtalk.swagger.json,未发现其他业务代码直接依赖字符串格式。风险在于必须同步重新生成产物并提交。

操作(必做):

  • 修改 proto(见下 diff)。
  • 重新运行 protoc / 生成脚本,提交更新的 .pb.go、_grpc.pb.go 与 swagger/json,并在修改后再次全库搜索与编译/测试确认无破坏。
-message CreateRecruitChatGroupResponse{
+message CreateRecruitChatGroupResponse{
   string chat_id = 1;
   string openConversationId = 2;
   string invite_url = 3;
-  string failed_member_ids = 4;
+  repeated string failed_member_ids = 4; // 添加失败的成员ID列表
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
string failed_member_ids = 4;
message CreateRecruitChatGroupResponse{
string chat_id = 1;
string openConversationId = 2;
string invite_url = 3;
repeated string failed_member_ids = 4; // 添加失败的成员ID列表
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants