mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
cli: rename sandbox permission profile flag (#30095)
## Why
`codex sandbox` accepts a single named permissions profile, so the
existing plural `--permissions-profile` spelling is misleading. The
canonical flag and its help text should use the singular form without
breaking scripts that already use the old spelling.
## What changed
- Make `--permission-profile` the canonical flag for all sandbox
backends.
- Keep `--permissions-profile` as a hidden backwards-compatible alias.
- Cover the canonical spelling, legacy alias, and help visibility with
regression tests.
## Testing
Ran `just c sandbox --help` and verified I saw:
```shell
-P, --permission-profile <NAME>
Named permissions profile to apply from the active configuration stack
```
This commit is contained in:
1 parent
6d9dbacf1a
commit
31b99f65cf
3 files changed
+49
-5
No files matched your search
+18
-3
@@ -53,7 +53,12 @@ pub struct SeatbeltCommand {
|
|||||||
pub sandbox_state: SandboxStateArgs,
|
pub sandbox_state: SandboxStateArgs,
|
||||||
|
|
||||||
/// Named permissions profile to apply from the active configuration stack.
|
/// Named permissions profile to apply from the active configuration stack.
|
||||||
#[arg(long = "permissions-profile", short = 'P', value_name = "NAME")]
|
#[arg(
|
||||||
|
long = "permission-profile",
|
||||||
|
alias = "permissions-profile",
|
||||||
|
short = 'P',
|
||||||
|
value_name = "NAME"
|
||||||
|
)]
|
||||||
pub permissions_profile: Option<String>,
|
pub permissions_profile: Option<String>,
|
||||||
|
|
||||||
/// Layer $CODEX_HOME/<name>.config.toml on top of the base user config.
|
/// Layer $CODEX_HOME/<name>.config.toml on top of the base user config.
|
||||||
@@ -104,7 +109,12 @@ pub struct LandlockCommand {
|
|||||||
pub sandbox_state: SandboxStateArgs,
|
pub sandbox_state: SandboxStateArgs,
|
||||||
|
|
||||||
/// Named permissions profile to apply from the active configuration stack.
|
/// Named permissions profile to apply from the active configuration stack.
|
||||||
#[arg(long = "permissions-profile", short = 'P', value_name = "NAME")]
|
#[arg(
|
||||||
|
long = "permission-profile",
|
||||||
|
alias = "permissions-profile",
|
||||||
|
short = 'P',
|
||||||
|
value_name = "NAME"
|
||||||
|
)]
|
||||||
pub permissions_profile: Option<String>,
|
pub permissions_profile: Option<String>,
|
||||||
|
|
||||||
/// Layer $CODEX_HOME/<name>.config.toml on top of the base user config.
|
/// Layer $CODEX_HOME/<name>.config.toml on top of the base user config.
|
||||||
@@ -142,7 +152,12 @@ pub struct WindowsCommand {
|
|||||||
pub sandbox_state: SandboxStateArgs,
|
pub sandbox_state: SandboxStateArgs,
|
||||||
|
|
||||||
/// Named permissions profile to apply from the active configuration stack.
|
/// Named permissions profile to apply from the active configuration stack.
|
||||||
#[arg(long = "permissions-profile", short = 'P', value_name = "NAME")]
|
#[arg(
|
||||||
|
long = "permission-profile",
|
||||||
|
alias = "permissions-profile",
|
||||||
|
short = 'P',
|
||||||
|
value_name = "NAME"
|
||||||
|
)]
|
||||||
pub permissions_profile: Option<String>,
|
pub permissions_profile: Option<String>,
|
||||||
|
|
||||||
/// Layer $CODEX_HOME/<name>.config.toml on top of the base user config.
|
/// Layer $CODEX_HOME/<name>.config.toml on top of the base user config.
|
||||||
|
|||||||
@@ -2962,7 +2962,28 @@ mod tests {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn sandbox_parses_permissions_profile() {
|
fn sandbox_parses_permission_profile() {
|
||||||
|
let cli = MultitoolCli::try_parse_from([
|
||||||
|
"codex",
|
||||||
|
"sandbox",
|
||||||
|
"--permission-profile",
|
||||||
|
":workspace",
|
||||||
|
"--",
|
||||||
|
"echo",
|
||||||
|
])
|
||||||
|
.expect("parse");
|
||||||
|
|
||||||
|
let Some(Subcommand::Sandbox(command)) = cli.subcommand else {
|
||||||
|
panic!("expected sandbox command");
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(command.permissions_profile.as_deref(), Some(":workspace"));
|
||||||
|
assert_eq!(command.command, vec!["echo"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
||||||
|
#[test]
|
||||||
|
fn sandbox_parses_legacy_permissions_profile_alias() {
|
||||||
let cli = MultitoolCli::try_parse_from([
|
let cli = MultitoolCli::try_parse_from([
|
||||||
"codex",
|
"codex",
|
||||||
"sandbox",
|
"sandbox",
|
||||||
@@ -2981,6 +3002,14 @@ mod tests {
|
|||||||
assert_eq!(command.command, vec!["echo"]);
|
assert_eq!(command.command, vec!["echo"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
||||||
|
#[test]
|
||||||
|
fn sandbox_help_only_shows_singular_permission_profile() {
|
||||||
|
let help = help_from_args(&["codex", "sandbox", "--help"]);
|
||||||
|
assert!(help.contains("--permission-profile"), "{help}");
|
||||||
|
assert!(!help.contains("--permissions-profile"), "{help}");
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn sandbox_parses_permissions_profile_short_alias() {
|
fn sandbox_parses_permissions_profile_short_alias() {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ mode = "full"
|
|||||||
.env("CODEX_HOME", codex_home.path())
|
.env("CODEX_HOME", codex_home.path())
|
||||||
.args([
|
.args([
|
||||||
"sandbox",
|
"sandbox",
|
||||||
"--permissions-profile",
|
"--permission-profile",
|
||||||
"network-test",
|
"network-test",
|
||||||
"--",
|
"--",
|
||||||
"curl",
|
"curl",
|
||||||
|
|||||||
Reference in new issue
Block a user