Repository navigation
fix(cli): gate the env vsock caveat branch the way the variant is gated - #592
Conversation
`SocketTarget::Vsock` carries `#[cfg(target_os = "linux")]` (client.rs:79), but `remote_daemon_caveat_from_env` matched on it without the same gate, so `sysknife-cli` did not compile on macOS: E0599, no variant named `Vsock` for enum `client::SocketTarget`. The branch cannot run off Linux anyway: `SocketTarget::try_from_str` builds the variant only inside its own Linux gate (client.rs:94-105), so no vsock target can reach the heuristic there. The sibling match in `remote_daemon_caveat` (runner.rs:150) already carries the attribute; this copies that shape. Refs lacs-project#566
vladimirrott
left a comment
There was a problem hiding this comment.
Thanks @yuee3. This is the fix #566 asked for, and your PR body made it quick to check.
You couldn't run the macOS check, so I ran it here. cargo check -p sysknife-cli --locked --target aarch64-apple-darwin fails on main (7c2d26a) with E0599: no variant named Vsock found for enum SocketTarget and finishes clean on your head d13c8405. My machine has no Apple C toolchain, so I stubbed CC and AR for that target. cargo check never links, so the stub only skips ring's assembly.
Once the crate compiles, rustc gets to its dead-code pass on macOS and prints warnings for code that already existed: unused variable: target at runner.rs:148 and vsock_token never used in the CLI, plus authenticate_vsock_token and VSOCK_AUTH_FRAME_TIMEOUT_SECS in the daemon. Linux CI never sees them and they block nothing. If you want them, I'll file an issue and hold it for you.
I updated the branch with main and will merge when the fresh run is green.
Entries for #570, #571, #572, #573, #575, #576, #577, #578, #579, #584, #586, #587, #589, #592, #594 and #603, plus the dependency bumps in #595, #596, #597, #599 and #600. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU
Closes #566.
What was wrong
SocketTarget::Vsockcarries#[cfg(target_os = "linux")]atapps/sysknife-cli/src/client.rs:79, butremote_daemon_caveat_from_envmatched on it without the same gate:so
sysknife-clistopped atE0599: no variant named Vsock found for enum client::SocketTargeton macOS, andcargo nextest run --workspace --lockednever reached the tests there.The change
One attribute, copying the sibling match in
remote_daemon_caveat(runner.rs:150-151, which already carries it):On other platforms the statement drops out and the function falls through to
None, exactly as the issue describes.Why gating it changes no behaviour
The branch was already unreachable off Linux.
SocketTarget::try_from_strcan only build the variant inside its own Linux gate (client.rs:94-105) — it is the only constructor in the tree — so a caller on macOS cannot produce aVsocktarget for this heuristic to see. The gate removes compile-time work, not reachable code.remote_daemon_caveat_from_envstill usestargeton every platform at line 108 (theSYSKNIFE_SOCKETbranch), so nothing becomes unused there.What I ran, and what I could not
I could not run the done-when check: this environment has no Rust toolchain at all (
cargo,rustc,.rustupand.cargoare all absent), socargo check -p sysknife-cli --target aarch64-apple-darwinwas not run — not "failed", just not available to me. Please treat that criterion as open and rerun it on your side.What I did verify, statically, against
d4a702e:SocketTarget::Vsockuse inrunner.rs— 123, 151, 2709, 3907 — enumerated withgit grep. 151 (plus its enclosing fn's doc), 2709 and 3907 already carry#[cfg(target_os = "linux")]; 123 was the only ungated one, and it is the E0599 the issue records.client.rs(lines 338, 394, 1806, 1850, 1870, 1883 — all inside Linux-gatedmatcharms or gated tests) and an unrelatedtransport::listentype insysknife-daemon. No second ungated use.#[cfg]on anifstatement is proven-good in this exact file: line 150 is the same construct.The macOS survey, deliberately untouched
I cannot rerun the survey, so
tests/evidence/macos-survey.jsonand the--exclude sysknife-cliline inCONTRIBUTING.mdare left exactly as you asked — the doc still reads as of9d862835, and says the package does not compile there yet, which stays true until someone reruns it.One thing to expect when you rerun it
Once the crate gets past line 123 and type-checks further,
remote_daemon_caveat'starget: &SocketTargetparameter is unread on macOS, because its only use is the gate at line 150 that was already onmain. That is anunused variablewarning, not an error, and the repo carries nodeny(warnings), so it does not block the build — I left it alone rather than widen the diff, but it may show up in your survey output and is worth deciding on in the same pass if you want it gone.