(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestApplySandboxDefaults(t *testing.T) { |
| 117 | tests := []struct { |
| 118 | name string |
| 119 | config *SandboxConfig |
| 120 | engine *EngineConfig |
| 121 | expected *SandboxConfig |
| 122 | expectDefaultWritePath bool |
| 123 | expectedAllowWrite []string |
| 124 | }{ |
| 125 | { |
| 126 | name: "nil config creates default with AWF", |
| 127 | config: nil, |
| 128 | engine: &EngineConfig{ID: "copilot"}, |
| 129 | expectDefaultWritePath: true, |
| 130 | expected: &SandboxConfig{ |
| 131 | Agent: &AgentSandboxConfig{ |
| 132 | Type: SandboxTypeAWF, |
| 133 | }, |
| 134 | }, |
| 135 | }, |
| 136 | { |
| 137 | name: "explicit AWF config preserved", |
| 138 | config: &SandboxConfig{ |
| 139 | Agent: &AgentSandboxConfig{ |
| 140 | Type: SandboxTypeAWF, |
| 141 | }, |
| 142 | }, |
| 143 | engine: &EngineConfig{ID: "copilot"}, |
| 144 | expectDefaultWritePath: true, |
| 145 | expected: &SandboxConfig{ |
| 146 | Agent: &AgentSandboxConfig{ |
| 147 | Type: SandboxTypeAWF, |
| 148 | }, |
| 149 | }, |
| 150 | }, |
| 151 | { |
| 152 | // version-only object (no id/type) must default to AWF so the sandbox is |
| 153 | // always enabled, matching the previous analysis of the smoke-gemini bug. |
| 154 | name: "version-only agent defaults to AWF", |
| 155 | config: &SandboxConfig{ |
| 156 | Agent: &AgentSandboxConfig{ |
| 157 | Version: "v0.25.29", |
| 158 | }, |
| 159 | }, |
| 160 | engine: &EngineConfig{ID: "gemini"}, |
| 161 | expectDefaultWritePath: true, |
| 162 | expected: &SandboxConfig{ |
| 163 | Agent: &AgentSandboxConfig{ |
| 164 | Type: SandboxTypeAWF, |
| 165 | Version: "v0.25.29", |
| 166 | }, |
| 167 | }, |
| 168 | }, |
| 169 | { |
| 170 | // An agent object with only an empty string ID must also default to AWF. |
| 171 | name: "empty ID agent defaults to AWF", |
| 172 | config: &SandboxConfig{ |
| 173 | Agent: &AgentSandboxConfig{}, |
nothing calls this directly
no test coverage detected