mirror of
https://github.com/openai/codex.git
synced 2026-05-04 21:32:21 +03:00
ci: sync Bazel clippy lints and fix uncovered violations (#16351)
## Why Follow-up to #16345, the Bazel clippy rollout in #15955, and the cleanup pass in #16353. `cargo clippy` was enforcing the workspace deny-list from `codex-rs/Cargo.toml` because the member crates opt into `[lints] workspace = true`, but Bazel clippy was only using `rules_rust` plus `clippy.toml`. That left the Bazel lane vulnerable to drift: `clippy.toml` can tune lint behavior, but it cannot set allow/warn/deny/forbid levels. This PR now closes both sides of the follow-up. It keeps `.bazelrc` in sync with `[workspace.lints.clippy]`, and it fixes the real clippy violations that the newly-synced Windows Bazel lane surfaced once that deny-list started matching Cargo. ## What Changed - added `.github/scripts/verify_bazel_clippy_lints.py`, a Python check that parses `codex-rs/Cargo.toml` with `tomllib`, reads the Bazel `build:clippy` `clippy_flag` entries from `.bazelrc`, and reports missing, extra, or mismatched lint levels - ran that verifier from the lightweight `ci.yml` workflow so the sync check does not depend on a Rust toolchain being installed first - expanded the `.bazelrc` comment to explain the Cargo `workspace = true` linkage and why Bazel needs the deny-list duplicated explicitly - fixed the Windows-only `codex-windows-sandbox` violations that Bazel clippy reported after the sync, using the same style as #16353: inline `format!` args, method references instead of trivial closures, removed redundant clones, and replaced SID conversion `unwrap` and `expect` calls with proper errors - cleaned up the remaining cross-platform violations the Bazel lane exposed in `codex-backend-client` and `core_test_support` ## Testing Key new test introduced by this PR: `python3 .github/scripts/verify_bazel_clippy_lints.py`
This commit is contained in:
@@ -312,8 +312,7 @@ fn lock_sandbox_dir(
|
||||
);
|
||||
if set != 0 {
|
||||
return Err(anyhow::anyhow!(
|
||||
"SetEntriesInAclW sandbox dir failed: {}",
|
||||
set
|
||||
"SetEntriesInAclW sandbox dir failed: {set}",
|
||||
));
|
||||
}
|
||||
let path_w = to_wide(dir.as_os_str());
|
||||
@@ -328,8 +327,7 @@ fn lock_sandbox_dir(
|
||||
);
|
||||
if res != 0 {
|
||||
return Err(anyhow::anyhow!(
|
||||
"SetNamedSecurityInfoW sandbox dir failed: {}",
|
||||
res
|
||||
"SetNamedSecurityInfoW sandbox dir failed: {res}",
|
||||
));
|
||||
}
|
||||
if !new_dacl.is_null() {
|
||||
@@ -424,7 +422,7 @@ fn real_main() -> Result<()> {
|
||||
});
|
||||
let report = SetupErrorReport {
|
||||
code: failure.code,
|
||||
message: failure.message.clone(),
|
||||
message: failure.message,
|
||||
};
|
||||
if let Err(write_err) = write_setup_error_report(&payload.codex_home, &report) {
|
||||
let _ = log_line(
|
||||
@@ -496,7 +494,7 @@ fn run_read_acl_only(payload: &Payload, log: &mut File) -> Result<()> {
|
||||
if !refresh_errors.is_empty() {
|
||||
log_line(
|
||||
log,
|
||||
&format!("read ACL run completed with errors: {:?}", refresh_errors),
|
||||
&format!("read ACL run completed with errors: {refresh_errors:?}"),
|
||||
)?;
|
||||
if payload.refresh_only {
|
||||
anyhow::bail!("read ACL run had errors");
|
||||
@@ -637,7 +635,7 @@ fn run_setup_full(payload: &Payload, log: &mut File, sbx_dir: &Path) -> Result<(
|
||||
}
|
||||
}
|
||||
|
||||
let cap_sid_str = caps.workspace.clone();
|
||||
let cap_sid_str = caps.workspace;
|
||||
let sandbox_group_sid_str =
|
||||
string_from_sid_bytes(&sandbox_group_sid).map_err(anyhow::Error::msg)?;
|
||||
let write_mask =
|
||||
@@ -895,7 +893,7 @@ fn run_setup_full(payload: &Payload, log: &mut File, sbx_dir: &Path) -> Result<(
|
||||
if refresh_only && !refresh_errors.is_empty() {
|
||||
log_line(
|
||||
log,
|
||||
&format!("setup refresh completed with errors: {:?}", refresh_errors),
|
||||
&format!("setup refresh completed with errors: {refresh_errors:?}"),
|
||||
)?;
|
||||
anyhow::bail!("setup refresh had errors");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user