code wiki / _hdl_build / _fetch_bounded_gate.nx

_fetch_bounded_gate.nx

buildroot/runtime/_hdl_build/_fetch_bounded_gate.nx

13019 B268 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic fetch
docsdependenciesstructsconstsfunctions

about

_fetch_bounded_gate.nx -- RES-R7 gate: bounded fetch (timeout + no silent truncation). Proves the nx_fetch_bounded capability with a SOVEREIGN, network-free harness: a sys_pipe2 stands in for any readable fd (socket/TLS/file). Write a body into the pipe's write end, drain it through the new bounded consumer, and assert the contract. REQUIRED CHECKS (each computed from a REAL drain, no fabrication): POS-1 small body fully consumed -> FB_OK, counted==1000 POS-2 >512KB body, NO SILENT TRUNCATION -> FB_OVERFLOW, counted==600000 (explicit code + FULL counted length, never clamped to cap) TIMEOUT stalled read returns in budget -> FB_TIMEOUT, elapsed<1000ms NEG-CTL OLD br_drain on same >512KB body truncates at cap with NO signal -> proves the test can actually detect truncation TAMPER tiny cap on a 1000-byte body -> FB_OVERFLOW, never FB_OK A GREEN requires BOTH (old path truncates, == cap, silently) AND (new path returns FB_OVERFLOW with the full count) AND (timeout returns within budget). If the new consumer ever silently clamped like the old one, POS-2 / TAMPER fail RED. build/placement: harness resolves `_fetch_bounded_gate` -> runtime/_hdl_build/_fetch_bounded_gate.nx (1st match). expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_fetch_bounded.nx _fetch_bounded_gate.nx

imports: nx_fetch_bounded.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main st_puts gate_pipe sys_pipe2 gate_fill_pipe fb_drain_bounded sys_now_us sys_mmap sys_clock_gettime_mono sys_mmap ↻ fb_wait_readable sys_now_us ↻ sys_mmap ↻ fb_pfd_set sys_poll sys_read st_putn sys_fork sys_wait4 sys_now_ms sys_mmap ↻ sys_clock_gettime_mono ↻ gate_old_drain sys_read ↻ sys_openat_append st_fdn

structs

none

consts

none

functions

31func st_puts(s: *u8) -> i64
called by 1: main
37func st_putn(v: i64) -> i64
called by 1: main
51func st_fdn(fd: i64, v: i64) -> i64
called by 1: main
71func gate_old_drain(fd: i64, buf: *u8, cap: i64) -> i64
called by 1: main calls 1: sys_read
88func gate_pipe(rfd: *i64, wfd: *i64) -> i64
called by 1: main calls 1: sys_pipe2
101func gate_fill_pipe(wfd: i64, n: i64) -> i64
called by 1: main
115func main() -> i64