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.

Supply the missing YAML parser for native macOS contracts

pulse-triage[bot]7a2209a78124
diff --git a/.github/workflows/unified-agent-native.yml b/.github/workflows/unified-agent-native.yml
index ff37901de0..5768a9ebef 100644
--- a/.github/workflows/unified-agent-native.yml
+++ b/.github/workflows/unified-agent-native.yml
@@ -148,6 +148,22 @@ jobs:
if: matrix.unix
run: go test -count=1 -timeout 3m -run '^TestIntegrationContainer' ./scripts/installtests
+ # The complete Go installer inventory also executes Python workflow
+ # contracts. Hosted macOS has Python but does not supply PyYAML; isolate
+ # that fixture prerequisite instead of skipping the registered proof or
+ # modifying Homebrew's externally managed interpreter.
+ - name: Supply YAML parser for native Unix contract checks
+ if: runner.os == 'macOS'
+ shell: bash
+ run: |
+ set -euo pipefail
+ contract_python="$(mktemp -d "$RUNNER_TEMP/pulse-contract-python.XXXXXX")"
+ python3 -m venv "$contract_python"
+ "$contract_python/bin/python3" -m pip install \
+ --disable-pip-version-check --no-input --only-binary=:all: 'PyYAML==6.0.3'
+ "$contract_python/bin/python3" -c 'import yaml; assert yaml.__version__ == "6.0.3"'
+ printf '%s\n' "$contract_python/bin" >> "$GITHUB_PATH"
+
- name: Supply GNU timeout for macOS guidance checks
if: runner.os == 'macOS'
shell: bash
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 63c8430e6c..e98a38e107 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -16,6 +16,20 @@
## Purpose
+### macOS native contract Python prerequisite
+
+The native Unix installer inventory invokes the registered frontend workflow
+contract through `python3`. Both hosted macOS architectures must supply PyYAML
+before that inventory: their standard Python does not include it. The workflow
+installs the fixed `PyYAML==6.0.3` binary distribution in an owned temporary
+virtual environment, checks its import/version and publishes only its bin path
+to subsequent steps. It does not alter Homebrew's interpreter or skip a test.
+Venv, acquisition or import failures stop before path publication. Linux and
+Windows keep their existing tools and all native checks/deadlines remain.
+`TestNativeMacOSContractPythonPrerequisite` executes the actual shell with
+bounded command doubles for success and each prerequisite failure; native
+macOS CI remains the real installation/execution proof.
+
### Duplicate-free Docker payload layers (29 October 2026)
The server runtime keeps its existing final binary bytes, cross-platform
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 6867dd2b74..a2d75f6856 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -5857,3 +5857,87 @@ func TestContainerPackagingProofIsReadOnlyAndSamePayload(t *testing.T) {
`records["result"] = "failed"`, `"merged_rootfs_regular_file_bytes"`,
)
}
+
+func TestNativeMacOSContractPythonPrerequisite(t *testing.T) {
+ content, err := os.ReadFile(repoFile(".github", "workflows", "unified-agent-native.yml"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var workflow struct {
+ Jobs map[string]struct {
+ Steps []struct{ Name, If, Run string }
+ }
+ }
+ if err := yaml.Unmarshal(content, &workflow); err != nil {
+ t.Fatal(err)
+ }
+ recipe := ""
+ for _, step := range workflow.Jobs["native-agent"].Steps {
+ if step.Name == "Supply YAML parser for native Unix contract checks" {
+ if step.If != "runner.os == 'macOS'" {
+ t.Fatal("Python acquisition is the missing macOS prerequisite, not a platform-wide tool replacement")
+ }
+ recipe = step.Run
+ }
+ if step.Name == "Test NAS removal contracts before frontend preparation" && recipe == "" {
+ t.Fatal("parser must be installed before the native contract inventory")
+ }
+ }
+ if recipe == "" || !strings.Contains(recipe, "--only-binary=:all: 'PyYAML==6.0.3'") ||
+ !strings.Contains(recipe, `assert yaml.__version__ == "6.0.3"`) {
+ t.Fatal("missing isolated fixed-version prerequisite and import check")
+ }
+ for _, fault := range []string{"", "venv", "pip", "import"} {
+ t.Run("failure="+fault, func(t *testing.T) {
+ root := t.TempDir()
+ tools := filepath.Join(root, "tools")
+ if err := os.Mkdir(tools, 0700); err != nil {
+ t.Fatal(err)
+ }
+ python := `#!/bin/sh
+set -eu
+if [ "$1 $2" = '-m venv' ]; then
+ [ "$FAULT" != venv ] || exit 21
+ mkdir -p "$3/bin"
+ cp "$0" "$3/bin/python3"
+ exit 0
+fi
+if [ "$1 $2" = '-m pip' ]; then
+ [ "$FAULT" != pip ] || exit 22
+ printf '%s\n' "$*" > "$INSTALL_ARGS"
+ exit 0
+fi
+[ "$1" = -c ] || exit 90
+[ "$FAULT" != import ] || exit 23
+printf '%s\n' "$2" > "$IMPORT_CODE"
+`
+ if err := os.WriteFile(filepath.Join(tools, "python3"), []byte(python), 0700); err != nil {
+ t.Fatal(err)
+ }
+ path := filepath.Join(root, "github-path")
+ cmd := exec.Command("bash", "--noprofile", "--norc", "-c", recipe)
+ cmd.Env = append(os.Environ(), "PATH="+tools+string(os.PathListSeparator)+os.Getenv("PATH"),
+ "RUNNER_TEMP="+root, "GITHUB_PATH="+path, "FAULT="+fault,
+ "INSTALL_ARGS="+filepath.Join(root, "install-args"), "IMPORT_CODE="+filepath.Join(root, "import-code"))
+ output, err := cmd.CombinedOutput()
+ if (err == nil) != (fault == "") {
+ t.Fatalf("prerequisite exit: %v\n%s", err, output)
+ }
+ published, readErr := os.ReadFile(path)
+ if fault != "" {
+ if readErr == nil && len(published) != 0 {
+ t.Fatalf("failed prerequisite published a usable path: %q", published)
+ }
+ return
+ }
+ if readErr != nil || !strings.HasPrefix(string(published), root+"/pulse-contract-python.") ||
+ !strings.HasSuffix(string(published), "/bin\n") {
+ t.Fatalf("missing exact venv path: %q, %v", published, readErr)
+ }
+ installed, err := os.ReadFile(filepath.Join(root, "install-args"))
+ if err != nil || !strings.Contains(string(installed), "--only-binary=:all: PyYAML==6.0.3") {
+ t.Fatalf("wrong prerequisite install: %q, %v", installed, err)
+ }
+ })
+ }
+}
diff --git a/scripts/tests/test_container_packaging.py b/scripts/tests/test_container_packaging.py
index 814185de07..68d209ec7d 100644
--- a/scripts/tests/test_container_packaging.py
+++ b/scripts/tests/test_container_packaging.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
"""Packaging's normal smoke-suite controls; no Docker daemon is used here."""
+import base64
+import contextlib
import hashlib
import importlib.util
import io
@@ -8,6 +10,7 @@ import subprocess
import tarfile
import tempfile
import unittest
+from unittest.mock import patch
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
@@ -83,6 +86,56 @@ class InventoryTests(unittest.TestCase):
packaging.stream_command(['sh', '-c', 'printf partial; exit 19'], lambda f: f.read())
+class DownloadConsumerTests(unittest.TestCase):
+ def test_actual_consumer_checks_every_body_and_both_sidecars(self):
+ # Execute the exact in-container consumer, substituting only its file
+ # root and HTTP transport. This is not a real-image/startup result.
+ for fault in ['', 'body', 'checksum', 'ed25519', 'sshsig', 'sidecar-mode']:
+ with self.subTest(fault=fault), tempfile.TemporaryDirectory() as tmp:
+ root = Path(tmp)
+ linux = ['linux-'+a for a in ['amd64','arm64','armv7','armv6','386']]
+ files = {}
+ for family, arches in [('pulse-agent', linux+['darwin-amd64','darwin-arm64',
+ 'freebsd-amd64','freebsd-arm64','windows-amd64','windows-arm64','windows-386']),
+ ('pulse-agent-helper', linux), ('pulse-agent-runner', linux)]:
+ for arch in arches:
+ name = family+'-'+arch+('.exe' if arch.startswith('windows-') else '')
+ files['/download/'+family+'?arch='+arch] = root/'bin'/name
+ for name in ['install.sh','install.ps1']:
+ files['/'+name] = root/'scripts'/name
+ for path in files.values():
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_bytes(path.name.encode())
+ path.chmod(0o755)
+ for suffix in ['.sig','.sshsig']:
+ sidecar = Path(str(path)+suffix)
+ sidecar.write_bytes(('signature-'+path.name+suffix).encode())
+ sidecar.chmod(0o755 if fault == 'sidecar-mode' else 0o644)
+ called = []
+ def fetch(url, timeout):
+ route = url.removeprefix('http://127.0.0.1:7655')
+ path = files[route]
+ called.append(route)
+ response = io.BytesIO(path.read_bytes() if fault != 'body' else b'wrong')
+ response.headers = {
+ 'X-Checksum-Sha256': hashlib.sha256(path.read_bytes()).hexdigest() if fault != 'checksum' else 'wrong',
+ 'X-Signature-Ed25519': Path(str(path)+'.sig').read_text() if fault != 'ed25519' else 'wrong',
+ 'X-Signature-SSHSIG': base64.b64encode(Path(str(path)+'.sshsig').read_bytes()).decode() if fault != 'sshsig' else 'd3Jvbmc=',
+ }
+ return response
+ code = packaging.DOWNLOAD_CHECK.replace("'/opt/pulse'", repr(str(root)))
+ capture = io.StringIO()
+ with patch('urllib.request.urlopen', side_effect=fetch), contextlib.redirect_stdout(capture):
+ if fault:
+ with self.assertRaises(AssertionError):
+ exec(compile(code, '<packaging-download-consumer>', 'exec'), {})
+ else:
+ exec(compile(code, '<packaging-download-consumer>', 'exec'), {})
+ self.assertEqual(set(called), set(files))
+ self.assertEqual(len(called), 24)
+ self.assertEqual(len(json.loads(capture.getvalue())), 24)
+
+
class DockerfileTests(unittest.TestCase):
@classmethod
def setUpClass(cls):