Commit 573ec6b
committed
fix(runner+boxlite/rest): classify stopped-box exec as 409 and refuse overwrite=false over REST
Two related real bugs surfaced by the Tokyo e2e suite once the
deserialization gate stopped poisoning every list call:
1. test_files_io.py::test_copy_in_overwrite_false_rejects_conflict
Root cause: src/boxlite/src/rest/litebox.rs::copy_into named the
CopyOptions argument `_opts` — i.e. dropped on the floor. The REST
upload protocol is a single tar that the runner extracts over
container_dst unconditionally, so overwrite=false silently turned
into overwrite=true and the test's host file replaced the seeded
guest content. The test contract explicitly accepts a raised
exception ('the runtime behaviour can be either a raised exception
or a no-op (FFI raises) — either is acceptable; the contract is
the guest content must be unchanged'), so the REST backend now
returns BoxliteError::Unsupported up front rather than silently
clobbering. A real per-entry skip-if-exists implementation would
require an end-to-end protocol change (overwrite query param +
runner-side staged-vs-existing check); follow-up work, not in
scope for the gate.
2. test_execution_shutdown.py::test_exec_on_stopped_box_is_typed_error
Root cause: apps/runner/pkg/api/controllers/boxlite_exec.go ::
BoxliteExec wraps every execManager.Start error in a generic 500
('exec failed: ...'). A stopped-box exec surfaces from libboxlite as
the typed Go SDK code 11 (ErrStopped) — the SDK already exposes
sdkboxlite.IsStopped/IsInvalidState helpers for exactly this case.
Use them to map to 409 Conflict (box is in a state that can't
accept execs), so the response is a typed 4xx instead of a leaked
500 'Handle invalidated after stop()'.
Local-verified:
- cargo test -p boxlite --features rest rest::types::tests + the
new build_platform_ref / oversize cases still pass (44 passing,
the one pre-existing ws_watchdog_fires_when_idle flaky timing test
fails unrelated).
- cd apps/runner && go vet ./pkg/api/controllers/ clean (full link
needs libboxlite.a which the deploy pipeline rebuilds).1 parent 2d3adfe commit 573ec6b
2 files changed
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
77 | 91 | | |
78 | 92 | | |
79 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
216 | 235 | | |
217 | 236 | | |
218 | 237 | | |
| |||
0 commit comments