Skip to content

test(app-server): gate the stdio toolchain test on Unix - #1961

Merged
yyhhyyyyyy merged 2 commits into
mainfrom
hui/app-server-tests-windows-cfg
Nov 21, 2026
Merged

yyhhyyyyyy merged 2 commits into
mainfrom
hui/app-server-tests-windows-cfg

Conversation

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator

Problem

The mcp_session_flow test target of dim-app-server does not compile for Windows.

a_stdio_entry_starts_a_command_the_toolchain_source_provides imports std::os::unix::fs::PermissionsExt and calls std::fs::Permissions::from_mode to make its stdio fixture executable, so cargo check -p dim-app-server --tests --target x86_64-pc-windows-gnu fails with cannot find unix in os (E0433) and no associated function or constant named from_mode (E0599).

The test is Unix-shaped anyway: its fixture is a #!/bin/sh script, and it asserts that a bare command resolves through the child PATH, 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-gnu reported E0433 at the use std::os::unix::fs::PermissionsExt; line and E0599 at the from_mode call in that test.

After the change the same command exits 0 for that target. Its only new message is the with_stdio_toolchain helper 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_provides passes, 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, and cargo run --locked -p xtask -- check.

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 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.
@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator Author

Done in fb9ac57: gated with_stdio_toolchain and its import on Unix; the Windows check no longer warns.

@yyhhyyyyyy
yyhhyyyyyy requested a review from eric8810 November 20, 2026 16:58

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

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.

2 participants