Commit d17b90c
fix(cli): #19 codex P2 v2 — pre-flight --env validation before backend I/O
Two correctness issues from the second codex pass on PR #19:
1. Pre-flight --env validation ran AFTER the master-session
list_credentials() call, so a malformed `--env NO_EQUALS` could still
produce a backend round-trip and a list/DENIED audit row before the
parse error fired. Move the validation loop above the
list_credentials branch so the pre-flight guarantee in the comment
actually holds for the master-session path.
2. The validation only checked for the presence of '=', so `--env =foo`
(empty KEY) and `--env BAR=` (empty SERVICE) were accepted and then
blew up later as opaque runtime errors (empty env-var name passed to
process spawn / empty service name passed to read_credential).
Reject both up front with a clear "KEY must not be empty" /
"SERVICE must not be empty" message.
Tests: cmd_run_env_flag_empty_key_rejected,
cmd_run_env_flag_empty_service_rejected.
Test: cargo test -p agentkeys-cli -- --test-threads=1 → 20 passed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1a09a69 commit d17b90c
2 files changed
Lines changed: 70 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
163 | 188 | | |
164 | 189 | | |
165 | 190 | | |
| |||
172 | 197 | | |
173 | 198 | | |
174 | 199 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | 200 | | |
187 | 201 | | |
188 | 202 | | |
| |||
214 | 228 | | |
215 | 229 | | |
216 | 230 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 231 | + | |
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
0 commit comments