Files
w3cjandClaude Opus 5.5 ecd266c7d3 test(cli): one wait for the scripts; the docs release job installs only what it builds with
The scripts waited with copies of the same loop: desktop.txtar's and
nix_cache.txtar's waitfor files, and sh -c loops in link_life,
fixture_v010_links, fixture_v010_small, ports and ports_stopped, each
with its own interval and limit. They now use one testscript command,
wait_until SCRIPT, which runs sh -c SCRIPT every 100 ms until it
succeeds, for up to 90 s, and fails at once when every background
command has ended, as wait_file does, or when SCRIPT exits 100
(waitGiveUp, a status no tool the scripts run gives), as the links
check does when its session has ended. Contributing's tests page names
it beside wait_file, whose limit it now says is 60 s.

The docs workflow's release job installed every tool in the tag's
mise.toml. It now installs only Go, Hugo by the name the tag gives it
(hugo-extended before Hugo 0.170) and Node when the tag draws its
diagrams, with --locked as mise-action did, picking them with mise's
own reading of the tag's mise.toml (mise ls --current --json, the tag's
file alone), and fails when the tag names no Hugo. MISE_AUTO_INSTALL is
off for the job, so mise run docs:diagrams and the shims install
nothing more, and a tool the pick missed fails the build. This job runs
only at a release, so it hasn't run yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00

82 lines
4.0 KiB
Plaintext

# The shared Nix cache: devvm _proxy with nix_cache in its config answers http://devvm.proxy/nix/
# itself; devvm space, devvm images and devvm gc show what it takes, and devvm
# gc deletes its least recently used files while it's over its cap
# (nix-cache.size), or all of it with --nix-cache.
env CACHE=$XDG_DATA_HOME/devvm/cache/nix-cache
# The proxy makes the folder, the user's alone, and answers nix-cache-info
# itself. What the cache doesn't take is refused, a NAR no checked narinfo
# names isn't fetched, and nothing is answered without the VM's password.
free_port PORT
exec sh -c 'printf ''{"version": 1, "listen": "127.0.0.1:%s", "password": "k", "policies": ["nix.policy"], "log": "events.jsonl", "nix_cache": "cache", "nix_cache_max": 1000}\n'' "$PORT" > nix.json && chmod 600 nix.json'
! exec devvm _proxy -config nix.json &p&
wait_until 'nc -z 127.0.0.1 $PORT'
exec curl -sS -x http://devvm:[email protected]:$PORT http://devvm.proxy/nix/nix-cache-info
stdout '^Priority: 30$'
stdout '^StoreDir: /nix/store$'
exec curl -sS -o /dev/null -w '%{http_code}' -x http://devvm:[email protected]:$PORT -X POST -d x http://devvm.proxy/nix/nix-cache-info
stdout '^400$'
exec curl -sS -o /dev/null -w '%{http_code}' -x http://devvm:[email protected]:$PORT --path-as-is http://devvm.proxy/nix/nar/../aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo
stdout '^400$'
exec curl -sS -o /dev/null -w '%{http_code}' -x http://devvm:[email protected]:$PORT http://devvm.proxy/nix/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo?x
stdout '^400$'
exec curl -sS -o /dev/null -w '%{http_code}' -x http://devvm:[email protected]:$PORT http://devvm.proxy/nix/nar/0000000000000000000000000000000000000000000000000000.nar.xz
stdout '^404$'
exec curl -sS -o /dev/null -w '%{http_code}' -x http://127.0.0.1:$PORT http://devvm.proxy/nix/nix-cache-info
stdout '^407$'
exec ls -ld cache
stdout '^drwx------'
exec ls -ld cache/nar
stdout '^drwx------'
kill p
wait p
grep '"event":"nix-cache".*"reason":"not found: no checked narinfo names it"' events.jsonl
grep '"event":"nix-cache".*"reason":"refused: ' events.jsonl
exec sh -c 'ls cache cache/nar'
! stdout narinfo
# nix-cache.size takes sizes as devvm space shows them.
! exec devvm retention nix-cache.size=2k
stderr '^devvm: retention_bad '
exec devvm retention nix-cache.size=128K
stdout '^==> retention_saved '
# 192K in the cache, over its 128K cap: devvm space says so, and the daily
# retention run deletes the least recently used file. Sizes are whole
# blocks, which the cap counts.
mkdir $CACHE/nar
exec sh -c 'head -c 65536 /dev/zero > "$CACHE/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo" && head -c 131072 /dev/zero > "$CACHE/nar/bbbb.nar.xz" && touch -t 202001010000 "$CACHE/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo"'
exec devvm space --json
stdout '"what": "Nix cache",\n\s+"count": 2,\n\s+"size": 196608,\n\s+"sized": true,\n\s+"kept": "remade",\n\s+"gc": 65536,\n\s+"rest": "gc --nix-cache",\n\s+"retain": "128K",\n\s+"retain_frees": 65536'
exec devvm space
stdout '^Nix cache .* gc --nix-cache +128K \(64K\)$'
exec devvm ls
stderr '^retention_deleted exports=0 nix_files=1 orphans=0 tools=0$'
! exists $CACHE/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo
exists $CACHE/nar/bbbb.nar.xz
# Over its cap again: devvm images says what it takes, and devvm gc deletes
# the least recently used file.
exec sh -c 'head -c 65536 /dev/zero > "$CACHE/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo" && touch -t 202001010000 "$CACHE/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo"'
exec devvm images
stderr '^images_nix_cache cap=128K size=192K$'
exec devvm gc --force
stdout '^gc_nix_cache_over cap=128K size=192K$'
stdout '^==> deleted_nix_cache count=1 size=64K$'
! exists $CACHE/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.narinfo
exists $CACHE/nar/bbbb.nar.xz
exec devvm gc --force
stdout '^==> nothing_to_clean$'
# --nix-cache: all of it.
exec devvm gc --force --nix-cache
stdout '^gc_nix_cache count=1 size=128K$'
stdout '^==> deleted_nix_cache count=1 size=128K$'
! exists $CACHE/nar/bbbb.nar.xz
exists $CACHE
exec devvm images
! stderr images_nix_cache
-- nix.policy --
cache.nixos.org