nx_bundle_ingest_selected_gate_t144.nx source
↩ module page · 294 lines · 18810 B
1// nx_bundle_ingest_gate.nx -- THE BUNDLE WALKER GATE (/compare/modding MD1, 2026-09-06). The fixture is BUILT AT RUNTIME with
2// the estate's own writers (nx_zip stored entries + nx_zip_deflate_lib method-8 entries), under /tmp/nx_bundle_ingest_gate/,
3// never a production path: an OBJ that names its MTL, an MTL that names four PNG maps, four PNGs, a VMD, an unreferenced PNG
4// and one member of no known type. Teeth drive the LIB in-process, then fork the promoted CLI on the same fixture as the
5// second witness and reconcile its receipt. Negative controls: the incumbent STORED-only reader (nxzip_entry_data) must
6// REFUSE the deflated member -- a walker that could not fail that way would prove nothing -- and a container with its EOCD
7// cut off must be refused, never reported as zero members.
8// usage: nx_bundle_ingest_gate (no args)
9// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
10import "nx_syscalls.nx"
11import "nx_gate_verdict.nx"
12import "nx_gatekit_lib.nx"
13import "nx_zip_selected_candidate_t144.nx"
14import "nx_zip_deflate_selected_candidate_t144.nx"
15import "nx_bundle_ingest_selected_candidate_t144.nx"
16
17const BG_DIR: *u8 = "/tmp/nx_bundle_ingest_gate"
18const BG_FIX: *u8 = "/tmp/nx_bundle_ingest_gate/fixture.zip"
19const BG_CUT: *u8 = "/tmp/nx_bundle_ingest_gate/fixture_noeocd.zip"
20const BG_ELF_LIVE: *u8 = "./nx_bundle_ingest.elf"
21const BG_ELF_STAGE: *u8 = "./nx_bundle_ingest.sov.elf.new"
22const BG_ELF_BUILD: *u8 = "buildroot/_build/nx_bundle_ingest.sov.elf"
23const BG_DIR_MODE: i64 = 493
24const BG_FILE_MODE: i64 = 420
25const BG_ZIP_CAP: i64 = 65536
26const BG_CD_CAP: i64 = 4096
27const BG_OBJ_V_LINES: i64 = 40
28const BG_OBJ_F_LINES: i64 = 20
29const BG_PNG_PAD: i64 = 24
30const BG_VMD_PAD: i64 = 40
31const BG_MEMBERS: i64 = 9
32const BG_CAP: i64 = 65536
33const BG_ZIP_FLD_N: i64 = 8
34
35func bg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
36func bg_cat(dst: *u8, off: i64, s: *u8) -> i64 { let n: i64 = bg_len(s); var i: i64 = 0; while i < n { dst[off + i] = s[i]; i = i + 1 } return off + n }
37func bg_write_file(path: *u8, b: *u8, n: i64) -> i64 {
38 let fd: i64 = sys_openat_wr(path, BG_FILE_MODE)
39 if fd < 0 { return 0 - 1 }
40 var done: i64 = 0
41 while done < n { let k: i64 = sys_write(fd, b + done, n - done); if k <= 0 { break } done = done + k }
42 sys_close(fd)
43 return done
44}
45func bg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
46func bg_num_after(buf: *u8, n: i64, key: *u8) -> i64 {
47 let p: i64 = gk_out_pos(buf, n, key)
48 if p < 0 { return 0 - 1000000 }
49 var i: i64 = p + gk_len(key)
50 var neg: i64 = 0
51 if i < n { if buf[i] == (45 as u8) { neg = 1; i = i + 1 } }
52 var v: i64 = 0
53 var got: i64 = 0
54 while i < n {
55 let c: i64 = buf[i] as i64
56 if c < 48 { i = n }
57 if c > 57 { i = n }
58 if i < n { v = v * 10 + (c - 48); got = 1; i = i + 1 }
59 }
60 if got == 0 { return 0 - 1000000 }
61 if neg == 1 { return 0 - v }
62 return v
63}
64// the row of member idx in the walker table
65func bg_row(tbl: *i64, i: i64) -> *i64 { return bi_rec(tbl, i) }
66
67func main(argc: i64, argv: *i64) -> i64 {
68 let ctr: *i64 = gv_ctr()
69 gv_head("nx_bundle_ingest_gate -- a community zip walked by CONTENT, textures bound by the mesh's own bytes, the unknown REPORTED" as *u8)
70 sys_mkdir(BG_DIR, BG_DIR_MODE)
71
72 // ---- the fixture: nine members, three of them DEFLATED through the estate's own compressor ------------------------
73 let obj: *u8 = sys_mmap(4096)
74 var o: i64 = bg_cat(obj, 0, "# fixture mesh\nmtllib cube.mtl\n" as *u8)
75 var i: i64 = 0
76 while i < BG_OBJ_V_LINES { o = bg_cat(obj, o, "v 0.500000 0.250000 0.125000\n" as *u8); i = i + 1 }
77 i = 0
78 while i < BG_OBJ_F_LINES { o = bg_cat(obj, o, "f 1 2 3\n" as *u8); i = i + 1 }
79 let objn: i64 = o
80 let mtl: *u8 = sys_mmap(512)
81 let mtln: i64 = bg_cat(mtl, 0, "newmtl skin\nmap_Kd skin.png\nmap_Bump normal.png\nmap_Ks spec.png\nmap_d alpha.png\n" as *u8)
82 let png: *u8 = sys_mmap(64)
83 png[0] = 0x89 as u8; png[1] = 80 as u8; png[2] = 78 as u8; png[3] = 71 as u8; png[4] = 13 as u8; png[5] = 10 as u8; png[6] = 26 as u8; png[7] = 10 as u8
84 let pngn: i64 = 8 + BG_PNG_PAD
85 let vmd: *u8 = sys_mmap(128)
86 var vn: i64 = bg_cat(vmd, 0, "Vocaloid Motion Data 0002" as *u8)
87 let vmdn: i64 = vn + BG_VMD_PAD
88 let junk: *u8 = sys_mmap(64)
89 let junkn: i64 = bg_cat(junk, 0, "qqqq not any known asset qqqq" as *u8)
90
91 let zip: *u8 = sys_mmap(BG_ZIP_CAP)
92 let cd: *u8 = sys_mmap(BG_CD_CAP)
93 let st: *i64 = sys_mmap(64) as *i64
94 st[NX_ZIP_ST_OFF] = 0; st[NX_ZIP_ST_CDOFF] = 0; st[NX_ZIP_ST_COUNT] = 0
95 let mo: *i64 = sys_mmap(16) as *i64
96 var ok: i64 = 1
97 if nxzip_add_deflated(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "cube.obj" as *u8, obj, objn, mo) != 1 { ok = 0 }
98 let obj_method: i64 = mo[0]
99 if nxzip_add_deflated(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "cube.mtl" as *u8, mtl, mtln, mo) != 1 { ok = 0 }
100 if nxzip_add_stored(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "tex/skin.png" as *u8, png, pngn) != 1 { ok = 0 }
101 if nxzip_add_stored(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "tex/normal.png" as *u8, png, pngn) != 1 { ok = 0 }
102 if nxzip_add_stored(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "tex/spec.png" as *u8, png, pngn) != 1 { ok = 0 }
103 if nxzip_add_stored(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "tex/alpha.png" as *u8, png, pngn) != 1 { ok = 0 }
104 if nxzip_add_deflated(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "dance.vmd" as *u8, vmd, vmdn, mo) != 1 { ok = 0 }
105 let vmd_method: i64 = mo[0]
106 if nxzip_add_stored(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "readme.xyz" as *u8, junk, junkn) != 1 { ok = 0 }
107 if nxzip_add_stored(zip, BG_ZIP_CAP, cd, BG_CD_CAP, st, "tex/extra.png" as *u8, png, pngn) != 1 { ok = 0 }
108 let zn: i64 = nxzip_finalize(zip, BG_ZIP_CAP, cd, st)
109 gv_check("fixture-built (every add and the finalize returned 1)" as *u8, (ok == 1) as i64, ctr)
110 gv_check("fixture-has-bytes" as *u8, (zn > 0) as i64, ctr)
111 gv_check_eq("fixture-reached-the-condition: the OBJ member is DEFLATED (method 8), not stored" as *u8, obj_method, NX_ZIP_METHOD_DEFLATE, ctr)
112 gv_kv("fixture_bytes" as *u8, zn)
113 gv_kv("obj_bytes" as *u8, objn)
114 gv_kv("vmd_method" as *u8, vmd_method)
115 let wrote: i64 = bg_write_file(BG_FIX, zip, zn)
116 gv_check_eq("fixture-written-to-gate-scratch" as *u8, wrote, zn, ctr)
117 let cutn: i64 = zn - NX_ZIP_EOCD_LEN
118 let wrote2: i64 = bg_write_file(BG_CUT, zip, cutn)
119 gv_check_eq("truncated-twin-written" as *u8, wrote2, cutn, ctr)
120
121 // ---- the lib, in-process ----------------------------------------------------------------------------------------
122 let total: i64 = bi_count(zip, zn)
123 gv_check_eq("eocd-count-is-the-member-count" as *u8, total, BG_MEMBERS, ctr)
124 let tbl: *i64 = sys_mmap(8 * BI_F_N * (total + 1)) as *i64
125 let names: *u8 = sys_mmap(zn + 4096)
126 let m: i64 = bi_walk(zip, zn, tbl, total, names, zn + 4096)
127 gv_check_eq("walker-returns-every-member" as *u8, m, BG_MEMBERS, ctr)
128 let bound: i64 = bi_bind_textures(tbl, m, names)
129 let p: *i64 = sys_mmap(8 * BI_P_N) as *i64
130 let sum: i64 = bi_partition(tbl, m, p)
131 gv_check_eq("partition-SUMS-to-the-member-count" as *u8, sum, m, ctr)
132 gv_check_eq("model=1 (the OBJ, typed by CONTENT through the deflated bytes)" as *u8, p[BI_P_MODEL], 1, ctr)
133 gv_check_eq("material=1 (the MTL)" as *u8, p[BI_P_MATERIAL], 1, ctr)
134 gv_check_eq("texture=5 (four maps plus the stray)" as *u8, p[BI_P_TEXTURE], 5, ctr)
135 gv_check_eq("motion=1 (the VMD, deflated)" as *u8, p[BI_P_MOTION], 1, ctr)
136 gv_check_eq("unknown=1 (readme.xyz is REPORTED, not dropped)" as *u8, p[BI_P_UNKNOWN], 1, ctr)
137 gv_check_eq("inflated=3 (obj, mtl, vmd through nx_deflate, CRC verified)" as *u8, p[BI_P_INFLATED], 3, ctr)
138 gv_check_eq("stored=6 (the five PNGs and the junk, CRC verified in place)" as *u8, p[BI_P_STORED], 6, ctr)
139 gv_check_eq("failed=0" as *u8, p[BI_P_FAILED], 0, ctr)
140 let r0: *i64 = bg_row(tbl, 0)
141 gv_check_eq("obj-magic-is-OBJ-by-content" as *u8, r0[BI_F_MAGIC], AP_OBJ, ctr)
142 gv_check_eq("obj-verdict-AGREE (claim and content match)" as *u8, r0[BI_F_VERDICT], BI_V_AGREE, ctr)
143 let r1: *i64 = bg_row(tbl, 1)
144 gv_check_eq("mtl-magic-is-MTL-by-content" as *u8, r1[BI_F_MAGIC], AP_MTL, ctr)
145 let r6: *i64 = bg_row(tbl, 6)
146 gv_check_eq("vmd-magic-is-VMD-through-inflate" as *u8, r6[BI_F_MAGIC], AP_VMD, ctr)
147 let r7: *i64 = bg_row(tbl, 7)
148 gv_check_eq("junk-verdict-UNIDENTIFIED (an honest unknown)" as *u8, r7[BI_F_VERDICT], BI_V_UNIDENTIFIED, ctr)
149 gv_check_eq("textures-bound=4 (named by the MTL's own bytes)" as *u8, p[BI_P_BOUND], 4, ctr)
150 gv_check_eq("textures-unbound=1 (extra.png nobody references)" as *u8, p[BI_P_UNBOUND], 1, ctr)
151 let r2: *i64 = bg_row(tbl, 2)
152 gv_check_eq("skin.png-bound-to-the-MTL-row" as *u8, r2[BI_F_BOUND_TO], 1, ctr)
153 let r8: *i64 = bg_row(tbl, 8)
154 gv_check_eq("extra.png-bound-to-nobody" as *u8, r8[BI_F_BOUND_TO], 0 - 1, ctr)
155 gv_kv("bound" as *u8, bound)
156
157 // ---- NEG-CONTROL 1: the incumbent STORED-only reader cannot open the deflated member ------------------------------
158 let fld: *i64 = sys_mmap(8 * BG_ZIP_FLD_N) as *i64
159 let cdp: i64 = nxzip_cd_start(zip, zn)
160 let rd: i64 = nxzip_read_cd(zip, zn, cdp, fld)
161 gv_check_eq("first-cd-record-readable" as *u8, rd, 1, ctr)
162 let stored_only: i64 = nxzip_entry_data(zip, zn, fld)
163 // the good case: the same reader on a STORED member (row 2) succeeds
164 var cdp2: i64 = cdp
165 var k: i64 = 0
166 while k < 2 { nxzip_read_cd(zip, zn, cdp2, fld); cdp2 = fld[NX_ZIP_FLD_NEXTCD]; k = k + 1 }
167 nxzip_read_cd(zip, zn, cdp2, fld)
168 let stored_ok: i64 = nxzip_entry_data(zip, zn, fld)
169 gv_bite("neg-control-STORED-only-reader-REFUSES-the-deflated-member (nxzip_entry_data returns -1 on method 8, opens method 0)" as *u8, (stored_only < 0) as i64, (stored_ok < 0) as i64, ctr)
170
171 // ---- NEG-CONTROL 2: a container with its EOCD cut off is refused, never reported as zero members ---------------
172 let cutcount: i64 = bi_count(zip, cutn)
173 gv_bite("neg-control-truncated-container-REFUSED (no EOCD -> count -1, not 0)" as *u8, (cutcount < 0) as i64, (total < 0) as i64, ctr)
174
175 // Selected-member ingestion boundary: unselected bodies are not decoded.
176 let selected_options: *i64 = sys_mmap(24) as *i64
177 selected_options[0] = total; selected_options[1] = 0 - 2; selected_options[2] = BG_CAP
178 let metadata_rows: i64 = bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
179 gv_check_eq("metadata inventory returns every directory row",metadata_rows,BG_MEMBERS,ctr)
180 var unopened: i64 = 0
181 i = 0
182 while i < total { let r: *i64 = bi_rec(tbl,i); if r[BI_F_INFLATE] == BI_INF_NOT_READ { if r[BI_F_DATA] == 0 { unopened = unopened + 1 } } i = i+1 }
183 gv_check_eq("metadata inventory decodes zero member bodies",unopened,total,ctr)
184 selected_options[1] = 0
185 gv_check_eq("selected deflate walk retains complete directory",bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options),total,ctr)
186 let selected_row: *i64 = bi_rec(tbl,0)
187 gv_check_eq("selected deflate bytes exact declared length",selected_row[BI_F_DLEN],objn,ctr)
188 gv_check_eq("selected deflate expected and actual CRC agree",selected_row[BI_F_CRC_ACTUAL],selected_row[BI_F_CRC],ctr)
189 let unopened_texture: *i64 = bi_rec(tbl,2)
190 gv_check_eq("unselected texture remains unopened",unopened_texture[BI_F_INFLATE],BI_INF_NOT_READ,ctr)
191 selected_options[2] = objn - 1
192 bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
193 gv_check_eq("selected output limit names refusal",selected_row[BI_F_INFLATE],BI_INF_LIMIT,ctr)
194 gv_check_eq("selected output limit exposes no bytes",selected_row[BI_F_DATA],0,ctr)
195 selected_options[2] = BG_CAP
196 selected_options[1] = total
197 gv_check_eq("out-of-range selected member refused",bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options),0-6,ctr)
198 selected_options[1] = 0-2
199 gv_check_eq("insufficient names arena refuses rather than truncates",bi_walk_selected(zip,zn,tbl,names,1,selected_options),0-4,ctr)
200 selected_options[1] = 2
201 nxzip_read_cd(zip,zn,cdp2,fld)
202 let stored_off: i64 = bi_local_data(zip,zn,fld)
203 zip[stored_off] = zip[stored_off] ^ (1 as u8)
204 bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
205 let corrupt_row: *i64 = bi_rec(tbl,2)
206 gv_check_eq("corrupted stored bytes name CRC refusal",corrupt_row[BI_F_INFLATE],BI_INF_CRC_MISMATCH,ctr)
207 gv_check_eq("CRC refusal exposes no output pointer",corrupt_row[BI_F_DATA],0,ctr)
208 zip[stored_off] = zip[stored_off] ^ (1 as u8)
209 let local_off: i64 = fld[NX_ZIP_FLD_LOCALOFF]
210 nxzip_w32(zip,cdp2+24,pngn+1); nxzip_w32(zip,local_off+22,pngn+1)
211 bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
212 gv_check_eq("stored declared size mismatch names refusal",corrupt_row[BI_F_INFLATE],BI_INF_SIZE_MISMATCH,ctr)
213 nxzip_w32(zip,cdp2+24,pngn); nxzip_w32(zip,local_off+22,pngn)
214 nxzip_w16(zip,local_off+8,8)
215 bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
216 gv_check_eq("local and central method disagreement refused",corrupt_row[BI_F_INFLATE],BI_INF_BADLOCAL,ctr)
217 nxzip_w16(zip,local_off+8,0)
218 let old_name: u8 = zip[local_off+30]
219 zip[local_off+30] = 88 as u8
220 bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
221 gv_check_eq("local and central name disagreement refused",corrupt_row[BI_F_INFLATE],BI_INF_BADLOCAL,ctr)
222 zip[local_off+30] = old_name
223 nxzip_w16(zip,local_off+6,1); nxzip_w16(zip,cdp2+8,1)
224 bi_walk_selected(zip,zn,tbl,names,zn+4096,selected_options)
225 gv_check_eq("encrypted entry is not decoded",corrupt_row[BI_F_INFLATE],BI_INF_BADLOCAL,ctr)
226 nxzip_w16(zip,local_off+6,0); nxzip_w16(zip,cdp2+8,0)
227
228
229 let comment_zip: *u8=sys_mmap(zn+32)
230 var cq: i64=0
231 while cq < zn { comment_zip[cq]=zip[cq]; cq=cq+1 }
232 while cq < zn+32 { comment_zip[cq]=0 as u8; cq=cq+1 }
233 nxzip_w16(comment_zip,zn-NX_ZIP_EOCD_LEN+20,32)
234 nxzip_w32(comment_zip,zn+10,NX_ZIP_SIG_EOCD)
235 nxzip_w16(comment_zip,zn+14,1)
236 gv_check_eq("comment false EOCD disk marker does not hide real EOCD",nxzip_find_eocd(comment_zip,zn+32),zn-NX_ZIP_EOCD_LEN,ctr)
237 gv_check_eq("comment false signature preserves all members",nxzip_count(comment_zip,zn+32),total,ctr)
238 nxzip_w16(comment_zip,zn+14,0); nxzip_w32(comment_zip,zn+26,zn+11)
239 gv_check_eq("comment false EOCD extent does not hide real EOCD",nxzip_find_eocd(comment_zip,zn+32),zn-NX_ZIP_EOCD_LEN,ctr)
240 nxzip_w16(comment_zip,zn-NX_ZIP_EOCD_LEN+20,0)
241 gv_check_eq("unadvertised trailing bytes are unsupported and refused",nxzip_find_eocd(comment_zip,zn+1),0-1,ctr)
242 let signed_zip: *u8=sys_mmap(zn+6)
243 cq=0; while cq < zn-NX_ZIP_EOCD_LEN { signed_zip[cq]=zip[cq]; cq=cq+1 }
244 nxzip_w32(signed_zip,cq,0x05054b50); nxzip_w16(signed_zip,cq+4,0)
245 var eq: i64=0; while eq < NX_ZIP_EOCD_LEN { signed_zip[cq+6+eq]=zip[cq+eq]; eq=eq+1 }
246 nxzip_w32(signed_zip,cq+6+12,nxzip_r32(zip,cq+12)+6)
247 selected_options[1]=0-2
248 gv_check_eq("central directory digital signature is explicitly unsupported",bi_walk_selected(signed_zip,zn+6,tbl,names,zn+4096,selected_options),0-2,ctr)
249
250 // ---- the CLI as the SECOND WITNESS on the same fixture ----------------------------------------------------------
251 var elf: *u8 = 0 as *u8
252 if argc > 1 { elf = argv[1] as *u8 }
253 else { if bg_exists(BG_ELF_LIVE) == 1 { elf = BG_ELF_LIVE }
254 else { if bg_exists(BG_ELF_STAGE) == 1 { elf = BG_ELF_STAGE } else { if bg_exists(BG_ELF_BUILD) == 1 { elf = BG_ELF_BUILD } } }
255 }
256 gv_need("cli-witness-present (live, staged or build fossil of nx_bundle_ingest)" as *u8, ((elf as i64) != 0) as i64, ctr)
257 if (elf as i64) != 0 {
258 let buf: *u8 = sys_mmap(BG_CAP)
259 let bl: *i64 = sys_mmap(16) as *i64
260 let rc: i64 = gk_run_capture(elf, BG_FIX, 0 as *u8, 0 as *u8, 0 as *u8, buf, BG_CAP, bl)
261 let nw: i64 = bl[0]
262 gv_check("cli-ran-and-produced-output" as *u8, (nw > 0) as i64, ctr)
263 gv_check_eq("cli-exits-clean" as *u8, rc, 0, ctr)
264 gv_check_eq("cli-members-agree-with-the-lib" as *u8, bg_num_after(buf, nw, "BUNDLE members=" as *u8), m, ctr)
265 gv_check_eq("cli-sum-agrees" as *u8, bg_num_after(buf, nw, " sum=" as *u8), sum, ctr)
266 gv_check_eq("cli-textures_bound-agrees" as *u8, bg_num_after(buf, nw, "textures_bound=" as *u8), p[BI_P_BOUND], ctr)
267 gv_check_eq("cli-unknown-agrees" as *u8, bg_num_after(buf, nw, " unknown=" as *u8), p[BI_P_UNKNOWN], ctr)
268 gv_check("cli-verdict-WALKED" as *u8, gk_out_has(buf, nw, "verdict=WALKED" as *u8), ctr)
269 let rc2: i64 = gk_run_capture(elf, BG_CUT, 0 as *u8, 0 as *u8, 0 as *u8, buf, BG_CAP, bl)
270 let nw2: i64 = bl[0]
271 gv_bite("neg-control-cli-refuses-the-truncated-container-BY-NAME" as *u8, gk_out_has(buf, nw2, "BUNDLE-REFUSE no-EOCD" as *u8), (rc == 0) as i64 * 0, ctr)
272 gv_check_eq("cli-refusal-uses-the-REFUSE-exit" as *u8, rc2, 3, ctr)
273 let dangling: *u8="/tmp/nx_bundle_ingest_gate/dangling-output-t144.obj"
274 gk_symlink("/tmp/nx_bundle_ingest_gate/absent-target-t144",dangling)
275 let link_probe: *u8=sys_mmap(BG_CAP)
276 gv_check("dangling output fixture is a symlink",(sys_readlinkat(dangling,link_probe,BG_CAP)>0) as i64,ctr)
277 let alias_path: *u8="/tmp/nx_bundle_ingest_gate/fixture-receipt-alias-t144.zip"
278 let link_rc: i64=gk_symlink(BG_FIX,alias_path)
279 gv_check("receipt alias fixture exists",(gk_exists(alias_path)==1) as i64,ctr)
280 let alias_rc: i64=gk_run_capture(elf,"inventory",BG_FIX,alias_path,"65536",buf,BG_CAP,bl)
281 gv_check_eq("receipt inode alias refused before append",alias_rc,5,ctr)
282 let after_n: i64=gk_read(BG_FIX,buf,BG_CAP)
283 gv_check_eq("receipt alias leaves archive size unchanged",after_n,zn,ctr)
284 gv_check_eq("receipt alias leaves archive bytes unchanged",nxzip_crc32(buf,after_n),nxzip_crc32(zip,zn),ctr)
285 nxzip_read_cd(zip,zn,cdp,fld)
286 let first_local: i64=fld[NX_ZIP_FLD_LOCALOFF]
287 let original_second: u8=zip[first_local+31]
288 zip[first_local+31]=0 as u8; zip[cdp+47]=0 as u8
289 gv_check_eq("embedded NUL fixture retained",bg_write_file("/tmp/nx_bundle_ingest_gate/fixture-nul-name-t144.zip",zip,zn),zn,ctr)
290 zip[first_local+31]=original_second; zip[cdp+47]=original_second
291
292 }
293 return gv_verdict("NX-BUNDLE-INGEST" as *u8, ctr, "a community zip is walked by content type through the shared ruler, DEFLATE members open through nx_deflate, textures bind to the mesh that names them, the unknown is reported and a STORED-only reader is proven insufficient" as *u8)
294}