code wiki / _hdl_build / nx_retry_policy_gate.nx

nx_retry_policy_gate.nx

buildroot/runtime/_hdl_build/nx_retry_policy_gate.nx

11900 B202 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_retry_policy_gate.nx -- TEETH FOR THE RETRY PRIMITIVE, written because its jitter was ADVERTISED AND INERT and nothing could see it. THE DEFECT (measured 2026-08-21, vocabulary census): nx_retry_policy_new set `p.jitter_enabled = 1` while nx_retry_compute_wait_seconds performed NO randomization -- its own comment said "v1 uses deterministic mid-jitter (multiply by 1.0)". A caller reading the flag believed the herd was decorrelated while every retry landed on the same instant. It failed in the FLATTERING direction, so nobody investigated, and the organ had NO GATE AT ALL -- the two facts are the same fact. THE TOOTH THAT MATTERS IS T2, AND IT IS BUILT TO FAIL AGAINST THE OLD CODE: two DIFFERENT callers drawing at the SAME instant must get DIFFERENT delays. Under the 1.0-multiplier version they get the same number, so T2 goes RED on the pre-fix source by construction -- that is what makes the GREEN worth anything. Every other tooth here would have passed before the fix. No files, no fixtures, no clock: the subject is pure arithmetic and the seed is explicit, so this gate is idempotent and cannot share a fixture with a production beat. license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_retry_policy.nx nx_gate_verdict.nx nx_retry_policy_gate.nx

imports: nx_retry_policy.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ rg_policy nx_retry_policy_new sys_mmap ↻ nx_retry_compute_wait_ms rs_jitter_ms gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_check gv_puts ↻ nx_retry_seed gv_bite gv_puts ↻ rg_eq nx_retry_policy_new ↻ nx_retry_apply_retry_after rs_jitter_ms ↻ nx_retry_policy_decide

structs

none

consts

23const RG_SEEDS: i64 = 64
27const RG_ATTEMPT: i64 = 3
28const RG_NOW: i64 = 1787000000

functions

30func rg_eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 }
called by 1: main
32func rg_policy(hk: i64, attempt: i64, jit: i64) -> *RetryPolicy
called by 1: main calls 1: nx_retry_policy_new
39func main() -> i64