Done
Labels
enhancementNew feature or request
Description
背景
PR #289 实测 453 个用例全绿(framework 430 / infra 6 / api 2 / starter 8 / example 7),数量真实。但改了逻辑却没有用例的位置有 8 类,其中若干是最容易回归的复合键与权限判定。
缺口清单(按风险排序)
$bind.getOperatorByIdentity(userId, identity):提交78591083新增的脚本能力,零测试;FlowRevokeService/FlowUrgeService/FlowSubProcessResetService的身份归属校验(三处逻辑都改了,无用例);AddAuditAction同人异身份查重、ReduceAuditAction减签的身份维度(复合键改动,最易回归);- 转交
forwardOperatorIdentity/ 委托 / 干预interferedOperatorIdentity落库(现有 P1 用例只断言了默认空串); FlowContent.loadCurrentNodeOperators多身份(当前实现有缺陷,见衍生 issue,补用例正好暴露);- Mock 查询链路身份隔离(见衍生 issue);
BaseAuditNode同人自动通过的身份过滤;FlowOperatorGateway.findByIds批量取人的身份维度(见衍生 issue)。
期望
- 每条缺口至少 1 个用例,遵循项目测试规范(目标 / 前置 / 步骤 / 断言明确,结果确定);
- 优先覆盖「复合键 + 权限判定」类,即第 2、3、5、7 项;
- 用例命名与现有风格一致(
should_xxx_when_yyy)。
验收标准
- 8 类缺口均有对应用例(或明确在 issue 中标注降级原因);
-
./mvnw test全绿,用例总数在 PR 中更新; - 不引入对时间、随机、外部网络的依赖。
关联
- 上游:用户多身份的流程参与能力 #288
- 代码:PR feat: 操作者身份标识(issue #288 P1+P2+P3) #289 / 分支
feature/issue-288-operator-identity
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
fix(identity): 补齐 issue #288 代码评审发现的偏离与测试缺口
xlorne commentedon Nov 23, 2026
单元测试缺口补齐(本轮 +25 个用例,总计 478)
新增用例明细
FlowCurrentNodeOperatorsIdentityTestOperatorIdentityValidationTestOperatorIdentityGuardTestGroovyScriptBindIdentityTest$bind.getOperatorByIdentity(P3 零测试)、默认身份兼容、两身份隔离FlowOperatorBulkIdentityTestFlowRecordQueryMockIdentityTestFlowOperatorIdentityRecordTestclearNotify清理转交身份验证:
./mvnw -o clean install全量通过,7 模块 SUCCESS,478 用例 0 失败 0 跳过(framework 455 / infra 6 / api 2 / starter 8 / example 7)。仍未覆盖(保留本 issue 继续跟踪,未在本轮范围内):撤销 / 催办 / 子流程重置的身份归属校验、加签同人异身份查重与减签身份维度、转交 / 委托 / 干预身份落库、
BaseAuditNode同人自动通过的身份过滤、currentNodeOperators跨多人员混合场景。这些路径在 P2/P3 已有代码改动但尚无针对性断言,建议下一轮补齐。交付信息
codingapi/flow-enginefeature/issue-288-operator-identity(已 fast-forward 合并并推送)9af745fc3fa5cc36f4213b29156149eb31bc1e92./mvnw -o clean install:7 模块 SUCCESS,478 个用例 0 失败 0 跳过(原 453,新增 25)本 issue 暂保持 open:修复随 PR #289 一并交付,未合入默认分支不会自动关闭,待确认后再关闭。
xlorne commentedon Dec 2, 2026
代码已在
dev,这里同步一次逐项核对结果(保持开启,仍有 4 类缺口)。已覆盖(可勾掉)
$bind.getOperatorByIdentityGroovyScriptBindIdentityTestFlowContent多身份去重/排除FlowCurrentNodeOperatorsIdentityTestFlowRecordQueryMockIdentityTestFlowOperatorBulkIdentityTest补充:
FlowOperatorIdentityRecordTest覆盖了创建人/审批人身份落库与clearNotify转交身份清零;OperatorIdentityGuardTest覆盖降级告警;OperatorIdentityPermissionTest/OperatorIdentityUserOnlyPermissionTest覆盖 STRICT / USER_ONLY 两种模式下的审批与删除拒绝。仍缺口
FlowRevokeServiceTest、FlowSubProcessEnhancementServiceTest均无身份断言(grep 0 命中),三处逻辑已改但无用例;FlowAddAuditServiceTest、FlowIssue266ReduceAuditTest无身份断言,复合键改动最易回归;clearNotify一处断言,forwardOperatorIdentity、interferedOperatorIdentity正向写入无覆盖;BaseAuditNode同人自动通过的跨身份过滤:FlowIssue224SameOperatorAuditTest、FlowIssue224SameOperatorAuditMultiModeTest、FlowIssue226AutoPassRecordTest均无身份维度。优先级建议不变:2 / 3 / 7 属「复合键 + 权限判定」,应先补。
xlorne commentedon Dec 2, 2026
8 类缺口已全部收口(本轮 +15 例,总计 505)。
缺口核对
$bind.getOperatorByIdentityGroovyScriptBindIdentityTest)OperatorIdentityBoundaryTest4 例 +FlowSubProcessResetServiceTest2 例OperatorIdentityBoundaryTest4 例(加签 2 / 减签 2)OperatorIdentityBoundaryTest3 例(转交目标、转交链、干预)FlowContent多身份FlowCurrentNodeOperatorsIdentityTest)FlowRecordQueryMockIdentityTest)BaseAuditNode同人自动通过的身份过滤OperatorIdentityBoundaryTest2 例(USER_ONLY / STRICT)FlowOperatorBulkIdentityTest)同时修正的两处实现不一致
FlowRecord#getTodoKey()):原先无条件按「身份」追加后缀,导致USER_ONLY下同一人换身份会生成两条重复待办。现改为由匹配模式决定:USER_ONLY身份不进键(按人合并),STRICT保持历史兼容追加格式。AddAuditAction#verifyNotInTodoQueue):原先用userId + identity复合键,USER_ONLY下同人换身份仍可重复加签。现统一走OperatorIdentityPolicy.matches,与审批/撤回/减签同口径。同人换身份不算干预这一条保持原实现(
FlowRecord#update已走策略),本轮补了正向断言。验证
./mvnw -o clean install:7 模块 SUCCESS,505 个用例 0 失败 0 跳过(framework 480 / starter-infra 6 / starter-api 2 / starter-query 0 / starter 10 / example 7),原 490,本轮新增 15。交付信息
codingapi/flow-enginefeature/issue-295-identity-tests5573905c64c2fd332889e93818c29eba2bc8a994dev,由人工决定Merge pull request #299 from codingapi/feature/issue-295-identity-tests
xlorne commentedon Dec 2, 2026
已合并到
dev,本 issue 收口关闭。合并信息
codingapi/flow-enginefeature/issue-295-identity-tests→dev5573905c9736e92b合并内容已核对进入
dev(5 文件 +712/−31):缺口收口情况
8 类缺口全部有确定用例覆盖(本轮 +15 例):
$bind.getOperatorByIdentityGroovyScriptBindIdentityTest(已有)OperatorIdentityBoundaryTest4 例 +FlowSubProcessResetServiceTest2 例OperatorIdentityBoundaryTest4 例OperatorIdentityBoundaryTest3 例FlowContent多身份FlowCurrentNodeOperatorsIdentityTest(已有)FlowRecordQueryMockIdentityTest(已有)BaseAuditNode同人自动通过的身份过滤OperatorIdentityBoundaryTest2 例(USER_ONLY / STRICT)FlowOperatorBulkIdentityTest(已有)同时修正两处「按人 vs 按身份」不一致的实现:
FlowRecord#getTodoKey():合并键改由OperatorIdentityPolicy决定——USER_ONLY身份不进键(按人合并),STRICT保持#identity历史兼容追加。修复了USER_ONLY下同一人换身份会生成两条重复待办的问题。AddAuditAction#verifyNotInTodoQueue:查重从userId + identity复合键改为OperatorIdentityPolicy.matches,USER_ONLY下同人换身份拒绝重复加签,与审批 / 撤回 / 减签同口径。「同人换身份不算干预」保持原实现(
FlowRecord#update已走策略),本轮补正向断言。验证
./mvnw -o clean install:7 模块 SUCCESS,505 用例 0 失败 0 跳过(framework 480 / starter-infra 6 / starter-api 2 / starter 10 / example 7),上一轮 490,本轮 +15。分支清理
.worktrees/issue-295已移除feature/issue-295-identity-tests已删除origin/feature/issue-295-identity-tests已删除dev/main