feat(worker): R1 job loop — claim, download, sandboxed decode, clean upload, commit, purge sweeps

Keyed parent on ureq 3 (rustls + ring, bundled roots), no async runtime:
config from the environment (secret never printed, JWT expiry logged), JSON
line logs with a field allowlist (child stderr escaped and truncated), strict
key validation before any URL, Backend trait over PostgREST RPCs and Storage
objects with closed error kinds, one job per claim with the STORAGE.md §3.4
mapping (content codes, processing_error on signals / timeout / overflow,
Broken stops the loop with exit 20, a refused commit deletes nothing), sweeper
(expire pending, purge queue, quarantine leftovers), per-stage watchdog
(exit 21), WORKER_ONCE for tests, run --check extended. 11 loop tests on a
fake backend and decoder; sandbox tests and seccomp derivation unchanged
(the child still makes the same 7 syscalls); image 11.6 MB.
This commit is contained in:
bchanot committed 2026-10-13 19:32:38 +02:00
1 parent 926dd7df8c
commit 0410af0c35
18 files changed
+2921 -42

No files matched your search

+4
View File
@@ -29,6 +29,10 @@ libwebp-sys = "0.14.4"
seccompiler = "0.5.0"
rlimit = "0.11"
libc = "0.2"
# Worker job loop (R1): blocking HTTP client (rustls + ring, bundled webpki roots for a managed
# Supabase over HTTPS) and the hash of the clean output. No async runtime: the loop is sequential.
ureq = { version = "3.4.2", default-features = false, features = ["rustls", "json"] }
sha2 = "0.11"
# The library crates deny unwrap/expect so that no panic path depends on content;
# the worker binary relaxes disallowed_methods (it owns I/O) in its own [lints].