Skip to content

os/v3/puppy: cut.sh builds the payload fresh, image-probe.sh can stop the write, archive-image.sh keeps the tested image (engine#3287) - #3316

Merged
bong-water-water-bong merged 4 commits into
mainfrom
1bit/cut-probe-archive-3287
Nov 22, 2026
Merged

bong-water-water-bong merged 4 commits into
mainfrom
1bit/cut-probe-archive-3287

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes the three release-tooling items of #3287:

  • The cut must use the freshly rolled payload -> os/v3/puppy/cut.sh
  • The pre-write probe must be able to stop the write -> os/v3/puppy/image-probe.sh
  • Keep the shipped image -> os/v3/puppy/archive-image.sh

Depends on #3313 and #3315 for a cut of main to pass end to end (found by running this cut: a package from the pinned toolchain fails the payload-runpath gate without #3313; patch-sfs refuses main's new usr/local/sbin/1bit-grow-data without #3315). This PR does not include them.

cut.sh <engine build dir> <tag> <out dir>

Run from the engine tree that configured the build. In ONE run it: re-packages the engine from the build with package-linux.sh (refusing a build whose 1bit version names another commit, or a dirty tree), rebuilds Lemonade (+web app, libwebsockets static, as c35) at the tree's pin and checks the payload's lemond-onebit --version carries that pin, assembles lemonade-onebit-<tag>/ from those two (RUNPATH $ORIGIN only, pack_normalise_modes, nothing group/other-writable), builds the image - WOOF= + KERNEL_DIR= through build.sh, or BASE=<osfiles> through patch-sfs.sh (the c35 path, with onebit-models.txt and release-identity regenerated from the payload; BUILT-FROM.txt says the base was not rebuilt) - then mkimage.sh, then the probe (must exit 0), then the archive. Every staged directory is removed and rebuilt each run. It writes no stick, tags nothing, publishes nothing.

image-probe.sh <img> (--payload <dir> | --engine-sha <sha>) [--tag <tag>]

Reads the image's own 1BIT-DATA ext4 with debugfs at the partition's byte offset and the SFS with unsquashfs - no mount, no loop device, no root - so "could not mount the image" (what let the c34 probe print skipped and the write proceed) is no longer a path. Checks /1bit against the image's own SHA256SUMS, the engine bytes and release-identity (engine sha, payload label), and diff -r --no-dereference of opt/1bit-package against the payload tree. Exit 0 PASS, 1 FAIL (mismatch), 2 REFUSED (could not look).

archive-image.sh <img> <tag> [<root>]

Copies the exact image to $ONEBIT_IMAGE_ARCHIVE/<tag>/1bit-os-puppy-<tag>.img (default ~/release-archive) with .sha256, the probe log, BUILT-FROM.txt and the payload listing; verifies the copy's hash; read-only; refuses to overwrite a tag.

Measured (ryzen, 2026-11-22)

Tests

tests/image_probe_test.sh (ctest image_probe, no root): a miniature image in mkimage's layout; 16 rows - pass, --engine-sha pass, wrong tag, stale payload, a payload differing outside 1bit/1bit, an extra file, an identity naming another engine, a frugal set disagreeing with its SHA256SUMS (all exit 1), truncated / missing image / no expectation / malformed sha (all exit 2), and the archive (byte-identical, .sha256 verifies, refuses to overwrite). scripts/pre-pr-checks.sh --base origin/main from a clean worktree: 17 green, 3 skipped.

🤖 Generated with Claude Code

bong-water-water-bong and others added 2 commits November 22, 2026 12:09
…probe that can stop the write, and the tested image archived (engine#3287)

cut.sh rebuilds the engine package, Lemonade and the lemonade-onebit-<tag>/ payload in every run (refusing a build dir
whose 1bit is from another commit), cuts the image with build.sh (WOOF) or by patching a released base (BASE), runs
image-probe.sh and archives the image with archive-image.sh.

image-probe.sh reads the image's own 1BIT-DATA partition with debugfs at its byte offset (no root, no mount), checks
/1bit against its SHA256SUMS, and compares the SFS's opt/1bit-package with the payload tree byte for byte plus the
release identity. Exit 0 pass, 1 mismatch, 2 could not look - never a silent skip.

archive-image.sh copies the exact image under the archive root with its sha256, verifies the copy, and never
overwrites a tag. tests/image_probe_test.sh covers all three outcomes and the archive on a miniature image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the probe and the archive (engine#3287)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 38dc99a)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3287 - Partially compliant

Compliant requirements:

  • The cut must use the freshly rolled payload
  • The pre-write probe must be able to stop the write
  • Keep the shipped image

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Error Handling in File Comparison

The image-probe.sh script compares the payload tree with the image's payload using diff -r --no-dereference -q. If the diff command fails due to a large number of differences or other issues, the script may not handle the error gracefully, potentially leading to a false positive or negative result. The script should ensure that any failure in the diff operation is properly reported.

if [ -n "$payload" ]; then
    if diff -r --no-dereference -q "$payload" "$work/root/opt/1bit-package" > "$work/diff.out" 2>&1; then
        ok "opt/1bit-package is the payload tree byte for byte ($(find "$payload" -type f | wc -l) files)"
    else
        bad "opt/1bit-package differs from $payload in $(wc -l < "$work/diff.out") place(s):"
        head -20 "$work/diff.out" | sed 's/^/       /' >&2
    fi
fi
Potential Stale Payload Risk

The cut.sh script ensures a fresh payload by rebuilding Lemonade and the engine package in every run, but it does not explicitly verify that the payload's lemond-onebit version matches the expected Lemonade tree pin. If the payload's lemond-onebit binary is not rebuilt correctly, it could lead to a mismatch between the payload's version and the expected Lemonade pin, potentially causing runtime issues.

plem=$("$P/lemond-onebit" --version 2> /dev/null | sed -n 's/^lemond version //p' | head -1)
[ -n "$plem" ] || die "the payload's lemond-onebit --version printed no version"
case "$plem" in *"${lpin:0:8}"*) ;; *) die "the payload's lemond is $plem, the tree pins lemonade ${lpin:0:8}" ;; esac

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 22, 2026 16:25
…n the build job instead of skipping (engine#3287)

The test builds a miniature appliance image and reads it back unprivileged (no loop device, no mount). Run in the CI
image ubuntu:26.04 with those three packages: image_probe_test 16 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 387dd3e

…-tools is installed; drop its baseline line

Measured on this PR's build: ctest_skips said 'patch_sfs_atomic is in tools/ci/ctest_skips.txt but it no longer skips'
(the container is root and now has mksquashfs/unsquashfs), and the row passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 38dc99a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant