code wiki / (root) / nx_gate_discover_test.nx

nx_gate_discover_test.nx

buildroot/runtime/nx_gate_discover_test.nx

6769 B137 linesdepth 7pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic gate
docsdependenciesstructsconstsfunctions

about

nx_gate_discover_test.nx -- GATE + proof for nx_gate_discover (the dynamic feed for the sovereign gate runner). NO LLM, no .sh: it self-asserts a known answer + sys_exit(0). PROVES, on the real _hdl_build/ directory: (1) DISCOVERY WORKS: scanning _hdl_build/ for *_test.nx finds a plausible, non-empty set of gates (verdict == NX_GD_OK). (2) IT FINDS THE KNOWN GATES: the three named gates from the runner's own enrolled list -- nx_superopt_test.nx, nx_rule_soundness_test.nx, nx_eqsat_membership_proof_test.nx -- are all in the discovered set (nx_gate_discover_find returns >= 0 for each). (3) IT CAN BE THE FEED FOR THE GATE RUNNER: each discovered entry carries a NUL-terminated ABSOLUTE path ending in "_test.nx", i.e. exactly the shape gr_gate(testnx: *u8) consumes. We assert the path of a known gate resolves to the expected absolute path string -- proving the path-join produced a runnable feed, without actually running 16 gates here (that is gr_gate's job; this organ proves the SET + PATHS). (4) FAIL-LOUD ON IMPLAUSIBLE COUNT (verify-before-enroll, negative control): scanning a directory with NO gates returns EMPTY (not OK), and a real scan with the floor enforced refuses any count below NX_GD_PLAUSIBLE_FLOOR. We exercise the floor branch with a deliberately-non-gate directory so the IMPLAUSIBLE/EMPTY path is genuinely taken -- a floor that has never fired on a real low-count input is not a guard. KNOWN ANSWER (FAIL LOUD), one line: "<verdict> <count_ge_floor> <found_superopt> <found_soundness> <found_membership> <path_ok> <neg_empty> <neg_floor_caught>" = "0 1 1 1 1 1 1 1 " run=0 verdict 0 = NX_GD_OK; count_ge_floor 1 = count >= NX_GD_PLAUSIBLE_FLOOR; the three found_* = each known gate present; path_ok 1 = a known gate's absolute path == the expected runner-shape string; neg_empty 1 = scanning a no-gate dir returned EMPTY; neg_floor_caught 1 = enforcing the floor on a no-gate dir returned EMPTY/IMPLAUSIBLE (NOT OK).

dependencies 1 imports · 0 importers

nx_gate_discover.nx nx_gate_discover_test.nx

imports: nx_gate_discover.nx

imported by: nobody (leaf or entry point)

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

main nx_gate_discover nx_dir_list nx_openat nx_dirent_read nx_dirent_iter nx_dir_is_dotlike nx_dir_name_strlen nx_dir_arena_copy_name gd_suffix gd_strlen nx_dir_row_at nx_dir_row_is_regular_file nx_dir_name_ends_with gd_arena_append nx_gate_discover_print gd_strlen ↻ nx_gate_discover_find gd_streq t_streq t_emit_num t_nl

structs

none

consts

37const HDL_DIR: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/runtime/_hdl_build"
41const NOGATE_DIR: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_offc"
43const WANT_SUPEROPT: *u8 = "nx_superopt_test.nx"
44const WANT_SOUNDNESS: *u8 = "nx_rule_soundness_test.nx"
45const WANT_MEMBERSHIP: *u8 = "nx_eqsat_membership_proof_test.nx"
49const EXPECT_SUPEROPT_PATH: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/runtime/_hdl_build/nx_superopt_test.nx"

functions

51func t_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } return n }
53func t_emit_num(v: i64) -> i64
called by 1: main
61func t_nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: main
63func t_streq(a: *u8, b: *u8) -> i64
called by 1: main
73func main() -> i64