Files
alkane-toolkit/code-review-report.md
T
noahandClaude Opus 4.8 b6df444e3c
build-test-release / release (push) Successful in 19m4s
round 19 review fixes + Health-column alignment + badge-push fix
Health column (operator-reported): give every component-health icon a UNIFORM
fixed-width slot in the SegmentRenderer (GetSize + DrawShape), so power/control/
fan/board icons line up in fixed columns across rows regardless of glyph aspect,
and left-align the icon columns (Health/Access/Light) so the block anchors at a
consistent left edge. The per-icon tooltip hit-test uses the same uniform slot.

Code-review-harness fixes:
- High: isolate per-miner telemetry with catch_unwind so one miner's get_data
  panic can't abort the whole scan (and strand the fast-path partial rows).
- Medium: fill the zebra stripe across the full cell for right-aligned colored
  columns (was anchored at the content's left edge, leaving the left unstriped).
- Medium: lower the scan-concurrency ceiling 512 -> 256 (128 is fully reliable,
  192 already dropped responders on the live fleet).
- Medium: board voltage/frequency sort key skips placeholder-zero boards
  (avg_positive), matching how the cell renders them as "-".
- Low: saturating_add for accepted/rejected share sums; moved an orphaned doc
  comment; corrected a stale comment.

CI: fix the README-badge push-back -- `git push -c http.extraheader` is invalid
(`-c` must precede the subcommand), so the badge/coverage/bench-baseline commit
never actually reached main; now `git -c http.extraheader=... push`. This also
lets the bench-delta baseline persist so the delta can compute.

Demo: the offline-demo paused miner now has detected (idle) hashboards so the
paused-blue Health icons (round 19 #19) are exercised.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Djv3oncM4LxTS5tb61Ako6
2026-09-23 12:21:03 -06:00

112 lines
6.4 KiB
Markdown

# Code review report -- Round 19
A multi-agent review of the Round 19 changes (columns, scan fast-path +
concurrency, per-firmware log delegation, export dialog, the wx-rs bridge
alignment/tooltip work, and the bench-delta CI badge). Four reviewers ran in
parallel across correctness, reliability/concurrency, the C++ bridge + UI, and
security/CI. Every finding was re-read against the code before it was acted on.
## Verdict
Ready to ship. No Critical findings. The one High (a single miner's telemetry
panic could abort the whole scan) is fixed with per-miner panic isolation. The
Mediums (right-aligned zebra fill, the scan-concurrency ceiling, and the
board-voltage/frequency sort key) are fixed. The tooltip hit-test Medium is
resolved by the Health-column uniform-slot fix. The remaining items are Lows and
documented tradeoffs. CI run 95 was green (93 unit tests + 9 microbenchmarks +
the headless self-test), and the fixes re-check clean (`cargo check --tests`,
`clippy --no-deps -D warnings`).
## Scope
Round 19 source only: `crates/alkane-gui/src` (model.rs, ui.rs, scan.rs,
log_scan.rs, export.rs, fixtures.rs, main.rs, presets.rs), `ci/`
(bench-badge.py, gen-badges.py), `.gitea/workflows/release.yml`, and the two
changed wx-rs bridge files (`src/widgets.rs`, `cpp_src/widgets_bridge.cpp`).
Vendored asic-rs and the wxWidgets tree were out of scope (read-only, and the
CIFS mount cannot be recursed safely).
## Fixed
- **[High] No panic isolation around per-miner telemetry** (scan.rs). asic-rs
backends parse miner-controlled data; a panic in one miner's `get_data` unwound
the whole scan thread, aborting every other miner and leaving the Round-19
partial identity rows stranded. `to_row` is now wrapped in
`AssertUnwindSafe(..).catch_unwind()`, so a panicked miner is skipped (keeping
its partial identity row) and the sweep continues. (`panic = "unwind"` in the
release profile makes this effective.)
- **[Medium] Zebra stripe missing on the left of right-aligned colored columns**
(widgets_bridge.cpp, SegmentRenderer::Render). Right-aligning the colored
columns (round 19 #21) anchored the zebra fill at the content's left edge, so
the left portion of each cell kept the base colour. The fill now over-spans the
column in both directions and lets the cell-DC clip trim it.
- **[Medium] Health-column tooltip landed on the wrong icon** (widgets_bridge.cpp).
The per-icon advance used a different formula in GetSize, DrawShape, and the
tooltip hit-test, so the slot boundaries drifted. All three now use one uniform
fixed-width slot (see the Health-column change below), so the hit-test lines up.
- **[Medium] Scan-concurrency ceiling too high** (scan.rs). The user-adjustable
cap allowed 512; the code documents that 128 is fully reliable and 192 already
dropped responders (which read as phantom faults). Ceiling lowered to 256.
- **[Medium] Board voltage/frequency sort key averaged placeholder zeros**
(model.rs). Those columns store 0.0 for a board with no reading (rendered "-"),
but the sort/filter key averaged the zeros too, mis-ranking miners. A new
`avg_positive` helper skips non-positive entries (board hashrate keeps a plain
average -- a 0.0 there is a genuinely idle board).
- **[Low] Accepted/rejected share summation could overflow** on miner-controlled
counts (scan.rs, model.rs) -- now `saturating_add`.
- **[Low] Orphaned doc comment**: `efficiency_display`'s docs had attached to
`reject_ratio`; reordered.
- **[Low] Stale comment** ("3 combined columns" -> two after the Boards removal).
## Health-column follow-up (operator-reported)
The right-aligned Health column did not line up across rows: every miner is
padded to the same NUMBER of component-icon slots, but the individual glyphs
(bolt, brain, fan, chip, gap) have different widths, so flush-right the columns
drifted. Fixed by giving every health icon a UNIFORM fixed-width slot in both
`SegmentRenderer::GetSize` and `DrawShape` (each glyph centred in its slot), and
left-aligning the icon columns (Health/Access/Light) so the block anchors at a
consistent left edge. The tooltip hit-test uses the same uniform slot, which also
resolves the tooltip Medium above.
## Accepted / documented tradeoffs
- **Security (Low, release.yml):** the badge push-back passes the ephemeral,
repo-scoped Gitea run token via `git -c http.extraheader`; it is never logged,
but is briefly visible in the runner's process argv. Acceptable on the single
single-tenant capped runner.
- **`[skip release]` (Info):** Gitea recognises `[skip ci]`, not `[skip release]`,
so the badges-only commit does trigger a second workflow run -- but that run cuts
no release (compute-version.sh treats `badges/*`, including bench-baseline.json,
as no-bump), which is the intended, verified behaviour.
- **Paused-blue can mask a faulty board (#19):** a paused miner's detected boards
all render blue by design; power/control/fans keep their true colours.
- **`do_export` opens the save dialog under the App borrow:** harmless
(`try_borrow_mut` drops re-entrant timer ticks; the native save dialog emits no
wx widget events), the scan channel just buffers while it is open.
## Verified sound (no change)
- Fast-scan partial/full ordering: `buffer_unordered` polls inline on the
single block_on thread and the partial is sent before the future awaits
`get_data`, so a full row never precedes its own partial; the UI `upsert_into`
keys by IP, so the full row replaces the partial (preserving selection).
- WhatsMiner log fallback: `naming::brand` returns "WhatsMiner", which matches the
case-insensitive brand gate, so WhatsMiner correctly routes to the fault-code
view.
- Every new Column arm is internally consistent (is_numeric <-> sort_key <->
num_value <-> cell blank logic); `timestamp_utc` matches UTC over 200k samples;
the export column subset keeps headers and values aligned; the bench-badge
parser handles all nine bench line formats and the weighted delta is correct;
`tail()` never panics on a non-UTF8 boundary.
## Automated verification
- `cargo check --release --tests -p alkane-gui` -- clean (local).
- `cargo clippy -p alkane-gui --no-deps --release --bins -- -D warnings` -- clean.
- CI run 95 (v0.65.0): 93 unit tests + 9 microbenchmarks + headless self-test all
pass; coverage 44%.
- Right-alignment verified from a headless screenshot of the built binary; the
Health-column and paused-blue changes are verified in the next release's
screenshot.