wolk-jjba-36fc4da3-511a

job failed

starting new job...


→ running command: cd "/etc/byggsteg/job-clone//wolk-jjba/trunk" && git reset --hard && git pull

HEAD is now at 9a4788d fix: Start the radio instead of restarting it for a stopped player
Already up to date.

→ running command: cd /etc/byggsteg/job-clone/wolk-jjba/trunk && uname -a

Linux wolk-jjba 7.2.11-gnu #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux

→ running command: cd /etc/byggsteg/job-clone/wolk-jjba/trunk && git log --name-status HEAD^..HEAD

commit 9a4788d2e811dfc73a595462d944ce3dd4b7733f
Author: Josep Bigorra <jjbigorra@gmail.com>
Date:   Sun Oct 25 18:59:54 2026 +0100

    fix: Start the radio instead of restarting it for a stopped player
    
    radio-health counted "a mount has no source" as a failed encoder and
    restarted Icecast and MPD after three checks.  A player that is stopped
    has no source on any mount at all -- MPD opens a shout output when
    playback starts -- so a queue that ran out, or a database rebuild that
    left it empty, put the job in a fifteen-minute restart loop that could
    never succeed.  Every restart dropped the listeners, and the queue went
    with the state file, so the station stayed silent while the health
    metrics said the daemons were fine.
    
    A player that is not playing is now started: `play' for a paused one,
    `play 1' from the top of the queue for a stopped one (a queue that ran
    out starts over instead of repeating its last track), preceded by
    `add /' when the queue is empty.  The restart is kept for the failures
    it can fix -- Icecast or MPD down, a player that was playing without a
    source on every mount, or a `play' that does not take -- and the
    empty-database rescan now runs before the repair, so the library it
    adds is the freshly scanned one.
    
    🤖 Generated with Codebuff
    Co-Authored-By: Codebuff <noreply@codebuff.com>

M       README.org
M       src/wolk-jjba/monitoring/alerting/alert-rules.yml
M       src/wolk-jjba/radio.scm
M       test/veritas/unit/radio-spec.scm

→ running command: cd /etc/byggsteg/job-clone/wolk-jjba/trunk && maak test

channels.scm:47:6: warning: channel 'jointhefreeworld' is not trusted

scanning directories for unit tests...
scanning present working directory for unit tests...

shuffled the files with seed 890329330 (replay with VERITAS_SEED=890329330)

found unit tests: (bash-spec.scm temp-spec.scm sysctl-spec.scm operating-system-spec.scm jobs-spec.scm nginx-spec.scm maintenance-spec.scm secrets-spec.scm radio-spec.scm logging-spec.scm certbot-spec.scm iptables-spec.scm gfs-spec.scm containers-spec.scm prelude-spec.scm)


running unit tests from file: bash-spec.scm, entrypoint: spec


ℹ️ info - shuffled with seed 890329330 (replay with VERITAS_SEED=890329330)
+----------------------------------------------+
[📑 suite] Bash Configuration Suite
  [🧪 test] Every shared alias reaches the rc
    [⚙️ assert] Each shared alias is emitted verbatim
    ✅ got: ()
    [⚙️ assert] hg still points at hgrep
    ✅ got: #t
    [⚙️ assert] the multi-character alias keeps its body
    ✅ got: #t
  [🧪 test] The prompt says which machine this is
    [⚙️ assert] The flavour is the repository name
    ✅ got: #t
    [⚙️ assert] The badge says this is a Guix server
    ✅ got: #t
    [⚙️ assert] The sigil is the server's omega
    ✅ got: #t
    [⚙️ assert] The accent is the server's teal
    ✅ got: #t
    [⚙️ assert] Identity is an assignment, not exported to children
    ✅ got: #f
  [🧪 test] The greeting array is emitted once, before it is read
    [⚙️ assert] The array is declared in the data block
    ✅ got: 1
    [⚙️ assert] The shared library no longer carries the pool
    ✅ got: #f
  [🧪 test] The greeting pool is non-empty and unique
    [⚙️ assert] shell-greeting must always find a saying
    ✅ got: #t
    [⚙️ assert] No saying is declared twice
    ✅ got: 48
  [🧪 test] The shared library still defines what the data calls
    [⚙️ assert] cc_boot is defined where the rc calls it
    ✅ got: #t
    [⚙️ assert] The hg alias has its hgrep
    ✅ got: #t
    [⚙️ assert] groot has its cdroot
    ✅ got: #t
    [⚙️ assert] The greeting function reads the generated array
    ✅ got: #t
    [⚙️ assert] The file ends on a line of its own
    ✅ got: #t
  [🧪 test] No alias shadows a function
    [⚙️ assert] Shared aliases are not git shortcuts
    ✅ got: ()
    [⚙️ assert] Shared aliases are not server helpers
    ✅ got: ()
    [⚙️ assert] Machine aliases are not server helpers
    ✅ got: ()
  [🧪 test] Git shortcuts are generated as functions
    [⚙️ assert] gst keeps its body and its arguments
    ✅ got: #t
    [⚙️ assert] groot calls the shared cdroot
    ✅ got: #t
    [⚙️ assert] The one-line shortcuts are no longer in the library
    ✅ got: #f
    [⚙️ assert] The multi-line glog stays in the library
    ✅ got: #t
  [🧪 test] Every machine-identity variable is emitted
    [⚙️ assert] The five CC_* values are declared
    ✅ got: 5
    [⚙️ assert] Each one reaches the rc verbatim
    ✅ got: ()
  [🧪 test] Greetings survive quotes, dollars and backticks
    [⚙️ assert] Every shell-special character is escaped
    ✅ got: CC_GREETINGS=(
        "a \"quoted\" \$HOME \`date\` \\ end"
)

  [🧪 test] Server helpers wrap the checkout and the Shepherd
    [⚙️ assert] The checkout path is assigned once
    ✅ got: 1
    [⚙️ assert] fr pulls the checkout, then runs maak fr
    ✅ got: #t
    [⚙️ assert] ht triggers a daemon and tails its log
    ✅ got: #t
    [⚙️ assert] The machine alias uses ls, not gls
    ✅ got: #t
  [🧪 test] The three pieces meet at line boundaries
    [⚙️ assert] The library starts on a new line
    ✅ got: #t
    [⚙️ assert] The postlude starts on a new line
    ✅ got: #t
    [⚙️ assert] The rc ends with a newline
    ✅ got: #t
  [🧪 test] History stays shell-local
    [⚙️ assert] CDPATH is exported for child shells
    ✅ got: #t
    [⚙️ assert] The history size is set
    ✅ got: #t
    [⚙️ assert] The history size is not pushed into every subprocess
    ✅ got: #f
  [🧪 test] An alias stays on one line
    [⚙️ assert] A body with a newline would break the alias line
    ✅ got: 0
  [🧪 test] The rc boots exactly once, at the end
    [⚙️ assert] cc_boot is called once in the postlude
    ✅ got: 1
    [⚙️ assert] Nothing runs after the prompt is installed
    ✅ got: #t
  [🧪 test] The shared library is spliced, not referenced
    [⚙️ assert] The library is read from the checkout
    ✅ got: # shellcheck shell=bash
