Skip to content

fix(cli): gate the env vsock caveat branch the way the variant is gated - #592

Merged
vladimirrott merged 3 commits into
lacs-project:mainfrom
yuee3:fix/vsock-cfg-gate-566
Oct 12, 2026
Merged

vladimirrott merged 3 commits into
lacs-project:mainfrom
yuee3:fix/vsock-cfg-gate-566

Conversation

@yuee3

@yuee3 yuee3 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Closes #566.

What was wrong

SocketTarget::Vsock carries #[cfg(target_os = "linux")] at apps/sysknife-cli/src/client.rs:79, but remote_daemon_caveat_from_env matched on it without the same gate:

    if matches!(target, SocketTarget::Vsock { .. }) {   // runner.rs:123

so sysknife-cli stopped at E0599: no variant named Vsock found for enum client::SocketTarget on macOS, and cargo nextest run --workspace --locked never reached the tests there.

The change

One attribute, copying the sibling match in remote_daemon_caveat (runner.rs:150-151, which already carries it):

    #[cfg(target_os = "linux")]
    if matches!(target, SocketTarget::Vsock { .. }) {

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_str can 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 a Vsock target for this heuristic to see. The gate removes compile-time work, not reachable code.

remote_daemon_caveat_from_env still uses target on every platform at line 108 (the SYSKNIFE_SOCKET branch), 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, .rustup and .cargo are all absent), so cargo check -p sysknife-cli --target aarch64-apple-darwin was 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:

  • Every SocketTarget::Vsock use in runner.rs — 123, 151, 2709, 3907 — enumerated with git 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.
  • The same enumeration over the workspace finds the variant in client.rs (lines 338, 394, 1806, 1850, 1870, 1883 — all inside Linux-gated match arms or gated tests) and an unrelated transport::listen type in sysknife-daemon. No second ungated use.
  • #[cfg] on an if statement 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.json and the --exclude sysknife-cli line in CONTRIBUTING.md are left exactly as you asked — the doc still reads as of 9d862835, 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's target: &SocketTarget parameter is unread on macOS, because its only use is the gate at line 150 that was already on main. That is an unused variable warning, not an error, and the repo carries no deny(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.

`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
@yuee3
yuee3 requested a review from vladimirrott as a code owner October 10, 2026 01:42

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vladimirrott
vladimirrott merged commit 73ed344 into lacs-project:main Oct 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sysknife-cli does not compile on macOS: runner.rs matches SocketTarget::Vsock without its Linux cfg

2 participants