refactor(sandboxing): gate test-only legacy sandbox helpers behind cfg(test)#158
Closed
andrei-hasna wants to merge 1 commit into
Closed
Conversation
andrei-hasna
force-pushed
the
openloops/open-codewith/b51df40e-166b-4807-a61a-df24b809ca25-e64149d4
branch
from
July 6, 2026 19:08
328cc3f to
5fcbdb5
Compare
…g(test) Replace cfg_attr(not(test), allow(dead_code)) with cfg(test) on the legacy sandbox helper functions that are only exercised by tests. Live public entrypoints remain compiled in production, while the legacy helper coverage remains available to cfg(test) modules.
andrei-hasna
force-pushed
the
openloops/open-codewith/b51df40e-166b-4807-a61a-df24b809ca25-e64149d4
branch
from
July 6, 2026 19:53
5fcbdb5 to
f21c873
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prunes test-only legacy sandbox helpers from production builds. Replaces
#[cfg_attr(not(test), allow(dead_code))]with#[cfg(test)]on the three sandbox helpers that are only exercised by tests, so non-test builds no longer compile dead compatibility/test-only code and theallow(dead_code)suppressions are gone.Affected helpers:
codex-rs/sandboxing/src/seatbelt.rs—dynamic_network_policycodex-rs/sandboxing/src/seatbelt.rs—create_seatbelt_command_args_for_legacy_policycodex-rs/sandboxing/src/landlock.rs—create_linux_sandbox_command_argsThe helpers stay available to the
#[cfg(test)] mod testsmodules viause super::..., so seatbelt/landlock legacy-policy coverage is unchanged.Safety
create_seatbelt_command_args,create_linux_sandbox_command_args_for_permission_profile.dynamic_network_policy_for_networkkeeps its production caller insidecreate_seatbelt_command_args(seatbelt.rs:706).Validation
just check-fast -p codex-sandboxing— pass (production build compiles without the helpers)just test-fast -p codex-sandboxing— 50/50 tests passjust fix -p codex-sandboxing— clippy cleanjust fmt— no changes to scoped filesCloses dead-code remediation task
b51df40e-166b-4807-a61a-df24b809ca25.🤖 Generated with Claude Code