基线 origin/main 0c9b459。后台 createAdmin 会在写事务里对群主做 endpointCheckTx,不存在或已停用会失败。客户端 Create 在 Queue.Do 里直接 insertMemberTx(tx, gid, actorID, now),不检查创建者。group.create 的上行入口也不先查 enabled。
origin/main
0c9b459
createAdmin
endpointCheckTx
Create
Queue.Do
insertMemberTx(tx, gid, actorID, now)
group.create
enabled
对话密码校验在事务外。这段时间里管理端可以先停用或删除该编号。写队列串行之后,Create 仍会插入 owner_id 为已停用甚至刚删除的编号,并写入 group_members。迁移 0003 只约束 group_id → groups(id),没有 endpoint_id → endpoints。已停用群主发不了消息,但群还在,改名、加人、解散仍认这个群主。编号以后若复用,可能撞上旧成员行。
owner_id
group_members
0003
group_id → groups(id)
endpoint_id → endpoints
加人目标已经在事务内复核,创建者这条漏了。
internal/app/group/app.go
在 Create 的同一事务里,插入群和群主成员之前,对 actorID 做与 createAdmin 相同的 endpointCheckTx。已停用返回 endpoint_disabled,不存在返回 invalid_target,并且不要插入群。不要改 emit,不要改迁移编号。
actorID
endpoint_disabled
invalid_target
emit
补测试:创建者在进入写事务前被停用或删除时,Create 失败且 groups 里没有新行。
groups
只改 internal/app/group/ 与其测试。偏差节 ### 复审修复 R3-07。
internal/app/group/
### 复审修复 R3-07
已在分支 feat/fix-r3-71-group-create 修复(基线 origin/main @ 0c9b459,HEAD b6f3baf)。
feat/fix-r3-71-group-create
b6f3baf
改动
docs/DEVIATIONS.md
验证:go test ./internal/app/group/ -count=1 通过。 推送:已推 feat/fix-r3-71-group-create,未合 main。
go test ./internal/app/group/ -count=1
已合入 main:f936a6b (#71);当前 origin/main HEAD 2d1dfd7。
f936a6b
2d1dfd7
No dependencies set.
The note is not visible to the blocked user.
现象
基线
origin/main0c9b459。后台createAdmin会在写事务里对群主做endpointCheckTx,不存在或已停用会失败。客户端Create在Queue.Do里直接insertMemberTx(tx, gid, actorID, now),不检查创建者。group.create的上行入口也不先查enabled。对话密码校验在事务外。这段时间里管理端可以先停用或删除该编号。写队列串行之后,
Create仍会插入owner_id为已停用甚至刚删除的编号,并写入group_members。迁移0003只约束group_id → groups(id),没有endpoint_id → endpoints。已停用群主发不了消息,但群还在,改名、加人、解散仍认这个群主。编号以后若复用,可能撞上旧成员行。加人目标已经在事务内复核,创建者这条漏了。
位置
internal/app/group/app.go:Create的Queue.DocreateAdmin的endpointCheckTx方案
在
Create的同一事务里,插入群和群主成员之前,对actorID做与createAdmin相同的endpointCheckTx。已停用返回endpoint_disabled,不存在返回invalid_target,并且不要插入群。不要改emit,不要改迁移编号。补测试:创建者在进入写事务前被停用或删除时,
Create失败且groups里没有新行。约束
只改
internal/app/group/与其测试。偏差节### 复审修复 R3-07。已在分支
feat/fix-r3-71-group-create修复(基线origin/main@0c9b459,HEADb6f3baf)。改动
internal/app/group/app.go:Create的写事务内、插入群与群主成员前,对actorID做与createAdmin相同的endpointCheckTx;已停用endpoint_disabled,不存在invalid_target,且不插入群。Create失败且groups无新行。docs/DEVIATIONS.md追加### 复审修复 R3-07。验证:
go test ./internal/app/group/ -count=1通过。推送:已推
feat/fix-r3-71-group-create,未合 main。已合入 main:
f936a6b(#71);当前 origin/main HEAD2d1dfd7。