code wiki / (root) / nx_capcensus_gate.nx

nx_capcensus_gate.nx

buildroot/runtime/nx_capcensus_gate.nx

14870 B272 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_capcensus_gate.nx -- THE GATE FOR THE PICKED-CAP CENSUS. Subject: ./nx_capcensus.elf (the serving-root binary; e2e fork via nx_gatekit_lib's PROVEN capture primitive -- never a hand-rolled pipe/fork/wait, which deadlocked a sibling gate in production TODAY: pid 2240 sat 50+ minutes in pipe_wait with a frozen 91-byte artifact). WHAT THIS PROVES, and why each tooth exists: 1. the census DISCRIMINATES. A classifier that lumps every bound into one bucket is worthless, so the fixture plants one of EACH class and the teeth assert the exact split. This is the anti-vacuity tooth: a trivial "everything is PICKED" implementation CANNOT pass it. 2. it does not FALSELY ACCUSE. A derived-only fixture must yield PICKED=0 -- bitten as a neg-control pair (fires on the planted picked cap, silent on the derived one). 3. it cannot pass on the EMPTY SET. An empty directory yields population=0, and the tooth binds the population count IN its condition rather than printing it alongside. 4. the RATCHET cannot launder itself. cg_rise / cg_newbase are PURE functions of (live, base), so all three required directions are unit-provable and uncheatable by a live number: - fires on a rise cg_rise(30,20)==1 - tightens on a fall cg_newbase(10,20)==10 - REFUSES to rewrite the baseline on a rise cg_newbase(30,20)==20 That third one is the self-laundering defect the estate has banked; it is the reason the ratchet is expressed as a pure function instead of inline arithmetic at the call site. *** THE RATCHET GOVERNS PICKED CAPS ONLY -- NEVER A CAPABILITY AXIS. *** Operator, 2026-08-23: "a worse score with higher capabilities isnt worse its part of iteration as long as we have a roadmap to best of breed." A texture resolution raised 2048 -> 8192, a triangle budget grown to carry real surface detail, or an arena that grew because the asset grew are all CAPABILITY GROWTH and this ratchet must never be able to forbid them. It counts only bounds whose subject size is knowable at runtime and was PICKED anyway. The tooth is named for that limit so a future reader cannot mistake it for a capability ceiling -- which is exactly how the clay-figure mistake was made once already today. NOT ROSTER-ADMITTED: the full census forks a recursive 18k-file walk (~60 s). The gate roster beat kills at ~1,800 ms, so admitting this would manufacture a permanent timeout. Same precedent as the voxchunk gate. Run it via nx_job_run or /api/gate_run with the fixture-only verbs. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_gatekit_lib.nx nx_capcensus_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.nx

imported by: nobody (leaf or entry point)

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

main gk_streq cg_ratchet_live 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 ↻ gk_run_capture_ms gk_run_cap3 sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_setpgid sys_openat_rd sys_dup3 sys_execve sys_exit ↻ sys_sleep_ms sys_mmap ↻ sys_munmap nx_kill sys_now_realtime_ms sys_mmap ↻ sys_clock_gettime_real sys_poll sys_read sys_wait4 gk_wait_code

structs

none

consts

40const CG_ELF: *u8 = "./nx_capcensus.elf"
41const CG_DIR: *u8 = "/tmp/nxcapgate"
42const CG_MIX: *u8 = "/tmp/nxcapgate/mix"
43const CG_DER: *u8 = "/tmp/nxcapgate/der"
44const CG_EMPTY: *u8 = "/tmp/nxcapgate/empty"
45const CG_BASECONF: *u8 = "knowledge/capcensus_ratchet.conf"
48const CG_WIN: i64 = 262144
52const CG_CENSUS_DEADLINE_MS: i64 = 600000
55const CG_CONF_SCRATCH: i64 = 4096

functions

58func cg_rise(live: i64, base: i64) -> i64 { if live > base { return 1 } return 0 }
called by 2: cg_ratchet_livemain
59func cg_newbase(live: i64, base: i64) -> i64 { if live < base { return live } return base }
called by 2: cg_ratchet_livemain
61func cg_num_after(b: *u8, n: i64, key: *u8) -> i64
called by 2: cg_ratchet_livemain calls 1: gk_len
95func cg_ratchet_live() -> i64
164func main(argc: i64, argv: *i64) -> i64