Files
alkane-toolkit/code-review-report.md
T
noahandClaude Opus 4.8 d80151a93c
build-test-release / release (push) Successful in 8m43s
item 12 finale: shrink the release binary + code-review report
[profile.release] opt-level="s" + fat LTO + one codegen unit + strip cuts the
Linux binary from ~38M to ~19M (50%). panic stays "unwind" deliberately: the scan
runs many miners on tokio tasks and the wx dispatch relies on unwinding, so one
miner's panic must never abort the whole app. Verified: stripped binary, SELFTEST
PASS, 99 tests, clippy clean.

Adds code-review-report.md: the ship verdict and a full accounting of the five
recursive review rounds (all confirmed critical/high fixed; remaining items are
documented perf/dev-CLI tradeoffs). Badges refreshed (tests 99, coverage ~35%).

This completes the round-18 marathon: all 12 queued items plus Round C G3 (LuxOS
named presets) and G7 (per-board V/F read side), CI hardening (verify/release
split, clippy gate, audit, badges), README + docs, and the recursive multi-agent
code review.

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

5.8 KiB

Code review report

A recursive, multi-agent review of the project's own source (not vendored crates), run with sonnet reviewers across five dimensions (correctness, reliability, security, performance, maintainability). Every candidate finding was adversarially verified by an independent agent; only findings confirmed real with medium/high confidence were acted on. The review was run in rounds -- each round re-reviewed the code after the previous round's fixes -- until it stopped surfacing new critical/high issues.

Verdict

Ready to ship. The review ran the full five iterations (the harness cap). Every confirmed critical and high finding across all five rounds is fixed, the substantive mediums and lows are fixed, and the remainder are documented, intentional tradeoffs. Clippy is clean (-D warnings, our crate), 99 unit tests and the headless UI self-test pass, and cargo audit passes with two build-time-only advisories accepted in .cargo/audit.toml.

Rounds

Each round re-reviewed the code after the previous round's fixes. Later rounds surfaced issues in code paths (and edge cases of earlier fixes) the earlier rounds had not reached; the new-critical/high rate fell across the run and the last round found only already-accepted perf tradeoffs plus a few niche items.

Round Confirmed Crit/High Outcome
1 18 1 crit, 5 high fixed 13, accepted 5 (waves 1-2)
2 20 4 high fixed the highs + security/correctness, accepted perf/CLI (waves 3-4)
3 14 4 high unreachable Boards column, action/scan races, char-boundary panic (wave 5)
4 17 3 high board-grey regression, unmasked prompt, more races (wave 6)
5 11 3 high credential-blank override, scan/action race, change-password lockout (wave 7)

Roughly 30 distinct real defects were fixed across the run (the totals overlap because each round re-confirms unresolved/accepted items).

Quantitative summary

  • Source: ~12.5k lines in crates/alkane-gui (the other crates/alkane-* are early scaffolding); vendored asic-rs + patched wx-rs are out of scope.
  • Tests: 99 unit tests + a headless UI self-test; microbenchmarks run in CI.
  • Line coverage: ~36% overall; the pure logic is well covered (model 77%, naming 95%, fixtures 100%, credentials 92%), with the wxWidgets UI-construction code exercised by the self-test rather than unit tests.
  • Lint: cargo clippy --no-deps -- -D warnings clean on our crate.

Fixed (by class)

  • Restore correctness (critical/med): a Braiins SSH restore reported success on auth/connection failure -- run_with_timeout now captures the exit code and drains stderr, and a testable classify_braiins treats ssh failures as failure; the LuxOS restore no longer reports failure when the miner reboots mid-reply.
  • Exclusivity (high): restore-to-stock, firmware flash, and config actions now refuse to start while any of the others is in flight, so no two operations hit the same miner and no running handle is orphaned; a restore worker-thread spawn failure can no longer wedge the subsystem.
  • Secrets off the command line (high): the access probe, the log fetch, and the Braiins SSH revert no longer put credentials on argv (curl config on stdin; sshpass -e); the Credentials dialog masks saved passwords; saved pool lists are chmod 0600; CSV export neutralizes spreadsheet formula injection.
  • Injection / panics (med): VNish and LuxOS JSON is built with serde (escaped); log tail() no longer panics on a non-UTF8 char boundary; board_index_from_text no longer grabs an unrelated number far past the board keyword.
  • UI responsiveness + correctness (high): viewing a miner log now runs on a background thread instead of freezing the UI ~20s; scan telemetry runs concurrently instead of serially; the Boards numeric filter compares the board count instead of a composite sort score; the WhatsMiner access probe now uses the operator's saved password; the columns widget stays in lockstep with the model when auto-hide-empty changes the shown set (drag-reorder and header sort fixed).
  • Hygiene (low): curl/subprocess timeouts reap the child; the fake-mode pools action honours cancellation; two tests no longer race on the global $HOME.

New regression tests were added for the restore classifier, the Boards filter, the log-tail boundary, the board-index parser, and the column subset-reorder.

Accepted, documented tradeoffs

Each is confirmed real but a deliberate choice, now carrying an in-code rationale: SSH host-key checking is off for LAN miners whose key rotates on reflash; scan restart uses cooperative cancellation (a hard join would freeze the UI); the aftermarket re-probe runs per scan for freshness; fill_rows clears and refills (coalesced to one refill per tick); upsert_into's linear scan and the per-render health recompute are negligible at the tool's fleet scale; bulk config-action writes stay serial deliberately; and miner_probe (a separate diagnostic binary) uses the global scan credentials, which its output now states explicitly.

Security notes

cargo audit reports two advisories, both in the wx-rs build script's reqwest 0.11 subtree (h2 0.3 DoS; rustls-pemfile unmaintained). Build-time only, never linked into the runtime binary, only exercised on Windows/macOS downloads, and unupgradable without re-vendoring the offline dependency tree. Accepted and documented in .cargo/audit.toml and deny.toml.

Automated verification

  • cargo test -p alkane-gui -- 99 passing.
  • cargo clippy -p alkane-gui --no-deps -- -D warnings -- clean.
  • cargo test -p alkane-gui --release -- --ignored bench_ -- microbenchmarks.
  • ALKANE_SELFTEST=1 alkane-toolkit under Xvfb -- SELFTEST PASS.
  • cargo audit -- clean with the accepted-advisory config.

All run in CI (verify.yml on PRs/branches; release.yml on main).