feat(worker): V1-2.3 sandboxed verify child and sheet-verify job mode

This commit is contained in:
bchanot committed 2026-11-01 17:20:07 +01:00
1 parent 345dde59e6
commit 31fbb0317f
24 files changed
+2145 -87

No files matched your search

+25 -1
View File
@@ -1,7 +1,10 @@
//! Caps of the decode child (review Part IV.1 and STEP8_FILES_ANALYSIS II.5 step 6).
//! Caps of the decode child (review Part IV.1 and STEP8_FILES_ANALYSIS II.5 step 6) and of the
//! verify child (V1-2.3).
use std::time::Duration;
use faunosteo_core::domain::archive::snapshot::SnapshotCaps;
/// Largest accepted upload (STEP8 D4: 5 MiB at upload).
pub const MAX_INPUT_BYTES: usize = 5 * 1024 * 1024;
/// Largest output the parent reads before killing the child (a 512 × 512 WebP is ~30 KB).
@@ -24,3 +27,24 @@ pub const CHILD_CPU_SECONDS: u64 = 10;
pub const CHILD_DEADLINE: Duration = Duration::from_secs(20);
/// Oldest libwebp the worker accepts to link (D-R4: the linked version is controlled).
pub const MIN_LIBWEBP_VERSION: (u8, u8, u8) = (1, 6, 0);
/// Caps of the `verify` child (V1-2.3, contract W3), sized on the at-caps fixture: the
/// document and the base (2 MiB each, SQL CHECK), four drawings (6 MiB in all,
/// `SnapshotCaps::ASSETS*`), the header and a margin.
pub const VERIFY_MAX_INPUT_BYTES: usize = 12 * 1024 * 1024;
/// Largest frame header (ids and drawing rows, a few KiB in practice).
pub const VERIFY_MAX_HEADER_BYTES: usize = 64 * 1024;
/// Largest verdict the parent reads (= SQL `sheet_verification_max_verdict_bytes`).
pub const VERIFY_MAX_OUTPUT_BYTES: usize = 4 * 1024 * 1024;
/// Hard address-space cap of the `verify` child (`RLIMIT_AS`).
pub const VERIFY_ADDRESS_SPACE_BYTES: u64 = 1024 * 1024 * 1024;
/// CPU-time cap of the `verify` child (`RLIMIT_CPU`, seconds).
pub const VERIFY_CPU_SECONDS: u64 = 60;
/// Wall-clock deadline of the `verify` child (contract budget: under 120 s at the caps).
pub const VERIFY_DEADLINE: Duration = Duration::from_secs(90);
/// Drawings the parent downloads for one verification, at most.
pub const VERIFY_MAX_DRAWINGS: usize = SnapshotCaps::ASSETS;
/// Largest drawing the parent downloads.
pub const VERIFY_MAX_DRAWING_BYTES: usize = SnapshotCaps::ASSET_BYTES;
/// Largest total of the drawings downloaded for one verification.
pub const VERIFY_MAX_DRAWINGS_TOTAL_BYTES: usize = SnapshotCaps::ASSETS_TOTAL_BYTES;