Document why SandboxExecConfig::to_json cannot fail

Richard Feldman created

The struct contains only Strings, Vec<String>, and bool — no cycles
or non-serializable types — so the expect is justified.

Change summary

crates/terminal/src/sandbox_exec.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Detailed changes

crates/terminal/src/sandbox_exec.rs 🔗

@@ -112,7 +112,9 @@ impl SandboxExecConfig {
 
     /// Serialize the config to a JSON string for passing via CLI arg.
     pub fn to_json(&self) -> String {
-        serde_json::to_string(self).expect("failed to serialize sandbox config")
+        // This type is a flat struct of Strings, Vec<String>, and bool — no
+        // cycles or non-serializable types — so serialization cannot fail.
+        serde_json::to_string(self).expect("SandboxExecConfig is non-cyclic")
     }
 
     /// Deserialize a config from a JSON string.