test: 对齐 coverage.scope 移除、测试改名,删掉 CI -skip
06a43f3 已有意删除 coverage.scope(范围根资产+company 富化)以精简规划上
下文,但该测试仍断言此字段。去掉相关断言、改名为 TestAssociatedCompany
AssetsEnterTaskContext(仍校验公司资产进入任务上下文),并移除 CI 里的 -skip。
This commit is contained in:
1 parent
98515a3974
commit
1e3536f571
2 files changed
+10
-25
No files matched your search
@@ -116,10 +116,8 @@ jobs:
|
||||
- name: 测试
|
||||
run: |
|
||||
# -p 1:各包共用一个库,串行执行避免跨包数据竞争。
|
||||
# -skip:TestGraphOverviewExpandsAssociatedCompanyScope 在当前代码上
|
||||
# 已失败(coverage["scope"] 为 nil),与本流程无关,修好后请删掉。
|
||||
run_tests() {
|
||||
go test -p 1 ./... -count=1 -skip 'TestGraphOverviewExpandsAssociatedCompanyScope'
|
||||
go test -p 1 ./... -count=1
|
||||
}
|
||||
# 已知偶发:server 包的后台 worker 会在测试结束后继续写 t.TempDir(),
|
||||
# 触发 "TempDir RemoveAll cleanup: directory not empty"。根因是
|
||||
|
||||
@@ -25,7 +25,15 @@ func callReadJSON(t *testing.T, tool actool.CoreTool, input string) any {
|
||||
return out
|
||||
}
|
||||
|
||||
func TestGraphOverviewExpandsAssociatedCompanyScope(t *testing.T) {
|
||||
// TestAssociatedCompanyAssetsEnterTaskContext verifies that an asset attributed
|
||||
// to a task's company surfaces in the agent's task context: it is linked to the
|
||||
// task with company provenance, counted in coverage.host_count, and reachable via
|
||||
// list_untested_assets / list_assets and as an intent target — with or without the
|
||||
// coverage feature. It no longer asserts coverage.scope: that overview field (scope
|
||||
// root assets + company enrichment) was intentionally dropped in 06a43f3 to slim the
|
||||
// per-round planner context; the association itself still holds through the checks
|
||||
// below.
|
||||
func TestAssociatedCompanyAssetsEnterTaskContext(t *testing.T) {
|
||||
d := testDB(t)
|
||||
defer d.Close()
|
||||
|
||||
@@ -82,27 +90,6 @@ func TestGraphOverviewExpandsAssociatedCompanyScope(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatalf("coverage missing: %#v", overview["coverage"])
|
||||
}
|
||||
scopeRows, ok := coverage["scope"].([]map[string]any)
|
||||
if !ok || len(scopeRows) != 1 {
|
||||
t.Fatalf("task scope missing: %#v", coverage["scope"])
|
||||
}
|
||||
companyScope, ok := scopeRows[0]["company_scope"].([]map[string]any)
|
||||
if !ok || len(companyScope) != len(inputs) {
|
||||
t.Fatalf("company scope not expanded: %#v", scopeRows[0])
|
||||
}
|
||||
kinds := make(map[string]string, len(companyScope))
|
||||
for _, rule := range companyScope {
|
||||
kinds[fmt.Sprint(rule["kind"])] = fmt.Sprint(rule["value"])
|
||||
}
|
||||
for _, input := range inputs {
|
||||
if kinds[input.Kind] != input.Value {
|
||||
t.Errorf("scope %s=%q want %q", input.Kind, kinds[input.Kind], input.Value)
|
||||
}
|
||||
}
|
||||
keywords, ok := scopeRows[0]["company_keywords"].([]string)
|
||||
if !ok || len(keywords) != 1 || keywords[0] != keyword {
|
||||
t.Fatalf("company keywords missing: %#v", scopeRows[0]["company_keywords"])
|
||||
}
|
||||
if hc, _ := coverage["host_count"].(int); hc < 1 {
|
||||
t.Fatalf("company asset host not counted in agent context: %#v", coverage["host_count"])
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user