Files
hx/tests/m6_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

46 lines
2.3 KiB
Bash

#!/bin/sh
set -eu
root=$(cd "$(dirname "$0")/.." && pwd)
tmp=$(mktemp -d)
trap 'kill $srv 2>/dev/null; rm -rf "$tmp"' EXIT
port=$((20000 + $$ % 20000))
python3 "$root/tests/fake_m6.py" $port & srv=$!
mkdir -p "$tmp/home/.hx" "$tmp/repo/.hx"
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"
cat > "$tmp/repo/.hx/mcp.json" <<EOF
{"mcpServers": {"f": {"command": "python3", "args": ["$root/crates/hx-mcp/tests/fake_mcp.py"], "eager": false}}}
EOF
sleep 0.5
cd "$tmp/repo"
export HOME="$tmp/home" HX_BASE_URL="http://127.0.0.1:$port"
"$root/target/debug/hx" -p "sum" > "$tmp/out" 2> "$tmp/err" || { cat "$tmp/err"; exit 1; }
grep -q "FINISHED OK:42" "$tmp/out" || { echo "--- out"; cat "$tmp/out"; echo "--- log"; curl -s "http://127.0.0.1:$port/"; echo "--- err"; cat "$tmp/err"; exit 1; }
"$root/target/debug/hx" mcp > "$tmp/st"
grep -q "f: 5 tools.*lazy (index ~[0-9]* tok, eager schemas ~[0-9]* tok)" "$tmp/st" || { cat "$tmp/st"; exit 1; }
printf 'fn main() {}\n' > main.rs
cat > "$tmp/repo/.hx/mcp.json" <<EOF
{"mcpServers": {"hx": {"command": "$root/target/debug/hx", "args": ["mcp-serve"], "eager": false}}}
EOF
"$root/target/debug/hx" mcp > "$tmp/st2"
grep -q "hx.lsp: Language server queries" "$tmp/st2" || { cat "$tmp/st2"; exit 1; }
if command -v pyright-langserver >/dev/null; then
printf 'x: int = "no"\n' > bad.py
python3 - "$root/target/debug/hx" > "$tmp/diag" <<'PY'
import json, subprocess, sys
p = subprocess.Popen([sys.argv[1], "mcp-serve"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
def rpc(i, m, params):
p.stdin.write(json.dumps({"jsonrpc": "2.0", "id": i, "method": m, "params": params}) + "\n"); p.stdin.flush()
while True:
r = json.loads(p.stdout.readline())
if r.get("id") == i:
return r
rpc(1, "initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "t", "version": "0"}})
r = rpc(2, "tools/call", {"name": "lsp", "arguments": {"action": "diagnostics", "path": "bad.py"}})
print(r["result"]["content"][0]["text"])
p.stdin.close(); p.wait(timeout=30)
PY
grep -q 'error.*not assignable' "$tmp/diag" || { echo "--- diag"; cat "$tmp/diag"; exit 1; }
fi
echo "m6 e2e ok"