code wiki / _hdl_build / nx_forkgrade.nx
nx_forkgrade.nx
buildroot/runtime/_hdl_build/nx_forkgrade.nx
about
nx_forkgrade.nx -- GRADE THE WHOLE CROSS-TREE FORK, IN ONE PROCESS, IN NISHILANG.
WHY THIS EXISTS. Every reading of the cross-tree fork so far was a SAMPLE -- 40 files, then 120, then
250 of 2,845 -- and the reason was purely instrumental: nx_srcdiff is one process per pair, and driven
from the laptop each spawn crosses WSL at ~2s, so the population cost ~95 minutes and I shrank the
evidence to fit the tool. ★★★★★★WHEN AN INSTRUMENT IS EXPENSIVE, PAY THE COST OR FIX THE INSTRUMENT --
NEVER SHRINK THE POPULATION TO FIT IT. Forking the same ruler NAS-side costs ~10ms, so the whole
population is seconds.
AND IT COMPOSES, IT DOES NOT REIMPLEMENT. The ruler stays nx_srcdiff -- one ruler, one implementation.
This organ only iterates and tallies. A second line-differ would be the duplicate-ruler defect that
this lane has already paid for twice (a local symbol-set check that was weaker than nx_srcdiff, and a
second flow-back with a second guard).
It also exists because the tally is JUDGEMENT, and judgement belongs in an organ: a .ps1 that
classifies verdicts and counts distributions is exactly the shell-side judging the doctrine forbids.
Shell's remaining job is moving bytes between the two trees, which is irreducibly laptop-side.
usage: nx_forkgrade <listfile> <dirA> <dirB> [outfile]
listfile : one tree-relative path per line
dirA : NAS tree root (e.g. buildroot/runtime)
dirB : staged other tree (e.g. /tmp/lapfork)
outfile : per-file rows "<verdict> <bpaired> <bunpaired> <relpath>"; stdout carries only the
envelope so a payload cap can never bound coverage.
UNKNOWN IS ITS OWN BUCKET: a pair whose ruler output carries no anchored verdict is counted
UNREADABLE, never folded into a known class. The bucket an unrecognised value lands in becomes the
number somebody plans against.
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.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
structs
| none |
consts
| 32 | const FG_MAGIC_2048: i64 = 2048 |
| 34 | const FG_STDOUT: i64 = 1 |
| 35 | const FG_LISTCAP: i64 = 4194304 |
| 36 | const FG_OUTCAP: i64 = 8388608 |
| 37 | const FG_RUNCAP: i64 = 262144 |
| 38 | const FG_PATHCAP: i64 = 1024 |
| 39 | const FG_DEADLINE: i64 = 20000 |
| 40 | const FG_RULER: *u8 = "nx_srcdiff.elf" |
| 43 | const FG_IDENT: i64 = 0 |
| 44 | const FG_ASUP: i64 = 1 |
| 45 | const FG_BSUP: i64 = 2 |
| 46 | const FG_BIDI: i64 = 3 |
| 47 | const FG_UNREAD: i64 = 4 |
| 48 | const FG_TOTAL: i64 = 5 |
| 49 | const FG_BIDI_PAIRED0: i64 = 6 // BIDIRECTIONAL rows whose B-side is fully paired (looks like an edit) |
| 56 | const FG_SB0: i64 = 7 // surplusB == 0 |
| 57 | const FG_SB1_3: i64 = 8 // 1..3 |
| 58 | const FG_SB4_20: i64 = 9 // 4..20 |
| 59 | const FG_SB21: i64 = 10 // >20 |
| 60 | const FG_BU0: i64 = 11 // bunpaired == 0 |
| 61 | const FG_BU1_3: i64 = 12 |
| 62 | const FG_BU4_20: i64 = 13 |
| 63 | const FG_BU21: i64 = 14 |
| 75 | const FG_SB_SEEN: i64 = 15 // pairs that yielded a parseable surplusB |
| 76 | const FG_BU_SEEN: i64 = 16 // pairs that yielded a parseable bunpaired |
| 77 | const FG_SLOTS: i64 = 24 |
| 177 | const FG_SPINE_PROD: *u8 = "knowledge/status/forkgrade.spine" |
| 178 | const FG_PROD_DIRA: *u8 = "buildroot/runtime" |
| 179 | const FG_SPINE_SIDECAR: *u8 = ".forkgrade.spine" |
| 180 | const FG_SPINEBUF: i64 = 1024 |
| 181 | const FG_MODE644: i64 = 420 |
| 182 | const FG_PERMIL: i64 = 1000 |
functions
| 79 | func fg_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(FG_STDOUT, s, n); return 0 } |
| 81 | func fg_num(v: i64) -> i64 |
| 95 | func fg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 97 | func fg_cat(dst: *u8, o: i64, s: *u8) -> i64 |
| 103 | func fg_catn(dst: *u8, o: i64, v: i64) -> i64 |
| 115 | func fg_at(buf: *u8, n: i64, i: i64, pat: *u8) -> i64 |
| 128 | func fg_find_line(buf: *u8, n: i64, pat: *u8) -> i64 |
| 141 | func fg_int_at(buf: *u8, n: i64, i: i64) -> i64 called by 1: main |
| 157 | func fg_join(dir: *u8, rel: *u8, out: *u8) -> i64 |
| 183 | func fg_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } called by 1: fg_trend |
| 184 | func fg_trend(ctr: *i64, dirA: *u8) -> i64 |
| 209 | func main(argc: i64, argv: *i64) -> i64 |