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.

Preserve backend receipt compatibility and failed-write evidence

pulse-triage[bot]bd904da5b2b5
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index fc8ca94abe..ae5d0a6e90 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -1721,6 +1721,10 @@ separate observations. All children must still return zero for the check to pass
`run_go_package_slice_test.py` drives the actual queue with a held first child,
an early exit-nine child and a successful sibling, checking readable incomplete
snapshots, source-ordered final results and an unchanged failing aggregate.
+Its interrupted-write control preserves the previous JSON snapshot, and a real
+missing-executable control completes result collection without claiming process
+execution or granting a passing check. The final ordered-list verdict remains
+compatible with the current stable's source-contract assertions.
Documentation-only changes retain the original explicit
runtime-inapplicable results and required check names.
diff --git a/scripts/release_control/run_go_package_slice_test.py b/scripts/release_control/run_go_package_slice_test.py
index f3d03b50fd..3316693154 100644
--- a/scripts/release_control/run_go_package_slice_test.py
+++ b/scripts/release_control/run_go_package_slice_test.py
@@ -535,6 +535,46 @@ sys.exit(0 if release.exists() else 13)
self.assertEqual([task['exit'] for task in final['tasks']], [0, 9, 0])
self.assertEqual(list(output.glob('.ordinary-packages-*')), [])
+ def test_a_failed_snapshot_write_preserves_the_previous_complete_json(self):
+ spec = importlib.util.spec_from_file_location('atomic_rest_shard', SHARD)
+ shard = importlib.util.module_from_spec(spec); spec.loader.exec_module(shard)
+ with tempfile.TemporaryDirectory() as temporary:
+ output = Path(temporary)
+ names = [runner.MODULE + 'internal/observed', runner.MODULE + 'internal/unobserved']
+ results = {names[0]: {'package': names[0], 'started': True, 'exit': 9, 'seconds': .01}}
+ shard.retain_results(output, 0, names, results, time.monotonic())
+ receipt = output / 'ordinary-packages.json'
+ previous = receipt.read_bytes()
+ def broken_write(value, stream, **kwargs):
+ stream.write('{"incomplete":')
+ raise OSError('test-only incomplete snapshot write')
+ with patch.object(shard.json, 'dump', side_effect=broken_write), self.assertRaises(OSError):
+ shard.retain_results(output, 0, names, results, time.monotonic())
+ self.assertEqual(receipt.read_bytes(), previous)
+ self.assertEqual(json.loads(previous)['tasks'][0]['exit'], 9)
+ self.assertEqual(list(output.glob('.ordinary-packages-*')), [])
+
+ def test_start_failure_is_incomplete_execution_not_an_observed_shell_exit(self):
+ spec = importlib.util.spec_from_file_location('start_rest_shard', SHARD)
+ shard = importlib.util.module_from_spec(spec); spec.loader.exec_module(shard)
+ with tempfile.TemporaryDirectory() as temporary:
+ output = Path(temporary)
+ names = [runner.MODULE + 'internal/not-started']
+ argv = [str(SHARD), '--index', '0', '--output', str(output),
+ '--ordinary-command', shard.ORDINARY_COMMAND]
+ with patch.object(shard, 'ordinary_packages', return_value=names), \
+ patch.object(shard, 'tasks', return_value=[(names[0], [str(output / 'absent-command')])]), \
+ patch.object(sys, 'stdin', io.StringIO(names[0] + '\n')), \
+ patch.object(sys, 'argv', argv), \
+ contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
+ self.assertEqual(shard.main(), 1)
+ receipt = json.loads((output / 'ordinary-packages.json').read_text())
+ self.assertTrue(receipt['collection_complete'])
+ self.assertEqual(receipt['unobserved_packages'], [])
+ self.assertFalse(receipt['tasks'][0]['started'])
+ self.assertIsNone(receipt['tasks'][0]['exit'])
+ self.assertEqual(receipt['tasks'][0]['start_error_errno'], 2)
+
def test_helpers_are_part_of_the_exact_main_controls_copied_to_patches(self):
stable_patch = (ROOT / 'scripts/release_control/stable_patch.py').read_text()
self.assertIn('"scripts/release_control"', stable_patch)
diff --git a/scripts/release_control/run_go_rest_shard.py b/scripts/release_control/run_go_rest_shard.py
index c3b1ef6720..faaad6f41e 100644
--- a/scripts/release_control/run_go_rest_shard.py
+++ b/scripts/release_control/run_go_rest_shard.py
@@ -128,18 +128,21 @@ def main() -> int:
start = time.monotonic()
admitted = tasks(packages, args.index, args.output, args.ordinary_command)
planned = [name for name, _ in admitted]
- results = {}
- retain_results(args.output, args.index, planned, results, start)
+ observed = {}
+ retain_results(args.output, args.index, planned, observed, start)
# Drain every admitted task even when a sibling fails. Collect in completion
# order so a slow first task cannot hide already returned results. Retained
# snapshots still use source order, including the final legacy tasks list.
with ThreadPoolExecutor(max_workers=SLOTS) as pool:
futures = {pool.submit(run_task, task): task[0] for task in admitted}
for future in as_completed(futures):
- results[futures[future]] = future.result()
- retain_results(args.output, args.index, planned, results, start)
- retain_results(args.output, args.index, planned, results, start, complete=True)
- return 0 if all(result["exit"] == 0 for result in results.values()) else 1
+ observed[futures[future]] = future.result()
+ retain_results(args.output, args.index, planned, observed, start)
+ retain_results(args.output, args.index, planned, observed, start, complete=True)
+ # Keep the final ordered list and verdict recipe compatible with source
+ # contracts on the current stable when these main controls are copied.
+ results = [observed[name] for name in planned]
+ return 0 if all(result["exit"] == 0 for result in results) else 1
if __name__ == "__main__":