nx_compare_regen_scoped.nx
buildroot/runtime/nx_compare_regen_scoped.nx
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
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
structs
| none |
consts
| 33 | const RG_EMIT_CAPTURE_BYTES: i64 = 1048576 // generator stdout: a whole emitted page, size unknown until it runs |
| 34 | const RG_HTML_MIN_BYTES: i64 = 2000 // a validity FLOOR, not a buffer: shorter than this is not a page |
| 35 | const RG_DEBTSTATE_BYTES: i64 = 65536 // debtstate accumulator; every write clamps on oo < ocap |
| 36 | const RG_GETDENTS_BYTES: i64 = 65536 // ONE getdents64 transfer -- the caller loops until it returns 0 |
| 37 | const RG_CHILD_CAPTURE_BYTES: i64 = 262144 // a forked tool's stdout, size unknowable in advance |
| 89 | const RG_PUBJRNL: *u8 = "../knowledge/status/comparepub.jrnl" |
| 94 | const RG_WATCHROW_OVERHEAD: i64 = 14 |
| 110 | const RG_LEASE_NAME: *u8 = "compare-regen" |
| 111 | const RG_LEASE_TTL_S: *u8 = "900" // nx_lease takes the ttl as text; DERIVED from the measured worst run 811 s + margin |
| 112 | const RG_LEASE_CAP: i64 = 4096 |
| 113 | const RG_EXIT_BUSY: i64 = 3 // nx_lease's own BUSY exit, relayed unchanged so a caller learns one code |
| 114 | const RG_EXIT_STORM: i64 = 4 // the build gate's QUEUE exit, relayed unchanged for the same reason |
| 115 | const RG_LEASE_ELF: *u8 = "../nx_lease.elf" // CWD is the build root; the promoted lease organ lives at its parent |
| 562 | const RG_FORK_MATRIX: i64 = 0 |
| 563 | const RG_FORK_SOTA: i64 = 1 |
| 564 | const RG_FORK_HUB: i64 = 2 |
| 567 | const RG_SELFCAT_STATUS_BYTES: i64 = 4096 |
| 568 | const RG_FORK_BOARD: i64 = 3 |
| 569 | const RG_FORKS: i64 = 4 // the DENOMINATOR: every generator this organ forks from _offc/ |
| 570 | const RG_PROMOTED_PREFIX: *u8 = "../" // CWD is the build root; /api/promote installs FLAT at its parent |
| 571 | const RG_FORKFRESH_STATUS: *u8 = "../knowledge/status/compare_forkfresh.status" |
| 572 | const RG_FORKSTATUS_BYTES: i64 = 4096 // derived from RG_FORKS rows plus a header, not guessed |
| 573 | const RG_ELF_SUFFIX_LEN: i64 = 4 |
| 802 | const RG_SCOPE_PATH_BYTES: i64 = 600 |
functions
| 39 | func 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 } |
| 40 | func wn(fd: i64, v: i64) -> i64 called by 7: rg_write_atomicrg_emit_receiptedrg_watchlistrg_censusrg_forkcheckrg_selfcatalog+1 calls 1: w |
| 46 | func 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 } |
| 57 | func rg_write_atomic(path: *u8, buf: *u8, n: i64) -> i64 called by 4: rg_debtstaterg_forkstatusrg_selfcatalogrg_scope_receipt calls 5: rgr_allocrgr_write_atomicwwnrgr_free |
| 71 | func rg_scaffold(droot: *u8, dom: *u8) -> i64 |
| 78 | func rg_run(elf: *u8, a1: *u8, a2: *u8, out: *u8, cap: i64, outlen: *i64) -> i64 |
| 95 | func rgr_num(b:*u8,off:i64,v:i64)->i64 {return rgr_decimal(b,off,v)} |
| 118 | func rg_lease_run(verb: *u8, out: *u8) -> i64 |
| 133 | func rg_lease_release() -> i64 |
| 144 | func rg_emit_receipted(elf: *u8, a1: *u8, mode: *u8, firstbyte: i64, minbytes: i64, target: *u8, out: *u8, cap: i64, journal:*u8) -> i64 |
| 191 | func 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)} |
| 204 | func rg_watchlist(droot: *u8) -> i64 |
| 377 | func rg_debtstate(dom: *u8, buf: *u8, cap: i64, out: *u8, ocap: i64) -> i64 |
| 453 | func rgc_inlist(lst: *u8, ln: i64, name: *u8) -> i64 called by 1: rg_census |
| 477 | func rg_census(droot: *u8) -> i64 |
| 587 | func rg_forkpath(idx: i64) -> *u8 |
| 595 | func rg_forkname(idx: i64, out: *u8) -> i64 |
| 618 | func rg_forkstatus() -> i64 |
| 644 | func rg_forkcheck() -> i64 |
| 748 | func rg_selfcatalog() -> i64 |
| 803 | func rg_scope_len(s: *u8) -> i64 called by 1: main |
| 808 | func rg_scope_list(name: *u8, n: i64) -> *u8 |
| 815 | func rg_scope_receipt(droot: *u8, domain: *u8, pubs: i64, fails: i64) -> i64 |
| 837 | func rg_published_count(successful:i64)->i64 {return successful+g_rg_published_incomplete} called by 1: main |
| 838 | func rg_exit_verdict(fails:i64)->i64 |
| 842 | func main(argc: i64, argv: *i64) -> i64 |