code wiki / (root) / nx_forkgrade_gate.nx

nx_forkgrade_gate.nx

buildroot/runtime/nx_forkgrade_gate.nx

11848 B188 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_forkgrade_gate.nx -- CE8 (codeeffectiveness fg_trend): does the fork census leave a TRAJECTORY, and only where it should? END-TO-END: forks the promoted nx_forkgrade (or the <subject_elf> given as argv[1], absolutised against the CWD) over a THREE-FILE fixture pair it plants under /tmp -- identical, A-superset, bidirectional -- so the census has known answers, then asserts the ONE new capability: every successful census appends one row to a spine, announced (spine= fd= wrote= of=), and two censuses in time leave two rows. The spine path is DERIVED from dirA, so the fixture writes a SIDECAR beside its own root and the PRODUCTION spine (knowledge/status/forkgrade.spine) is asserted UNCHANGED by size: a trial run can never forge the production trajectory. Every expected count below was decided from the fixture before the run. RED against the pre-fg_trend binary by construction (no spine line, no sidecar): the RED-before-GREEN this gate owes. The subject forks nx_srcdiff.elf by BARE NAME from its CWD, so the run is started in the directory where that ruler resolves (CWD or its parent) -- derived from data, never a pinned absolute path; absent ruler = SKIP, never RED. exit: 0 GREEN . 1 RED . 3 SKIP license_tier: ORIGINAL No hw writes.

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_forkgrade_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 ↻ sys_mmap ↻ fgg_subject_from_argv sys_mmap ↻ sys_getcwd sys_mmap ↻ fgg_cat fgg_exists sys_openat_rd sys_close fgg_resolve sys_mmap ↻ sys_getcwd ↻ fgg_cat ↻ fgg_exists ↻ gv_puts ↻ gv_need gv_puts ↻ gv_verdict gv_note_bare_rate gv_bare_rate

structs

none

consts

17const FGG_PATH: i64 = 1024
18const FGG_CAP: i64 = 1048576
19const FGG_TMO: i64 = 60000
20const FGG_ARGV: i64 = 8
21const FGG_WORD: i64 = 8
22const FGG_MODE_RWX: i64 = 493
23const FGG_MODE_RW: i64 = 420
24const FGG_ROOT: *u8 = "/tmp/nx_forkgrade_gate"
25const FGG_DIRA: *u8 = "/tmp/nx_forkgrade_gate/A"
26const FGG_DIRB: *u8 = "/tmp/nx_forkgrade_gate/B"
27const FGG_LIST: *u8 = "/tmp/nx_forkgrade_gate/list.txt"
28const FGG_SIDECAR: *u8 = "/tmp/nx_forkgrade_gate/A.forkgrade.spine"
29const FGG_PROD_SPINE: *u8 = "knowledge/status/forkgrade.spine"
30const FGG_RULER: *u8 = "/nx_srcdiff.elf"
31const FGG_NFILES: i64 = 3
32const FGG_EXPECT_ADOPTABLE_PERMIL: i64 = 666 // (identical 1 + a_superset 1) * 1000 / 3 pairs, hand-computed from the fixture
33const FGG_ZERO: i64 = 48
34const FGG_NINE: i64 = 57
35const FGG_NL: i64 = 10
36const FGG_SLASH: i64 = 47

functions

38func fgg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
39func fgg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { dst[o] = s[i]; o = o + 1; i = i + 1 } dst[o] = 0 as u8; return o }
40func fgg_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 2: fgg_hasfgg_num_after calls 1: fgg_slen
47func fgg_has(buf: *u8, n: i64, needle: *u8) -> i64 { if fgg_find(buf, n, needle) >= 0 { return 1 } return 0 }
called by 1: main calls 1: fgg_find
48func fgg_num_after(buf: *u8, n: i64, key: *u8) -> i64
called by 1: main calls 2: fgg_findfgg_slen
58func fgg_write(path: *u8, text: *u8) -> i64
68func fgg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
70func fgg_size(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let s: i64 = sys_lseek(fd, 0, 2); sys_close(fd); return s }
73func fgg_lines(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
82func fgg_subject_from_argv(a1: *u8, out: *u8) -> i64
88func fgg_resolve(out: *u8) -> i64
104func fgg_ruler_root(out: *u8) -> i64
120func fgg_run(gen: *u8, root: *u8, out: *u8, outlen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture_cwd
126func main(argc: i64, argv: *i64) -> i64