feat(supabase): retry delay of 2, 5, 10, 20 s for technical verification failures

M6 amended in place (applied only to the throwaway sandbox): a hidden
not_before on the round, set by fail_sheet_verification and honoured by the
claim; RPC signatures unchanged. pgTAP 021 (68), sandbox cases i (delay with
the real worker), j (inputs at the caps, 2 MiB base), k (just beyond).
This commit is contained in:
bchanot committed 2026-11-01 21:09:00 +01:00
1 parent e967ce6736
commit 5adad3709f
8 files changed
+398 -29

No files matched your search

+32 -3
View File
@@ -175,7 +175,8 @@ cmake on Alpine). The decode child's traced syscall set did not change with
the parent's TLS code (§5.4 re-run at R1: the same seven). Image 11.6 MB
(8.7 MB at R0: ring + rustls). Tests: `crates/worker/tests/job_loop.rs` (11,
fake backend + fake decoder) and the module unit tests run natively; the
real-stack end-to-end runs through `pnpm e2e:avatar` (`STORAGE.md` §6).
real-stack end-to-end runs through `pnpm db:sandbox avatar-e2e` on the throwaway stack since V1-2.3
(`pnpm e2e:avatar` on DEV, the owner's call; `STORAGE.md` §6).
The sandboxed child, unchanged from R0:
@@ -4501,8 +4502,7 @@ Reviews (fresh, 2026-11-01, on `7043d39`):
password literal in `scripts/db-sandbox.sh`). LOWs fixed: the verdict cap measured twice (child output now
3 MiB, under the 4 MiB SQL measure of `jsonb::text`); the child's 1 GiB address space above the container's
512 MiB (`worker-verify` and the sandbox worker now 1 280 MiB, so the child's limit binds first). LOWs open: no
backoff between attempts (the §6.4 design « without backoff »: an outage of a few seconds can spend the five
attempts, the round closing `unavailable`; fail-closed, availability only); a document naming several hundred
backoff between attempts (closed afterwards by the owner decision of 2026-11-01: SQL delay of 2, 5, 10, 20 s, V1-2 contract §6.4; the finding as written on `7043d39` is left); a document naming several hundred
registered drawings overflows the 64 KiB frame header and is reported `resource_limit` instead of the core's
`caps` (wrong exit message, no security effect); SQL interpolation of generated ids in the sandbox test only.
- Verifier: ECARTS(2). W1-W5, W7 met. W6: the hostile corpus through the child was missing (added, above); `pnpm
@@ -4525,3 +4525,32 @@ WASM 580 522 B gzip in the app image, unchanged by V1-2.3); `pnpm e2e:shell` 86
Second reviews on `6aa85fe`: verifier ECARTS(1), the one item owner-gated (`pnpm e2e:avatar`, a worker on DEV), the
hostile corpus met; security PASS (MEDIUM pre-existing sandbox password literal; LOWs: the 3 MiB / 4 MiB relation is
empirical, a refused verdict ending fail-closed `verdict_refused`; DEPLOY.md memory note, fixed).
### 13.1 Reserves Q3 and Q4: inputs at the caps, `brk` bounded (2026-11-01)
Contract `.claude/tasks/contracts/2026-11-01-v1-2-3-reserves.md`. Fixtures (`fixtures.rs`, `test-hooks`): `verify_max_frame()`,
also `fixture verify-max`: document and base of exactly 2 097 152 bytes (the `jsonb::text` spelling, `": "` and `", "`,
filler in `attribution.notes`; the core measures `document_bytes` 2 097 152), four drawings of 2 097 152, 2 097 152,
1 048 576 and 1 048 576 bytes (6 291 456 in all), a frame of 10 486 658 bytes. A drawing is the stored prolog, a 10 × 10
root, 10 000 `<path d="M0 0L5 5"/>` and a last path whose `d` ends in as many spaces as the size needs. Unit tests run the
core on each fixture: the maximum is `passed`; four drawings of 2 MiB (no base), five drawings, one drawing of 2 097 153
bytes and a document of 2 097 153 bytes are `failed` with `verification.validation.caps` (content, exit 0).
Through the full sandbox (`tests/sandbox.rs`, now 31 tests): `the_maximum_input_is_verified_within_the_limits` (`passed`,
verdict 2 531 bytes, under the 3 MiB cap and the 90 s deadline), `inputs_just_beyond_the_caps_fail_as_caps_through_the_sandbox`,
`the_verify_input_cap_is_exact` (a frame of exactly 12 MiB is read, here refused by the frame check; one byte more is refused
unread by the existing test). Measured on the development host, release build, glibc, sandbox applied: the maximum 104 ms,
the sheet at every other cap (2 118 765 bytes in, 24 689 out) 142 ms. The Docker `test` stage passes the same tests; its
log does not print the timings (captured output).
`brk` in the verify child (`tests/sandbox.rs`, 1 GiB address space): `--alloc-gib 2` and the new hook
`--alloc-small-gib <n>` (4 KiB chunks kept alive, the small-allocation path) both end in SIGABRT and the survival
message never appears; `--mmap-exec` and `--signal-parent` die with SIGSYS; `--violate` was already covered. The CPU and
deadline hooks stay on the decode child. No syscall added to `ALLOWED_SYSCALLS`.
Derivation: `derive-seccomp.sh` also traces `fixture verify-max` through `verify --no-seccomp`; the traced set is
unchanged (`brk exit_group getrandom mmap mremap munmap read write`), the allowlist covers it.
The two misclassifications stay tracked, not fixed (`tests/verify_loop.rs`): a frame header over 64 KiB is reported
`resource_limit`; an object over the policy is passed without bytes and the verdict lists `caps` then `drawing_missing`
(its declared size already exceeds the cap), never `size_mismatch`.