Files
ely-eye/scripts/ui_smoke.sh
T
ZacharyZhang-NY 9f91ff7ed7 Let the console search, browse, forget and mount
The store had a write path, a mount path and a search path, and the console
still showed a dashboard of counters. Nothing in the UI could ask what someone
knows, page through atoms, look at a wordless picture, forget one memory, or
mount a cartridge — so the mechanisms built in P0 were invisible.

Backend:
- senses.py: one function decides what this machine can perceive. /api/status
  and doctor each computed it before, which is two truths. Picture atoms are now
  counted by image_ref rather than by modality, so a screenshot crop from a PDF
  counts and a picture whose bytes were deleted stops claiming it can be encoded.
- browse.py: GET /api/atoms pages newest-first through v_atoms_current with
  modality/holder/source filters; GET /api/atoms/{id}/image serves the stored
  bytes so a picture with no OCR text can be looked at.
- Deleted 8 HTTP routes nobody calls (4 benchmark, research modules, dense index,
  visual-contradiction-proof, memory-map). Their functions stay: the CLI and the
  proof checks use them. The surface is 30 routes, pinned as a set by a test so a
  new unused route fails the suite.

Frontend: App.tsx (517 lines) became a 131-line shell plus seven panels that own
their own fetches, and lib/format.ts. types.ts now carries the memory dimensions
the backend has been sending since schema v2.

Two invented fields were rendering lies: AdapterPanel showed gpu_available and
probe_status, which AdapterLoadReport does not have — every machine looked GPU-less
including this one. The panel now shows only what the server says.

Proof: scripts/ui_smoke.sh starts the API on a fresh temp home, serves the built
UI from the same origin, and drives five interactions in a real browser — search
as somebody in a scenario, page and view a wordless picture, forget, mount, read
adapter states with reasons. It prints the mount refusal verbatim rather than
pretending the mount succeeded.

Gates: 263 pytest passed; ruff and mypy clean on the 8 touched backend files
(repo-wide mypy unchanged at 24 errors / 6 files); pyright 0 errors there;
go build/vet/test/gofmt clean; npm build + eslint clean; ui_smoke and
mcp_write_smoke both PASS.
2026-10-08 05:13:38 -04:00

72 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# The console is proven by driving it: a fresh home, the built interface served by the
# API itself, and a browser that searches, pages, forgets, mounts and reads adapter states.
# ELY_EYE_UI_SMOKE_KEEP=1 leaves the temporary home in place and prints it.
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
python="${PYTHON:-$repo/.venv/bin/python}"
server_bin="$(dirname "$python")/ely-eye"
if [[ ! -x "$server_bin" ]]; then
echo "$server_bin is not installed; run scripts/install.sh first" >&2
exit 1
fi
port="${ELY_EYE_UI_SMOKE_PORT:-8791}"
api="http://127.0.0.1:${port}"
home="$(mktemp -d "${TMPDIR:-/tmp}/ely-eye-ui-smoke.XXXXXX")"
server=""
cleanup() {
if [[ -n "$server" ]] && kill -0 "$server" 2>/dev/null; then
kill "$server" 2>/dev/null || true
wait "$server" 2>/dev/null || true
fi
if [[ "${ELY_EYE_UI_SMOKE_KEEP:-}" == "1" ]]; then
echo "kept: $home"
else
rm -rf "$home"
fi
}
trap cleanup EXIT
if [[ ! -f "$repo/frontend/dist/index.html" ]]; then
(cd "$repo/frontend" && npm run build)
fi
export ELY_EYE_HOME="$home"
export ELY_EYE_DEFAULT_HOLDER=wife
export ELY_EYE_UI_DIR="$repo/frontend/dist"
"$server_bin" serve --host 127.0.0.1 --port "$port" >"$home/serve.log" 2>&1 &
server=$!
ready=""
for _ in $(seq 1 120); do
if curl -sf "$api/api/status" >/dev/null 2>&1; then
ready=yes
break
fi
if ! kill -0 "$server" 2>/dev/null; then
echo "the API stopped before it was ready:" >&2
cat "$home/serve.log" >&2
exit 1
fi
sleep 0.5
done
if [[ -z "$ready" ]]; then
echo "the API never answered on $api:" >&2
cat "$home/serve.log" >&2
exit 1
fi
# The interface is served by the same process, so the browser talks to one origin.
if ! curl -sf "$api/" >/dev/null 2>&1; then
echo "the API is up but does not serve the built interface at /; is frontend/dist real?" >&2
cat "$home/serve.log" >&2
exit 1
fi
(cd "$repo/frontend" && ELY_EYE_API="$api" ELY_EYE_UI_URL="$api/" ELY_EYE_UI_SMOKE_DIR="$home" node scripts/verify-ui.mjs)
echo "PASS: the console searches, pages, forgets, mounts and reports adapter states"