ServiceMap: update tests and backend/app (+7 areas)

Public changes compared with the previous published export:
89 files changed.

Affected areas:
- backend/app: 21 files
- dependencies: 5 files
- deployment and CI: 6 files
- documentation: 2 files
- frontend: 3 files
- frontend/src: 20 files
- project files: 1 file
- tests: 30 files
- unraid: 1 file

Changed files:
- Updated: ".env.example"
- Updated: "Dockerfile.unraid"
- Updated: "README.md"
- Updated: "backend/Dockerfile"
- Added: "backend/app/alerts.py"
- Updated: "backend/app/auth.py"
- Added: "backend/app/backups.py"
- Updated: "backend/app/config_io.py"
- Updated: "backend/app/demo.py"
- Updated: "backend/app/discovery.py"
- Updated: "backend/app/discovery_store.py"
- Updated: "backend/app/docker_discovery.py"
- Updated: "backend/app/events.py"
- Updated: "backend/app/evidence.py"
- Updated: "backend/app/health.py"
- Updated: "backend/app/incidents.py"
- Added: "backend/app/loops.py"
- Updated: "backend/app/main.py"
- Updated: "backend/app/models.py"
- Updated: "backend/app/observation.py"
- Updated: "backend/app/probes.py"
- Added: "backend/app/response_cache.py"
- Updated: "backend/app/scheduler.py"
- Updated: "backend/app/semantic.py"
- Updated: "backend/app/store.py"
- Updated: "backend/pyproject.toml"
- Updated: "backend/tests/test_api.py"
- Updated: "backend/tests/test_config_io.py"
- Updated: "backend/tests/test_demo.py"
- Updated: "backend/tests/test_discovery_v120.py"
- Updated: "backend/tests/test_health.py"
- Updated: "backend/tests/test_probes.py"
- Updated: "backend/tests/test_scheduler.py"
- Updated: "backend/tests/test_v130_probe_reachability.py"
- Updated: "backend/tests/test_v160_evidence_changes.py"
- Added: "backend/tests/test_v163_alerts.py"
- Added: "backend/tests/test_v163_backups.py"
- Added: "backend/tests/test_v163_data_integrity.py"
- Added: "backend/tests/test_v163_efficiency.py"
- Added: "backend/tests/test_v163_health_performance.py"
- Added: "backend/tests/test_v163_loops.py"
- Added: "backend/tests/test_v163_management.py"
- Added: "backend/tests/test_v163_realtime.py"
- Added: "backend/tests/test_v163_security.py"
- Added: "backend/tests/test_v163_semantic_etag.py"
- Added: "compose.demo.yaml"
- Updated: "compose.yaml"
- Added: "docker-compose.broker.yml"
- Updated: "docker-compose.yml"
- Updated: "docs/ARCHITECTURE.md"
- Added: "frontend/e2e/a11y.spec.ts"
- Updated: "frontend/e2e/demo.spec.ts"
- Updated: "frontend/index.html"
- Updated: "frontend/nginx.conf"
- Updated: "frontend/package-lock.json"
- Updated: "frontend/package.json"
- Updated: "frontend/playwright.config.ts"
- Updated: "frontend/src/App.tsx"
- Updated: "frontend/src/LivingEdge.tsx"
- Added: "frontend/src/activityView.test.ts"
- Added: "frontend/src/activityView.ts"
- Updated: "frontend/src/api.ts"
- Added: "frontend/src/apiAuth.test.ts"
- Added: "frontend/src/components/ActionsMenu.tsx"
- Added: "frontend/src/components/ConfirmDialog.test.tsx"
- Added: "frontend/src/components/ConfirmDialog.tsx"
- Added: "frontend/src/components/StatusIcon.tsx"
- Updated: "frontend/src/demo/DemoWalkthrough.test.ts"
- Updated: "frontend/src/demo/DemoWalkthrough.tsx"
- Added: "frontend/src/elk-worker-url.d.ts"
- Added: "frontend/src/labels.ts"
- Updated: "frontend/src/main.tsx"
- Added: "frontend/src/realtime/refreshPlan.test.ts"
- Added: "frontend/src/realtime/refreshPlan.ts"
- Updated: "frontend/src/realtime/useRealtimeEvents.ts"
- Added: "frontend/src/routing/urlState.test.ts"
- Added: "frontend/src/routing/urlState.ts"
- Updated: "frontend/src/styles.css"
- Added: "frontend/src/topology/GraphListView.test.tsx"
- Added: "frontend/src/topology/GraphListView.tsx"
- Updated: "frontend/src/topology/ServiceNode.tsx"
- Updated: "frontend/src/topology/TopologyCommandBar.tsx"
- Added: "frontend/src/topology/semanticGraph.test.ts"
- Updated: "frontend/src/topology/semanticGraph.ts"
- Added: "frontend/src/topologyLayout.test.ts"
- Updated: "frontend/src/topologyLayout.ts"
- Updated: "package-lock.json"
- Updated: "package.json"
- Updated: "unraid/my-servicemap.xml"

Export provenance/manifests refreshed; excluded from the change summary.

Publish curated ServiceMap source from af46f684e468dffd3a5190e28d3b572d4c26bfd7
This commit is contained in:
NuklearRabbit committed 2026-11-20 13:51:46 +01:00
1 parent d7319250e8
commit adc2c70c21
91 files changed
+9205 -1691

No files matched your search

