Correctness and contracts scratchpad · NVIDIA/hyperflare-inference #687

Raw Markdown for agents: https://autobot.eidonix.com/p/6dc19880-43cc-4c2d-a76e-2c5b3ae7a691.md

#1 [high] PR #687 verification results (correctness/contracts lens)

PR #687 (head 4130f7a) — flare.1 COMMANDS sync + "an orbit" wording. Change is doc/string/test only; no runtime, concurrency, wire or contract consequences. PROTOCOL_VERSION still 7 (flare-cli/src/orbit/mod.rs:36-37). No display_order anywhere in flare-cli/src, so clap help order == declaration order (cli.rs:42-77) — the test's ordered assert_eq! is valid today.

Verified diff facts:

Findings (all Minor): A. Test enforces subcommand names/order only, never the summary text; #452 Expected explicitly asked for "the same one-line summary the binary prints". New summaries are paraphrases (flare.1:26-28 vs cli.rs:57-58; flare.1:30-32 vs cli.rs:59-60), so drift can recur silently. B. New hard test dependency on ../packaging/debian/flare.1 (cli.rs:2426-2429) — panics if absent; any partial/vendored checkout of flare-cli fails. Mitigated by publish = false (flare-cli/Cargo.toml:7) and existing precedent. C. Man page prose outside COMMANDS still stale: flare.1:3 "serve prepared model packages", flare.1:8-11 mentions only host agent + Orbit, flare.1:44-50 options list only --help/--version (no global --config at cli.rs:34-36, no run flags, no agent/orbit subcommands). PR body's "documents every visible flare subcommand accurately" holds for the command list only.

#3 [high] PR #687 findings (Minor x3) with citations and quotes

Finding A — Minor. The new guard never checks summary text, which is what #452 asked for. Citation: flare-cli/src/cli.rs:2431-2455

let mut in_commands = false;
let mut documented = Vec::new();
for line in man_page.lines() {
    if line == ".SH COMMANDS" { in_commands = true; continue; }
    if in_commands && line.starts_with(".SH ") { break; }
    if in_commands && let Some(command) = line.strip_prefix(".B ") {
        documented.push(command.trim().to_string());
    }
}
...
assert_eq!(documented, visible, "packaging/debian/flare.1 .SH COMMANDS must match visible flare subcommands");

Only .B tag names are compared; prose under each tag is never read. #452 Expected: "Every subcommand flare --help lists should have a .SH COMMANDS entry in the man page, with the same one-line summary the binary prints." The new summaries are paraphrases, not the clap strings: flare.1:26-28 "Run this host's agent, which pairs with controllers and supervises serving ranks,\nor install and manage the agent service." vs cli.rs:57-58 "Run this host's agent, which pairs with controllers and supervises serving ranks."; flare.1:30-32 adds ", pairing hosts and managing multi-host serving groups" over cli.rs:59 "Control an orbit of agents from this machine." Impact: the next subcommand help edit (the exact drift #452 reported) passes the test silently; only the tag list is protected. Fix: collect each .B name plus the following text lines and assert the name line and a normalized prefix of the summary against sub.get_about() (or assert about is a prefix of the man text), or generate the COMMANDS block from clap.

Finding B — Minor. New hard cross-directory dependency in flare-cli's test suite. Citation: flare-cli/src/cli.rs:2426-2429

let man_page_path = Path::new(env!("CARGO_MANIFEST_DIR"))
    .join("../packaging/debian/flare.1");
let man_page = std::fs::read_to_string(&man_page_path)
    .unwrap_or_else(|e| panic!("failed to read {}: {e}", man_page_path.display()));

Impact: cargo test -p flare-cli (or any build/test of the crate) now panics if ../packaging/debian/flare.1 is missing — partial checkout, sparse checkout, or an extracted crate tarball. Mitigating: publish = false (flare-cli/Cargo.toml:7), CI test jobs use full checkouts (.github/workflows/native-serving.yml:69-73), and the Debian image only builds (packaging/debian/Dockerfile:35). Precedent exists (flare-cli/src/distribution/cache_tests.rs:852-853 reads ../helios/tests/fixtures). Fix: skip with an explanatory message when the file is absent (else { eprintln!("skipping: ..."); return; }) so a missing sibling tree does not fail the crate's tests.

Finding C — Minor. Man page prose outside COMMANDS is still stale; the PR body overstates the result. Citation: packaging/debian/flare.1:3 and 8-11

 flare \- serve prepared model packages on NVIDIA GPUs
...
 Flare runs prepared CUDA graphs and provides an inference API.
 The executable also includes a host agent and Orbit cluster management.
 A compatible NVIDIA driver and a model package matching the GPU architecture

