Repository navigation
fix(#301): 身份改为请求头传递,修复流程列表 500 - #302
Merged
Merged
Conversation
身份原先前端以 query 参数 operatorIdentity 注入所有 /api/ 请求,而引擎的 /api/query/workflow/list 用 SearchRequest 接收请求,会把 query 参数当作实体 过滤字段解析,直接抛 Field operatorIdentity not found in class hierarchy。 - OperatorIdentity 新增 X-Operator-Identity / X-Identity-Scope / X-Lock-Identity 请求头常量与 pick()(请求头优先、区分「未携带」与「显式空串」) - FlowRecordController、FlowRecordQueryController 身份解析改为请求头优先, 保留 query 读取以兼容旧调用方 - 查询身份范围(identityScope / lockIdentity)同步支持请求头 - 更新 operator-identity 文档与 curl 示例 - 新增 OperatorIdentityHeaderResolveTest 覆盖优先级与非法值拒绝 Closes #301
This was referenced Dec 3, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #302 +/- ##
============================================
- Coverage 76.19% 76.17% -0.03%
- Complexity 2124 2127 +3
============================================
Files 282 282
Lines 8651 8658 +7
Branches 1028 1029 +1
============================================
+ Hits 6592 6595 +3
- Misses 1550 1554 +4
Partials 509 509 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 issue
Closes #301
问题
前端把当前身份以 query 参数
operatorIdentity注入所有/api/请求(issue #288 引入),而流程列表接口用SearchRequest接收请求:SearchRequest#toPageRequest会把所有 query 参数当作实体过滤字段解析,operatorIdentity不是WorkflowEntity的字段,直接抛:流程列表页因此 500。
修复
身份是请求上下文,不应混进查询条件:
OperatorIdentity新增X-Operator-Identity/X-Identity-Scope/X-Lock-Identity请求头常量,以及pick(header, parameter, parameterPresent)(请求头优先,区分「未携带」与「显式空串」);FlowRecordController、FlowRecordQueryController的身份解析改为请求头优先,保留 query 读取以兼容旧调用方与 curl 直连;identityScope/lockIdentity)同步支持请求头;operator-identity.md补请求头说明与 curl 示例,并标注 query 方式的坑。验证
./mvnw -o -pl flow-engine-framework test:485 用例,0 失败 0 错误(新增OperatorIdentityHeaderResolveTest5 例,覆盖优先级、空串语义、非法值拒绝)。启动示例应用(8091)后实测:
GET /api/query/workflow/list?operatorIdentity=department1{"success":false,"errMessage":"Field operatorIdentity not found in class hierarchy."}(复现原问题)GET /api/query/workflow/list+X-Operator-Identity: department1{"success":true,"data":{"total":1,"list":[]}}GET /api/query/record/todo+X-Operator-Identity: department1+X-Identity-Scope: LOCKED{"success":true,"data":{"total":0,"list":[]}}合并顺序
先本 PR,再
codingapi/flow-frontend#88(前端改为请求头注入)。后端保留 query 兼容,所以旧前端在合并后仍能用(除流程列表外)。