Repository navigation
feat: 标签统计增加过滤范围 --story=140191570 - #1028
Conversation
🔎 AI 代码审查📌 Warning 请优先查看下方待处理问题。
🚩 待处理问题🔴 仍存在 · scope_type/scope_value 未做成对校验,单边传入时作用域过滤被静默忽略📍 bkflow/apigw/serializers/label.py:40 · 🏷️ 当前快照中两个 Serializer 仍未新增 validate()/字段级成对校验:bkflow/apigw/serializers/label.py 的 LabelRefCountSerializer 只有 validate_label_ids,scope_type/scope_value 仍为 required=False;bkflow/task/serializers.py 的 LabelRefSerializer 同样只有两个可选字段。调用端仍是 `scope_type is not None and scope_value is not None` 才过滤(get_label_ref_count.py:47-48、task/views.py:258-260、task.py:71-72),单边传入仍会静默退化为全空间统计且无报错。问题仍存在。 🧩 当前代码证据bkflow/apigw/serializers/label.py:40 scope_type = serializers.CharField(help_text=_("流程范围类型,传入时仅统计该作用域下的引用"), required=False)
🔁 历史复核✅ 已修复(静态代码确认) · get_task_label_ref_count 改为 data 传参后未同步既有单测,engine 测试将失败📍 bkflow/contrib/api/collections/task.py:76 · 🏷️ 当前快照 tests/engine/utils/test_client.py:259-264 已更新断言为 url='http://task\.space1/task/get\_task\_label\_ref\_count/&\#x27;、data=\{&\#x27;space\_id&\#x27;: 1, 'label_ids': '1,2'},与 TaskComponentClient.get_task_label_ref_count 现在构造的 data 一致(task.py:70-77)。原断言失败点已修复,不再导致 engine 单测红。 📎 审查边界未运行任何测试/构建,结论均基于静态源码与本次 diff。`bkflow/apigw/management/commands/data/api-resources.yml` 与 `bkflow/apigw/docs/apigw-docs.zip` 被过滤,无法核对 get_label_ref_count 新增可选 query 参数 scope_type/scope_value 是否需要同步网关资源定义/文档。scope 过滤在 all_resource(interface/engine 分库)部署下依赖模板 scope 正确继承到任务:已沿 template/views/template.py create_task 传播链路(scope_type/scope_value 由 template 写入 create_task_data)确认代码路径,但未做运行时验证,任务存量数据(NULL scope)是否与模板 scope 一致会影响按 scope 统计的 task_count,需环境验证。frontend/package-lock.json 等被过滤,未核对前端调用方是否传入 scope。 📋 审查范围与验证说明仅辅助人工审查;未执行测试,也不代表已满足合入或发布条件。 快照过滤了 13 个大文件、链接或工具配置文件;diff 仍包含其修改。 💡 本报告辅助人工审查,结论绑定上述提交。 |
🔁 AI 代码审查复核📌 对上轮审查的逐项回复: 🔴 仍存在 · scope_type/scope_value 未做成对校验,单边传入时作用域过滤被静默忽略📍 bkflow/apigw/serializers/label.py:40 · 🏷️ 当前快照中两个 Serializer 仍未新增 validate()/字段级成对校验:bkflow/apigw/serializers/label.py 的 LabelRefCountSerializer 只有 validate_label_ids,scope_type/scope_value 仍为 required=False;bkflow/task/serializers.py 的 LabelRefSerializer 同样只有两个可选字段。调用端仍是 `scope_type is not None and scope_value is not None` 才过滤(get_label_ref_count.py:47-48、task/views.py:258-260、task.py:71-72),单边传入仍会静默退化为全空间统计且无报错。问题仍存在。 🧩 当前代码证据bkflow/apigw/serializers/label.py:40 scope_type = serializers.CharField(help_text=_("流程范围类型,传入时仅统计该作用域下的引用"), required=False)
✅ 已修复(静态代码确认) · get_task_label_ref_count 改为 data 传参后未同步既有单测,engine 测试将失败📍 bkflow/contrib/api/collections/task.py:76 · 🏷️ 当前快照 tests/engine/utils/test_client.py:259-264 已更新断言为 url='http://task\.space1/task/get\_task\_label\_ref\_count/&\#x27;、data=\{&\#x27;space\_id&\#x27;: 1, 'label_ids': '1,2'},与 TaskComponentClient.get_task_label_ref_count 现在构造的 data 一致(task.py:70-77)。原断言失败点已修复,不再导致 engine 单测红。 以上为静态代码复核,未运行测试;无法确认项继续保留,不自动关闭讨论。 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1028 +/- ##
===========================================
+ Coverage 84.24% 86.54% +2.30%
===========================================
Files 331 377 +46
Lines 21760 25315 +3555
===========================================
+ Hits 18332 21910 +3578
+ Misses 3428 3405 -23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.