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:
Michael Bolin authored and GitHub committed 2026-03-27 19:00:44 -07:00
1 parent ed977b42ac
commit 61dfe0b86c
307 files changed
+7724 -4710

No files matched your search

+43 -20
View File
@@ -75,7 +75,9 @@ async fn make_config_with_project_root_markers(
async fn no_doc_file_returns_none() {
let tmp = tempfile::tempdir().expect("tempdir");
let res = get_user_instructions(&make_config(&tmp, 4096, None).await).await;
let res =
get_user_instructions(&make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await)
.await;
assert!(
res.is_none(),
"Expected None when AGENTS.md is absent and no system instructions provided"
@@ -89,9 +91,10 @@ async fn doc_smaller_than_limit_is_returned() {
let tmp = tempfile::tempdir().expect("tempdir");
fs::write(tmp.path().join("AGENTS.md"), "hello world").unwrap();
let res = get_user_instructions(&make_config(&tmp, 4096, None).await)
.await
.expect("doc expected");
let res =
get_user_instructions(&make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await)
.await
.expect("doc expected");
assert_eq!(
res, "hello world",
@@ -108,7 +111,7 @@ async fn doc_larger_than_limit_is_truncated() {
let huge = "A".repeat(LIMIT * 2); // 2 KiB
fs::write(tmp.path().join("AGENTS.md"), &huge).unwrap();
let res = get_user_instructions(&make_config(&tmp, LIMIT, None).await)
let res = get_user_instructions(&make_config(&tmp, LIMIT, /*instructions*/ None).await)
.await
.expect("doc expected");
@@ -137,7 +140,7 @@ async fn finds_doc_in_repo_root() {
std::fs::create_dir_all(&nested).unwrap();
// Build config pointing at the nested dir.
let mut cfg = make_config(&repo, 4096, None).await;
let mut cfg = make_config(&repo, /*limit*/ 4096, /*instructions*/ None).await;
cfg.cwd = nested.abs();
let res = get_user_instructions(&cfg).await.expect("doc expected");
@@ -150,7 +153,8 @@ async fn zero_byte_limit_disables_docs() {
let tmp = tempfile::tempdir().expect("tempdir");
fs::write(tmp.path().join("AGENTS.md"), "something").unwrap();
let res = get_user_instructions(&make_config(&tmp, 0, None).await).await;
let res =
get_user_instructions(&make_config(&tmp, /*limit*/ 0, /*instructions*/ None).await).await;
assert!(
res.is_none(),
"With limit 0 the function should return None"
@@ -160,7 +164,7 @@ async fn zero_byte_limit_disables_docs() {
#[tokio::test]
async fn js_repl_instructions_are_appended_when_enabled() {
let tmp = tempfile::tempdir().expect("tempdir");
let mut cfg = make_config(&tmp, 4096, None).await;
let mut cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
cfg.features
.enable(Feature::JsRepl)
.expect("test config should allow js_repl");
@@ -175,7 +179,7 @@ async fn js_repl_instructions_are_appended_when_enabled() {
#[tokio::test]
async fn js_repl_tools_only_instructions_are_feature_gated() {
let tmp = tempfile::tempdir().expect("tempdir");
let mut cfg = make_config(&tmp, 4096, None).await;
let mut cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
let mut features = cfg.features.get().clone();
features
.enable(Feature::JsRepl)
@@ -194,7 +198,7 @@ async fn js_repl_tools_only_instructions_are_feature_gated() {
#[tokio::test]
async fn js_repl_image_detail_original_does_not_change_instructions() {
let tmp = tempfile::tempdir().expect("tempdir");
let mut cfg = make_config(&tmp, 4096, None).await;
let mut cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
let mut features = cfg.features.get().clone();
features
.enable(Feature::JsRepl)
@@ -219,7 +223,7 @@ async fn merges_existing_instructions_with_project_doc() {
const INSTRUCTIONS: &str = "base instructions";
let res = get_user_instructions(&make_config(&tmp, 4096, Some(INSTRUCTIONS)).await)
let res = get_user_instructions(&make_config(&tmp, /*limit*/ 4096, Some(INSTRUCTIONS)).await)
.await
.expect("should produce a combined instruction string");
@@ -236,7 +240,8 @@ async fn keeps_existing_instructions_when_doc_missing() {
const INSTRUCTIONS: &str = "some instructions";
let res = get_user_instructions(&make_config(&tmp, 4096, Some(INSTRUCTIONS)).await).await;
let res =
get_user_instructions(&make_config(&tmp, /*limit*/ 4096, Some(INSTRUCTIONS)).await).await;
assert_eq!(res, Some(INSTRUCTIONS.to_string()));
}
@@ -262,7 +267,7 @@ async fn concatenates_root_and_cwd_docs() {
std::fs::create_dir_all(&nested).unwrap();
fs::write(nested.join("AGENTS.md"), "crate doc").unwrap();
let mut cfg = make_config(&repo, 4096, None).await;
let mut cfg = make_config(&repo, /*limit*/ 4096, /*instructions*/ None).await;
cfg.cwd = nested.abs();
let res = get_user_instructions(&cfg).await.expect("doc expected");
@@ -279,7 +284,13 @@ async fn project_root_markers_are_honored_for_agents_discovery() {
fs::create_dir_all(nested.join(".git")).unwrap();
fs::write(nested.join("AGENTS.md"), "child doc").unwrap();
let mut cfg = make_config_with_project_root_markers(&root, 4096, None, &[".codex-root"]).await;
let mut cfg = make_config_with_project_root_markers(
&root,
/*limit*/ 4096,
/*instructions*/ None,
&[".codex-root"],
)
.await;
cfg.cwd = nested.abs();
let discovery = discover_project_doc_paths(&cfg).expect("discover paths");
@@ -302,7 +313,7 @@ async fn agents_local_md_preferred() {
fs::write(tmp.path().join(DEFAULT_PROJECT_DOC_FILENAME), "versioned").unwrap();
fs::write(tmp.path().join(LOCAL_PROJECT_DOC_FILENAME), "local").unwrap();
let cfg = make_config(&tmp, 4096, None).await;
let cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
let res = get_user_instructions(&cfg)
.await
@@ -324,7 +335,13 @@ async fn uses_configured_fallback_when_agents_missing() {
let tmp = tempfile::tempdir().expect("tempdir");
fs::write(tmp.path().join("EXAMPLE.md"), "example instructions").unwrap();
let cfg = make_config_with_fallback(&tmp, 4096, None, &["EXAMPLE.md"]).await;
let cfg = make_config_with_fallback(
&tmp,
/*limit*/ 4096,
/*instructions*/ None,
&["EXAMPLE.md"],
)
.await;
let res = get_user_instructions(&cfg)
.await
@@ -340,7 +357,13 @@ async fn agents_md_preferred_over_fallbacks() {
fs::write(tmp.path().join("AGENTS.md"), "primary").unwrap();
fs::write(tmp.path().join("EXAMPLE.md"), "secondary").unwrap();
let cfg = make_config_with_fallback(&tmp, 4096, None, &["EXAMPLE.md", ".example.md"]).await;
let cfg = make_config_with_fallback(
&tmp,
/*limit*/ 4096,
/*instructions*/ None,
&["EXAMPLE.md", ".example.md"],
)
.await;
let res = get_user_instructions(&cfg)
.await
@@ -364,7 +387,7 @@ async fn skills_are_not_appended_to_project_doc() {
let tmp = tempfile::tempdir().expect("tempdir");
fs::write(tmp.path().join("AGENTS.md"), "base doc").unwrap();
let cfg = make_config(&tmp, 4096, None).await;
let cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
create_skill(
cfg.codex_home.clone(),
"pdf-processing",
@@ -380,7 +403,7 @@ async fn skills_are_not_appended_to_project_doc() {
#[tokio::test]
async fn apps_feature_does_not_emit_user_instructions_by_itself() {
let tmp = tempfile::tempdir().expect("tempdir");
let mut cfg = make_config(&tmp, 4096, None).await;
let mut cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
cfg.features
.enable(Feature::Apps)
.expect("test config should allow apps");
@@ -394,7 +417,7 @@ async fn apps_feature_does_not_append_to_project_doc_user_instructions() {
let tmp = tempfile::tempdir().expect("tempdir");
fs::write(tmp.path().join("AGENTS.md"), "base doc").unwrap();
let mut cfg = make_config(&tmp, 4096, None).await;
let mut cfg = make_config(&tmp, /*limit*/ 4096, /*instructions*/ None).await;
cfg.features
.enable(Feature::Apps)
.expect("test config should allow apps");