# shellcheck disable=SC2034  # palette values are consumed indirectly (${!name})
# =============================================================================
# Shared shell library — wolk-jjba (this file) · heks-bash (the same file)
# Also mirrored for zsh in cask-and-cons/src/cask-and-cons/shell-lib.zsh.
#
# Keep this file identical to heks-bash/src/heks-bash/shell-lib.bash, header
# aside, so the two machines feel like one system. Everything
# machine-specific comes from the CC_* variables below, which the host config
# sets *before* calling `cc_boot':
#
#   CC_FLAVOR     name of the config, e.g. heks-bash
#   CC_HOST_KIND  at-a-glance machine kind, e.g. guix/linux
#   CC_SIGIL      prompt sigil, e.g. λ
#   CC_ACCENT     256-colour accent (0-255), e.g. 99
#   CC_RC_FILE    file `reload' sources
#   CC_PATH_DEPTH path components kept in the prompt (default 3)
#
# No plugins, no external prompt framework: the only fork per prompt is a
# single `git status --porcelain=v2 --branch'. The pager is plain less with
# the Emacs keymap from the sibling `lesskey' file, installed by the same
# installer that writes this rc.
# =============================================================================

CC_PATH_DEPTH=${CC_PATH_DEPTH:-3}
CC_ACCENT=${CC_ACCENT:-99}
: "${CC_FLAVOR:=shell}"
: "${CC_HOST_KIND:=unix}"
: "${CC_SIGIL:=λ}"
: "${CC_RC_FILE:=$HOME/.bashrc}"

# ---- history ----------------------------------------------------------------
# One big, shared, timestamped, de-duplicated history per machine.
HISTFILE=${HISTFILE:-$HOME/.bash_history}
HISTSIZE=${HISTSIZE:-500000}
HISTFILESIZE=${HISTFILESIZE:-100000}
HISTTIMEFORMAT=${HISTTIMEFORMAT:-'%F %T  | '}
HISTCONTROL=${HISTCONTROL:-ignoreboth:erasedups}
HISTIGNORE=${HISTIGNORE:-'&:[ ]*:exit:ls:ll:l:bg:fg:history:clear:cd:cd ..:pwd'}
shopt -s histappend cmdhist checkwinsize 2> /dev/null

# ---- pager ------------------------------------------------------------------
# One pager everywhere (less), with Emacs key bindings: the keymap is the
# shared lesskey source file installed as $XDG_CONFIG_HOME/lesskey — less 582
# and later read it directly, so there is no compiled file to keep in sync.
# -F quit-if-one-screen, -I case-insensitive search, -M long prompt, -R colour.
export PAGER=${PAGER:-less}
export MANPAGER=${MANPAGER:-less}
export LESS="-F -I -M -R"
# less looks for that file on its own, so nothing needs to be exported; older
# less versions (< 582) simply ignore it and keep their default keys.
CC_LESSKEY=${XDG_CONFIG_HOME:-$HOME/.config}/lesskey
export CC_LESSKEY

