#!/usr/bin/env bash
# Stub systemctl for the deploy-handler seam: every invocation is logged, so
# a test asserts on what the handler ASKED systemd to do. `is-active` answers
# "inactive" (the state a cutover finds the unit in) and MainPID answers
# $STUB_MAIN_PID — 0 is the stray-port-holder shape, the false-green gate
# every LLM handler reads after a health answer.
printf '%s\n' "$*" >> "${STUB_SYSTEMCTL_LOG:-/dev/null}"
case "$*" in
    "is-active "*) echo inactive ;;
    *"MainPID --value "*) echo "${STUB_MAIN_PID:-4242}" ;;
esac
exit 0
