diff --git a/CMakeLists.txt b/CMakeLists.txt index f637937bb..b52159a21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,6 +242,11 @@ add_test(NAME release_check_row COMMAND ${CMAKE_SOURCE_DIR}/os/mini/release-chec # dir, so no key, no device and no build: the four refusals are a set with no manifest, a file the # manifest does not list, a ciphertext byte flipped after signing, and a manifest signed by another key. add_test(NAME seal_manifest COMMAND ${CMAKE_SOURCE_DIR}/tests/seal_manifest_test.sh) +# engine #1279: the version a package is built with (scripts/pack-version.sh) -- a release tag as +# it stands, a candidate mapped into the ISO week of its own date with a suffix that sorts below that +# release, and the ordering a candidate needs: previous release < candidate < its release. The +# ordering is the row dpkg, rpm and pacman had to agree on; no container, no build, dpkg only. +add_test(NAME pack_version COMMAND ${CMAKE_SOURCE_DIR}/tests/pack_version_test.sh) # engine #713: the pinned HRX toolchain (config/hrx-toolchain.config, scripts/fetch-rocm-sdk.sh) -- the # pin file's refusals, the completeness check against a fabricated tree, and that cmake and # weekly.sh both use the pin instead of the box's /opt/rocm-therock. No network, no SDK, no GPU. diff --git a/docs/install-any-distro.md b/docs/install-any-distro.md index 5aa4f43f8..dfc376df9 100644 --- a/docs/install-any-distro.md +++ b/docs/install-any-distro.md @@ -350,6 +350,8 @@ registry model, since this Lemonade version has no local-file registration): | the tarball cannot hand a system directory to uid 1000 | clean `ubuntu:26.04`, the documented `sudo tar -C / --no-same-owner --no-overwrite-dir -xf …` | `/`, `/usr`, `/usr/bin`, `/opt` read `0:0 755` before and after; the payload lands `0:0`, `0` of 75 files not owned by root, and the shim runs (`version: 1 (32559003)`). Before the fix the same extraction as root left uid 1000 owning `/`, `/usr`, `/usr/bin` and `/opt` — a local root escalation on every "any other distribution" install (#1292 review) | | the glibc floor is enforced, not just documented | clean `ubuntu:24.04` container (glibc 2.39), `apt-get install ./1bit-engine__amd64.deb` | refused: `1bit-engine : Depends: libc6 (>= 2.43) but 2.39-0ubuntu8.9 is to be installed`. Before the floor was declared, the same deb installed, `ldd` was happy and the binary then failed to load | | **the package's payload serves on the GPU** | strixhalo, the Fedora `.rpm` unpacked with `rpm2cpio` (so exactly the files the package installs), `1bit serve -m Qwen3-0.6B-Q4_K_M.gguf --device hrx --no-strict-device`, two chats | `1bit serve: HRX: HSA runtime …/_rocm_sdk_core/lib/libhsa-runtime64.so.1 sha256 21a66824…` — the runtime the package ships, not the box's — then `Qwen3-0.6B-Q4_K_M on hrx`, health `200`, and `request /v1/chat/completions -> hrx status 200 in 202.5 ms | prompt 16 completion 16 79.0 tok/s`; a second chat with `max_tokens: 200` came back `content: "5"` (109 completion tokens, 69.1 tok/s). The first one's content was empty because Qwen3 spends the opening tokens on its thinking trace, so a 16-token budget never reaches the answer. Both this model and `Qwen3-4B-Q4_K_M` are refused first by strict placement (`"embd" is GET_ROWS f32 … 1 of 986 nodes off HRX`), which is why the runs pass `--no-strict-device` | +| **the release proves its own packages** | `scripts/pack-proof.sh `, wired into `scripts/weekly.sh`'s package stage, 2026-11-07, on the `rc-2026-11-06-c31` artifacts | 6/6 rows PASS: the `.deb` installed in `ubuntu:26.04`, the `.rpm` in both `fedora:latest` and `opensuse/tumbleweed`, the pacman package in `archlinux:latest` (each asked `1bit-engine --version` = `1bit 0.0.1`, made to run the shim = `version: 1 (32559003)`, then removed with nothing left), the tarball unpacked as root the way this page says, and the four compared as root (paths, modes, owner `0:0`, sizes, sha256). Handed the pre-fix tarball — uid 1000, a `./` member, the filesystem directories — the same harness fails **4/6**, naming the 151 members that are not root's and the payload difference, so the row is a check and not a claim | +| **a candidate package installs over the previous release** | `scripts/pack-version.sh` + `tests/pack_version_test.sh` (ctest `pack_version`), measured with each family's own comparator, 2026-11-07 | a candidate tag has to map to a version that sorts *above* the previous release and *below* the release it precedes, or installing it is a downgrade that apt and rpm refuse. `rc-2026-11-07-c32` packs as `2026.45~c32` (deb, rpm, tarball) and `2026.45c32` (pacman): `2026.44 < 2026.45~c32 < 2026.45` with `dpkg --compare-versions` and with rpm's `labelCompare` in `fedora:latest`, and `2026.44 < 2026.45c32 < 2026.45` with pacman's `vercmp` in `archlinux:latest`. The mapping this replaced read the tag as `2026.11.07.c32`, which is *below* every release since week 11 (`dpkg: 2026.11.07.c32 < 2026.44`) — the bug the #1368 review found, kept as a row in the test | | a stock Lemonade takes a backend binary from `hrx_bin` / `LEMONADE_HRX_HRX_BIN` | extracted PPA deb `2026.44.1~26.04` on the dev box, isolated cache/config | `llamacpp-hrx` backend `installable` → `installed`, both forms, with no fork and no patch | | the same recipe, both packages side by side | clean `ubuntu:26.04` container: PPA `lemonade-server` + this `.deb` | `lemond 2026.44.1` starts, `1bit-engine --version` and the shim run; the recipe's backend state is hardware-gated there (`unsupported: Unsupported GPU`), so the end-to-end chat is the hardware row below | | the shim is the engine's own wrapper | `1bit/lemonade-hrx` from this repo's package (`scripts/package-linux.sh`) | it runs `1bit serve --print-backend-env` and then `exec`s the engine with serve's environment and defaults; `lemonade-bin/llama-server` is a symlink to it | diff --git a/docs/releases.md b/docs/releases.md index 8d4aca1af..712ab3662 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -485,8 +485,18 @@ WEEKLY_DRY_RUN=1 WEEKLY_TAG=rehearsal-private scripts/weekly.sh ~/.cache/1bit-we 2. **build** and **test**: `main` at the merged pins, the same way. 3. **package**: the two packages above, plus the engine's own packages for every family (`scripts/mk-plugin-package.sh`: the `.deb`, `.rpm`, Arch package and tarball, all built from one - payload tree by `scripts/pack-distro.sh`). `scripts/package-linux.sh` packs the engine first; its - tarball goes into the Lemonade + onebit package as `1bit/`, not into the release on its own. + payload tree by `scripts/pack-distro.sh`), and then the proof of them: + `scripts/pack-proof.sh` installs each one in a throwaway container of its distribution + (`ubuntu:26.04`, `fedora:latest`, `opensuse/tumbleweed`, `archlinux:latest`), asks the engine its + version, runs the shim, removes it and checks nothing is left; unpacks the tarball as root the way + the guide says; and compares the four as root so a package carrying a different payload fails the + release instead of a user. A failing row stops the release. `scripts/package-linux.sh` packs the + engine first; its tarball goes into the Lemonade + onebit package as `1bit/`, not into the release + on its own. A candidate cut's tag is not a version, so it is mapped to one by + `scripts/pack-version.sh`: `rc-2026-11-07-c32` becomes `2026.45~c32` in the `.deb`, `.rpm` and + tarball names and `2026.45c32` in the Arch one, which is the week of the release it is a candidate + for and sorts after the previous release and before that one, so installing a candidate is an + upgrade (the property `tests/pack_version_test.sh` pins). 4. **release**: `tools/weekly_changes.py` lists, for every pin that moved since the last release, the upstream commits (authors, PRs) and releases in between; that becomes the release notes and `changes.json`, and `gh release create` publishes it all. @@ -503,7 +513,9 @@ rehearsal found these only after the build) and stops with a message naming what or `ROCM_PATH`. (The optional DwarfStar build that also wanted it is gone since 2026-11-02.) - **package:** `patchelf` (`scripts/package-linux.sh`); `dpkg-deb` and `docker` (`scripts/pack-distro.sh` builds the `.rpm` with rpmbuild in a `fedora` container and the Arch - package with makepkg in an `archlinux` one, since the release box has neither toolchain); `node` + package with makepkg in an `archlinux` one, since the release box has neither toolchain, and + `scripts/pack-proof.sh` installs all four in `ubuntu:26.04`, `fedora:latest`, + `opensuse/tumbleweed` and `archlinux:latest`, so the network has to reach those four images); `node` and `npm` for Lemonade's web app (`LEMONADE_WEB_APP=1 scripts/build-lemonade.sh`; its `npm ci` needs the network); a readable kernel image for the `os/mini` image, `/boot/vmlinuz-$(uname -r)` or `VMLINUZ=` (Ubuntu's `/boot/vmlinuz-*` is root-only). diff --git a/scripts/pack-distro.sh b/scripts/pack-distro.sh index 704af2eba..ee929b6fa 100755 --- a/scripts/pack-distro.sh +++ b/scripts/pack-distro.sh @@ -39,9 +39,9 @@ # PKG_NAME, PKG_SUMMARY, PKG_DESC, PKG_MAINTAINER (required) # PKG_DEB_DEPENDS, PKG_DEB_RECOMMENDS (optional, comma separated) # -# The version is normalized to what every family accepts: a leading "v" goes, and anything outside -# [A-Za-z0-9._] becomes "." (rpm and pacman refuse "-" in a version, and the weekly's rehearsal tags -# start with "rc-"). +# The version is normalized to what every family accepts, because the tag a cut carries is not one +# (scripts/pack-version.sh: rc-2026-11-07-c32 packs as 2026.11.07.c32, and a tag with no digit at all as +# 0.). It is the same function scripts/pack-proof.sh uses to find the packages again. # # deb and tarball are built here. rpm and arch are built in containers (fedora:latest, # archlinux:latest): rpmbuild and makepkg are the only correct builders for those two formats and the @@ -53,16 +53,17 @@ set -euo pipefail [ $# -eq 3 ] || { sed -n '16,52p' "$0"; exit 2; } fmt=$1 root=$2 out=$3 repo=$(cd "$(dirname "$0")/.." && pwd) +# shellcheck source=scripts/pack-version.sh +. "$(dirname "$0")/pack-version.sh" need() { [ -n "${!1:-}" ] || { echo "pack-distro.sh: $1 is not set ($2)" >&2; exit 2; }; } need PKG_VERSION "the release version" [ -d "$root" ] || { echo "pack-distro.sh: no payload tree at $root" >&2; exit 2; } [ -n "$(ls -A "$root")" ] || { echo "pack-distro.sh: the payload tree at $root is empty" >&2; exit 2; } -ver=$(printf '%s' "${PKG_VERSION#v}" | sed -e 's/[^A-Za-z0-9._]\+/./g' -e 's/^\.*//' -e 's/\.*$//') -[[ $ver =~ ^[0-9] ]] || { - echo "pack-distro.sh: version '$PKG_VERSION' does not start with a digit even normalized ('$ver'); pass the release's version" >&2 - exit 2; } +# the version and how a tag becomes one lives in one place, shared with the proof that looks the +# packages up by name (scripts/pack-version.sh); it is per family, because a candidate's version has to +# sort below its release and only pacman needs a different spelling to do that rel=${PKG_RELEASE:-1} # The distribution's own filesystem skeleton: its filesystem package owns these paths, so no package @@ -103,6 +104,7 @@ deb) need PKG_DESC "the description" need PKG_MAINTAINER "the maintainer, \"Name \"" [ ! -e "$root/DEBIAN" ] || { echo "pack-distro.sh: $root already has a DEBIAN directory" >&2; exit 2; } + ver=$(pack_version "$PKG_VERSION" deb) || exit 2 # a real copy, not hardlinks: the modes are normalised inside it, and the caller's tree is left as # it was cp -a "$root" "$work/root" @@ -128,6 +130,7 @@ deb) ;; tarball) # the name keeps the name the guide has always used for this route + ver=$(pack_version "$PKG_VERSION" tarball) || exit 2 f="$out/${PKG_NAME:-1bit}-${ver}-linux-x86_64.tar.zst" cp -a "$root" "$work/root" normalize_modes "$work/root" @@ -148,6 +151,7 @@ rpm) need PKG_NAME "the package name" spec=${PKG_RPM_SPEC:-$repo/packaging/rpm/$PKG_NAME.spec} [ -f "$spec" ] || { echo "pack-distro.sh: no spec at $spec" >&2; exit 2; } + ver=$(pack_version "$PKG_VERSION" rpm) || exit 2 p="$PKG_NAME-$ver" mkdir -p "$work/$p" cp -a "$root/." "$work/$p/" @@ -187,6 +191,7 @@ SH arch) pkgbuild=${PKG_ARCH_PKGBUILD:-$repo/packaging/arch/PKGBUILD} [ -f "$pkgbuild" ] || { echo "pack-distro.sh: no PKGBUILD at $pkgbuild" >&2; exit 2; } + ver=$(pack_version "$PKG_VERSION" arch) || exit 2 mkdir -p "$work/payload" cp -a "$root/." "$work/payload/" normalize_modes "$work/payload" diff --git a/scripts/pack-proof.sh b/scripts/pack-proof.sh new file mode 100755 index 000000000..5af8d0ab4 --- /dev/null +++ b/scripts/pack-proof.sh @@ -0,0 +1,173 @@ +#!/usr/bin/env bash +# Copyright 2026 bong-water-water-bong +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# pack-proof.sh +# +# The proof for the engine's own packages (engine #1279 item 4): every family installs it, the engine +# answers, the shim runs, and it uninstalls cleanly; the tarball is unpacked as root the way +# docs/install-any-distro.md says and must not touch a directory that is not ours; and the four +# packages are unpacked side by side to check they carry the same thing. One PASS/FAIL row per check, +# non-zero exit if any row fails. +# +# Needs docker and nothing else on the host: every install happens inside a throwaway container of the +# family it is for, and the host is left with one temporary directory. Run from the release's package +# stage (scripts/weekly.sh) or by hand: +# +# scripts/pack-proof.sh +# +# The version is normalized exactly as the packer normalizes it (scripts/pack-version.sh), so the tag a +# cut carries works here too: rc-2026-11-07-c32 finds 1bit-engine_2026.11.07.c32_amd64.deb. +# +# The rows and what each one means: +# deb ubuntu:26.04 apt-get install ./1bit-engine__amd64.deb +# rpm fedora:latest dnf install ./1bit-engine--1.x86_64.rpm +# rpm opensuse/tumbleweed zypper install ./... (the same file: one rpm for both families) +# arch archlinux:latest pacman -U ./1bit-engine--1-x86_64.pkg.tar.zst +# tarball ubuntu:26.04 tar -C / --zstd --no-same-owner --no-overwrite-dir -xf ... +# same ubuntu:26.04 the four unpacked as root: paths, modes, owner, sizes, sha256 +# +# The deb/rpm/arch rows check removal too (nothing of the payload may be left); the tarball row does +# not, because a tarball has nothing to uninstall. The images are the distributions the release says +# it supports, named once here so a release cannot quietly prove itself on something else. +set -uo pipefail + +[ $# -eq 2 ] || { sed -n '16,43p' "$0"; exit 2; } +dir=$(cd "$1" && pwd) || exit 2 +# shellcheck source=scripts/pack-version.sh +. "$(dirname "$0")/pack-version.sh" +# one version per family: a candidate's has to sort below its release, and pacman spells that +# differently from deb and rpm (scripts/pack-version.sh) +v_deb=$(pack_version "$2" deb) || exit 2 +v_rpm=$(pack_version "$2" rpm) || exit 2 +v_arch=$(pack_version "$2" arch) || exit 2 +v_tar=$(pack_version "$2" tarball) || exit 2 +deb=1bit-engine_${v_deb}_amd64.deb +rpm=1bit-engine-${v_rpm}-1.x86_64.rpm +arch_pkg=1bit-engine-${v_arch}-1-x86_64.pkg.tar.zst +tarball=1bit-engine-${v_tar}-linux-x86_64.tar.zst +for f in "$deb" "$rpm" "$arch_pkg" "$tarball"; do + [ -f "$dir/$f" ] || { echo "pack-proof: no $f in $dir (the release builds all four: scripts/mk-plugin-package.sh)" >&2; exit 2; } +done +command -v docker >/dev/null || { echo "pack-proof: no docker on PATH; the rows are container installs" >&2; exit 2; } + +rows=0 failed=0 + +# run_row