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.

Integrate current workload evidence and merge qualification

rcourtmana4d2cdc2b8b6
diff --cc docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.md
index f1f422e82d,f1f422e82d..f707c3363b
--- a/docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.md
+++ b/docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.md
@@@ -730,3 -730,3 +730,12 @@@ Pulse v6 should be
2. extension-oriented instead of patch-oriented
3. enforced by tests and guardrails
4. obvious for both humans and agents to continue correctly
++
++### Inherited merge content
++
++Staged qualification compares each file’s Git mode and object ID with the
++merged parents. Exact inherited states, including deletions, keep their parent
++qualification. New resolutions and mode changes remain current work and must
++satisfy their owning contract and proof requirements. Range checks still
++qualify the complete proposed change. Combined frontend content needs a fresh
++browser receipt in a subsequent non-merge commit.
diff --cc frontend-modern/src/components/Workloads/useGuestDrawerState.ts
index f07fcdc144,e2f262ba83..0aa0205914
--- a/frontend-modern/src/components/Workloads/useGuestDrawerState.ts
+++ b/frontend-modern/src/components/Workloads/useGuestDrawerState.ts
@@@ -1,7 -1,8 +1,8 @@@
import { createEffect, createMemo, createSignal } from 'solid-js';
-import type { HistoryTimeRange } from '@/api/charts';
import { useAlertsActivation } from '@/stores/alertsActivation';
+import type { HistoryTimeRange } from '@/api/charts';
+ import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import type { DisplayMetricType } from '@/utils/metricThresholds';
import {
getCanonicalWorkloadId,
@@@ -40,22 -42,6 +41,23 @@@ export function createGuestDrawerViewSt
const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>(
GUEST_DRAWER_HISTORY_DEFAULT_RANGE,
);
+ return {
+ activeTab,
+ setActiveTab,
+ historyRange,
+ setHistoryRange,
+ reset: () => {
+ setActiveTab('overview');
+ setHistoryRange(GUEST_DRAWER_HISTORY_DEFAULT_RANGE);
+ },
+ };
+}
+
+export function useGuestDrawerState(props: GuestDrawerProps) {
+ const alertsActivation = useAlertsActivation();
++ const now = useRelativeTimeNow();
+ const { activeTab, setActiveTab, historyRange, setHistoryRange } =
+ props.viewState ?? createGuestDrawerViewState();
const guestId = createMemo(() => getCanonicalWorkloadId(props.guest));
const alertThresholdScope = createMemo(() => getWorkloadAlertThresholdScope(props.guest));
diff --cc scripts/release_control/browser_verification_guard.py
index c437fc7669,c437fc7669..c120471ee5
--- a/scripts/release_control/browser_verification_guard.py
+++ b/scripts/release_control/browser_verification_guard.py
@@@ -23,6 -23,6 +23,7 @@@ import sy
from typing import Iterable, Sequence
import format_staged_frontend
++from repo_file_io import blob_ids, merge_parents, merged_in_paths, run_git
REPO_ROOT = Path(__file__).resolve().parents[2]
@@@ -40,17 -40,17 +41,6 @@@ FRONTEND_ENTRY_FILES = {"frontend-moder
FRONTEND_SOURCE_SUFFIXES = {".css", ".scss", ".ts", ".tsx"}
--def run_git(args: Sequence[str], *, repo_root: Path = REPO_ROOT) -> str:
-- result = subprocess.run(
-- ["git", *args],
-- cwd=repo_root,
-- check=True,
-- capture_output=True,
-- text=True,
-- )
-- return result.stdout.strip()
--
--
def blocked(headline: str, details: Iterable[str] = (), advice: Iterable[str] = ()) -> int:
print(f"BLOCKED: {headline}", file=sys.stderr)
for detail in details:
@@@ -321,72 -321,72 +311,6 @@@ def validate_receipt
return errors
--def blob_ids(
-- revision: str | None,
-- paths: Sequence[str],
-- *,
-- repo_root: Path = REPO_ROOT,
--) -> dict[str, str]:
-- """Object ids under the given paths in a commit, or in the index when revision is None.
--
-- A path that does not exist there is simply absent from the result.
-- """
-- ids: dict[str, str] = {}
-- for start in range(0, len(paths), 200):
-- chunk = list(paths[start : start + 200])
-- if revision is None:
-- command = ["ls-files", "--stage", "-z", "--", *chunk]
-- else:
-- command = ["ls-tree", "-r", "-z", revision, "--", *chunk]
-- output = run_git(["--literal-pathspecs", *command], repo_root=repo_root)
-- for entry in output.split("\0"):
-- meta, separator, path = entry.partition("\t")
-- if not separator:
-- continue
-- fields = meta.split()
-- ids[path] = fields[1] if revision is None else fields[2]
-- return ids
--
--
--def merge_parents(*, commit: str | None, repo_root: Path = REPO_ROOT) -> list[str]:
-- """Parents beyond the first: the merge being concluded, or a merge commit's own."""
-- if commit:
-- return run_git(
-- ["rev-list", "--parents", "-n", "1", commit], repo_root=repo_root
-- ).split()[2:]
-- merge_head = Path(run_git(["rev-parse", "--git-path", "MERGE_HEAD"], repo_root=repo_root))
-- if not merge_head.is_absolute():
-- merge_head = repo_root / merge_head
-- if not merge_head.exists():
-- return []
-- return merge_head.read_text(encoding="utf-8").split()
--
--
--def merged_in_paths(
-- paths: Sequence[str],
-- *,
-- commit: str | None,
-- repo_root: Path = REPO_ROOT,
--) -> set[str]:
-- """Paths whose new state is exactly what a merged parent already carries.
--
-- Concluding a merge stages everything the other parent brought, so a plain
-- staged-file reading mistakes the other side's frontend work and receipts
-- for this commit's own. Demanding a receipt for them asked the author to
-- vouch for files they never ran, which made a merge unable to repair a
-- branch that fell behind main. Content a parent already holds was verified
-- in that parent's history and is not this commit's change.
-- """
-- parents = merge_parents(commit=commit, repo_root=repo_root)
-- if not parents or not paths:
-- return set()
-- new = blob_ids(commit, paths, repo_root=repo_root)
-- inherited: set[str] = set()
-- for parent in parents:
-- theirs = blob_ids(parent, paths, repo_root=repo_root)
-- inherited.update(path for path in paths if new.get(path) == theirs.get(path))
-- return inherited
--
def parse_receipt_changes(name_status: str) -> dict[str, str]:
changes: dict[str, str] = {}
diff --cc scripts/release_control/browser_verification_guard_test.py
index 1dead68019,1dead68019..29605bfe45
--- a/scripts/release_control/browser_verification_guard_test.py
+++ b/scripts/release_control/browser_verification_guard_test.py
@@@ -598,7 -598,7 +598,7 @@@ class IntegrationRangeTest(GuardRepoTes
step = workflow.split(" - name: Validate final frontend browser evidence\n", 1)[1]
step = step.split("\n - name:", 1)[0]
command = textwrap.dedent(step.split(" run: |\n", 1)[1])
-- for name in ("browser_verification_guard.py", "format_staged_frontend.py"):
++ for name in ("browser_verification_guard.py", "format_staged_frontend.py", "repo_file_io.py"):
self.write("scripts/release_control/" + name,
(REPO_ROOT / "scripts/release_control" / name).read_text())
return subprocess.run(
diff --cc scripts/release_control/canonical_completion_guard.py
index 241e379d9e,241e379d9e..4ca908f24b
--- a/scripts/release_control/canonical_completion_guard.py
+++ b/scripts/release_control/canonical_completion_guard.py
@@@ -20,7 -20,7 +20,7 @@@ from typing import Dict, List, Sequence
import browser_verification_guard
from control_plane import DEFAULT_CONTROL_PLANE
--from repo_file_io import load_repo_json
++from repo_file_io import git_env, load_repo_json, merged_in_paths
from subsystem_contracts import load_contract_index, referenced_contracts_for_path
@@@ -165,8 -165,8 +165,11 @@@ def git_staged_files() -> List[str]
check=True,
capture_output=True,
text=True,
++ env=git_env(REPO_ROOT),
)
-- return [line.strip() for line in result.stdout.splitlines() if line.strip()]
++ paths = [line.strip() for line in result.stdout.splitlines() if line.strip()]
++ inherited = merged_in_paths(paths, commit=None, repo_root=REPO_ROOT)
++ return [path for path in paths if path not in inherited]
def stdin_files(stdin: Sequence[str]) -> List[str]:
diff --cc scripts/release_control/canonical_completion_guard_test.py
index eaaff38630,59d7125d12..3fe826e9cf
--- a/scripts/release_control/canonical_completion_guard_test.py
+++ b/scripts/release_control/canonical_completion_guard_test.py
@@@ -1,4 -1,4 +1,5 @@@
import io
++import canonical_completion_guard
import json
import os
import subprocess
@@@ -158,6 -158,6 +159,45 @@@ def first_matching_policy_id(rule: dict
class CanonicalCompletionGuardTest(unittest.TestCase):
++ def test_staged_scope_keeps_resolutions_and_modes_but_not_inherited_merge_work(self) -> None:
++ with tempfile.TemporaryDirectory() as temporary:
++ root = Path(temporary)
++ env = os.environ.copy()
++ strip_local_git_env(env)
++ env["GIT_CONFIG_GLOBAL"] = os.devnull
++ env["GIT_CONFIG_SYSTEM"] = os.devnull
++
++ def git(*args: str) -> None:
++ subprocess.run(
++ ["git", "-c", "user.name=Proof Fixture", "-c", "[email protected]", *args],
++ cwd=root, env=env, check=True, capture_output=True, text=True,
++ )
++
++ git("init", "-b", "main")
++ for name in ("resolved.go", "mode.go", "removed.go", "old name.go"):
++ (root / name).write_text("base\n", encoding="utf-8")
++ git("add", "resolved.go", "mode.go", "removed.go", "old name.go")
++ git("commit", "-m", "Base fixture")
++ git("checkout", "-b", "reviewed")
++ (root / "resolved.go").write_text("reviewed\n", encoding="utf-8")
++ (root / "inherited.go").write_text("reviewed\n", encoding="utf-8")
++ git("rm", "removed.go")
++ git("mv", "old name.go", "new name.go")
++ git("add", "resolved.go", "inherited.go")
++ git("commit", "-m", "Reviewed fixture")
++ git("checkout", "main")
++ git("merge", "--no-commit", "--no-ff", "reviewed")
++ (root / "resolved.go").write_text("combined resolution\n", encoding="utf-8")
++ git("add", "resolved.go")
++ git("update-index", "--chmod=+x", "mode.go")
++ with patch("canonical_completion_guard.REPO_ROOT", root):
++ self.assertEqual(canonical_completion_guard.git_staged_files(), ["mode.go", "resolved.go"])
++ git("reset", "--hard", "HEAD")
++ (root / "resolved.go").write_text("reviewed\n", encoding="utf-8")
++ git("add", "resolved.go")
++ with patch("canonical_completion_guard.REPO_ROOT", root):
++ self.assertEqual(canonical_completion_guard.git_staged_files(), ["resolved.go"])
++
def test_registry_exists_and_contains_required_subsystems(self):
self.assertTrue(SUBSYSTEM_REGISTRY.exists())
rules = load_subsystem_rules()
diff --cc scripts/release_control/repo_file_io.py
index d46b7f2101,d46b7f2101..96b7282b34
--- a/scripts/release_control/repo_file_io.py
+++ b/scripts/release_control/repo_file_io.py
@@@ -9,7 -9,7 +9,7 @@@ from dataclasses import dataclas
from functools import lru_cache
from pathlib import Path
import subprocess
--from typing import Any, Iterable
++from typing import Any, Iterable, Sequence
REPO_ROOT = Path(__file__).resolve().parents[2]
@@@ -308,3 -308,3 +308,78 @@@ def load_repo_json
return json.loads(
read_repo_text(path, staged=staged, strict_staged=strict_staged, revision=revision)
)
++
++
++def run_git(args: Sequence[str], *, repo_root: Path = REPO_ROOT) -> str:
++ result = subprocess.run(
++ ["git", *args], cwd=repo_root, check=True, capture_output=True,
++ text=True, env=git_env(repo_root),
++ )
++ return result.stdout.strip()
++
++
++def _git_tree_entries(
++ revision: str | None,
++ paths: Sequence[str],
++ *,
++ repo_root: Path = REPO_ROOT,
++) -> dict[str, tuple[str, str]]:
++ """Mode and object ID for each committed or indexed path.
++
++ A path that does not exist there is simply absent from the result.
++ """
++ ids: dict[str, tuple[str, str]] = {}
++ for start in range(0, len(paths), 200):
++ chunk = list(paths[start : start + 200])
++ if revision is None:
++ command = ["ls-files", "--stage", "-z", "--", *chunk]
++ else:
++ command = ["ls-tree", "-r", "-z", revision, "--", *chunk]
++ output = run_git(["--literal-pathspecs", *command], repo_root=repo_root)
++ for entry in output.split("\0"):
++ meta, separator, path = entry.partition("\t")
++ if not separator:
++ continue
++ fields = meta.split()
++ ids[path] = (fields[0], fields[1] if revision is None else fields[2])
++ return ids
++
++
++def blob_ids(revision: str | None, paths: Sequence[str], *, repo_root: Path = REPO_ROOT) -> dict[str, str]:
++ return {path: entry[1] for path, entry in _git_tree_entries(revision, paths, repo_root=repo_root).items()}
++
++
++def merge_parents(*, commit: str | None, repo_root: Path = REPO_ROOT) -> list[str]:
++ """Parents beyond the first: the merge being concluded, or a merge commit's own."""
++ if commit:
++ return run_git(
++ ["rev-list", "--parents", "-n", "1", commit], repo_root=repo_root
++ ).split()[2:]
++ merge_head = Path(run_git(["rev-parse", "--git-path", "MERGE_HEAD"], repo_root=repo_root))
++ if not merge_head.is_absolute():
++ merge_head = repo_root / merge_head
++ if not merge_head.exists():
++ return []
++ return merge_head.read_text(encoding="utf-8").split()
++
++
++def merged_in_paths(
++ paths: Sequence[str],
++ *,
++ commit: str | None,
++ repo_root: Path = REPO_ROOT,
++) -> set[str]:
++ """Paths with exactly the same indexed or committed state as a merged parent.
++
++ Both object ID and mode must match. New resolutions, edits and mode changes
++ remain changes of the current commit. Inherited deletions also match.
++ """
++ parents = merge_parents(commit=commit, repo_root=repo_root)
++ if not parents or not paths:
++ return set()
++ new = _git_tree_entries(commit, paths, repo_root=repo_root)
++ inherited: set[str] = set()
++ for parent in parents:
++ theirs = _git_tree_entries(parent, paths, repo_root=repo_root)
++ inherited.update(path for path in paths if new.get(path) == theirs.get(path))
++ return inherited