Repository navigation
test(app-server): gate the stdio toolchain test on Unix - #1961
Conversation
The test writes a `#!/bin/sh` fixture and marks it executable through `std::os::unix::fs::PermissionsExt`, so the `mcp_session_flow` target did not compile for Windows. Its assertion also relies on the Unix program lookup reading the child `PATH`. Gate it with `#[cfg(unix)]`, as the other Unix-only tests in this crate's test targets do.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at db4d1e77. The Unix gate is appropriately scoped to a shell-script/Unix permissions fixture and keeps the test on Unix. The exact-head Linux log records the stdio test itself passing. The aggregate is still red on three different cli_flow tests (goal status, re-picking the same model, and subagent model policy), all covered by the pending stabilization in #1958, so I am leaving approval pending a green run. I did not independently rerun the Windows cross-check.
Non-blocking: Env::with_stdio_toolchain only has this caller, so applying the same cfg to it and its toolchain import would also avoid the new Windows dead_code warning.
The helper only serves the Unix-only stdio toolchain test, so on Windows it and the toolchain imports it uses became dead code once the test was gated. Gate the helper and its `ShellStatus` and toolchain imports with `#[cfg(unix)]`; the Windows test build no longer warns.
|
Done in fb9ac57: gated |
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head fb9ac57.
The fix is the smallest one that makes the target compile: #[cfg(unix)] on the one test that is Unix-shaped, and on the imports that only it uses. Gating rather than rewriting the fixture is the right call — the test's subject is a #!/bin/sh script resolving through the child PATH, which is Unix program lookup, so a cross-platform version of it would be a different test asserting something weaker. Nothing is deleted; the platforms that can exercise it still do.
Gating the ShellStatus import separately from HostPlatform is the detail that makes it compile rather than trade one unused-import warning for another: the gate sits on exactly what becomes unused.
verify (linux) and ci-ok failed on this head, in three TUI model-picker cases that have nothing to do with this test:
crates/dimcode/tests/cli_flow.rs:3942 and :371
goal::tui_goal_shows_the_state_and_marks_the_status_area
repicking_the_current_model_keeps_the_effort
tui_models_picker_edits_only_the_subagent_model_policy
Those same three are failing across heads this evening — they appeared on #1923 and #1881 — so the red here is the repository's, not this PR's. The Windows compromise the PR fixes (cannot find unix in os, E0433) is a cargo check --target x86_64-pc-windows-gnu path that the Linux job does not exercise at all.
Not approving while a required check is red.
Non-blocking: none.
Problem
The
mcp_session_flowtest target ofdim-app-serverdoes not compile for Windows.a_stdio_entry_starts_a_command_the_toolchain_source_provides imports
std::os::unix::fs::PermissionsExtand callsstd::fs::Permissions::from_modeto make its stdio fixture executable, socargo check -p dim-app-server --tests --target x86_64-pc-windows-gnufails withcannot find unix in os(E0433) andno associated function or constant named from_mode(E0599).The test is Unix-shaped anyway: its fixture is a
#!/bin/shscript, and it asserts that a bare command resolves through the childPATH, which relies on the Unix program lookup.Fix
Gate the test with
#[cfg(unix)]next to its#[tokio::test], like the other Unix-only tests in this crate's test targets.No test is deleted, no assertion changes, and no product code changes.
Verification
Before the change,
cargo check --locked -p dim-app-server --tests --target x86_64-pc-windows-gnureported E0433 at theuse std::os::unix::fs::PermissionsExt;line and E0599 at thefrom_modecall in that test.After the change the same command exits 0 for that target. Its only new message is the
with_stdio_toolchainhelper being unused on Windows, since the gated test is its only caller.On the host,
cargo test --locked -p dim-app-server --test mcp_session_flow a_stdio_entry_starts_a_command_the_toolchain_source_providespasses, so the test still compiles and runs where it is expected to.Also passing:
cargo clippy --locked -p dim-app-server --tests -- -D warnings,cargo fmt --all -- --check --config error_on_line_overflow=true, andcargo run --locked -p xtask -- check.