code wiki / (root) / nx_labsci_svc_test.nx

nx_labsci_svc_test.nx source

↩ module page · 334 lines · 19607 B

1// nx_labsci_svc_test.nx -- gate for the lab-science facade. Proves the SAME 2// nx_service base drives a totally different domain: peptide masses match the 3// library, the refusal paths surface as structured errors, and the workflow 4// shape holds. This is the "it scales" evidence -- a second science, one base. 5// expect_exit: 0 license_tier: ORIGINAL 6import "nx_syscalls.nx" 7import "nx_service.nx" 8import "nx_peptide.nx" 9import "nx_labsci_svc.nx" 10 11func t_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 12func t_putn(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 - m; sys_write(1, "-" as *u8, 1) } let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, bb, k); return 0 } 13 14func j_has(j: *NxJson, needle: *u8) -> i64 { 15 var nn: i64 = 0 16 while needle[nn] != (0 as u8) { nn = nn + 1 } 17 if nn == 0 { return 0 } 18 let b: *u8 = j.buf 19 let last: i64 = j.off - nn 20 var i: i64 = 0 21 var found: i64 = 0 22 while i <= last { 23 if found == 0 { 24 var m: i64 = 0 25 var ok: i64 = 1 26 while m < nn { if b[i + m] != needle[m] { ok = 0 } m = m + 1 } 27 if ok == 1 { found = 1 } 28 } 29 i = i + 1 30 } 31 return found 32} 33 34func mk_argv(a0: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, a5: *u8, a6: *u8) -> *i64 { 35 let av: *i64 = sys_mmap(64) 36 av[0] = a0 as i64 37 av[1] = a1 as i64 38 av[2] = a2 as i64 39 av[3] = a3 as i64 40 av[4] = a4 as i64 41 av[5] = a5 as i64 42 av[6] = a6 as i64 43 return av 44} 45 46func main() -> i64 { 47 var pass: i64 = 0 48 var total: i64 = 0 49 let NUL: *u8 = "\x00" as *u8 50 51 // --- T1 describe: the SAME base drives a different domain's catalog --- 52 total = total + 1 53 let j1: *NxJson = nx_json_new(8192) 54 let av1: *i64 = mk_argv("nx_labsci_svc" as *u8, "describe" as *u8, NUL, NUL, NUL, NUL, NUL) 55 lab_dispatch(2, av1, j1) 56 let d1: i64 = j_has(j1, "\"svc\":\"labsci\"" as *u8) 57 let d2: i64 = j_has(j1, "peptide.analyze" as *u8) 58 let d3: i64 = j_has(j1, "water.activity" as *u8) 59 t_puts("T1 labsci describe: svc+catalog=" as *u8); t_putn(d1); t_putn(d2); t_putn(d3); t_puts(": " as *u8) 60 var ok1: i64 = 1 61 if d1 != 1 { ok1 = 0 } 62 if d2 != 1 { ok1 = 0 } 63 if d3 != 1 { ok1 = 0 } 64 if ok1 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 65 66 // --- T2 peptide.analyze matches the library exactly (angiotensin II) --- 67 total = total + 1 68 let j2: *NxJson = nx_json_new(4096) 69 let av2: *i64 = mk_argv("nx_labsci_svc" as *u8, "peptide.analyze" as *u8, "DRVYIHPF" as *u8, NUL, NUL, NUL, NUL) 70 lab_dispatch(3, av2, j2) 71 // pI comes from the SHARED interpolated pow10 (wave-2 refactor), so it is 72 // 7540, tighter than the pre-refactor 7549 -- assert the neutral band and 73 // the exact library value, not a stale constant. 74 let lib_mass: i64 = pep_mass_mono_q4("DRVYIHPF" as *u8) 75 let lib_pi: i64 = pep_pi_milli("DRVYIHPF" as *u8) 76 let has_mass: i64 = j_has(j2, "\"monoisotopic_mass_q4\":10455345" as *u8) 77 let has_pi: i64 = j_has(j2, "\"pi_milli\":7540" as *u8) 78 t_puts("T2 peptide.analyze DRVYIHPF: library mass=" as *u8); t_putn(lib_mass); t_puts(" pI=" as *u8); t_putn(lib_pi); t_puts(" facade mass-match=" as *u8); t_putn(has_mass); t_puts(" pI-match=" as *u8); t_putn(has_pi); t_puts(": " as *u8) 79 var ok2: i64 = 1 80 if lib_mass != 10455345 { ok2 = 0 } 81 if lib_pi < 7000 { ok2 = 0 } 82 if lib_pi > 8000 { ok2 = 0 } 83 if has_mass != 1 { ok2 = 0 } 84 if has_pi != 1 { ok2 = 0 } 85 if ok2 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 86 87 // --- T3 a non-standard residue REFUSES as a structured 422, not a 88 // fabricated mass --- 89 total = total + 1 90 let j3: *NxJson = nx_json_new(4096) 91 let av3: *i64 = mk_argv("nx_labsci_svc" as *u8, "peptide.analyze" as *u8, "DRVYIHPZ" as *u8, NUL, NUL, NUL, NUL) 92 lab_dispatch(3, av3, j3) 93 let refused: i64 = j_has(j3, "\"code\":\"REFUSED\"" as *u8) 94 let status422: i64 = j_has(j3, "\"status\":422" as *u8) 95 t_puts("T3 bad residue: REFUSED=" as *u8); t_putn(refused); t_puts(" 422=" as *u8); t_putn(status422); t_puts(": " as *u8) 96 if refused == 1 { if status422 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 97 98 // --- T4 icecream.freeze routes 5 numeric args and computes --- 99 total = total + 1 100 let j4: *NxJson = nx_json_new(4096) 101 let av4: *i64 = mk_argv("nx_labsci_svc" as *u8, "icecream.freeze" as *u8, "120" as *u8, "100" as *u8, "150" as *u8, "34230" as *u8, "1000" as *u8) 102 lab_dispatch(7, av4, j4) 103 // No other-solids arg in this facade, so water = 1000-(120+100+150) = 630, 104 // and the freezing point tracks that water (-2354), a real function of the 105 // exact input rather than the ref mix's -2472. 106 let has_water: i64 = j_has(j4, "\"water_g\":630" as *u8) 107 let has_fp: i64 = j_has(j4, "\"freezing_point_milli_c\":-2354" as *u8) 108 let has_frozen: i64 = j_has(j4, "\"frozen_permil_at_minus13c\":819" as *u8) 109 t_puts("T4 icecream.freeze 12/10/15 mix: water630=" as *u8); t_putn(has_water); t_puts(" fp-2354=" as *u8); t_putn(has_fp); t_puts(" frozen819=" as *u8); t_putn(has_frozen); t_puts(": " as *u8) 110 var ok4: i64 = 1 111 if has_water != 1 { ok4 = 0 } 112 if has_fp != 1 { ok4 = 0 } 113 if has_frozen != 1 { ok4 = 0 } 114 if ok4 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 115 116 // --- T5 thermal.pasteurize: the bumped ice-cream-mix schedule check --- 117 total = total + 1 118 let j5: *NxJson = nx_json_new(4096) 119 let av5: *i64 = mk_argv("nx_labsci_svc" as *u8, "thermal.pasteurize" as *u8, "74445" as *u8, "15000" as *u8, "1" as *u8, NUL, NUL) 120 lab_dispatch(5, av5, j5) 121 let compliant: i64 = j_has(j5, "\"compliant\":true" as *u8) 122 let j5b: *NxJson = nx_json_new(4096) 123 let av5b: *i64 = mk_argv("nx_labsci_svc" as *u8, "thermal.pasteurize" as *u8, "71667" as *u8, "15000" as *u8, "1" as *u8, NUL, NUL) 124 lab_dispatch(5, av5b, j5b) 125 let noncompliant: i64 = j_has(j5b, "\"compliant\":false" as *u8) 126 t_puts("T5 mix 74.4C/15s compliant=" as *u8); t_putn(compliant); t_puts(" ; 71.7C/15s (milk temp) compliant-false=" as *u8); t_putn(noncompliant); t_puts(": " as *u8) 127 if compliant == 1 { if noncompliant == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 128 129 // --- T6 water.activity: the ice-cream-mix truth (not protected) --- 130 total = total + 1 131 let j6: *NxJson = nx_json_new(4096) 132 let av6: *i64 = mk_argv("nx_labsci_svc" as *u8, "water.activity" as *u8, "600" as *u8, "800000" as *u8, NUL, NUL, NUL) 133 lab_dispatch(4, av6, j6) 134 let phf: i64 = j_has(j6, "\"potentially_hazardous\":true" as *u8) 135 let bot: i64 = j_has(j6, "\"botulinum_can_grow\":true" as *u8) 136 t_puts("T6 water.activity high-moisture: PHF=" as *u8); t_putn(phf); t_puts(" botulinum=" as *u8); t_putn(bot); t_puts(": " as *u8) 137 if phf == 1 { if bot == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 138 139 // --- T7 water.activity REFUSES no-water rather than reporting dry-safe --- 140 total = total + 1 141 let j7: *NxJson = nx_json_new(4096) 142 let av7: *i64 = mk_argv("nx_labsci_svc" as *u8, "water.activity" as *u8, "0" as *u8, "1000" as *u8, NUL, NUL, NUL) 143 lab_dispatch(4, av7, j7) 144 let ref7: i64 = j_has(j7, "\"code\":\"REFUSED\"" as *u8) 145 t_puts("T7 no-water refused (not 'dry therefore safe')=" as *u8); t_putn(ref7); t_puts(": " as *u8) 146 if ref7 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 147 148 // --- T8 thermal.barrier shares the pH 4.6 line --- 149 total = total + 1 150 let j8: *NxJson = nx_json_new(4096) 151 let av8: *i64 = mk_argv("nx_labsci_svc" as *u8, "thermal.barrier" as *u8, "6600" as *u8, "0" as *u8, NUL, NUL, NUL) 152 lab_dispatch(4, av8, j8) 153 let barrier3: i64 = j_has(j8, "\"barrier_required\":3" as *u8) 154 let j8b: *NxJson = nx_json_new(4096) 155 let av8b: *i64 = mk_argv("nx_labsci_svc" as *u8, "thermal.barrier" as *u8, "3500" as *u8, "1" as *u8, NUL, NUL, NUL) 156 lab_dispatch(4, av8b, j8b) 157 let barrier1: i64 = j_has(j8b, "\"barrier_required\":1" as *u8) 158 t_puts("T8 pH6.6 chilled->cold-chain(3)=" as *u8); t_putn(barrier3); t_puts(" pH3.5->acid(1)=" as *u8); t_putn(barrier1); t_puts(": " as *u8) 159 if barrier3 == 1 { if barrier1 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 160 161 // --- T9 unknown verb -> structured 404 + non-zero exit --- 162 total = total + 1 163 let j9: *NxJson = nx_json_new(4096) 164 let av9: *i64 = mk_argv("nx_labsci_svc" as *u8, "nope.nope" as *u8, NUL, NUL, NUL, NUL, NUL) 165 let rc9: i64 = lab_dispatch(2, av9, j9) 166 let e404: i64 = j_has(j9, "\"status\":404" as *u8) 167 t_puts("T9 unknown verb: rc=" as *u8); t_putn(rc9); t_puts(" 404=" as *u8); t_putn(e404); t_puts(": " as *u8) 168 if rc9 != 0 { if e404 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 169 170 // --- T10 peptide.analyze joins a whitespace-split sequence too --- 171 total = total + 1 172 let j10: *NxJson = nx_json_new(4096) 173 let av10: *i64 = mk_argv("nx_labsci_svc" as *u8, "peptide.analyze" as *u8, "RPPGFSPFR" as *u8, NUL, NUL, NUL, NUL) 174 lab_dispatch(3, av10, j10) 175 let bk_ok: i64 = j_has(j10, "\"length\":9" as *u8) 176 let a280: i64 = j_has(j10, "\"a280_quantifiable\":false" as *u8) 177 t_puts("T10 bradykinin len9=" as *u8); t_putn(bk_ok); t_puts(" A280-unquantifiable=" as *u8); t_putn(a280); t_puts(" (no W/Y): " as *u8) 178 if bk_ok == 1 { if a280 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 179 180 // --- T11 stability.shelf answers the 25 C -> 40 C projection the 181 // decade-only path REFUSED, and carries the recovered Ea with it. 182 // 730 days at 25 C / 3.98 = 183 days at 40 C -- i.e. the facade 183 // reproduces ICH's own 24-months-to-6-months equivalence. --- 184 total = total + 1 185 let j11: *NxJson = nx_json_new(4096) 186 let av11: *i64 = mk_argv("nx_labsci_svc" as *u8, "stability.shelf" as *u8, "730" as *u8, "25" as *u8, "40" as *u8, "24" as *u8, "5" as *u8) 187 lab_dispatch(7, av11, j11) 188 let sh_days: i64 = j_has(j11, "\"shelf_days_at_target\":183" as *u8) 189 let sh_ea: i64 = j_has(j11, "\"activation_energy_j_per_mol\":71623" as *u8) 190 let sh_ret: i64 = j_has(j11, "\"potency_retained_permil\":939" as *u8) 191 let sh_hard: i64 = j_has(j11, "\"accelerated_alone_sets_shelf_life\":false" as *u8) 192 t_puts("T11 stability.shelf 730d@25C->40C: 183d=" as *u8); t_putn(sh_days) 193 t_puts(" Ea=71623=" as *u8); t_putn(sh_ea); t_puts(" retained939=" as *u8); t_putn(sh_ret) 194 t_puts(" accel-alone-false=" as *u8); t_putn(sh_hard); t_puts(": " as *u8) 195 var ok11: i64 = 1 196 if sh_days != 1 { ok11 = 0 } 197 if sh_ea != 1 { ok11 = 0 } 198 if sh_ret != 1 { ok11 = 0 } 199 if sh_hard != 1 { ok11 = 0 } 200 if ok11 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 201 202 // --- T12 stability.mkt: a 5 C / 45 C history averages to exactly 25 C but 203 // degrades like 37.25 C. The facade reports BOTH numbers so the 204 // consumer cannot take the reassuring one on its own. --- 205 total = total + 1 206 let j12: *NxJson = nx_json_new(4096) 207 let av12: *i64 = mk_argv("nx_labsci_svc" as *u8, "stability.mkt" as *u8, "5" as *u8, "45" as *u8, NUL, NUL, NUL) 208 lab_dispatch(4, av12, j12) 209 let mk_mean: i64 = j_has(j12, "\"arithmetic_mean_centi_c\":2500" as *u8) 210 let mk_gap: i64 = j_has(j12, "\"understatement_centi_c\":1225" as *u8) 211 t_puts("T12 stability.mkt 5C/45C: mean=25.00C=" as *u8); t_putn(mk_mean) 212 t_puts(" understatement=12.25C=" as *u8); t_putn(mk_gap); t_puts(": " as *u8) 213 if mk_mean == 1 { if mk_gap == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 214 215 // --- T13 PER-VERB GROUNDING HONESTY. The SAME facade must report 216 // VALIDATED/verified:true for stability (Ea recovered from the 217 // regulation and cross-checked) and ASSERTED/verified:false for 218 // water activity (organism thresholds are domain constants). 219 // One tool, two honesty levels, decided per claim not per tool. --- 220 total = total + 1 221 let j13: *NxJson = nx_json_new(4096) 222 let av13: *i64 = mk_argv("nx_labsci_svc" as *u8, "water.activity" as *u8, "600" as *u8, "4000" as *u8, NUL, NUL, NUL) 223 lab_dispatch(4, av13, j13) 224 let g_stab: i64 = j_has(j11, "\"grounding\":\"VALIDATED\"" as *u8) 225 let v_stab: i64 = j_has(j11, "\"verified\":true" as *u8) 226 let g_water: i64 = j_has(j13, "\"grounding\":\"ASSERTED\"" as *u8) 227 let v_water: i64 = j_has(j13, "\"verified\":false" as *u8) 228 t_puts("T13 grounding discriminates: stability VALIDATED=" as *u8); t_putn(g_stab) 229 t_puts("/verified=" as *u8); t_putn(v_stab); t_puts(" water ASSERTED=" as *u8); t_putn(g_water) 230 t_puts("/unverified=" as *u8); t_putn(v_water); t_puts(": " as *u8) 231 var ok13: i64 = 1 232 if g_stab != 1 { ok13 = 0 } 233 if v_stab != 1 { ok13 = 0 } 234 if g_water != 1 { ok13 = 0 } 235 if v_water != 1 { ok13 = 0 } 236 if ok13 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 237 238 // --- T14 FAIL-CLOSED at the service boundary: one reading is not a 239 // history, and a bad loss percentage is refused rather than 240 // normalised into something plausible. --- 241 total = total + 1 242 let j14: *NxJson = nx_json_new(4096) 243 let av14: *i64 = mk_argv("nx_labsci_svc" as *u8, "stability.mkt" as *u8, "25" as *u8, NUL, NUL, NUL, NUL) 244 lab_dispatch(3, av14, j14) 245 let j14b: *NxJson = nx_json_new(4096) 246 let av14b: *i64 = mk_argv("nx_labsci_svc" as *u8, "stability.shelf" as *u8, "730" as *u8, "25" as *u8, "40" as *u8, "24" as *u8, "0" as *u8) 247 lab_dispatch(7, av14b, j14b) 248 let e400a: i64 = j_has(j14, "\"status\":400" as *u8) 249 let e400b: i64 = j_has(j14b, "\"status\":400" as *u8) 250 t_puts("T14 one-reading history 400=" as *u8); t_putn(e400a) 251 t_puts(" zero loss_pct 400=" as *u8); t_putn(e400b); t_puts(": " as *u8) 252 if e400a == 1 { if e400b == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } } else { t_puts("FAIL\n" as *u8) } 253 254 // --- T15 stability.separate splits the lumped parameter given a design 255 // that supports it, and reports the conditioning alongside. --- 256 total = total + 1 257 let j15: *NxJson = nx_json_new(4096) 258 let av15: *i64 = sys_mmap(128) 259 av15[0] = "nx_labsci_svc" as i64; av15[1] = "stability.separate" as i64 260 av15[2] = "25" as i64; av15[3] = "60" as i64; av15[4] = "24" as i64 261 av15[5] = "40" as i64; av15[6] = "75" as i64; av15[7] = "6" as i64 262 av15[8] = "40" as i64; av15[9] = "25" as i64; av15[10] = "34" as i64 263 lab_dispatch(11, av15, j15) 264 let sep_b10: i64 = j_has(j15, "\"moisture_sensitivity_b10_milli_per_pct_rh\":15" as *u8) 265 let sep_band: i64 = j_has(j15, "\"moisture_sensitivity_in_published_band\":true" as *u8) 266 let sep_cond: i64 = j_has(j15, "\"design_is_well_conditioned\":true" as *u8) 267 let sep_ich: i64 = j_has(j15, "\"ich_pair_alone_could_separate\":false" as *u8) 268 t_puts("T15 separate: B10=15=" as *u8); t_putn(sep_b10); t_puts(" in-band=" as *u8); t_putn(sep_band) 269 t_puts(" well-conditioned=" as *u8); t_putn(sep_cond); t_puts(" ich-alone-false=" as *u8); t_putn(sep_ich); t_puts(": " as *u8) 270 var ok15: i64 = 1 271 if sep_b10 != 1 { ok15 = 0 } 272 if sep_band != 1 { ok15 = 0 } 273 if sep_cond != 1 { ok15 = 0 } 274 if sep_ich != 1 { ok15 = 0 } 275 if ok15 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 276 277 // --- T16 and it REFUSES a singular design at the service boundary with a 278 // 422, rather than emitting a confident meaningless number. --- 279 total = total + 1 280 let j16: *NxJson = nx_json_new(4096) 281 let av16: *i64 = sys_mmap(128) 282 av16[0] = "nx_labsci_svc" as i64; av16[1] = "stability.separate" as i64 283 av16[2] = "25" as i64; av16[3] = "60" as i64; av16[4] = "24" as i64 284 av16[5] = "40" as i64; av16[6] = "60" as i64; av16[7] = "6" as i64 285 av16[8] = "55" as i64; av16[9] = "60" as i64; av16[10] = "2" as i64 286 lab_dispatch(11, av16, j16) 287 let e422: i64 = j_has(j16, "\"status\":422" as *u8) 288 t_puts("T16 fixed-humidity design refused with 422=" as *u8); t_putn(e422); t_puts(": " as *u8) 289 if e422 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 290 291 // --- T17 icecream.recrystal reports steady and cycled outcomes side by 292 // side. A verb that returned only one of them would let a caller 293 // conclude a fluctuating cabinet is fine. --- 294 total = total + 1 295 let j17: *NxJson = nx_json_new(4096) 296 let av17: *i64 = sys_mmap(128) 297 av17[0] = "nx_labsci_svc" as i64; av17[1] = "icecream.recrystal" as i64 298 av17[2] = "120" as i64; av17[3] = "100" as i64; av17[4] = "150" as i64; av17[5] = "1000" as i64 299 av17[6] = "-20000" as i64; av17[7] = "-16000" as i64; av17[8] = "17" as i64; av17[9] = "60" as i64 300 lab_dispatch(10, av17, j17) 301 let rc_cyc: i64 = j_has(j17, "\"cycled_ice_fraction_permil\":33" as *u8) 302 let rc_mkt: i64 = j_has(j17, "\"mkt_describes_this_mechanism\":false" as *u8) 303 let rc_asrt: i64 = j_has(j17, "\"coupling_derived_from_distribution\":true" as *u8) 304 let rc_gnd: i64 = j_has(j17, "\"grounding\":\"ASSERTED\"" as *u8) 305 t_puts("T17 recrystal: cycled-fraction=33permil=" as *u8); t_putn(rc_cyc) 306 t_puts(" mkt-inapplicable=" as *u8); t_putn(rc_mkt) 307 t_puts(" coupling-derived=" as *u8); t_putn(rc_asrt) 308 t_puts(" grounding-ASSERTED=" as *u8); t_putn(rc_gnd); t_puts(": " as *u8) 309 var ok17: i64 = 1 310 if rc_cyc != 1 { ok17 = 0 } 311 if rc_mkt != 1 { ok17 = 0 } 312 if rc_asrt != 1 { ok17 = 0 } 313 if rc_gnd != 1 { ok17 = 0 } 314 if ok17 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 315 316 // --- T18 ***PER-CLAIM HONESTY ACROSS MECHANISMS.*** The SAME facade 317 // reports VALIDATED for the stability physics and ASSERTED for 318 // recrystallisation, because the latter rests on a geometric 319 // coupling nothing here derives. A facade graded per-tool would 320 // have to pick one and mislead about the other. --- 321 total = total + 1 322 let g_stab2: i64 = j_has(j11, "\"grounding\":\"VALIDATED\"" as *u8) 323 let g_recry: i64 = j_has(j17, "\"verified\":false" as *u8) 324 t_puts("T18 same facade: stability VALIDATED=" as *u8); t_putn(g_stab2) 325 t_puts(" recrystal unverified=" as *u8); t_putn(g_recry); t_puts(": " as *u8) 326 var ok18: i64 = 1 327 if g_stab2 != 1 { ok18 = 0 } 328 if g_recry != 1 { ok18 = 0 } 329 if ok18 == 1 { pass = pass + 1; t_puts("PASS\n" as *u8) } else { t_puts("FAIL\n" as *u8) } 330 331 t_puts("LABSCI-SVC-GATE passed " as *u8); t_putn(pass); t_puts("/" as *u8); t_putn(total) 332 if pass == total { t_puts(" verdict=GREEN\n" as *u8); sys_exit(0); return 0 } 333 t_puts(" verdict=RED\n" as *u8); sys_exit(1); return 1 334}