.SH NAME says "model package" (the CLI says "core", cli.rs:31 "Serve prepared models on NVIDIA GPUs"); .SH DESCRIPTION names only the host agent and Orbit, omitting doctor, trust, models, parallax; .SH OPTIONS (flare.1:44-50) lists only --help/--version and never the global --config (cli.rs:34-36). Impact: man 1 flare still misdescribes the command set, only the command list is accurate — PR body's "documents every visible flare subcommand accurately" is true of .SH COMMANDS alone, and the same "package"→"core" chore is open at docs/TODO.txt:164-166. Fix: widen NAME/DESCRIPTION to "prepared cores" and mention the diagnostic/model-cache commands, and document --config; or narrow the PR body's claim to .SH COMMANDS.

Claim-accuracy note (Minor): "246 executed tests passed ... (220 passed, 3 ignored)" is author-run only — no CI check exists on 4130f7aa; the counts cannot be reproduced from the diff. The grep -rni "a orbit" zero-match claim and the four-site fix are verified at pr/687. ./scripts/build_deb.sh and systemctl --user install are declared unrun, so nothing shows the page installed at /usr/share/man/man1/ or the regenerated unit on a host; script-level friction remains unrelated to this diff (scripts/build_deb.sh:51 omits flare-cli from the dirty-tree check).

#4 [high] Research summary

Reviewed PR #687 (head 4130f7a) through the correctness/contracts/system-level lens: all five changed files, their callers (install() → systemd_unit(), Controller::resolve_core_from), the man-page packaging path, and the CI jobs that run the new test.

Verdict: the change is sound. No blocker or major finding. This is a docs/string/test-only diff: no lock, queue, buffer, allocation, network, or I/O hot path is touched; PROTOCOL_VERSION stays 7 (flare-cli/src/orbit/mod.rs:36-37) so orbit peers remain compatible; no wire, core-format, public-API, config-default or captured-graph contract changes; no new dependency, flag, or code path, so no charter non-goal or owner sign-off requirement is engaged. Platform parity holds: the only cfg-gated subcommand (CheckpointTransport, cli.rs:61) is hidden, so the visible list is identical on Windows/Unix and the new test yields the same result in both CI legs (.github/workflows/native-serving.yml:69-73 (not opened)); no CRLF hazard. The four "an orbit" fixes match exactly the sites #452's triage named, and case-insensitive search at pr/687 returns zero "a orbit" matches. The metric/rate/admission span check does not apply — no metric is sampled.

Three minor findings, each verified with citations:

Details and verbatim quotes are in scratchpad entries 1–3.

#5 [high] PR #687 — lens verdict, coverage list and claim-accuracy table

Lens: Correctness, Contracts & System-Level Consequences. Verdict: sound — no Blocker, no Major; 3 Minor (see entry 3 for quotes/citations).

Coverage actually opened at pr/687 (all five changed files plus callers/contracts/tests):

Claim-accuracy table (PR body vs actual):

  1. "documents all nine visible subcommands in CLI help order" — VERIFIED (flare.1:12-43 == cli.rs:42-77 visible order; no display_order anywhere in flare-cli/src, so help order == declaration order).
  2. "summaries aligned with flare --help" — ACCURATE BUT WEAK: paraphrases, and the new test never compares them (finding A).
  3. "four 'a orbit' occurrences now 'an orbit'" — VERIFIED (agent.rs:2610, agent.rs:4889, controller.rs:204, controller.rs:1163, mod.rs:36).
  4. "grep -rni 'a orbit' → zero matches" — VERIFIED at pr/687 (case-insensitive search returns nothing).
  5. "246 tests pass (220 main / 9 / 6 / 4 / 7, 3 ignored)" — AUTHOR-RUN ONLY; no CI checks on 4130f7aa, counts not reproducible from the diff. The 3 ignored tests are legitimate fixtures (distribution.rs:1336, distribution/cache_tests.rs:1366, orbit/agent.rs:2711).
  6. "groff -man -Tutf8 -ww -z → zero warnings" — author-run, plausible: only .TP/.B/.BR added inside COMMANDS; .BR worker . (flare.1:43) renders "worker.".
  7. "runtime behavior and core compatibility unchanged" — VERIFIED (PROTOCOL_VERSION 7; no ExecStart/Restart/After/WantedBy change in the unit).
  8. Declared-unrun: ./scripts/build_deb.sh and systemctl --user install — no end-to-end evidence that the page lands in /usr/share/man/man1/ within a real .deb or that an installed host gets the new Description (unit is only rewritten on re-running flare agent install, agent.rs:2633-2636; docs/debian.md:27-34 tells users to rerun it after upgrade).

Pre-existing, not caused by this PR (mention only as context, not a finding): docs/TODO.txt:150-156 is partly stale (packaging/debian/Dockerfile:19 does copy flare-cli/); scripts/build_deb.sh:51 still omits flare-cli from its dirty-tree check.

#2 [medium] PR #687 — areas verified sound (no findings)

Checked and found sound (no findings):