# ---- palette ----------------------------------------------------------------
# 256-colour ANSI. `CC_PLAIN=1' (or NO_COLOR / TERM=dumb) renders the same
# prompt without escapes. \001 ... \002 is readline's \"this is not printable\".
__cc_palette () {
    local v name
    if [[ ${CC_PLAIN:-0} != 0 || -n ${NO_COLOR:-} || ${TERM:-dumb} == dumb ]]
    then
        for v in ACCENT TEXT DIM PATH BRANCH DIRTY AB BAD GOOD BOLD RESET
        do
            printf -v "CC_${v}_SEQ" '%s' ''
            printf -v "CC_${v}_OUT" '%s' ''
        done
        return 0
    fi
    # plain escapes: used by normal output (greeting, about)
    printf -v CC_RESET_OUT '\033[0m'
    printf -v CC_BOLD_OUT '\033[1m'
    printf -v CC_ACCENT_OUT '\033[38;5;%sm' "$CC_ACCENT"
    printf -v CC_TEXT_OUT '\033[38;5;252m'
    printf -v CC_DIM_OUT '\033[38;5;244m'
    printf -v CC_PATH_OUT '\033[38;5;111m'
    printf -v CC_BRANCH_OUT '\033[38;5;81m'
    printf -v CC_DIRTY_OUT '\033[38;5;221m'
    printf -v CC_AB_OUT '\033[38;5;176m'
    printf -v CC_BAD_OUT '\033[38;5;203m'
    printf -v CC_GOOD_OUT '\033[38;5;114m'
    # prompt copies: \001 ... \002 are readline's "zero width" markers, so
    # the prompt is measured correctly without counting the escapes.
    for v in ACCENT TEXT DIM PATH BRANCH DIRTY AB BAD GOOD BOLD RESET
    do
        name=CC_${v}_OUT
        printf -v "CC_${v}_SEQ" '\001%s\002' "${!name}"
    done
}

