Compare commits

..
12 Commits
Author SHA1 Message Date
noahandClaude Opus 4.8 7fac0ce726 CI: make the headless UI self-test a hard gate
The self-test was continue-on-error while the container display path was
unproven. Run 529 confirmed it launches and passes (SELFTEST PASS) once xauth
was installed, so remove continue-on-error: a future regression that breaks GUI
init now fails the build instead of releasing silently.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 19:30:17 -06:00
noahandClaude Opus 4.8 8e9c5e7105 GUI + CI: code-review-harness fixes, expanded tests, version-logic tests
Ran the code-review-harness (four parallel reviewers: correctness, reliability,
performance, test-coverage) over the GUI crate and fixed every Critical/High
finding, plus grew the test + microbenchmark suite that gates the pipeline.

Correctness / reliability fixes:
- IP column sorted lexically, not numerically. The default view is IP-ascending
  but Column::Ip fell through to the generic lowercase-string sort key, so
  10.255.1.10 sorted before 10.255.1.2 on every launch. Add a numeric IP sort
  key (u32, exact in f64) and switch view() to decorate-sort-undecorate so a
  sort key is computed once per row, not twice per comparison.
- Scans had no cancellation. Stop/Apply/Play only dropped the receiver, leaving
  the background thread probing dead hosts (each waits out an asic-rs timeout),
  and Play could spawn a second concurrent scan + tokio runtime. Add a
  ScanHandle with an Arc<AtomicBool> cancel flag the loop checks each iteration,
  a begin_scan() helper that stops the in-flight scan before starting a new one,
  and Stop now signals cancellation.
- Native column drag never rebuilt the control: column_reordered mutated
  view.order but skipped rebuild_table(), so the store's creation order diverged
  from display_columns() and cells rendered under the wrong headers on the next
  scan tick. Rebuild after applying the reorder.
- format_si rounding rolled a mantissa up to "1000" without advancing the SI
  prefix (999.9 W -> "1000 W", a 4-digit result). Round first, then roll over;
  [99.95,100) drops its decimal.
- start_scan used .expect() on thread spawn, which would panic across the wx FFI
  boundary; it now sends ScanMsg::Failed and returns the handle.

