nx_triage_ground_gate.nx source
↩ module page · 46 lines · 2519 B
1// nx_triage_ground_gate.nx -- liar-killed GATE for the triage evidence-grounding organ. Proves the
2// disk-fact cross-check via the EXISTING nx_capability_census engine on the REAL tree: a claimed
3// organ backed by a gate on disk -> GROUNDED; a claimed organ the disk CANNOT show -> DISCREPANCY
4// (the load-bearing neg-control: the check must catch a fabricated/wrong-name label, never rubber-
5// stamp it); has_organ=0 but present -> UNDERCLAIM; non-runtime name -> UNPROBEABLE. Exercises the
6// composed cc_our_grade end-to-end. Exit 0 only on 7/7.
7// license_tier: ORIGINAL expect_exit: 0
8import "nx_syscalls.nx"
9import "nx_triage_ground.nx"
10
11func g_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 g_putn(v: i64) -> i64 { nxi_out(v); return 0 }
13func g_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
14func g_bool(name: *u8, got: i64, want: i64, passp: *i64) -> i64 {
15 g_puts("T " as *u8); g_puts(name); g_puts(" got=" as *u8); g_putn(got)
16 if got == want { g_puts(" PASS\n" as *u8); passp[0] = passp[0] + 1 } else { g_puts(" FAIL\n" as *u8) }
17 return 0
18}
19
20func main(argc: i64, argv: *i64) -> i64 {
21 let pass: *i64 = sys_mmap(16) as *i64
22 pass[0] = 0
23
24 // probeable classification
25 g_bool("probeable-nx_shelltool" as *u8, tg_probeable("nx_shelltool" as *u8, g_slen("nx_shelltool" as *u8)), 1, pass)
26 g_bool("unprobeable-forge-e1" as *u8, tg_probeable("forge-e1-8033" as *u8, g_slen("forge-e1-8033" as *u8)), 0, pass)
27
28 // disk-fact grade on the REAL tree: nx_coindex has a _gate.nx -> grade >= 3 (present/gated)
29 var gr: i64 = tg_grade("nx_coindex" as *u8)
30 var okreal: i64 = 0
31 if gr >= 3 { okreal = 1 }
32 g_bool("real-organ-present-via-tg_grade" as *u8, okreal, 1, pass)
33 // a fabricated name -> grade 0
34 g_bool("fabricated-grade-0" as *u8, tg_grade("nx_zzz_nope_qq" as *u8), 0, pass)
35
36 // verdicts
37 g_bool("claim+present->GROUNDED" as *u8, tg_verdict(1, 1, 4), TG_GROUNDED, pass)
38 // LOAD-BEARING NEG-CONTROL: claim has_organ=1 but disk ABSENT -> DISCREPANCY (never rubber-stamp)
39 g_bool("negctl-claim+absent->DISCREPANCY" as *u8, tg_verdict(1, 1, 0), TG_DISCREPANCY, pass)
40 g_bool("unprobeable->UNPROBEABLE" as *u8, tg_verdict(0, 1, 0), TG_UNPROBEABLE, pass)
41
42 g_puts("TGROUND-GATE pass=" as *u8); g_putn(pass[0]); g_puts("/7 verdict=" as *u8)
43 if pass[0] == 7 { g_puts("GREEN\n" as *u8); return 0 }
44 g_puts("RED\n" as *u8)
45 return 1
46}