code wiki / (root) / nx_compare_regen_scoped.nx

nx_compare_regen_scoped.nx

buildroot/runtime/nx_compare_regen_scoped.nx

75245 B1179 linesdepth 8pulls 24 transitivereach 0 importersview sourcekind tooltopic compare
docsdependenciesstructsconstsfunctions

about

nx_compare_regen.nx -- ON-NAS regeneration of the whole Nishi Compare publish surface (operator 2026-07-09: "no frozen snapshots"). Re-MEASURES every matrix domain against the synced source tree (buildroot/runtime), GATE-CHECKED: for each artifact the generator's liar-kill gate must exit 0 FIRST -- a RED measurement is NEVER published (fail-closed). Then emits json+html per domain + the hub index json/html + the in-code OpenAPI, and hot-swaps each into the LIVE docroot via write-.new + sys_renameat (atomic; a concurrent reader never tears). Because nx_compare_serve reads the SAME docroot files, MCP tools/call and public REST update together, single source. argv: [1]=buildroot dir (default "buildroot"), [2]=docroot prefix (default "../sites/nishifamily/compare/", i.e. the live docroot relative to buildroot). The MCP allowlist row PINS these args (caller argv ignored) so a tools/call caller cannot redirect writes. Targets must already exist (this regenerates, never scaffolds). license_tier: ORIGINAL expect_exit: 0

dependencies 9 imports · 0 importers

nx_tool_run.nx nx_compare_receipt_lib.nx nx_compare_scope_lib.nx nx_symdecl_lib.nx nx_estate_path.nx nx_forkfresh_lib.nx nx_catalog_lib.nx nx_ioadmit_lib.nx nx_heavyio_lib.nx nx_compare_regen_scoped.nx

imports: nx_tool_run.nxnx_compare_receipt_lib.nxnx_compare_scope_lib.nxnx_symdecl_lib.nxnx_estate_path.nxnx_forkfresh_lib.nxnx_catalog_lib.nxnx_ioadmit_lib.nxnx_heavyio_lib.nx

imported by: nobody (leaf or entry point)

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

main w cscope_roster_count cscope_name_char rg_scope_len cscope_validate_name cscope_name_char ↻ ep_anchor sys_openat_rd sys_close sys_chdir 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 ↻ ioa_measure sys_mmap ↻ rm_read sys_openat_rd ↻ sys_read sys_close ↻ ioa_ncpu rm_field rm_slen sys_munmap ioa_spawn_budget wn w ↻ hio_admit_conf

structs

none

consts

33const RG_EMIT_CAPTURE_BYTES: i64 = 1048576 // generator stdout: a whole emitted page, size unknown until it runs
34const RG_HTML_MIN_BYTES: i64 = 2000 // a validity FLOOR, not a buffer: shorter than this is not a page
35const RG_DEBTSTATE_BYTES: i64 = 65536 // debtstate accumulator; every write clamps on oo < ocap
36const RG_GETDENTS_BYTES: i64 = 65536 // ONE getdents64 transfer -- the caller loops until it returns 0
37const RG_CHILD_CAPTURE_BYTES: i64 = 262144 // a forked tool's stdout, size unknowable in advance
89const RG_PUBJRNL: *u8 = "../knowledge/status/comparepub.jrnl"
94const RG_WATCHROW_OVERHEAD: i64 = 14
110const RG_LEASE_NAME: *u8 = "compare-regen"
111const RG_LEASE_TTL_S: *u8 = "900" // nx_lease takes the ttl as text; DERIVED from the measured worst run 811 s + margin
112const RG_LEASE_CAP: i64 = 4096
113const RG_EXIT_BUSY: i64 = 3 // nx_lease's own BUSY exit, relayed unchanged so a caller learns one code
114const RG_EXIT_STORM: i64 = 4 // the build gate's QUEUE exit, relayed unchanged for the same reason
115const RG_LEASE_ELF: *u8 = "../nx_lease.elf" // CWD is the build root; the promoted lease organ lives at its parent
562const RG_FORK_MATRIX: i64 = 0
563const RG_FORK_SOTA: i64 = 1
564const RG_FORK_HUB: i64 = 2
567const RG_SELFCAT_STATUS_BYTES: i64 = 4096
568const RG_FORK_BOARD: i64 = 3
569const RG_FORKS: i64 = 4 // the DENOMINATOR: every generator this organ forks from _offc/
570const RG_PROMOTED_PREFIX: *u8 = "../" // CWD is the build root; /api/promote installs FLAT at its parent
571const RG_FORKFRESH_STATUS: *u8 = "../knowledge/status/compare_forkfresh.status"
572const RG_FORKSTATUS_BYTES: i64 = 4096 // derived from RG_FORKS rows plus a header, not guessed
573const RG_ELF_SUFFIX_LEN: i64 = 4
802const RG_SCOPE_PATH_BYTES: i64 = 600

functions

39func 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 }
40func wn(fd: i64, v: i64) -> i64
46func scopy(dst: *u8, doff: i64, src: *u8) -> i64 { var i: i64 = 0; while src[i] != (0 as u8) { dst[doff+i] = src[i]; i = i + 1 } return doff + i }
57func rg_write_atomic(path: *u8, buf: *u8, n: i64) -> i64
71func rg_scaffold(droot: *u8, dom: *u8) -> i64
called by 1: main calls 1: scopy
78func rg_run(elf: *u8, a1: *u8, a2: *u8, out: *u8, cap: i64, outlen: *i64) -> i64
95func rgr_num(b:*u8,off:i64,v:i64)->i64 {return rgr_decimal(b,off,v)}
118func rg_lease_run(verb: *u8, out: *u8) -> i64
called by 2: rg_lease_releasemain calls 1: tr_run_capture
133func rg_lease_release() -> i64
called by 1: main calls 1: rg_lease_run
144func rg_emit_receipted(elf: *u8, a1: *u8, mode: *u8, firstbyte: i64, minbytes: i64, target: *u8, out: *u8, cap: i64, journal:*u8) -> i64
191func rg_emit(elf:*u8,a1:*u8,mode:*u8,firstbyte:i64,minbytes:i64,target:*u8,out:*u8,cap:i64)->i64 {return rg_emit_receipted(elf,a1,mode,firstbyte,minbytes,target,out,cap,RG_PUBJRNL)}
called by 1: main calls 1: rg_emit_receipted
204func rg_watchlist(droot: *u8) -> i64
377func rg_debtstate(dom: *u8, buf: *u8, cap: i64, out: *u8, ocap: i64) -> i64
453func rgc_inlist(lst: *u8, ln: i64, name: *u8) -> i64
called by 1: rg_census
477func rg_census(droot: *u8) -> i64
called by 1: main calls 3: wrgc_inlistwn
587func rg_forkpath(idx: i64) -> *u8
595func rg_forkname(idx: i64, out: *u8) -> i64
618func rg_forkstatus() -> i64
644func rg_forkcheck() -> i64
748func rg_selfcatalog() -> i64
803func rg_scope_len(s: *u8) -> i64
called by 1: main
808func rg_scope_list(name: *u8, n: i64) -> *u8
called by 1: main calls 1: scopy
815func rg_scope_receipt(droot: *u8, domain: *u8, pubs: i64, fails: i64) -> i64
called by 1: main calls 3: scopyrgr_numrg_write_atomic
837func rg_published_count(successful:i64)->i64 {return successful+g_rg_published_incomplete}
called by 1: main
838func rg_exit_verdict(fails:i64)->i64
called by 1: main calls 1: w
842func main(argc: i64, argv: *i64) -> i64