Files
hx/tests/m8_e2e.sh
T
johannesandClaude Sonnet 5.5 a94632ea3d chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record.
Tautology/stale/excuse comments are deleted (excuses filed as issues
#196-#236), decisions moved to docs/adr/0001-0034.

- scripts/lint-comments.sh + .comment-baseline: per-file comment count
  may only go down; wired into tests/all.sh
- .claude/skills/delete-comment: repeatable audit workflow
- cargo fmt applied to touched crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 13:37:32 +01:00

43 lines
2.1 KiB
Bash

#!/bin/sh
set -eu
root=$(cd "$(dirname "$0")/.." && pwd)
tmp=$(mktemp -d)
trap 'kill $srv 2>/dev/null; rm -rf "$tmp"' EXIT
mkdir -p "$tmp/home/.hx" "$tmp/repo"
echo '{"claude":{"access":"fake-token","refresh":"r","expires":99999999999999}}' > "$tmp/home/.hx/auth.json"
printf '[lsp]\nmode = "off"\ntests = "off"\n' > "$tmp/home/.hx/config.toml"
echo "secret is 42" > "$tmp/repo/note.txt"
echo "PROJECT-RULE-XYZ" > "$tmp/repo/AGENTS.md"
cat > "$tmp/turns.json" <<'J'
[[["tool_use", {"id": "p1", "name": "Task", "input": {"prompt": "what is in note.txt?"}}]],
[["tool_use", {"id": "c1", "name": "Read", "input": {"path": "note.txt"}}]],
[["text", "note.txt says: secret is 42"]],
[["text", "Parent done."]]]
J
cd "$tmp/repo"
export HOME="$tmp/home"
port=$((20000 + $$ % 20000))
python3 "$root/tests/fake_anthropic.py" $port "$tmp/turns.json" & srv=$!
export HX_BASE_URL="http://127.0.0.1:$port"
sleep 0.5
"$root/target/debug/hx" -p "go" -s "$tmp/s.jsonl" > "$tmp/out" 2> "$tmp/err" || { echo "FAIL run"; cat "$tmp/err"; exit 1; }
grep -q "Parent done." "$tmp/out" || { echo "FAIL parent text"; cat "$tmp/out" "$tmp/err"; exit 1; }
curl -s "http://127.0.0.1:$port/log" > "$tmp/log"
python3 - "$tmp/log" "$tmp/s.jsonl" <<'PY' || { echo "FAIL requests"; exit 1; }
import json, sys
log = json.load(open(sys.argv[1]))
assert len(log) == 4, len(log)
parent, child1, child2, parent2 = [r["body"] for r in log]
assert "haiku" in child1["model"] and "sonnet" in parent["model"], (child1["model"], parent["model"])
assert child1["messages"][0]["content"][0]["text"] == "what is in note.txt?"
assert {t["name"] for t in child1["tools"]} == {"Read", "Bash", "skill"}, [t["name"] for t in child1["tools"]]
assert "Task" in {t["name"] for t in parent["tools"]}
for r in (parent, child1, child2):
assert "PROJECT-RULE-XYZ" in json.dumps(r["system"]), r["model"]
res = json.dumps(parent2["messages"][-1])
assert "secret is 42" in res and "[task explore" in res
PY
ls "$tmp/s.sub/001-explore.jsonl" > /dev/null || { echo "FAIL child session"; exit 1; }
"$root/target/debug/hx" stats "$tmp/s.jsonl" | grep -q "subagents (1 runs" || { echo "FAIL stats"; exit 1; }
echo "m8 e2e ok"