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
14 KiB
HANDOFF — alkane-toolkit
For: resuming this work in Claude Code (or any fresh agent session).
Read order: this file → docs/IMPLEMENTATION-PLAN.md → docs/UI-SPEC.md → docs/adr/000{1,2,3}*.md → README.md.
Parent project: ~/Ultron/projects/miner-firmware/ (its HANDOFF.md, AGENTS.md and MEMORY-SNAPSHOT/ hold the bench context and standing orders — read them before touching real hardware).
1. What this repo is
alkane-toolkit = cross-platform desktop toolkit (pure-Rust GUI on wxWidgets)
to install stock or alkaneOS on ASIC miner control boards, whatever they
currently run. Sibling repo ~/Ultron/projects/miner-firmware/alkane-sdk/
owns the board doctrine (docs/install-methods.md = the invariants) and the
board metadata (boards/*/board.yml); this toolkit mechanizes those recipes.
- Remote:
https://gitea.bluefla.re/blueflare/alkane-toolkit(private, branchmain, tipb264cdd6) - GitHub is DEAD (account suspended): never touch github remotes; old ones are kept as
github-suspendedin sibling clones - Gitea auth: token in
~/.config/gitea/token, askpass helper~/.config/gitea/askpass(usernoah, admin). For git:export GIT_ASKPASS=~/.config/gitea/askpass GIT_TERMINAL_PROMPT=0
2. Current state (2026-09-15)
Ships today (M1 primary view):
- 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)
- 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_tablenow 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
rootsizers passedALIGN_CENTRE_VERTICALto 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 singledispatchwhile it still held theAppRefCellborrow →RefCell already borrowed→ non-unwinding panic → abort. Fixed the invalid flags, and hardeneddispatchinto two phases (build under the borrow,show_modaloutside it) withtry_borrow_mutso 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 throughdisplay_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 as0.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.Hfull ranges, andA.B.C.D-Nshort ranges (scan::parse_line). - Scan progress bar across the top of the table + status-bar text (
scan_stream_with_ipgives 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
MinerDatametric (~30, model.rsColumn), 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); nativeSetSortOrderwas 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_SELFTESTmode 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-guiruns the transform-layer unit tests (10).scripts/ui-screenshot.sh [out.png] [--live]— off-screen (private Xvfb) screenshot for visual review; defaults to the offlineALKANE_FAKE_SCANfixtures.- Offline modes:
ALKANE_FAKE_SCAN=1feedscrates/alkane-gui/src/fixtures.rs(the 9 bench boards) instead of scanning;ALKANE_SELFTEST=1runs the self-test and exits. - Headless X gotcha: the GTK window only maps under Xvfb with
GDK_BACKEND=x11set (the scripts do this).
Not done yet (open threads, in rough priority):
- Windows + macOS builds —
scripts/build-gui-{windows,macos}.shexist; 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. - ARP/ICMP pre-pass for link-up-but-silent boards (M1 scope, spec'd in plan §5, not implemented)
- 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. - 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
- 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) - 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.
3. How to build / run (this machine)
cd ~/Ultron/projects/miner-firmware/alkane-toolkit
scripts/build-wx-linux.sh # once: wx 3.3.3 → ~/.cache/wx-3.3.3-linux (out-of-tree)
scripts/build-gui-linux.sh # release build (needs WX_RS_WXCONFIG, script sets it)
/usr/local/bin/alkane-toolkit # installed binary; or ~/.cache/alkane-tk-target/release/alkane-toolkit
Needs a display (user's desktop session has DISPLAY=:0). Headless smoke test:
timeout 15 xvfb-run -a /usr/local/bin/alkane-toolkit — rc 124 = ran until killed (good), rc 139 = crash.
4. Machine quirks (these cost hours — don't re-learn them)
- The synced project mount is noexec for newly-written files: never build or execute anything inside the repo tree. wx builds go to
~/.cache/wxbuild, cargo target to~/.cache/alkane-tk-target(set machine-locally via~/.cargo/config.toml, NOT committed). cargo vendor vendorDELETES unmanaged directories under vendor/. Hand-made trees live inthirdparty/(wxwidgets, wx-rs). Only cargo-managed crate sources are invendor/(341 crates; offline builds via committed.cargo/config.toml).- /tmp tmpfs is 100% full (bench artifacts live there — do not clean). Build outputs must not go to /tmp.
- The FS is very slow for many-file operations:
git addof thirdparty/wxwidgets (~10k files) takes ~20 min; extraction of the wx tarball will blow a 120 s timeout. Run big FS operations as background jobs and poll. - sudo:
sudo -S -p '' <cmd> < ~/.sudopass(non-interactive). - Rust 1.97.1, cargo, gdb, xvfb-run, mingw-w64, gtk3 dev, pcre2 dev all installed.
5. Architecture map
crates/
alkane-core/ domain types (stub — next milestone fills it)
alkane-discovery/ asic-rs dependency wired (engine lives in alkane-gui/scan.rs today)
alkane-access/ stub (SSH/foothold layer, M3+)
alkane-flash/ stub (write/verify engines, M3+)
alkane-artifacts/ manifest-seed.csv (14 artifacts w/ sha256)
alkane-cli/ stub bin
alkane-gui/ THE APP (bin "alkane-toolkit"): main.rs, model.rs, scan.rs, ui.rs
thirdparty/
wxwidgets/wxWidgets-3.3.3/ pristine dist tarball tree (+ VERSION sha256, patches/ empty)
wx-rs/wx-rs-0.2.0-patched/ the used crate (path dep) + VERSION + patches/:
0001 linux/GTK3 wx-config build path (build.rs; handles full-path .a in --libs!)
0002 Rust widget bindings (src/widgets.rs: Widget API + single event dispatcher)
0003 C++ widget bridge (cpp_src/widgets_bridge.cpp: panel/sizers/static text/
button/textctrl/checkbox/checklistbox/dialog/dvlc/timer/destroy)
0004 upstream fixes (Linux get_client_size branch; init render/handle_events —
upstream left them UNINITIALIZED: 5ms render timer calls garbage in release)
vendor/ cargo-managed ONLY (341 crates, offline)
scripts/ build-wx-linux.sh, build-gui-{linux,windows,macos}.sh
docs/ IMPLEMENTATION-PLAN.md, UI-SPEC.md, adr/0001-0003
Key implementation facts (don't re-derive):
- Event model: ONE C callback (
wxbr_set_widget_event_fn) → Rustset_event_handler(Handler); all events funnel throughui::dispatch(thread_local APP). Event kinds: ButtonClicked(id), DvlcValueChanged(row,col), DvlcHeaderClick(col), DvlcReordered, TimerTick(id). - Table semantics:
view.order= creation order = display order; toggle col is creation idx 0 (bool variants only);dvlc_col_at_pos()maps display→creation after a drag; store rows are appended in filtered+sorted view order, so store row ==view_idx[row]. Header click sort cycles asc→desc→off and refills. - Scan thread: std thread + own tokio runtime + std mpsc; a 1 s wx Timer drains it (
App::drain_scan). Ranges:~/.config/alkane-toolkit/scan-ranges.txt(default 10.255.1.0/24), parse viascan::parse_cidr. - asic-rs API:
MinerFactory::from_subnet("a.b.c.d/p"),.scan_stream()→Stream<Item=Box<dyn Miner>>;Miner::get_data().await -> MinerData(trait atasic_rs::core::traits::miner::Miner);HashRate.clone().as_unit(HashRateUnit::TeraHash).value;Power::as_watts(),Temperature::as_celsius(),AngularVelocity::as_rpm(); pools:MinerData.pools[].pools[]with.user/.active. - wx 3.3 API gotchas hit:
store->GetValueByRow(v,row,col)(not GetValue),GetColumnPosition()(no GetColumnAt),--enable-dataviewdoesn't exist,--disable-stc --without-catch2 --disable-testsneeded only if using the GitHub source export (the dist tarball in thirdparty/ is complete — just chmod +x configure).
6. Verification evidence
cargo build --workspace --offlineclean (network-independent; all sources vendored)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
b264cdd6pushed to gitea (gitea reposizefield 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)
9 boards live on 10.255.1.0/24: S17 stock (.112, root+EMPTY password, legacy SSH algos), S19 xil OurOS (.166), S19j Pro bb OurOS (.152), S19k Pro cv OurOS (.167), S21 Pro aml stock (.149), WhatsMiner H3 (.126), H616 (.131), M50 CB4 (.148 — random MAC, address moves), WardenOS dev (.115). Scanning is read-only and routine; the live-fleet-ops rules (no auth bursts, gentle on prod 10.2.1.0/24) are standing orders in AGENTS.md. Never install/flash anything without the operator explicitly asking.
8. Conventions for this repo
- Confidence tags (CONFIRMED/DERIVED/EXTERNAL) on claims in docs; cite file paths.
- Commit style so far: single-line imperative summaries, no sign-off noise.
- 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 matchingpatches/NNNN-*.patchviadiff -uagainst the pristine crate (tarball URL+sha inthirdparty/wx-rs/VERSION), and confirm the patch set reconstructs the patched tree before committing both.