From 85735ccf195276ae53ce43e63cbbea958b20a91f Mon Sep 17 00:00:00 2001 From: Surma Date: Sat, 7 Nov 2026 10:40:00 +0000 Subject: [PATCH] box: document startup-aware builds and verify archive preservation --- userland/box/README.md | 14 ++++++++++---- userland/box/test.nu | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/userland/box/README.md b/userland/box/README.md index 7c51a69..b139104 100644 --- a/userland/box/README.md +++ b/userland/box/README.md @@ -85,14 +85,20 @@ Archive failures return the completed command and an availability notice. Never ## Build and validation -From the repository root: +Build the shared startup object from the repository root: + +```sh +nix develop -c nu --no-config-file userland/cwd-init/build.nu +``` + +Run the following commands from `userland/` so Cargo loads the shared startup and numeric exit support: ```sh df -h / export CARGO_TARGET_DIR=/home/surma/src/gitea.surma.technology/surma/sausage/target/p1-tools -nix develop -c cargo build --manifest-path userland/Cargo.toml -p box-cli --target wasm32-wasip2 --release --locked +nix develop -c cargo build -p box-cli --target wasm32-wasip2 --release --locked nix develop -c kache stats -nix develop -c nu userland/box/test.nu +nix develop -c nu box/test.nu ``` The existing `userland/bundle.nu` discovers the workspace member and copies its `box` binary into `/bin`. @@ -103,7 +109,7 @@ Stop before a build if disk use exceeds 85%. Run pure unit tests with the native target from `rustc -vV`, for example: ```sh -nix develop -c cargo test --manifest-path userland/Cargo.toml -p box-cli --target aarch64-unknown-linux-gnu --locked +nix develop -c cargo test -p box-cli --target aarch64-unknown-linux-gnu --locked ``` The real-service script tests every required command and removes every created box, including after an assertion failure. diff --git a/userland/box/test.nu b/userland/box/test.nu index fc4ff56..2b623c8 100644 --- a/userland/box/test.nu +++ b/userland/box/test.nu @@ -45,7 +45,8 @@ def main [component: path = '/home/surma/src/gitea.surma.technology/surma/sausag let bytes = (open --raw ($root | path join ($archive | str trim --left --char '/'))) check (($bytes | bytes length) == 1200003) 'full binary archive retains byte total' let repeated = (call $component $root [exec $id -- sh -c 'printf collision-check'] | require) - check ($repeated.stdout == 'collision-check') 'later archive leaves earlier output intact' + check ($repeated.stdout == 'collision-check') 'later exec returns output' + check ((open --raw ($root | path join ($archive | str trim --left --char '/'))) == $bytes) 'later archive leaves earlier output intact' let log = (call $component $root [logs $id] | require) check ($log.stderr | str contains 'box build archive:') 'logs retains build archive' let wit = (^wasm-tools component wit $component | complete)