Tests / benchmarks (the pipeline's regression gate):
- Unit tests 24 -> 41: format_si/format_uptime boundaries, numeric IP sort,
  upsert-new-IP, Light three-state + pool-slot-out-of-range cells, filter
  AND/OR, reorder non-permutation guard; scan.rs parse_cidr/prefix_mask,
  single-host /32, empty/whitespace, short-range single/reversed, parse_targets
  aggregate cap + error propagation, validate_ranges, targets_to_cidrs
  non-contiguous, auto-rescan-secs round-trip.
- Microbenchmarks 2 -> 9: view default-sort, sort-by-each-column, filtered view,
  upsert cold-start, parse_line near MAX_ADDRS, parse_targets many ranges,
  targets_to_cidrs large range. Floors are 5-10x above local numbers.
- New ci/test-compute-version.sh: 9 cases for the X.Y.Z logic (first release,
  pre-bumped X, backend/UI bumps, docs-only no-op, major-wins-over-UI,
  backend-wins-over-UI, nested ci/ and thirdparty/wx-rs paths). Wired in as a
  fast-fail CI step.

CI: install libssl-dev + pkg-config (openssl-sys); add xauth so the headless
self-test actually launches under xvfb (was aborting on "xauth not found").

Deferred (documented in code-review-report.md, guarded by benches): Cow cells,
an ip->index map for upsert. Local: 41 tests + 9 benches + 9 shell tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 19:22:49 -06:00
noahandClaude Opus 4.8 e5fb63ad52 CI: install libssl-dev + pkg-config for openssl-sys
Run 2 got past the wx build (the bash fix worked) but cargo build --release
failed in openssl-sys 0.9.117: the debian:trixie-slim CI image has no OpenSSL
dev headers, which a transitive asic-rs dependency links. Add an install step
(libssl-dev, pkg-config, ca-certificates) before the build. actions/cache only
saves the wx prefix on job success, so this is the minimal change to get a
green run and persist the ~10-min wx build for subsequent iterations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 19:00:55 -06:00
noahandClaude Opus 4.8 8e65162b07 CI: invoke build-wx via bash; mark shell scripts executable
Run 1 of the release pipeline failed at the "Build wxWidgets" step with
"scripts/build-wx-linux.sh: Permission denied" - the checked-out scripts
carry mode 100644 (no exec bit), so a bare shebang invocation fails. The
compute-version step worked only because it was already called as
"bash ci/compute-version.sh".

- Call the wx build as "bash scripts/build-wx-linux.sh" (interpreter
  explicit; no dependency on the exec bit).
- Set the exec bit in git on all ci/ and scripts/ shell scripts so they
  also run directly for humans and future steps.
- Make the headless UI self-test non-fatal for now (continue-on-error)
  and install dbus-x11 + fonts-dejavu-core alongside xvfb, so a container
  display quirk cannot discard an otherwise-good 10-minute build. The
  gate is re-tightened once it is confirmed green in-container.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 18:41:31 -06:00
noahandClaude Opus 4.8 a1de684635 CI: build-test-release pipeline on merge to main
Gitea Actions workflow (.gitea/workflows/release.yml) triggered on push to
main: build the GUI against the cached vendored wx, run the 22 unit tests and
two microbenchmarks (view pipeline + cell render, with perf-regression floors),
run the headless UI self-test under xvfb, then package the binary and cut a
release when the change warrants one.

Auto-versioning X.Y.Z (ci/compute-version.sh):
  X - manual (ci/version-x.txt); a bump resets Y.Z
  Y - backend-logic changes (core/discovery/access/flash/artifacts/cli, the
      GUI crate's scan/model/main, build + CI config); resets Z
  Z - UI changes (GUI view, fixtures, the wx-rs widget bridge)
Backend beats UI when both change; docs-only changes cut no release.

Runner: a dedicated act_runner (label alkane-ci) on bfe-mpc-0640 (the Gitea
host) runs jobs in a Debian-trixie image with Rust + GTK3/pcre2 + node.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 18:27:48 -06:00
noahandClaude Opus 4.8 6955b1e3e3 GUI round 2: selection, scan loop, column management, dark-mode fix
- Fixed "Scan ranges" button label (no longer grows with the range list).
- Dark-mode KPI cards: derive colours from the live system theme luminance
  instead of is_dark(), which mis-detected some GTK dark themes.
- Removed the checkbox column; the table is multi-select (wxDV_MULTIPLE,
  ctrl/shift-click), with the selection tracked by IP so it survives refreshes.
- Replaced Rescan with Play / Pause / Stop; added an editable auto-rescan
  interval (scan-ranges dialog; ~/.config/alkane-toolkit/auto-rescan-secs.txt)
  with a timer-driven countdown scheduler.
- Status bar shows the last-probed IP during a scan and a countdown to the next
  scan when idle (dropped the "scan complete" text).
- Default sort is IP-ascending with a header chevron; IP is column 0, sortable.
- Choose-columns dialog is a wxRearrangeCtrl (check to show; up/down or drag to
  reorder) exposing every metric, including Pool 1/2/3 URL + worker.
- Column drag-reorder moves the whole column with its data on drop.
- Row separator lines (wxDV_ROW_LINES). GTK3 native has no zebra striping; a
  GTK4-forward zebra-CSS hook and pkg-config gtk cflags are in place.

Scan engine: parse each configured pool's (url, worker); Progress carries the
last-probed IP. Model: Column::Sel removed; Pool1/2/3 columns; default IP sort.

wx-rs bridge: multi-select + selection/context-menu events + get_selections,
alternating-row + zebra-CSS hooks, in-place column title, rearrangeable list,
and popup-menu primitives (for the upcoming right-click config menu). Patches
0001-0003 regenerated and round-trip validated.

Review fixes: scan loop no longer sticks "scanning" if a thread ends without
Done (channel-disconnect handling + Stop force-reset); Play no longer starts a
second scan; stale selections pruned on rescan; column apply order/visibility
applied atomically.

Verified: 22 unit tests, a 14-check headless UI self-test, and interaction
checks (multi-select, column rearrange/drag, play/pause/stop, dark mode).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 17:27:20 -06:00
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
noah fcc70c04f6 M1 primary view: wx-rs patched+extended (Linux/GTK3 build, widget bridge), vendored wx 3.3.3 + asic-rs in thirdparty/, UI-SPEC table+KPIs+dialogs, build scripts 2026-09-15 13:59:55 -06:00
noah a2b65bb47f Vendor asic-rs 0.8.1 (280 crates, offline builds) + wxWidgets 3.3.3 (pristine + patch queue); UI spec + ADR-0003; M1 on asic-rs 2026-09-15 10:41:00 -06:00
noah 6dc77e8eb0 Plan: bench-validated pathway matrix, artifact registry seed (14 sha256s), inventory integration 2026-09-15 09:16:55 -06:00
noah 4fdc49aaca ADRs: recipes-as-data, GUI binding decision; cli as bin target 2026-09-15 09:08:36 -06:00
noah 302c8b6e49 Scaffold: workspace crates + implementation plan draft 2026-09-15 09:06:29 -06:00
30328 changed files with 11908502 additions and 2856 deletions
+7
View File
@@ -0,0 +1,7 @@
# Vendored dependencies (see docs/adr/0003-vendoring-policy.md).
# Builds never touch the network: all crates resolve from ./vendor.
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
+126
View File
@@ -0,0 +1,126 @@
name: build-test-release
# Runs on every merge/push to main: build the GUI, run tests + a microbenchmark,
# and (when the change warrants it) cut an X.Y.Z release with the binary attached.
on:
push:
branches: [main]
jobs:
release:
runs-on: alkane-ci
env:
WX_PREFIX: /root/.cache/wx-3.3.3-linux
steps:
- name: Checkout (full history for tags)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute version
id: ver
run: bash ci/compute-version.sh | tee -a "$GITHUB_OUTPUT"
- name: Test version logic
if: steps.ver.outputs.release == 'true'
run: bash ci/test-compute-version.sh
- name: Install build dependencies
if: steps.ver.outputs.release == 'true'
run: |
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
libssl-dev pkg-config ca-certificates >/dev/null
echo "libssl-dev + pkg-config installed (openssl-sys needs them)"
- name: Cache vendored wxWidgets build
if: steps.ver.outputs.release == 'true'
uses: actions/cache@v4
with:
path: /root/.cache/wx-3.3.3-linux
key: wx-3.3.3-${{ runner.os }}-${{ hashFiles('thirdparty/wx-rs/VERSION') }}
- name: Build wxWidgets (once, then cached)
if: steps.ver.outputs.release == 'true'
run: |
if [ ! -x "$WX_PREFIX/bin/wx-config" ]; then
bash scripts/build-wx-linux.sh
else
echo "wx prefix restored from cache"
fi
- name: Set crate version to ${{ steps.ver.outputs.version }}
if: steps.ver.outputs.release == 'true'
run: |
sed -i "0,/^version = \".*\"/s//version = \"${{ steps.ver.outputs.version }}\"/" Cargo.toml
grep -m1 '^version' Cargo.toml
- name: Build release
if: steps.ver.outputs.release == 'true'
run: |
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
cargo build --release -p alkane-gui --offline
- name: Unit tests
if: steps.ver.outputs.release == 'true'
run: |
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
cargo test -p alkane-gui --offline
- name: Microbenchmarks
if: steps.ver.outputs.release == 'true'
run: |
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
cargo test -p alkane-gui --release --offline -- --ignored --nocapture bench_
- name: Headless UI self-test
if: steps.ver.outputs.release == 'true'
run: |
apt-get update -qq && apt-get install -y -qq --no-install-recommends \
xvfb xauth dbus-x11 fonts-dejavu-core >/dev/null
BIN=target/release/alkane-toolkit
xvfb-run -a env GDK_BACKEND=x11 ALKANE_SELFTEST=1 "$BIN"
- name: Package artifact
if: steps.ver.outputs.release == 'true'
id: pkg
run: |
V="${{ steps.ver.outputs.version }}"
NAME="alkane-toolkit-v${V}-linux-x86_64"
mkdir -p "dist/$NAME"
cp target/release/alkane-toolkit "dist/$NAME/"
cat > "dist/$NAME/README.txt" <<EOF
alkane-toolkit v${V} (linux x86_64)
Bump type: ${{ steps.ver.outputs.bump }}
Commit: ${GITHUB_SHA}
Run: ./alkane-toolkit
Requires GTK 3 at runtime: sudo apt install libgtk-3-0
Offline demo: ALKANE_FAKE_SCAN=1 ./alkane-toolkit
EOF
tar -C dist -czf "dist/${NAME}.tar.gz" "$NAME"
echo "asset=dist/${NAME}.tar.gz" >> "$GITHUB_OUTPUT"
echo "assetname=${NAME}.tar.gz" >> "$GITHUB_OUTPUT"
- name: Create Gitea release + upload artifact
if: steps.ver.outputs.release == 'true'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.ver.outputs.tag }}"
API="${GITHUB_API_URL:-https://gitea.bluefla.re/api/v1}"
REPO="${GITHUB_REPOSITORY}"
body="Automated ${{ steps.ver.outputs.bump }} release from ${GITHUB_SHA}."
rel=$(curl -sS -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \
"${API}/repos/${REPO}/releases" \
-d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\",\"name\":\"${TAG}\",\"body\":\"${body}\"}")
id=$(echo "$rel" | grep -oE '"id":[0-9]+' | head -1 | cut -d: -f2)
if [ -z "$id" ]; then echo "release create failed: $rel"; exit 1; fi
curl -sS -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/gzip" \
"${API}/repos/${REPO}/releases/${id}/assets?name=${{ steps.pkg.outputs.assetname }}" \
--data-binary @"${{ steps.pkg.outputs.asset }}" | grep -oE '"browser_download_url":"[^"]+"' || true
echo "Released ${TAG}"
- name: No release needed
if: steps.ver.outputs.release != 'true'
run: echo "No backend/UI change since ${{ steps.ver.outputs.last_tag }} - skipping release."
+3
View File
@@ -0,0 +1,3 @@
/target
**/target
.claude/
Generated
+3668
View File
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
[workspace]
resolver = "2"
members = [
"crates/alkane-core",
"crates/alkane-discovery",
"crates/alkane-access",
"crates/alkane-flash",
"crates/alkane-artifacts",
"crates/alkane-cli",
"crates/alkane-gui",
]
[workspace.package]
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
[workspace.dependencies]
thiserror = "2"
serde = { version = "1", features = ["derive"] }
sha2 = "0.10"
+37 -2
View File
@@ -1,3 +1,38 @@
# CI badges
# alkane-toolkit
Machine-maintained status for the last completed main and next workflow attempts.
Cross-platform desktop toolkit (Rust core, native GUI) to install **stock** or
**alkaneOS** firmware on ASIC miner control boards, whatever they currently run
(stock, Vnish/AnthillOS, Braiins OS+, LuxOS, ePIC, BixBit, WardenOS).
Sibling to [alkane-sdk](https://gitea.bluefla.re/blueflare/alkane-sdk): the SDK
owns board knowledge and build outputs; this toolkit is the orchestration
engine and operator UI that executes its install recipes safely.
## Status
M1 primary view ships: discovery (vendored asic-rs 0.8.1) + the UI-SPEC
table (6 KPIs, sortable/drag-reorderable columns, row checkboxes, scan-range
editor, Excel-style filter, columns panel). Pure-Rust GUI on wxWidgets via
vendored + patched wx-rs (docs/adr/0002, 0003).
## Build + run (Debian)
```sh
scripts/build-wx-linux.sh # once: builds vendored wx 3.3.3 to ~/.cache
scripts/build-gui-linux.sh # cargo build --release -p alkane-gui
~/.cache/alkane-tk-target/release/alkane-toolkit
```
Windows/macOS: `scripts/build-gui-windows.sh` (needs a Windows/msys2
toolchain) and `scripts/build-gui-macos.sh` (needs a Mac) - the GUI code is
shared; only the C++ bridge + wx differ per platform.
See `docs/IMPLEMENTATION-PLAN.md` for the roadmap.
## Hard rules (from alkane-sdk `docs/install-methods.md`, encoded in code)
1. Never write the bootloader/secure region.
2. Verify on a channel the installer does not control.
3. Reboot is root-only; a dropped SSH connection can be success.
4. A packer is per board; never reuse across boards.
5. Boot-switch handling is an explicit, verified step.
-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128.0" height="20" role="img" aria-label="bench coverage: 6%">
<title>bench coverage: 6%</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="128.0" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="103.0" height="20" fill="#555"/>
<rect x="103.0" width="25.0" height="20" fill="#e05d44"/>
<rect width="128.0" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="51.5" y="15" fill="#010101" fill-opacity=".3">bench coverage</text>
<text x="51.5" y="14">bench coverage</text>
<text x="115.5" y="15" fill="#010101" fill-opacity=".3">6%</text>
<text x="115.5" y="14">6%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 946 B

-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="147.5" height="20" role="img" aria-label="bench: -22.8% vs prev">
<title>bench: -22.8% vs prev</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="147.5" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="44.5" height="20" fill="#555"/>
<rect x="44.5" width="103.0" height="20" fill="#fe7d37"/>
<rect width="147.5" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="22.2" y="15" fill="#010101" fill-opacity=".3">bench</text>
<text x="22.2" y="14">bench</text>
<text x="96.0" y="15" fill="#010101" fill-opacity=".3">-22.8% vs prev</text>
<text x="96.0" y="14">-22.8% vs prev</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 955 B

-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="95.5" height="20" role="img" aria-label="coverage: 45%">
<title>coverage: 45%</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="95.5" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="64.0" height="20" fill="#555"/>
<rect x="64.0" width="31.5" height="20" fill="#dfb317"/>
<rect width="95.5" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="32.0" y="15" fill="#010101" fill-opacity=".3">coverage</text>
<text x="32.0" y="14">coverage</text>
<text x="79.8" y="15" fill="#010101" fill-opacity=".3">45%</text>
<text x="79.8" y="14">45%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 919 B

-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="121.5" height="20" role="img" aria-label="dependencies: 349">
<title>dependencies: 349</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="121.5" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="90.0" height="20" fill="#555"/>
<rect x="90.0" width="31.5" height="20" fill="#007ec6"/>
<rect width="121.5" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="45.0" y="15" fill="#010101" fill-opacity=".3">dependencies</text>
<text x="45.0" y="14">dependencies</text>
<text x="105.8" y="15" fill="#010101" fill-opacity=".3">349</text>
<text x="105.8" y="14">349</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 940 B

-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="89.0" height="20" role="img" aria-label="license: MIT">
<title>license: MIT</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="89.0" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="57.5" height="20" fill="#555"/>
<rect x="57.5" width="31.5" height="20" fill="#007ec6"/>
<rect width="89.0" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="28.8" y="15" fill="#010101" fill-opacity=".3">license</text>
<text x="28.8" y="14">license</text>
<text x="73.2" y="15" fill="#010101" fill-opacity=".3">MIT</text>
<text x="73.2" y="14">MIT</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 915 B

-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="141.0" height="20" role="img" aria-label="lines of code: 36.1K">
<title>lines of code: 36.1K</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="141.0" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="96.5" height="20" fill="#555"/>
<rect x="96.5" width="44.5" height="20" fill="#007ec6"/>
<rect width="141.0" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="48.2" y="15" fill="#010101" fill-opacity=".3">lines of code</text>
<text x="48.2" y="14">lines of code</text>
<text x="118.8" y="15" fill="#010101" fill-opacity=".3">36.1K</text>
<text x="118.8" y="14">36.1K</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 952 B

-275
View File
@@ -1,275 +0,0 @@
{
"bench_coverage_pct": 6.49,
"bench_delta_pct": -22.8,
"bench_same_inputs": false,
"clippy": "clean",
"coverage_by_crate": {
"alkane-access": {
"lines": 143,
"missed": 48
},
"alkane-artifacts": {
"lines": 1416,
"missed": 433
},
"alkane-cli": {
"lines": 1195,
"missed": 1195
},
"alkane-core": {
"lines": 55,
"missed": 6
},
"alkane-flash": {
"lines": 8956,
"missed": 4416
},
"alkane-gui": {
"lines": 11996,
"missed": 6853
}
},
"coverage_by_file": [
{
"file": "crates/alkane-access/src/lib.rs",
"lines": 143,
"missed": 48
},
{
"file": "crates/alkane-artifacts/src/afw.rs",
"lines": 906,
"missed": 281
},
{
"file": "crates/alkane-artifacts/src/fetch.rs",
"lines": 330,
"missed": 117
},
{
"file": "crates/alkane-artifacts/src/lib.rs",
"lines": 180,
"missed": 35
},
{
"file": "crates/alkane-cli/src/main.rs",
"lines": 1195,
"missed": 1195
},
{
"file": "crates/alkane-core/src/platform.rs",
"lines": 55,
"missed": 6
},
{
"file": "crates/alkane-flash/src/aml_ubi.rs",
"lines": 427,
"missed": 285
},
{
"file": "crates/alkane-flash/src/boards/a113d.rs",
"lines": 546,
"missed": 252
},
{
"file": "crates/alkane-flash/src/boards/am335x.rs",
"lines": 1480,
"missed": 238
},
{
"file": "crates/alkane-flash/src/boards/cv1835.rs",
"lines": 268,
"missed": 9
},
{
"file": "crates/alkane-flash/src/boards/zynq.rs",
"lines": 235,
"missed": 19
},
{
"file": "crates/alkane-flash/src/install.rs",
"lines": 707,
"missed": 277
},
{
"file": "crates/alkane-flash/src/lib.rs",
"lines": 290,
"missed": 14
},
{
"file": "crates/alkane-flash/src/md5.rs",
"lines": 68,
"missed": 0
},
{
"file": "crates/alkane-flash/src/preflight.rs",
"lines": 277,
"missed": 99
},
{
"file": "crates/alkane-flash/src/stock.rs",
"lines": 193,
"missed": 146
},
{
"file": "crates/alkane-flash/src/stock_firmware.rs",
"lines": 194,
"missed": 178
},
{
"file": "crates/alkane-flash/src/stock_method.rs",
"lines": 3150,
"missed": 2056
},
{
"file": "crates/alkane-flash/src/transport.rs",
"lines": 501,
"missed": 421
},
{
"file": "crates/alkane-flash/src/uimage.rs",
"lines": 80,
"missed": 0
},
{
"file": "crates/alkane-flash/src/zynq_nand.rs",
"lines": 540,
"missed": 422
},
{
"file": "crates/alkane-gui/src/access_probe.rs",
"lines": 230,
"missed": 193
},
{
"file": "crates/alkane-gui/src/alkane_detect.rs",
"lines": 219,
"missed": 49
},
{
"file": "crates/alkane-gui/src/askpass.rs",
"lines": 69,
"missed": 16
},
{
"file": "crates/alkane-gui/src/bench_sequence.rs",
"lines": 224,
"missed": 224
},
{
"file": "crates/alkane-gui/src/bug_report.rs",
"lines": 281,
"missed": 76
},
{
"file": "crates/alkane-gui/src/credentials.rs",
"lines": 225,
"missed": 17
},
{
"file": "crates/alkane-gui/src/export.rs",
"lines": 294,
"missed": 55
},
{
"file": "crates/alkane-gui/src/fixtures.rs",
"lines": 309,
"missed": 1
},
{
"file": "crates/alkane-gui/src/i18n.rs",
"lines": 82,
"missed": 68
},
{
"file": "crates/alkane-gui/src/log_scan.rs",
"lines": 44,
"missed": 18
},
{
"file": "crates/alkane-gui/src/logs.rs",
"lines": 28,
"missed": 28
},
{
"file": "crates/alkane-gui/src/main.rs",
"lines": 73,
"missed": 41
},
{
"file": "crates/alkane-gui/src/model.rs",
"lines": 2254,
"missed": 561
},
{
"file": "crates/alkane-gui/src/naming.rs",
"lines": 331,
"missed": 35
},
{
"file": "crates/alkane-gui/src/pool_prefs.rs",
"lines": 98,
"missed": 71
},
{
"file": "crates/alkane-gui/src/presets.rs",
"lines": 93,
"missed": 16
},
{
"file": "crates/alkane-gui/src/restore.rs",
"lines": 368,
"missed": 271
},
{
"file": "crates/alkane-gui/src/scan.rs",
"lines": 1911,
"missed": 1319
},
{
"file": "crates/alkane-gui/src/stock_ops.rs",
"lines": 336,
"missed": 332
},
{
"file": "crates/alkane-gui/src/ui.rs",
"lines": 4527,
"missed": 3462
}
],
"coverage_pct": 45.49,
"dependencies": 349,
"grade": "C",
"grade_bands": [
[
80.0,
"A"
],
[
60.0,
"B"
],
[
40.0,
"C"
],
[
20.0,
"D"
]
],
"license": "MIT",
"loc": 36132,
"loc_by_crate": {
"alkane-access": 219,
"alkane-artifacts": 2052,
"alkane-cli": 1476,
"alkane-core": 151,
"alkane-discovery": 1,
"alkane-flash": 12914,
"alkane-gui": 19319
},
"rustfmt": "clean",
"schema": 1,
"sha": "0873d2c79d3f75a8802c38428c93be6e90ca5c29",
"tests_passed": 237
}
-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="108.5" height="20" role="img" aria-label="code quality: C (Clippy, rustfmt and line coverage)">
<title>code quality: C (Clippy, rustfmt and line coverage)</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="108.5" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="90.0" height="20" fill="#555"/>
<rect x="90.0" width="18.5" height="20" fill="#dfb317"/>
<rect width="108.5" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="45.0" y="15" fill="#010101" fill-opacity=".3">code quality</text>
<text x="45.0" y="14">code quality</text>
<text x="99.2" y="15" fill="#010101" fill-opacity=".3">C</text>
<text x="99.2" y="14">C</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1002 B

-19
View File
@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128.0" height="20" role="img" aria-label="tests: 237 passing">
<title>tests: 237 passing</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r"><rect width="128.0" height="20" rx="3" fill="#fff"/></clipPath>
<g clip-path="url(#r)">
<rect width="44.5" height="20" fill="#555"/>
<rect x="44.5" width="83.5" height="20" fill="#4c1"/>
<rect width="128.0" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="22.2" y="15" fill="#010101" fill-opacity=".3">tests</text>
<text x="22.2" y="14">tests</text>
<text x="86.2" y="15" fill="#010101" fill-opacity=".3">237 passing</text>
<text x="86.2" y="14">237 passing</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 939 B

+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# Compute the next release version for alkane-toolkit from the latest release
# tag and the paths changed since it. Version scheme X.Y.Z:
# X - major, bumped manually (ci/version-x.txt); a bump resets Y.Z to 0.0
# Y - backend-logic changes (core/discovery/access/flash/artifacts/cli,
# scan+model+main in the GUI crate, build/CI config); resets Z to 0
# Z - UI changes (the GUI view + fixtures + the wx-rs widget bridge)
# When both backend and UI changed, backend wins (bump Y). Docs-only changes
# produce no release.
#
# Emits KEY=VALUE lines on stdout (suitable for $GITHUB_OUTPUT):
# version, tag, bump, release (true/false), last_tag
set -euo pipefail
x_file="ci/version-x.txt"
X=0
[ -f "$x_file" ] && X=$(tr -dc '0-9' < "$x_file")
X=${X:-0}
last=$(git tag -l 'v*.*.*' | sort -V | tail -1 || true)
if [ -n "$last" ]; then
v=${last#v}; lx=${v%%.*}; rest=${v#*.}; ly=${rest%%.*}; lz=${rest##*.}
changed=$(git diff --name-only "$last"..HEAD)
else
lx=0; ly=0; lz=0
changed=$(git ls-files)
fi
ui=false; backend=false
while IFS= read -r f; do
[ -z "$f" ] && continue
case "$f" in
crates/alkane-gui/src/ui.rs|crates/alkane-gui/src/fixtures.rs|thirdparty/wx-rs/*)
ui=true ;;
crates/alkane-core/*|crates/alkane-discovery/*|crates/alkane-access/*|\
crates/alkane-flash/*|crates/alkane-artifacts/*|crates/alkane-cli/*|\
crates/alkane-gui/src/scan.rs|crates/alkane-gui/src/model.rs|\
crates/alkane-gui/src/main.rs|Cargo.toml|Cargo.lock|.gitea/*|ci/*|scripts/*)
backend=true ;;
*) : ;; # docs, HANDOFF, README, thirdparty/wxwidgets tree: no bump
esac
done <<< "$changed"
if [ -z "$last" ]; then
# First release: X.1.0 (or X.0.0 if X was pre-bumped above 0).
nx=$X; if [ "$X" -gt 0 ]; then ny=0; else ny=1; fi; nz=0; bump=initial; release=true
elif [ "$X" -gt "$lx" ]; then
nx=$X; ny=0; nz=0; bump=major; release=true
elif [ "$backend" = true ]; then
nx=$lx; ny=$((ly + 1)); nz=0; bump=backend; release=true
elif [ "$ui" = true ]; then
nx=$lx; ny=$ly; nz=$((lz + 1)); bump=ui; release=true
else
nx=$lx; ny=$ly; nz=$lz; bump=none; release=false
fi
echo "version=${nx}.${ny}.${nz}"
echo "tag=v${nx}.${ny}.${nz}"
echo "bump=${bump}"
echo "release=${release}"
echo "last_tag=${last:-none}"
+101
View File
@@ -0,0 +1,101 @@
#!/usr/bin/env bash
# Tests for ci/compute-version.sh (the X.Y.Z versioning logic). Each case builds
# a throwaway git repo in a scratch tmp dir (never inside this repo / the Ultron
# mount), lays out a scenario, runs compute-version.sh inside it, and asserts the
# emitted KEY=VALUE lines. Run: bash ci/test-compute-version.sh
set -euo pipefail
SCRIPT="$(cd "$(dirname "$0")" && pwd)/compute-version.sh"
[ -f "$SCRIPT" ] || { echo "cannot find compute-version.sh at $SCRIPT"; exit 2; }
pass=0
fail=0
# new_repo: fresh git repo in a scratch dir, echoes its path.
new_repo() {
local r
r="$(mktemp -d "${TMPDIR:-/tmp}/alkane-cv-XXXXXX")"
git -C "$r" init -q
git -C "$r" config user.email t@t
git -C "$r" config user.name t
echo "$r"
}
commit() { # commit <repo> <msg>
git -C "$1" add -A
git -C "$1" commit -q -m "$2"
}
# run_case: <name> <repo> then key=value expectations as remaining args.
run_case() {
local name="$1" repo="$2"; shift 2
local out get k v ok=1
out="$(cd "$repo" && bash "$SCRIPT")"
get() { echo "$out" | grep "^$1=" | cut -d= -f2-; }
for kv in "$@"; do
k="${kv%%=*}"; v="${kv#*=}"
if [ "$(get "$k")" != "$v" ]; then
echo "FAIL [$name]: expected $k=$v, got $k=$(get "$k")"
ok=0
fi
done
if [ "$ok" = 1 ]; then echo "PASS [$name]"; pass=$((pass + 1)); else fail=$((fail + 1)); fi
rm -rf "$repo"
}
# 1. First release, no tag, X=0 -> 0.1.0
R="$(new_repo)"; mkdir -p "$R/ci"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init
run_case first_release "$R" version=0.1.0 tag=v0.1.0 bump=initial release=true last_tag=none
# 2. First release with a pre-bumped major (X=2, no tag) -> 2.0.0
R="$(new_repo)"; mkdir -p "$R/ci"; printf '2' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init
run_case first_release_prebumped_x "$R" version=2.0.0 bump=initial release=true
# 3. Backend path change bumps Y
R="$(new_repo)"; mkdir -p "$R/ci" "$R/crates/alkane-gui/src"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf 'fn x(){}' > "$R/crates/alkane-gui/src/scan.rs"; commit "$R" backend
run_case backend_bump "$R" version=1.3.0 tag=v1.3.0 bump=backend release=true last_tag=v1.2.3
# 4. UI path change bumps Z
R="$(new_repo)"; mkdir -p "$R/ci" "$R/crates/alkane-gui/src"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf 'fn x(){}' > "$R/crates/alkane-gui/src/fixtures.rs"; commit "$R" ui
run_case ui_bump "$R" version=1.2.4 bump=ui release=true
# 5. Docs-only change -> no release
R="$(new_repo)"; mkdir -p "$R/ci"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf 'more docs' > "$R/README.md"; commit "$R" docs
run_case no_release_docs_only "$R" version=1.2.3 bump=none release=false
# 6. Manual major bump wins over a simultaneous UI change
R="$(new_repo)"; mkdir -p "$R/ci" "$R/crates/alkane-gui/src"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf '2' > "$R/ci/version-x.txt"; printf 'fn x(){}' > "$R/crates/alkane-gui/src/fixtures.rs"; commit "$R" bumpx
run_case manual_major_wins_over_ui "$R" version=2.0.0 bump=major release=true
# 7. Backend wins over UI when both change in the same diff
R="$(new_repo)"; mkdir -p "$R/ci" "$R/crates/alkane-gui/src"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf 'a' > "$R/crates/alkane-gui/src/scan.rs"
printf 'b' > "$R/crates/alkane-gui/src/fixtures.rs"; commit "$R" both
run_case backend_wins_over_ui "$R" version=1.3.0 bump=backend release=true
# 8. Nested ci/ path classified as backend (also covers editing compute-version.sh)
R="$(new_repo)"; mkdir -p "$R/ci"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf '# tweak' >> "$R/ci/compute-version.sh"; commit "$R" ci
run_case ci_nested_is_backend "$R" version=1.3.0 bump=backend release=true
# 9. Nested thirdparty/wx-rs path classified as UI
R="$(new_repo)"; mkdir -p "$R/ci" "$R/thirdparty/wx-rs/src/deep"; printf '0' > "$R/ci/version-x.txt"
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
printf 'x' > "$R/thirdparty/wx-rs/src/deep/nested.rs"; commit "$R" wx
run_case wx_rs_nested_is_ui "$R" version=1.2.4 bump=ui release=true
echo "----"
echo "compute-version tests: $pass passed, $fail failed"
[ "$fail" -eq 0 ]
+1
View File
@@ -0,0 +1 @@
0
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "alkane-access"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
alkane-core = { path = "../alkane-core" }
+1
View File
@@ -0,0 +1 @@
// alkane-access
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "alkane-artifacts"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
alkane-core = { path = "../alkane-core" }
@@ -0,0 +1,15 @@
sha256,size_bytes,path,family,format,applicability
e56393cbc26a5a97f677b22b8fe9abed705afd91854d4c59831777da8b529bd6,71586875,H3 SD card Program-20220422.zip,whatsminer-h3,IMAGEWTY-SD,SD install source; edit_wm_imagewty_h3.py input
12a2367327396c04c14cb2976855f7d98005b63cdce2fcc555c6d7a051ef9e1c,73633572,H6 SD Card Program-20210121.zip,whatsminer-h6,IMAGEWTY-SD,SD install source
be9728390c36698006751761275abfd47d5b1dd435b946b77afc61ca4f24e670,77956225,H6os SD Card Program-20220422.zip,whatsminer-h6os,IMAGEWTY-SD,SD install source
651f70ff184cbf4387066a6edbbc44e36b571f21911aeb1ed02f975ae65ccf27,120146097,Antminer_s21-t21-s19-t19-l7_ANT_Global_0_0.9.9.4.zip,bitmain-stock,update-zip,S21/T21/S19/T19/L7 stock source
f4e7ffb19f2e8917c1323848b8b5716018ddf429e750eeeb9db2410ae88ce1d1,60821504,powerplay-amlogic-epic-antminer-update-v1.22.0-28830069.ubifs,epic-umc-a113d,ubifs,ePIC install source; root:letmein vector
2dfb99bbbf977b9874af547c89fb7f5005e94449050ed43679578fd7f42a6fb3,45143628,Whatsminer-all-20260729.11_1786698699016.bin.bak,whatsminer-ota,bin-AES-container,network-update input only
6f26295b31db31d4c33c07e3c4f746d3d9c4d9c6a2e812e81d6386be98d8f361,64457212,luxos-installer_1.19.0.zip,luxos,zip-installer,bb/xil/aml source-OS route; no cvitek asset
b2e5b64c24808402ecd421ead6d05a3b7319acfc26b8c36a5172f5cc77125073,20679718,firmware-analysis/bixbit-antminer/bixbit-BB-universal.bmu,bixbit-bb,bmu,am335x-bb source/carve
3f8e519fddd8c5f50fe11f1ab3c3efa551b7ade2caf69e4bf61ca39ee1abae7e,22529209,firmware-analysis/bixbit-antminer/bixbit-CV-universal.bmu,bixbit-cv,bmu,cv1835 source/carve
7294c8a3e1be42670ca55bf9bd42fbfa894ffb52d1773f3e1faceaf9090c2ec0,29887071,firmware-analysis/bixbit-antminer/bixbit-XLNX-universal.bmu,bixbit-xlnx,bmu,zynq-7010 source/carve
670980107a0125e16fe01d271c9a6b9ebeee5d82835474d7ac741d1840307484,43838976,firmware-analysis/epic/powerplay-antminer-update-v1.20.4-297ddfd7.swu,epic-umc-am335x,swu,am335x-bb install source
f1ec045497570e794b920c45c5121fb834eae5a2803118d3f0c4a89ef7a4233b,12686696,scratch/wm-install-build/pkgs/20251209_embed0_alg1_t8c790afe.bin,whatsminer-h616-pkg,wm-package-0x9a5ba57c,h616 update-endpoint install (forged)
eaf26b9cf19cce872ea53f39c4d38796df4221f9cee7d0822cd2ec827ad60952,12905720,scratch/wm-install-build/pkgs-h3/m2x_1.6.0.2_alg1_chip0.bin,whatsminer-h3-pkg,wm-package-0x9a5ba57c,h3 update-endpoint install (forged)
628bf53e582e2b31756f7e3ff522d4e8ad9c99b17e4eda4d24045988a2ac25f3,24857600,firmware-analysis/bixbit-antminer/bixbit-AML-universal.bmu,bixbit-aml,bmu,a113d source/carve
1 sha256 size_bytes path family format applicability
2 e56393cbc26a5a97f677b22b8fe9abed705afd91854d4c59831777da8b529bd6 71586875 H3 SD card Program-20220422.zip whatsminer-h3 IMAGEWTY-SD SD install source; edit_wm_imagewty_h3.py input
3 12a2367327396c04c14cb2976855f7d98005b63cdce2fcc555c6d7a051ef9e1c 73633572 H6 SD Card Program-20210121.zip whatsminer-h6 IMAGEWTY-SD SD install source
4 be9728390c36698006751761275abfd47d5b1dd435b946b77afc61ca4f24e670 77956225 H6os SD Card Program-20220422.zip whatsminer-h6os IMAGEWTY-SD SD install source
5 651f70ff184cbf4387066a6edbbc44e36b571f21911aeb1ed02f975ae65ccf27 120146097 Antminer_s21-t21-s19-t19-l7_ANT_Global_0_0.9.9.4.zip bitmain-stock update-zip S21/T21/S19/T19/L7 stock source
6 f4e7ffb19f2e8917c1323848b8b5716018ddf429e750eeeb9db2410ae88ce1d1 60821504 powerplay-amlogic-epic-antminer-update-v1.22.0-28830069.ubifs epic-umc-a113d ubifs ePIC install source; root:letmein vector
7 2dfb99bbbf977b9874af547c89fb7f5005e94449050ed43679578fd7f42a6fb3 45143628 Whatsminer-all-20260729.11_1786698699016.bin.bak whatsminer-ota bin-AES-container network-update input only
8 6f26295b31db31d4c33c07e3c4f746d3d9c4d9c6a2e812e81d6386be98d8f361 64457212 luxos-installer_1.19.0.zip luxos zip-installer bb/xil/aml source-OS route; no cvitek asset
9 b2e5b64c24808402ecd421ead6d05a3b7319acfc26b8c36a5172f5cc77125073 20679718 firmware-analysis/bixbit-antminer/bixbit-BB-universal.bmu bixbit-bb bmu am335x-bb source/carve
10 3f8e519fddd8c5f50fe11f1ab3c3efa551b7ade2caf69e4bf61ca39ee1abae7e 22529209 firmware-analysis/bixbit-antminer/bixbit-CV-universal.bmu bixbit-cv bmu cv1835 source/carve
11 7294c8a3e1be42670ca55bf9bd42fbfa894ffb52d1773f3e1faceaf9090c2ec0 29887071 firmware-analysis/bixbit-antminer/bixbit-XLNX-universal.bmu bixbit-xlnx bmu zynq-7010 source/carve
12 670980107a0125e16fe01d271c9a6b9ebeee5d82835474d7ac741d1840307484 43838976 firmware-analysis/epic/powerplay-antminer-update-v1.20.4-297ddfd7.swu epic-umc-am335x swu am335x-bb install source
13 f1ec045497570e794b920c45c5121fb834eae5a2803118d3f0c4a89ef7a4233b 12686696 scratch/wm-install-build/pkgs/20251209_embed0_alg1_t8c790afe.bin whatsminer-h616-pkg wm-package-0x9a5ba57c h616 update-endpoint install (forged)
14 eaf26b9cf19cce872ea53f39c4d38796df4221f9cee7d0822cd2ec827ad60952 12905720 scratch/wm-install-build/pkgs-h3/m2x_1.6.0.2_alg1_chip0.bin whatsminer-h3-pkg wm-package-0x9a5ba57c h3 update-endpoint install (forged)
15 628bf53e582e2b31756f7e3ff522d4e8ad9c99b17e4eda4d24045988a2ac25f3 24857600 firmware-analysis/bixbit-antminer/bixbit-AML-universal.bmu bixbit-aml bmu a113d source/carve
+1
View File
@@ -0,0 +1 @@
// alkane-artifacts
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "alkane-cli"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
alkane-core = { path = "../alkane-core" }
+4
View File
@@ -0,0 +1,4 @@
//! Headless driver over the same engine the GUI uses.
fn main() {
println!("alkane-toolkit-cli: scaffold");
}
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "alkane-core"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
thiserror.workspace = true
serde.workspace = true
+1
View File
@@ -0,0 +1 @@
// alkane-core
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "alkane-discovery"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
alkane-core = { path = "../alkane-core" }
asic-rs = "0.8.1"
+1
View File
@@ -0,0 +1 @@
// alkane-discovery
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "alkane-flash"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
alkane-core = { path = "../alkane-core" }
+1
View File
@@ -0,0 +1 @@
// alkane-flash
+18
View File
@@ -0,0 +1,18 @@
[package]
name = "alkane-gui"
version.workspace = true
edition.workspace = true
license.workspace = true
[[bin]]
name = "alkane-toolkit"
path = "src/main.rs"
[dependencies]
alkane-core = { path = "../alkane-core" }
alkane-discovery = { path = "../alkane-discovery" }
# vendored + patched wx-rs (see vendor/wx-rs/patches/)
wx-rs = { path = "../../thirdparty/wx-rs/wx-rs-0.2.0-patched" }
asic-rs = "0.8.1"
tokio = { version = "1", features = ["rt"] }
futures-util = "0.3"
+114
View File
@@ -0,0 +1,114 @@
//! Bench-fleet fixtures: the expected hardware output of the 9 boards on
//! 10.255.1.0/24 (see ../../../HANDOFF.md section 7 and the parent project's
//! [removed]). These are the reference values the workflow tests compare
//! the application's actual output against, and the rows the offline
//! `ALKANE_FAKE_SCAN` demo mode renders.
//!
//! Hashrate/power/temp are representative per-model figures (the bench boards
//! are not always energised); the point of the fixtures is a fixed, known input
//! set so the transforms (formatting, KPI aggregation, sort, filter, the "slow"
//! band) can be checked deterministically. Update these if the bench inventory
//! changes.
use crate::model::{is_slow, MinerRow};
/// One fixture board, pre-transform. `expected` of 0.0 means "band unknown".
struct Board {
ip: &'static str,
model: &'static str,
firmware: &'static str,
hashrate: f64,
expected: f64,
power: f64,
temp: f64,
fan: f64,
worker: &'static str,
mining: bool,
}
impl Board {
fn into_row(self) -> MinerRow {
let slow = is_slow(self.mining, self.hashrate, self.expected);
// A few extra metrics so the demo/offline mode shows non-empty values
// for some of the additional columns.
let last_octet: u8 = self.ip.rsplit('.').next().and_then(|s| s.parse().ok()).unwrap_or(0);
let (boards, chips, efficiency) = if self.mining {
(Some(3u32), Some(210u32), if self.hashrate > 0.0 { self.power / self.hashrate } else { 0.0 })
} else {
(None, None, 0.0)
};
MinerRow {
ip: self.ip.to_string(),
selected: false,
model: self.model.to_string(),
firmware: self.firmware.to_string(),
hashrate_ths: self.hashrate,
expected_ths: self.expected,
efficiency,
power_w: self.power,
chip_temp_c: self.temp,
fan_rpm: self.fan,
worker: self.worker.to_string(),
is_mining: self.mining,
slow,
mac: format!("AA:BB:CC:00:{:02X}:{last_octet:02X}", last_octet.wrapping_mul(3)),
hostname: format!("miner-{last_octet}"),
hashboards: boards,
expected_hashboards: Some(3),
total_chips: chips,
psu_fan_rpm: if self.mining { self.fan * 0.9 } else { 0.0 },
uptime_secs: if self.mining { 3600 * 24 * 2 + 3600 * 5 } else { 0 },
light_flashing: Some(false),
pool_url: if self.worker.is_empty() { String::new() } else { "stratum+tcp://pool.blueflare:3333".to_string() },
pools: if self.worker.is_empty() {
Vec::new()
} else {
vec![
("stratum+tcp://pool.blueflare:3333".to_string(), self.worker.to_string()),
("stratum+tcp://backup.blueflare:3333".to_string(), format!("{}_bak", self.worker)),
]
},
operating_state: if self.mining { "mining".to_string() } else { "idle".to_string() },
..Default::default()
}
}
}
/// The 9 bench boards. Two are idle (S17 stock, WardenOS dev), one is slow
/// (S21 Pro aml stock at ~30% of expected); the other six hash normally.
///
/// Derived totals (used by the workflow tests):
/// total = 9, hashing = 6, slow = 1, not hashing = 2,
/// total hashrate = 685.0 TH/s, total power = 21300 W.
pub fn bench_fleet() -> Vec<MinerRow> {
let boards = [
Board { ip: "10.255.1.112", model: "Antminer S17", firmware: "Stock",
hashrate: 0.0, expected: 0.0, power: 0.0, temp: 0.0, fan: 0.0,
worker: "", mining: false },
Board { ip: "10.255.1.166", model: "Antminer S19", firmware: "[removed] 1.2",
hashrate: 95.0, expected: 96.0, power: 3250.0, temp: 65.0, fan: 4200.0,
worker: "blueflare.s19", mining: true },
Board { ip: "10.255.1.152", model: "Antminer S19j Pro", firmware: "[removed] 1.2",
hashrate: 100.0, expected: 104.0, power: 3100.0, temp: 62.0, fan: 3900.0,
worker: "blueflare.s19jpro", mining: true },
Board { ip: "10.255.1.167", model: "Antminer S19k Pro", firmware: "[removed] 1.2",
hashrate: 120.0, expected: 128.0, power: 3300.0, temp: 68.0, fan: 4500.0,
worker: "blueflare.s19kpro", mining: true },
Board { ip: "10.255.1.149", model: "Antminer S21 Pro", firmware: "Stock",
hashrate: 60.0, expected: 200.0, power: 1500.0, temp: 55.0, fan: 3000.0,
worker: "blueflare.s21pro", mining: true }, // slow: 60/200 = 30%
Board { ip: "10.255.1.126", model: "WhatsMiner M30S", firmware: "WMOS H3",
hashrate: 92.0, expected: 96.0, power: 3400.0, temp: 70.0, fan: 4800.0,
worker: "blueflare.h3", mining: true },
Board { ip: "10.255.1.131", model: "WhatsMiner M30S+", firmware: "WMOS H616",
hashrate: 100.0, expected: 100.0, power: 3450.0, temp: 71.0, fan: 4900.0,
worker: "blueflare.h616", mining: true },
Board { ip: "10.255.1.148", model: "WhatsMiner M50", firmware: "WMOS CB4",
hashrate: 118.0, expected: 122.0, power: 3300.0, temp: 66.0, fan: 4600.0,
worker: "blueflare.m50", mining: true },
Board { ip: "10.255.1.115", model: "Antminer S19", firmware: "WardenOS dev",
hashrate: 0.0, expected: 0.0, power: 0.0, temp: 0.0, fan: 0.0,
worker: "", mining: false },
];
boards.into_iter().map(Board::into_row).collect()
}
+50
View File
@@ -0,0 +1,50 @@
//! alkane-toolkit — primary view (docs/UI-SPEC.md).
//! Pure-Rust wxWidgets app on the vendored, patched wx-rs.
mod fixtures;
mod model;
mod scan;
mod ui;
use wx_rs;
fn main() {
// Headless workflow self-test: render the bench-fleet fixtures through the
// real widgets and check the table + KPIs against the expected hardware
// output. Run under a virtual display (see scripts/ui-selftest.sh).
if std::env::var_os("ALKANE_SELFTEST").is_some() {
std::process::exit(run_selftest());
}
// Bootstrap the wx app + main frame (upstream bridge).
wx_rs::init_app("alkane-toolkit", 1280, 800);
// Follow the system light/dark appearance.
wx_rs::set_appearance_system();
// Build the UI-SPEC primary view into the frame.
let frame = wx_rs::Widget::main_frame();
let app = ui::build(frame);
ui::install(app);
// All widget events funnel through one dispatcher.
wx_rs::set_event_handler(ui::dispatch);
// Enter the wx event loop; the scan thread streams rows via channel and
// a 1 s timer drains it on the main thread.
wx_rs::run_app();
}
fn run_selftest() -> i32 {
// Force offline: never touch the network during the self-test.
std::env::set_var(scan::FAKE_SCAN_ENV, "1");
wx_rs::init_app("alkane-toolkit", 1280, 800);
let frame = wx_rs::Widget::main_frame();
let mut app = ui::build(frame);
let ok = app.run_fixture_selftest();
println!("SELFTEST {}", if ok { "PASS" } else { "FAIL" });
if ok {
0
} else {
1
}
}
File diff suppressed because it is too large Load Diff
+697
View File
@@ -0,0 +1,697 @@
//! Scan engine: drives vendored asic-rs over the configured subnets and
//! streams MinerRow snapshots to the UI thread via a std channel.
use crate::model::MinerRow;
use asic_rs::MinerFactory;
use asic_rs::core::traits::miner::Miner;
use futures_util::StreamExt;
use std::collections::HashSet;
use std::net::Ipv4Addr;
use std::path::PathBuf;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{channel, Receiver};
use std::sync::Arc;
pub enum ScanMsg {
/// A new scan started: `total` addresses to probe, and the exact set of
/// target IPs (as strings) so the UI can drop miners no longer in range.
Started { total: usize, targets: HashSet<String> },
/// Progress update: `done` of `total` addresses probed; `ip` is the most
/// recently probed address (activity indicator).
Progress { done: usize, total: usize, ip: String },
/// A miner was identified.
Row(MinerRow),
/// The scan finished (label is informational).
Done(String),
/// The scan could not run.
Failed(String),
}
pub const CONFIG_DIR: &str = ".config/alkane-toolkit";
pub const RANGES_FILE: &str = "scan-ranges.txt";
pub const AUTO_FILE: &str = "auto-rescan-secs.txt";
pub const DEFAULT_RANGE: &str = "10.255.1.0/24";
/// Default seconds between automatic rescans.
pub const DEFAULT_AUTO_SECS: u64 = 300;
/// Load the auto-rescan interval in seconds (0 = disabled).
pub fn load_auto_secs() -> u64 {
std::fs::read_to_string(config_path(AUTO_FILE))
.ok()
.and_then(|s| s.trim().parse().ok())
.unwrap_or(DEFAULT_AUTO_SECS)
}
/// Save the auto-rescan interval in seconds.
pub fn save_auto_secs(secs: u64) -> std::io::Result<()> {
let p = config_path(AUTO_FILE);
if let Some(dir) = p.parent() {
std::fs::create_dir_all(dir)?;
}
std::fs::write(p, secs.to_string())
}
pub fn config_path(file: &str) -> PathBuf {
let home = std::env::var("HOME").unwrap_or_else(|_| ".".into());
PathBuf::from(home).join(CONFIG_DIR).join(file)
}
pub fn load_ranges() -> Vec<String> {
let p = config_path(RANGES_FILE);
if let Ok(s) = std::fs::read_to_string(&p) {
let v: Vec<String> = s
.lines()
.map(|l| l.trim().to_string())
.filter(|l| !l.is_empty() && !l.starts_with('#'))
.collect();
if !v.is_empty() {
return v;
}
}
vec![DEFAULT_RANGE.to_string()]
}
pub fn save_ranges(ranges: &[String]) -> std::io::Result<()> {
let p = config_path(RANGES_FILE);
if let Some(dir) = p.parent() {
std::fs::create_dir_all(dir)?;
}
std::fs::write(p, ranges.join("\n") + "\n")
}
/// Parse "a.b.c.d/p" (also accepts a bare address as /32).
pub fn parse_cidr(s: &str) -> Option<(Ipv4Addr, u8)> {
let s = s.trim();
match s.split_once('/') {
Some((addr, prefix)) => {
let addr: Ipv4Addr = addr.parse().ok()?;
let prefix: u8 = prefix.parse().ok()?;
if prefix > 32 {
return None;
}
Some((addr, prefix))
}
None => Some((s.parse().ok()?, 32)),
}
}
/// Upper bound on how many addresses a single line (or the whole target set)
/// may expand to, so a stray `10.0.0.0/8` can't allocate gigabytes / freeze the
/// app. A million addresses is already far more than any real miner LAN.
pub const MAX_ADDRS: u64 = 1_000_000;
/// Parse one scan-range line into its address list. Accepts:
/// - CIDR: `10.253.1.0/24`
/// - single IP: `10.253.1.5`
/// - full range: `10.253.1.3-10.253.1.234` (inclusive)
/// - short range: `10.253.1.3-234` (end = same /24, last octet)
pub fn parse_line(line: &str) -> Result<Vec<Ipv4Addr>, String> {
let line = line.trim();
if line.is_empty() {
return Ok(Vec::new());
}
if let Some((_a, _p)) = line.split_once('/') {
let (addr, prefix) = parse_cidr(line).ok_or_else(|| format!("bad CIDR: {line}"))?;
let base = u32::from(addr) & prefix_mask(prefix);
let count = 1u64 << (32 - prefix as u32);
if count > MAX_ADDRS {
return Err(format!("CIDR too large (> {MAX_ADDRS} addresses): {line}"));
}
return Ok((0..count).map(|i| Ipv4Addr::from(base + i as u32)).collect());
}
if let Some((start_s, end_s)) = line.split_once('-') {
let start: Ipv4Addr = start_s
.trim()
.parse()
.map_err(|_| format!("bad start address: {start_s}"))?;
let end_s = end_s.trim();
// full end address, or a bare last-octet sharing the start's /24
let end: Ipv4Addr = if end_s.contains('.') {
end_s.parse().map_err(|_| format!("bad end address: {end_s}"))?
} else {
let o: u8 = end_s.parse().map_err(|_| format!("bad range end: {end_s}"))?;
let s = start.octets();
Ipv4Addr::new(s[0], s[1], s[2], o)
};
let (s, e) = (u32::from(start), u32::from(end));
if s > e {
return Err(format!("range start after end: {line}"));
}
if (e - s) as u64 >= MAX_ADDRS {
return Err(format!("range too large (> {MAX_ADDRS} addresses): {line}"));
}
return Ok((s..=e).map(Ipv4Addr::from).collect());
}
// single address
let addr: Ipv4Addr = line.parse().map_err(|_| format!("bad address: {line}"))?;
Ok(vec![addr])
}
fn prefix_mask(prefix: u8) -> u32 {
if prefix == 0 {
0
} else {
u32::MAX << (32 - prefix as u32)
}
}
/// Parse and de-duplicate all scan-range lines into a sorted target list.
pub fn parse_targets(lines: &[String]) -> Result<Vec<Ipv4Addr>, String> {
let mut set = std::collections::BTreeSet::new();
for line in lines {
for ip in parse_line(line)? {
set.insert(u32::from(ip));
}
if set.len() as u64 > MAX_ADDRS {
return Err(format!("too many addresses across ranges (> {MAX_ADDRS})"));
}
}
Ok(set.into_iter().map(Ipv4Addr::from).collect())
}
/// Validate scan-range lines; returns an error message if any line is bad or
/// the set is empty.
pub fn validate_ranges(lines: &[String]) -> Result<(), String> {
let ips = parse_targets(lines)?;
if ips.is_empty() {
return Err("no addresses in the given ranges".into());
}
Ok(())
}
/// Aggregate a sorted, de-duplicated address list into the minimal set of CIDR
/// blocks that cover exactly those addresses (used to load the asic-rs factory).
fn targets_to_cidrs(ips: &[Ipv4Addr]) -> Vec<(Ipv4Addr, u8)> {
let mut out = Vec::new();
let vals: Vec<u32> = ips.iter().map(|ip| u32::from(*ip)).collect();
let mut i = 0usize;
while i < vals.len() {
// extend a contiguous run [start, end]
let start = vals[i];
let mut end = start;
while i + 1 < vals.len() && vals[i + 1] == end + 1 {
end = vals[i + 1];
i += 1;
}
out.extend(range_to_cidrs(start, end));
i += 1;
}
out
}
/// Cover the inclusive [start, end] u32 range with aligned CIDR blocks.
fn range_to_cidrs(start: u32, end: u32) -> Vec<(Ipv4Addr, u8)> {
let mut cidrs = Vec::new();
let mut cur = start as u64;
let end = end as u64;
while cur <= end {
let align = if cur == 0 { 32 } else { (cur as u32).trailing_zeros() };
let mut bits = align.min(32);
let remaining = end - cur + 1;
while bits > 0 && (1u64 << bits) > remaining {
bits -= 1;
}
cidrs.push((Ipv4Addr::from(cur as u32), (32 - bits) as u8));
cur += 1u64 << bits;
}
cidrs
}
/// Env var that swaps the live network scan for the built-in bench-fleet
/// fixtures. Set it to render/test the UI offline and deterministically.
pub const FAKE_SCAN_ENV: &str = "ALKANE_FAKE_SCAN";
/// True when the app should feed fixtures instead of scanning the network.
pub fn fake_scan_enabled() -> bool {
std::env::var_os(FAKE_SCAN_ENV).is_some()
}
/// Spawn the scan thread. It parses the range lines into an exact target set,
/// tells the UI which addresses are in range (so out-of-range miners can be
/// dropped), then streams identified miners plus progress updates. In fake-scan
/// mode it streams the bench-fleet fixtures instead, needing no network.
///
/// The returned [`ScanHandle`] carries the message stream plus a cancel flag the
/// background thread checks each iteration, so Stop / re-scan can end a scan
/// promptly instead of leaving a thread probing dead hosts (each probe waits out
/// an asic-rs per-host timeout).
pub struct ScanHandle {
pub rx: Receiver<ScanMsg>,
cancel: Arc<AtomicBool>,
}
impl ScanHandle {
/// Signal the scan thread to stop at its next loop iteration. Idempotent;
/// dropping the handle's `rx` alone does NOT stop the thread.
pub fn stop(&self) {
self.cancel.store(true, Ordering::Relaxed);
}
}
pub fn start_scan(lines: Vec<String>) -> ScanHandle {
let (tx, rx) = channel();
let cancel = Arc::new(AtomicBool::new(false));
if fake_scan_enabled() {
let thread_cancel = cancel.clone();
let err_tx = tx.clone();
let res = std::thread::Builder::new().name("fake-scan".into()).spawn(move || {
let rows = crate::fixtures::bench_fleet();
let targets: HashSet<String> = rows.iter().map(|r| r.ip.clone()).collect();
let total = rows.len();
let _ = tx.send(ScanMsg::Started { total, targets });
for (i, row) in rows.into_iter().enumerate() {
if thread_cancel.load(Ordering::Relaxed) {
return;
}
if tx.send(ScanMsg::Row(row)).is_err() {
return;
}
let _ = tx.send(ScanMsg::Progress { done: i + 1, total, ip: String::new() });
}
let _ = tx.send(ScanMsg::Done("fixtures".into()));
});
if let Err(e) = res {
let _ = err_tx.send(ScanMsg::Failed(format!("spawn fake-scan thread: {e}")));
}
return ScanHandle { rx, cancel };
}
// Resolve the target addresses up front so we can report total + membership.
let targets = match parse_targets(&lines) {
Ok(t) if !t.is_empty() => t,
Ok(_) => {
let _ = tx.send(ScanMsg::Failed("no addresses in the given ranges".into()));
return ScanHandle { rx, cancel };
}
Err(e) => {
let _ = tx.send(ScanMsg::Failed(e));
return ScanHandle { rx, cancel };
}
};
let total = targets.len();
let target_set: HashSet<String> = targets.iter().map(|ip| ip.to_string()).collect();
let _ = tx.send(ScanMsg::Started { total, targets: target_set });
let cidrs = targets_to_cidrs(&targets);
let thread_cancel = cancel.clone();
let err_tx = tx.clone();
let res = std::thread::Builder::new().name("asic-rs-scan".into()).spawn(move || {
let rt = match tokio::runtime::Runtime::new() {
Ok(rt) => rt,
Err(e) => {
let _ = tx.send(ScanMsg::Failed(format!("tokio runtime: {e}")));
return;
}
};
rt.block_on(async move {
let mut factory = MinerFactory::new();
for (ip, prefix) in &cidrs {
factory = match factory.with_subnet(&format!("{ip}/{prefix}")) {
Ok(f) => f,
Err(e) => {
let _ = tx.send(ScanMsg::Failed(format!("{ip}/{prefix}: {e}")));
return;
}
};
}
// scan_stream_with_ip yields one item per probed address, so we
// get accurate progress plus the responders.
let mut stream = factory.scan_stream_with_ip();
let mut done = 0usize;
let step = (total / 100).max(1); // throttle progress messages
while let Some((ip, miner)) = stream.next().await {
if thread_cancel.load(Ordering::Relaxed) {
return; // Stop / re-scan requested
}
done += 1;
if let Some(miner) = miner {
let row = to_row(&*miner).await;
if tx.send(ScanMsg::Row(row)).is_err() {
return; // UI gone
}
}
if done % step == 0 || done == total {
let _ = tx.send(ScanMsg::Progress { done, total, ip: ip.to_string() });
}
}
let _ = tx.send(ScanMsg::Done(format!("{total} addresses")));
});
});
if let Err(e) = res {
let _ = err_tx.send(ScanMsg::Failed(format!("spawn scan thread: {e}")));
}
ScanHandle { rx, cancel }
}
async fn to_row(miner: &dyn Miner) -> MinerRow {
let data = miner.get_data().await;
let hashrate_ths = data
.hashrate
.as_ref()
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
.unwrap_or(0.0);
let expected_ths = data
.expected_hashrate
.as_ref()
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
.unwrap_or(0.0);
let power_w = data.wattage.as_ref().map(|p| p.as_watts()).unwrap_or(0.0);
let chip_temp_c = data
.average_temperature
.as_ref()
.map(|t| t.as_celsius())
.unwrap_or(0.0);
let fan_rpm = data
.fans
.iter()
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
.fold(0.0f64, f64::max);
let worker = data
.pools
.iter()
.flat_map(|g| g.pools.iter())
.find(|p| p.active == Some(true))
.or_else(|| data.pools.iter().flat_map(|g| g.pools.iter()).next())
.and_then(|p| p.user.clone())
.unwrap_or_default();
let active_pool = data
.pools
.iter()
.flat_map(|g| g.pools.iter())
.find(|p| p.active == Some(true))
.or_else(|| data.pools.iter().flat_map(|g| g.pools.iter()).next());
let pool_url = active_pool
.and_then(|p| p.url.as_ref().map(|u| u.to_string()))
.unwrap_or_default();
// Each configured pool's (url, worker), in order, across all pool groups.
let pools: Vec<(String, String)> = data
.pools
.iter()
.flat_map(|g| g.pools.iter())
.map(|p| {
(
p.url.as_ref().map(|u| u.to_string()).unwrap_or_default(),
p.user.clone().unwrap_or_default(),
)
})
.collect();
let firmware = match (&data.device_info.firmware, &data.firmware_version) {
(fw, Some(v)) if !fw.is_empty() => format!("{fw} {v}"),
(fw, Some(v)) => format!("{fw}{v}"),
(fw, None) => fw.clone(),
};
let model = if data.device_info.make.is_empty() {
data.device_info.model.clone()
} else {
format!("{} {}", data.device_info.make, data.device_info.model)
};
let fluid_temp_c = data.fluid_temperature.as_ref().map(|t| t.as_celsius()).unwrap_or(0.0);
let outlet_temp_c = data
.outlet_fluid_temperature
.as_ref()
.map(|t| t.as_celsius())
.unwrap_or(0.0);
let psu_fan_rpm = data
.psu_fans
.iter()
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
.fold(0.0f64, f64::max);
let is_mining = data.is_mining;
let slow = crate::model::is_slow(is_mining, hashrate_ths, expected_ths);
MinerRow {
ip: data.ip.to_string(),
selected: false,
model,
mac: data.mac.map(|m| m.to_string()).unwrap_or_default(),
hostname: data.hostname.clone().unwrap_or_default(),
serial: data.serial_number.clone().unwrap_or_default(),
firmware,
api_version: data.api_version.clone().unwrap_or_default(),
control_board: data.control_board_version.as_ref().map(|c| c.to_string()).unwrap_or_default(),
hashrate_ths,
expected_ths,
efficiency: data.efficiency.unwrap_or(0.0),
power_w,
tuning_percent: data.tuning_percent,
chip_temp_c,
fluid_temp_c,
outlet_temp_c,
fan_rpm,
psu_fan_rpm,
fan_count: (!data.fans.is_empty()).then_some(data.fans.len() as u32),
expected_fans: data.expected_fans.map(|v| v as u32),
total_chips: data.total_chips.map(|v| v as u32),
expected_chips: data.expected_chips.map(|v| v as u32),
hashboards: (!data.hashboards.is_empty()).then_some(data.hashboards.len() as u32),
expected_hashboards: data.expected_hashboards.map(|v| v as u32),
worker,
pool_url,
pools,
best_share: data.best_share,
session_best_share: data.session_best_share,
uptime_secs: data.uptime.map(|d| d.as_secs()).unwrap_or(0),
light_flashing: data.light_flashing,
operating_state: data.operating_state.as_ref().map(|s| s.to_string()).unwrap_or_default(),
is_mining,
slow,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parse_cidr_line() {
let ips = parse_line("10.253.1.0/30").unwrap();
assert_eq!(ips.len(), 4);
assert_eq!(ips[0], Ipv4Addr::new(10, 253, 1, 0));
assert_eq!(ips[3], Ipv4Addr::new(10, 253, 1, 3));
}
#[test]
fn parse_single_ip() {
let ips = parse_line("10.253.1.5").unwrap();
assert_eq!(ips, vec![Ipv4Addr::new(10, 253, 1, 5)]);
}
#[test]
fn parse_full_range() {
let ips = parse_line("10.253.1.3-10.253.1.234").unwrap();
assert_eq!(ips.len(), 232);
assert_eq!(ips[0], Ipv4Addr::new(10, 253, 1, 3));
assert_eq!(*ips.last().unwrap(), Ipv4Addr::new(10, 253, 1, 234));
}
#[test]
fn parse_short_range() {
let ips = parse_line("10.253.1.3-234").unwrap();
assert_eq!(ips.len(), 232);
assert_eq!(*ips.last().unwrap(), Ipv4Addr::new(10, 253, 1, 234));
}
#[test]
fn parse_cross_octet_range() {
let ips = parse_line("10.253.1.250-10.253.2.5").unwrap();
assert_eq!(ips.len(), 12); // .250..=.255 (6) + 2.0..=2.5 (6)
assert_eq!(ips[0], Ipv4Addr::new(10, 253, 1, 250));
assert_eq!(*ips.last().unwrap(), Ipv4Addr::new(10, 253, 2, 5));
}
#[test]
fn parse_rejects_reversed_range() {
assert!(parse_line("10.0.0.10-10.0.0.1").is_err());
assert!(parse_line("not-an-ip").is_err());
}
#[test]
fn parse_rejects_oversized_cidr_and_range() {
// a /8 (16.7M) and /0 must be rejected, not allocated
assert!(parse_line("10.0.0.0/8").is_err());
assert!(parse_line("0.0.0.0/0").is_err());
// a large full range too
assert!(parse_line("10.0.0.0-10.99.0.0").is_err());
// a /16 (65k) is fine
assert!(parse_line("10.1.0.0/16").is_ok());
}
#[test]
fn targets_dedup_and_sort() {
let lines = vec!["10.0.0.5".to_string(), "10.0.0.1-10.0.0.3".to_string(), "10.0.0.2".to_string()];
let t = parse_targets(&lines).unwrap();
assert_eq!(t, vec![
Ipv4Addr::new(10, 0, 0, 1),
Ipv4Addr::new(10, 0, 0, 2),
Ipv4Addr::new(10, 0, 0, 3),
Ipv4Addr::new(10, 0, 0, 5),
]);
}
#[test]
fn cidr_aggregation_round_trips() {
// a /24 must aggregate back to exactly one /24 block
let ips = parse_line("10.9.8.0/24").unwrap();
let cidrs = targets_to_cidrs(&ips);
assert_eq!(cidrs, vec![(Ipv4Addr::new(10, 9, 8, 0), 24)]);
// an arbitrary range's blocks must cover exactly the same address set
let ips = parse_line("10.0.0.3-10.0.0.20").unwrap();
let cidrs = targets_to_cidrs(&ips);
let mut covered = Vec::new();
for (base, prefix) in cidrs {
let n = 1u32 << (32 - prefix as u32);
let b = u32::from(base);
covered.extend((0..n).map(|i| Ipv4Addr::from(b + i)));
}
covered.sort();
assert_eq!(covered, ips);
}
// ---- harness-driven additions (coverage) ----
#[test]
fn parse_cidr_bare_and_rejections() {
assert_eq!(parse_cidr("10.1.2.3"), Some((Ipv4Addr::new(10, 1, 2, 3), 32)));
assert_eq!(parse_cidr("10.0.0.1/24"), Some((Ipv4Addr::new(10, 0, 0, 1), 24)));
assert_eq!(parse_cidr("10.0.0.1/33"), None);
assert_eq!(parse_cidr("10.0.0.1/abc"), None);
assert_eq!(parse_cidr("bad/24"), None);
}
#[test]
fn prefix_mask_boundaries() {
assert_eq!(prefix_mask(0), 0);
assert_eq!(prefix_mask(24), 0xFFFF_FF00);
assert_eq!(prefix_mask(32), u32::MAX);
}
#[test]
fn parse_line_single_host_cidr_slash_32() {
assert_eq!(parse_line("10.1.2.3/32").unwrap(), vec![Ipv4Addr::new(10, 1, 2, 3)]);
}
#[test]
fn parse_line_empty_and_whitespace() {
assert_eq!(parse_line("").unwrap(), Vec::<Ipv4Addr>::new());
assert_eq!(parse_line(" ").unwrap(), Vec::<Ipv4Addr>::new());
}
#[test]
fn parse_line_short_range_single_address_and_reversed() {
assert_eq!(parse_line("10.253.1.5-5").unwrap(), vec![Ipv4Addr::new(10, 253, 1, 5)]);
// short form whose end octet precedes the start is an inverted range.
assert!(parse_line("10.253.1.200-50").is_err());
assert!(parse_line("10.253.1.3-300").is_err()); // 300 is not a u8
}
#[test]
fn parse_targets_aggregate_cap_and_errors() {
// Each /13 (524288) is under the cap; together they exceed 1,000,000.
let over = parse_targets(&["10.0.0.0/13".into(), "11.0.0.0/13".into()]);
assert!(over.is_err(), "aggregate over MAX_ADDRS must be rejected");
// One bad line among good ones propagates.
assert!(parse_targets(&["10.0.0.1".into(), "not-an-ip".into()]).is_err());
// Empty input is an empty (Ok) set.
assert!(parse_targets(&[]).unwrap().is_empty());
}
#[test]
fn validate_ranges_empty_ok_and_bad() {
assert!(validate_ranges(&[]).is_err()); // no addresses
assert!(validate_ranges(&["10.0.0.0/30".into()]).is_ok());
assert!(validate_ranges(&["garbage".into()]).is_err());
}
#[test]
fn targets_to_cidrs_splits_noncontiguous_runs() {
let cidrs = targets_to_cidrs(&[Ipv4Addr::new(10, 0, 0, 5), Ipv4Addr::new(10, 0, 0, 10)]);
assert_eq!(cidrs, vec![(Ipv4Addr::new(10, 0, 0, 5), 32), (Ipv4Addr::new(10, 0, 0, 10), 32)]);
}
#[test]
fn auto_secs_round_trip_and_defaults() {
// config_path() reads $HOME; point it at a private temp dir. HOME is
// process-global, so this stays one test and restores HOME afterward.
let prev = std::env::var_os("HOME");
let dir = std::env::temp_dir().join(format!("alkane-test-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
std::env::set_var("HOME", &dir);
assert_eq!(load_auto_secs(), DEFAULT_AUTO_SECS, "missing file -> default");
save_auto_secs(150).unwrap();
assert_eq!(load_auto_secs(), 150, "round-trip");
std::fs::write(config_path(AUTO_FILE), "not-a-number").unwrap();
assert_eq!(load_auto_secs(), DEFAULT_AUTO_SECS, "malformed -> default");
std::fs::write(config_path(AUTO_FILE), " 42 \n").unwrap();
assert_eq!(load_auto_secs(), 42, "whitespace tolerated");
match prev {
Some(v) => std::env::set_var("HOME", v),
None => std::env::remove_var("HOME"),
}
let _ = std::fs::remove_dir_all(&dir);
}
// ---- microbenchmarks (perf-regression gates; run with --ignored) ----
#[test]
#[ignore]
fn bench_parse_line_near_max_addrs() {
use std::time::Instant;
let start = Ipv4Addr::new(10, 0, 0, 0);
let end = Ipv4Addr::from(u32::from(start) + (MAX_ADDRS as u32 - 2));
let line = format!("{start}-{end}");
let iters = 5u32;
let t = Instant::now();
let mut sink = 0usize;
for _ in 0..iters {
sink += parse_line(&line).unwrap().len();
}
let per = t.elapsed() / iters;
println!("bench_parse_line_near_max_addrs: {sink} addrs, {:?}/op", per);
assert!(per.as_millis() < 400, "parse_line near MAX_ADDRS regressed: {per:?}/op");
}
#[test]
#[ignore]
fn bench_parse_targets_many_ranges_near_cap() {
use std::time::Instant;
let mut lines = Vec::new();
let mut total = 0u64;
let mut b = 0u32;
while total + 65536 < MAX_ADDRS && b < 200 {
lines.push(format!("10.{b}.0.0/16"));
total += 65536;
b += 1;
}
let iters = 5u32;
let t = Instant::now();
let mut sink = 0usize;
for _ in 0..iters {
sink += parse_targets(&lines).unwrap().len();
}
let per = t.elapsed() / iters;
println!("bench_parse_targets_many_ranges_near_cap: {} lines, {sink} addrs, {:?}/op", lines.len(), per);
assert!(per.as_millis() < 800, "parse_targets regressed: {per:?}/op");
}
#[test]
#[ignore]
fn bench_targets_to_cidrs_large_range() {
use std::time::Instant;
let ips = parse_line("10.0.0.1-10.7.255.254").unwrap(); // ~524k addrs, odd start
let iters = 20u32;
let t = Instant::now();
let mut sink = 0usize;
for _ in 0..iters {
sink += targets_to_cidrs(&ips).len();
}
let per = t.elapsed() / iters;
println!("bench_targets_to_cidrs_large_range: {} addrs -> {sink} cidrs, {:?}/op", ips.len(), per);
assert!(per.as_millis() < 200, "targets_to_cidrs regressed: {per:?}/op");
}
}
+929
View File
@@ -0,0 +1,929 @@
//! Primary view per docs/UI-SPEC.md: KPI header, scan-ranges editor,
//! Excel-style filter panel, columns panel, sortable/drag-reorderable table.
use crate::model::*;
use crate::scan::{self, ScanMsg};
use std::cell::RefCell;
use std::collections::HashSet;
use wx_rs::{Widget, WxEvent, WxEventKind, sizer_flags as sf};
pub const ID_RANGES: i32 = 101;
pub const ID_FILTER: i32 = 102;
pub const ID_COLUMNS: i32 = 103;
pub const ID_PLAY: i32 = 104;
pub const ID_PAUSE: i32 = 105;
pub const ID_STOP: i32 = 106;
const ID_RANGES_APPLY: i32 = 201;
const ID_RANGES_CANCEL: i32 = 202;
const ID_COLUMNS_OK: i32 = 203;
const ID_COLUMNS_CANCEL: i32 = 204;
const ID_FILTER_OK: i32 = 205;
const ID_FILTER_CANCEL: i32 = 206;
const ID_FILTER_RESET: i32 = 210;
// Per-column "All"/"None" buttons in the filter panel are ID_FILTER_ALL_BASE +
// column index (and the None equivalent). 100 columns of headroom each.
const ID_FILTER_ALL_BASE: i32 = 300;
const ID_FILTER_NONE_BASE: i32 = 500;
const TIMER_SCAN: i32 = 1;
/// Theme-aware palette for the KPI cards. Health is encoded in colour so a red
/// "Not hashing" or amber "Slow" draws the eye immediately. Colours derive from
/// the live system theme so the cards follow light/dark correctly (relying on
/// wxAppearance alone left the cards white under some GTK dark themes).
struct Palette {
card_bg: (u8, u8, u8),
label: (u8, u8, u8),
neutral: (u8, u8, u8),
green: (u8, u8, u8),
amber: (u8, u8, u8),
red: (u8, u8, u8),
accent: (u8, u8, u8),
}
fn luminance(c: (u8, u8, u8)) -> f32 {
0.299 * c.0 as f32 + 0.587 * c.1 as f32 + 0.114 * c.2 as f32
}
fn nudge(c: (u8, u8, u8), d: i32) -> (u8, u8, u8) {
let f = |v: u8| (v as i32 + d).clamp(0, 255) as u8;
(f(c.0), f(c.1), f(c.2))
}
/// Short mm:ss-ish duration for the rescan countdown ("4m 12s", "45s").
fn fmt_secs(s: u64) -> String {
if s >= 60 {
format!("{}m {:02}s", s / 60, s % 60)
} else {
format!("{s}s")
}
}
fn palette() -> Palette {
let win = wx_rs::system_color(0); // window background
let text = wx_rs::system_color(1); // window text
let dark = luminance(win) < 128.0;
Palette {
// Cards read as slightly elevated vs the window: lighter in dark mode,
// pure white on a light-grey window.
card_bg: if dark { nudge(win, 14) } else { (255, 255, 255) },
label: if dark { (150, 156, 164) } else { (108, 114, 122) },
neutral: text,
green: if dark { (74, 222, 128) } else { (33, 140, 80) },
amber: if dark { (245, 190, 66) } else { (176, 120, 10) },
red: if dark { (245, 110, 100) } else { (198, 55, 45) },
accent: if dark { (108, 168, 250) } else { (40, 100, 170) },
}
}
pub struct App {
pub rows: Vec<MinerRow>,
pub view: ViewState,
pub view_idx: Vec<usize>,
kpi_total: Widget,
kpi_hashing: Widget,
kpi_slow: Widget,
kpi_not: Widget,
kpi_hashrate: Widget,
kpi_power: Widget,
progress: Widget,
pub table: Option<Widget>,
table_parent: Widget,
root_sizer: Widget,
pub scan: Option<scan::ScanHandle>,
pub scanning: bool,
scan_total: usize,
target_ips: HashSet<String>,
// scan loop (play/pause/stop + auto-rescan)
playing: bool,
auto_secs: u64,
countdown: u64,
// selection (replaces the old checkbox column), tracked by IP so it
// survives table refreshes during a scan.
selected_ips: HashSet<String>,
alt_row: (u8, u8, u8),
ranges_dialog: Widget,
ranges_edit: Widget,
ranges_auto: Widget,
columns_dialog: Widget,
columns_list: Widget,
filter_dialog: Widget,
filter_lists: Vec<(Column, Widget)>,
}
pub fn build(frame: Widget) -> App {
let pal = palette();
// Subtle alternating-row tint derived from the theme. GTK's native dataview
// ignores SetAlternateRowColour, so also install an app-wide zebra CSS.
let win = wx_rs::system_color(0);
let alt_row = if luminance(win) < 128.0 { nudge(win, 12) } else { nudge(win, -12) };
wx_rs::apply_zebra_css(alt_row.0, alt_row.1, alt_row.2);
let panel = Widget::panel(frame);
let root = Widget::box_sizer(true);
// KPI header: a row of equal-width cards, each a big value over a small
// label. Health KPIs are colour-coded (green/amber/red); hashrate uses the
// accent colour so totals stand apart from counts.
let kpi_row = Widget::box_sizer(false);
let mk_card = |label: &str, value_color: (u8, u8, u8)| -> Widget {
let card = Widget::panel(panel);
card.set_bg(pal.card_bg.0, pal.card_bg.1, pal.card_bg.2);
let cs = Widget::box_sizer(true);
let value = Widget::static_text(card, "0");
value.set_font_size(19);
value.set_bold();
value.set_fg(value_color.0, value_color.1, value_color.2);
value.set_bg(pal.card_bg.0, pal.card_bg.1, pal.card_bg.2);
let lbl = Widget::static_text(card, label);
lbl.set_font_size(9);
lbl.set_fg(pal.label.0, pal.label.1, pal.label.2);
lbl.set_bg(pal.card_bg.0, pal.card_bg.1, pal.card_bg.2);
cs.add(value, 0, sf::BORDER_LEFT | sf::BORDER_TOP | sf::BORDER_RIGHT, 12);
cs.add(lbl, 0, sf::BORDER_LEFT | sf::BORDER_BOTTOM | sf::BORDER_RIGHT, 12);
cs.set_sizer_on(card);
kpi_row.add(card, 1, sf::EXPAND | sf::BORDER_ALL, 4);
value
};
let kpi_total = mk_card("Total", pal.neutral);
let kpi_hashing = mk_card("Hashing", pal.green);
let kpi_slow = mk_card("Slow", pal.amber);
let kpi_not = mk_card("Not hashing", pal.red);
let kpi_hashrate = mk_card("Hashrate", pal.accent);
let kpi_power = mk_card("Est. power", pal.neutral);
root.add_sizer(kpi_row, 0, sf::EXPAND | sf::BORDER_ALL, 6);
// Controls row: scan-ranges + play/pause/stop on the left; Filter / Columns
// pushed to the right.
let ctl = Widget::box_sizer(false);
let ranges_btn = Widget::button(panel, "Scan ranges", ID_RANGES);
ctl.add(ranges_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
ctl.add_spacer(8);
let play_btn = Widget::button(panel, "Play", ID_PLAY);
ctl.add(play_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
let pause_btn = Widget::button(panel, "Pause", ID_PAUSE);
ctl.add(pause_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
let stop_btn = Widget::button(panel, "Stop", ID_STOP);
ctl.add(stop_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
ctl.add_stretch(1);
let filter_btn = Widget::button(panel, "Filter", ID_FILTER);
ctl.add(filter_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
let columns_btn = Widget::button(panel, "Columns", ID_COLUMNS);
ctl.add(columns_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
root.add_sizer(ctl, 0, sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT, 4);
// Scan-progress bar across the top of the table (hidden when idle).
let progress = Widget::gauge(panel, 1);
root.add(progress, 0, sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT, 6);
progress.show(false);
// The table is created in rebuild_table and added to `root` there.
let table_parent = panel;
root.set_sizer_on(panel);
let frame_sizer = Widget::box_sizer(true);
frame_sizer.add(panel, 1, sf::EXPAND, 0);
frame_sizer.set_sizer_on(frame);
frame.set_min_size(1200, 720);
// A status bar carries scan state (was an inline label).
wx_rs::create_status_bar();
wx_rs::set_status_text("starting scan...");
let ranges = scan::load_ranges();
let mut app = App {
rows: Vec::new(),
view: ViewState::default(),
view_idx: Vec::new(),
kpi_total,
kpi_hashing,
kpi_slow,
kpi_not,
kpi_hashrate,
kpi_power,
progress,
table: None,
table_parent,
root_sizer: root,
scan: Some(scan::start_scan(ranges.clone())),
scanning: true,
scan_total: 0,
target_ips: HashSet::new(),
playing: true,
auto_secs: scan::load_auto_secs(),
countdown: 0,
selected_ips: HashSet::new(),
alt_row,
ranges_dialog: frame,
ranges_edit: frame,
ranges_auto: frame,
columns_dialog: frame,
columns_list: frame,
filter_dialog: frame,
filter_lists: Vec::new(),
};
app.rebuild_table();
Widget::timer(TIMER_SCAN, 1000);
app
}
impl App {
pub fn rebuild_table(&mut self) {
// Detach the old table from the sizer before destroying it, so the
// sizer never holds a dangling item, then drop it.
if let Some(t) = self.table.take() {
self.root_sizer.detach(t);
t.destroy();
}
let t = Widget::dvlc(self.table_parent);
// Creation order == display order. IP is the fixed first column (not
// reorderable); the rest are reorderable. The active sort column carries
// an ASCII direction marker in its header ("^" asc, "v" desc) -- wx's
// native SetSortOrder re-sorts the store lexically and would fight our
// numeric sort, so we mark the header text instead.
for c in self.view.display_columns() {
let fixed = self.view.is_fixed(c);
let mut title = c.title().to_string();
match self.view.sort {
Some((sc, true)) if sc == c => title.push_str(" ^"),
Some((sc, false)) if sc == c => title.push_str(" v"),
_ => {}
}
t.dvlc_append_text_col(&title, c.width(), !fixed);
}
t.dvlc_set_alt_row_color(self.alt_row.0, self.alt_row.1, self.alt_row.2);
// Add the table to the root sizer (proportion 1 => fills the area under
// the KPI + controls rows) and re-run the panel's layout so it is
// positioned, not left floating at (0,0).
self.root_sizer.add(t, 1, sf::EXPAND | sf::BORDER_ALL, 4);
self.table = Some(t);
self.table_parent.layout();
self.fill_rows();
}
pub fn fill_rows(&mut self) {
let Some(t) = self.table else { return };
t.dvlc_clear();
self.view_idx = self.view.view(&self.rows);
let cols = self.view.display_columns();
for &ri in &self.view_idx {
let r = &self.rows[ri];
let cells: Vec<String> = cols.iter().map(|c| c.cell(r)).collect();
let refs: Vec<&str> = cells.iter().map(|s| s.as_str()).collect();
t.dvlc_append_row(&refs);
}
// Re-apply the selection (a refresh clears the control's selection).
let sel: Vec<usize> = self
.view_idx
.iter()
.enumerate()
.filter(|(_, &ri)| self.selected_ips.contains(&self.rows[ri].ip))
.map(|(disp, _)| disp)
.collect();
if !sel.is_empty() {
t.dvlc_select_rows(&sel);
}
self.refresh_kpis();
}
pub fn refresh_kpis(&self) {
let k = compute_kpis(&self.rows, &self.view_idx);
self.kpi_total.set_label(&k.total.to_string());
self.kpi_hashing.set_label(&k.hashing.to_string());
self.kpi_slow.set_label(&k.slow.to_string());
self.kpi_not.set_label(&k.not_hashing.to_string());
self.kpi_hashrate.set_label(&format_si(k.total_hashrate_ths * 1e12, "H/s"));
self.kpi_power.set_label(&format_si(k.total_power_w, "W"));
}
pub fn drain_scan(&mut self) {
let Some(handle) = &self.scan else { return };
let mut changed = false;
loop {
match handle.rx.try_recv() {
Ok(ScanMsg::Started { total, targets }) => {
// Drop miners no longer in the target range.
let before = self.rows.len();
self.rows.retain(|r| targets.contains(&r.ip));
changed |= self.rows.len() != before;
self.target_ips = targets;
// Drop selections that are no longer in range.
let keep = std::mem::take(&mut self.selected_ips);
self.selected_ips = keep.into_iter().filter(|ip| self.target_ips.contains(ip)).collect();
self.scan_total = total;
self.scanning = true;
self.progress.gauge_set_range(total.max(1) as i32);
self.progress.gauge_set_value(0);
self.progress.show(true);
self.table_parent.layout();
wx_rs::set_status_text(&format!("scanning {total} addresses..."));
}
Ok(ScanMsg::Progress { done, total, ip }) => {
self.scan_total = total;
self.progress.gauge_set_value(done.min(total) as i32);
let where_ = if ip.is_empty() { String::new() } else { format!(" - scanning {ip}") };
wx_rs::set_status_text(&format!(
"{done}/{total}{where_} ({} found)",
self.rows.len()
));
}
Ok(ScanMsg::Row(row)) => {
// Ignore stray rows outside the current target set.
if self.target_ips.is_empty() || self.target_ips.contains(&row.ip) {
row.upsert_into(&mut self.rows);
changed = true;
}
}
Ok(ScanMsg::Done(_s)) => {
self.scanning = false;
self.progress.gauge_set_value(self.scan_total.max(1) as i32);
self.progress.show(false);
self.table_parent.layout();
// Arm the next automatic scan (if the loop is running).
self.countdown = if self.playing { self.auto_secs } else { 0 };
}
Ok(ScanMsg::Failed(e)) => {
self.scanning = false;
self.progress.show(false);
self.table_parent.layout();
wx_rs::set_status_text(&format!("scan failed: {e}"));
self.countdown = if self.playing { self.auto_secs } else { 0 };
}
Err(std::sync::mpsc::TryRecvError::Empty) => break,
Err(std::sync::mpsc::TryRecvError::Disconnected) => {
// The scan thread ended. Normally this follows Done/Failed
// (handled above); if it ended without either (panic/hang
// recovery), don't leave the loop stuck "scanning".
if self.scanning {
self.scanning = false;
self.progress.show(false);
self.table_parent.layout();
self.countdown = if self.playing { self.auto_secs } else { 0 };
}
self.scan = None;
break;
}
}
}
if changed {
self.fill_rows();
}
}
/// Called every second by the scan timer: drain scan messages, then run the
/// scan-loop scheduler (countdown to the next automatic rescan, or idle).
fn tick(&mut self) {
self.drain_scan();
if self.scanning {
return; // status already shows scan progress
}
if self.playing && self.auto_secs > 0 {
if self.countdown > 1 {
self.countdown -= 1;
wx_rs::set_status_text(&format!(
"{} miners - next scan in {}",
self.rows.len(),
fmt_secs(self.countdown)
));
} else {
self.start_new_scan();
}
} else {
wx_rs::set_status_text(&format!(
"{} miners - {}",
self.rows.len(),
if self.playing { "auto-rescan off" } else { "paused" }
));
}
}
/// Cancel any in-flight scan, then start a fresh one over `lines`. Signalling
/// the old scan to stop before replacing it prevents two scan threads (and
/// two tokio runtimes) probing the network at once.
fn begin_scan(&mut self, lines: Vec<String>) {
if let Some(old) = self.scan.take() {
old.stop();
}
self.scan = Some(scan::start_scan(lines));
self.scanning = true;
self.countdown = 0;
}
/// Start a fresh scan of the saved ranges.
fn start_new_scan(&mut self) {
self.begin_scan(scan::load_ranges());
wx_rs::set_status_text("scanning...");
}
/// The table's selection changed (ctrl/shift-click). Mirror it into the
/// model, tracked by IP so it survives table refreshes during a scan.
fn on_selection_changed(&mut self) {
let Some(t) = self.table else { return };
let rows_sel = t.dvlc_get_selections();
self.selected_ips.clear();
for disp in rows_sel {
if let Some(&ri) = self.view_idx.get(disp) {
self.selected_ips.insert(self.rows[ri].ip.clone());
}
}
for r in &mut self.rows {
r.selected = self.selected_ips.contains(&r.ip);
}
}
/// Row activated (double-click / Enter): open the miner's web UI in the
/// system browser.
fn activate_row(&mut self, store_row: usize) {
if let Some(&ri) = self.view_idx.get(store_row) {
if let Some(r) = self.rows.get(ri) {
if !r.ip.is_empty() {
wx_rs::launch_browser(&format!("http://{}", r.ip));
}
}
}
}
fn header_click(&mut self, creation_idx: usize) {
// Columns are appended in display order; map the clicked creation index
// back to a model column through display_columns() (hidden columns don't
// shift the mapping). Every column, including IP at index 0, is sortable.
let cols = self.view.display_columns();
if creation_idx >= cols.len() {
return;
}
let col = cols[creation_idx];
self.view.sort = match self.view.sort {
Some((c, true)) if c == col => Some((col, false)),
Some((c, false)) if c == col => None,
_ => Some((col, true)),
};
// Update the header marker in place + re-sort rows. Avoids destroying and
// recreating the whole control on every sort click (janky on big fleets).
self.update_headers();
self.fill_rows();
}
/// Refresh each column header's ASCII sort marker ("^" asc, "v" desc) in
/// place, without recreating the table.
fn update_headers(&self) {
let Some(t) = self.table else { return };
for (i, c) in self.view.display_columns().iter().enumerate() {
let mut title = c.title().to_string();
match self.view.sort {
Some((sc, true)) if sc == *c => title.push_str(" ^"),
Some((sc, false)) if sc == *c => title.push_str(" v"),
_ => {}
}
t.dvlc_set_col_title(i, &title);
}
}
fn column_reordered(&mut self) {
let Some(t) = self.table else { return };
// The table only holds the VISIBLE columns; a creation index maps to a
// model column via display_columns(). Read the new visible order from
// the drag result and hand it to the model, which splices it back into
// the full column order while leaving hidden columns in place.
let disp = self.view.display_columns();
let n = t.dvlc_col_count();
let mut new_visible = Vec::with_capacity(n);
for pos in 0..n {
let creation = t.dvlc_col_at_pos(pos).unwrap_or(pos);
if let Some(&c) = disp.get(creation) {
new_visible.push(c);
}
}
self.view.apply_visible_reorder(&new_visible);
// Rebuild so the control's column creation order matches the new
// display order again; fill_rows/header_click/update_headers all assume
// creation order == display_columns(), which the drag alone breaks.
self.rebuild_table();
}
/// Build (but do not show) the ranges editor. The caller shows it modally
/// *after* releasing the App borrow; see `dispatch`.
fn build_ranges_dialog(&mut self) -> Widget {
let frame = Widget::main_frame();
let dlg = Widget::dialog(frame, "Edit IP scanning ranges");
let root = Widget::box_sizer(true);
let hint = Widget::static_text(
dlg,
"One range per line:\n CIDR 10.255.1.0/24\n range 10.253.1.3-10.253.1.234\n single 10.253.1.5",
);
root.add(hint, 0, sf::BORDER_ALL, 6);
let edit = Widget::text_ctrl(dlg, true);
edit.set_value(&scan::load_ranges().join("\n"));
root.add(edit, 1, sf::EXPAND | sf::BORDER_ALL, 6);
// Auto-rescan interval (seconds; 0 = off).
let auto_row = Widget::box_sizer(false);
let auto_lbl = Widget::static_text(dlg, "Auto-rescan every (seconds, 0 = off):");
auto_row.add(auto_lbl, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 6);
let auto_edit = Widget::text_ctrl(dlg, false);
auto_edit.set_value(&self.auto_secs.to_string());
auto_row.add(auto_edit, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 6);
root.add_sizer(auto_row, 0, sf::BORDER_LEFT | sf::BORDER_RIGHT, 6);
let btns = Widget::box_sizer(false);
let apply = Widget::button(dlg, "Apply", ID_RANGES_APPLY);
btns.add(apply, 0, sf::BORDER_ALL, 6);
let cancel = Widget::button(dlg, "Cancel", ID_RANGES_CANCEL);
btns.add(cancel, 0, sf::BORDER_ALL, 6);
root.add_sizer(btns, 0, sf::BORDER_ALL, 6);
root.set_sizer_on(dlg);
self.ranges_dialog = dlg;
self.ranges_edit = edit;
self.ranges_auto = auto_edit;
dlg
}
fn apply_ranges(&mut self) {
let text = self.ranges_edit.get_value();
let lines: Vec<String> = text
.lines()
.map(str::trim)
.filter(|l| !l.is_empty() && !l.starts_with('#'))
.map(String::from)
.collect();
if lines.is_empty() {
wx_rs::set_status_text("no ranges given");
self.ranges_dialog.close(0);
return;
}
if let Err(e) = scan::validate_ranges(&lines) {
wx_rs::set_status_text(&format!("invalid range: {e}"));
return; // keep dialog open
}
// Save the auto-rescan interval too.
if let Ok(secs) = self.ranges_auto.get_value().trim().parse::<u64>() {
self.auto_secs = secs;
let _ = scan::save_auto_secs(secs);
}
let _ = scan::save_ranges(&lines);
self.begin_scan(lines);
wx_rs::set_status_text("scanning...");
self.ranges_dialog.close(1);
}
/// The columns available to show/hide: every metric except the fixed IP
/// column, in registry order (the rearrange-list's item index space).
fn selectable_columns() -> Vec<Column> {
ALL_COLUMNS.iter().copied().filter(|c| *c != Column::Ip).collect()
}
/// Build (but do not show) the columns chooser: a rearrangeable checklist of
/// every scannable metric. Check to show; drag or use the up/down arrows to
/// reorder. IP is always the first column and is not listed here.
fn build_columns_dialog(&mut self) -> Widget {
let frame = Widget::main_frame();
let dlg = Widget::dialog(frame, "Choose columns");
let root = Widget::box_sizer(true);
let hint = Widget::static_text(
dlg,
"Check to show a metric; drag or use the arrows to reorder (IP is always first).",
);
root.add(hint, 0, sf::BORDER_ALL, 6);
// Base list is registry order; the wx order array lists items in the
// current arranged order, encoding checked = visible (a negative value
// ~idx means item idx unchecked).
let base = Self::selectable_columns();
let titles: Vec<&str> = base.iter().map(|c| c.title()).collect();
let mut order: Vec<i32> = Vec::with_capacity(base.len());
for c in self.view.order.iter().filter(|c| **c != Column::Ip) {
if let Some(idx) = base.iter().position(|b| b == c) {
let idx = idx as i32;
order.push(if self.view.visible.contains(c) { idx } else { !idx });
}
}
let list = Widget::rearrange_list(dlg, &order, &titles);
root.add(list, 1, sf::EXPAND | sf::BORDER_ALL, 6);
let btns = Widget::box_sizer(false);
btns.add(Widget::button(dlg, "OK", ID_COLUMNS_OK), 0, sf::BORDER_ALL, 6);
btns.add(Widget::button(dlg, "Cancel", ID_COLUMNS_CANCEL), 0, sf::BORDER_ALL, 6);
root.add_sizer(btns, 0, sf::BORDER_ALL, 6);
root.set_sizer_on(dlg);
dlg.fit(dlg);
self.columns_dialog = dlg;
self.columns_list = list;
dlg
}
fn apply_columns(&mut self) {
let base = Self::selectable_columns();
let order = self.columns_list.rearrange_get_order();
let mut new_order: Vec<Column> = vec![Column::Ip];
let mut visible: HashSet<Column> = HashSet::from([Column::Ip]);
for entry in order {
let (idx, checked) = if entry < 0 { ((!entry) as usize, false) } else { (entry as usize, true) };
if let Some(&c) = base.get(idx) {
new_order.push(c);
if checked {
visible.insert(c);
}
}
}
// Only accept a full permutation (no dropped/duplicated columns); apply
// order + visibility together so they never desync.
if new_order.len() == self.view.order.len() {
self.view.order = new_order;
self.view.visible = visible;
}
// Drop the sort if its column was hidden (IP is always shown).
if let Some((c, _)) = self.view.sort {
if c != Column::Ip && !self.view.visible.contains(&c) {
self.view.sort = None;
}
}
self.columns_dialog.close(1);
self.rebuild_table();
}
/// Build (but do not show) the Excel-style filter panel. Every visible
/// column with more than one distinct value gets a per-column value
/// checklist with All / None controls; filters AND across columns and OR
/// within a column. Blank cells show as "(blank)".
fn build_filter_dialog(&mut self) -> Widget {
let frame = Widget::main_frame();
let dlg = Widget::dialog(frame, "Filter");
let root = Widget::box_sizer(true);
let content = Widget::box_sizer(false); // side-by-side column filters
let mut lists = Vec::new();
for c in self.view.display_columns() {
// Value checklists only make sense for categorical columns; skip the
// continuous numeric metrics.
if c.is_numeric() {
continue;
}
let mut values: Vec<String> = self.rows.iter().map(|r| c.cell(r)).collect();
values.sort();
values.dedup();
if values.len() < 2 {
continue;
}
let idx = lists.len() as i32;
let colbox = Widget::box_sizer(true);
let head = Widget::box_sizer(false);
let lbl = Widget::static_text(dlg, c.title());
lbl.set_bold();
head.add(lbl, 1, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 2);
head.add(Widget::button(dlg, "All", ID_FILTER_ALL_BASE + idx), 0, sf::BORDER_ALL, 1);
head.add(Widget::button(dlg, "None", ID_FILTER_NONE_BASE + idx), 0, sf::BORDER_ALL, 1);
colbox.add_sizer(head, 0, sf::EXPAND | sf::BORDER_ALL, 2);
let lst = Widget::check_list_box(dlg);
lst.set_min_size(140, 220); // so Fit gives the checklist real space
let current: Option<HashSet<String>> = self.view.filters.get(&c).cloned();
for v in &values {
let shown = if v.is_empty() { "(blank)" } else { v.as_str() };
lst.clb_append(shown);
let checked = match &current {
Some(allowed) => allowed.contains(v),
None => true,
};
lst.clb_set_checked(lst.clb_count() - 1, checked);
}
colbox.add(lst, 1, sf::EXPAND | sf::BORDER_ALL, 2);
content.add_sizer(colbox, 1, sf::EXPAND | sf::BORDER_ALL, 4);
lists.push((c, lst));
}
if lists.is_empty() {
let lbl = Widget::static_text(dlg, "Nothing to filter yet - run a scan first.");
content.add(lbl, 0, sf::BORDER_ALL, 8);
}
root.add_sizer(content, 1, sf::EXPAND | sf::BORDER_ALL, 4);
let btns = Widget::box_sizer(false);
btns.add(Widget::button(dlg, "Apply", ID_FILTER_OK), 0, sf::BORDER_ALL, 6);
btns.add(Widget::button(dlg, "Reset", ID_FILTER_RESET), 0, sf::BORDER_ALL, 6);
btns.add(Widget::button(dlg, "Cancel", ID_FILTER_CANCEL), 0, sf::BORDER_ALL, 6);
root.add_sizer(btns, 0, sf::BORDER_ALL, 6);
root.set_sizer_on(dlg);
// Size the dialog to fit however many category columns there are.
dlg.fit(dlg);
self.filter_dialog = dlg;
self.filter_lists = lists;
dlg
}
/// Check or uncheck every value in one column's list (0-based index into
/// `filter_lists`).
fn filter_check_all(&self, idx: usize, checked: bool) {
if let Some((_c, lst)) = self.filter_lists.get(idx) {
for i in 0..lst.clb_count() {
lst.clb_set_checked(i, checked);
}
}
}
fn apply_filter(&mut self) {
for (c, lst) in &self.filter_lists {
let count = lst.clb_count();
let mut allowed = HashSet::new();
for i in 0..count {
if lst.clb_checked(i) {
// map the shown "(blank)" back to the empty string
let v = lst.clb_string(i).unwrap_or_default();
allowed.insert(if v == "(blank)" { String::new() } else { v });
}
}
if allowed.is_empty() || allowed.len() == count {
self.view.filters.remove(c); // all (or none) checked = no filter
} else {
self.view.filters.insert(*c, allowed);
}
}
self.filter_dialog.close(1);
self.fill_rows();
}
fn reset_filters(&mut self) {
self.view.filters.clear();
self.filter_dialog.close(1);
self.fill_rows();
}
/// Handle one widget event under the App borrow. Returns a dialog to show
/// modally *after* the borrow is released (see `dispatch`); all in-place
/// work is done here, so most events return None.
fn handle(&mut self, ev: WxEvent) -> Option<Widget> {
match ev.kind {
WxEventKind::ButtonClicked => {
let id = ev.p1 as i32;
match id {
ID_RANGES => return Some(self.build_ranges_dialog()),
ID_RANGES_APPLY => self.apply_ranges(),
ID_RANGES_CANCEL => self.ranges_dialog.close(0),
ID_COLUMNS => return Some(self.build_columns_dialog()),
ID_COLUMNS_OK => self.apply_columns(),
ID_COLUMNS_CANCEL => self.columns_dialog.close(0),
ID_FILTER => return Some(self.build_filter_dialog()),
ID_FILTER_OK => self.apply_filter(),
ID_FILTER_CANCEL => self.filter_dialog.close(0),
ID_FILTER_RESET => self.reset_filters(),
ID_PLAY => {
// Resume/start the scan loop: scan now (unless one is
// already running) + auto-rescan on.
self.playing = true;
if !self.scanning {
self.start_new_scan();
}
}
ID_PAUSE => {
// Stop the auto-rescan loop (a scan in flight finishes).
self.playing = false;
wx_rs::set_status_text(&format!("{} miners - paused", self.rows.len()));
}
ID_STOP => {
// Halt the loop and cancel any in-flight scan (dropping
// the receiver alone would leave the thread probing).
self.playing = false;
self.countdown = 0;
self.scanning = false;
if let Some(old) = self.scan.take() {
old.stop();
}
self.progress.show(false);
self.table_parent.layout();
wx_rs::set_status_text(&format!("{} miners - stopped", self.rows.len()));
}
_ if (ID_FILTER_ALL_BASE..ID_FILTER_NONE_BASE).contains(&id) => {
self.filter_check_all((id - ID_FILTER_ALL_BASE) as usize, true);
}
_ if (ID_FILTER_NONE_BASE..ID_FILTER_NONE_BASE + 200).contains(&id) => {
self.filter_check_all((id - ID_FILTER_NONE_BASE) as usize, false);
}
_ => {}
}
}
WxEventKind::DvlcHeaderClick => self.header_click(ev.p1 as usize),
WxEventKind::DvlcSelectionChanged => self.on_selection_changed(),
WxEventKind::DvlcActivated => self.activate_row(ev.p1 as usize),
WxEventKind::DvlcReordered => self.column_reordered(),
WxEventKind::TimerTick if ev.p1 as i32 == TIMER_SCAN => self.tick(),
_ => {}
}
None
}
/// Headless workflow self-test: load the bench-fleet fixtures, render them
/// through the real widgets, then read back what the table and KPIs
/// actually display and compare to the expected hardware output. Prints one
/// line per check and returns true iff every check passed.
pub fn run_fixture_selftest(&mut self) -> bool {
self.rows = crate::fixtures::bench_fleet();
self.view = ViewState::default();
self.fill_rows();
let mut ok = true;
let mut check = |name: &str, pass: bool, detail: String| {
println!("[{}] {}{}", if pass { "PASS" } else { "FAIL" }, name,
if detail.is_empty() { String::new() } else { format!(" -- {detail}") });
ok &= pass;
};
// 1. KPI values: independent, hand-computed from the fixtures. The
// labels are static; the value widgets carry the numbers.
let want_kpis = [
(self.kpi_total, "Total", "9"),
(self.kpi_hashing, "Hashing", "6"),
(self.kpi_slow, "Slow", "1"),
(self.kpi_not, "Not hashing", "2"),
(self.kpi_hashrate, "Hashrate", "685 TH/s"),
(self.kpi_power, "Est. power", "21.3 kW"),
];
for (w, name, want) in want_kpis {
let got = w.get_label();
check(&format!("kpi {name} == \"{want}\""), got == want, format!("got \"{got}\""));
}
let Some(t) = self.table else {
check("table exists", false, "no table widget".into());
return false;
};
let cols = self.view.display_columns();
// 2. Row count in the store matches the (unfiltered) fixture count.
let want_rows = self.view_idx.len();
check("table row count == 9",
t.dvlc_row_count() == 9 && want_rows == 9,
format!("store={}, view={}", t.dvlc_row_count(), want_rows));
// 3. Every store cell equals what the model produced for that row/col
// (catches column-order / off-by-one / append bugs).
let mut mismatches = 0;
for (disp_row, &ri) in self.view_idx.iter().enumerate() {
let r = &self.rows[ri];
for (j, c) in cols.iter().enumerate() {
let want = c.cell(r);
let got = t.dvlc_get_cell(disp_row, j).unwrap_or_default();
if got != want {
if mismatches < 5 {
println!(" cell[{disp_row}][{j}] {}: want \"{want}\" got \"{got}\"", c.title());
}
mismatches += 1;
}
}
}
check("every table cell matches the model", mismatches == 0,
format!("{mismatches} mismatched cells"));
// 4. Independent spot-checks by IP against the known hardware output.
let ip_col = cols.iter().position(|c| *c == Column::Ip);
let status_col = cols.iter().position(|c| *c == Column::Status);
let hr_col = cols.iter().position(|c| *c == Column::Hashrate);
let find = |ip: &str| -> Option<usize> {
self.view_idx.iter().position(|&ri| self.rows[ri].ip == ip)
};
let cell = |row: usize, col: Option<usize>| -> String {
match col { Some(c) => t.dvlc_get_cell(row, c).unwrap_or_default(), None => String::new() }
};
if let (Some(row), Some(_)) = (find("10.255.1.149"), status_col) {
check("S21 Pro (.149) is slow", cell(row, status_col) == "slow",
format!("status=\"{}\"", cell(row, status_col)));
check("S21 Pro (.149) hashrate == 60.0 TH/s", cell(row, hr_col) == "60.0 TH/s",
format!("hashrate=\"{}\"", cell(row, hr_col)));
} else {
check("S21 Pro (.149) present", false, "row not found".into());
}
if let Some(row) = find("10.255.1.112") {
check("S17 (.112) is not hashing", cell(row, status_col) == "not hashing",
format!("status=\"{}\"", cell(row, status_col)));
check("S17 (.112) blank hashrate", cell(row, hr_col).is_empty(),
format!("hashrate=\"{}\"", cell(row, hr_col)));
} else {
check("S17 (.112) present", false, "row not found".into());
}
check("IP is the first column", ip_col == Some(0),
format!("ip col index = {ip_col:?}"));
// default view is IP-ascending
let ips: Vec<String> = self.view_idx.iter().map(|&ri| self.rows[ri].ip.clone()).collect();
let mut sorted = ips.clone();
sorted.sort();
check("default sort is IP ascending", ips == sorted, String::new());
ok
}
}
// The wx event loop is single-threaded; keep the app in a thread-local.
thread_local! {
static APP: RefCell<Option<App>> = const { RefCell::new(None) };
}
pub fn install(app: App) {
APP.with(|a| *a.borrow_mut() = Some(app));
}
/// Single event entry point. Runs in two phases so that a modal dialog's nested
/// event loop never runs while the App borrow is held — the old code held
/// `borrow_mut()` across `show_modal()`, so any event fired inside the dialog
/// (a button, or the 1 s scan timer) re-entered here and panicked with a
/// double `BorrowMutError`, crashing the app on every dialog button.
pub fn dispatch(ev: WxEvent) {
let to_show = APP.with(|cell| {
// try_borrow_mut, not borrow_mut: if some nested wx event loop (an
// assert box, a system dialog) re-enters us while we already hold the
// borrow, drop this event instead of aborting the whole app. A dropped
// timer tick or click is harmless; a non-unwinding panic is fatal.
let Ok(mut app_ref) = cell.try_borrow_mut() else { return None };
app_ref.as_mut().and_then(|app| app.handle(ev))
});
if let Some(dlg) = to_show {
dlg.show_modal(); // nested loop, no App borrow held; blocks until EndModal
dlg.destroy(); // tear the dialog down (needs no App borrow, so none is taken)
}
}
+61
View File
@@ -0,0 +1,61 @@
# UI Spec — primary view
Source: operator description, 2026-09-15. Status: ACCEPTED (v1 scope).
## Header (above the table)
- **KPI block, top left — 6 KPIs:**
1. Total miners
2. Hashing
3. Slow
4. Not hashing
5. Total hashrate (sum over table)
6. Total estimated power consumption (sum over table)
- **Scan-ranges box** (middle): click to edit the IP scanning ranges.
- **Filter button**: opens an Excel-style filter panel (per-column value
filters, multi-select).
- **Columns button**: opens a panel of checkboxes, one per available
statistic; unchecked = column hidden from the table.
## Table
- One miner per row; statistics as columns.
- **Sort:** click a column title to sort by it (toggle asc/desc).
- **Row checkbox** at the left edge selects the miner (bulk actions later).
- **First column is always IP** (not reorderable, not hideable).
- **Other columns drag-to-reorder.**
- **Default column order** after IP:
1. Hashrate
2. Power (estimated)
3. Chip temp
4. Cooling (fan)
5. Firmware
6. Pool worker account name
7. …then the remaining statistics in registry order.
## Data sources
- Rows and statistics come from the vendored `asic-rs` scan engine
(`MinerFactory::scan_stream()` over the configured ranges); the toolkit
adds install-state columns (foothold available, pathway supported) that
asic-rs does not know about.
- The six KPIs are derived client-side from the same row set, so header and
table can never disagree.
- "Slow" = hashing but below the model's expected hashrate band (band data
ships with the board registry; missing band = excluded from Slow, counted
in Hashing).
## Implementation notes
- wxWidgets: the view is a `wxDataViewListCtrl`/`wxDataViewCtrl` (virtual
list — thousands of rows without materializing cells), checkbox column +
IP column fixed via attribute/serializer, drag reorder via `wxReorderable`
column events, sort via column header click events mapped to the model.
- Filter panel: per-column distinct-value checklist with text search,
"select all/none", AND across columns, OR within a column (Excel
semantics).
- Columns panel: persists (order + visibility) per install in a user config
file; "reset to default order" action included.
- Scan-ranges box: opens a small editor with CIDR list, one per line,
validate-on-apply; ranges feed both asic-rs scan and the ARP/ICMP
pre-pass.
+35
View File
@@ -0,0 +1,35 @@
# ADR 0001: Recipes as data, interpreted by one engine
Status: ACCEPTED
Date: 2026-09-14
## Context
alkane-sdk defines per `{board, source-OS}` install recipes as prose with
five facts (foothold, transfer channel, write target, verify, revert) plus
a universal stage pattern. Hardcoding each combination as imperative Rust
would fork control flow per combination and make the recorded false
positives (UBI volume-name trap, "Success: 1" booting stock) easy to
reintroduce.
## Decision
Every recipe is a declarative pipeline (ordered stages + typed parameters,
board/OS-keyed data files in the repo), executed by a single engine. The
five SDK invariants are enforced by the engine and the domain types, not by
individual recipes:
1. secure-partition writes refused unconditionally
2. independent-channel verification + >= 2 power-cycle persist gate
3. reboot timeout = candidate success, re-classified via liveness channel
4. packer formats are board-owned enum values; cross-board misuse is
unrepresentable
5. boot-switch is an explicit stage with its own verification + regression
tests for known traps
## Consequences
- Adding `{board, source-OS}` support = data + tests, no new control flow.
- The audit log is a natural by-product (one entry per stage).
- Resume/rollback operates on the same stage list the log describes.
- The engine is identical for CLI and GUI (D4 in the plan).
+41
View File
@@ -0,0 +1,41 @@
# ADR 0002: GUI bindings — wxWidgets shell in C++ + Rust core, spike to revisit
Status: RESOLVED 2026-09-15 - the operator chose Option B (pure Rust via
wx-rs) with vendoring (ADR-0003). wx-rs 0.2.0 was extended via the patch
queue: Linux/GTK3 wx-config build path plus the widget bridge (panel,
sizers, static text, button, text ctrl, checkbox, checklistbox, dialog,
data view list ctrl, timer). The app ships this way; no C++ shell.
Date: 2026-09-14
## Context
The toolkit must present a native cross-platform GUI (wxWidgets chosen).
Rust bindings to wxWidgets checked on crates.io 2026-09-14:
- `wxRust` 0.0.1-alpha — unmaintained since 2022.
- `wx-rs` 0.2.0 (2023, self-contained) — ~6k downloads, no 1.0.
Betting the GUI on alpha bindings risks weeks of binding-gap debugging
(paste-heavy widgets, worker threads + event loops, GTK/WinCocoa quirks).
## Decision
Default: **thin C++17 wxWidgets shell (`gui/`) + Rust core exposed over a
small stable C ABI** (cdylib from `alkane-core`, header generated with
cbindgen). The shell holds frames, lists, the install wizard, and event
glue only — no business logic, no safety logic. All invariants, engines,
and tests live in Rust where they are testable headlessly.
Gate: M0 runs a time-boxed `wx-rs` spike (window + list/tree + wizard flow
+ worker-thread progress + cancel on Linux and Windows). If the spike is
solid, flip to pure Rust; either way the decision is recorded before M3.
## Consequences
- The repo builds two things: a Rust workspace and a small C++ app linked
against the core cdylib. CMake in `gui/`.
- Core API surface stays small and event-oriented (discover, identify,
plan, execute, cancel, progress events, log tail) — good FFI hygiene and
a natural match for the CLI too (D4).
- If wx-rs wins the spike, the C ABI is kept as an integration boundary for
scripted/HIL use anyway.
+58
View File
@@ -0,0 +1,58 @@
# ADR 0003: Vendoring policy — pristine upstream archives + patch queue
Status: ACCEPTED
Date: 2026-09-15
## Context
The operator directed that ASIC-rs and wxWidgets live vendored in this repo
"so that we can handle merging updates easily". Upstream is not reachable
through our suspended GitHub account, and we want reproducible offline
builds and conflict-free updates.
## Decision
Both dependencies are vendored under `vendor/` as **pristine upstream
archives plus a patch queue**:
```
vendor/ cargo-managed crate sources ONLY (regenerated by
`cargo vendor vendor`; it deletes unmanaged dirs - never
put hand-made trees here; learned the hard way)
thirdparty/
asic-rs lives in vendor/ (pure crates.io dep, cargo-vendored)
wxwidgets/
wxWidgets-3.3.3/ pristine release tree, never edited directly
VERSION upstream version + tarball URL + sha256
patches/ our changes as numbered .patch files (empty today)
wx-rs/
wx-rs-0.2.0-patched/ the used crate (path dep from alkane-gui)
VERSION upstream version + tarball URL + sha256
patches/ 0001 linux build path, 0002 rust widgets binding,
0003 C++ widget bridge, 0004 upstream wx3.3 fixes
```
Rules:
1. Never edit a vendored pristine tree in place — every local change is a
patch in `patches/`, applied by the build in numeric order. This makes
an upstream update: replace pristine archive, `git apply` surviving
patches, rebase the rest.
2. Every vendored tree records its upstream source URL and sha256 in
`VERSION`. Updates are a diff of one version-pinning line plus the
patch-queue rebase.
3. Builds happen out-of-tree (`~/.cache/wxbuild`, `~/.cache/wx-3.3.3-linux`)
because the synced project mount is noexec; scripts/build-wx-linux.sh
automates it.
3. asic-rs is pinned per semver in Cargo.toml and materialized with
`cargo vendor`; the build uses `.cargo/config.toml`'s vendored-sources
replacement, so builds never touch the network.
4. wxWidgets 3.3.3 release tarball is the merge unit (wx upstream supports
it); the C++ shell links the vendored tree via CMake `add_subdirectory`.
## Consequences
- The repo grows by the vendored sources (one-time; git-compressed).
- Offline/reproducible builds on any machine.
- Updating either dependency is mechanical, reviewable, and never
entangles our changes with upstream files.
@@ -1,30 +0,0 @@
{
"sha": "086c883c4ae42f5d3c24fc1fb4d312badcfbc79e",
"timestamp": "2026-11-04T20:50:12+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 231400.0,
"bench_health_diagnostics": 41504.0,
"bench_render_cells": 8263260.000000001,
"bench_sort_by_each_column": 1426938.0,
"bench_upsert_cold_start_population": 14057415.0,
"bench_view_pipeline": 317977.0,
"bench_view_pipeline_default_sort": 512832.99999999994,
"bench_view_pipeline_with_filter": 402369.0,
"bench_naming_transforms": 671.0,
"bench_parse_line_near_max_addrs": 1128579.0,
"bench_parse_targets_many_ranges_near_cap": 110722378.0,
"bench_targets_to_cidrs_large_range": 955996.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "de5c1a5a150a410d1591e9b5ed664c2ac55157a8"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "0873d2c79d3f75a8802c38428c93be6e90ca5c29",
"timestamp": "2026-11-17T07:03:05+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 150768.0,
"bench_health_diagnostics": 17390.0,
"bench_render_cells": 3124124.0,
"bench_sort_by_each_column": 480690.0,
"bench_upsert_cold_start_population": 18664809.0,
"bench_view_pipeline": 161447.0,
"bench_view_pipeline_default_sort": 175055.0,
"bench_view_pipeline_with_filter": 133088.0,
"bench_naming_transforms": 252.0,
"bench_parse_line_near_max_addrs": 352516.0,
"bench_parse_targets_many_ranges_near_cap": 76502278.0,
"bench_targets_to_cidrs_large_range": 590427.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "63c603d91987069b615f1927d8383e383bd3a1a5"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "0949870a147fbc54dbd7a9fe0567cd70315ba1db",
"timestamp": "2026-11-03T16:08:38+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 476269.0,
"bench_health_diagnostics": 80495.0,
"bench_render_cells": 8167535.000000001,
"bench_sort_by_each_column": 863351.0,
"bench_upsert_cold_start_population": 22065597.0,
"bench_view_pipeline": 249205.0,
"bench_view_pipeline_default_sort": 432689.0,
"bench_view_pipeline_with_filter": 360209.0,
"bench_naming_transforms": 712.0,
"bench_parse_line_near_max_addrs": 463750.0,
"bench_parse_targets_many_ranges_near_cap": 109014386.0,
"bench_targets_to_cidrs_large_range": 1258014.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "abad4879ea89af0c0a6f41157a987114fa5f406f"
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "190a04d740f890df70c15d9336447ec41d07572c",
"timestamp": "2026-10-17T13:10:07+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 145692.0,
"bench_health_diagnostics": 17914.0,
"bench_render_cells": 3089940.0,
"bench_sort_by_each_column": 404616.0,
"bench_upsert_cold_start_population": 6819436.0,
"bench_view_pipeline": 158400.0,
"bench_view_pipeline_default_sort": 173943.0,
"bench_view_pipeline_with_filter": 174073.0,
"bench_naming_transforms": 225.0,
"bench_parse_line_near_max_addrs": 253780.0,
"bench_parse_targets_many_ranges_near_cap": 45754074.0,
"bench_targets_to_cidrs_large_range": 238448.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "21e3c5fe8597d77f1fa9a5e4826b5a2d48b41b14",
"timestamp": "2026-10-19T13:05:31+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 287697.0,
"bench_health_diagnostics": 64825.0,
"bench_render_cells": 8729316.0,
"bench_sort_by_each_column": 1016929.0,
"bench_upsert_cold_start_population": 19092946.0,
"bench_view_pipeline": 356335.0,
"bench_view_pipeline_default_sort": 822767.0,
"bench_view_pipeline_with_filter": 490965.0,
"bench_naming_transforms": 1259.0,
"bench_parse_line_near_max_addrs": 1010586.9999999999,
"bench_parse_targets_many_ranges_near_cap": 130404975.0,
"bench_targets_to_cidrs_large_range": 849779.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "224b3b37e82062edbdd1bcd92f97e4811b836399",
"timestamp": "2026-11-12T23:39:17+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 156621.0,
"bench_health_diagnostics": 17225.0,
"bench_render_cells": 3375293.0,
"bench_sort_by_each_column": 408203.0,
"bench_upsert_cold_start_population": 6338209.0,
"bench_view_pipeline": 169986.0,
"bench_view_pipeline_default_sort": 207867.0,
"bench_view_pipeline_with_filter": 139582.0,
"bench_naming_transforms": 237.0,
"bench_parse_line_near_max_addrs": 446909.0,
"bench_parse_targets_many_ranges_near_cap": 49953456.0,
"bench_targets_to_cidrs_large_range": 346302.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": null
}
}
}
@@ -1,24 +0,0 @@
{
"sha": "24fc79025dc7a2631dfc1839cf31ab6478cc85d7",
"timestamp": "2026-10-16T02:19:55+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 367352.0,
"bench_render_cells": 9587436.0,
"bench_sort_by_each_column": 949231.0,
"bench_upsert_cold_start_population": 13731946.0,
"bench_view_pipeline": 372242.0,
"bench_view_pipeline_default_sort": 489146.0,
"bench_view_pipeline_with_filter": 309416.0,
"bench_naming_transforms": 767.0,
"bench_parse_line_near_max_addrs": 1545620.0,
"bench_parse_targets_many_ranges_near_cap": 98663260.0,
"bench_targets_to_cidrs_large_range": 919255.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,18 +0,0 @@
{
"sha": "2b96ba495af7fbaee88f7a3e49ea7690d14d7585",
"timestamp": "2026-10-15T02:59:35+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 384838.0,
"bench_parse_line_near_max_addrs": 4640391.0,
"bench_upsert_cold_start_population": 32144464.0,
"bench_targets_to_cidrs_large_range": 1895524.0,
"bench_view_pipeline": 509809.0,
"bench_view_pipeline_default_sort": 839787.0,
"bench_view_pipeline_with_filter": 868182.0,
"bench_sort_by_each_column": 2381377.0,
"bench_render_cells": 11180890.0,
"bench_parse_targets_many_ranges_near_cap": 125437870.0
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "2f1a65035b172218f4107e2a408d18d490778875",
"timestamp": "2026-10-16T01:34:08+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 346141.0,
"bench_render_cells": 8142103.000000001,
"bench_sort_by_each_column": 1171404.0,
"bench_upsert_cold_start_population": 13963726.0,
"bench_view_pipeline": 288593.0,
"bench_view_pipeline_default_sort": 394582.0,
"bench_view_pipeline_with_filter": 271501.0,
"bench_parse_line_near_max_addrs": 1126873.0,
"bench_parse_targets_many_ranges_near_cap": 91095834.0,
"bench_targets_to_cidrs_large_range": 645368.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "35ea1b6e59fff8c12ec4ceafaf453dd1e6da0575",
"timestamp": "2026-11-03T01:49:03+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 216539.0,
"bench_health_diagnostics": 52171.0,
"bench_render_cells": 7567196.0,
"bench_sort_by_each_column": 683139.0,
"bench_upsert_cold_start_population": 15256877.0,
"bench_view_pipeline": 283474.0,
"bench_view_pipeline_default_sort": 604442.0,
"bench_view_pipeline_with_filter": 341919.0,
"bench_naming_transforms": 690.0,
"bench_parse_line_near_max_addrs": 1093951.0,
"bench_parse_targets_many_ranges_near_cap": 96273203.0,
"bench_targets_to_cidrs_large_range": 779068.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": true,
"baseline_sha": "f2782e7d0363353b1e7de2b530e76dee5812acd4"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "36f12d6d4eba5c75e2f7734950ed234b83484a9d",
"timestamp": "2026-11-03T18:15:47+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 284328.0,
"bench_health_diagnostics": 43870.0,
"bench_render_cells": 9062725.0,
"bench_sort_by_each_column": 1431571.0,
"bench_upsert_cold_start_population": 14805374.0,
"bench_view_pipeline": 362835.0,
"bench_view_pipeline_default_sort": 670666.0,
"bench_view_pipeline_with_filter": 439213.0,
"bench_naming_transforms": 1182.0,
"bench_parse_line_near_max_addrs": 877061.0,
"bench_parse_targets_many_ranges_near_cap": 106004212.0,
"bench_targets_to_cidrs_large_range": 735187.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": true,
"baseline_sha": "d925414bc8c517de51d0f821a22d557c6ea7f6d8"
}
}
}
@@ -1,18 +0,0 @@
{
"sha": "3846b12d8c1124fe7b1418e957d45f13aecc1758",
"timestamp": "2026-10-15T03:43:37+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 296251.0,
"bench_parse_line_near_max_addrs": 4739934.0,
"bench_upsert_cold_start_population": 58684370.0,
"bench_targets_to_cidrs_large_range": 2860035.0,
"bench_view_pipeline": 604581.0,
"bench_view_pipeline_default_sort": 741241.0,
"bench_view_pipeline_with_filter": 772467.0,
"bench_sort_by_each_column": 3028466.0,
"bench_render_cells": 11094676.0,
"bench_parse_targets_many_ranges_near_cap": 131662616.00000001
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "3d0cc99936484e0bcd3eb9253b714ef3d39bc3c4",
"timestamp": "2026-10-19T13:42:03+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 149123.0,
"bench_health_diagnostics": 20251.0,
"bench_render_cells": 3315556.0,
"bench_sort_by_each_column": 441505.0,
"bench_upsert_cold_start_population": 6408091.0,
"bench_view_pipeline": 173266.0,
"bench_view_pipeline_default_sort": 210071.0,
"bench_view_pipeline_with_filter": 138017.0,
"bench_naming_transforms": 240.0,
"bench_parse_line_near_max_addrs": 248233.0,
"bench_parse_targets_many_ranges_near_cap": 54797302.0,
"bench_targets_to_cidrs_large_range": 259588.00000000003
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
},
"bench_context": {
"schema": 1,
"same_inputs": true,
"baseline_sha": "9367bacc919cece889a2e0bde769ff77a0850796"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "3d1fd36811a2b0aa0939632eec35e7855fccb7f0",
"timestamp": "2026-11-04T17:39:32+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 220792.0,
"bench_health_diagnostics": 47611.0,
"bench_render_cells": 9858396.0,
"bench_sort_by_each_column": 1071853.0,
"bench_upsert_cold_start_population": 12811287.0,
"bench_view_pipeline": 286772.0,
"bench_view_pipeline_default_sort": 694225.0,
"bench_view_pipeline_with_filter": 339542.0,
"bench_naming_transforms": 988.0,
"bench_parse_line_near_max_addrs": 1108814.0,
"bench_parse_targets_many_ranges_near_cap": 99582545.0,
"bench_targets_to_cidrs_large_range": 830943.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "d9dc60918c37d25aae75ee9ebdd45748c77dd1c8"
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "4826f4789313932ff3e02d1cf2549b5e72a636b6",
"timestamp": "2026-10-19T07:54:49+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 149297.0,
"bench_health_diagnostics": 18162.0,
"bench_render_cells": 3237480.0,
"bench_sort_by_each_column": 403280.0,
"bench_upsert_cold_start_population": 5761643.0,
"bench_view_pipeline": 167669.0,
"bench_view_pipeline_default_sort": 187230.0,
"bench_view_pipeline_with_filter": 142824.0,
"bench_naming_transforms": 276.0,
"bench_parse_line_near_max_addrs": 270557.0,
"bench_parse_targets_many_ranges_near_cap": 50420544.0,
"bench_targets_to_cidrs_large_range": 262823.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "50102800a3ce0918182740ad8c4b6736cf163da2",
"timestamp": "2026-11-12T20:38:34+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 345115.0,
"bench_health_diagnostics": 71323.0,
"bench_render_cells": 11520511.0,
"bench_sort_by_each_column": 761691.0,
"bench_upsert_cold_start_population": 15509979.0,
"bench_view_pipeline": 295508.0,
"bench_view_pipeline_default_sort": 521515.0,
"bench_view_pipeline_with_filter": 448970.0,
"bench_naming_transforms": 764.0,
"bench_parse_line_near_max_addrs": 830828.0,
"bench_parse_targets_many_ranges_near_cap": 113494127.0,
"bench_targets_to_cidrs_large_range": 777129.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "086c883c4ae42f5d3c24fc1fb4d312badcfbc79e"
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "5033c9609de42055a2281309aaed28cf1cd507c9",
"timestamp": "2026-10-15T20:45:20+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 296364.0,
"bench_render_cells": 7871919.0,
"bench_sort_by_each_column": 590320.0,
"bench_upsert_cold_start_population": 10892236.0,
"bench_view_pipeline": 269610.0,
"bench_view_pipeline_default_sort": 378227.0,
"bench_view_pipeline_with_filter": 315949.0,
"bench_parse_line_near_max_addrs": 479187.0,
"bench_parse_targets_many_ranges_near_cap": 92440268.0,
"bench_targets_to_cidrs_large_range": 754162.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "589e933391ceece158e55f9fb6914abe47d0e1b3",
"timestamp": "2026-10-17T04:15:42+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 211665.0,
"bench_health_diagnostics": 42443.0,
"bench_render_cells": 7263909.0,
"bench_sort_by_each_column": 997910.0,
"bench_upsert_cold_start_population": 15908355.0,
"bench_view_pipeline": 355129.0,
"bench_view_pipeline_default_sort": 492829.0,
"bench_view_pipeline_with_filter": 330860.0,
"bench_naming_transforms": 562.0,
"bench_parse_line_near_max_addrs": 744600.0,
"bench_parse_targets_many_ranges_near_cap": 100276723.0,
"bench_targets_to_cidrs_large_range": 617330.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "63c603d91987069b615f1927d8383e383bd3a1a5",
"timestamp": "2026-11-17T05:38:28+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 159636.0,
"bench_health_diagnostics": 16504.0,
"bench_render_cells": 3292312.0,
"bench_sort_by_each_column": 397849.0,
"bench_upsert_cold_start_population": 6062771.0,
"bench_view_pipeline": 163138.0,
"bench_view_pipeline_default_sort": 199057.0,
"bench_view_pipeline_with_filter": 138058.0,
"bench_naming_transforms": 347.0,
"bench_parse_line_near_max_addrs": 532364.0,
"bench_parse_targets_many_ranges_near_cap": 47043070.0,
"bench_targets_to_cidrs_large_range": 356855.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "224b3b37e82062edbdd1bcd92f97e4811b836399"
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "664be2304fc78b2725935faa8383a525d8afe742",
"timestamp": "2026-10-17T15:22:00+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 151408.0,
"bench_health_diagnostics": 22349.0,
"bench_render_cells": 3243855.0,
"bench_sort_by_each_column": 402489.0,
"bench_upsert_cold_start_population": 6920466.0,
"bench_view_pipeline": 181864.0,
"bench_view_pipeline_default_sort": 227356.0,
"bench_view_pipeline_with_filter": 135183.0,
"bench_naming_transforms": 377.0,
"bench_parse_line_near_max_addrs": 457347.0,
"bench_parse_targets_many_ranges_near_cap": 48664759.0,
"bench_targets_to_cidrs_large_range": 446479.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
}
}
}
@@ -1,18 +0,0 @@
{
"sha": "694e2fc7e54ed48fc91ca0238c1b0691ebbf4bcf",
"timestamp": "2026-10-15T04:05:00+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 365426.0,
"bench_parse_line_near_max_addrs": 3076713.0,
"bench_upsert_cold_start_population": 63214191.0,
"bench_targets_to_cidrs_large_range": 2406662.0,
"bench_view_pipeline": 473218.0,
"bench_view_pipeline_default_sort": 923022.0,
"bench_view_pipeline_with_filter": 968899.0,
"bench_sort_by_each_column": 2429822.0,
"bench_render_cells": 11029261.0,
"bench_parse_targets_many_ranges_near_cap": 146216294.0
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "8597ae9f9d4bfebdad96bdf6dbab6a42d2ef5dda",
"timestamp": "2026-10-15T18:57:30+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 292745.0,
"bench_render_cells": 7622204.0,
"bench_sort_by_each_column": 1043665.0000000001,
"bench_upsert_cold_start_population": 18272527.0,
"bench_view_pipeline": 356502.0,
"bench_view_pipeline_default_sort": 567867.0,
"bench_view_pipeline_with_filter": 363892.0,
"bench_parse_line_near_max_addrs": 1247912.0,
"bench_parse_targets_many_ranges_near_cap": 104308299.0,
"bench_targets_to_cidrs_large_range": 527482.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "89cf01324e677119b0836df094e63cbe97518cf7",
"timestamp": "2026-10-15T18:01:06+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 242716.0,
"bench_render_cells": 8553437.0,
"bench_sort_by_each_column": 609435.0,
"bench_upsert_cold_start_population": 21969970.0,
"bench_view_pipeline": 247075.0,
"bench_view_pipeline_default_sort": 397949.0,
"bench_view_pipeline_with_filter": 310322.0,
"bench_parse_line_near_max_addrs": 933566.0,
"bench_parse_targets_many_ranges_near_cap": 93079826.0,
"bench_targets_to_cidrs_large_range": 740061.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "9367bacc919cece889a2e0bde769ff77a0850796",
"timestamp": "2026-10-19T12:51:45+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 198246.0,
"bench_health_diagnostics": 26489.0,
"bench_render_cells": 4380129.0,
"bench_sort_by_each_column": 444842.0,
"bench_upsert_cold_start_population": 9773220.0,
"bench_view_pipeline": 209086.0,
"bench_view_pipeline_default_sort": 330129.0,
"bench_view_pipeline_with_filter": 156561.0,
"bench_naming_transforms": 399.0,
"bench_parse_line_near_max_addrs": 451749.0,
"bench_parse_targets_many_ranges_near_cap": 59691906.0,
"bench_targets_to_cidrs_large_range": 267781.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
}
}
}
@@ -1,18 +0,0 @@
{
"sha": "9d0ebafece9f88a8270dcdee00082c4c1b9496b2",
"timestamp": "2026-10-15T03:14:02+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 219022.0,
"bench_parse_line_near_max_addrs": 3804482.0,
"bench_upsert_cold_start_population": 39237098.0,
"bench_targets_to_cidrs_large_range": 2001242.0,
"bench_view_pipeline": 541949.0,
"bench_view_pipeline_with_filter": 763250.0,
"bench_view_pipeline_default_sort": 837874.0,
"bench_sort_by_each_column": 1613311.0,
"bench_render_cells": 10743266.0,
"bench_parse_targets_many_ranges_near_cap": 129729098.0
}
}
}
@@ -1,17 +0,0 @@
{
"sha": "9d40ff2490e40288c994902e6de738548f1dbb8c",
"timestamp": "2026-10-15T02:45:10+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_parse_line_near_max_addrs": 3827574.0,
"bench_targets_to_cidrs_large_range": 1840735.0,
"bench_upsert_cold_start_population": 53175458.0,
"bench_view_pipeline": 666476.0,
"bench_view_pipeline_with_filter": 794104.0,
"bench_view_pipeline_default_sort": 843599.0,
"bench_sort_by_each_column": 1298114.0,
"bench_render_cells": 11420892.0,
"bench_parse_targets_many_ranges_near_cap": 137639734.0
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "a1f610a393dedb993f5c16b7f51a4ab67ed6c04b",
"timestamp": "2026-10-16T11:21:01+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 376947.0,
"bench_health_diagnostics": 55682.0,
"bench_render_cells": 8362787.000000001,
"bench_sort_by_each_column": 1205811.0,
"bench_upsert_cold_start_population": 13716307.0,
"bench_view_pipeline": 271402.0,
"bench_view_pipeline_default_sort": 435624.0,
"bench_view_pipeline_with_filter": 316096.0,
"bench_naming_transforms": 657.0,
"bench_parse_line_near_max_addrs": 724431.0,
"bench_parse_targets_many_ranges_near_cap": 106269799.0,
"bench_targets_to_cidrs_large_range": 1117471.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "a604cbf5b5412ff8d383091198118a0064769a21",
"timestamp": "2026-10-15T21:06:37+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 242202.0,
"bench_render_cells": 7469431.0,
"bench_sort_by_each_column": 1068697.0,
"bench_upsert_cold_start_population": 17376872.0,
"bench_view_pipeline": 262328.0,
"bench_view_pipeline_default_sort": 439350.0,
"bench_view_pipeline_with_filter": 326119.0,
"bench_parse_line_near_max_addrs": 718592.0,
"bench_parse_targets_many_ranges_near_cap": 94324631.0,
"bench_targets_to_cidrs_large_range": 1488755.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "aaf18f6d9c6861a95177c0abb9443bc1f6c64b33",
"timestamp": "2026-10-17T10:05:16+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 246734.0,
"bench_health_diagnostics": 38610.0,
"bench_render_cells": 8644429.0,
"bench_sort_by_each_column": 1106075.0,
"bench_upsert_cold_start_population": 18903190.0,
"bench_view_pipeline": 253698.0,
"bench_view_pipeline_default_sort": 443696.0,
"bench_view_pipeline_with_filter": 324631.0,
"bench_naming_transforms": 648.0,
"bench_parse_line_near_max_addrs": 708841.0,
"bench_parse_targets_many_ranges_near_cap": 98195090.0,
"bench_targets_to_cidrs_large_range": 1134955.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "abad4879ea89af0c0a6f41157a987114fa5f406f",
"timestamp": "2026-11-03T14:40:08+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 250211.0,
"bench_health_diagnostics": 39323.0,
"bench_render_cells": 6881329.0,
"bench_sort_by_each_column": 738357.0,
"bench_upsert_cold_start_population": 10749899.0,
"bench_view_pipeline": 293535.0,
"bench_view_pipeline_default_sort": 467861.0,
"bench_view_pipeline_with_filter": 305577.0,
"bench_naming_transforms": 1196.0,
"bench_parse_line_near_max_addrs": 695013.0,
"bench_parse_targets_many_ranges_near_cap": 90324476.0,
"bench_targets_to_cidrs_large_range": 714750.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": true,
"baseline_sha": "c06cff966da25e0ac7739bb28ab97117761c6edb"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "b1b7a3dbc0d710182119eb0d4faa765c7b576822",
"timestamp": "2026-11-03T19:45:01+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 205141.0,
"bench_health_diagnostics": 35119.0,
"bench_render_cells": 7661409.0,
"bench_sort_by_each_column": 969764.0,
"bench_upsert_cold_start_population": 15386423.0,
"bench_view_pipeline": 282417.0,
"bench_view_pipeline_default_sort": 500004.0,
"bench_view_pipeline_with_filter": 391194.0,
"bench_naming_transforms": 843.0,
"bench_parse_line_near_max_addrs": 529906.0,
"bench_parse_targets_many_ranges_near_cap": 96687131.0,
"bench_targets_to_cidrs_large_range": 712574.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "36f12d6d4eba5c75e2f7734950ed234b83484a9d"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "ba0c71665aba139dfb72701b6c08cd72d5ca1f48",
"timestamp": "2026-11-03T17:29:36+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 315507.0,
"bench_health_diagnostics": 53128.0,
"bench_render_cells": 6964676.0,
"bench_sort_by_each_column": 692127.0,
"bench_upsert_cold_start_population": 13608854.0,
"bench_view_pipeline": 295039.0,
"bench_view_pipeline_default_sort": 433913.0,
"bench_view_pipeline_with_filter": 309545.0,
"bench_naming_transforms": 787.0,
"bench_parse_line_near_max_addrs": 1176949.0,
"bench_parse_targets_many_ranges_near_cap": 128753097.0,
"bench_targets_to_cidrs_large_range": 1275395.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "0949870a147fbc54dbd7a9fe0567cd70315ba1db"
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "ba782e78951518b13f16b52e2e1cee2b980bb1a8",
"timestamp": "2026-10-16T02:42:08+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 273904.0,
"bench_health_diagnostics": 49222.0,
"bench_render_cells": 7494854.0,
"bench_sort_by_each_column": 845325.0,
"bench_upsert_cold_start_population": 10489144.0,
"bench_view_pipeline": 248815.0,
"bench_view_pipeline_default_sort": 543384.0,
"bench_view_pipeline_with_filter": 307910.0,
"bench_naming_transforms": 1040.0,
"bench_parse_line_near_max_addrs": 712150.0,
"bench_parse_targets_many_ranges_near_cap": 98513838.0,
"bench_targets_to_cidrs_large_range": 535509.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,18 +0,0 @@
{
"sha": "bc406af89f70bb2c34b4457581bba72cfc47faec",
"timestamp": "2026-10-15T03:28:41+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 398454.0,
"bench_parse_line_near_max_addrs": 3360049.0,
"bench_upsert_cold_start_population": 27099168.0,
"bench_targets_to_cidrs_large_range": 1380223.0,
"bench_view_pipeline": 529723.0,
"bench_view_pipeline_with_filter": 646081.0,
"bench_view_pipeline_default_sort": 893189.0,
"bench_sort_by_each_column": 2257556.0,
"bench_render_cells": 10075243.0,
"bench_parse_targets_many_ranges_near_cap": 138231252.0
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "c06cff966da25e0ac7739bb28ab97117761c6edb",
"timestamp": "2026-11-03T03:09:59+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 205600.0,
"bench_health_diagnostics": 64043.00000000001,
"bench_render_cells": 8197196.999999999,
"bench_sort_by_each_column": 1098407.0,
"bench_upsert_cold_start_population": 22804580.0,
"bench_view_pipeline": 247352.0,
"bench_view_pipeline_default_sort": 396722.0,
"bench_view_pipeline_with_filter": 336975.0,
"bench_naming_transforms": 620.0,
"bench_parse_line_near_max_addrs": 695879.0,
"bench_parse_targets_many_ranges_near_cap": 98974083.0,
"bench_targets_to_cidrs_large_range": 1243064.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "35ea1b6e59fff8c12ec4ceafaf453dd1e6da0575"
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "c6ab7510c8702b2e4c60e269d959d6ca0bc541af",
"timestamp": "2026-10-15T10:18:59+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 205681.0,
"bench_render_cells": 7788885.0,
"bench_sort_by_each_column": 967167.0,
"bench_upsert_cold_start_population": 24391329.0,
"bench_view_pipeline": 243287.0,
"bench_view_pipeline_default_sort": 365244.0,
"bench_view_pipeline_with_filter": 323236.0,
"bench_parse_line_near_max_addrs": 1451641.0,
"bench_parse_targets_many_ranges_near_cap": 91555147.0,
"bench_targets_to_cidrs_large_range": 1168169.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,18 +0,0 @@
{
"sha": "cb46adada20120c0b47f0f410faa3b1aff8b80f3",
"timestamp": "2026-10-15T09:43:24+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 264623.0,
"bench_parse_line_near_max_addrs": 3900418.0,
"bench_targets_to_cidrs_large_range": 1370620.0,
"bench_upsert_cold_start_population": 52689889.0,
"bench_view_pipeline": 644508.0,
"bench_view_pipeline_with_filter": 725578.0,
"bench_view_pipeline_default_sort": 977443.0,
"bench_sort_by_each_column": 1488922.0,
"bench_render_cells": 10442975.0,
"bench_parse_targets_many_ranges_near_cap": 132692428.0
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "d07fccd9b104fa4a28c9f12b515bb8bd644f1098",
"timestamp": "2026-10-20T06:38:29+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 287597.0,
"bench_health_diagnostics": 51891.0,
"bench_render_cells": 7771762.0,
"bench_sort_by_each_column": 753638.0,
"bench_upsert_cold_start_population": 15443697.0,
"bench_view_pipeline": 310825.0,
"bench_view_pipeline_default_sort": 436411.0,
"bench_view_pipeline_with_filter": 288077.0,
"bench_naming_transforms": 853.0,
"bench_parse_line_near_max_addrs": 1517012.0,
"bench_parse_targets_many_ranges_near_cap": 114922207.0,
"bench_targets_to_cidrs_large_range": 719502.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": true,
"baseline_sha": "21e3c5fe8597d77f1fa9a5e4826b5a2d48b41b14"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "d925414bc8c517de51d0f821a22d557c6ea7f6d8",
"timestamp": "2026-11-03T17:56:16+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 482684.0,
"bench_health_diagnostics": 105969.0,
"bench_render_cells": 16208072.000000002,
"bench_sort_by_each_column": 1479551.0,
"bench_upsert_cold_start_population": 25050809.0,
"bench_view_pipeline": 401020.0,
"bench_view_pipeline_default_sort": 1119743.0,
"bench_view_pipeline_with_filter": 481430.0,
"bench_naming_transforms": 814.0,
"bench_parse_line_near_max_addrs": 1173441.0,
"bench_parse_targets_many_ranges_near_cap": 170423105.0,
"bench_targets_to_cidrs_large_range": 1051465.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": null
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "d9dc60918c37d25aae75ee9ebdd45748c77dd1c8",
"timestamp": "2026-11-03T22:01:13+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 220570.0,
"bench_health_diagnostics": 48450.0,
"bench_render_cells": 8515973.0,
"bench_sort_by_each_column": 1086721.0,
"bench_upsert_cold_start_population": 11484199.0,
"bench_view_pipeline": 267912.0,
"bench_view_pipeline_default_sort": 496484.0,
"bench_view_pipeline_with_filter": 419495.0,
"bench_naming_transforms": 1053.0,
"bench_parse_line_near_max_addrs": 1096792.0,
"bench_parse_targets_many_ranges_near_cap": 124562079.0,
"bench_targets_to_cidrs_large_range": 1157666.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "b1b7a3dbc0d710182119eb0d4faa765c7b576822"
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "dd0732454e745444609a9f4845a3030f40263332",
"timestamp": "2026-10-16T12:11:57+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 235497.0,
"bench_health_diagnostics": 35749.0,
"bench_render_cells": 8670894.0,
"bench_sort_by_each_column": 677462.0,
"bench_upsert_cold_start_population": 11075293.0,
"bench_view_pipeline": 313264.0,
"bench_view_pipeline_default_sort": 398323.0,
"bench_view_pipeline_with_filter": 261173.99999999997,
"bench_naming_transforms": 557.0,
"bench_parse_line_near_max_addrs": 1326819.0,
"bench_parse_targets_many_ranges_near_cap": 96819591.0,
"bench_targets_to_cidrs_large_range": 937425.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "de5c1a5a150a410d1591e9b5ed664c2ac55157a8",
"timestamp": "2026-11-04T20:11:32+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 377984.0,
"bench_health_diagnostics": 40579.0,
"bench_render_cells": 7085153.0,
"bench_sort_by_each_column": 637484.0,
"bench_upsert_cold_start_population": 17188092.0,
"bench_view_pipeline": 288320.0,
"bench_view_pipeline_default_sort": 418440.0,
"bench_view_pipeline_with_filter": 332109.0,
"bench_naming_transforms": 1018.0,
"bench_parse_line_near_max_addrs": 732030.0,
"bench_parse_targets_many_ranges_near_cap": 94466864.0,
"bench_targets_to_cidrs_large_range": 554739.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "3d1fd36811a2b0aa0939632eec35e7855fccb7f0"
}
}
}
@@ -1,23 +0,0 @@
{
"sha": "e609176c66b601ae574d5e7e5bf1f5c50d330c6d",
"timestamp": "2026-10-16T01:13:04+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 218872.0,
"bench_render_cells": 9530209.0,
"bench_sort_by_each_column": 1315714.0,
"bench_upsert_cold_start_population": 15157985.0,
"bench_view_pipeline": 263511.0,
"bench_view_pipeline_default_sort": 703491.0,
"bench_view_pipeline_with_filter": 392226.0,
"bench_parse_line_near_max_addrs": 1592722.0,
"bench_parse_targets_many_ranges_near_cap": 99469756.0,
"bench_targets_to_cidrs_large_range": 1072855.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "e7bb7d13d07666c954fb3cdd5a41c758eac16775",
"timestamp": "2026-10-19T03:48:15+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 151224.0,
"bench_health_diagnostics": 26346.0,
"bench_render_cells": 3605323.0,
"bench_sort_by_each_column": 411789.0,
"bench_upsert_cold_start_population": 5831394.0,
"bench_view_pipeline": 177420.0,
"bench_view_pipeline_default_sort": 194736.0,
"bench_view_pipeline_with_filter": 143243.0,
"bench_naming_transforms": 398.0,
"bench_parse_line_near_max_addrs": 399835.0,
"bench_parse_targets_many_ranges_near_cap": 50695071.0,
"bench_targets_to_cidrs_large_range": 347059.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
"logical_cpus": 4
}
}
}
@@ -1,25 +0,0 @@
{
"sha": "efd5f85eb8823bc0f86c1fa3e095ae0471f28d4e",
"timestamp": "2026-10-19T11:43:33+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 493004.0,
"bench_health_diagnostics": 82637.0,
"bench_render_cells": 16634609.999999998,
"bench_sort_by_each_column": 1871825.0,
"bench_upsert_cold_start_population": 32961717.0,
"bench_view_pipeline": 495008.0,
"bench_view_pipeline_default_sort": 1106422.0,
"bench_view_pipeline_with_filter": 757315.0,
"bench_naming_transforms": 1484.0,
"bench_parse_line_near_max_addrs": 1230688.0,
"bench_parse_targets_many_ranges_near_cap": 210135166.0,
"bench_targets_to_cidrs_large_range": 1157898.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "f2782e7d0363353b1e7de2b530e76dee5812acd4",
"timestamp": "2026-11-03T01:19:10+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 389967.0,
"bench_health_diagnostics": 52290.0,
"bench_render_cells": 7779419.0,
"bench_sort_by_each_column": 698896.0,
"bench_upsert_cold_start_population": 14165385.0,
"bench_view_pipeline": 314658.0,
"bench_view_pipeline_default_sort": 456276.0,
"bench_view_pipeline_with_filter": 365940.0,
"bench_naming_transforms": 1313.0,
"bench_parse_line_near_max_addrs": 1026106.0,
"bench_parse_targets_many_ranges_near_cap": 101291737.0,
"bench_targets_to_cidrs_large_range": 607801.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
"logical_cpus": 8
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": "d07fccd9b104fa4a28c9f12b515bb8bd644f1098"
}
}
}
@@ -1,30 +0,0 @@
{
"sha": "f302de1d03554d45ac07913ad067fe2e384ffc72",
"timestamp": "2026-10-21T13:07:57+00:00",
"metrics": {
"bench_ns_per_op": {
"bench_verify_artifact": 1055560.0,
"bench_health_diagnostics": 76337.0,
"bench_render_cells": 7273172.0,
"bench_sort_by_each_column": 806299.0,
"bench_upsert_cold_start_population": 17349863.0,
"bench_view_pipeline": 548227.0,
"bench_view_pipeline_default_sort": 575808.0,
"bench_view_pipeline_with_filter": 540407.0,
"bench_naming_transforms": 670.0,
"bench_parse_line_near_max_addrs": 1396925.0,
"bench_parse_targets_many_ranges_near_cap": 118287353.0,
"bench_targets_to_cidrs_large_range": 1567283.0
},
"bench_host": {
"architecture": "x86_64",
"cpu_model": "Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz",
"logical_cpus": 4
},
"bench_context": {
"schema": 1,
"same_inputs": false,
"baseline_sha": null
}
}
}
-1215
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="102" height="20" role="img" aria-label="CI main: last completed attempt pass (run 13352)"><title>CI main: last completed attempt pass (run 13352)</title><rect width="102" height="20" rx="3" fill="#555"/><path d="M39 0h60a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H39z" fill="#2ea043"/><text x="20" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">CI</text><text x="70" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">pass</text></svg>

Before

Width:  |  Height:  |  Size: 533 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="102" height="20" role="img" aria-label="CI next: last completed attempt pass (run 12315)"><title>CI next: last completed attempt pass (run 12315)</title><rect width="102" height="20" rx="3" fill="#555"/><path d="M39 0h60a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H39z" fill="#2ea043"/><text x="20" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">CI</text><text x="70" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">pass</text></svg>

Before

Width:  |  Height:  |  Size: 533 B

+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Build the alkane-toolkit GUI for Linux (GTK3) against the vendored wx 3.3.3.
# Usage: scripts/build-gui-linux.sh [wx-prefix]
# wx-prefix defaults to ~/.cache/wx-3.3.3-linux (see docs/adr/0003 and
# scripts/build-wx-linux.sh to produce it).
set -e
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
WX_PREFIX="${1:-$HOME/.cache/wx-3.3.3-linux}"
if [ ! -x "$WX_PREFIX/bin/wx-config" ]; then
"$REPO/scripts/build-wx-linux.sh"
fi
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
cd "$REPO"
cargo build --release -p alkane-gui --offline
echo
echo "binary: $REPO/target/release/alkane-toolkit (or the target dir set in ~/.cargo/config.toml)"
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
# Build the alkane-toolkit GUI on macOS.
# wx-rs upstream supports macOS: its build.rs clones/builds wx 3.2.2.1 into
# ./dist (osx-release-build) on first build. Requires Xcode Command Line
# Tools. Run this ON a Mac - macOS cannot be linked from Linux.
set -e
cd "$(dirname -- "$0")/.."
cargo build --release -p alkane-gui
echo "binary: target/release/alkane-toolkit (app bundle packaging is follow-up)"
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
# Build the alkane-toolkit GUI for Windows (x86_64) from Linux, via mingw-w64.
# wx-rs upstream supports MSW (it downloads and builds wx 3.2.2.1 with MSVC
# via nmake, or links an msys2 mingw64 wx). Two supported routes:
#
# A) On Windows: install msys2/mingw64 wx + rust-gnu, run `cargo build
# --release -p alkane-gui` there (wx-rs build.rs handles msys2 paths).
# B) Cross from Linux: not automated yet - wxMSW needs the MSVC or msys2
# toolchain; tracked as follow-up. The Rust side cross-compiles fine;
# only the C++ bridge + wx need the Windows toolchain.
#
# This script documents route A and fails here if run on Linux.
set -e
if [ "$(uname -s)" = "Linux" ]; then
echo "Route B (Linux cross to MSW) is not automated yet."
echo "Run scripts/build-gui-windows.sh on Windows (msys2 mingw64 + rust),"
echo "or use CI with a Windows runner."
exit 1
fi
cd "$(dirname -- "$0")/.."
cargo build --release -p alkane-gui
echo "binary: target/release/alkane-toolkit.exe"
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Build the vendored wxWidgets 3.3.3 (GTK3, static, monolithic) out-of-tree.
# The repo's vendor tree stays pristine; the build lives in ~/.cache/wxbuild.
set -e
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
SRC="$REPO/thirdparty/wxwidgets/wxWidgets-3.3.3"
BUILD="$HOME/.cache/wxbuild/wxWidgets-3.3.3"
PREFIX="$HOME/.cache/wx-3.3.3-linux"
[ -d "$BUILD" ] || { mkdir -p "$HOME/.cache/wxbuild"; cp -r "$SRC" "$BUILD"; }
[ -d "$BUILD" ] || { echo "thirdparty wxWidgets tree missing"; exit 1; }
chmod +x "$BUILD/configure" "$BUILD/config.guess" "$BUILD/config.sub" "$BUILD/install-sh" 2>/dev/null || true
cd "$BUILD" 2>/dev/null || exit 1
mkdir -p "$BUILD/build-linux"
cd "$BUILD/build-linux"
sh ../configure --prefix="$PREFIX" --disable-shared --enable-monolithic \
--with-gtk=3 --with-opengl=no --disable-stc --disable-tests
make -j"$(nproc)"
make install
echo "installed: $PREFIX/lib/libwx_gtk3u-3.3.a"
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
# Off-screen screenshot of the running UI, for visual review.
#
# Runs alkane-toolkit under a private Xvfb display (never the real desktop),
# waits for its window to map, and captures it to a PNG. By default it renders
# the offline bench-fleet fixtures (ALKANE_FAKE_SCAN) so the shot is
# deterministic and needs no hardware; pass --live to scan the real network.
#
# Usage: scripts/ui-screenshot.sh [out.png] [--live] [binary]
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}"
OUT="${1:-alkane-toolkit.png}"
LIVE=0; BIN=""
shift 2>/dev/null || true
for a in "$@"; do
case "$a" in
--live) LIVE=1 ;;
*) BIN="$a" ;;
esac
done
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
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"
FAKE_ENV="ALKANE_FAKE_SCAN=1"
[ "$LIVE" = "1" ] && FAKE_ENV=""
Xvfb "$DISP" -screen 0 1280x850x24 -nolisten tcp >/dev/null 2>&1 &
XPID=$!
sleep 1.2
# warm the font/GTK caches so the first window map is not stalled
DISPLAY="$DISP" xclock >/dev/null 2>&1 & WARM=$!; sleep 1.2; kill "$WARM" 2>/dev/null
# shellcheck disable=SC2086
DISPLAY="$DISP" GDK_BACKEND=x11 $FAKE_ENV "$BIN" >/dev/null 2>&1 &
APID=$!
WID=""; t=0
while [ "$t" -lt 25 ]; do
sleep 1; t=$((t+1))
kill -0 "$APID" 2>/dev/null || { echo "app exited early" >&2; break; }
line=$(DISPLAY="$DISP" xwininfo -root -tree 2>/dev/null | grep '"alkane-toolkit"' | grep -E '1[0-9]{3}x[0-9]{3}' | head -1)
[ -n "$line" ] && { WID=$(echo "$line" | awk '{print $1}'); break; }
done
sleep 2 # let it paint and drain a scan tick
if [ -n "$WID" ]; then
DISPLAY="$DISP" import -window "$WID" "$OUT" && echo "wrote $OUT (window $WID, ${t}s)"
else
DISPLAY="$DISP" import -window root "$OUT"; echo "no app window; captured root -> $OUT" >&2
fi
kill "$APID" 2>/dev/null
kill "$XPID" 2>/dev/null
+39
View File
@@ -0,0 +1,39 @@
#!/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"
+8
View File
@@ -0,0 +1,8 @@
upstream: wx-rs (AlexCharlton/wx-rs)
version: 0.2.0 (crates.io tarball, == master d420e30)
source_url: https://static.crates.io/crates/wx-rs/wx-rs-0.2.0.crate
sha256: b70620dba2997db6640794ef43fa130d19b9a2ec1ab93925450a5b8334d99e33
state: patched tree is the used crate (path dep from crates/alkane-gui).
Upstream stubs non-Windows/macOS and has no widget surface; patches add
the Linux/GTK3 wx-config build path and the widget bridge (see patches/).
Update flow: unpack new upstream here, re-apply patches/, resolve, commit.
+113
View File
@@ -0,0 +1,113 @@
--- a/build.rs
+++ b/build.rs
@@ -24,8 +24,14 @@
cfg!(target_os = "macos")
}
+// alkane-toolkit patch: real wxGTK3 support on Linux via wx-config
+// (upstream stubbed every non-Windows/macOS target).
+fn is_linux() -> bool {
+ cfg!(target_os = "linux")
+}
+
fn is_stub() -> bool {
- cfg!(feature = "stub_lib") || (!is_windows() && !is_osx())
+ cfg!(feature = "stub_lib") || (!is_windows() && !is_osx() && !is_linux())
}
fn main() -> Result<(), Box<dyn Error>> {
@@ -35,6 +41,9 @@
if is_stub() {
return Ok(());
}
+ if is_linux() {
+ return Ok(()); // libs are linked inside build_linux()
+ }
let wx_libs = get_libs(&wx_path)?;
@@ -80,7 +89,7 @@
fn download_dist() -> Result<PathBuf, Box<dyn Error>> {
let dist_path = Path::new("./dist/");
let wx_path = PathBuf::from(format!("./dist/{}", WX_PATH));
- if wx_path.exists() || is_stub() {
+ if wx_path.exists() || is_stub() || is_linux() {
return Ok(wx_path);
}
println!("cargo:warning=wx-rs: Downloading source to './dist/");
@@ -107,8 +116,14 @@
return Ok(());
}
println!("cargo:rerun-if-changed=cpp_src/wxbridge.cpp");
+ println!("cargo:rerun-if-changed=cpp_src/widgets_bridge.cpp");
+
+ // alkane-toolkit patch: compile the bridge (upstream + widgets extension)
+ // against the wx shown by $WX_RS_WXCONFIG (default `wx-config`).
+ if is_linux() {
+ return build_linux();
+ }
- //panic!("{}", wx_path.to_str().unwrap());
if is_windows() {
build_msvc(wx_path)?;
} else {
@@ -217,6 +232,59 @@
)?)
}
+fn build_linux() -> Result<(), Box<dyn Error>> {
+ // alkane-toolkit patch: GTK3 build driven entirely by wx-config, so the
+ // same code builds against our vendored static wx 3.3.3 (WX_RS_WXCONFIG
+ // pointing at its prefix) or any system wxGTK3.
+ let wxconfig = env::var("WX_RS_WXCONFIG").unwrap_or_else(|_| String::from("wx-config"));
+ let cxxflags = String::from_utf8(
+ Command::new(&wxconfig).arg("--cxxflags").output()?.stdout,
+ )?;
+ let libs = String::from_utf8(Command::new(&wxconfig).arg("--libs").output()?.stdout)?;
+ // The widget bridge uses GTK directly (zebra-striping CSS), so add GTK's own
+ // include paths. Best-effort: if pkg-config or gtk3-dev is missing the flags
+ // are simply empty and the GTK-only code stays disabled.
+ let gtk_cflags = Command::new("pkg-config")
+ .args(["--cflags", "gtk+-3.0"])
+ .output()
+ .ok()
+ .filter(|o| o.status.success())
+ .and_then(|o| String::from_utf8(o.stdout).ok())
+ .unwrap_or_default();
+
+ let mut build = cc::Build::new();
+ build.cpp(true)
+ .file("cpp_src/wxbridge.cpp")
+ .file("cpp_src/widgets_bridge.cpp");
+ for f in cxxflags.split_whitespace() {
+ build.flag(f);
+ }
+ for f in gtk_cflags.split_whitespace() {
+ build.flag(f);
+ }
+ build.compile("wxbridge");
+
+ for flag in libs.split_whitespace() {
+ if flag.starts_with('/') && flag.ends_with(".a") {
+ // static wx builds: wx-config emits the archive as a full path
+ let file = flag.rsplit('/').next().unwrap_or(flag);
+ let stem = file
+ .strip_prefix("lib")
+ .unwrap_or(file)
+ .strip_suffix(".a")
+ .unwrap_or(file);
+ println!("cargo:rustc-link-lib=static={}", stem);
+ } else if let Some(lib) = flag.strip_prefix("-l") {
+ println!("cargo:rustc-link-lib={}", lib);
+ } else if let Some(path) = flag.strip_prefix("-L") {
+ println!("cargo:rustc-link-search=native={}", path);
+ } else if flag == "-pthread" {
+ println!("cargo:rustc-link-arg=-pthread");
+ }
+ }
+ Ok(())
+}
+
fn embed_resource_file(wx_path: &PathBuf) {
/*
This was cribbed from https://github.com/nabijaczleweli/rust-embed-resource
+574
View File
@@ -0,0 +1,574 @@
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,3 +3,7 @@
mod menu;
pub use menu::*;
+
+// alkane-toolkit patch: widget bridge (see cpp_src/widgets_bridge.cpp)
+mod widgets;
+pub use widgets::*;
--- a/src/widgets.rs
+++ b/src/widgets.rs
@@ -0,0 +1,561 @@
+// widgets.rs — alkane-toolkit extension: Rust bindings for the widget bridge
+// in cpp_src/widgets_bridge.cpp. Handles are opaque pointers owned by the
+// wxWidgets object tree (parents own children; nothing to free in Rust).
+// All functions must be called from the main thread while the wx event loop
+// is (or will be) running.
+
+use std::ffi::CString;
+use std::os::raw::{c_char, c_int, c_long, c_void};
+
+mod notsafe {
+ use std::os::raw::{c_char, c_int, c_long, c_void};
+
+ extern "C" {
+ pub fn wxbr_set_widget_event_fn(f: extern "C" fn(c_int, c_long, c_long));
+ pub fn wxbr_main_frame() -> *mut c_void;
+ pub fn wxbr_panel(parent: *mut c_void) -> *mut c_void;
+ pub fn wxbr_box_sizer(vertical: c_int) -> *mut c_void;
+ pub fn wxbr_sizer_add(sizer: *mut c_void, win: *mut c_void, proportion: c_int, flags: c_int, border: c_int);
+ pub fn wxbr_sizer_add_sizer(sizer: *mut c_void, subsizer: *mut c_void, proportion: c_int, flags: c_int, border: c_int);
+ pub fn wxbr_sizer_add_spacer(sizer: *mut c_void, px: c_int);
+ pub fn wxbr_sizer_add_stretch(sizer: *mut c_void, proportion: c_int);
+ pub fn wxbr_set_sizer(win: *mut c_void, sizer: *mut c_void);
+ pub fn wxbr_layout(win: *mut c_void);
+ pub fn wxbr_sizer_detach(sizer: *mut c_void, win: *mut c_void);
+ pub fn wxbr_fit(win: *mut c_void);
+ pub fn wxbr_set_min_size(win: *mut c_void, w: c_int, h: c_int);
+ pub fn wxbr_static_text(parent: *mut c_void, label: *const c_char) -> *mut c_void;
+ pub fn wxbr_set_label(win: *mut c_void, label: *const c_char);
+ pub fn wxbr_get_label(win: *mut c_void, buf: *mut c_char, cap: c_int) -> c_int;
+ pub fn wxbr_set_bold(win: *mut c_void);
+ pub fn wxbr_set_font_size(win: *mut c_void, pts: c_int);
+ pub fn wxbr_button(parent: *mut c_void, label: *const c_char, id: c_int) -> *mut c_void;
+ pub fn wxbr_text_ctrl(parent: *mut c_void, multiline: c_int) -> *mut c_void;
+ pub fn wxbr_text_ctrl_get(win: *mut c_void, buf: *mut c_char, cap: c_int) -> c_int;
+ pub fn wxbr_text_ctrl_set(win: *mut c_void, value: *const c_char);
+ pub fn wxbr_check_box(parent: *mut c_void, label: *const c_char) -> *mut c_void;
+ pub fn wxbr_check_box_get(win: *mut c_void) -> c_int;
+ pub fn wxbr_check_box_set(win: *mut c_void, v: c_int);
+ pub fn wxbr_check_list_box(parent: *mut c_void) -> *mut c_void;
+ pub fn wxbr_clb_append(win: *mut c_void, label: *const c_char);
+ pub fn wxbr_clb_clear(win: *mut c_void);
+ pub fn wxbr_clb_count(win: *mut c_void) -> c_int;
+ pub fn wxbr_clb_checked(win: *mut c_void, i: c_int) -> c_int;
+ pub fn wxbr_clb_set_checked(win: *mut c_void, i: c_int, v: c_int);
+ pub fn wxbr_clb_string(win: *mut c_void, i: c_int, buf: *mut c_char, cap: c_int) -> c_int;
+ pub fn wxbr_dialog(parent: *mut c_void, title: *const c_char) -> *mut c_void;
+ pub fn wxbr_dialog_show_modal(win: *mut c_void) -> c_int;
+ pub fn wxbr_dialog_close(win: *mut c_void, code: c_int);
+ pub fn wxbr_dvlc(parent: *mut c_void) -> *mut c_void;
+ pub fn wxbr_dvlc_append_text_col(win: *mut c_void, title: *const c_char, width: c_int, reorderable: c_int);
+ pub fn wxbr_dvlc_append_toggle_col(win: *mut c_void, width: c_int);
+ pub fn wxbr_dvlc_append_row(win: *mut c_void, nvals: c_int, vals: *const *const c_char);
+ pub fn wxbr_dvlc_delete_row(win: *mut c_void, row: usize);
+ pub fn wxbr_dvlc_clear(win: *mut c_void);
+ pub fn wxbr_dvlc_row_count(win: *mut c_void) -> c_int;
+ pub fn wxbr_dvlc_set_cell(win: *mut c_void, row: usize, col: usize, value: *const c_char);
+ pub fn wxbr_dvlc_get_cell(win: *mut c_void, row: usize, col: usize, buf: *mut c_char, cap: c_int) -> c_int;
+ pub fn wxbr_dvlc_col_count(win: *mut c_void) -> c_int;
+ pub fn wxbr_dvlc_set_col_title(win: *mut c_void, col: c_int, title: *const c_char);
+ pub fn wxbr_dvlc_set_sort_indicator(win: *mut c_void, col: c_int, active: c_int, ascending: c_int);
+ pub fn wxbr_dvlc_col_at_pos(win: *mut c_void, pos: c_int) -> c_int;
+ pub fn wxbr_dvlc_selected_row(win: *mut c_void) -> c_long;
+ pub fn wxbr_dvlc_select_row(win: *mut c_void, row: c_long);
+ pub fn wxbr_dvlc_get_selections(win: *mut c_void, buf: *mut c_int, cap: c_int) -> c_int;
+ pub fn wxbr_dvlc_select_rows(win: *mut c_void, rows: *const c_int, n: c_int);
+ pub fn wxbr_dvlc_set_alt_row_color(win: *mut c_void, r: c_int, g: c_int, b: c_int);
+ pub fn wxbr_apply_zebra_css(r: c_int, g: c_int, b: c_int);
+ pub fn wxbr_rearrange_list(parent: *mut c_void, n: c_int, order: *const c_int, items: *const *const c_char) -> *mut c_void;
+ pub fn wxbr_rearrange_get_order(win: *mut c_void, buf: *mut c_int, cap: c_int) -> c_int;
+ pub fn wxbr_menu_new() -> *mut c_void;
+ pub fn wxbr_menu_append(menu: *mut c_void, id: c_int, label: *const c_char);
+ pub fn wxbr_menu_append_separator(menu: *mut c_void);
+ pub fn wxbr_popup_menu(win: *mut c_void, menu: *mut c_void);
+ pub fn wxbr_timer(id: c_int, ms: c_int) -> *mut c_void;
+ pub fn wxbr_gauge(parent: *mut c_void, range: c_int) -> *mut c_void;
+ pub fn wxbr_gauge_set_range(win: *mut c_void, range: c_int);
+ pub fn wxbr_gauge_set_value(win: *mut c_void, value: c_int);
+ pub fn wxbr_gauge_pulse(win: *mut c_void);
+ pub fn wxbr_show(win: *mut c_void, shown: c_int);
+ pub fn wxbr_launch_browser(url: *const c_char) -> c_int;
+ pub fn wxbr_set_appearance_system();
+ pub fn wxbr_is_dark() -> c_int;
+ pub fn wxbr_system_color(which: c_int, r: *mut u8, g: *mut u8, b: *mut u8);
+ pub fn wxbr_set_bg(win: *mut c_void, r: c_int, g: c_int, b: c_int);
+ pub fn wxbr_set_fg(win: *mut c_void, r: c_int, g: c_int, b: c_int);
+ pub fn wxbr_destroy(win: *mut c_void);
+ }
+}
+
+/// Opaque handle to a wxWidgets window/sizer/control.
+#[derive(Clone, Copy, Debug)]
+pub struct Widget(pub(crate) *mut c_void);
+
+/// Sizer flags understood by the bridge (see widgets_bridge.cpp).
+pub mod sizer_flags {
+ pub const EXPAND: i32 = 1;
+ pub const ALIGN_CENTRE_VERTICAL: i32 = 2;
+ pub const BORDER_ALL: i32 = 4;
+ pub const BORDER_TOP: i32 = 8;
+ pub const BORDER_BOTTOM: i32 = 16;
+ pub const BORDER_LEFT: i32 = 32;
+ pub const BORDER_RIGHT: i32 = 64;
+}
+
+/// Widget event kinds delivered to the handler set by `set_event_handler`.
+/// Values match WxWidgetEventKind in widgets_bridge.cpp.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum WxEventKind {
+ ButtonClicked,
+ ClbToggled,
+ DvlcValueChanged,
+ DvlcHeaderClick,
+ DvlcReordered,
+ TimerTick,
+ DvlcActivated,
+ DvlcSelectionChanged,
+ DvlcContextMenu,
+ MenuItem,
+}
+
+impl WxEventKind {
+ fn from_raw(k: i32) -> Option<Self> {
+ Some(match k {
+ 1 => WxEventKind::ButtonClicked,
+ 3 => WxEventKind::ClbToggled,
+ 4 => WxEventKind::DvlcValueChanged,
+ 5 => WxEventKind::DvlcHeaderClick,
+ 6 => WxEventKind::DvlcReordered,
+ 7 => WxEventKind::TimerTick,
+ 8 => WxEventKind::DvlcActivated,
+ 9 => WxEventKind::DvlcSelectionChanged,
+ 10 => WxEventKind::DvlcContextMenu,
+ 11 => WxEventKind::MenuItem,
+ _ => return None,
+ })
+ }
+}
+
+/// Apply app-wide zebra striping to tree/list views (GTK CSS; no-op elsewhere).
+pub fn apply_zebra_css(r: u8, g: u8, b: u8) {
+ unsafe { notsafe::wxbr_apply_zebra_css(r as c_int, g as c_int, b as c_int) }
+}
+
+/// Open a URL in the system default browser. Returns true on success.
+pub fn launch_browser(url: &str) -> bool {
+ let c = CString::new(url).unwrap_or_default();
+ unsafe { notsafe::wxbr_launch_browser(c.as_ptr()) != 0 }
+}
+
+/// Ask wx to follow the system light/dark appearance (no-op before 3.3).
+pub fn set_appearance_system() {
+ unsafe { notsafe::wxbr_set_appearance_system() }
+}
+
+/// True if the current system appearance is dark.
+pub fn is_dark() -> bool {
+ unsafe { notsafe::wxbr_is_dark() != 0 }
+}
+
+/// A theme colour. `which`: 0=window bg, 1=window text, 2=highlight,
+/// 3=button face, 4=grey text. Returns (r, g, b).
+pub fn system_color(which: i32) -> (u8, u8, u8) {
+ let (mut r, mut g, mut b) = (0u8, 0u8, 0u8);
+ unsafe { notsafe::wxbr_system_color(which, &mut r, &mut g, &mut b) }
+ (r, g, b)
+}
+
+/// A widget event: kind plus two payload words.
+/// ButtonClicked: p1 = button id.
+/// ClbToggled: p1 = control handle, p2 = item index.
+/// DvlcValueChanged: p1 = row, p2 = column.
+/// DvlcHeaderClick: p1 = column.
+/// DvlcReordered: (re-read the column order afterwards).
+/// TimerTick: p1 = timer id.
+#[derive(Debug, Clone, Copy)]
+pub struct WxEvent {
+ pub kind: WxEventKind,
+ pub p1: i64,
+ pub p2: i64,
+}
+
+type Handler = fn(WxEvent);
+
+thread_local! {
+ static HANDLER: std::cell::RefCell<Option<Handler>> = const { std::cell::RefCell::new(None) };
+}
+
+extern "C" fn event_trampoline(kind: c_int, p1: c_long, p2: c_long) {
+ let Some(kind) = WxEventKind::from_raw(kind) else { return };
+ let ev = WxEvent { kind, p1: p1 as i64, p2: p2 as i64 };
+ HANDLER.with(|h| {
+ if let Some(f) = h.borrow().as_ref() {
+ f(ev);
+ }
+ });
+}
+
+/// Install the single widget-event handler (call once, before run_app).
+pub fn set_event_handler(f: Handler) {
+ HANDLER.with(|h| *h.borrow_mut() = Some(f));
+ unsafe {
+ notsafe::wxbr_set_widget_event_fn(event_trampoline);
+ }
+}
+
+impl Widget {
+ pub fn main_frame() -> Widget {
+ Widget(unsafe { notsafe::wxbr_main_frame() })
+ }
+
+ pub fn panel(parent: Widget) -> Widget {
+ Widget(unsafe { notsafe::wxbr_panel(parent.0) })
+ }
+
+ pub fn box_sizer(vertical: bool) -> Widget {
+ Widget(unsafe { notsafe::wxbr_box_sizer(vertical as c_int) })
+ }
+
+ pub fn add(&self, win: Widget, proportion: i32, flags: i32, border: i32) {
+ unsafe { notsafe::wxbr_sizer_add(self.0, win.0, proportion, flags, border) }
+ }
+
+ /// Add a child SIZER (not a window) to this sizer.
+ pub fn add_sizer(&self, sizer: Widget, proportion: i32, flags: i32, border: i32) {
+ unsafe { notsafe::wxbr_sizer_add_sizer(self.0, sizer.0, proportion, flags, border) }
+ }
+
+ pub fn add_spacer(&self, px: i32) {
+ unsafe { notsafe::wxbr_sizer_add_spacer(self.0, px) }
+ }
+
+ pub fn add_stretch(&self, proportion: i32) {
+ unsafe { notsafe::wxbr_sizer_add_stretch(self.0, proportion) }
+ }
+
+ pub fn set_sizer_on(&self, win: Widget) {
+ unsafe { notsafe::wxbr_set_sizer(win.0, self.0) }
+ }
+
+ /// Re-run this window's sizer (self = a window). Call after adding a child
+ /// window to an already-installed sizer, or after rebuilding the table.
+ pub fn layout(&self) {
+ unsafe { notsafe::wxbr_layout(self.0) }
+ }
+
+ /// Detach a child window from this sizer (self = a sizer) without
+ /// destroying it. Use before destroying a sizer-managed window.
+ pub fn detach(&self, win: Widget) {
+ unsafe { notsafe::wxbr_sizer_detach(self.0, win.0) }
+ }
+
+ pub fn fit(&self, win: Widget) {
+ unsafe { notsafe::wxbr_fit(win.0) }
+ }
+
+ pub fn set_min_size(&self, w: i32, h: i32) {
+ unsafe { notsafe::wxbr_set_min_size(self.0, w, h) }
+ }
+
+ pub fn static_text(parent: Widget, label: &str) -> Widget {
+ let c = CString::new(label).unwrap_or_default();
+ Widget(unsafe { notsafe::wxbr_static_text(parent.0, c.as_ptr()) })
+ }
+
+ pub fn set_label(&self, label: &str) {
+ let c = CString::new(label).unwrap_or_default();
+ unsafe { notsafe::wxbr_set_label(self.0, c.as_ptr()) }
+ }
+
+ /// Read back a control's current label text (self-test uses this to verify
+ /// what a KPI actually displays).
+ pub fn get_label(&self) -> String {
+ let mut buf = vec![0i8; 4096];
+ let n = unsafe { notsafe::wxbr_get_label(self.0, buf.as_mut_ptr(), buf.len() as c_int) };
+ if n <= 0 {
+ return String::new();
+ }
+ let bytes: Vec<u8> = buf[..(n - 1) as usize].iter().map(|&b| b as u8).collect();
+ String::from_utf8_lossy(&bytes).into_owned()
+ }
+
+ pub fn set_bold(&self) {
+ unsafe { notsafe::wxbr_set_bold(self.0) }
+ }
+
+ pub fn set_font_size(&self, pts: i32) {
+ unsafe { notsafe::wxbr_set_font_size(self.0, pts) }
+ }
+
+ pub fn button(parent: Widget, label: &str, id: i32) -> Widget {
+ let c = CString::new(label).unwrap_or_default();
+ Widget(unsafe { notsafe::wxbr_button(parent.0, c.as_ptr(), id) })
+ }
+
+ pub fn text_ctrl(parent: Widget, multiline: bool) -> Widget {
+ Widget(unsafe { notsafe::wxbr_text_ctrl(parent.0, multiline as c_int) })
+ }
+
+ pub fn get_value(&self) -> String {
+ let mut buf = vec![0i8; 65536];
+ let n = unsafe { notsafe::wxbr_text_ctrl_get(self.0, buf.as_mut_ptr(), buf.len() as c_int) };
+ let n = n.max(1) as usize;
+ let bytes: Vec<u8> = buf[..n - 1].iter().map(|&b| b as u8).collect();
+ String::from_utf8_lossy(&bytes).into_owned()
+ }
+
+ pub fn set_value(&self, value: &str) {
+ let c = CString::new(value).unwrap_or_default();
+ unsafe { notsafe::wxbr_text_ctrl_set(self.0, c.as_ptr()) }
+ }
+
+ pub fn check_box(parent: Widget, label: &str) -> Widget {
+ let c = CString::new(label).unwrap_or_default();
+ Widget(unsafe { notsafe::wxbr_check_box(parent.0, c.as_ptr()) })
+ }
+
+ pub fn is_checked(&self) -> bool {
+ unsafe { notsafe::wxbr_check_box_get(self.0) != 0 }
+ }
+
+ pub fn set_checked(&self, v: bool) {
+ unsafe { notsafe::wxbr_check_box_set(self.0, v as c_int) }
+ }
+
+ pub fn check_list_box(parent: Widget) -> Widget {
+ Widget(unsafe { notsafe::wxbr_check_list_box(parent.0) })
+ }
+
+ pub fn clb_append(&self, label: &str) {
+ let c = CString::new(label).unwrap_or_default();
+ unsafe { notsafe::wxbr_clb_append(self.0, c.as_ptr()) }
+ }
+
+ pub fn clb_clear(&self) {
+ unsafe { notsafe::wxbr_clb_clear(self.0) }
+ }
+
+ pub fn clb_count(&self) -> usize {
+ unsafe { notsafe::wxbr_clb_count(self.0).max(0) as usize }
+ }
+
+ pub fn clb_checked(&self, i: usize) -> bool {
+ unsafe { notsafe::wxbr_clb_checked(self.0, i as c_int) != 0 }
+ }
+
+ pub fn clb_set_checked(&self, i: usize, v: bool) {
+ unsafe { notsafe::wxbr_clb_set_checked(self.0, i as c_int, v as c_int) }
+ }
+
+ pub fn clb_string(&self, i: usize) -> Option<String> {
+ let mut buf = vec![0i8; 4096];
+ let n = unsafe { notsafe::wxbr_clb_string(self.0, i as c_int, buf.as_mut_ptr(), buf.len() as c_int) };
+ if n <= 0 {
+ return None;
+ }
+ let bytes: Vec<u8> = buf[..(n - 1) as usize].iter().map(|&b| b as u8).collect();
+ Some(String::from_utf8_lossy(&bytes).into_owned())
+ }
+
+ pub fn dialog(parent: Widget, title: &str) -> Widget {
+ let c = CString::new(title).unwrap_or_default();
+ Widget(unsafe { notsafe::wxbr_dialog(parent.0, c.as_ptr()) })
+ }
+
+ /// Blocks in a nested event loop until the dialog is dismissed.
+ pub fn show_modal(&self) -> i32 {
+ unsafe { notsafe::wxbr_dialog_show_modal(self.0) }
+ }
+
+ pub fn close(&self, code: i32) {
+ unsafe { notsafe::wxbr_dialog_close(self.0, code) }
+ }
+
+ // ---- data view list ctrl ----
+
+ pub fn dvlc(parent: Widget) -> Widget {
+ Widget(unsafe { notsafe::wxbr_dvlc(parent.0) })
+ }
+
+ pub fn dvlc_append_text_col(&self, title: &str, width: i32, reorderable: bool) {
+ let c = CString::new(title).unwrap_or_default();
+ unsafe { notsafe::wxbr_dvlc_append_text_col(self.0, c.as_ptr(), width, reorderable as c_int) }
+ }
+
+ pub fn dvlc_append_toggle_col(&self, width: i32) {
+ unsafe { notsafe::wxbr_dvlc_append_toggle_col(self.0, width) }
+ }
+
+ pub fn dvlc_append_row(&self, values: &[&str]) {
+ let cvals: Vec<CString> = values.iter().map(|v| CString::new(*v).unwrap_or_default()).collect();
+ let ptrs: Vec<*const c_char> = cvals.iter().map(|c| c.as_ptr()).collect();
+ unsafe { notsafe::wxbr_dvlc_append_row(self.0, ptrs.len() as c_int, ptrs.as_ptr()) }
+ }
+
+ pub fn dvlc_delete_row(&self, row: usize) {
+ unsafe { notsafe::wxbr_dvlc_delete_row(self.0, row) }
+ }
+
+ pub fn dvlc_clear(&self) {
+ unsafe { notsafe::wxbr_dvlc_clear(self.0) }
+ }
+
+ pub fn dvlc_row_count(&self) -> usize {
+ unsafe { notsafe::wxbr_dvlc_row_count(self.0).max(0) as usize }
+ }
+
+ pub fn dvlc_set_cell(&self, row: usize, col: usize, value: &str) {
+ let c = CString::new(value).unwrap_or_default();
+ unsafe { notsafe::wxbr_dvlc_set_cell(self.0, row, col, c.as_ptr()) }
+ }
+
+ pub fn dvlc_get_cell(&self, row: usize, col: usize) -> Option<String> {
+ let mut buf = vec![0i8; 4096];
+ let n = unsafe {
+ notsafe::wxbr_dvlc_get_cell(self.0, row, col, buf.as_mut_ptr(), buf.len() as c_int)
+ };
+ if n <= 0 {
+ return None;
+ }
+ let bytes: Vec<u8> = buf[..(n - 1) as usize].iter().map(|&b| b as u8).collect();
+ Some(String::from_utf8_lossy(&bytes).into_owned())
+ }
+
+ pub fn dvlc_col_count(&self) -> usize {
+ unsafe { notsafe::wxbr_dvlc_col_count(self.0).max(0) as usize }
+ }
+
+ /// Model column index shown at display position `pos` (after drag reorder).
+ pub fn dvlc_col_at_pos(&self, pos: usize) -> Option<usize> {
+ let v = unsafe { notsafe::wxbr_dvlc_col_at_pos(self.0, pos as c_int) };
+ if v < 0 { None } else { Some(v as usize) }
+ }
+
+ pub fn dvlc_selected_row(&self) -> Option<usize> {
+ let v = unsafe { notsafe::wxbr_dvlc_selected_row(self.0) };
+ if v < 0 { None } else { Some(v as usize) }
+ }
+
+ pub fn dvlc_select_row(&self, row: usize) {
+ unsafe { notsafe::wxbr_dvlc_select_row(self.0, row as c_long) }
+ }
+
+ /// The selected row indices (multi-select).
+ pub fn dvlc_get_selections(&self) -> Vec<usize> {
+ let mut buf = vec![0i32; 8192];
+ let n = unsafe {
+ notsafe::wxbr_dvlc_get_selections(self.0, buf.as_mut_ptr(), buf.len() as c_int)
+ };
+ buf.into_iter().take(n.max(0) as usize).map(|v| v as usize).collect()
+ }
+
+ /// Replace the selection with the given row indices.
+ pub fn dvlc_select_rows(&self, rows: &[usize]) {
+ let v: Vec<c_int> = rows.iter().map(|&r| r as c_int).collect();
+ unsafe { notsafe::wxbr_dvlc_select_rows(self.0, v.as_ptr(), v.len() as c_int) }
+ }
+
+ pub fn dvlc_set_alt_row_color(&self, r: u8, g: u8, b: u8) {
+ unsafe { notsafe::wxbr_dvlc_set_alt_row_color(self.0, r as c_int, g as c_int, b as c_int) }
+ }
+
+ // ---- rearrangeable check-list ----
+
+ /// Create a rearrangeable checklist. `order` uses wx encoding: a value `v`
+ /// >= 0 is item `v` (checked); `!v` (negative) is item `v` unchecked.
+ pub fn rearrange_list(parent: Widget, order: &[i32], items: &[&str]) -> Widget {
+ let cs: Vec<CString> = items.iter().map(|s| CString::new(*s).unwrap_or_default()).collect();
+ let ptrs: Vec<*const c_char> = cs.iter().map(|c| c.as_ptr()).collect();
+ Widget(unsafe {
+ notsafe::wxbr_rearrange_list(parent.0, items.len() as c_int, order.as_ptr(), ptrs.as_ptr())
+ })
+ }
+
+ /// Read back the current order (same wx encoding as `rearrange_list`).
+ pub fn rearrange_get_order(&self) -> Vec<i32> {
+ let mut buf = vec![0i32; 4096];
+ let n = unsafe {
+ notsafe::wxbr_rearrange_get_order(self.0, buf.as_mut_ptr(), buf.len() as c_int)
+ };
+ buf.into_iter().take(n.max(0) as usize).collect()
+ }
+
+ // ---- popup menu ----
+
+ pub fn menu_new() -> Widget {
+ Widget(unsafe { notsafe::wxbr_menu_new() })
+ }
+
+ pub fn menu_append(&self, id: i32, label: &str) {
+ let c = CString::new(label).unwrap_or_default();
+ unsafe { notsafe::wxbr_menu_append(self.0, id, c.as_ptr()) }
+ }
+
+ pub fn menu_append_separator(&self) {
+ unsafe { notsafe::wxbr_menu_append_separator(self.0) }
+ }
+
+ /// Show `menu` as a popup on this window; blocks until dismissed.
+ pub fn popup_menu(&self, menu: Widget) {
+ unsafe { notsafe::wxbr_popup_menu(self.0, menu.0) }
+ }
+
+ /// Update a column's header text in place (creation index).
+ pub fn dvlc_set_col_title(&self, col: usize, title: &str) {
+ let c = CString::new(title).unwrap_or_default();
+ unsafe { notsafe::wxbr_dvlc_set_col_title(self.0, col as c_int, c.as_ptr()) }
+ }
+
+ /// Show or clear the native sort arrow on a column (creation index).
+ pub fn dvlc_set_sort_indicator(&self, col: usize, active: bool, ascending: bool) {
+ unsafe {
+ notsafe::wxbr_dvlc_set_sort_indicator(
+ self.0,
+ col as c_int,
+ active as c_int,
+ ascending as c_int,
+ )
+ }
+ }
+
+ pub fn timer(id: i32, ms: i32) -> Widget {
+ Widget(unsafe { notsafe::wxbr_timer(id, ms) })
+ }
+
+ // ---- gauge (progress bar) ----
+
+ pub fn gauge(parent: Widget, range: i32) -> Widget {
+ Widget(unsafe { notsafe::wxbr_gauge(parent.0, range) })
+ }
+
+ pub fn gauge_set_range(&self, range: i32) {
+ unsafe { notsafe::wxbr_gauge_set_range(self.0, range) }
+ }
+
+ pub fn gauge_set_value(&self, value: i32) {
+ unsafe { notsafe::wxbr_gauge_set_value(self.0, value) }
+ }
+
+ pub fn gauge_pulse(&self) {
+ unsafe { notsafe::wxbr_gauge_pulse(self.0) }
+ }
+
+ /// Show or hide this window.
+ pub fn show(&self, shown: bool) {
+ unsafe { notsafe::wxbr_show(self.0, shown as c_int) }
+ }
+
+ pub fn set_bg(&self, r: u8, g: u8, b: u8) {
+ unsafe { notsafe::wxbr_set_bg(self.0, r as c_int, g as c_int, b as c_int) }
+ }
+
+ pub fn set_fg(&self, r: u8, g: u8, b: u8) {
+ unsafe { notsafe::wxbr_set_fg(self.0, r as c_int, g as c_int, b as c_int) }
+ }
+
+ /// Deferred destruction (safe from event handlers); used to rebuild
+ /// the table when its column set changes.
+ pub fn destroy(&self) {
+ unsafe { notsafe::wxbr_destroy(self.0) }
+ }
+}

Some files were not shown because too many files have changed in this diff Show More