# ---- prompt pieces ----------------------------------------------------------
# $HOME becomes ~, then only the last CC_PATH_DEPTH components are kept.
__cc_trim_path () {
    local p=${PWD/#$HOME/\~} depth=$CC_PATH_DEPTH
    local -a parts=()
    local IFS=/
    IFS=/ read -r -a parts <<< "$p"
    local n=${#parts[@]}
    if ((n <= depth))
    then
        printf '%s' "$p"
        return 0
    fi
    local out='' i
    for ((i = n - depth; i < n; i++))
    do
        out+=/${parts[i]}
    done
    printf '…%s' "$out"
}

# Environment badges: Guix shell, Nix shell, Python venv.
__cc_env_badge () {
    if [[ -n ${GUIX_ENVIRONMENT:-} ]]
    then
        printf ' %s[guix env]%s' "$CC_DIM_SEQ" "$CC_RESET_SEQ"
    elif [[ -n ${IN_NIX_SHELL:-} ]]
    then
        printf ' %s[nix]%s' "$CC_DIM_SEQ" "$CC_RESET_SEQ"
    elif [[ -n ${VIRTUAL_ENV:-} ]]
    then
        printf ' %s[venv]%s' "$CC_DIM_SEQ" "$CC_RESET_SEQ"
    fi
}

# One fork per prompt: porcelain v2 gives branch, upstream divergence and the
# dirty state in a single call. Untracked files are ignored (they are noise).
__cc_git_sync () {
    CC_GIT_SEG=''
    local dir=$PWD gd=''
    while :
    do
        if [[ -e $dir/.git ]]
        then
            gd=$dir
            break
        fi
        [[ $dir == / ]] && return 0
        dir=${dir%/*}
        [[ -z $dir ]] && dir=/
    done
    local out
    out=$(GIT_OPTIONAL_LOCKS=0 git -C "$gd" status --porcelain=v2 --branch \
        --ignore-submodules=dirty --untracked-files=no 2> /dev/null) || return 0
    local branch='' oid='' ahead=0 behind=0 changed=0 conflicts=0 stash=0
    local line ab
    while IFS= read -r line
    do
        case $line in
            '# branch.head '*)
                branch=${line#'# branch.head '}
                ;;
            '# branch.oid '*)
                oid=${line#'# branch.oid '}
                ;;
            '# branch.ab '*)
                ab=${line#'# branch.ab '}
                ahead=${ab%% *}
                ahead=${ahead#+}
                behind=${ab##* }
                behind=${behind#-}
                ;;
            'u '*)
                conflicts=$((conflicts + 1))
                ;;
            [12]' '*)
                changed=$((changed + 1))
                ;;
        esac
    done <<< "$out"
    [[ -z $branch ]] && return 0
    [[ $branch == '(detached)' ]] && branch=@${oid:0:7}
    # Stash entries are small plain-text logs; counting them costs no fork.
    if [[ -f $gd/.git/logs/refs/stash ]]
    then
        while read -r _
        do
            stash=$((stash + 1))
        done < "$gd/.git/logs/refs/stash"
    fi
    CC_GIT_SEG=" ${CC_BRANCH_SEQ}${branch}${CC_RESET_SEQ}"
    if ((conflicts))
    then
        CC_GIT_SEG+=" ${CC_BAD_SEQ}✖${conflicts}${CC_RESET_SEQ}"
    elif ((changed))
    then
        CC_GIT_SEG+=" ${CC_DIRTY_SEQ}✚${changed}${CC_RESET_SEQ}"
    else
        CC_GIT_SEG+=" ${CC_GOOD_SEQ}✓${CC_RESET_SEQ}"
    fi
    ((ahead)) && CC_GIT_SEG+=" ${CC_AB_SEQ}↑${ahead}${CC_RESET_SEQ}"
    ((behind)) && CC_GIT_SEG+=" ${CC_AB_SEQ}↓${behind}${CC_RESET_SEQ}"
    ((stash)) && CC_GIT_SEG+=" ${CC_DIM_SEQ}⚑${stash}${CC_RESET_SEQ}"
    return 0
}

# Two lines everywhere, identical on every machine:
#   ╭─ user@host <sigil> <kind>  ~/some/where [guix env]
#   ╰─ main ✚2 ↑1  <sigil>
__cc_prompt () {
    local cwd badge
    cwd=$(__cc_trim_path)
    badge=$(__cc_env_badge)
    __cc_git_sync
    PS1="${CC_DIM_SEQ}╭─ ${CC_RESET_SEQ}${CC_BOLD_SEQ}\u${CC_RESET_SEQ}"
    PS1+="${CC_DIM_SEQ}@${CC_RESET_SEQ}\h "
    PS1+="${CC_ACCENT_SEQ}${CC_SIGIL} ${CC_HOST_KIND}${CC_RESET_SEQ} "
    PS1+="${CC_PATH_SEQ}${cwd}${CC_RESET_SEQ}${badge}"$'\n'
    PS1+="${CC_DIM_SEQ}╰─${CC_RESET_SEQ}${CC_GIT_SEG} "
    PS1+="${CC_ACCENT_SEQ}${CC_SIGIL}${CC_RESET_SEQ} "
    history -a 2> /dev/null
    return 0
}

# ---- greeting ---------------------------------------------------------------
# The pool of sayings (CC_GREETINGS) is data and lives in bash.scm
# (`bash-greetings'); it is emitted into the rc before this runs.

shell-greeting () {
    local q=${CC_GREETINGS[RANDOM % ${#CC_GREETINGS[@]}]}
    printf '%s%s%s %s%s%s  %s%s%s\n\n' \
        "$CC_ACCENT_OUT" "$CC_SIGIL" "$CC_RESET_OUT" \
        "$CC_BOLD_OUT" "$CC_FLAVOR" "$CC_RESET_OUT" \
        "$CC_DIM_OUT" "$q" "$CC_RESET_OUT"
}

# ---- self knowledge ---------------------------------------------------------
about () {
    local shell_name="bash $BASH_VERSION"
    printf '%s%s%s %s%s%s\n' \
        "$CC_ACCENT_OUT" "$CC_SIGIL" "$CC_RESET_OUT" \
        "$CC_BOLD_OUT" "$CC_FLAVOR" "$CC_RESET_OUT"
    printf '  %skind%s    %s\n' "$CC_DIM_OUT" "$CC_RESET_OUT" "$CC_HOST_KIND"
    printf '  %shost%s    %s@%s\n' "$CC_DIM_OUT" "$CC_RESET_OUT" "${USER:-$(id -un)}" "$(uname -n)"
    printf '  %ssystem%s  %s\n' "$CC_DIM_OUT" "$CC_RESET_OUT" "$(uname -srm)"
    printf '  %sshell%s   %s\n' "$CC_DIM_OUT" "$CC_RESET_OUT" "$shell_name"
    printf '  %sconfig%s  %s\n' "$CC_DIM_OUT" "$CC_RESET_OUT" "$CC_RC_FILE"
    printf '  %sgit%s     %s\n' "$CC_DIM_OUT" "$CC_RESET_OUT" "$(git --version 2> /dev/null | cut -d' ' -f3)"
    printf '  %sprompt%s  accent %s · sigil %s · depth %s · %s\n' \
        "$CC_DIM_OUT" "$CC_RESET_OUT" "$CC_ACCENT" "$CC_SIGIL" "$CC_PATH_DEPTH" \
        "$([[ ${CC_PLAIN:-0} != 0 || -n ${NO_COLOR:-} ]] && echo plain || echo colour)"
    printf '  %spager%s   less · Emacs keys · %s\n' \
        "$CC_DIM_OUT" "$CC_RESET_OUT" "$CC_LESSKEY"
    printf '  %shelpers%s about · pager-keys · hist-top · paths · extract · mkcd · up · serve · bak · calc · json · notify\n' \
        "$CC_DIM_OUT" "$CC_RESET_OUT"
}

# -----------------------------------------------------------------------------
# Helper functions (vanilla: coreutils + git only)
# -----------------------------------------------------------------------------
__cc_has () { command -v "$1" > /dev/null 2>&1; }

mkcd () {
    if [[ -z ${1:-} ]]
    then
        printf 'usage: mkcd <dir>\n' >&2
        return 2
    fi
    mkdir -p -- "$1" && cd -- "$1" || return
}

up () {
    local n=${1:-1} p=''
    while ((n-- > 0))
    do
        p+=../
    done
    cd "$p" || return
    pwd
}

extract () {
    local f=${1:-}
    if [[ ! -f $f ]]
    then
        printf 'extract: not a file: %s\n' "${f:-<none>}" >&2
        return 1
    fi
    case $f in
        *.tar.bz2 | *.tbz2) tar xjf "$f" ;;
        *.tar.gz | *.tgz) tar xzf "$f" ;;
        *.tar.xz | *.txz) tar xJf "$f" ;;
        *.tar.zst) tar --zstd -xf "$f" ;;
        *.tar) tar xf "$f" ;;
        *.zip) unzip -q "$f" ;;
        *.7z) 7z x "$f" ;;
        *.rar) unrar x "$f" ;;
        *.gz) gzip -dc "$f" > "${f%.gz}" ;;
        *.bz2) bzip2 -dc "$f" > "${f%.bz2}" ;;
        *.xz) xz -dc "$f" > "${f%.xz}" ;;
        *.zst) zstd -dc "$f" > "${f%.zst}" ;;
        *)
            printf 'extract: unknown archive type: %s\n' "$f" >&2
            return 1
            ;;
    esac
}

psg () {
    if [[ -z ${1:-} ]]
    then
        printf 'usage: psg <pattern>\n' >&2
        return 2
    fi
    ps aux | grep -i -- "[${1:0:1}]${1:1}"
}

kport () {
    local p=${1:-} pids=''
    if [[ -z $p ]]
    then
        printf 'usage: kport <port>\n' >&2
        return 2
    fi
    if __cc_has lsof
    then
        pids=$(lsof -ti "tcp:$p" 2> /dev/null)
    elif __cc_has ss
    then
        pids=$(ss -tlnpH "sport = :$p" 2> /dev/null \
            | grep -o 'pid=[0-9]*' | cut -d= -f2 | sort -u)
    fi
    if [[ -z $pids ]]
    then
        printf 'kport: nothing listening on %s\n' "$p" >&2
        return 1
    fi
    kill $pids && printf 'kport: sent TERM to %s\n' "$pids"
}

serve () {
    local p=${1:-8000}
    printf 'serving %s on http://localhost:%s\n' "$PWD" "$p"
    if __cc_has python3
    then
        python3 -m http.server "$p"
    else
        python -m SimpleHTTPServer "$p"
    fi
}

# Desktop notification: notify-send where available, otherwise the terminal
# bell on the controlling TTY (so it is harmless in scripts and over SSH).
notify () {
    local msg=${1:-done} title=${2:-$(hostname -s)}
    if __cc_has notify-send
    then
        notify-send "$title" "$msg"
    elif [[ -t 1 ]]
    then
        printf '\a%s: %s\n' "$title" "$msg"
    else
        printf '%s: %s\n' "$title" "$msg"
    fi
}

# Listening sockets: ss on Linux, lsof on macOS/BSD.
ports () {
    if __cc_has ss
    then
        ss -tulpn
    else
        lsof -iTCP -sTCP:LISTEN -P -n
    fi
}

bak () {
    local f=${1:-}
    if [[ -z $f ]]
    then
        printf 'usage: bak <file>\n' >&2
        return 2
    fi
    local d
    d=$f.$(date +%Y%m%d-%H%M%S).bak
    cp -p -- "$f" "$d" && printf '→ %s\n' "$d"
}

calc () {
    if (($# == 0))
    then
        printf 'usage: calc <expression>\n' >&2
        return 2
    fi
    LC_ALL=C awk "BEGIN { printf \"%.10g\\n\", $* }"
}

json () {
    if __cc_has python3
    then
        python3 -m json.tool "$@"
    else
        cat "$@"
    fi
}

paths () {
    local IFS=: i=0 p
    for p in $PATH
    do
        printf '%2d  %s\n' "$i" "$p"
        i=$((i + 1))
    done
}

# The pager keymap (installed as $XDG_CONFIG_HOME/lesskey) in one screen.
pager-keys () {
    local b=${CC_BOLD_OUT:-} d=${CC_DIM_OUT:-} r=${CC_RESET_OUT:-}
    local a=${CC_ACCENT_OUT:-}
    printf '%s%spager%s less · Emacs keys · %s\n\n' \
        "$b" "$a" "$r$d" "$CC_LESSKEY"
    printf '  %s%-11s%s %s\n' "$b" 'C-n  C-p' "$r" 'one line down / up'
    printf '  %s%-11s%s %s\n' "$b" 'C-f  C-b' "$r" 'one screen down / up'
    printf '  %s%-11s%s %s\n' "$b" 'C-v  M-v' "$r" 'one screen down / up'
    printf '  %s%-11s%s %s\n' "$b" 'C-d  C-u' "$r" 'half a screen down / up'
    printf '  %s%-11s%s %s\n' "$b" 'C-a  C-e' "$r" 'top / bottom of the file'
    printf '  %s%-11s%s %s\n' "$b" 'M-<  M->' "$r" 'top / bottom of the file'
    printf '  %s%-11s%s %s\n' "$b" 'C-s  C-r' "$r" 'search forward / backward'
    printf '  %s%-11s%s %s\n' "$b" 'M-g' "$r" 'go to line'
    printf '  %s%-11s%s %s\n' "$b" 'M-u' "$r" 'clear the search highlighting'
    printf '  %s%-11s%s %s\n' "$b" 'C-l' "$r" 'redraw the screen'
    printf '\n  %sin prompts (:e, /, ?, ...)%s\n' "$d" "$r"
    printf '  %s%-11s%s %s\n' "$b" 'C-a  C-e' "$r" 'beginning / end of the line'
    printf '  %s%-11s%s %s\n' "$b" 'C-b  C-f' "$r" 'one character left / right'
    printf '  %s%-11s%s %s\n' "$b" 'M-b  M-f' "$r" 'one word left / right'
    printf '  %s%-11s%s %s\n' "$b" 'C-w  M-d' "$r" 'kill the word before / after the cursor'
    printf '  %s%-11s%s %s\n' "$b" 'C-k  C-u' "$r" 'kill the whole line'
    printf '  %s%-11s%s %s\n' "$b" 'C-g' "$r" 'cancel the prompt'
    printf '\n  %sstill plain less%s: space b · g G · / ? · n N · m '\'' · ! · | · q%s\n' \
        "$d" "$r" "$r"
}

reload () {
    printf 'reloading %s\n' "$CC_RC_FILE"
    # shellcheck source=/dev/null
    CC_RELOAD=1 . "$CC_RC_FILE"
}

cdroot () {
    local d=$PWD
    while :
    do
        if [[ -e $d/.git ]]
        then
            cd "$d" || return 1
            return 0
        fi
        [[ $d == / ]] && break
        d=${d%/*}
        [[ -z $d ]] && d=/
    done
    printf 'cdroot: not inside a git work tree\n' >&2
    return 1
}

ff () {
    if [[ -z ${1:-} ]]
    then
        printf 'usage: ff <name-fragment>\n' >&2
        return 2
    fi
    find . -iname "*${1}*" -not -path './.git/*' -not -path './node_modules/*'
}

# Most frequently used commands, straight from the history file.
hist-top () {
    local n=${1:-10} f=${HISTFILE:-$HOME/.bash_history}
    [[ -r $f ]] || return 0
    awk '!/^#/ && NF { print $1 }' "$f" | sort | uniq -c | sort -rn | head -n "$n"
}

hgrep () {
    history | grep -- "${1:-}"
}

# Decompress a .gz log and page through it.
gunlog () {
    if [[ -z ${1:-} ]]
    then
        printf 'usage: gunlog <file.gz>\n' >&2
        return 2
    fi
    gzip -dc -- "$1" | ${PAGER:-less}
}

# Startup cost of the shell itself, averaged over a few runs.
rc-time () {
    local n=${1:-5} t0 t1 i
    t0=${EPOCHREALTIME//,/.}   # EPOCHREALTIME honours LC_NUMERIC
    for ((i = 0; i < n; i++))
    do
        bash -i -c exit > /dev/null 2>&1
    done
    t1=${EPOCHREALTIME//,/.}
    LC_ALL=C awk -v a="$t0" -v b="$t1" -v n="$n" \
        'BEGIN { printf "%.1f ms per start (%d runs)\n", (b - a) * 1000 / n, n }'
}

# ---- git -------------------------------------------------------------------
# The one-line git shortcuts (gst, gd, gco, ...) are generated from
# `bash-git-shortcuts' in bash.scm; only the multi-line ones stay here.

glog () {
    local n=${1:-20}
    git log --graph --abbrev-commit --decorate --date=short \
        --format='%C(auto)%h%C(reset) %C(auto)%d%C(reset) %s %C(dim)(%ar)%C(reset)' \
        -n "$n" --all
}


# -----------------------------------------------------------------------------
# Boot: colours, prompt hook, greeting. Called once at the end of the rc file.
# -----------------------------------------------------------------------------
cc_boot () {
    # PS1 is already fully expanded here; leaving promptvars on would let a
    # directory called "$(cmd)" run cmd every time the prompt is drawn.
    shopt -u promptvars 2> /dev/null
    # No XOFF/XON: C-s is forward-search in readline and in the pager, not a
    # frozen terminal. Set per TTY, and only when there is one.
    [[ -t 0 ]] && stty -ixon 2> /dev/null
    __cc_palette
    case ${PROMPT_COMMAND:-} in
        *__cc_prompt*) ;;
        '') PROMPT_COMMAND=__cc_prompt ;;
        *) PROMPT_COMMAND="__cc_prompt;$PROMPT_COMMAND" ;;
    esac
    __cc_prompt
    [[ ${CC_RELOAD:-0} == 1 ]] || shell-greeting
    return 0
}

    [⚙️ assert] No store path leaks into the rc
    ✅ got: #f
    [⚙️ assert] The spliced text is the library itself
    ✅ got: #t
ℹ️ info - ran 1 tasks in: 0 seconds, 34519 microseconds

running unit tests from file: temp-spec.scm, entrypoint: spec


ℹ️ info - shuffled with seed 890329330 (replay with VERITAS_SEED=890329330)
+----------------------------------------------+
[📑 suite] Temporary Directory Suite
  [🧪 test] A directory that is already there is never handed out
    [⚙️ assert] The second call chose another name
    ✅ got: #t
    [⚙️ assert] The new fixture does not inherit the last run's files
    ✅ got: #t
    [⚙️ assert] And the directory that was there is left alone
    ✅ got: #t
  [🧪 test] Removal takes the whole tree, and a missing path is fine
    [⚙️ assert] Removal reports success
    ✅ got: #t
    [⚙️ assert] The tree is gone, not just its files
    ✅ got: #t
    [⚙️ assert] Removing what is not there is not an error
    ✅ got: #t
    [⚙️ assert] Neither is a path that never existed
    ✅ got: #t
  [🧪 test] The directory is named after the fixture, in TMPDIR
    [⚙️ assert] The prefix names the suite that made it
    ✅ got: #t
    [⚙️ assert] And it is created in the directory asked for
    ✅ got: #t
  [🧪 test] Two calls never make the same directory
    [⚙️ assert] Every fixture has a name of its own
    ✅ got: #t
    [⚙️ assert] And every one of them was created
    ✅ got: #t
    [⚙️ assert] Each starts empty, so no run inherits files
    ✅ got: #t
    [⚙️ assert] And none of them is readable by another user
    ✅ got: #t
ℹ️ info - ran 1 tasks in: 0 seconds, 6876 microseconds

running unit tests from file: sysctl-spec.scm, entrypoint: spec


ℹ️ info - shuffled with seed 890329330 (replay with VERITAS_SEED=890329330)
+----------------------------------------------+
[📑 suite] Sysctl Suite
  [🧪 test] The host keeps its routing and addressing role
    [⚙️ assert] Packet forwarding is left to Podman
    ✅ got: #f
    [⚙️ assert] IPv6 forwarding is left alone
    ✅ got: #f
    [⚙️ assert] Router advertisements stay with NetworkManager
    ✅ got: #f
    [⚙️ assert] IPv6 is not switched off
    ✅ got: #f
  [🧪 test] The kernel survives a SYN flood
    [⚙️ assert] Syncookies are on
    ✅ got: 1
    [⚙️ assert] The SYN backlog is larger than the default
    ✅ got: #t
    [⚙️ assert] The accept queue is larger than the default
    ✅ got: #t
  [🧪 test] Kernel internals are not readable by ordinary users
    [⚙️ assert] Kernel pointers are hidden
    ✅ got: 2
    [⚙️ assert] Only root reads the ring buffer
    ✅ got: 1
    [⚙️ assert] Unprivileged BPF loading is off
    ✅ got: 1
  [🧪 test] The settings extend Guix's defaults instead of replacing them
    [⚙️ assert] Guix's own defaults survive
    ✅ got: #t
    [⚙️ assert] and this module's settings are added
    ✅ got: #t
    [⚙️ assert] Nothing is set twice or dropped
    ✅ got: 32
  [🧪 test] Every setting is a well-formed key/value pair
    [⚙️ assert] Each entry is a dotted key and a string
    ✅ got: #t
    [⚙️ assert] No key is set twice
    ✅ got: 30
  [🧪 test] ICMP is bounded
    [⚙️ assert] Broadcast echo is ignored
    ✅ got: 1;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /gnu/store/dh01ag5hxswbpbw7sn67q639kf6wj6bh-guix-jointhefreeworld-fad7201/channel/jointhefreeworld/packages/applications.scm
;;; compiling /gnu/store/dh01ag5hxswbpbw7sn67q639kf6wj6bh-guix-jointhefreeworld-fad7201/channel/jointhefreeworld/packages/guile.scm
;;; compiled /root/.cache/guile/ccache/3.0-LE-8-4.7/gnu/store/dh01ag5hxswbpbw7sn67q639kf6wj6bh-guix-jointhefreeworld-fad7201/channel/jointhefreeworld/packages/guile.scm.go
WARNING: (jointhefreeworld packages applications): `guile-scriba' imported from both (gnu packages guile-xyz) and (jointhefreeworld packages guile)
;;; compiled /root/.cache/guile/ccache/3.0-LE-8-4.7/gnu/store/dh01ag5hxswbpbw7sn67q639kf6wj6bh-guix-jointhefreeworld-fad7201/channel/jointhefreeworld/packages/applications.scm.go
Backtrace:
In ice-9/boot-9.scm:
  1784:12 10 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
           9 (apply-smob/0 #<thunk 7fe2925142e0>)
In ice-9/boot-9.scm:
    733:2  8 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8  7 (_ #(#(#<directory (guile-user) 7fe292518c80>)))
In ice-9/command-line.scm:
   187:19  6 (_ #<input: custom-port 7fe2924ff3f0>)
In unknown file:
           5 (eval (load "/etc/byggsteg/job-clone/wolk-jjba/trunk/config.scm") #<directory (guile-user) 7fe292518c80>)
In ice-9/boot-9.scm:
   2890:4  4 (save-module-excursion _)
  4440:12  3 (_)
In /etc/byggsteg/job-clone/wolk-jjba/trunk/config.scm:
    300:2  2 (_)
In gnu/system.scm:
    241:0  1 (#{ %make-operating-system-procedure/abi-check}# _ #<package linux-libre@7.2.6 gnu/packages/linux.scm:1367 7fe27b9008f0> () ("modprobe.blacklist=usbmouse,usbkbd" "quiet") #f #<<bootloader-configuration> bootloader: #<<bootloader> name: grub-efi package: #<package grub-efi@2.14 gnu/packages/bootloaders.scm:400 7fe27abcf4d0> installer: #<gexp  gnu/bootloader/grub.scm:664:2 7fe27f7c24b0> disk-image-installer: #f configuration-file: "/boot/grub/grub.cfg" configuration-file-generato…> …)
In guix/records.scm:
     72:4  0 (record-abi-mismatch-error _)

guix/records.scm:72:4: In procedure record-abi-mismatch-error:
Throw to key `record-abi-mismatch-error' with args `(abi-check "~a: record ABI mismatch; recompilation needed" (#<record-type <operating-system>>) ())'.
Backtrace:
In ice-9/boot-9.scm:
  1784:12  9 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
           8 (apply-smob/0 #<thunk 7fb9399142e0>)
In ice-9/boot-9.scm:
    733:2  7 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8  6 (_ #(#(#<directory (guile-user) 7fb939918c80>)))
In ice-9/command-line.scm:
   187:19  5 (_ #<input: custom-port 7fb9398ff3f0>)
In unknown file:
           4 (eval (load "/etc/byggsteg/job-clone/wolk-jjba/trunk/config.scm") #<directory (guile-user) 7fb939918c80>)
In ice-9/boot-9.scm:
   2890:4  3 (save-module-excursion _)
  4440:12  2 (_)
In /etc/byggsteg/job-clone/wolk-jjba/trunk/config.scm:
    257:2  1 (_)
In wolk-jjba/secrets.scm:
    127:8  0 (read-secret "mpd-admin")

wolk-jjba/secrets.scm:127:8: In procedure read-secret:
missing secret: /tmp/wolk-jjba-spec-22088-1792951237-26/no-such-directory/mpd-admin
The radio reads four secrets from /tmp/wolk-jjba-spec-22088-1792951237-26/no-such-directory: mpd-admin, mpd-read, icecast-source and icecast-admin.
Create them as described in "Create the secrets" in README.org, e.g.
  openssl rand -base64 24 | sudo tee /tmp/wolk-jjba-spec-22088-1792951237-26/no-such-directory/mpd-admin >/dev/null
  sudo chmod 600 /tmp/wolk-jjba-spec-22088-1792951237-26/no-such-directory/mpd-admin
or push them from the machine you keep them on with `maak secrets'.

    [⚙️ assert] Echo replies are rate limited
    ✅ got: #t
  [🧪 test] Spoofed and redirected traffic is not honoured
    [⚙️ assert] Reverse-path filtering is strict
    ✅ got: 1
    [⚙️ assert] and applies to interfaces created later
    ✅ got: 1
    [⚙️ assert] IPv4 redirects are refused
    ✅ got: 0
    [⚙️ assert] IPv6 redirects are refused
    ✅ got: 0
    [⚙️ assert] This host sends no redirects
    ✅ got: 0
    [⚙️ assert] Source-routed IPv4 is refused
    ✅ got: 0
ℹ️ info - ran 1 tasks in: 0 seconds, 5215 microseconds

running unit tests from file: operating-system-spec.scm, entrypoint: spec


ℹ️ info - shuffled with seed 890329330 (replay with VERITAS_SEED=890329330)
+----------------------------------------------+
[📑 suite] Operating System Suite
  [🧪 test] The system configuration evaluates as an ordinary user
    [⚙️ assert] config.scm evaluates without root
    ❌ fail - error, expect: 0, got: 256
    [⚙️ assert] The host keeps its name
    ❌ fail - error, expect: wolk-jjba, got: (the child did not evaluate config.scm)
    [⚙️ assert] The result is an operating-system
    ❌ fail - error, expect: #t, got: #f
  [🧪 test] The machine still has its services
    [⚙️ assert] The service list is the whole machine
    ❌ fail - error, expect: #t, got: #f
  [🧪 test] The passwords come from the secrets directory the environment names
    [⚙️ assert] The admin password is the fixture's
    ❌ fail - error, expect: fixture-admin-password, got: 
    [⚙️ assert] The read password is the fixture's
    ❌ fail - error, expect: fixture-read-password, got: 
  [🧪 test] A missing secrets directory fails the evaluation
    [⚙️ assert] config.scm cannot silently ship without secrets
    ✅ got: #t
  [🧪 test] The languages a visitor may ask for are compiled
    [⚙️ assert] Japanese, Greek, Chinese (both scripts), Arabic and Russian
    ❌ fail - error, expect: (#t #t #t #t #t #t), got: (#f #f #f #f #f #f)
ℹ️ info - ran 1 tasks in: 0 seconds, 3080 microseconds

❌ error - 
aborting due to error in test case...



--------------------------------------------------------------

Maak 0.12.2: the infinitely extensible command runner

Loading tasks from Maak file: /etc/byggsteg/job-clone/wolk-jjba/trunk/maak.scm

Executing Maak tasks: test


--------------------------------------------------------------

=> Running Maak task: test

  Run the Veritas unit-test suite, one process per test file.

Runs inside the manifest shell like the other Scheme tasks: the suite
imports (guix gexp) and (gnu services ...) and needs veritas, none of
which are in the machine's system profile, so a bare `guile' fails with
`no code for module (veritas runner)' -- which is what the Byggsteg CI
task `maak-test' used to hit.

The files run in parallel, one process each, in as many processes as
this machine may use up to four; VERITAS_JOBS overrides that count.
Four things are deliberate, so that a failure here is a failure of the
code under test rather than of the schedule:

  - the order the files run in is shuffled, and the seed is printed:
    `VERITAS_SEED=<the seed> VERITAS_SHUFFLE_FILES=true maak test'
    replays a failing order, and `VERITAS_SHUFFLE_FILES=false' runs them
    in the fixed one;
  - every fixture is created under a name unique to the run and removed
    when it ends (see test/veritas/temp.scm), so two workers -- or two CI
    jobs sharing /tmp -- cannot collide on one;
  - GUILE_LOAD_PATH names the channel's module directory, because
    evaluating config.scm needs the jointhefreeworld channel and the pinned
    shell does not carry it -- worked out from the pulled guix when there is
    one and from the guix that pinned the channels when there is not (see
    the comments above);
  - a suite that needs the network or the machine's own root-only files
    is a suite that fails for reasons nobody can act on, and there is
    none of those: see the Commentary of each spec.

Executing: env VERITAS_JOBS=1 GUILE_LOAD_PATH=/gnu/store/48kikkip5zdiym0fnv31a8w5cxmjh443-jointhefreeworld/share/guile/site/3.0 guix time-machine --channels=channels.scm -- shell -m manifest.scm -- guile -L ./src -L ./test -c '(use-modules (veritas runner)) (run-tests)'

maak: error: command failed (exit code 1): env VERITAS_JOBS=1 GUILE_LOAD_PATH=/gnu/store/48kikkip5zdiym0fnv31a8w5cxmjh443-jointhefreeworld/share/guile/site/3.0 guix time-machine --channels=channels.scm -- shell -m manifest.scm -- guile -L ./src -L ./test -c '(use-modules (veritas runner)) (run-tests)'
        hint: Fix the command above, or run `maak --dry-run' to inspect it first.
inspect the job's lambda expression
(lambda()
  `((task . "maak-test")
    (project . "wolk-jjba")
    (branch-name . "trunk")
    (clone-url . "https://codeberg.org/jjba23/wolk-jjba.git")))