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

28 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
set -eu
command -v rust-analyzer >/dev/null || { echo "skip: rust-analyzer not installed"; exit 0; }
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_lens.py" $port & srv=$!
mkdir -p "$tmp/home/.hx" "$tmp/repo/src"
echo '{"claude":{"access":"fake-token","refresh":"r","expires":99999999999999}}' > "$tmp/home/.hx/auth.json"
printf '[package]\nname = "t"\nversion = "0.1.0"\nedition = "2021"\n' > "$tmp/repo/Cargo.toml"
sleep 0.5
export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
cd "$tmp/repo"
HOME="$tmp/home" HX_BASE_URL="http://127.0.0.1:$port" "$root/target/debug/hx" -p "add f" > "$tmp/out" 2> "$tmp/err" || { cat "$tmp/err"; exit 1; }
grep -q "FINISHED lens=clean" "$tmp/out" || { echo "--- out"; cat "$tmp/out"; echo "--- err"; cat "$tmp/err"; exit 1; }
grep -q "42" src/lib.rs
curl -s "http://127.0.0.1:$port/" | grep -q 'mismatched types'
kill $srv; python3 "$root/tests/fake_lens.py" $port & srv=$!; sleep 0.5
git checkout -q -- . 2>/dev/null || rm -f src/lib.rs
HOME="$tmp/home" HX_BASE_URL="http://127.0.0.1:$port" "$root/target/debug/hx" -p "add f" --mode json > "$tmp/json" 2> "$tmp/err" || { cat "$tmp/err"; exit 1; }
python3 - "$tmp/json" <<'PY' || { echo "FAIL: no injected lens event"; exit 1; }
import json, sys
ev = [json.loads(l) for l in open(sys.argv[1])]
assert any(e["type"] == "injected" and any("[lens]" in t and "mismatched types" in t for t in e["texts"]) for e in ev)
PY
echo "lens e2e ok"