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
2026-03-27 19:00:44 -07:00
committed by GitHub
parent ed977b42ac
commit 61dfe0b86c
307 changed files with 7724 additions and 4710 deletions
+4 -1
View File
@@ -132,6 +132,9 @@ just argument-comment-lint -p codex-core
If no package selection is provided, `run-prebuilt-linter.sh` defaults to checking the
`codex-rs` workspace with `--workspace --no-deps`.
For non-`--fix` runs, both wrappers also default the underlying Cargo
invocation to `--all-targets` unless you explicitly narrow the target set, so
workspace and package lint runs both cover test-only call sites by default.
Repo runs also promote `uncommented_anonymous_literal_argument` to an error by
default:
@@ -152,7 +155,7 @@ CARGO_INCREMENTAL=1 \
./tools/argument-comment-lint/run.sh -p codex-core
```
To expand target coverage for an ad hoc run:
To override an explicitly narrow target selection, or to be explicit in scripts:
```bash
./tools/argument-comment-lint/run-prebuilt-linter.sh -p codex-core -- --all-targets
@@ -10,9 +10,39 @@ has_manifest_path=false
has_package_selection=false
has_library_selection=false
has_no_deps=false
has_cargo_target_selection=false
has_fix=false
after_separator=false
expect_value=""
lint_args=()
cargo_args=()
for arg in "$@"; do
if [[ "$after_separator" == true ]]; then
cargo_args+=("$arg")
case "$arg" in
--all-targets|--lib|--bins|--tests|--examples|--benches|--doc)
has_cargo_target_selection=true
;;
--bin|--test|--example|--bench)
has_cargo_target_selection=true
;;
--bin=*|--test=*|--example=*|--bench=*)
has_cargo_target_selection=true
;;
esac
continue
fi
case "$arg" in
--)
after_separator=true
continue
;;
esac
lint_args+=("$arg")
if [[ -n "$expect_value" ]]; then
case "$expect_value" in
manifest_path)
@@ -30,9 +60,6 @@ for arg in "$@"; do
fi
case "$arg" in
--)
break
;;
--manifest-path)
expect_value="manifest_path"
;;
@@ -45,6 +72,9 @@ for arg in "$@"; do
--package=*)
has_package_selection=true
;;
--fix)
has_fix=true
;;
--lib|--lib-path)
expect_value="library_selection"
;;
@@ -60,17 +90,25 @@ for arg in "$@"; do
esac
done
lint_args=()
final_args=()
if [[ "$has_manifest_path" == false ]]; then
lint_args+=(--manifest-path "$manifest_path")
final_args+=(--manifest-path "$manifest_path")
fi
if [[ "$has_package_selection" == false ]]; then
lint_args+=(--workspace)
final_args+=(--workspace)
fi
if [[ "$has_no_deps" == false ]]; then
lint_args+=(--no-deps)
final_args+=(--no-deps)
fi
if [[ "$has_fix" == false && "$has_cargo_target_selection" == false ]]; then
cargo_args+=(--all-targets)
fi
if [[ ${#lint_args[@]} -gt 0 ]]; then
final_args+=("${lint_args[@]}")
fi
if [[ ${#cargo_args[@]} -gt 0 ]]; then
final_args+=(-- "${cargo_args[@]}")
fi
lint_args+=("$@")
if ! command -v dotslash >/dev/null 2>&1; then
cat >&2 <<EOF
@@ -159,6 +197,6 @@ command=("$cargo_dylint" dylint --lib-path "$normalized_library_path")
if [[ "$has_library_selection" == false ]]; then
command+=(--all)
fi
command+=("${lint_args[@]}")
command+=("${final_args[@]}")
exec "${command[@]}"
+47 -9
View File
@@ -13,7 +13,12 @@ has_manifest_path=false
has_package_selection=false
has_no_deps=false
has_library_selection=false
has_cargo_target_selection=false
has_fix=false
after_separator=false
expect_value=""
lint_args=()
cargo_args=()
ensure_local_prerequisites() {
if ! command -v cargo-dylint >/dev/null 2>&1 || ! command -v dylint-link >/dev/null 2>&1; then
@@ -52,6 +57,31 @@ set_default_env() {
}
for arg in "$@"; do
if [[ "$after_separator" == true ]]; then
cargo_args+=("$arg")
case "$arg" in
--all-targets|--lib|--bins|--tests|--examples|--benches|--doc)
has_cargo_target_selection=true
;;
--bin|--test|--example|--bench)
has_cargo_target_selection=true
;;
--bin=*|--test=*|--example=*|--bench=*)
has_cargo_target_selection=true
;;
esac
continue
fi
case "$arg" in
--)
after_separator=true
continue
;;
esac
lint_args+=("$arg")
if [[ -n "$expect_value" ]]; then
case "$expect_value" in
manifest_path)
@@ -69,9 +99,6 @@ for arg in "$@"; do
fi
case "$arg" in
--)
break
;;
--manifest-path)
expect_value="manifest_path"
;;
@@ -84,6 +111,9 @@ for arg in "$@"; do
--package=*)
has_package_selection=true
;;
--fix)
has_fix=true
;;
--workspace)
has_package_selection=true
;;
@@ -99,17 +129,25 @@ for arg in "$@"; do
esac
done
lint_args=()
final_args=()
if [[ "$has_manifest_path" == false ]]; then
lint_args+=(--manifest-path "$manifest_path")
final_args+=(--manifest-path "$manifest_path")
fi
if [[ "$has_package_selection" == false ]]; then
lint_args+=(--workspace)
final_args+=(--workspace)
fi
if [[ "$has_no_deps" == false ]]; then
lint_args+=(--no-deps)
final_args+=(--no-deps)
fi
if [[ "$has_fix" == false && "$has_cargo_target_selection" == false ]]; then
cargo_args+=(--all-targets)
fi
if [[ ${#lint_args[@]} -gt 0 ]]; then
final_args+=("${lint_args[@]}")
fi
if [[ ${#cargo_args[@]} -gt 0 ]]; then
final_args+=(-- "${cargo_args[@]}")
fi
lint_args+=("$@")
ensure_local_prerequisites
set_default_env
@@ -118,6 +156,6 @@ cmd=(cargo dylint --path "$lint_path")
if [[ "$has_library_selection" == false ]]; then
cmd+=(--all)
fi
cmd+=("${lint_args[@]}")
cmd+=("${final_args[@]}")
exec "${cmd[@]}"