Dockerfile 运行阶段补齐 dws_dingtalk_scan(F12),并新增 runtime-scripts 门禁 做脚本依赖闭包正负例;就绪探测每次解析当前端点/绑定/凭据并区分 404、未配置、 不可达(F13);路由写入来源路径与父目录,历史空值仅按同连接同 item 的意图读时 补齐(F14);目标筛选显示短 ID 与当前绑定/历史并提供快捷筛选(F15);刷新终态 移除后台运行、展示失败时间/旧快照/脱敏原因/作业 ID 与重试(F16)。 验证:make verify 17 项全过(identity 本地按设计 skipped);一次性 schema 的 Monitor 目录/路由集成用例通过;8088 部署与真实 UI 验收仍由父会话执行。
This commit is contained in:
@@ -177,10 +177,13 @@ func (provider *RealProvider) weKnoraProbe(ctx context.Context, now time.Time) g
|
||||
return provider.track(classify("weknora", "WeKnora API", false, true, ProbeOutcome{ObservedAt: now}))
|
||||
}
|
||||
outcome := provider.httpProbeOutcome(ctx, baseURL, now)
|
||||
probeTarget := ""
|
||||
if outcome.Reachability == nil && provider.weknoraReadiness != nil {
|
||||
outcome.WorkReadiness = provider.weknoraReadiness(ctx)
|
||||
probeTarget, outcome.WorkReadiness = provider.weknoraReadiness(ctx)
|
||||
}
|
||||
return provider.track(classify("weknora", "WeKnora API", true, true, outcome))
|
||||
health := provider.track(classify("weknora", "WeKnora API", true, true, outcome))
|
||||
health.ProbeTarget = probeTarget
|
||||
return health
|
||||
}
|
||||
|
||||
// productionWeKnoraProbe reports the real state of the production WeKnora
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"knowledge-governance/internal/governance"
|
||||
"knowledge-governance/internal/readiness"
|
||||
)
|
||||
|
||||
func testNow() time.Time { return time.Date(2026, 9, 12, 9, 0, 0, 0, time.UTC) }
|
||||
@@ -141,3 +142,31 @@ func TestOverallReadinessTreatsProductionEndpointAsAdvisory(t *testing.T) {
|
||||
t.Fatalf("real dependency failure must still block: ok=%v blocked=%v", ok, blocked)
|
||||
}
|
||||
}
|
||||
|
||||
// F13: 旧 env 绑定 404 是「业务就绪被阻断」,不是「服务不可达」;
|
||||
// 同时必须把脱敏后的探测对象带出来,否则红灯无法归因。
|
||||
func TestWeKnoraReadinessReportsBindingBlockWithoutLosingLiveness(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
defer server.Close()
|
||||
provider := &RealProvider{
|
||||
httpClient: server.Client(),
|
||||
weknoraBaseURL: server.URL,
|
||||
health: newHealthTracker(),
|
||||
weknoraReadiness: func(context.Context) (string, error) {
|
||||
target := "实例 weknora.test · 知识库 1b52c140"
|
||||
return target, fmt.Errorf("%w(%s)", readiness.ErrKnowledgeBaseMissing, target)
|
||||
},
|
||||
}
|
||||
health := provider.weKnoraProbe(context.Background(), testNow())
|
||||
if health.Liveness != LiveUp || health.Readiness != ReadBlocked {
|
||||
t.Fatalf("404 binding = %+v, want up/blocked", health)
|
||||
}
|
||||
if health.ProbeTarget != "实例 weknora.test · 知识库 1b52c140" {
|
||||
t.Fatalf("probe target = %q", health.ProbeTarget)
|
||||
}
|
||||
if !strings.Contains(health.Reason, "1b52c140") || strings.Contains(health.Reason, "1b52c140-2e18-4676-afc5-4c7d8d190a8c") {
|
||||
t.Fatalf("reason = %q, want short target only", health.Reason)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ type RealProviderConfig struct {
|
||||
// place operators configure it — and the env value above stays the
|
||||
// bootstrap fallback for containers that were wired before the UI existed.
|
||||
ProductionWeKnoraResolver func(ctx context.Context) string
|
||||
// WeKnoraReadiness optionally exercises a real read against a routing
|
||||
// knowledge base (nil = API key not configured; liveness-only).
|
||||
WeKnoraReadiness func(ctx context.Context) error
|
||||
// WeKnoraReadiness optionally exercises a real read against the CURRENT
|
||||
// routing binding and reports the sanitized probe target alongside the error.
|
||||
WeKnoraReadiness func(ctx context.Context) (target string, err error)
|
||||
// WorkerStaleAfter bounds how long a missing worker heartbeat still counts
|
||||
// as alive (P10).
|
||||
WorkerStaleAfter time.Duration
|
||||
@@ -61,7 +61,7 @@ type RealProvider struct {
|
||||
testWeKnoraResolver func(ctx context.Context) string
|
||||
productionWeKnoraBaseURL string
|
||||
productionWeKnoraResolver func(ctx context.Context) string
|
||||
weknoraReadiness func(ctx context.Context) error
|
||||
weknoraReadiness func(ctx context.Context) (string, error)
|
||||
workerStaleAfter time.Duration
|
||||
health *healthTracker
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user