#!/bin/sh # Tests for bin/check-session-log. # # The regression: nine skills documented a session_log payload and not one of # them named `session_id` — the tool's ONLY required field. Every documented # call was incomplete, so an agent following any of them either failed the call # or invented an id, and invented ids do not group. Found by a pressure test # against `debug`, then found to be fleet-wide (#36). # # Also gated: `duration_ms: `, which an agent cannot measure. A # documented field nobody can honestly populate gets fabricated or silently # dropped; both are worse than omitting it. set -u ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) SUT="$ROOT/bin/check-session-log" pass=0 fail=0 WORK=${TMPDIR:-/tmp}/check_session_log_test.$$ if [ ! -f "$SUT" ]; then printf 'FAIL: %s does not exist\n' "$SUT" exit 1 fi cleanup() { rm -rf "$WORK"; } trap cleanup EXIT INT TERM # fixture — a checkout with one skill whose SKILL.md is . fixture() { _f="$WORK/$1" mkdir -p "$_f/skills/alpha" printf -- '---\nname: alpha\ndescription: a\n---\n\n%s\n' "$2" > "$_f/skills/alpha/SKILL.md" printf '%s' "$_f" } # expect