refactor(overview): graph_overview 不再平铺 hosts,新增 done_intents_total
- coverage 块移除 hosts 列表(大范围任务里每轮携带最多 500 个 host 字符串, 对规划决策价值有限),只保留 host_count;具体主机按需 list_assets 查 - 新增顶层 done_intents_total:已结束意图(done/blocked/exhausted)总数,与 recent_done_intents(≤15 截断视图)平行命名,让 planner 去重时知道有无被截, key 即自描述、无需写进提示词 - db: 新增 ExplorationStore.CountFinishedIntents - 测试:blackboard 继承用例改用 host_count 断言,移除随之无用的 containsString
This commit is contained in:
1 parent
6b18845939
commit
b39284f1c6
3 files changed
+26
-27
No files matched your search
@@ -103,9 +103,8 @@ func TestGraphOverviewExpandsAssociatedCompanyScope(t *testing.T) {
|
||||
if !ok || len(keywords) != 1 || keywords[0] != keyword {
|
||||
t.Fatalf("company keywords missing: %#v", scopeRows[0]["company_keywords"])
|
||||
}
|
||||
hosts, ok := coverage["hosts"].([]string)
|
||||
if !ok || !containsString(hosts, domain) {
|
||||
t.Fatalf("company asset host missing from agent context: %#v", coverage["hosts"])
|
||||
if hc, _ := coverage["host_count"].(int); hc < 1 {
|
||||
t.Fatalf("company asset host not counted in agent context: %#v", coverage["host_count"])
|
||||
}
|
||||
untested := callReadJSON(t, tools.listUntestedAssets(), `{"type":"root_domain","page":1,"page_size":10}`)
|
||||
if !strings.Contains(fmt.Sprint(untested), domain) {
|
||||
@@ -153,9 +152,8 @@ func TestGraphOverviewExpandsAssociatedCompanyScope(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatalf("coverage-disabled task lost asset context: %#v", disabledOverview["coverage"])
|
||||
}
|
||||
disabledHosts, ok := disabledCoverage["hosts"].([]string)
|
||||
if !ok || !containsString(disabledHosts, domain) {
|
||||
t.Fatalf("coverage-disabled task lost company asset host: %#v", disabledCoverage["hosts"])
|
||||
if hc, _ := disabledCoverage["host_count"].(int); hc < 1 {
|
||||
t.Fatalf("coverage-disabled task lost company asset host count: %#v", disabledCoverage["host_count"])
|
||||
}
|
||||
if _, exists := disabledCoverage["denominator"]; exists {
|
||||
t.Fatalf("coverage-disabled task unexpectedly exposed metrics: %#v", disabledCoverage)
|
||||
@@ -176,15 +174,6 @@ func TestGraphOverviewExpandsAssociatedCompanyScope(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func containsString(items []string, target string) bool {
|
||||
for _, item := range items {
|
||||
if item == target {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func companiesName(t *testing.T, companies *db.CompanyStore, companyID int64) string {
|
||||
t.Helper()
|
||||
company, err := companies.GetCompany(companyID)
|
||||
@@ -321,9 +310,8 @@ func TestBlackboardToolsReadDirectSources(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatalf("coverage missing from overview: %#v", overview["coverage"])
|
||||
}
|
||||
hosts, ok := coverage["hosts"].([]string)
|
||||
if !ok || len(hosts) != 1 || hosts[0] != host || coverage["host_count"] != 1 {
|
||||
t.Fatalf("inherited host context missing: %#v", coverage)
|
||||
if coverage["host_count"] != 1 {
|
||||
t.Fatalf("inherited host context missing (want host_count=1): %#v", coverage)
|
||||
}
|
||||
|
||||
facts := callReadJSON(t, tools.listFacts(), `{}`).(map[string]any)["facts"].([]any)
|
||||
|
||||
Reference in new issue
Block a user