Commit 68d130c
committed
fix(sandbox): PR #12655 simplification — correctness fixes + test consolidation
Phase 1 (correctness): replace hand-rolled equality helpers with
pydantic-canonicalized `_normalize_section` (via `model_dump`); future field
additions to `InternetAccessConfig` / `PythonDependenciesConfig` now track
automatically. `_env_vars_equal` switches from `frozenset` to `Counter` so
duplicate multiplicity is preserved. Extend runtime `_resolve_user_env` to
reject reserved `EnvVarLiteral.name` symmetrically with the existing
`EnvVarSecretRef.secret_key` check, closing the pre-mutation-guard-row
exposure D7 was meant to close.
Phase 2 (test consolidation): drop three integration-layer duplicate files
(`test_env_var_end_to_end.py`, `test_credential_resolution_integration.py`,
`test_reserved_credential_names.py`) after folding unique scenarios into
their unit-level counterparts; prune pydantic-framework-rechecking tests
(`test_unknown_keys_preserved`, `test_empty_config_returns_defaults`, trivial
round-trips) from `test_sandbox_config_validation.py`; drop `backend._user_env`
internal-attribute assertions from `test_user_env_forwarding.py`; replace
`_BACKEND_CACHE` dict-shape peeks in `test_sandbox_cache_invalidation.py` with
identity-based observable checks; parametrize per-adapter shape assertions in
`test_capability_advertisement.py` over `SANDBOX_ADAPTER_METADATA.keys()`; add
module-level docstrings to `test_daytona_backend.py` / `test_vercel_backend.py`
/ `test_modal_backend.py` stating the per-adapter-files-only-for-unique-lifecycle
principle; move `test_sandbox_config_validation.py` from `tests/unit/server/api/`
to `tests/unit/server/sandbox/` (tests sandbox pydantic models, not API).
Phase 3 (clarity): rename `_PHOENIX_SANDBOX_FALLBACK_CREDENTIAL_KEYS` →
`_PHOENIX_RESERVED_CREDENTIAL_ONLY_KEYS` with an inline docstring distinguishing
it from `SandboxAdapter.credential_specs` and `RESERVED_CREDENTIAL_NAMES`.
Net: +599 / -718. All 429 sandbox-relevant tests pass.1 parent e78ce9f commit 68d130c
14 files changed
Lines changed: 599 additions & 718 deletions
File tree
- src/phoenix/server/sandbox
- tests/unit/server
- api
- mutations
- sandbox
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
391 | | - | |
392 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
394 | 399 | | |
395 | 400 | | |
396 | 401 | | |
| |||
624 | 629 | | |
625 | 630 | | |
626 | 631 | | |
627 | | - | |
| 632 | + | |
628 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
629 | 637 | | |
630 | 638 | | |
631 | 639 | | |
| |||
637 | 645 | | |
638 | 646 | | |
639 | 647 | | |
640 | | - | |
| 648 | + | |
641 | 649 | | |
642 | 650 | | |
643 | 651 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
| 326 | + | |
| 327 | + | |
328 | 328 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
341 | 340 | | |
342 | 341 | | |
343 | 342 | | |
344 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
345 | 350 | | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
349 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
350 | 375 | | |
351 | 376 | | |
352 | 377 | | |
353 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
354 | 383 | | |
355 | 384 | | |
356 | 385 | | |
357 | 386 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
361 | 390 | | |
362 | 391 | | |
363 | 392 | | |
364 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
365 | 399 | | |
366 | 400 | | |
367 | 401 | | |
368 | 402 | | |
369 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
370 | 410 | | |
371 | 411 | | |
372 | 412 | | |
| |||
580 | 620 | | |
581 | 621 | | |
582 | 622 | | |
583 | | - | |
584 | | - | |
| 623 | + | |
585 | 624 | | |
586 | 625 | | |
587 | 626 | | |
| |||
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | 201 | | |
206 | 202 | | |
207 | 203 | | |
| |||
216 | 212 | | |
217 | 213 | | |
218 | 214 | | |
219 | | - | |
220 | | - | |
221 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
222 | 225 | | |
223 | | - | |
224 | | - | |
| 226 | + | |
| 227 | + | |
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 72 | + | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
84 | 76 | | |
85 | 77 | | |
86 | | - | |
87 | 78 | | |
88 | 79 | | |
89 | 80 | | |
| |||
213 | 204 | | |
214 | 205 | | |
215 | 206 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
229 | 211 | | |
0 commit comments