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
This commit is contained in:
+33
-7
@@ -22,12 +22,36 @@ board metadata (`boards/*/board.yml`); this toolkit mechanizes those recipes.
|
||||
- Discovery via vendored **asic-rs 0.8.1** (MinerFactory::scan_stream over the configured CIDR list)
|
||||
- UI-SPEC primary view: 6 KPIs (Total/Hashing/Slow/Not hashing/total hashrate/est. power), scan-ranges editor, Excel-style filter panel, columns panel, sortable + drag-reorderable table with row checkboxes, IP pinned first, default order hashrate → power → chip temp → cooling → firmware → pool worker → model/status
|
||||
- Pure-Rust GUI on wxWidgets: vendored wx-rs 0.2.0 **extended by patches** (upstream stubs Linux and had no widgets) + vendored wxWidgets 3.3.3 (static monolithic GTK3)
|
||||
- Built + smoke-tested on this machine (debug + release run clean under xvfb)
|
||||
- **Visually verified working** (off-screen Xvfb screenshots): table renders below the header full-width; all dialogs (Scan ranges / Filter / Columns) open, apply, and close without crashing; header-click sort, column hide, and row-checkbox all work.
|
||||
|
||||
**Fixed 2026-09-15 (this session), with regression tests:**
|
||||
- **Table rendered in the top-left corner** instead of below the header: the dvlc was created but never added to the sizer. `rebuild_table` now adds it to the root sizer (proportion 1, EXPAND) and re-runs the panel layout; `add_stretch(1)` (which ate all vertical space) removed.
|
||||
- **App crashed (abort) on most buttons**: the dialog `root` sizers passed `ALIGN_CENTRE_VERTICAL` to a *vertical* sizer, tripping a wxWidgets consistency assert whose default handler pumps a nested event loop; the 1 s scan timer then re-entered the single `dispatch` while it still held the `App` `RefCell` borrow → `RefCell already borrowed` → non-unwinding panic → abort. Fixed the invalid flags, and hardened `dispatch` into two phases (build under the borrow, `show_modal` outside it) with `try_borrow_mut` so any future nested re-entry drops the event instead of aborting.
|
||||
- Header-click sort mapped the clicked column through `view.order` (wrong when a column was hidden) → now maps through `display_columns()`. Drag-reorder likewise (`ViewState::apply_visible_reorder`, splices visible order back into the full order so hidden columns are never dropped). Row-selection checkbox now survives a table refresh.
|
||||
|
||||
**Feature round 2026-09-15 (operator requests, verified by live bench scan + selftest):**
|
||||
- Redesigned KPI header: colour-coded cards (green Hashing / amber Slow / red Not hashing / blue Hashrate), big value over small label, theme-aware.
|
||||
- Light/dark mode follows the system (wxSystemSettings + `set_appearance_system`); custom KPI colours adapt.
|
||||
- SI-formatted hashrate/power everywhere (KPIs + columns): prefix chosen so the mantissa is 1-999, 1 decimal below 100 (e.g. `685 TH/s`, `21.3 kW`, `95.0 TH/s`). Note: strict "<=2 digits" would render 685 TH/s as `0.7 PH/s`; the 3-sig-fig form reads better - flag if you want the strict form.
|
||||
- Scan ranges accept CIDR, single IP, `A.B.C.D-E.F.G.H` full ranges, and `A.B.C.D-N` short ranges (`scan::parse_line`).
|
||||
- Scan progress bar across the top of the table + status-bar text (`scan_stream_with_ip` gives per-address progress); the inline "scan done" text is gone.
|
||||
- Out-of-range miners are dropped when a scan starts (rows retained by the new target set).
|
||||
- Columns panel exposes **every** scannable `MinerData` metric (~30, model.rs `Column`), with All / None / Defaults.
|
||||
- Excel-style filter panel built out: per-category value checklists (numeric columns excluded), per-column All/None, Apply/Reset/Cancel, "(blank)" handling.
|
||||
- Sort direction shown as an ASCII marker in the header (`^`/`v`); native `SetSortOrder` was rejected because it re-sorts the store lexically and fought the numeric sort.
|
||||
- Double-click a row opens `http://<ip>` in the default browser (`wxLaunchDefaultBrowser`).
|
||||
- Filter panel horizontal layout can get wide with many category columns (no scrolled-window in the bridge yet); it is resizable. Live text-search within a filter column is not implemented.
|
||||
|
||||
**Dev / review / visual-feedback loop (see AGENTS.md):**
|
||||
- `scripts/ui-selftest.sh` — headless workflow self-test: `ALKANE_SELFTEST` mode renders the bench-fleet fixtures through the real widgets and compares the table cells + KPIs to the expected hardware output (13 checks; exit non-zero on any mismatch). `cargo test -p alkane-gui` runs the transform-layer unit tests (10).
|
||||
- `scripts/ui-screenshot.sh [out.png] [--live]` — off-screen (private Xvfb) screenshot for visual review; defaults to the offline `ALKANE_FAKE_SCAN` fixtures.
|
||||
- Offline modes: `ALKANE_FAKE_SCAN=1` feeds `crates/alkane-gui/src/fixtures.rs` (the 9 bench boards) instead of scanning; `ALKANE_SELFTEST=1` runs the self-test and exits.
|
||||
- Headless X gotcha: the GTK window only maps under Xvfb with `GDK_BACKEND=x11` set (the scripts do this).
|
||||
|
||||
**Not done yet (open threads, in rough priority):**
|
||||
1. Windows + macOS builds — `scripts/build-gui-{windows,macos}.sh` exist; Windows needs msys2/MSVC (wx-rs build.rs handles msys2 paths natively), macOS needs a Mac to link. Consider a gitea Actions CI runner. No CI config exists at all yet.
|
||||
2. ARP/ICMP pre-pass for link-up-but-silent boards (M1 scope, spec'd in plan §5, not implemented)
|
||||
3. Column order/visibility persistence (`ui.conf` — spec'd in UI-SPEC "Implementation notes", not implemented)
|
||||
3. Column order/visibility *persistence* to `ui.conf` (spec'd in UI-SPEC "Implementation notes"). Visibility (Columns dialog) and drag-reorder both work in-session; only the save/restore across runs is missing.
|
||||
4. Sort-direction indicator in headers; per-model "Slow" bands (currently flat 80% of expected); model-derived power estimates for units that don't report wattage
|
||||
5. M2: verify-image port (magic/min-size/integrity) + artifact registry expansion (`crates/alkane-artifacts/data/manifest-seed.csv` = 14 sha256'd bench artifacts; bulk archives 3.7GB/624MB not hashed)
|
||||
6. M3+: first install pathway (zynq-7010 stock↔stock, proven on the bench S17), then per plan §7. Note **no alkaneOS build exists** (SDK boards all "bake"), so installs are stock↔stock only until the SDK produces artifacts.
|
||||
@@ -88,9 +112,11 @@ Key implementation facts (don't re-derive):
|
||||
## 6. Verification evidence
|
||||
|
||||
- `cargo build --workspace --offline` clean (network-independent; all sources vendored)
|
||||
- Release binary smoke-tested twice under xvfb: runs until killed, no crash, no wx warnings
|
||||
- Git: tip `b264cdd6` pushed to gitea (gitea repo `size` field updates lazily — the commit has 16k files/4.9M insertions incl. the wx tree)
|
||||
- NOT yet verified: a human eyeballing the window on the real bench fleet (xvfb smoke ≠ visual check). First thing next session: run it, confirm the 9 bench boards render.
|
||||
- `cargo test -p alkane-gui --offline`: 10 transform-layer unit tests pass (KPIs, sort, filter, cell formatting, slow band, hidden-column mapping, drag-reorder splice, selection-survives-upsert).
|
||||
- `scripts/ui-selftest.sh`: 13/13 checks pass end-to-end through the real widgets (KPI labels, row count, every cell matches the model, slow/not-hashing spot checks, IP is first text column).
|
||||
- Visual review via `scripts/ui-screenshot.sh` (off-screen Xvfb): confirmed the table renders below the header, and drove every button with xdotool (open/apply/cancel each dialog, header sort, column hide, row check) with zero crashes/panics.
|
||||
- Git: previous tip `b264cdd6` pushed to gitea (gitea repo `size` field updates lazily — that commit has 16k files/4.9M insertions incl. the wx tree).
|
||||
- Still open: eyeball on the **real bench fleet** (`--live`). The visual + interaction checks above used the offline fixtures; a live run against the 9 boards on 10.255.1.0/24 is the remaining confidence step.
|
||||
|
||||
## 7. Bench fleet context (for the scan you'll see)
|
||||
|
||||
@@ -100,5 +126,5 @@ Key implementation facts (don't re-derive):
|
||||
|
||||
- Confidence tags (CONFIRMED/DERIVED/EXTERNAL) on claims in docs; cite file paths.
|
||||
- Commit style so far: single-line imperative summaries, no sign-off noise.
|
||||
- The repo has no AGENTS.md/CLAUDE.md yet — if you establish repo-level rules, write them there and keep them short.
|
||||
- When you change the vendored wx-rs: edit `thirdparty/wx-rs/wx-rs-0.2.0-patched/`, regenerate the matching `patches/NNNN-*.patch` via `diff -u /tmp/pristine ...` (pristine tarball URL+sha in `VERSION`), commit both.
|
||||
- Repo-level rules now live in `AGENTS.md` (dev/review/visual loop, offline modes, build discipline). Keep it short.
|
||||
- When you change the vendored wx-rs: edit `thirdparty/wx-rs/wx-rs-0.2.0-patched/`, regenerate the matching `patches/NNNN-*.patch` via `diff -u` against the pristine crate (tarball URL+sha in `thirdparty/wx-rs/VERSION`), and confirm the patch set reconstructs the patched tree before committing both.
|
||||
|
||||
Reference in New Issue
Block a user