fix: name why a narrowed pack was refused

The consistency step printed only that the builder wrote no pack: the refusal went to the stdout it discarded. It now prints the reason the outcome carries.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 02:26:45 +01:00
1 parent d8570c6480
commit dd76142a9c
2 files changed
+22 -1

No files matched your search

+1 -1
View File
@@ -135,7 +135,7 @@ def check_narrowed_packs(
name = f"{platform} {label}"
if report is None:
# The builder declines a system no core of the platform runs.
print(f" {name}: the builder wrote no pack")
print(f" {name}: the builder wrote no pack: {built.refusal}")
all_ok = False
continue
credited = set(report["pack_destinations"])
+21
View File
@@ -236,6 +236,27 @@ class EveryNarrowingIsCompared(unittest.TestCase):
source = script_source("pipeline.py")
self.assertIn("ok = check_narrowed_packs(", source)
def test_a_refused_pack_names_the_reason(self):
"""The builder's refusal went into a discarded stdout: the step said
only that no pack was written."""
from unittest import mock
from orchestrate import narrowed
from packs import platformpack
refused = platformpack.PlatformPackOutcome(zip_path=None, refusal="no core runs x")
inputs = ({}, {}, {}, {}, [(["p"], "p")])
printed = io.StringIO()
with mock.patch.object(narrowed, "comparison_inputs", return_value=inputs), \
mock.patch.object(narrowed, "narrowed_variants",
return_value=[("--system x", {"system_filter": ["x"]})]), \
mock.patch("model.platforms.load_platform_config", return_value={}), \
mock.patch.object(platformpack, "build_platform_pack", return_value=refused), \
contextlib.redirect_stdout(printed):
self.assertFalse(narrowed.check_narrowed_packs())
self.assertIn("p --system x: the builder wrote no pack: no core runs x",
printed.getvalue())
class ThePipelineComparesPaths(unittest.TestCase):
"""Equal counts, other paths: the comparison fails and names both sides."""