Human proof from a copy (bus checks its own human-cli path), row 61's packages/tasks import missing from COPY_PATHS, directory write bits. webui 94 pass; 19 mutants, 16 killed, 3 survivors explained. Co-Authored-By: Claude Opus 5.5 <[email protected]>
63 lines
3.2 KiB
Bash
Executable File
63 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Darkwing row 77 review mutants: single-site edits to the candidate in
|
|
# WORKTREE. Each backs up one file, edits one site with
|
|
# queue-59-review/r1/mut.mjs (exactly one match, else BAD-SITE), runs the
|
|
# named webui test files and restores the backup.
|
|
# Usage: mutants.sh WORKTREE [NAME,...] (TMPDIR must be set; outputs go there)
|
|
set -u
|
|
WT="$1" ONLY="${2:-}"
|
|
MUT="$(cd "$(dirname "$0")/../../queue-59-review/r1" && pwd)/mut.mjs"
|
|
cd "$WT" || exit 1
|
|
S=scripts/webui-service.sh CLI=packages/webui/src/cli.mjs RD=packages/webui/src/reads.mjs
|
|
SVC=tests/service.test.mjs PIN=tests/pinned-copy.test.mjs
|
|
|
|
m() { # name file tests from to
|
|
local name="$1" file="$2" tests="$3" from="$4" to="$5"
|
|
if [ -n "$ONLY" ] && [[ ",$ONLY," != *",$name,"* ]]; then return; fi
|
|
cp -- "$file" "$TMPDIR/mut.bak"
|
|
if ! node "$MUT" "$file" "$from" "$to"; then echo "$name BAD-SITE"; cp -- "$TMPDIR/mut.bak" "$file"; return; fi
|
|
if (cd packages/webui && node --test $tests > "$TMPDIR/$name.out" 2>&1); then
|
|
echo "$name SURVIVED"
|
|
else
|
|
echo "$name killed: $(grep -E '^✖ ' "$TMPDIR/$name.out" | grep -v 'failing tests' | sort -u | sed 's/ ([0-9.]*ms)$//' | tr '\n' ';')"
|
|
fi
|
|
cp -- "$TMPDIR/mut.bak" "$file"
|
|
}
|
|
|
|
# copy
|
|
m mv-no-T $S $PIN 'if ! mv -T "$COPY_TMP"' 'if ! mv "$COPY_TMP"'
|
|
m no-file-chmod $S $PIN ' find "$COPY_TMP" -type f -exec chmod a-w {} +
|
|
' ''
|
|
m dir-0700 $S $PIN ' chmod 0755 "$COPY_TMP"
|
|
' ''
|
|
m no-trap $S $PIN " trap 'rm -rf \"\$COPY_TMP\"' EXIT
|
|
" ''
|
|
m no-early-exists $S $PIN ' if [ -e "$target" ]; then echo "exists: $target"; return 0; fi
|
|
' ''
|
|
m no-ancestor $S $PIN ' git -C "$REPO" merge-base --is-ancestor "$id" refs/heads/refactor || die "refusing: $id is not reachable from refs/heads/refactor"
|
|
' ''
|
|
m copy-no-canonical $S $PIN ' canonical
|
|
copies_ok
|
|
' ' copies_ok
|
|
'
|
|
# install, render, uninstall
|
|
m install-no-canonical $S $SVC ' canonical
|
|
[ -n "$COPY_ID" ]' ' [ -n "$COPY_ID" ]'
|
|
m install-no-copy-needed $S $SVC ' [ -n "$COPY_ID" ] || die "install needs --copy ID, a copy made with: scripts/webui-service.sh copy COMMIT"
|
|
' ''
|
|
m render-no-checkout $S $SVC ' [ -z "$COPY_ID" ] || flags="--checkout $REPO $flags"
|
|
' ''
|
|
m failed-is-running $S $SVC ' && $3 != "failed"' ''
|
|
m silent-state-fail $S $SVC ')" || die "refusing: systemctl' ')" || exit 1 || die "refusing: systemctl'
|
|
m no-reload-skips-check $S $SVC ' state="$(running)" || exit 1
|
|
[ -z "$state" ] || die "refusing: $UNIT_NAME is still running' ' state=""; [ "$RELOAD" = 0 ] || state="$(running)" || exit 1
|
|
[ -z "$state" ] || die "refusing: $UNIT_NAME is still running'
|
|
m uid-length-range $S $SVC '^[0-9a-f]{64}$ ]]' '^[0-9a-f]{63,65}$ ]]'
|
|
# status
|
|
m status-drift-inverted $S $SVC 'if [ "$head" = "$copy" ]; then' 'if [ "$head" != "$copy" ]; then'
|
|
m status-any-copy $S $SVC 'if [[ "$copy" =~ ^[0-9a-f]{40}$ ]]; then' 'if [ -n "$copy" ]; then'
|
|
# serve and the reads
|
|
m queue-root-ignored $RD $PIN 'queueReader({ root: queueRoot,' 'queueReader({ root,'
|
|
m cli-checkout-ignored $CLI $PIN 'queueRoot: options.checkout ?? REPO' 'queueRoot: REPO'
|
|
m checkout-relative-ok $CLI $PIN 'dir = isAbsolute(value) && statSync(value).isDirectory();' 'dir = statSync(value).isDirectory();'
|