+59 -16
View File
@@ -1,10 +1,42 @@
import { MarkerType, type Edge } from "@xyflow/react";
import type { HealthStatus, SemanticTopology } from "../api";
import type { Criticality, HealthStatus, SemanticTopology } from "../api";
import type { ServiceNode } from "./ServiceNode";
export type SemanticView = "domains" | "applications" | "components";
export type SemanticFilterStatus = "all" | "unresolved" | HealthStatus;
export type SemanticFilterStatus = "all" | "unresolved" | "problems" | HealthStatus;
/** Statuses that "Problems only" shows: anything needing attention. */
export const PROBLEM_STATUSES: ReadonlySet<string> = new Set(["down", "degraded", "recovering"]);
export function matchesStatusFilter(status: string, filter: SemanticFilterStatus): boolean {
if (filter === "all") return true;
if (filter === "unresolved") return status === "unknown" || status === "unmonitored";
if (filter === "problems") return PROBLEM_STATUSES.has(status);
return status === filter;
}
const CRITICALITY_RANK: Record<Criticality, number> = { low: 0, medium: 1, high: 2, critical: 3 };
export type ServiceFacts = { criticality: Criticality; flapping: boolean };
export type SemanticGraphOptions = {
/** Per-service facts the semantic projection does not carry. */
serviceFacts?: (serviceId: string) => ServiceFacts | undefined;
/**
* Extra filters (domain, application, environment, criticality, lifecycle,
* monitoring, group) evaluated per service. A domain or application node is
* shown when at least one of its components matches.
*/
serviceFilter?: (serviceId: string) => boolean;
};
export type SemanticGraph = {
nodes: ServiceNode[];
edges: Edge[];
/** Relations not drawn because of the per-level cap or the weight rule. */
hiddenEdgeCount: number;
};
/** Projects canonical services and relationships into the active semantic level. */
export function semanticTopologyGraph(
@@ -14,7 +46,21 @@ export function semanticTopologyGraph(
incidentOnly: boolean,
search: string,
statusFilter: SemanticFilterStatus,
): { nodes: ServiceNode[]; edges: Edge[] } {
options: SemanticGraphOptions = {},
): SemanticGraph {
const facts = (ids: string[]): ServiceFacts => {
let criticality: Criticality = "low";
let flapping = false;
let known = false;
for (const id of ids) {
const item = options.serviceFacts?.(id);
if (!item) continue;
known = true;
if (CRITICALITY_RANK[item.criticality] > CRITICALITY_RANK[criticality]) criticality = item.criticality;
flapping ||= item.flapping;
}
return known ? { criticality, flapping } : { criticality: "medium", flapping: false };
};
const applicationById = new Map(
topology.applications.map((item) => [item.id, item]),
);
@@ -51,14 +97,13 @@ export function semanticTopologyGraph(
rootCause: domain.root_cause,
impacted: domain.affected,
group: domain.name,
criticality: "medium",
flapping: false,
...facts(domain.application_ids.flatMap((id) => applicationById.get(id)?.component_ids ?? [])),
category: "domain",
memberIds: domain.application_ids.flatMap(
(id) => applicationById.get(id)?.component_ids ?? [],
),
nodeKind: "domain",
explanation: `${domain.resolved_application_count}/${domain.application_count} resolved · ${domain.unresolved_application_count} unresolved${domain.incident_count ? ` · ${domain.incident_count} incident` : ""}`,
explanation: `${domain.resolved_application_count}/${domain.application_count} opgelost · ${domain.unresolved_application_count} onopgelost${domain.incident_count ? ` · ${domain.incident_count} incident` : ""}`,
},
className: `service-node domain-node status-${domain.status}`,
}))
@@ -77,8 +122,7 @@ export function semanticTopologyGraph(
rootCause: app.root_cause,
impacted: app.affected,
group: domainById.get(app.domain_id)?.name ?? null,
criticality: "medium",
flapping: false,
...facts(app.component_ids),
category: "application",
application: app.name,
applicationNode: true,
@@ -106,20 +150,21 @@ export function semanticTopologyGraph(
impacted: component.affected,
group:
applicationById.get(component.application_id)?.name ?? null,
criticality: "medium",
flapping: false,
...facts([component.service_id]),
category: component.role,
nodeKind: "component",
role: component.role,
explanation: component.unknown_reason
? `${component.unknown_reason.replaceAll("_", " ")} · ${component.dependent_ids.length} dependents`
: `${component.monitoring_state.replace("_", " ")} · ${component.dependent_ids.length} dependents`,
? `${component.unknown_reason.replaceAll("_", " ")} · ${component.dependent_ids.length} afhankelijken`
: `${component.monitoring_state.replace("_", " ")} · ${component.dependent_ids.length} afhankelijken`,
},
className: `service-node component-node status-${component.effective_status}`,
}));
const normalizedSearch = search.trim().toLocaleLowerCase();
const serviceFilter = options.serviceFilter;
const visibleNodes = nodes.filter((node) => {
const descendants = node.data.memberIds ?? [node.id];
if (serviceFilter && !descendants.some((serviceId) => serviceFilter(serviceId))) return false;
const descendantMatches = descendants.some((serviceId) =>
componentById
.get(serviceId)
@@ -132,10 +177,7 @@ export function semanticTopologyGraph(
.toLocaleLowerCase()
.includes(normalizedSearch) ||
descendantMatches) &&
(statusFilter === "all" ||
(statusFilter === "unresolved"
? ["unknown", "unmonitored"].includes(node.data.status)
: node.data.status === statusFilter))
matchesStatusFilter(node.data.status, statusFilter)
);
});
const nodeIds = new Set(visibleNodes.map((node) => node.id));
@@ -244,6 +286,7 @@ export function semanticTopologyGraph(
);
return {
nodes: visibleNodes,
hiddenEdgeCount: projectedEdges.length - visibleEdges.length,
edges: visibleEdges.map((edge) => ({
id: edge.id,
source: edge.source,