code wiki / _hdl_build / nx_corpus_ingest_gate.nx

nx_corpus_ingest_gate.nx source

↩ module page · 341 lines · 22657 B

1// nx_corpus_ingest_gate.nx -- GATE for the corpus-ingest front door (dir -> searchable sovereign shard). 2// Builds a real test dir (/tmp) with: a raw .txt, an .html (tags/script/entities exercise nx_html_to_text), 3// a .bak (must be skipped), and TWO ~600KB files (forces the 1MB writer to batch across >=2 segments). 4// Assertions are RUN-INDEPENDENT (content-addressed skip-if-present makes re-runs clean): search truths + 5// the persisted manifest segment count, never per-run counters alone. On the gate base class (gv_check / 6// gv_verdict) since 2026-09-14 so /api/promote and /api/gate_run read the verdict from the exit code. 7// license_tier: ORIGINAL expect_exit: 0 8import "nx_corpus_ingest.nx" 9import "nx_g_puts_lib.nx" 10import "nx_gate_verdict.nx" 11 12func g_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 13func g_num(v: i64) -> i64 { 14 let bb: *u8 = sys_mmap(28); var m: i64 = v 15 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 16 let t: *u8 = sys_mmap(28); var k: i64 = 0 17 if m == 0 { t[0] = 48 as u8; k = 1 } 18 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 19 var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } 20 sys_write(1, bb, k); return 0 21} 22func g_contains(hay: *u8, hn: i64, needle: *u8) -> i64 { 23 let nl: i64 = g_len(needle) 24 if nl == 0 { return 1 } 25 var i: i64 = 0 26 while i + nl <= hn { 27 var m: i64 = 1 28 var j: i64 = 0 29 while j < nl { if hay[i + j] != needle[j] { m = 0; j = nl } else { j = j + 1 } } 30 if m == 1 { return 1 } 31 i = i + 1 32 } 33 return 0 34} 35func g_write(path: *u8, data: *u8, n: i64) -> i64 { 36 let fd: i64 = sys_openat_wr(path, 0x1a4) 37 if fd < 0 { return 0 - 1 } 38 sys_write(fd, data, n); sys_close(fd); return 0 39} 40 41// T9 fixture values, NAMED because the build ratchet counts inline literals 42const G_MODE_DIR: i64 = 0x1ed 43const G_COUNTS: i64 = 64 44const G_PREFIXBUF: i64 = 512 45const G_KEYBUF: i64 = 64 46const G_BOX: i64 = 16 47const G_TOP: i64 = 10 48const G_TREE_PRESENT: i64 = 7 // the tree fixture on a re-run: 4 files present (x.nx y.md w.nx b.plan) + b.plan's 3 rows (E3b), rows are content-addressed documents too 49const G_JOURNAL_BYTES: i64 = 1000000 // T12: a journal fixture LARGER than CI_DOCCAP, so only its tail window can be the document 50const G_JOURNAL_TAILROOM: i64 = 32 // bytes held back for the tail marker 51 52func main() -> i64 { 53 g_puts("=== nx_corpus_ingest gate (dir -> sovereign searchable shard; html->text; url rows; batching; tree walk; anchors) ===\n" as *u8) 54 let ctr: *i64 = gv_ctr() 55 let dir: *u8 = "/tmp/ci_gate_dir" as *u8 56 sys_mkdir(dir, 0x1ed) // exists-already is fine; files are rewritten each run 57 let fa: *u8 = "Alpha zenithterm ingestion check for the sovereign corpus front door. Tokenizer needs words." as *u8 58 g_write("/tmp/ci_gate_dir/a.txt" as *u8, fa, g_len(fa)) 59 let fb: *u8 = "<html><head><style>x{color:red}</style></head><body><h1>Beta estateterm page</h1><p>Planning &amp; probate content here.</p><script>evilmarker()</script></body></html>" as *u8 60 g_write("/tmp/ci_gate_dir/b.html" as *u8, fb, g_len(fb)) 61 let fc: *u8 = "bakmarkerterm should never be indexed from a .bak file" as *u8 62 g_write("/tmp/ci_gate_dir/c.bak" as *u8, fc, g_len(fc)) 63 // two ~600KB files -> the 1MB writer MUST split them across segments 64 let big: *u8 = sys_mmap(700000) 65 var bo: i64 = 0 66 var r: i64 = 0 67 while r < 30000 { bo = bo + 0; let w: *u8 = "filler corpus words " as *u8; var j: i64 = 0; while w[j] != (0 as u8) { big[bo] = w[j]; bo = bo + 1; j = j + 1 } r = r + 1 } 68 let m1: *u8 = "bigsegterm1 " as *u8 69 var j1: i64 = 0; while m1[j1] != (0 as u8) { big[bo] = m1[j1]; bo = bo + 1; j1 = j1 + 1 } 70 g_write("/tmp/ci_gate_dir/big1.txt" as *u8, big, bo) 71 // swap the unique marker for the second file (same filler, different tail = different cid) 72 var bo2: i64 = bo - 12 73 let m2: *u8 = "bigsegterm2 " as *u8 74 var j2: i64 = 0; while m2[j2] != (0 as u8) { big[bo2] = m2[j2]; bo2 = bo2 + 1; j2 = j2 + 1 } 75 g_write("/tmp/ci_gate_dir/big2.txt" as *u8, big, bo2) 76 77 let dom: *u8 = "cigatetest" as *u8 78 let counts: *i64 = sys_mmap(64) as *i64 79 let rc: i64 = ci_run(dir, dom, "/" as *u8, counts) 80 g_puts(" ci_run rc=" as *u8); g_num(rc) 81 g_puts(" ingested=" as *u8); g_num(counts[0]); g_puts(" present=" as *u8); g_num(counts[1]) 82 g_puts(" other=" as *u8); g_num(counts[2]); g_puts(" segs=" as *u8); g_num(counts[3]); g_puts("\n" as *u8) 83 84 let cids: *i64 = sys_mmap(64 * 8) as *i64 85 let scores: *i64 = sys_mmap(64 * 8) as *i64 86 87 // T1: the raw .txt doc is searchable 88 let n1: i64 = dss_search(dom, "zenithterm" as *u8, 10, cids, scores, 10) 89 gv_check("T1 raw .txt searchable" as *u8, (n1 == 1) as i64, ctr) 90 91 // T2: the .html doc was TEXT-EXTRACTED (searchable term; no tags; script suppressed; entity decoded) 92 let n2: i64 = dss_search(dom, "estateterm" as *u8, 10, cids, scores, 10) 93 var t2: i64 = 0 94 if n2 == 1 { 95 let prefix: *u8 = sys_mmap(512); dss_prefix(dom, prefix) 96 let h: *i64 = ss_open(prefix) 97 let key: *u8 = sys_mmap(64); dss_mkkey(cids[0], key) 98 let dp: *i64 = sys_mmap(16) as *i64; let dl: *i64 = sys_mmap(16) as *i64 99 if (h as i64) != 0 { if ss_hget(h, key, dp, dl) == 1 { 100 let txt: *u8 = dp[0] as *u8 101 if g_contains(txt, dl[0], "Beta estateterm page" as *u8) == 1 { 102 if g_contains(txt, dl[0], "<h1>" as *u8) == 0 { 103 if g_contains(txt, dl[0], "evilmarker" as *u8) == 0 { 104 if g_contains(txt, dl[0], "Planning & probate" as *u8) == 1 { t2 = 1 } 105 } 106 } 107 } 108 } } 109 } 110 gv_check("T2 html->text (tags gone, script suppressed, entity decoded)" as *u8, t2, ctr) 111 112 // T3: the html doc carries its url:<cid> row = "/b.html" (SERP links to the real page) 113 var t3: i64 = 0 114 if n2 == 1 { 115 let prefix3: *u8 = sys_mmap(512); dss_prefix(dom, prefix3) 116 let h3: *i64 = ss_open(prefix3) 117 let uk: *u8 = sys_mmap(64); ci_mkurlkey(cids[0], uk) 118 let up: *i64 = sys_mmap(16) as *i64; let ul: *i64 = sys_mmap(16) as *i64 119 if (h3 as i64) != 0 { if ss_hget(h3, uk, up, ul) == 1 { 120 if ul[0] == 7 { if g_contains(up[0] as *u8, ul[0], "/b.html" as *u8) == 1 { t3 = 1 } } 121 } } 122 } 123 gv_check("T3 url:<cid> row = /b.html" as *u8, t3, ctr) 124 125 // T4 NEG: the .bak file was never indexed 126 let n4: i64 = dss_search(dom, "bakmarkerterm" as *u8, 13, cids, scores, 10) 127 gv_check("T4 neg-control-.bak skipped" as *u8, (n4 == 0) as i64, ctr) 128 129 // T5: BOTH big docs searchable (the writer batched across segments without losing either) 130 let n5a: i64 = dss_search(dom, "bigsegterm1" as *u8, 11, cids, scores, 10) 131 let n5b: i64 = dss_search(dom, "bigsegterm2" as *u8, 11, cids, scores, 10) 132 gv_check("T5 both >0.5MB docs searchable across segments" as *u8, ((n5a == 1) as i64) * ((n5b == 1) as i64), ctr) 133 134 // T6: the shard REALLY spans >=2 segments (persisted manifest truth, run-independent) 135 let prefix6: *u8 = sys_mmap(512); dss_prefix(dom, prefix6) 136 let segs: *i64 = sys_mmap(256 * 8) as *i64 137 let nseg: i64 = ss_manifest_file(prefix6, "manifest.txt" as *u8, segs) 138 gv_check("T6 manifest >=2 segments" as *u8, (nseg >= 2) as i64, ctr) 139 140 // T7: idempotent re-run -- nothing double-ingested (zenithterm still exactly 1 hit) 141 let counts2: *i64 = sys_mmap(64) as *i64 142 ci_run(dir, dom, "/" as *u8, counts2) 143 let n7: i64 = dss_search(dom, "zenithterm" as *u8, 10, cids, scores, 10) 144 var t7: i64 = 0 145 if n7 == 1 { if counts2[0] == 0 { if counts2[1] >= 4 { t7 = 1 } } } 146 gv_check("T7 idempotent re-run (0 new, all present, still 1 hit)" as *u8, t7, ctr) 147 148 // T8 NEG (the 2026-07-03 library-url regression): NO urlprefix (null) -> NO url row may exist. 149 // The `"" as *u8` empty literal miscompiled to an unterminated pool pointer and silently stamped 150 // every doc with a junk href -- this row pins the no-urlprefix path clean forever. 151 let dom2: *u8 = "cigatetest2" as *u8 152 let counts3: *i64 = sys_mmap(64) as *i64 153 ci_run(dir, dom2, 0 as *u8, counts3) 154 let n8b: i64 = dss_search(dom2, "estateterm" as *u8, 10, cids, scores, 10) 155 var t8: i64 = 0 156 if n8b == 1 { 157 let prefix8: *u8 = sys_mmap(512); dss_prefix(dom2, prefix8) 158 let h8: *i64 = ss_open(prefix8) 159 let uk8: *u8 = sys_mmap(64); ci_mkurlkey(cids[0], uk8) 160 let up8: *i64 = sys_mmap(16) as *i64; let ul8: *i64 = sys_mmap(16) as *i64 161 if (h8 as i64) != 0 { if ss_hget(h8, uk8, up8, ul8) != 1 { t8 = 1 } } 162 } 163 gv_check("T8 neg-control-null urlprefix -> NO url row stamped" as *u8, t8, ctr) 164 165 // T9 (E1): the recursive source-tree walk -- nested dirs entered, the relative path as the url, fossil and 166 // hidden dirs never entered, and the whole thing idempotent on a re-run. Fixture files are rewritten each run. 167 // A FRESH FIXTURE SHARD EVERY RUN: the previous manifest is RETIRED (renamed, never deleted) before the tree 168 // ingest, or documents left by an earlier binary -- without anchors or path rows -- would sit beside this run's 169 // and no count below could hold. A gate that is not idempotent reports on its first run and lies on every run after. 170 let dom9: *u8 = "cigatetree" as *u8 171 let prefix9r: *u8 = sys_mmap(G_PREFIXBUF); dss_prefix(dom9, prefix9r) 172 let mf9: *u8 = sys_mmap(G_PREFIXBUF) 173 var mo9: i64 = ci_cat(mf9, 0, prefix9r); mo9 = ci_cat(mf9, mo9, "manifest.txt" as *u8); mf9[mo9] = 0 as u8 174 let mr9: *u8 = sys_mmap(G_PREFIXBUF) 175 var ro9: i64 = ci_cat(mr9, 0, prefix9r); ro9 = ci_cat(mr9, ro9, "manifest.retired" as *u8); mr9[ro9] = 0 as u8 176 sys_renameat(mf9, mr9) 177 let tr: *u8 = "/tmp/ci_gate_tree" as *u8 178 sys_mkdir(tr, G_MODE_DIR) 179 // the T12 journal lives in ITS OWN root; a first cut wrote it into this tree, where it survived to the next run and 180 // moved T9f's present count from three to four -- a fixture that leaks across runs lies on every run after the first. 181 // Any stray copy from that cut is moved out (a rename of an absent file is a harmless refusal). 182 sys_mkdir("/tmp/ci_gate_jrnl" as *u8, G_MODE_DIR) 183 sys_renameat("/tmp/ci_gate_tree/beat.jrnl" as *u8, "/tmp/ci_gate_jrnl/beat.jrnl.stray" as *u8) 184 sys_mkdir("/tmp/ci_gate_tree/sub" as *u8, G_MODE_DIR) 185 sys_mkdir("/tmp/ci_gate_tree/sub/deep" as *u8, G_MODE_DIR) 186 sys_mkdir("/tmp/ci_gate_tree/_build" as *u8, G_MODE_DIR) 187 sys_mkdir("/tmp/ci_gate_tree/.hidden" as *u8, G_MODE_DIR) 188 let tx: *u8 = "// a source file for the tree walk\nfunc treeterm_alpha() -> i64 { return 1 } // treewalkterm marks this file\n" as *u8 189 g_write("/tmp/ci_gate_tree/sub/deep/x.nx" as *u8, tx, g_len(tx)) 190 let ty: *u8 = "treemdterm is a markdown note under the root of the tree walk fixture" as *u8 191 g_write("/tmp/ci_gate_tree/y.md" as *u8, ty, g_len(ty)) 192 let tz: *u8 = "buildfossilterm must never be indexed from a _build directory of the tree" as *u8 193 g_write("/tmp/ci_gate_tree/_build/z.nx" as *u8, tz, g_len(tz)) 194 let th: *u8 = "hiddenterm must never be indexed from a hidden directory of the tree" as *u8 195 g_write("/tmp/ci_gate_tree/.hidden/h.nx" as *u8, th, g_len(th)) 196 // a directory whose name merely ENDS with _build must be entered: the skip list matches whole names 197 sys_mkdir("/tmp/ci_gate_tree/_hdl_build" as *u8, G_MODE_DIR) 198 let tw: *u8 = "hdlbuildterm lives under a directory whose name only ends with build and must be indexed" as *u8 199 g_write("/tmp/ci_gate_tree/_hdl_build/w.nx" as *u8, tw, g_len(tw)) 200 // E3b fixture board: a comment row, a rung row, a rungrole row and a log row; the rung row earns the definition 201 // token of its id and every row is its own document beside the whole file 202 let tb: *u8 = "# fixture board\nrung|ZZ9|A fixture rung with a title|zz_symbol|note text for the fixture rung row\nrungrole|ZZ9|substrate|T-FX|why the fixture rung stands where it stands\nlog|1|ZZ9|measure|ZZ9 ZZ9 ZZ9 mentioned thrice in a measure row about the fixture rung\n" as *u8 203 g_write("/tmp/ci_gate_tree/b.plan" as *u8, tb, g_len(tb)) 204 let counts9: *i64 = sys_mmap(G_COUNTS) as *i64 205 let walked9: i64 = ci_ingest_source_tree(tr, dom9, "estate://tree/" as *u8, counts9) 206 g_puts(" ci_ingest_source_tree walked=" as *u8); g_num(walked9); g_puts(" ingested=" as *u8); g_num(counts9[0]); g_puts(" present=" as *u8); g_num(counts9[1]); g_puts(" other=" as *u8); g_num(counts9[2]); g_puts(" segs=" as *u8); g_num(counts9[3]); g_puts("\n" as *u8) 207 let q9: *u8 = "treewalkterm" as *u8 208 let n9: i64 = dss_search(dom9, q9, g_len(q9), cids, scores, G_TOP) 209 gv_check("T9 a source file two directories down is searchable" as *u8, (n9 == 1) as i64, ctr) 210 var t9b: i64 = 0 211 if n9 == 1 { 212 let prefix9: *u8 = sys_mmap(G_PREFIXBUF); dss_prefix(dom9, prefix9) 213 let h9: *i64 = ss_open(prefix9) 214 let uk9: *u8 = sys_mmap(G_KEYBUF); ci_mkurlkey(cids[0], uk9) 215 let up9: *i64 = sys_mmap(G_BOX) as *i64; let ul9: *i64 = sys_mmap(G_BOX) as *i64 216 let want9: *u8 = "estate://tree/sub/deep/x.nx" as *u8 217 if (h9 as i64) != 0 { if ss_hget(h9, uk9, up9, ul9) == 1 { 218 if ul9[0] == g_len(want9) { if g_contains(up9[0] as *u8, ul9[0], want9) == 1 { t9b = 1 } } 219 } } 220 } 221 gv_check("T9b its url row is the path relative to the root under the prefix" as *u8, t9b, ctr) 222 let q9c: *u8 = "treemdterm" as *u8 223 let n9c: i64 = dss_search(dom9, q9c, g_len(q9c), cids, scores, G_TOP) 224 gv_check("T9c a markdown file at the root is searchable" as *u8, (n9c == 1) as i64, ctr) 225 let q9d: *u8 = "buildfossilterm" as *u8 226 let n9d: i64 = dss_search(dom9, q9d, g_len(q9d), cids, scores, G_TOP) 227 gv_check("T9d neg-control-a _build directory is never entered" as *u8, (n9d == 0) as i64, ctr) 228 let q9e: *u8 = "hiddenterm" as *u8 229 let n9e: i64 = dss_search(dom9, q9e, g_len(q9e), cids, scores, G_TOP) 230 gv_check("T9e neg-control-a hidden directory is never entered" as *u8, (n9e == 0) as i64, ctr) 231 let q9g: *u8 = "hdlbuildterm" as *u8 232 let n9g: i64 = dss_search(dom9, q9g, g_len(q9g), cids, scores, G_TOP) 233 gv_check("T9g a directory whose name only ends with build IS entered (the skip list matches whole names)" as *u8, (n9g == 1) as i64, ctr) 234 let counts9b: *i64 = sys_mmap(G_COUNTS) as *i64 235 ci_ingest_source_tree(tr, dom9, "estate://tree/" as *u8, counts9b) 236 let n9f: i64 = dss_search(dom9, q9, g_len(q9), cids, scores, G_TOP) 237 var t9f: i64 = 0 238 if n9f == 1 { if counts9b[0] == 0 { if counts9b[1] == G_TREE_PRESENT { t9f = 1 } } } 239 gv_check("T9f idempotent re-run (0 new, both present, still 1 hit)" as *u8, t9f, ctr) 240 // T10 (E1): identifier anchors and the path row -- a changed file REPLACES its document, and an underscored 241 // identifier is searchable whole through its collapsed anchor 242 let q10: *u8 = "treetermalpha" as *u8 243 let n10: i64 = dss_search(dom9, q10, g_len(q10), cids, scores, G_TOP) 244 gv_check("T10 the collapsed identifier of func tree_term_alpha is an anchor the walk indexed" as *u8, (n10 == 1) as i64, ctr) 245 let tx2: *u8 = "// the same file, rewritten\nfunc tree_term_alpha() -> i64 { return 2 } // treeretermwalk marks the second version\n" as *u8 246 g_write("/tmp/ci_gate_tree/sub/deep/x.nx" as *u8, tx2, g_len(tx2)) 247 let counts10: *i64 = sys_mmap(G_COUNTS) as *i64 248 ci_ingest_source_tree(tr, dom9, "estate://tree/" as *u8, counts10) 249 g_puts(" re-ingest after a change: ingested=" as *u8); g_num(counts10[0]); g_puts(" replaced=" as *u8); g_num(counts10[4]); g_puts(" present=" as *u8); g_num(counts10[1]); g_puts("\n" as *u8) 250 gv_check("T10b the changed file counts as ONE replacement" as *u8, (counts10[4] == 1) as i64, ctr) 251 let q10c: *u8 = "treeretermwalk" as *u8 252 let n10c: i64 = dss_search(dom9, q10c, g_len(q10c), cids, scores, G_TOP) 253 gv_check("T10c the new version is searchable" as *u8, (n10c == 1) as i64, ctr) 254 let n10d: i64 = dss_search(dom9, q9, g_len(q9), cids, scores, G_TOP) 255 gv_check("T10d neg-control-the old version is tombstoned: its own marker answers zero" as *u8, (n10d == 0) as i64, ctr) 256 let n10e: i64 = dss_search(dom9, q10, g_len(q10), cids, scores, G_TOP) 257 gv_check("T10e the identifier anchor still answers exactly one document, the replacement" as *u8, (n10e == 1) as i64, ctr) 258 // T13 (E3b): board rows as documents -- the fixture board's rung row is its own document with the row index in 259 // its url and carries the definition token of its id; the whole file is still a document of its own. 260 let q13: *u8 = "defzz9" as *u8 261 let n13: i64 = dss_search(dom9, q13, g_len(q13), cids, scores, G_TOP) 262 gv_check("T13 the rung row's definition token is indexed exactly once (the rung row document)" as *u8, (n13 == 1) as i64, ctr) 263 var t13b: i64 = 0 264 if n13 == 1 { 265 let prefix13: *u8 = sys_mmap(G_PREFIXBUF); dss_prefix(dom9, prefix13) 266 let h13: *i64 = ss_open(prefix13) 267 let uk13: *u8 = sys_mmap(G_KEYBUF); ci_mkurlkey(cids[0], uk13) 268 let up13: *i64 = sys_mmap(G_BOX) as *i64; let ul13: *i64 = sys_mmap(G_BOX) as *i64 269 let want13: *u8 = "estate://tree/b.plan#1" as *u8 270 if (h13 as i64) != 0 { if ss_hget(h13, uk13, up13, ul13) == 1 { 271 if ul13[0] == g_len(want13) { if g_contains(up13[0] as *u8, ul13[0], want13) == 1 { t13b = 1 } } 272 } } 273 } 274 gv_check("T13b the rung row's url is the board url with its row index (the comment row is row 0)" as *u8, t13b, ctr) 275 let q13c: *u8 = "zz9" as *u8 276 let n13c: i64 = dss_search(dom9, q13c, g_len(q13c), cids, scores, G_TOP) 277 gv_check("T13c the id is found in the whole-file document AND its rows (at least four documents)" as *u8, (n13c >= 4) as i64, ctr) 278 // T11 (E1b): a definition token per function head -- the def prefix glued to the collapsed name -- so the file 279 // that DECLARES a symbol carries a term no caller carries. The rewritten x.nx declares tree_term_alpha; the word 280 // treeretermwalk in the same file is not a head and must earn no token. 281 let q11: *u8 = "deftreetermalpha" as *u8 282 let n11: i64 = dss_search(dom9, q11, g_len(q11), cids, scores, G_TOP) 283 gv_check("T11 the definition token of func tree_term_alpha is an anchor the walk indexed" as *u8, (n11 == 1) as i64, ctr) 284 let q11b: *u8 = "deftreeretermwalk" as *u8 285 let n11b: i64 = dss_search(dom9, q11b, g_len(q11b), cids, scores, G_TOP) 286 gv_check("T11b neg-control-a-word-that-is-not-a-function-head earns no definition token" as *u8, (n11b == 0) as i64, ctr) 287 // T12 (E3): the boards verb -- one conf row per tree (root|domain|urlprefix, a comment row ignored, a CRLF row 288 // tolerated), every row walked through the ONE tree ingest with the counts summed; and an append-only journal is 289 // anchored at its TAIL (the newest CI_DOCCAP bytes), so a marker in the head of an oversized journal is NOT indexed 290 // while one in its tail is. Fresh shard every run, the same retire-the-manifest discipline as T9. 291 let domb: *u8 = "cigateboards" as *u8 292 let prefixbr: *u8 = sys_mmap(G_PREFIXBUF); dss_prefix(domb, prefixbr) 293 let mfb: *u8 = sys_mmap(G_PREFIXBUF) 294 var mob: i64 = ci_cat(mfb, 0, prefixbr); mob = ci_cat(mfb, mob, "manifest.txt" as *u8); mfb[mob] = 0 as u8 295 let mrb: *u8 = sys_mmap(G_PREFIXBUF) 296 var rob: i64 = ci_cat(mrb, 0, prefixbr); rob = ci_cat(mrb, rob, "manifest.retired" as *u8); mrb[rob] = 0 as u8 297 sys_renameat(mfb, mrb) 298 let jb: *u8 = sys_mmap(G_JOURNAL_BYTES) 299 let jh: *u8 = "jrnlheadterm " as *u8 300 var jo: i64 = 0 301 var jhi: i64 = 0 302 while jh[jhi] != (0 as u8) { jb[jo] = jh[jhi]; jo = jo + 1; jhi = jhi + 1 } 303 while jo < G_JOURNAL_BYTES - G_JOURNAL_TAILROOM { let w2: *u8 = "journal filler row " as *u8; var wj: i64 = 0; while w2[wj] != (0 as u8) { jb[jo] = w2[wj]; jo = jo + 1; wj = wj + 1 } } 304 let jt: *u8 = " jrnltailterm\n" as *u8 305 var jti: i64 = 0 306 while jt[jti] != (0 as u8) { jb[jo] = jt[jti]; jo = jo + 1; jti = jti + 1 } 307 g_write("/tmp/ci_gate_jrnl/beat.jrnl" as *u8, jb, jo) 308 let cf0: *u8 = "# boards fixture: three roots, one comment row\n/tmp/ci_gate_tree|cigateboards|estate://b1/" as *u8 309 let cf1: *u8 = "\n/tmp/ci_gate_dir|cigateboards|estate://b2/\n/tmp/ci_gate_jrnl|cigateboards|estate://b3/\n" as *u8 310 let cfb: *u8 = sys_mmap(G_PREFIXBUF) 311 var co: i64 = 0 312 var c0: i64 = 0 313 while cf0[c0] != (0 as u8) { cfb[co] = cf0[c0]; co = co + 1; c0 = c0 + 1 } 314 cfb[co] = CI_CR as u8; co = co + 1 315 var c1: i64 = 0 316 while cf1[c1] != (0 as u8) { cfb[co] = cf1[c1]; co = co + 1; c1 = c1 + 1 } 317 g_write("/tmp/ci_gate_boards.conf" as *u8, cfb, co) 318 let counts12: *i64 = sys_mmap(G_COUNTS) as *i64 319 let rows12: i64 = ci_ingest_boards("/tmp/ci_gate_boards.conf" as *u8, counts12) 320 g_puts(" ci_ingest_boards rows=" as *u8); g_num(rows12); g_puts(" ingested=" as *u8); g_num(counts12[0]); g_puts(" other=" as *u8); g_num(counts12[2]); g_puts("\n" as *u8) 321 gv_check("T12 the boards verb walks every conf row (three roots) and ignores the comment row" as *u8, (rows12 == 3) as i64, ctr) 322 let n12b: i64 = dss_search(domb, "zenithterm" as *u8, 10, cids, scores, G_TOP) 323 gv_check("T12b the second root's raw text document is searchable under the boards domain" as *u8, (n12b == 1) as i64, ctr) 324 let n12c: i64 = dss_search(domb, q10c, g_len(q10c), cids, scores, G_TOP) 325 gv_check("T12c the first root's source file is searchable under the boards domain (its CRLF row parsed clean)" as *u8, (n12c == 1) as i64, ctr) 326 let q12d: *u8 = "jrnltailterm" as *u8 327 let n12d: i64 = dss_search(domb, q12d, g_len(q12d), cids, scores, G_TOP) 328 gv_check("T12d a journal's TAIL marker is indexed" as *u8, (n12d == 1) as i64, ctr) 329 let q12e: *u8 = "jrnlheadterm" as *u8 330 let n12e: i64 = dss_search(domb, q12e, g_len(q12e), cids, scores, G_TOP) 331 gv_check("T12e neg-control-a-journal-head-marker-past-the-tail-window is not indexed" as *u8, (n12e == 0) as i64, ctr) 332 333 gv_values_head() 334 gv_kv("dir_ingested" as *u8, counts[0]) 335 gv_kv("boards_rows" as *u8, rows12) 336 gv_kv("dir_segments" as *u8, nseg) 337 gv_kv("tree_walked" as *u8, walked9) 338 gv_kv("tree_ingested" as *u8, counts9[0]) 339 gv_kv("tree_replaced" as *u8, counts10[4]) 340 return gv_verdict("NX-CORPUS-INGEST-GATE" as *u8, ctr, "the corpus front door: a flat dir and a source tree into a searchable sovereign shard with url rows, identifier and definition anchors, replacement tombstones and idempotent re-runs" as *u8) 341}