mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08: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:
@@ -47,13 +47,19 @@ fn node_version_parses_v_prefix_and_suffix() {
|
||||
#[test]
|
||||
fn truncate_utf8_prefix_by_bytes_preserves_character_boundaries() {
|
||||
let input = "aé🙂z";
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 0), "");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 1), "a");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 2), "a");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 3), "aé");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 6), "aé");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 7), "aé🙂");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, 8), "aé🙂z");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 0), "");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 1), "a");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 2), "a");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 3), "aé");
|
||||
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 6), "aé");
|
||||
assert_eq!(
|
||||
truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 7),
|
||||
"aé🙂"
|
||||
);
|
||||
assert_eq!(
|
||||
truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 8),
|
||||
"aé🙂z"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -203,7 +209,7 @@ async fn wait_for_exec_tool_calls_map_drains_inflight_calls_without_hanging() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn reset_waits_for_exec_lock_before_clearing_exec_tool_calls() {
|
||||
let manager = JsReplManager::new(None, Vec::new())
|
||||
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
|
||||
.await
|
||||
.expect("manager should initialize");
|
||||
let permit = manager
|
||||
@@ -300,8 +306,11 @@ async fn emitted_image_content_item_does_not_force_original_when_enabled() {
|
||||
.expect("test turn features should allow feature update");
|
||||
turn.model_info.supports_image_detail_original = true;
|
||||
|
||||
let content_item =
|
||||
emitted_image_content_item(&turn, "data:image/png;base64,AAA".to_string(), None);
|
||||
let content_item = emitted_image_content_item(
|
||||
&turn,
|
||||
"data:image/png;base64,AAA".to_string(),
|
||||
/*detail*/ None,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
content_item,
|
||||
@@ -427,7 +436,7 @@ fn summarize_tool_call_error_marks_error_payload() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn reset_clears_inflight_exec_tool_calls_without_waiting() {
|
||||
let manager = JsReplManager::new(None, Vec::new())
|
||||
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
|
||||
.await
|
||||
.expect("manager should initialize");
|
||||
let exec_id = Uuid::new_v4().to_string();
|
||||
@@ -460,7 +469,7 @@ async fn reset_clears_inflight_exec_tool_calls_without_waiting() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn reset_aborts_inflight_exec_tool_tasks() {
|
||||
let manager = JsReplManager::new(None, Vec::new())
|
||||
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
|
||||
.await
|
||||
.expect("manager should initialize");
|
||||
let exec_id = Uuid::new_v4().to_string();
|
||||
@@ -621,14 +630,14 @@ async fn interrupt_turn_exec_clears_matching_submitted_exec() -> anyhow::Result<
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let manager = JsReplManager::new(None, Vec::new())
|
||||
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
|
||||
.await
|
||||
.expect("manager should initialize");
|
||||
let (_session, turn) = make_session_and_context().await;
|
||||
let turn = Arc::new(turn);
|
||||
let dependency_env = HashMap::new();
|
||||
let mut state = manager
|
||||
.start_kernel(Arc::clone(&turn), &dependency_env, None)
|
||||
.start_kernel(Arc::clone(&turn), &dependency_env, /*thread_id*/ None)
|
||||
.await
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
let child = Arc::clone(&state.child);
|
||||
@@ -667,14 +676,14 @@ async fn interrupt_turn_exec_resets_matching_pending_kernel_start() -> anyhow::R
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let manager = JsReplManager::new(None, Vec::new())
|
||||
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
|
||||
.await
|
||||
.expect("manager should initialize");
|
||||
let (_session, turn) = make_session_and_context().await;
|
||||
let turn = Arc::new(turn);
|
||||
let dependency_env = HashMap::new();
|
||||
let mut state = manager
|
||||
.start_kernel(Arc::clone(&turn), &dependency_env, None)
|
||||
.start_kernel(Arc::clone(&turn), &dependency_env, /*thread_id*/ None)
|
||||
.await
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
state.top_level_exec_state = TopLevelExecState::FreshKernel {
|
||||
@@ -711,14 +720,14 @@ async fn interrupt_turn_exec_does_not_reset_reused_kernel_before_submit() -> any
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let manager = JsReplManager::new(None, Vec::new())
|
||||
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
|
||||
.await
|
||||
.expect("manager should initialize");
|
||||
let (_session, turn) = make_session_and_context().await;
|
||||
let turn = Arc::new(turn);
|
||||
let dependency_env = HashMap::new();
|
||||
let mut state = manager
|
||||
.start_kernel(Arc::clone(&turn), &dependency_env, None)
|
||||
.start_kernel(Arc::clone(&turn), &dependency_env, /*thread_id*/ None)
|
||||
.await
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
state.top_level_exec_state = TopLevelExecState::ReusedKernelPending {
|
||||
|
||||
Reference in New Issue
Block a user