#!/bin/zsh # macOS client run of the albok browse-view withdrawal test (unit 4.3 exposure gate). # Staged on nh3-albok under ~vh/albok-browse-test/harness/ with a vh-owned replica beside it. # On the Mac: # mkdir -p ~/albok-browse-test && cd ~/albok-browse-test && scp 'vh@10.100.50.44:albok-browse-test/harness/*' . && zsh run-mac.sh # It tests every FUSE backend this Mac can mount with (the backend decides whether a rename # withdraws access), smoke-tests the real wings as vh, and copies the results back to nh3-albok. set -u cd "${0:A:h}" SRV=vh@10.100.50.44 MNT=$PWD/mnt N=${N:-5} stamp=$(date +%Y%m%d-%H%M) mkdir -p "$MNT" results unmount() { umount "$MNT" 2>/dev/null || diskutil unmount force "$MNT" >/dev/null 2>&1; } { echo "date: $(date '+%F %H%M %Z') host: $(scutil --get LocalHostName 2>/dev/null)" sw_vers echo "arch: $(uname -m)" echo "sshfs: $(command -v sshfs || echo MISSING)" command -v sshfs >/dev/null && { sshfs -V 2>&1 | head -5; otool -L "$(command -v sshfs)" 2>/dev/null | grep -i fuse; } [[ -d /Library/Filesystems/macfuse.fs ]] && echo "macFUSE: $(defaults read /Library/Filesystems/macfuse.fs/Contents/Info CFBundleShortVersionString 2>/dev/null)" pkgutil --pkgs 2>/dev/null | grep -i fuse } 2>&1 | tee "results/client-$stamp.txt" if ! command -v sshfs >/dev/null; then print "\nNo sshfs on this Mac. Install fuse-t (no kernel extension), then re-run this script:" print " brew install macos-fuse-t/homebrew-cask/fuse-t macos-fuse-t/homebrew-cask/fuse-t-sshfs" exit 2 fi # Candidate backends: "" = whatever this sshfs mounts with by default. candidates=("") if pkgutil --pkgs 2>/dev/null | grep -qi fuse-t || [[ -e /usr/local/lib/libfuse-t.dylib ]]; then candidates+=("backend=smb" "backend=fskit") fi [[ -d /Library/Filesystems/macfuse.fs ]] && candidates+=("backend=fskit") candidates=("${(@u)candidates}") # dedupe, keeping the empty "default" entry working=() for c in "${candidates[@]}"; do label=${c:-default}; label=${label#backend=} o="ro,follow_symlinks${c:+,$c}" if sshfs "$SRV:albok-browse-test/wing/.browse" "$MNT" -o "$o" 2>>"results/client-$stamp.txt" \ && ls "$MNT/stash" >/dev/null 2>&1; then print "backend $label: mounts"; working+=("$c") else print "backend $label: does not mount here (skipped)" fi unmount done (( ${#working} )) || { print "No backend mounted; send results/client-$stamp.txt to infra-ops."; exit 3; } for c in "${working[@]}"; do label=${c:-default}; label=${label#backend=} print "\n== trials, backend $label (N=$N per condition; ~3 min)" ALBOK_TEST_SRV=$SRV ALBOK_TEST_KEY= ALBOK_TEST_KNOWN_HOSTS= ALBOK_TEST_MNT=$MNT \ ALBOK_TEST_EXTRA_OPTS=$c python3 run-trials.py manifest.json $N > "results/trials-$label-$stamp.json" python3 summarize.py "results/trials-$label-$stamp.json" done # Smoke test of the REAL views as vh (read-only; prints counts, never content). first=${working[1]} print "\n== real wings as vh" | tee "results/smoke-$stamp.txt" for w in fleet/memory fleet/stash library/fiction library/nonfiction personal/notes personal/agent-feedback; do if sshfs "$SRV:/srv/albok/store/$w/.browse" "$MNT" -o "ro,follow_symlinks${first:+,$first}" 2>/dev/null; then n=$(find "$MNT" -type f 2>/dev/null | wc -l | tr -d ' ') f=$(find "$MNT" -type f 2>/dev/null | head -1) b=$([[ -n $f ]] && head -c 4096 "$f" | wc -c | tr -d ' ' || echo -) print "$w: mount ok, files=$n, first-file bytes read=$b" else print "$w: MOUNT FAILED" fi | tee -a "results/smoke-$stamp.txt" unmount done scp -q results/*-$stamp.* "$SRV:albok-browse-test/results/" && print "\nResults copied to nh3-albok; tell infra-ops it is done."