Files
alkane-toolkit/scripts/ui-selftest.sh
T
noahandClaude Opus 4.8 d88df603ba Fix GUI layout/crash bugs; add operator features, tests, and dev loop
Round 1 (bug fixes + test harness):
- Fix table rendering in the top-left corner: the dvlc was never added to the
  sizer; add it (proportion 1) and re-run layout; drop the space-eating stretch.
- Fix abort on dialog buttons: the dialog root sizers passed ALIGN_CENTRE_VERTICAL
  to a vertical sizer, tripping a wx consistency assert whose handler pumps a
  nested event loop, re-entering dispatch while it held the App RefCell borrow.
  Remove the invalid flags; split dispatch into two phases with try_borrow_mut.
- Fix header-click sort mapping when columns are hidden (use display_columns);
  drag-reorder splices back into the full order without dropping hidden columns.
- Add offline fixtures + ALKANE_FAKE_SCAN and ALKANE_SELFTEST modes; scripts
  ui-selftest.sh and ui-screenshot.sh; AGENTS.md documents the dev loop.

Round 2 (operator requests):
- Redesigned color-coded KPI cards; light/dark mode follows the system theme.
- SI-formatted hashrate/power on the KPIs and columns (685 TH/s, 21.3 kW).
- Scan ranges accept CIDR, single IP, and A.B.C.D-E.F.G.H / A.B.C.D-N ranges;
  oversized ranges (> 1,000,000 addresses) are rejected.
- Scan progress bar over the table + status-bar text; out-of-range miners are
  dropped when a scan starts.
- Columns panel exposes every scannable MinerData metric (All / None / Defaults).
- Excel-style filter panel: per-category value checklists, per-column All/None,
  Apply / Reset / Cancel, blank handling.
- Sort direction marker in the header (updated in place); double-click a row
  opens the miner in the default browser.

wx-rs: extend the widget bridge (gauge, in-place column title, sort indicator,
browser launch, system appearance/colours, widget colours, item-activated);
patches 0002/0003 regenerated and round-trip validated.

Verified: 22 unit tests + a 13-check headless UI self-test, plus a live scan
against the bench fleet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 16:24:05 -06:00

40 lines
1.6 KiB
Bash

#!/bin/bash
# Headless UI workflow self-test.
#
# Builds alkane-toolkit, then runs it in ALKANE_SELFTEST mode under a private
# Xvfb display. In that mode the app loads the bench-fleet fixtures (the
# expected hardware output), renders them through the real wxWidgets table and
# KPI header, reads back what the widgets actually display, and compares to the
# expected result. It prints one line per check and exits non-zero on any
# mismatch -- so this is a CI-able, hardware-free check that the app's functions
# produce the intended output.
#
# Usage: scripts/ui-selftest.sh [binary]
# binary defaults to the release build in the cargo target dir.
set -u
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
WX_PREFIX="${WX_PREFIX:-$HOME/.cache/wx-3.3.3-linux}"
export WX_RS_WXCONFIG="${WX_RS_WXCONFIG:-$WX_PREFIX/bin/wx-config}"
BIN="${1:-}"
if [ -z "$BIN" ]; then
if [ ! -x "$WX_PREFIX/bin/wx-config" ]; then "$REPO/scripts/build-wx-linux.sh"; fi
( cd "$REPO" && cargo build --release -p alkane-gui --offline ) || exit 3
# locate the binary via the machine-local target dir
TDIR=$(cd "$REPO" && cargo metadata --no-deps --format-version 1 --offline 2>/dev/null \
| tr ',' '\n' | grep -o '"target_directory":"[^"]*"' | head -1 | cut -d'"' -f4)
[ -n "$TDIR" ] || TDIR="$REPO/target"
BIN="$TDIR/release/alkane-toolkit"
fi
[ -x "$BIN" ] || { echo "binary not found: $BIN" >&2; exit 3; }
DISP=":98"
Xvfb "$DISP" -screen 0 1280x850x24 -nolisten tcp >/dev/null 2>&1 &
XPID=$!
sleep 1.2
DISPLAY="$DISP" GDK_BACKEND=x11 ALKANE_SELFTEST=1 "$BIN"
RC=$?
kill "$XPID" 2>/dev/null
echo "== ui-selftest exit=$RC =="
exit "$RC"