Commit Graph

3 Commits

Author SHA1 Message Date
Wanjohi
55b72fc4af feat(nesdoctor): put the line on the clipboard, and ask for the JSON properly
Two problems with how the run ended, both about presentation rather than data.

The summary line was set in the same dim grey as the paragraphs around it and
had to be found, then hand-selected out of a terminal. It is now a reverse-video
block under a "Copy this" rule, and it is copied to the clipboard automatically
via wl-copy, xclip, xsel, pbcopy or clip -- whichever the desktop has. Where
none is present we say so and mention the package, so it works by itself next
time. Selecting a long line out of a terminal was the last step before we learn
anything, so it should not be work.

And the JSON was described defensively -- "goes nowhere unless you send it" --
which reads as though we expect to be distrusted, and inviting the doubt is a
good way to create it. The file is genuinely the more valuable artefact: it
carries every check with its reason, the full latency series, and installed
titles with sizes and launch times. So it now says that, says what it is for,
and asks for it: read through it, send it along if nothing in there bothers
you, and the line is already plenty if not.

The consent model does not change -- no server exists, nothing is uploaded, and
Steam still needs an explicit yes asked last. What changes is that we stop
apologising for asking.
2026-09-02 00:17:31 +03:00
Wanjohi
c89680ba47 ci(nesdoctor): build and smoke-test the release binaries on tag
release-nesdoctor.yml
  Four targets on tag `nesdoctor-v*`: x86_64 linux-musl, x86_64 windows-msvc,
  aarch64 and x86_64 macOS. musl rather than glibc so one Linux binary runs on
  every distro regardless of glibc version. SHA256SUMS beside the binaries,
  because "download this and run it" is only a reasonable request if the file
  can be verified. `fail-fast: false` -- a Windows failure should still leave
  the Linux binary available to look at.

  Built here and nowhere else: a binary somebody produced on their laptop and
  uploaded is not auditable however honest they are.

  The step that justifies the workflow is the smoke test, which runs the
  binary it just built, network included. `ring` under rustls resolves root
  certificates through the host trust store, so a static musl build can compile
  cleanly and then fail TLS on the machine it ships to -- breaking the network
  test, the one feature anybody runs this for, silently and only for other
  people. The step fails the build if the summary line comes back
  `net=unmeasured`.

  A manual dispatch builds and smoke-tests without publishing, which is what
  you want while iterating.

ci.yml
  A `nesdoctor` job: fmt, clippy -D warnings, test, and one real run. Scoped to
  the one member deliberately -- the rest of the Rust half has never been under
  CI, so `--workspace` would turn every PR red for unrelated reasons. Widen it
  one member at a time as each is made to pass.

Two bugs the new gates found immediately, both of which shipped in the previous
commit:
  - `--quiet` printed the whole questionnaire before its summary line, which
    breaks the one thing `--quiet` promises. Prompts are now skipped when
    stdout is quiet or stdin is not a terminal -- and a pipe is explicitly not
    treated as consent to read somebody's Steam library, unlike `--yes`.
  - clippy: an `if` with identical branches in the KVM check, two map
    iterations taking keys they discarded, a manual `split_once`, and a
    `sort_by` that wanted `sort_by_key`. `needless_return` is allowed in
    `sys.rs` with the reason stated: every probe there is a stack of
    cfg-gated returns and the trailing `return` in each arm is load-bearing.
2026-09-02 00:15:22 +03:00
Wanjohi
283e882ce3 feat(nesdoctor): a host readiness checker that measures instead of asking
The first executable form of our host requirements. Until now a machine was
qualified by a human reading a table of hard requirements, and a requirement
nothing can check is one that is silently optional.

It also replaces a form. Every field we wanted from a prospective host --
upstream, latency under load, spare disk, hours powered, library size, play
hours -- is measurable, and most of them cannot be answered honestly by a
human anyway: almost nobody knows their real upstream and essentially nobody
has seen their own bufferbloat figure. What is left for the questions is only
what a machine cannot know: intent, and what someone already pays.

What it does
  - Checks every hard requirement: /dev/kvm, an AMD or Intel GPU with a DRM
    render node, VK_KHR_video_encode_queue plus a codec, virglrenderer, the
    two stores, the io cgroup controller, virtiofsd. Pass/fail/unknown, and
    unknown is never collapsed into fail -- a machine we could not ask is not
    a machine that failed.
  - Measures upstream and, the point of the whole thing, added latency under
    load. Grade bands come from the frame budget rather than convention: the
    network allowance is ~40 ms because render, encode, decode, display and
    jitter buffer have already spent ~58 ms.
  - Reads Steam, only with an explicit yes, for library size and shape and an
    hour-of-day histogram of launches -- one sample per title, which is a real
    distribution obtained without asking.
  - Asks at most five questions, branched, all skippable.

No server
  Nothing is uploaded and no telemetry endpoint exists. The network test talks
  to Cloudflare's public sink and to 1.1.1.1, neither of which is ours. Output
  is a line on the terminal that the person may choose to paste. The line
  carries no hostname, IP, username, game title or path -- a size band rather
  than a size, hours rather than dates. The long version stays in a local
  JSON file.

Three bugs found by running it, all of which would have produced wrong data
  - vulkaninfo --summary lists ZERO VK_KHR_video entries where full vulkaninfo
    lists five on the same machine. Preferring the summary reported "not
    advertised" on a card that advertises it -- a false negative on the check
    most likely to disqualify a host.
  - btrfs subvolumes were counted as separate disks: /, /home and /srv each
    reported 91 GiB of one 91 GiB device. Deduped by backing device, which the
    two-stores check needs anyway since it wants separate devices.
  - Proton and the Steam Linux Runtimes are installed like games and are not
    games. Five of eight entries on the test machine, so the title count was
    5x too high and the library-shape question was corrupted.

And one finding about the development connection, now encoded as a verdict:
178 ms idle RTT, served from Johannesburg. That machine passes every other
check and cannot host for a European player, because it is distance and no
upgrade shortens it. HOST-READY-LOCAL exists for exactly that case -- and it
is the coverage argument from the other end: somewhere with no nearby edge is
somewhere a local host is the only option anyone has.

Dependencies are four, three of them serde/clap/anyhow. The VDF parser, every
platform probe and the text wrapping are in-tree: a binary handed to strangers
has a dependency tree that is part of its interface.
2026-09-02 00:09:00 +03:00