fix(platform): harden queries and batch vehicle search

This commit is contained in:
lingniu
2026-07-16 00:14:16 +08:00
parent c29ccdf2da
commit 53e1b57e86
19 changed files with 193 additions and 53 deletions

View File

@@ -1113,6 +1113,9 @@ func TestHandlerSourceReadiness(t *testing.T) {
if body.Data.PlatformRelease != "platform-source-test" {
t.Fatalf("source readiness should expose runtime release, got %+v", body.Data)
}
if body.Data.TotalVehicles != body.Data.BoundVehicles+body.Data.IdentityRequiredVehicles {
t.Fatalf("source readiness vehicle identity population should reconcile, got %+v", body.Data)
}
if len(body.Data.Sources) < len(canonicalVehicleProtocols) {
t.Fatalf("source readiness should expose canonical protocol slots, got %+v", body.Data.Sources)
}

View File

@@ -942,13 +942,15 @@ type MissingSourceStat struct {
}
type SourceReadinessPlan struct {
TotalVehicles int `json:"totalVehicles"`
OnlineVehicles int `json:"onlineVehicles"`
KafkaLag *int `json:"kafkaLag"`
ActiveConnections *int `json:"activeConnections"`
RedisOnlineKeys *int `json:"redisOnlineKeys"`
PlatformRelease string `json:"platformRelease"`
Sources []SourceReadinessRow `json:"sources"`
TotalVehicles int `json:"totalVehicles"`
BoundVehicles int `json:"boundVehicles"`
IdentityRequiredVehicles int `json:"identityRequiredVehicles"`
OnlineVehicles int `json:"onlineVehicles"`
KafkaLag *int `json:"kafkaLag"`
ActiveConnections *int `json:"activeConnections"`
RedisOnlineKeys *int `json:"redisOnlineKeys"`
PlatformRelease string `json:"platformRelease"`
Sources []SourceReadinessRow `json:"sources"`
}
type SourceReadinessRow struct {

View File

@@ -262,13 +262,15 @@ func buildSourceReadinessPlan(summary VehicleServiceSummary, health OpsHealth, q
rows = append(rows, row)
}
return SourceReadinessPlan{
TotalVehicles: summary.TotalVehicles,
OnlineVehicles: summary.OnlineVehicles,
KafkaLag: health.KafkaLag,
ActiveConnections: health.ActiveConnections,
RedisOnlineKeys: health.RedisOnlineKeys,
PlatformRelease: health.Runtime.PlatformRelease,
Sources: rows,
TotalVehicles: summary.TotalVehicles,
BoundVehicles: summary.BoundVehicles,
IdentityRequiredVehicles: summary.IdentityRequiredVehicles,
OnlineVehicles: summary.OnlineVehicles,
KafkaLag: health.KafkaLag,
ActiveConnections: health.ActiveConnections,
RedisOnlineKeys: health.RedisOnlineKeys,
PlatformRelease: health.Runtime.PlatformRelease,
Sources: rows,
}
}