code wiki / (root) / nx_communitypulse_gate.nx

nx_communitypulse_gate.nx

buildroot/runtime/nx_communitypulse_gate.nx

28028 B396 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_communitypulse_gate.nx -- THE GATE FOR THE COMMUNITY PULSE (2026-08-24). SUBJECT: the nx_communitypulse ELF, forked for real with a fresh store per run (/tmp/<gate>/r<usec>/), so the gate is idempotent by construction: nothing measured here was inherited from an earlier run. FIXTURE: a six-cell forest nation > region > locality > {church a, agency b, nonprofit c}; a one-item pulse instrument; kiosk ballots a=7 b=6 c=2 under k=5. That shape is chosen so every release state occurs at once: a and b PUBLISHED, c WITHHELD-UNDER-K, the locality WITHHELD-COMPLEMENTARY (15 - 7 - 6 = 2 contributors would be isolatable), the region PUBLISHED (its only child is withheld, residual 15), the nation PUBLISHED (residual 0). Every expected number below is derived from those ballots by hand and asserted exactly; no tooth passes on an empty set (the fixture-reached-the-condition teeth come first). Every negative control is a gv_bite: fires on the crafted bad input AND stays silent on the good one.

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_communitypulse_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.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 ↻ gv_puts ↻ sys_mmap ↻ sys_mkdir cpg_cat cpg_catn sys_mmap ↻ sys_now_us sys_mmap ↻ sys_clock_gettime_mono cpg_path sys_mmap ↻ cpg_cat ↻ cpg_write_text sys_openat_wr sys_write ↻ sys_close cpg_file_has sys_mmap ↻ sys_read_file sys_openat_rd

structs

none

consts

16const CPG_SUBJECT_DEFAULT: *u8 = "_offc/nx_communitypulse.elf"
17const CPG_DIR: *u8 = "/tmp/nx_communitypulse_gate"
18const CPG_EXIT_OK: i64 = 0
19const CPG_EXIT_REFUSED: i64 = 1
20const CPG_EXIT_USAGE: i64 = 2
21const CPG_EXIT_UNOBSERVABLE: i64 = 3
22const CPG_MODE_DIR: i64 = 493 // 0755
23const CPG_CAPTURE_CAP: i64 = 65536
24const CPG_PATH_CAP: i64 = 512
25const CPG_ARGV_SLOTS: i64 = 16
26const CPG_WORD: i64 = 8
27const CPG_CONF_BYTES: i64 = 4096
28const CPG_NUM_BYTES: i64 = 32
29const CPG_SMALL: i64 = 16
30const CPG_ASCII_DASH: i64 = 45
31const CPG_ASCII_ZERO: i64 = 48
32const CPG_DECIMAL: i64 = 10
33const CPG_LP_BYTES: i64 = 16
34const CPG_ASCII_NL: i64 = 10
35const CPG_ASCII_M: i64 = 77
37const CPG_K: i64 = 5
38const CPG_RATE_MAX: i64 = 7
39const CPG_WINDOW_US: i64 = 3600000000 // one hour: every fixture ballot is inside it, so the trend halves cannot both clear k
40const CPG_A_DENOM: i64 = 100
41const CPG_B_DENOM: i64 = 50
42const CPG_C_DENOM: i64 = 20
43const CPG_A_N: i64 = 7
44const CPG_EXPECT_A_MEAN: *u8 = "|own=7|total=7|PUBLISHED|mean_pm=6285|" // 2+3+3+8+9+9+10 = 44; 44000/7
45const CPG_EXPECT_B_MEAN: *u8 = "|own=6|total=6|PUBLISHED|mean_pm=8000|" // 6+7+8+8+9+10 = 48; 48000/6
46const CPG_EXPECT_C: *u8 = "row|c|nonprofit|l1|own=2|total=2|WITHHELD-UNDER-K|"
47const CPG_EXPECT_L1: *u8 = "row|l1|locality|r1|own=0|total=15|WITHHELD-COMPLEMENTARY|"
48const CPG_EXPECT_R1: *u8 = "row|r1|region|n1|own=0|total=15|PUBLISHED|mean_pm=6866|" // (44+48+11)*1000/15
49const CPG_EXPECT_N1: *u8 = "row|n1|nation|-|own=0|total=15|PUBLISHED|mean_pm=6866|"
50const CPG_EXPECT_PART: *u8 = "partition published=4 withheld_k=1 withheld_comp=1 sum=6 cells=6 SUMS"
51const CPG_EXPECT_BALLOTS: *u8 = "ballots own_sum=15 roots_total=15 SUMS"
52const CPG_EXPECT_WEIGHTED_R1: *u8 = "weighted|r1|PUBLISHED|wmean_pm=6697|denom_sum=170|leaves=3" // (6285*100 + 8000*50 + 5500*20) / 170

functions

56func cpg_write_text(path: *u8, s: *u8) -> i64
66func cpg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off + i] = s[i]; i = i + 1 } return off + i }
67func cpg_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
78func cpg_path(dir: *u8, leaf: *u8) -> *u8
called by 1: main calls 2: sys_mmapcpg_cat
87func cpg_run(subject: *u8, conf: *u8, verb: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, a5: *u8, a6: *u8, a7: *u8) -> i64
111func cpg_has(needle: *u8) -> i64 { return tr_contains(cpg_cap_g, cpg_olen_g[0], needle) }
called by 1: main calls 1: tr_contains
112func cpg_file_has(path: *u8, needle: *u8) -> i64
118func cpg_nil() -> *u8 { return 0 as *u8 }
called by 2: cpg_kiosk1main
119func cpg_kiosk1(subject: *u8, conf: *u8, prefix: *u8, cell: *u8, v: *u8) -> i64
called by 1: main calls 4: sys_mmapcpg_catcpg_runcpg_nil
127func main(argc: i64, argv: *i64) -> i64