nx_dataeng_sota_census.nx source
↩ module page · 175 lines · 10977 B
1// nx_dataeng_sota_census.nx (operator: data-eng+analytics+analyst honest census) -- grade the Nishi sovereign mgmt API vs the SOTA API capability union
2// (knowledge/registry/dataeng_sota_features.conf, grounded in knowledge/fetched/api_*.raw). LIAR-KILL: every
3// HAVE/PARTIAL/EXCEED names an organ; we OPEN runtime/<organ> -> a missing file flips it to UNGROUNDED (caught).
4// Reports HAVE/PARTIAL/GAP/EXCEED + a meet-SOTA score + the GAP list + the beyond-SOTA EXCEED list.
5// license_tier: ORIGINAL depends: nx_syscalls
6import "nx_syscalls.nx"
7import "nx_estate_path.nx" // ep_anchor: the CWD must not decide this organ's verdict
8const K_MAGIC_262144: i64 = 262144
9const K_MAGIC_1024: i64 = 1024
10
11// ---- SOURCE-TREE ROOT RESOLUTION (rule 17: conf > compiled bootstrap default) ----
12// FOUND 2026-07-23 (debt seq635): grounding opened a HARDCODED "runtime/<organ>". Run on the NAS
13// (CWD nishihost) that resolves to a 7-file SHADOW tree (seq207 dual-copy family) while the SSOT is
14// buildroot/runtime/ -- so every HAVE/PARTIAL/EXCEED row printed UNGROUNDED and the meet-SOTA score
15// STILL PRINTED as if verified. The liar-killer was disarmed and nobody could tell from the output.
16// Now: probe an ORDERED root list per organ, ground on the first hit, DECLARE the winning root, and
17// say so out loud when organs ground under MORE THAN ONE root (a split/shadow tree).
18func dc_can_open(p: *u8) -> i64 { let fd: i64=sys_openat_rd(p); if fd<0 { return 0 } sys_close(fd); return 1 }
19// rbuf holds nr NUL-separated root prefixes back to back; return a pointer to the idx-th
20func dc_root_ptr(rbuf: *u8, idx: i64) -> *u8 {
21 var i: i64=0; var p: i64=0
22 while i<idx { var e: i64=0; while e==0 { if rbuf[p]==(0 as u8) { e=1 } else { p=p+1 } } p=p+1; i=i+1 }
23 return (((rbuf as i64)+p) as *u8)
24}
25func dc_put_root(rbuf: *u8, at: i64, s: *u8) -> i64 {
26 var q: i64=at; var j: i64=0
27 while s[j]!=(0 as u8) { rbuf[q]=s[j]; q=q+1; j=j+1 }
28 rbuf[q]=0 as u8
29 return q+1
30}
31// roots <- knowledge/registry/dataeng_census_roots.conf (one prefix per line, '#' comment); an
32// absent/empty/all-comment conf falls back to the compiled bootstrap list. CR-tolerant.
33func dc_roots_load(rbuf: *u8) -> i64 {
34 var cnt: i64=0
35 let fd: i64=sys_openat_rd("knowledge/registry/dataeng_census_roots.conf" as *u8)
36 if fd>=0 {
37 let ccap: i64 = K_MAGIC_1024
38 let cb: *u8 = sys_mmap(ccap)
39 var n: i64=0; var r: i64=1
40 while r>0 { if n>=ccap { r=0 } else { r=sys_read(fd, (((cb as i64)+n) as *u8), ccap-n); if r>0 { n=n+r } } }
41 sys_close(fd)
42 var at: i64=0; var ls: i64=0
43 while ls<n {
44 var le: i64=ls; var e: i64=0
45 while e==0 { if le>=n { e=1 } else { if cb[le]==(10 as u8) { e=1 } else { le=le+1 } } }
46 var te: i64=le
47 if te>ls { if cb[te-1]==(13 as u8) { te=te-1 } }
48 if te>ls { if cb[ls]!=(35 as u8) {
49 var q: i64=at; var j: i64=ls
50 while j<te { rbuf[q]=cb[j]; q=q+1; j=j+1 }
51 rbuf[q]=0 as u8; at=q+1; cnt=cnt+1
52 } }
53 ls=le+1
54 }
55 }
56 if cnt==0 {
57 var at2: i64=0
58 at2=dc_put_root(rbuf, at2, "buildroot/runtime/" as *u8)
59 at2=dc_put_root(rbuf, at2, "runtime/" as *u8)
60 at2=dc_put_root(rbuf, at2, "../runtime/" as *u8)
61 cnt=3
62 }
63 return cnt
64}
65// try each root in order. On a hit leave the WINNING path in out and return the root index; on total
66// miss leave the LAST tried path in out (so the "missing <path>" message stays informative) and
67// return -1. No break in the language -> the hit<0 guard short-circuits remaining probes.
68func dc_ground(rbuf: *u8, nr: i64, buf: *u8, oo: i64, ol: i64, out: *u8) -> i64 {
69 var i: i64=0; var hit: i64=0-1
70 while i<nr {
71 if hit<0 {
72 let root: *u8=dc_root_ptr(rbuf, i)
73 var q: i64=0; var pj: i64=0
74 while root[pj]!=(0 as u8) { out[q]=root[pj]; q=q+1; pj=pj+1 }
75 var oj: i64=0
76 while oj<ol { out[q]=buf[oo+oj]; q=q+1; oj=oj+1 }
77 out[q]=0 as u8
78 if dc_can_open(out)==1 { hit=i }
79 }
80 i=i+1
81 }
82 return hit
83}
84
85func cp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
86func cn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(28); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } while k>0 { k=k-1; sys_write(1,(((t as i64)+k) as *u8),1) } return 0 }
87// compare buf[off..off+len) to NUL-term lit
88func cseq(buf: *u8, off: i64, len: i64, lit: *u8) -> i64 { var i: i64=0; while i<len { if lit[i]==(0 as u8) { return 0 } if buf[off+i]!=lit[i] { return 0 } i=i+1 } if lit[len]!=(0 as u8) { return 0 } return 1 }
89func cwrite(buf: *u8, off: i64, len: i64) -> i64 { sys_write(1, (((buf as i64)+off) as *u8), len); return 0 }
90
91func main() -> i64 {
92 // ANCHOR FIRST (2026-08-04): run from buildroot this organ read an EMPTY/absent estate
93 // and fail-closed RED (or, worse, appended to a SECOND store). Its subject is the
94 // estate, so the caller's working directory must not decide its verdict.
95 ep_anchor()
96 let cap: i64 = K_MAGIC_262144; let buf: *u8 = sys_mmap(cap)
97 let fd: i64 = sys_openat_rd("knowledge/registry/dataeng_sota_features.conf" as *u8)
98 if fd < 0 { cp("cannot open dataeng_sota_features.conf\n" as *u8); sys_exit(1); return 1 }
99 var n: i64=0; var r: i64=1
100 while r>0 { if n>=cap { r=0 } else { r=sys_read(fd, (((buf as i64)+n) as *u8), cap-n); if r>0 { n=n+r } } }
101 sys_close(fd)
102 cp("NX-DATAENG-SOTA-CENSUS (vs dbt/Spark/DuckDB/ClickHouse/Arrow/pandas/Polars/Superset/DataSketches/OpenLineage)\n" as *u8)
103 var have: i64=0; var part: i64=0; var gap: i64=0; var exc: i64=0; var tot: i64=0; var ungrounded: i64=0
104 // resolve the source-tree root ONCE (see dc_roots_load); grounded_root = index that actually
105 // opened organs, split_root = 1 when organs grounded under more than one root (shadow tree).
106 let rbuf: *u8 = sys_mmap(K_MAGIC_1024)
107 let nroot: i64 = dc_roots_load(rbuf)
108 var grounded: i64=0; var grounded_root: i64=0-1; var split_root: i64=0
109 let offs: *i64 = sys_mmap(64) as *i64; let lens: *i64 = sys_mmap(64) as *i64
110 var ls: i64=0
111 while ls < n {
112 var le: i64=ls; var eol: i64=0
113 while eol==0 { if le>=n { eol=1 } else { if buf[le]==(10 as u8) { eol=1 } else { le=le+1 } } }
114 if le>ls { if buf[ls]!=(35 as u8) { // skip '#' + blank
115 // split [ls,le) on TAB into up to 5 fields
116 var nf: i64=0; var fs: i64=ls; var i: i64=ls
117 while i<=le { var cut: i64=0; if i==le { cut=1 } else { if buf[i]==(9 as u8) { cut=1 } } if cut==1 { if nf<8 { offs[nf]=fs; lens[nf]=i-fs; nf=nf+1 } fs=i+1 } i=i+1 }
118 if nf>=4 {
119 let so: i64=offs[2]; let sl: i64=lens[2] // status
120 let oo: i64=offs[3]; let ol: i64=lens[3] // organ
121 var st: i64=0 // 1 HAVE 2 PARTIAL 3 GAP 4 EXCEED
122 if cseq(buf,so,sl,"HAVE" as *u8)==1 { st=1 } if cseq(buf,so,sl,"PARTIAL" as *u8)==1 { st=2 } if cseq(buf,so,sl,"GAP" as *u8)==1 { st=3 } if cseq(buf,so,sl,"EXCEED" as *u8)==1 { st=4 }
123 if st>0 {
124 tot=tot+1
125 if st==1 { have=have+1 } if st==2 { part=part+1 } if st==3 { gap=gap+1 } if st==4 { exc=exc+1 }
126 // LIAR-KILL: HAVE/PARTIAL/EXCEED must name a real organ (not "-")
127 if st!=3 {
128 var dash: i64=0; if ol==1 { if buf[oo]==(45 as u8) { dash=1 } }
129 if dash==0 {
130 let op: *u8=sys_mmap(K_MAGIC_1024)
131 let hitr: i64=dc_ground(rbuf, nroot, buf, oo, ol, op)
132 if hitr<0 { ungrounded=ungrounded+1; cp(" [UNGROUNDED] " as *u8); cwrite(buf, offs[0], lens[0]); cp(" -> missing " as *u8); cp(op); cp("\n" as *u8) } else {
133 grounded=grounded+1
134 if grounded_root<0 { grounded_root=hitr } else { if grounded_root!=hitr { split_root=1 } }
135 }
136 } else { ungrounded=ungrounded+1; cp(" [UNGROUNDED] " as *u8); cwrite(buf, offs[0], lens[0]); cp(" claims non-GAP but organ='-'\n" as *u8) }
137 }
138 }
139 }
140 } }
141 ls=le+1
142 }
143 // meet-SOTA score: HAVE + EXCEED fully meet (2), PARTIAL half (1), GAP 0.
144 let score: i64 = (have*2 + exc*2 + part) * 1000 / (tot*2)
145 cp("\n-- HAVE=" as *u8); cn(have); cp(" PARTIAL=" as *u8); cn(part); cp(" GAP=" as *u8); cn(gap); cp(" EXCEED=" as *u8); cn(exc); cp(" of " as *u8); cn(tot); cp(" meet-SOTA=" as *u8); cn(score); cp("/1000\n" as *u8)
146 cp("-- LIAR-KILL: " as *u8); cn(ungrounded); cp(" ungrounded of " as *u8); cn(grounded+ungrounded); cp(" claims; " as *u8); cn(grounded); cp(" GROUNDED (organ file opened)\n" as *u8)
147 cp("-- GROUNDED-ROOT: " as *u8)
148 if grounded_root<0 { cp("NONE -- no root in the candidate list contains the organs; the score below is UNVERIFIED" as *u8) } else { cp(dc_root_ptr(rbuf, grounded_root)) }
149 cp(" (roots tried=" as *u8); cn(nroot); cp(")\n" as *u8)
150 if split_root==1 { cp("-- WARN SPLIT-TREE: organs grounded under MORE THAN ONE root (shadow/dual-copy tree) -- grounding is not from a single SSOT\n" as *u8) }
151 // list GAPs (build-targets) + EXCEEDs (beyond-SOTA differentiators)
152 cp("-- GAPs (build to reach SOTA):\n" as *u8)
153 ls=0
154 while ls < n {
155 var le2: i64=ls; var e2: i64=0; while e2==0 { if le2>=n { e2=1 } else { if buf[le2]==(10 as u8) { e2=1 } else { le2=le2+1 } } }
156 if le2>ls { if buf[ls]!=(35 as u8) {
157 var nf2: i64=0; var fs2: i64=ls; var i2: i64=ls
158 while i2<=le2 { var c2: i64=0; if i2==le2 { c2=1 } else { if buf[i2]==(9 as u8) { c2=1 } } if c2==1 { if nf2<8 { offs[nf2]=fs2; lens[nf2]=i2-fs2; nf2=nf2+1 } fs2=i2+1 } i2=i2+1 }
159 if nf2>=4 { if cseq(buf,offs[2],lens[2],"GAP" as *u8)==1 { cp(" - " as *u8); cwrite(buf, offs[0], lens[0]); cp("\n" as *u8) } }
160 } }
161 ls=le2+1
162 }
163 cp("-- EXCEED (beyond mainstream SOTA):\n" as *u8)
164 ls=0
165 while ls < n {
166 var le3: i64=ls; var e3: i64=0; while e3==0 { if le3>=n { e3=1 } else { if buf[le3]==(10 as u8) { e3=1 } else { le3=le3+1 } } }
167 if le3>ls { if buf[ls]!=(35 as u8) {
168 var nf3: i64=0; var fs3: i64=ls; var i3: i64=ls
169 while i3<=le3 { var c3: i64=0; if i3==le3 { c3=1 } else { if buf[i3]==(9 as u8) { c3=1 } } if c3==1 { if nf3<8 { offs[nf3]=fs3; lens[nf3]=i3-fs3; nf3=nf3+1 } fs3=i3+1 } i3=i3+1 }
170 if nf3>=4 { if cseq(buf,offs[2],lens[2],"EXCEED" as *u8)==1 { cp(" + " as *u8); cwrite(buf, offs[0], lens[0]); cp("\n" as *u8) } }
171 } }
172 ls=le3+1
173 }
174 sys_exit(0); return 0
175}