feat(insert_assets): 资产可标记是否与当前任务相关(related)
insert_assets 每条资产新增 related 入参(默认 true):仅在任务开启资产 覆盖度功能时生效——true 才自动纳入覆盖度(测试范围分母),false 则只入 共享资产库、不计入本任务覆盖度(如顺带发现的旁站/无关资产)。 - Call 内部按 related + coverageDisabled 双重 gate 决定是否 AddAutoScope - 覆盖度关闭时 related 无意义,经 StripCoverageParams 从最终工具 schema 剔除(必须在 ToolResolve 的 DB schema 覆盖之后做,故在装配链末端处理) - 旧库经 refreshBuiltinToolSchemas(flag v6) 刷新 insert_assets schema, 否则首插入only 的 seed 收不到新参数 - 补 StripCoverageParams 回归测试(开启保留/关闭隐藏/不改原始 schema) Claude-Session: https://claude.ai/code/session_01Jm87Gr5fq5aso6SfLyguhx
This commit is contained in:
1 parent
eb3f278711
commit
22ae280584
6 files changed
+126
-6
No files matched your search
+16
-2
@@ -62,6 +62,13 @@ type assetInputItem struct {
|
||||
// ---- endpoint ----
|
||||
Method string `json:"method"`
|
||||
Params []map[string]any `json:"params"`
|
||||
|
||||
// Related marks whether this asset is relevant to the CURRENT test task and
|
||||
// should therefore auto-enter the coverage system (task_scope denominator).
|
||||
// nil = default true (relevant → auto-scoped). false = insert into the shared
|
||||
// asset库 but keep it OUT of this task's coverage. Only consulted when the task
|
||||
// has the coverage feature enabled; ignored (no auto-scope either way) when off.
|
||||
Related *bool `json:"related"`
|
||||
}
|
||||
|
||||
// insertAssets is the unified insert_assets agent tool.
|
||||
@@ -150,6 +157,11 @@ func (t *ToolSet) insertAssets() actool.CoreTool {
|
||||
"description": "请求参数列表,每条含 location(query/body/header/path)/name/value/type(可选,追加不覆盖)",
|
||||
"items": map[string]any{"type": "object"},
|
||||
},
|
||||
// 覆盖度相关:该资产是否与当前测试任务有关。
|
||||
"related": map[string]any{
|
||||
"type": "boolean",
|
||||
"description": "该资产是否与【当前测试任务】相关:true(默认)才自动纳入资产覆盖度(测试范围分母);false 则只入库、不计入本任务覆盖度(如顺带发现的旁站/无关资产)。仅在任务开启资产覆盖度功能时生效。",
|
||||
},
|
||||
}, "type"),
|
||||
},
|
||||
}, "assets"),
|
||||
@@ -274,8 +286,10 @@ func (t *ToolSet) insertAssets() actool.CoreTool {
|
||||
t.anchorOwner(id)
|
||||
// 自动入测试范围(source='auto'):只对 worker 顶层显式插入的这一项,按其
|
||||
// 类型加保守范围;side-effect 派生的资产不经此处,故范围不盲目扩大。taskID=0 时无操作。
|
||||
// 资产覆盖度功能关闭时不再累积测试范围(分母)。
|
||||
if !t.coverageDisabled {
|
||||
// 资产覆盖度功能关闭时不再累积测试范围(分母);related=false(与当前任务无关)
|
||||
// 的资产也只入库、不计入覆盖度。related 省略/null 视为 true(默认纳入)。
|
||||
related := item.Related == nil || *item.Related
|
||||
if !t.coverageDisabled && related {
|
||||
svcIP := item.ServiceIP
|
||||
if svcIP == "" {
|
||||
svcIP = item.IP
|
||||
|
||||
Reference in new issue
Block a user