code wiki / _hdl_build / nx_ale_gap_filer.nx

nx_ale_gap_filer.nx

buildroot/runtime/_hdl_build/nx_ale_gap_filer.nx

9764 B224 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic ale
docsdependenciesstructsconstsfunctions

about

nx_ale_gap_filer.nx -- ALE-R5 autonomy: turns the flywheel's gap LEDGER (knowledge/status/ ale_gaps.tsv lines "ALEGAP<TAB>task=<path><TAB>exit=<rc><TAB>score=<n>") into queue RUNGS so the RSI loop spins itself HANDS-OFF: flywheel detects a gap -> ledgers it -> THIS files a NOVEL "ALE-GAP-<id>" assignment (id = ALE-GAP- + sanitized task basename) -> the team builds the missing capability -> re-attempt closes the gap. IDEMPOTENT: an ALE-GAP-<id> already in the queue is skipped, and duplicate ledger lines collapse to ONE rung (so re-running every beat adds 0 dupes). LOCK-PROTECTED append (shared assignment_queue.tsv.lock) so it never races the beat. argv[1] = queue-path override (a scratch queue, no lock) for dry-run; no-arg => LIVE. BAKED SELF-TEST FIRST (scratch ledger w/ a DUP + scratch queue): control_pos files exactly 1, control_idem re-run files 0; mismatch -> RED + nonzero exit, the real queue UNTOUCHED. MAINLESS-LIB import convention (nx_registry_lock pulls nx_syscalls transitively; do NOT also import nx_syscalls). license_tier: ORIGINAL module: nishi-core.ale.gap_filer depends: nishi-core.autonomy.registry_lock capability: ALE_GAP_AUTOFILE

dependencies 2 imports · 0 importers

nx_registry_lock.nx nx_itoa_lib.nx nx_ale_gap_filer.nx

imports: nx_registry_lock.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main gf_selftest gf_write_file sys_openat_wr gf_len gf_process gf_read sys_read sys_openat_append gf_extract_task gf_len ↻ gf_basename_id gf_len ↻ gf_id_present gf_len ↻ gf_w gf_read ↻ gf_id_present ↻ gf_w ↻ gf_wn nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap gf_w ↻ rt_lock rt_writeint_fd sys_mmap ↻ sys_write ↻ rt_now sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real rt_readint sys_openat_rd sys_mmap ↻ sys_read ↻ sys_close rt_unlink

structs

none

consts

19const GF_MAGIC_262144: i64 = 262144
20const GF_MAGIC_131072: i64 = 131072
21const GF_MAGIC_2048: i64 = 2048
22const GF_MAGIC_65536: i64 = 65536
24const GF_QCAP: i64 = 1048576

functions

26func gf_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
31func gf_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 2: gf_selftestmain calls 1: nxi_fd
32func gf_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
34func gf_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 2: gf_processgf_selftest calls 1: sys_read
48func gf_write_file(path: *u8, s: *u8) -> i64
called by 1: gf_selftest calls 2: sys_openat_wrgf_len
58func gf_basename_id(path: *u8, out: *u8) -> i64
called by 1: gf_process calls 1: gf_len
89func gf_id_present(buf: *u8, n: i64, id: *u8) -> i64
called by 2: gf_processgf_selftest calls 1: gf_len
111func gf_extract_task(buf: *u8, ls: i64, le: i64, out: *u8) -> i64
called by 1: gf_process
132func gf_process(ledgerpath: *u8, qpath: *u8) -> i64
180func gf_selftest() -> i64
203func main(argc: i64, argv: *i64) -> i64