From 314f90d3fd5181ca546641f273283f3c7fc45346 Mon Sep 17 00:00:00 2001 From: diviocity Date: Tue, 1 Dec 2026 02:26:20 +0100 Subject: [PATCH] Verify that each release feed covers both runtime roots --- tests/FEED.md | 9 ++++ tests/release-runtime-closure.py | 78 ++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 tests/release-runtime-closure.py diff --git a/tests/FEED.md b/tests/FEED.md index 0951520..c5abb15 100644 --- a/tests/FEED.md +++ b/tests/FEED.md @@ -211,6 +211,15 @@ The full amd64 candidate inputs passed the release driver's input checker for Vi The matching arm64 inputs passed with a 69-package installed desktop and 152 signed offline packages. The prepared initramfs SHA-256 is `e0e73713401c4706ff3d316b545010993c7cd291c5d9b5ef03d67ae0a700185a`. See `foundation/ports-candidate-inputs-01/arm64`, receipt SHA-256 `2f407d9b90413f0648bb44a0a443a8a22bb9a1555cfd1652d93d40a37a7c12fd`. +Run the closure check against the matching source plan and the already audited clients. It checks every seed version and archive digest against the verified source coverage and compares both installed version sets with the planned runtime dependencies. + +```sh +python3 tests/release-runtime-closure.py "$plan" "$coverage" "$repo/packages.tsv" \ + "$desktop_client" "$desktop_x11_client" "$report" +``` + +Both cold installs match their respective 70-package or 69-package desktop closure and the 138-package desktop and X11 closure. Each signed offline feed carries the complete runtime closure and 14 extra packages. The six other verified outputs are `busybox-bootstrap`, `elfutils`, `encodings`, `pkgconf`, `spirv-tools` and `util-macros`. The five with Alpine counterparts had no file matches in the published image or sidecar inventory. The worker rejected a missing X11 metapackage, a changed seed digest and a desktop-only client supplied for the X11 root. See `foundation/release-runtime-closure-01`, receipt SHA-256 `b82a76b60a01c45712d34823d033ebba793d5cd7ddad96540a7cba9ce99e8c18`. + The worker stores each prepared input directory in `inputs.sqfs`. It compared every file byte for byte with the original on a read-only mount and rechecked `inputs/SHA256SUMS` before freeing the raw copies. To replay without a mount, verify `compact-filesystem.sha256`, unpack the image with `unsquashfs -d "$output" inputs.sqfs`, and verify `SHA256SUMS` in the extracted directory. The compact storage receipt SHA-256 values are `66f093bc6d841c3d2593b02307fa7039551b249cedc1d5d314ae5c3486b624e0` for amd64 and `043fee4d6dea91c3c277dc62ee28cfe95c4c8ce5aa4431fe7a03587efef3bc61` for arm64. Both full release ISOs passed the streamed comparison against their respective prepared initramfs files, including the image identifiers. The candidate manifest lists SHA-256 `57f8d17a7bcbd675113b121e9f2234954b6c8c0cef7de226e702e22423882515` for `vinix-amd64.iso` and `c918af6fa4006eddd44ba6eaf69f66f79b4b7351c22c9c95f2b95cbf0df4d3f4` for `vinix-arm64.iso`. See `foundation/ports-candidate-embedded-inputs-01`, receipt SHA-256 `9dc3c348677731c6fea75093f39453b3961d4d08c008363a48458c925d34b75f`. diff --git a/tests/release-runtime-closure.py b/tests/release-runtime-closure.py new file mode 100644 index 0000000..2b313dd --- /dev/null +++ b/tests/release-runtime-closure.py @@ -0,0 +1,78 @@ +"""Compare a signed release feed and its cold clients with the source plan.""" + +import argparse +import csv +from importlib import import_module +from pathlib import Path +import sys + + +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tools")) +release_feed = import_module("release-feed") +package_fields = import_module("stage-image").package_fields + + +def index(rows, name_field): + named = {} + for row in rows: + name = row[name_field] + if name in named: + raise ValueError(f"duplicate package record: {name}") + named[name] = row + return named + + +def check_client(path, expected): + actual = index((package_fields(file.read_text()) for file in (path / "db/local").glob("*/desc")), + "NAME") + missing = sorted(expected.keys() - actual.keys()) + extra = sorted(actual.keys() - expected.keys()) + changed = sorted(name for name in expected.keys() & actual.keys() + if expected[name]["version"] != actual[name]["VERSION"]) + if missing or extra or changed: + raise ValueError(f"{path}: missing {missing}, extra {extra}, changed versions {changed}") + + +def check(args): + packages = index(release_feed.records(args.coverage), "package") + planned = index(release_feed.records(args.plan / "order.tsv"), "package") + if packages.keys() != planned.keys() or not packages: + raise ValueError("archive coverage does not match the source plan") + for name, row in packages.items(): + if row["status"] != "verified" or row["version"] != planned[name]["version"]: + raise ValueError(f"source plan has no verified archive for {name} {planned[name]['version']}") + + desktop_root = "vinix-release-desktop" + x11_root = "vinix-release-x11" + desktop = release_feed.runtime_packages(args.plan, args.coverage, [desktop_root]) + graphics = release_feed.runtime_packages(args.plan, args.coverage, [desktop_root, x11_root]) + feed = index(release_feed.records(args.feed), "name") + missing = sorted(graphics.keys() - feed.keys()) + if missing: + raise ValueError(f"signed seed omits runtime packages: {missing}") + for name, row in feed.items(): + source = packages.get(name) + if not source or (row["version"], row["archive"], row["sha256"]) != ( + source["version"], Path(source["archive"]).name, source["archive_sha256"]): + raise ValueError(f"signed seed archive differs from verified coverage: {name}") + check_client(args.desktop, desktop) + check_client(args.graphics, graphics) + + with args.output.open("x", newline="") as stream: + writer = csv.writer(stream, delimiter="\t", lineterminator="\n") + writer.writerow(("package", "version", "desktop", "desktop_x11", "signed_seed", "archive_sha256")) + for name, row in sorted(packages.items()): + writer.writerow((name, row["version"], int(name in desktop), int(name in graphics), + int(name in feed), row["archive_sha256"])) + print(f"{len(packages)} verified outputs, {len(feed)} signed seed packages, " + f"{len(desktop)} desktop packages, {len(graphics)} desktop and X11 packages") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + for arg in ("plan", "coverage", "feed", "desktop", "graphics", "output"): + parser.add_argument(arg, type=Path) + try: + check(parser.parse_args()) + except (OSError, ValueError, KeyError) as error: + parser.exit(1, f"{error}\n") -- 2.56.1