build-test-release / release (push) Failing after 10m13s
Large round implemented via a research workflow (6 parallel readers) then a file-partitioned implementation workflow (model/scan/bridge/ui/fixtures), all to one shared contract. Table / model: - Offline recognition fix: the scan loop now emits a row for EVERY probed IP - non-responders become an "offline" row (new MinerRow.online flag + MinerRow::offline()), so unreachable miners show up (offline, red) instead of vanishing. Previously only responders got a row. - Not-hashing rows are now RED (were grey); offline also red. - New "paused" status (operating_state contains "pause" while not mining): its own blue row colour, a blue "Paused" KPI card, and a Kpis.paused count. - Combined actual/expected columns: Hashrate, Hashboards and TotalChips fold their separate Expected* columns into one "actual / expected" cell; the actual is drawn on a smooth red->amber->green scale by ratio (100% = green), the expected in plain text, the slash black. num_value is carved out so a numeric filter never matches a row that only has an expected value. - Fan column shows every fan's RPM as "rpm/rpm/rpm" (max 3 sig digits, SI-style), each fan coloured on its own grey->blue speed scale, slashes black. - These four columns render via a new wxDataViewCustomRenderer (SegmentRenderer) that draws colour runs from a \x1f/\x1e-encoded value; every other column keeps the stock renderer and per-row status colour. Interaction: - KPI quick-filter: clicking the Hashing / Slow / Not hashing / Paused card filters the table to that status (composed with any column filters) and highlights the active card; clicking again clears it. - Removed "Select all" / "Clear selection" from the right-click menu. - Right-click "Refresh": re-polls the selected miners (asic-rs scan_miner) on a background thread and upserts the rows, without a full network scan. - "Set scan credentials..." button (top-right): stores a username/password (~/.config/alkane-toolkit/scan-credentials.txt, 0600) that is fanned out to every asic-rs firmware backend via with_firmware_discovery_auth, so scans and all right-click actions authenticate. Applied through a new credentials::configured_factory() used everywhere MinerFactory::new() was. - "Flash firmware..." (right-click): asic-rs UpgradeFirmware for the backends that support it (stock Antminer + EPIC; every other backend declines and is reported as unsupported). File picker (new wxFileDialog binding) + a typed "FLASH" confirmation; one miner at a time; cancel only between miners. - Responsive layout: the KPI and controls rows use wxWrapSizer so they reflow when narrow; the min window size drops from 1200x720 to 640x480. Bridge (wx-rs): SegmentRenderer + dvlc_append_colored_col, wrap_sizer, bind_click (clickable KPI cards), file_dialog; dropped a vestigial gtk.h include. Patches 0002/0003 regenerated + round-trip validated. Portability note: every widget is a stock, natively-backed wxWidgets control (ports to wxMSW/wxOSX); wxDataViewCtrl is native on Linux/macOS and wx's own generic (still-correct) drawing on Windows. Verified: cargo check --release --tests is clean; the release build + tests + headless self-test run in CI. (Local release link is OOM-blocked on this desktop; CI is the authoritative build.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
169 lines
8.2 KiB
Rust
169 lines
8.2 KiB
Rust
//! 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
|
|
//! MEMORY-SNAPSHOT), plus one synthetic unreachable IP rendered via
|
|
//! `MinerRow::offline()` so the "offline" status/row shape is exercisable
|
|
//! offline too (10 rows total). 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,
|
|
/// True for the bench board deliberately rebucketed into the "paused"
|
|
/// status/KPI bucket (not-mining but operator-paused, distinct from a
|
|
/// unit that is simply idle/not-hashing).
|
|
paused: 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)
|
|
};
|
|
let fan_rpms = if self.mining {
|
|
vec![self.fan, self.fan * 0.95, self.fan * 1.02]
|
|
} else {
|
|
vec![]
|
|
};
|
|
// Firmware-flash capability is modeled on the real Bitmain/Antminer
|
|
// upgrade path (S17/S19/S21 family); WhatsMiner boards in this fleet
|
|
// don't advertise it, so both true and false show up and the
|
|
// firmware menu item is testable.
|
|
let firmware_flash = self.model == "Antminer S17"
|
|
|| self.model.starts_with("Antminer S19")
|
|
|| self.model.starts_with("Antminer S21");
|
|
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_rpms,
|
|
worker: self.worker.to_string(),
|
|
is_mining: self.mining,
|
|
slow,
|
|
paused: self.paused,
|
|
online: true,
|
|
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.paused {
|
|
"paused".to_string()
|
|
} else if self.mining {
|
|
"mining".to_string()
|
|
} else {
|
|
"idle".to_string()
|
|
},
|
|
// Synthetic capabilities so the right-click config menu is
|
|
// exercisable offline: mining units support everything, idle ones
|
|
// only the fault light + restart (to show the capability intersection).
|
|
caps: crate::model::MinerCaps {
|
|
fault_light: true,
|
|
restart: true,
|
|
pause: self.mining,
|
|
resume: self.mining,
|
|
power_limit: self.mining,
|
|
tuning: self.mining,
|
|
firmware_flash,
|
|
},
|
|
..Default::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
/// The 9 bench boards plus one synthetic offline entry (10 rows total).
|
|
/// One is idle/not-hashing (S17 stock, .112); one is paused (WardenOS dev,
|
|
/// .115 - deliberately rebucketed from idle so the "paused" status/KPI
|
|
/// bucket is exercisable offline); one is slow (S21 Pro aml stock at ~30%
|
|
/// of expected); the other six hash normally; the last row is an
|
|
/// unreachable IP rendered via `MinerRow::offline()` (blank fields,
|
|
/// `online: false`).
|
|
///
|
|
/// Derived totals (used by the workflow tests):
|
|
/// total = 10, hashing = 6, slow = 1, not hashing = 1, paused = 1, offline = 1,
|
|
/// total hashrate = 685.0 TH/s, total power = 21300 W (offline row is all zero).
|
|
///
|
|
/// Note: `compute_kpis` has no separate "offline" bucket - an offline row is
|
|
/// `!is_mining && !paused && !slow`, so it folds into the "not hashing" KPI
|
|
/// alongside the idle S17, giving `Kpis.not_hashing == 2`. The per-row
|
|
/// `status()` text still distinguishes them ("not hashing" for .112 vs.
|
|
/// "offline" for .199).
|
|
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, paused: false },
|
|
Board { ip: "10.255.1.166", model: "Antminer S19", firmware: "OurOS 1.2",
|
|
hashrate: 95.0, expected: 96.0, power: 3250.0, temp: 65.0, fan: 4200.0,
|
|
worker: "blueflare.s19", mining: true, paused: false },
|
|
Board { ip: "10.255.1.152", model: "Antminer S19j Pro", firmware: "OurOS 1.2",
|
|
hashrate: 100.0, expected: 104.0, power: 3100.0, temp: 62.0, fan: 3900.0,
|
|
worker: "blueflare.s19jpro", mining: true, paused: false },
|
|
Board { ip: "10.255.1.167", model: "Antminer S19k Pro", firmware: "OurOS 1.2",
|
|
hashrate: 120.0, expected: 128.0, power: 3300.0, temp: 68.0, fan: 4500.0,
|
|
worker: "blueflare.s19kpro", mining: true, paused: false },
|
|
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, paused: false }, // 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, paused: false },
|
|
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, paused: false },
|
|
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, paused: false },
|
|
// Rebucketed from idle/not-hashing to paused so the "paused"
|
|
// status/KPI bucket is exercisable in the fake-scan/offline demo.
|
|
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, paused: true },
|
|
];
|
|
let mut rows: Vec<MinerRow> = boards.into_iter().map(Board::into_row).collect();
|
|
// Synthetic offline board: unreachable IP, blank/zeroed fields, online: false.
|
|
rows.push(MinerRow::offline("10.255.1.199".into()));
|
|
rows
|
|
}
|