fix(ci): keep the terminal request contract warning-free on the 501 builds

The OpenHarmony check on 8811455 got past the re-export and stopped on
dead code: the four size constants are read only by the Unix handlers,
and the three request bodies are deserialized by the 501 stubs but never
read there, which `-D warnings` rejects on ohos and Windows.

The constants carry the same Unix gate as the handlers. The request
structs stay on every platform, since they are the route contract the
stubs answer, and expect their fields to be unread on the non-Unix
build; `expect` rather than `allow` so a future stub that does read
them fails the build instead of leaving a stale attribute (and it stays
outside the dead-code budget).

Validation: `cargo fmt --all -- --check` clean; dead-code budget
unchanged at 174. The ohos and Windows legs are judged by CI on this
head; neither toolchain is available here.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0134iUMxmGuXiG1LzPgfZVnv
This commit is contained in:
Claude committed 2026-09-20 13:25:14 +00:00
1 parent 8811455834
commit 2ca42e9dbd
1 file changed
+9
+9
View File
@@ -43,13 +43,20 @@ use crate::tools::terminal_session;
use super::{ApiError, RuntimeApiState};
/// Default per-response ceiling; the owner clamps to its own `READ_LIMIT`.
#[cfg(all(unix, not(target_env = "ohos")))]
const TERMINAL_CHUNK_DEFAULT: usize = 64 * 1024;
/// Session names come from the agent's tools; this only bounds the echo.
#[cfg(all(unix, not(target_env = "ohos")))]
const TERMINAL_NAME_MAX_BYTES: usize = 128;
/// One input frame. Interactive typing is bytes, not uploads.
#[cfg(all(unix, not(target_env = "ohos")))]
const TERMINAL_INPUT_MAX_BYTES: usize = 64 * 1024;
#[cfg(all(unix, not(target_env = "ohos")))]
const TERMINAL_DIMENSION_MAX: u16 = 1000;
// The request shape is the contract on every platform; only the Unix
// handlers read it, so the 501 builds expect the fields to stay unread.
#[cfg_attr(any(not(unix), target_env = "ohos"), expect(dead_code))]
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub(super) struct TerminalOutputQuery {
@@ -83,6 +90,7 @@ pub(super) struct TerminalOutputResponse {
exit_code: Option<i64>,
}
#[cfg_attr(any(not(unix), target_env = "ohos"), expect(dead_code))]
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub(super) struct TerminalInputRequest {
@@ -98,6 +106,7 @@ pub(super) struct TerminalWriteResponse {
written: usize,
}
#[cfg_attr(any(not(unix), target_env = "ohos"), expect(dead_code))]
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub(super) struct TerminalResizeRequest {