Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Rename contract graph helper

rcourtmanc826707f60ce
diff --git a/scripts/release_control/canonical_completion_guard.py b/scripts/release_control/canonical_completion_guard.py
index ae4e7fcc67..e311f8f062 100644
--- a/scripts/release_control/canonical_completion_guard.py
+++ b/scripts/release_control/canonical_completion_guard.py
@@ -17,7 +17,7 @@ from typing import Dict, List, Sequence, Set
from control_plane import DEFAULT_CONTROL_PLANE
from repo_file_io import load_repo_json
-from subsystem_contracts import load_contract_graph, referenced_contracts_for_path
+from subsystem_contracts import load_contract_index, referenced_contracts_for_path
REPO_ROOT = Path(__file__).resolve().parents[2]
@@ -258,11 +258,11 @@ def required_contract_updates(
staged_files: Sequence[str],
impacted: Dict[str, dict] | None = None,
*,
- use_staged_contract_graph: bool = False,
+ use_staged_contract_index: bool = False,
) -> Dict[str, dict]:
impacted_subsystems = impacted if impacted is not None else infer_impacted_subsystems(staged_files)
required: Dict[str, dict] = {}
- contract_graph = load_contract_graph(staged=use_staged_contract_graph)
+ contract_index = load_contract_index(staged=use_staged_contract_index)
for subsystem_id, data in impacted_subsystems.items():
required[data["contract"]] = {
@@ -281,7 +281,7 @@ def required_contract_updates(
}
)
for path in touched_runtime_files:
- for contract in referenced_contracts_for_path(path, contract_graph):
+ for contract in referenced_contracts_for_path(path, contract_index):
contract_path = str(contract["contract"])
entry = required.setdefault(
contract_path,
@@ -467,7 +467,7 @@ def check_staged_contracts(staged_files: Sequence[str]) -> int:
required_contracts = required_contract_updates(
staged_files,
impacted,
- use_staged_contract_graph=True,
+ use_staged_contract_index=True,
)
missing_contracts = {
contract_path: data
diff --git a/scripts/release_control/staged_commit_shape_guard.py b/scripts/release_control/staged_commit_shape_guard.py
index 26863e943f..320b4611e1 100644
--- a/scripts/release_control/staged_commit_shape_guard.py
+++ b/scripts/release_control/staged_commit_shape_guard.py
@@ -245,7 +245,7 @@ def canonical_commit_shape_errors(staged_files: Sequence[str]) -> list[str]:
required_contracts = required_contract_updates(
staged_files,
impacted,
- use_staged_contract_graph=True,
+ use_staged_contract_index=True,
)
missing_contracts = {
contract_path: data
diff --git a/scripts/release_control/subsystem_contracts.py b/scripts/release_control/subsystem_contracts.py
index e7e853665c..9b775b83f6 100644
--- a/scripts/release_control/subsystem_contracts.py
+++ b/scripts/release_control/subsystem_contracts.py
@@ -198,12 +198,12 @@ def parse_contract_text(rel: str, content: str) -> tuple[dict[str, Any], list[st
}, errors
-def load_contract_graph(
+def load_contract_index(
contract_texts: dict[str, str] | None = None,
*,
staged: bool = False,
) -> dict[str, dict[str, Any]]:
- graph: dict[str, dict[str, Any]] = {}
+ contract_index: dict[str, dict[str, Any]] = {}
for rel, content in (contract_texts or tracked_contract_files(staged=staged)).items():
if rel == TEMPLATE_REL or not rel.endswith(".md"):
continue
@@ -214,14 +214,14 @@ def load_contract_graph(
subsystem_id = str(metadata.get("subsystem_id", "")).strip()
if not subsystem_id:
continue
- graph[subsystem_id] = {
+ contract_index[subsystem_id] = {
"subsystem_id": subsystem_id,
"contract": rel,
"metadata": metadata,
"path_references": list(parsed.get("path_references", [])),
"title": parsed.get("title", ""),
}
- return graph
+ return contract_index
def contract_reference_matches_path(reference_path: str, path: str) -> bool:
@@ -232,11 +232,11 @@ def contract_reference_matches_path(reference_path: str, path: str) -> bool:
def referenced_contracts_for_path(
path: str,
- contract_graph: dict[str, dict[str, Any]] | None = None,
+ contract_index: dict[str, dict[str, Any]] | None = None,
) -> list[dict[str, Any]]:
- graph = contract_graph or load_contract_graph()
+ contracts_by_subsystem = contract_index or load_contract_index()
matches: list[dict[str, Any]] = []
- for contract in graph.values():
+ for contract in contracts_by_subsystem.values():
referenced_paths = [
reference
for reference in contract.get("path_references", [])
diff --git a/scripts/release_control/subsystem_contracts_test.py b/scripts/release_control/subsystem_contracts_test.py
index 1d91cc6818..5c17e3199d 100644
--- a/scripts/release_control/subsystem_contracts_test.py
+++ b/scripts/release_control/subsystem_contracts_test.py
@@ -7,7 +7,7 @@ import tempfile
from subsystem_contracts import (
contract_reference_matches_path,
- load_contract_graph,
+ load_contract_index,
parse_contract_text,
referenced_contracts_for_path,
tracked_contract_paths,
@@ -89,7 +89,7 @@ Stable.
self.assertFalse(contract_reference_matches_path("internal/example/runtime.go", "internal/example/other.go"))
def test_referenced_contracts_for_path_returns_matching_subsystem(self) -> None:
- contract_graph = load_contract_graph(
+ contract_index = load_contract_index(
{
"docs/release-control/v6/internal/subsystems/example.md": """# Example Contract
@@ -132,7 +132,7 @@ Stable.
}
)
- matches = referenced_contracts_for_path("internal/example/runtime.go", contract_graph)
+ matches = referenced_contracts_for_path("internal/example/runtime.go", contract_index)
self.assertEqual(len(matches), 1)
self.assertEqual(matches[0]["subsystem_id"], "example")
self.assertEqual(
@@ -143,7 +143,7 @@ Stable.
],
)
- shared_matches = referenced_contracts_for_path("internal/shared/runtime.go", contract_graph)
+ shared_matches = referenced_contracts_for_path("internal/shared/runtime.go", contract_index)
self.assertEqual(len(shared_matches), 1)
self.assertEqual(shared_matches[0]["subsystem_id"], "example")
self.assertEqual(
diff --git a/scripts/toggle-mock.sh b/scripts/toggle-mock.sh
index e16d55cf28..773f4b41ab 100755
--- a/scripts/toggle-mock.sh
+++ b/scripts/toggle-mock.sh
@@ -477,7 +477,7 @@ start_hot_dev_runtime() {
return 2
fi
- # Frontend startup can lag behind backend startup when dependency graph is large.
+ # Frontend startup can lag behind backend startup when the dependency map is large.
if ! wait_for_port "${expected_frontend_port}" "${startup_timeout}"; then
log_warn "hot-dev backend is up but frontend port ${expected_frontend_port} is not listening yet"
log_warn "Proceeding with backend-only availability; check ${HOT_DEV_LOG} for frontend startup"