From 38eaf5f7d49407f21eb36ae952247e11fbe2b371 Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 30 Sep 2026 16:03:39 +0800 Subject: [PATCH] fix(deploy): make bundled Agent endpoint valid for isolated Mock --- deploys/config/agent-endpoints.example.json | 2 +- docs/evidence/saas-dispatcher-implementation.md | 2 ++ internal/config/current_agent_endpoints_test.go | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/deploys/config/agent-endpoints.example.json b/deploys/config/agent-endpoints.example.json index d3987c7..8509303 100644 --- a/deploys/config/agent-endpoints.example.json +++ b/deploys/config/agent-endpoints.example.json @@ -2,7 +2,7 @@ { "agent_id": "agent-cell-a", "cell_id": "cell-a", - "address": "agent-cell-a.internal:19090", + "address": "127.0.0.1:19090", "server_name": "agent-cell-a.internal" } ] diff --git a/docs/evidence/saas-dispatcher-implementation.md b/docs/evidence/saas-dispatcher-implementation.md index 762276f..a17e62d 100644 --- a/docs/evidence/saas-dispatcher-implementation.md +++ b/docs/evidence/saas-dispatcher-implementation.md @@ -132,6 +132,8 @@ - 旧全局环境配置:旧 `Config`/`FromEnv` 同时配置 Mock、mixed/real、旧 Dispatcher SQLite 和 OSS 环境凭据,已无现行业务调用;删除实现和专属测试,保留当前分角色环境及批准文件/受控引用读取。把「旧 OSS 环境变量不可覆盖配置文件与受控凭据」迁至现行 `LoadCurrentOSSConfig` 隔离测试;原旧结构的 mTLS 专属测试删除,现行 Dispatcher/Agent mTLS 校验测试仍在。全仓 Go 测试通过;不更改实际部署配置或现存数据。 +- Agent 端点样例:包内 `deploys/config/agent-endpoints.example.json` 原指向非本机地址,无法通过唯一现行 Mock Dispatcher 的本地端点校验;新增读取实际打包样例的测试先复现失败,再将地址改为显式 loopback 端口。Agent/Cell 标识与证书 SNI 仍为部署占位值,须由受控环境提供匹配证书;样例通过只证明隔离 Mock 可读取,不授权真实 Agent/线路。 + ## 验收台账 P01–P06 的项目内隔离证据见上;P07 全仓命名与唯一入口尚在清理,A01–A12 和 K01–K16 的最终对照仍待 P08。不得用本地 Mock 冒充外部签收。 diff --git a/internal/config/current_agent_endpoints_test.go b/internal/config/current_agent_endpoints_test.go index 4fbc495..8cee46b 100644 --- a/internal/config/current_agent_endpoints_test.go +++ b/internal/config/current_agent_endpoints_test.go @@ -18,6 +18,14 @@ func writeMockAgentEndpoints(t *testing.T, body string) string { return filename } +func TestBundledAgentEndpointExampleIsValidForCurrentMock(t *testing.T) { + filename := filepath.Join("..", "..", "deploys", "config", "agent-endpoints.example.json") + endpoint, err := LoadCurrentMockAgentEndpoint(filename) + if err != nil || endpoint.AgentID != "agent-cell-a" || endpoint.CellID != "cell-a" || endpoint.Address != "127.0.0.1:19090" { + t.Fatalf("bundled Agent endpoint example cannot start the current Mock: endpoint=%+v err=%v", endpoint, err) + } +} + func TestLoadCurrentMockAgentEndpointRequiresOneLocalDeploymentTarget(t *testing.T) { endpoint, err := LoadCurrentMockAgentEndpoint(writeMockAgentEndpoints(t, mockAgentEndpoint)) if err != nil || endpoint.AgentID != "agent-mock" || endpoint.CellID != "cell-mock" ||