mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-06 21:11:50 +08:00
fix(findings): protect historical reports and verify consolidation results
This commit is contained in:
1 parent
71ec0f0efd
commit
7db7b71cdb
15 files changed
+906
-74
No files matched your search
@@ -29,3 +29,33 @@ func TestFindingCaseGuidanceRespectsToolsAndTrafficSwitch(t *testing.T) {
|
||||
t.Fatal("custom prompt lost")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHistoricalFindingReviewFiltersMutationAndProbeTools(t *testing.T) {
|
||||
oldAugment, oldResolve := ToolAugment, ToolResolve
|
||||
ToolAugment, ToolResolve = nil, nil
|
||||
t.Cleanup(func() { ToolAugment, ToolResolve = oldAugment, oldResolve })
|
||||
tools := []actool.CoreTool{}
|
||||
for _, name := range []string{"update_finding_report", "bind_finding_traffic", "report_finding", "Bash", "Write", "Edit", "mcp__custom__write", "get_finding_record", "merge_finding_records", "search_finding_duplicates", "get_finding_case", "update_finding_case_report", "complete_finding_case_review"} {
|
||||
tools = append(tools, writeTool(name, name, obj(nil), func(context.Context, json.RawMessage) (actool.Result, error) { return actool.Text("ok"), nil }))
|
||||
}
|
||||
out, def, cleanup := AugmentTools(WithFindingCaseReview(t.Context()), "reporter", tools)
|
||||
defer cleanup()
|
||||
for _, tool := range out {
|
||||
switch tool.Name() {
|
||||
case "update_finding_report", "bind_finding_traffic", "report_finding", "Bash", "Write", "Edit", "mcp__custom__write":
|
||||
t.Fatal("historical mutation capability", tool.Name())
|
||||
}
|
||||
}
|
||||
if len(out) != 6 || def.FindingGuidance != "" || !strings.Contains(def.CaseGuidance, "历史整理模式") || !strings.Contains(def.CaseGuidance, "接口、路径、后端、读/写影响、评级不同") {
|
||||
t.Fatal("missing historical isolation", def)
|
||||
}
|
||||
normal, _, cl := AugmentTools(t.Context(), "reporter", tools)
|
||||
defer cl()
|
||||
found := map[string]bool{}
|
||||
for _, tool := range normal {
|
||||
found[tool.Name()] = true
|
||||
}
|
||||
if !found["update_finding_report"] || !found["Bash"] || !found["report_finding"] {
|
||||
t.Fatal("normal reporting was restricted")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user