mirror of
https://github.com/openai/codex.git
synced 2026-05-01 01:47:18 +00:00
chore: clean up argument-comment lint and roll out all-target CI on macOS (#16054)
## Why `argument-comment-lint` was green in CI even though the repo still had many uncommented literal arguments. The main gap was target coverage: the repo wrapper did not force Cargo to inspect test-only call sites, so examples like the `latest_session_lookup_params(true, ...)` tests in `codex-rs/tui_app_server/src/lib.rs` never entered the blocking CI path. This change cleans up the existing backlog, makes the default repo lint path cover all Cargo targets, and starts rolling that stricter CI enforcement out on the platform where it is currently validated. ## What changed - mechanically fixed existing `argument-comment-lint` violations across the `codex-rs` workspace, including tests, examples, and benches - updated `tools/argument-comment-lint/run-prebuilt-linter.sh` and `tools/argument-comment-lint/run.sh` so non-`--fix` runs default to `--all-targets` unless the caller explicitly narrows the target set - fixed both wrappers so forwarded cargo arguments after `--` are preserved with a single separator - documented the new default behavior in `tools/argument-comment-lint/README.md` - updated `rust-ci` so the macOS lint lane keeps the plain wrapper invocation and therefore enforces `--all-targets`, while Linux and Windows temporarily pass `-- --lib --bins` That temporary CI split keeps the stricter all-targets check where it is already cleaned up, while leaving room to finish the remaining Linux- and Windows-specific target-gated cleanup before enabling `--all-targets` on those runners. The Linux and Windows failures on the intermediate revision were caused by the wrapper forwarding bug, not by additional lint findings in those lanes. ## Validation - `bash -n tools/argument-comment-lint/run.sh` - `bash -n tools/argument-comment-lint/run-prebuilt-linter.sh` - shell-level wrapper forwarding check for `-- --lib --bins` - shell-level wrapper forwarding check for `-- --tests` - `just argument-comment-lint` - `cargo test` in `tools/argument-comment-lint` - `cargo test -p codex-terminal-detection` ## Follow-up - Clean up remaining Linux-only target-gated callsites, then switch the Linux lint lane back to the plain wrapper invocation. - Clean up remaining Windows-only target-gated callsites, then switch the Windows lint lane back to the plain wrapper invocation.
This commit is contained in:
@@ -426,7 +426,7 @@ async fn pipe_process_round_trips_stdin() -> anyhow::Result<()> {
|
||||
drop(writer);
|
||||
session.close_stdin();
|
||||
|
||||
let (output, code) = collect_output_until_exit(output_rx, exit_rx, 5_000).await;
|
||||
let (output, code) = collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 5_000).await;
|
||||
let text = String::from_utf8_lossy(&output);
|
||||
|
||||
assert!(
|
||||
@@ -535,7 +535,7 @@ async fn pipe_drains_stderr_without_stdout_activity() -> anyhow::Result<()> {
|
||||
let spawned = spawn_pipe_process(&python, &args, Path::new("."), &env_map, &None).await?;
|
||||
let (_session, output_rx, exit_rx) = combine_spawned_output(spawned);
|
||||
|
||||
let (output, code) = collect_output_until_exit(output_rx, exit_rx, 10_000).await;
|
||||
let (output, code) = collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 10_000).await;
|
||||
|
||||
assert_eq!(code, 0, "expected python to exit cleanly");
|
||||
assert!(!output.is_empty(), "expected stderr output to be drained");
|
||||
@@ -644,7 +644,7 @@ async fn pty_terminate_kills_background_children_in_same_process_group() -> anyh
|
||||
.await?;
|
||||
let (session, mut output_rx, _exit_rx) = combine_spawned_output(spawned);
|
||||
|
||||
let bg_pid = match wait_for_marker_pid(&mut output_rx, marker, 2_000).await {
|
||||
let bg_pid = match wait_for_marker_pid(&mut output_rx, marker, /*timeout_ms*/ 2_000).await {
|
||||
Ok(pid) => pid,
|
||||
Err(err) => {
|
||||
session.terminate();
|
||||
@@ -658,7 +658,7 @@ async fn pty_terminate_kills_background_children_in_same_process_group() -> anyh
|
||||
|
||||
session.terminate();
|
||||
|
||||
let exited = wait_for_process_exit(bg_pid, 3_000).await?;
|
||||
let exited = wait_for_process_exit(bg_pid, /*timeout_ms*/ 3_000).await?;
|
||||
if !exited {
|
||||
let _ = unsafe { libc::kill(bg_pid, libc::SIGKILL) };
|
||||
}
|
||||
@@ -708,7 +708,7 @@ async fn pty_spawn_can_preserve_inherited_fds() -> anyhow::Result<()> {
|
||||
drop(write_end);
|
||||
|
||||
let (_session, output_rx, exit_rx) = combine_spawned_output(spawned);
|
||||
let (_, code) = collect_output_until_exit(output_rx, exit_rx, 2_000).await;
|
||||
let (_, code) = collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 2_000).await;
|
||||
assert_eq!(code, 0, "expected preserved-fd PTY child to exit cleanly");
|
||||
|
||||
let mut pipe_output = String::new();
|
||||
@@ -762,14 +762,19 @@ async fn pty_preserving_inherited_fds_keeps_python_repl_running() -> anyhow::Res
|
||||
let (session, mut output_rx, exit_rx) = combine_spawned_output(spawned);
|
||||
let writer = session.writer_sender();
|
||||
let newline = "\n";
|
||||
let mut output =
|
||||
wait_for_python_repl_ready_via_probe(&writer, &mut output_rx, 5_000, newline).await?;
|
||||
let mut output = wait_for_python_repl_ready_via_probe(
|
||||
&writer,
|
||||
&mut output_rx,
|
||||
/*timeout_ms*/ 5_000,
|
||||
newline,
|
||||
)
|
||||
.await?;
|
||||
let marker = "__codex_preserved_py_pid:";
|
||||
writer
|
||||
.send(format!("import os; print('{marker}' + str(os.getpid())){newline}").into_bytes())
|
||||
.await?;
|
||||
|
||||
let python_pid = match wait_for_marker_pid(&mut output_rx, marker, 2_000).await {
|
||||
let python_pid = match wait_for_marker_pid(&mut output_rx, marker, /*timeout_ms*/ 2_000).await {
|
||||
Ok(pid) => pid,
|
||||
Err(err) => {
|
||||
session.terminate();
|
||||
@@ -782,7 +787,8 @@ async fn pty_preserving_inherited_fds_keeps_python_repl_running() -> anyhow::Res
|
||||
);
|
||||
|
||||
writer.send(format!("exit(){newline}").into_bytes()).await?;
|
||||
let (remaining_output, code) = collect_output_until_exit(output_rx, exit_rx, 5_000).await;
|
||||
let (remaining_output, code) =
|
||||
collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 5_000).await;
|
||||
output.extend_from_slice(&remaining_output);
|
||||
|
||||
assert_eq!(code, 0, "expected python to exit cleanly");
|
||||
@@ -871,7 +877,12 @@ async fn pty_spawn_with_inherited_fds_supports_resize() -> anyhow::Result<()> {
|
||||
|
||||
let (session, mut output_rx, exit_rx) = combine_spawned_output(spawned);
|
||||
let writer = session.writer_sender();
|
||||
let mut output = wait_for_output_contains(&mut output_rx, "start:31 101\r\n", 5_000).await?;
|
||||
let mut output = wait_for_output_contains(
|
||||
&mut output_rx,
|
||||
"start:31 101\r\n",
|
||||
/*timeout_ms*/ 5_000,
|
||||
)
|
||||
.await?;
|
||||
|
||||
session.resize(TerminalSize {
|
||||
rows: 45,
|
||||
@@ -880,7 +891,8 @@ async fn pty_spawn_with_inherited_fds_supports_resize() -> anyhow::Result<()> {
|
||||
writer.send(b"go\n".to_vec()).await?;
|
||||
session.close_stdin();
|
||||
|
||||
let (remaining_output, code) = collect_output_until_exit(output_rx, exit_rx, 5_000).await;
|
||||
let (remaining_output, code) =
|
||||
collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 5_000).await;
|
||||
output.extend_from_slice(&remaining_output);
|
||||
let text = String::from_utf8_lossy(&output);
|
||||
let normalized = text.replace("\r\n", "\n");
|
||||
@@ -933,7 +945,7 @@ async fn pipe_spawn_no_stdin_can_preserve_inherited_fds() -> anyhow::Result<()>
|
||||
drop(write_end);
|
||||
|
||||
let (_session, output_rx, exit_rx) = combine_spawned_output(spawned);
|
||||
let (_, code) = collect_output_until_exit(output_rx, exit_rx, 2_000).await;
|
||||
let (_, code) = collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 2_000).await;
|
||||
assert_eq!(code, 0, "expected preserved-fd pipe child to exit cleanly");
|
||||
|
||||
let mut pipe_output = String::new();
|
||||
|
||||
Reference in New Issue
Block a user