diff --git a/README.md b/README.md index a2f4f3a..90f2557 100644 --- a/README.md +++ b/README.md @@ -259,6 +259,12 @@ only. ## Offline runtime and TLS +The 1.10.0 image uses Debian 13 (trixie), with the glibc 2.41 family and GCC 14. +This runtime floor supplies `__isoc23_strtol`, required by the immutable amd64 +engine library; bookworm's glibc 2.36 cannot load that library. Engine, codegen +and HPO remain at 1.10.0, with unchanged producer artifact SHA-256 pins. +The engine asset triples remain `linux-x86_64` and `linux-aarch64`. + The image is offline by design. The [backtest entrypoint](docker/entrypoint.sh) transpiles and compiles locally using bundled code and mounted inputs, with no runtime network fetch. The [release smoke](scripts/release_smoke.py) runs the @@ -315,6 +321,16 @@ its bundle attached to an earlier or dedicated release before its first publish, because the guard looks up the holding release by tag before the new tag's GitHub Release exists. +Set-17 mirrors the trixie image's 72 source/version pairs at `v1.4.0` with `set-17.SOURCES.list` (set-id `76b31d334dc701427d36bbd034b463bdd69101b3bb34e67aa9569bd892d6994a`). +The trixie image needs a new source set derived from both native image inventories. +The existing bookworm sets do not establish its source coverage. Publication +still requires equal amd64/arm64 source/version sets, every exact source archive, +and a verified published list and asset mirror before adding a registry row. +The six toolchain pins map to `gcc-defaults` 1.220, `gcc-14` 14.2.0-19, +`binutils` 2.44-3, `eigen3` 3.4.0-5, `cmake` 3.31.6-2 and `make-dfsg` 4.4.1-2. +CMake and make remain build-only; the final inventories determine the complete +runtime source set, including glibc and all other base and dependency packages. + ## License The files in this repository (Dockerfile, entrypoint, scripts, workflows, tests) @@ -353,24 +369,28 @@ to 1.0.0 carry `Apache-2.0`. ## Harness / engine ABI -`scripts/sync-harness.sh ` vendors exactly twelve engine runtime +`scripts/sync-harness.sh ` vendors exactly sixteen engine runtime harness files into `docker/` from the pinned `pineforge-engine` tag, in sorted order: - `bind_compiled_inventory.py` - `entrypoint.sh` - `pf_bars.py` - `pf_sink.py` +- `pineforge_report_deadlines.py` +- `pineforge_report_supervise.py` - `pineforge_sink_finalize.py` - `pineforge_sink_to_json.py` +- `quota_columns.py` - `request_feed_inventory.py` - `run_execution_observer.py` - `run_json.py` - `run_phase_transport.py` +- `run_quota.py` - `selected_window_plan.py` - `selected_window_report.py` `handle-upstream.yml` syncs those files and regenerates `docker/HARNESS-SHA256SUMS` -for the engine version it releases. The Dockerfile requires the same twelve names +for the engine version it releases. The Dockerfile requires the same sixteen names and checks their installed bytes against the sums. It also refuses to build when `docker/run_json.py`'s `EXPECTED_PF_ABI` differs from `PF_ABI_VERSION` in the bundled engine headers. @@ -407,8 +427,8 @@ its recorded equity and trade rows. The fixture provenance is documented in `docker build` without `--target`, using `docker/Dockerfile`, builds the backtest image: the last `default` stage aliases the runtime, `release`. -The default image differs from 1.5.0 only by the source notice, the two source -labels and the retained Debian package copyright files. +The 1.10.0 packaging refresh moves every Debian-based stage to trixie and replaces +bookworm's GCC 12 pins with GCC 14; the checked harness and entrypoint stay unchanged. `ENGINE_VERSION`, `CODEGEN_VERSION` and `GUARD_POLICY_SETS_SHA256` are required for that build, and its entrypoint remains `/opt/pineforge/bin/entrypoint.sh`. The guard policy value is read from `docker/GUARD-POLICY-SETS.pin`, computed privately and never re-derived here; the image records it in the `io.pineforge.guard.policy-sets-sha256` label and in `/opt/pineforge/guard-policy.sha256`. @@ -424,7 +444,7 @@ The artifact cache is writable by the image's existing user; use `--cache-dir` with a writable mount to retain compiled artifacts between containers. With no first argument `hpo`, the dispatcher passes every argument unchanged -to the engine's existing `/opt/pineforge/bin/entrypoint.sh`. The twelve engine +to the engine's existing `/opt/pineforge/bin/entrypoint.sh`. The sixteen engine harness files and their byte and ABI checks remain in place. For `--target hpo`, `HPO_VERSION` is a required build argument with no default, @@ -440,8 +460,8 @@ Publishing validates both bound artifact digests before passing is checked against the sdist digest before extraction and compilation. These per-release artifact pins are declared in `scripts/release_sources.py`, separate from the six Debian toolchain versions below. -This change merges without a release; the first publish carrying HPO is the -1.6.0 lockstep. HPO 0.15.0 is the fixture for the signed box proof. +The 1.10.0 engine/codegen/HPO producer triple and both HPO artifact pins stay +unchanged by the Debian packaging refresh. The box must supply exact Debian package versions through these required build arguments; no toolchain version has been guessed: @@ -449,18 +469,18 @@ build arguments; no toolchain version has been guessed: | Build argument | Packages | |---|---| | `HPO_GCC_DEFAULTS_VERSION` | `gcc`, `g++`, `cpp` | -| `HPO_GCC_VERSION` | `gcc-12`, `g++-12`, `cpp-12`, `libgcc-12-dev`, `libstdc++-12-dev`, `libgcc-s1`, `libstdc++6` | +| `HPO_GCC_VERSION` | `gcc-14`, `g++-14`, `cpp-14`, `libgcc-14-dev`, `libstdc++-14-dev`, `libgcc-s1`, `libstdc++6` | | `HPO_BINUTILS_VERSION` | `binutils` | | `HPO_EIGEN_VERSION` | `libeigen3-dev` | | `HPO_CMAKE_VERSION` | `cmake` (native build only) | | `HPO_MAKE_VERSION` | `make` (native build only) | `docker/hpo-toolchain.args` records those six pins as plain `NAME=VALUE` lines, -with comments and blank lines allowed, and no shell syntax. The values were -recorded by a signed box run (and a value left empty is reported by the tests as -an unfilled skip); the publish workflow reads the file and passes the -values as build arguments for `--target hpo`. The Dockerfile uses build -arguments only. The default target does not need this file or its arguments. +with comments and blank lines allowed, and no shell syntax. The trixie values +come from public Debian metadata for both amd64 and arm64; native validation +is pending. The publish parser rejects empty values; the historical test helper +discloses an empty value as an unfilled skip, which is never proof. Publishing +passes all six arguments to `--target hpo`; the default target does not need them. The installed wheels' own `*.dist-info/licenses/` files are also copied to `/opt/pineforge/licenses/pineforge-hpo/` (`LICENSE`, `NOTICE` and @@ -486,9 +506,10 @@ wheel for an offline run; otherwise the test fetches it from PyPI and verifies PyPI's digest. The same build helper must reject 0.13.2 because its real `pineforge-codegen<1.4,>=1.1.0` bound excludes 1.5.0, then resolve 0.15.0 without changing codegen. The tests also compute each target's stage dependencies, -compare `release` with the original runtime at `989a0fd9~1`, and check dispatcher +compare `release` with the historical runtime digest, allowing the exact trixie +base change, and check dispatcher argv and exit status, the unchanged harness check, a forced licence mutation -and the README pair-rule bytes against `origin/main`. The args-file tests +and the pinned README pair-rule bytes. The args-file tests compare its names with the real Dockerfile's toolchain declarations and required guards, reject malformed or duplicate entries, and report empty values as a named `unfilled toolchain versions` skip until the box fills them. diff --git a/docker/Dockerfile b/docker/Dockerfile index 76e4697..f37e78e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -28,7 +28,7 @@ ARG ENGINE_VERSION ARG CODEGEN_VERSION # --- Stage 1: stage the pure-Python transpiler (final image carries no pip) --- -FROM debian:bookworm-slim AS codegen +FROM debian:trixie-slim AS codegen ARG CODEGEN_VERSION RUN test -n "${CODEGEN_VERSION}" || { echo "ERROR: CODEGEN_VERSION build-arg is required (CI resolves it)" >&2; exit 1; } RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -38,7 +38,7 @@ RUN pip3 install --break-system-packages --no-cache-dir -U \ --target /opt/codegen "pineforge-codegen==${CODEGEN_VERSION}" # --- Stage 2: fetch + verify the engine static-lib tarball (per build arch) --- -FROM debian:bookworm-slim AS engine +FROM debian:trixie-slim AS engine ARG ENGINE_VERSION ARG TARGETARCH RUN test -n "${ENGINE_VERSION}" || { echo "ERROR: ENGINE_VERSION build-arg is required (CI resolves it)" >&2; exit 1; } @@ -63,7 +63,7 @@ RUN set -eux; \ cp -r "/tmp/${base}/include" /opt/pineforge/include # --- Stage 3: final = toolchain + engine lib + codegen + harness -------------- -FROM debian:bookworm-slim AS release +FROM debian:trixie-slim AS release ARG ENGINE_VERSION ARG CODEGEN_VERSION ARG GUARD_POLICY_SETS_SHA256 @@ -221,10 +221,10 @@ RUN set -eu; \ cp -r "$1/." /opt/hpo-licenses/pineforge-codegen/ # --- HPO toolchain: shared by the native build and the FULL runtime ----------- -# No guessed package versions: the box supplies these exact Debian pins for -# both architectures. gcc/g++/cpp are the bookworm GCC-12 defaults; the compiler +# Exact Debian trixie pins for both architectures come from public package +# metadata in hpo-toolchain.args. gcc/g++/cpp are the GCC-14 defaults; the compiler # and libstdc++ packages share HPO_GCC_VERSION. CMake/make stay build-only. -FROM debian:bookworm-slim AS hpo-toolchain +FROM debian:trixie-slim AS hpo-toolchain ARG HPO_GCC_DEFAULTS_VERSION ARG HPO_GCC_VERSION ARG HPO_BINUTILS_VERSION @@ -237,11 +237,11 @@ RUN set -eu; \ apt-get update; \ apt-get install -y --no-install-recommends \ "gcc=${HPO_GCC_DEFAULTS_VERSION}" "g++=${HPO_GCC_DEFAULTS_VERSION}" "cpp=${HPO_GCC_DEFAULTS_VERSION}" \ - "gcc-12=${HPO_GCC_VERSION}" "g++-12=${HPO_GCC_VERSION}" "cpp-12=${HPO_GCC_VERSION}" \ - "libgcc-12-dev=${HPO_GCC_VERSION}" "libstdc++-12-dev=${HPO_GCC_VERSION}" \ + "gcc-14=${HPO_GCC_VERSION}" "g++-14=${HPO_GCC_VERSION}" "cpp-14=${HPO_GCC_VERSION}" \ + "libgcc-14-dev=${HPO_GCC_VERSION}" "libstdc++-14-dev=${HPO_GCC_VERSION}" \ "libgcc-s1=${HPO_GCC_VERSION}" "libstdc++6=${HPO_GCC_VERSION}" \ "binutils=${HPO_BINUTILS_VERSION}" "libeigen3-dev=${HPO_EIGEN_VERSION}" python3; \ - for pkg in gcc g++ cpp gcc-12 g++-12 cpp-12 libgcc-12-dev libstdc++-12-dev libgcc-s1 libstdc++6 binutils libeigen3-dev; do \ + for pkg in gcc g++ cpp gcc-14 g++-14 cpp-14 libgcc-14-dev libstdc++-14-dev libgcc-s1 libstdc++6 binutils libeigen3-dev; do \ mkdir -p "/opt/pineforge/licenses/${pkg}"; \ cp -L "/usr/share/doc/${pkg}/copyright" "/opt/pineforge/licenses/${pkg}/copyright"; \ done; \ @@ -300,8 +300,8 @@ LABEL org.opencontainers.image.description="Full PineScript v6 -> deterministic # CMake, make, pip and the native build tree stay in the build stages. RUN apt-get update && apt-get install -y --no-install-recommends \ "gcc=${HPO_GCC_DEFAULTS_VERSION}" "g++=${HPO_GCC_DEFAULTS_VERSION}" "cpp=${HPO_GCC_DEFAULTS_VERSION}" \ - "gcc-12=${HPO_GCC_VERSION}" "g++-12=${HPO_GCC_VERSION}" "cpp-12=${HPO_GCC_VERSION}" \ - "libgcc-12-dev=${HPO_GCC_VERSION}" "libstdc++-12-dev=${HPO_GCC_VERSION}" \ + "gcc-14=${HPO_GCC_VERSION}" "g++-14=${HPO_GCC_VERSION}" "cpp-14=${HPO_GCC_VERSION}" \ + "libgcc-14-dev=${HPO_GCC_VERSION}" "libstdc++-14-dev=${HPO_GCC_VERSION}" \ "libgcc-s1=${HPO_GCC_VERSION}" "libstdc++6=${HPO_GCC_VERSION}" \ "binutils=${HPO_BINUTILS_VERSION}" "libeigen3-dev=${HPO_EIGEN_VERSION}" \ && rm -rf /var/lib/apt/lists/* /usr/share/man /usr/share/locale /usr/share/info diff --git a/docker/LICENSE-SHA256SUMS b/docker/LICENSE-SHA256SUMS index 48a07e1..9fa9f50 100644 --- a/docker/LICENSE-SHA256SUMS +++ b/docker/LICENSE-SHA256SUMS @@ -1,15 +1,15 @@ -a81bdd422c2c015deca84bf6ad249bf0d7d19885fc01d1894463291b0b7313e1 binutils/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 cpp-12/copyright +20a9818b14f941467bcc0f459a1b1951e3bfecc1cc259e5004f8b9a80d7dc804 binutils/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 cpp-14/copyright 156004744edbf17a975f0004ac4a9295b160ab403d646c445235711255ca9ff8 cpp/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 g++-12/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 g++-14/copyright 156004744edbf17a975f0004ac4a9295b160ab403d646c445235711255ca9ff8 g++/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 gcc-12/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 gcc-14/copyright 156004744edbf17a975f0004ac4a9295b160ab403d646c445235711255ca9ff8 gcc/copyright d86a43829b598ef251601455af9c6a05027aec31f6380266890ea016c7ba5fb7 libeigen3-dev/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 libgcc-12-dev/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 libgcc-s1/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 libstdc++-12-dev/copyright -da8191658b3452ce9caf31638ba61dab31a38c619fa39df119812e050f592fd3 libstdc++6/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 libgcc-14-dev/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 libgcc-s1/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 libstdc++-14-dev/copyright +20390f8a6f3b1e4d7cb45dd8652dabb259bbef688cbad839bcdb0b9ba7252f79 libstdc++6/copyright 5f43346a79228e0ee266ea08efc6e2106d64afa9255fc360cc329903268f720e pineforge-codegen/LICENSE 1aa95beed7fc0b368872fcd1bcf6a09a0f67ef3014b5e48ae21404cb647a1136 pineforge-hpo/LICENSE fb088c51cdd2b82f2ee6488730de8334310796f124046df9679dc1e96f744d1b pineforge-hpo/NOTICE diff --git a/docker/SOURCE-SETS.tsv b/docker/SOURCE-SETS.tsv index 4b063a8..f01f00c 100644 --- a/docker/SOURCE-SETS.tsv +++ b/docker/SOURCE-SETS.tsv @@ -16,3 +16,4 @@ de7a6dfdd2afa6f1c52df5c376e0975884510e8ce65a302d707562e44dff1349 v1.3.0 84 1ae78 0bab451a5fc075359bd98d347399301f46dbae1e5cdde88c5d29837e18305fdf v1.4.0 84 c1be8b7e847979081df6dab249038b1210c872e67e1e53229e58e37d672dfd71 set-14.SOURCES.list cb35339cfd799ec45d9d8f42eb4c86fd5ea53aa804e4de2be0cd8e2c47360f2f v1.4.0 84 5a21329c99f509860c3d7e924902510cc2eb4075de3663df21db3b26e225b1ca set-15.SOURCES.list cc43cbdfb3f1e7a182e5f07618d556f9824d5fe348f793cb13b41e7897641f57 v1.4.0 84 24c977c4eda0e56ecb495ef55bd8a7f8c966c8217bea89b3aefa4b0530475d5a set-16.SOURCES.list +76b31d334dc701427d36bbd034b463bdd69101b3bb34e67aa9569bd892d6994a v1.4.0 72 c8c640fc002564dca0db3a61178a9a45e15ba0420361f6cff44d184a7760c19a set-17.SOURCES.list diff --git a/docker/SOURCES.txt.in b/docker/SOURCES.txt.in index 8c0acaf..a546b72 100644 --- a/docker/SOURCES.txt.in +++ b/docker/SOURCES.txt.in @@ -1,5 +1,5 @@ -This image contains software from Debian GNU/Linux 12 (bookworm), including the GNU C/C++ -compiler (gcc/g++ 12.2.0) and GNU binutils 2.40, Eigen 3.4.0, and the Debian base system. +This image contains software from Debian GNU/Linux 13 (trixie), including the GNU C/C++ +compiler (gcc/g++ 14.2.0) and GNU binutils 2.44, Eigen 3.4.0, and the Debian base system. Each package is distributed under its own license, recorded in /usr/share/doc//copyright. The complete corresponding source code of every Debian package in this image, at the exact versions installed, is available at no charge from: diff --git a/docker/hpo-toolchain.args b/docker/hpo-toolchain.args index b8ff5af..3a95c80 100644 --- a/docker/hpo-toolchain.args +++ b/docker/hpo-toolchain.args @@ -1,24 +1,26 @@ # The build for --target hpo must pass these exact toolchain build arguments. # The default target does not need them. # This file is read as plain NAME=VALUE lines (no shell syntax). -# Values recorded by the signed box run of 2026-10-13 (apt-cache policy candidates in -# debian:bookworm-slim, uniform inside each package group; the installed versions in the built -# hpo image equal them). +# Values from Debian trixie main Packages metadata for amd64 and arm64, retrieved +# 2026-11-04; both indexes match the Debian 13.7 Release SHA256 entries. +# These replace bookworm's GCC-12 family; native build/runtime validation is pending. +# https://deb.debian.org/debian/dists/trixie/main/binary-amd64/Packages.xz +# https://deb.debian.org/debian/dists/trixie/main/binary-arm64/Packages.xz # Debian packages gcc, g++, cpp -HPO_GCC_DEFAULTS_VERSION=4:12.2.0-3 +HPO_GCC_DEFAULTS_VERSION=4:14.2.0-1 -# Debian packages gcc-12, g++-12, cpp-12, libgcc-12-dev, libstdc++-12-dev, libgcc-s1, libstdc++6 -HPO_GCC_VERSION=12.2.0-14+deb12u1 +# Debian packages gcc-14, g++-14, cpp-14, libgcc-14-dev, libstdc++-14-dev, libgcc-s1, libstdc++6 +HPO_GCC_VERSION=14.2.0-19 # Debian packages binutils -HPO_BINUTILS_VERSION=2.40-2 +HPO_BINUTILS_VERSION=2.44-3 # Debian packages libeigen3-dev -HPO_EIGEN_VERSION=3.4.0-4 +HPO_EIGEN_VERSION=3.4.0-5 # Debian packages cmake -HPO_CMAKE_VERSION=3.25.1-1 +HPO_CMAKE_VERSION=3.31.6-2 # Debian packages make -HPO_MAKE_VERSION=4.3-4.1 +HPO_MAKE_VERSION=4.4.1-2 diff --git a/tests/fixtures/GPL-NOTICE-v2.txt b/tests/fixtures/GPL-NOTICE-v2.txt new file mode 100644 index 0000000..3489cd8 --- /dev/null +++ b/tests/fixtures/GPL-NOTICE-v2.txt @@ -0,0 +1,8 @@ +This image contains software from Debian GNU/Linux 13 (trixie), including the GNU C/C++ +compiler (gcc/g++ 14.2.0) and GNU binutils 2.44, Eigen 3.4.0, and the Debian base system. +Each package is distributed under its own license, recorded in /usr/share/doc//copyright. +The complete corresponding source code of every Debian package in this image, at the exact +versions installed, is available at no charge from: + https://github.com/pineforge-4pass/pineforge-release/releases/tag/ +(file SOURCES.list lists every package, version and SHA-256). The same packages can also be +obtained from https://snapshot.debian.org/ under the names and versions listed. diff --git a/tests/test_release_docs_runtime.py b/tests/test_release_docs_runtime.py index 51a0070..0f14687 100644 --- a/tests/test_release_docs_runtime.py +++ b/tests/test_release_docs_runtime.py @@ -101,5 +101,41 @@ def test_missing_hpo_cache_sentence_is_rejected(self): self.assert_scratch_guidance(without_cache_sentence) +class TrixieRuntimeDocumentationTest(unittest.TestCase): + def setUp(self): + self.readme = (ROOT / "README.md").read_text(encoding="utf-8") + + def assert_trixie_guidance(self, text): + prose = " ".join(text.split()) + for required in ( + "Debian 13 (trixie), with the glibc 2.41 family and GCC 14", + "`__isoc23_strtol`", + "bookworm's glibc 2.36 cannot load that library", + "Engine, codegen and HPO remain at 1.10.0, with unchanged producer artifact SHA-256 pins", + "`linux-x86_64` and `linux-aarch64`", + "trixie image needs a new source set derived from both native image inventories", + "equal amd64/arm64 source/version sets", + "verified published list and asset mirror before adding a registry row", + "CMake and make remain build-only", + "native validation is pending", + "unfilled skip, which is never proof", + ): + self.assertIn(required, prose) + + def test_runtime_floor_unchanged_producers_and_pending_mirror_are_documented(self): + self.assert_trixie_guidance(self.readme) + + def test_wrong_runtime_floor_or_missing_producer_or_mirror_disclosure_is_rejected(self): + for fragment in ("Debian 13 (trixie)", "glibc 2.41", "remain at 1.10.0", + "unchanged producer artifact SHA-256 pins", + "verified published list and asset mirror", + "native validation\nis pending", "unfilled skip, which is never proof"): + with self.subTest(fragment=fragment): + mutated = self.readme.replace(fragment, "omitted", 1) + self.assertNotEqual(mutated, self.readme) + with self.assertRaises(AssertionError): + self.assert_trixie_guidance(mutated) + + if __name__ == "__main__": unittest.main() diff --git a/tests/test_release_hpo_image.py b/tests/test_release_hpo_image.py index ffba62a..2bb11c6 100644 --- a/tests/test_release_hpo_image.py +++ b/tests/test_release_hpo_image.py @@ -312,6 +312,15 @@ def _without_stage_alias(stage: DockerStage) -> str: r"\1", stage.text, count=1, flags=re.M | re.I) +def _restore_bookworm_runtime_base(text: str) -> str: + """Restore only the single approved FROM line for the historical digest.""" + lines = text.splitlines(keepends=True) + if (not lines or lines[0] != "FROM debian:trixie-slim\n" + or sum(line.startswith("FROM ") for line in lines) != 1): + raise ValueError("expected exactly one approved trixie runtime FROM line") + return "FROM debian:bookworm-slim\n" + "".join(lines[1:]) + + def _without_guard_policy(text: str) -> str: """Remove exactly the approved guard fragment before checking the historical runtime pin.""" argument = "ARG GUARD_POLICY_SETS_SHA256\n" @@ -437,6 +446,52 @@ def _require_filled_toolchain_arguments(arguments: dict[str, str]) -> None: + "; TO BE FILLED BY THE BOX RUN") +# Reviewed against both trixie Packages indexes, not inferred from one arch or +# from the installed host. These are packaging assertions, not runtime proof. +TRIXIE_TOOLCHAIN_PINS = { + "HPO_GCC_DEFAULTS_VERSION": "4:14.2.0-1", + "HPO_GCC_VERSION": "14.2.0-19", + "HPO_BINUTILS_VERSION": "2.44-3", + "HPO_EIGEN_VERSION": "3.4.0-5", + "HPO_CMAKE_VERSION": "3.31.6-2", + "HPO_MAKE_VERSION": "4.4.1-2", +} + + +def _trixie_packaging_problems(dockerfile: str, args_text: str) -> list[str]: + stages = _dockerfile_stages(dockerfile) + named = {stage.name: stage for stage in stages} + problems = [] + external = {stage.name: stage.base for stage in stages if stage.base not in named} + if external != dict.fromkeys(("codegen", "engine", "release", "hpo-toolchain"), + "debian:trixie-slim"): + problems.append("all four Debian bases must be exactly debian:trixie-slim") + if _read_toolchain_arguments(args_text) != TRIXIE_TOOLCHAIN_PINS: + problems.append("toolchain values must match the six reviewed trixie pins") + expected = { + **dict.fromkeys(("gcc", "g++", "cpp"), "HPO_GCC_DEFAULTS_VERSION"), + **dict.fromkeys(("gcc-14", "g++-14", "cpp-14", "libgcc-14-dev", + "libstdc++-14-dev", "libgcc-s1", "libstdc++6"), "HPO_GCC_VERSION"), + "binutils": "HPO_BINUTILS_VERSION", "libeigen3-dev": "HPO_EIGEN_VERSION", + } + for name in ("hpo-toolchain", "hpo", "hpo-native"): + stage = named[name] + pinned = ({"cmake": "HPO_CMAKE_VERSION", "make": "HPO_MAKE_VERSION"} + if name == "hpo-native" else expected) + packages = [f"{package}=${{{argument}}}" for package, argument in pinned.items()] + if name == "hpo-toolchain": + packages.append("python3") + elif name == "hpo-native": + packages.extend(("curl", "ca-certificates")) + installs = [match[1] for keyword, body in stage.instructions if keyword == "RUN" + for match in re.finditer( + r"apt-get install -y --no-install-recommends\s+(.+?)(?:;|&&)", body)] + if (len(installs) != 1 or shlex.split(installs[0]) != packages + or _pinned_packages(stage) != pinned): + problems.append(name + ": expected exactly the approved trixie package pins") + return problems + + class DockerfileTargetTest(unittest.TestCase): @classmethod def setUpClass(cls): @@ -489,14 +544,29 @@ def test_hpo_reaches_its_build_stages_and_requires_all_seven_arguments(self): def test_release_stage_matches_original_runtime_after_notice_and_harness_changes(self): text = _without_guard_policy(_without_sources_notice(_without_stage_alias(self.named["release"]))) + text = _restore_bookworm_runtime_base(text) text = _restore_original_doc_cleanup(text) text = _restore_original_harness_manifest(text) self.assertEqual(hashlib.sha256(text.encode("utf-8")).hexdigest(), self.ORIGINAL_RUNTIME_STAGE_SHA256, "after restoring the one /usr/share/doc token and removing the marked " - "notice and approved harness changes, release must remain " + "notice, exact trixie FROM line and approved harness changes, release must remain " "byte for byte the original runtime stage") + def test_runtime_base_normalization_refuses_other_from_changes(self): + text = _without_stage_alias(self.named["release"]) + restored = _restore_bookworm_runtime_base(text) + self.assertEqual(restored, text.replace("FROM debian:trixie-slim\n", + "FROM debian:bookworm-slim\n", 1)) + for replacement in ("FROM debian:bookworm-slim\n", "FROM debian:trixie\n", + "FROM debian:latest\n", "FROM ubuntu:24.04\n", + "FROM debian:trixie-slim AS release\n", + "FROM debian:trixie-slim\nFROM debian:trixie-slim\n"): + with self.subTest(replacement=replacement): + changed = text.replace("FROM debian:trixie-slim\n", replacement, 1) + with self.assertRaisesRegex(ValueError, "approved trixie runtime FROM line"): + _restore_bookworm_runtime_base(changed) + def test_original_harness_normalization_requires_all_added_modules(self): text = _without_sources_notice(_without_stage_alias(self.named["release"])) for name, copy_line in ( @@ -541,6 +611,7 @@ def test_notice_and_harness_changes_cannot_hide_other_instructions(self): stripped = _without_sources_notice(text) self.assertNotEqual(text, stripped) stripped = _without_guard_policy(stripped) + stripped = _restore_bookworm_runtime_base(stripped) stripped = _restore_original_doc_cleanup(stripped) stripped = _restore_original_harness_manifest(stripped) self.assertNotEqual(hashlib.sha256(text.encode("utf-8")).hexdigest(), @@ -573,7 +644,8 @@ def test_notice_and_harness_changes_cannot_hide_other_instructions(self): "RUN mkdir -p /opt/pineforge/bin /unexpected\n", 1) self.assertNotEqual(altered, text) normalized = _restore_original_harness_manifest( - _restore_original_doc_cleanup(_without_guard_policy(_without_sources_notice(altered)))) + _restore_original_doc_cleanup(_restore_bookworm_runtime_base( + _without_guard_policy(_without_sources_notice(altered))))) self.assertNotEqual(hashlib.sha256(normalized.encode("utf-8")).hexdigest(), self.ORIGINAL_RUNTIME_STAGE_SHA256) @@ -642,6 +714,39 @@ def test_plain_argument_file_matches_both_declared_args_and_required_guards(self self.assertNotIn("hpo-toolchain.args", stage.text, "the workflow reads this data file; Dockerfile stays build-arg driven") + def test_trixie_bases_and_matching_compiler_runtime_pins(self): + self.assertEqual(_trixie_packaging_problems(self.dockerfile, self.args_text), []) + + def test_mixed_suite_old_compiler_and_missing_or_mismatched_runtime_pins_are_rejected(self): + self.assertEqual(_trixie_packaging_problems(self.dockerfile, self.args_text), []) + runtime = next(stage for stage in _dockerfile_stages(self.dockerfile) if stage.name == "hpo") + mutations = [ + self.dockerfile.replace("FROM debian:trixie-slim AS engine", + "FROM debian:bookworm-slim AS engine", 1), + self.dockerfile.replace("FROM debian:trixie-slim", "FROM debian:latest"), + self.dockerfile.replace("gcc-14", "gcc-12"), + self.dockerfile.replace('"cmake=${HPO_CMAKE_VERSION}"', + '"cmake=${HPO_MAKE_VERSION}"', 1), + ] + pin = '"libstdc++6=${HPO_GCC_VERSION}"' + for replacement in ('"libstdc++6"', '"libstdc++6=${HPO_GCC_DEFAULTS_VERSION}"', "", + pin + " " + pin): + mutations.append(self.dockerfile.replace( + runtime.text, runtime.text.replace(pin, replacement, 1), 1)) + for index, mutated in enumerate(mutations): + with self.subTest(mutation=index): + self.assertNotEqual(mutated, self.dockerfile) + self.assertTrue(_trixie_packaging_problems(mutated, self.args_text)) + + def test_bookworm_empty_and_latest_values_cannot_replace_the_reviewed_trixie_pins(self): + for argument, value in TRIXIE_TOOLCHAIN_PINS.items(): + for replacement in ("", "latest", "12.2.0-14+deb12u1"): + with self.subTest(argument=argument, replacement=replacement): + mutated = self.args_text.replace(f"{argument}={value}", + f"{argument}={replacement}", 1) + self.assertNotEqual(mutated, self.args_text) + self.assertTrue(_trixie_packaging_problems(self.dockerfile, mutated)) + def test_argument_comments_name_the_packages_pinned_by_the_real_stages(self): stages = _dockerfile_stages(self.dockerfile) reached = _reachable_stages(stages, "hpo") @@ -964,13 +1069,6 @@ class ReadmePairRuleTest(unittest.TestCase): # this value in the same commit. PAIR_RULE_SHA256 = "35b72f7f5c7466cfc212a71eaf05df98f45e92411fd34a67bfff761556c61601" - # The converter documentation adds 30 lines to the previous 446-line layout. - # The offline runtime and TLS section adds 18 lines after the pair rule, for 494. - # The pair-rule digest above still covers the unchanged lines 215-244. - def test_runner_documentation_keeps_the_494_line_layout(self): - lines = (REPO / "README.md").read_bytes().splitlines(keepends=True) - self.assertEqual(len(lines), 494) - def test_lines_215_to_244_are_byte_identical_to_the_published_rule(self): lines = (REPO / "README.md").read_bytes().splitlines(keepends=True) self.assertGreaterEqual(len(lines), 244) diff --git a/tests/test_release_sources.py b/tests/test_release_sources.py index ea9a596..912fa50 100644 --- a/tests/test_release_sources.py +++ b/tests/test_release_sources.py @@ -135,6 +135,19 @@ def test_01_no_registered_set_is_refused(self): self.registry.write_text(REGISTRY_HEADER + "# no mirrors yet\n", encoding="utf-8") self.refused(self.check(), f"source set {_set_id(self.pairs)} is not in registry") + def test_trixie_defaults_source_version_cannot_reuse_a_bookworm_registry_row(self): + # The source is gcc-defaults 1.220, not the defaults binaries' epoch version. + updated = [(source, "1.220" if source == "gcc-defaults" else version) + for source, version in self.pairs] + self.assertNotEqual(updated, self.pairs) + for path, arch in ((self.amd64, "amd64"), (self.arm64, "arm64")): + data = _inventory(updated, arch).replace("4:12.2.0-3", "4:14.2.0-1") + path.write_text(data, encoding="utf-8") + pairs = sources.inventory_pairs(path) + self.assertIn(("gcc-defaults", "1.220"), pairs) + self.assertNotIn(("gcc-defaults", "4:14.2.0-1"), pairs) + self.refused(self.check(), f"source set {_set_id(updated)} is not in registry") + def test_02_registered_set_without_list_asset_is_refused(self): assets = [item for item in self.assets if item["name"] != self.sources_list.name] self.refused(self.check(assets), "missing release asset: set-02.SOURCES.list") @@ -318,10 +331,11 @@ def test_95_repository_registry_has_the_documented_header_and_real_source_sets(s self.assertTrue(data, "the registry must retain its documented header") self.assertEqual(data[0], REGISTRY_HEADER.rstrip("\n")) rows = [line.split("\t") for line in data[1:]] - self.assertEqual(len(rows), 16, "the registry must contain the 16 real source sets") + self.assertEqual(len(rows), 17, "the registry must contain the 17 real source sets") expected_tags = ("v0.1.0", "v1.4.0", "v0.1.21", "v0.1.15", "v1.0.1", "v0.1.11", "v0.1.13", "v1.0.0-rc.1", "v0.1.19", "v0.1.25", "v1.3.0", "v1.4.0", "v1.4.0", "v1.4.0", - "v1.4.0", "v1.4.0") + "v1.4.0", "v1.4.0", "v1.4.0") + expected_counts = ("84",) * 16 + ("72",) identities = [] for number, columns in enumerate(rows, 1): with self.subTest(source_set=f"set-{number:02d}"): @@ -332,10 +346,10 @@ def test_95_repository_registry_has_the_documented_header_and_real_source_sets(s self.assertTrue(tag.startswith("v"), "holding releases must use v-prefixed tags") self.assertIn(tag, expected_tags) self.assertEqual(tag, expected_tags[number - 1], "each set must use its confirmed release") - self.assertEqual(count, "84") + self.assertEqual(count, expected_counts[number - 1]) self.assertEqual(asset, f"set-{number:02d}.SOURCES.list") identities.append(identity) - self.assertEqual(len(set(identities)), 16, "source set-ids must be unique") + self.assertEqual(len(set(identities)), 17, "source set-ids must be unique") def test_96_multiple_assets_for_one_source_pair_keep_the_same_set_id(self): source, version = next(pair for pair in self.pairs if ":" in pair[1]) @@ -472,7 +486,7 @@ def setUpClass(cls): cls.template = (REPO / "docker" / "SOURCES.txt.in").read_text(encoding="utf-8") def test_template_preserves_biz_notice_verbatim_except_version_token(self): - approved = (FIXTURES / "GPL-NOTICE-v1.txt").read_text(encoding="utf-8") + approved = (FIXTURES / "GPL-NOTICE-v2.txt").read_text(encoding="utf-8") self.assertEqual(self.template, approved.replace("", "@RELEASE_VERSION@")) self.assertEqual(re.findall(r"@[A-Za-z0-9_]+@", self.template), ["@RELEASE_VERSION@"]) self.assertNotIn("", self.template) @@ -763,10 +777,10 @@ def test_readme_documents_bootstrapping_new_source_sets_and_kept_copyright_files "README must explain how to make a new source set available before its first publish", ) self.assertIn( - "The default image differs from 1.5.0 only by the source notice, the two source " - "labels and the retained Debian package copyright files.", + "The 1.10.0 packaging refresh moves every Debian-based stage to trixie and replaces " + "bookworm's GCC 12 pins with GCC 14; the checked harness and entrypoint stay unchanged.", readme, - "README must state the notice and copyright differences from the 1.5.0 default image", + "README must state the bounded Debian base/compiler refresh", )