code wiki / _hdl_build / nx_wiredclaim.nx
nx_wiredclaim.nx source
↩ module page · 53 lines · 2628 B
1// nx_wiredclaim.nx -- is an organ CALLED, or only CLAIMED to be?
2//
3// Mechanises the check that exposed F881 (1785530277): nx_magicratchet is asserted "wired into
4// /api/build" in FOUR comments, while grep finds ZERO call sites in source AND ZERO in the deployed
5// mgmt binary, and a two-build experiment shows the enforcement never fires. Same class as the
6// unwired signup gate (1785445704) and the unreachable pre-deploy gate (1785453118).
7//
8// PIPELINE (composes the ONE canonical search path, and the out= envelope shipped this session):
9// nx_shelltool grep <organ> buildroot/runtime nx out=<f>.out
10// nx_wiredclaim <organ> <f>.out
11//
12// exit 0 WIRED | 1 CLAIMED-UNWIRED (prose only -- RUN THE BEHAVIOURAL TEST) | 2 NO-EVIDENCE | 3 UNREADABLE
13// license_tier: ORIGINAL No hw writes (Rule 26).
14import "nx_wiredclaim_lib.nx"
15import "nx_estr.nx"
16
17func main(argc: i64, argv: *i64) -> i64 {
18 if argc < 3 {
19 es_puts("usage: nx_wiredclaim <organ-name> <grep-output-file>\n" as *u8)
20 es_puts(" produce the input with: nx_shelltool grep <organ> <dir> nx out=<f>.out\n" as *u8)
21 es_puts("exit 0 WIRED | 1 CLAIMED-UNWIRED | 2 NO-EVIDENCE | 3 UNREADABLE\n" as *u8)
22 sys_exit(WC_UNREADABLE)
23 return WC_UNREADABLE
24 }
25 let organ: *u8 = argv[1] as *u8
26 let path: *u8 = argv[2] as *u8
27 let ln: *i64 = sys_mmap(16) as *i64
28 ln[0] = 0
29 let buf: *u8 = sys_read_file(path, ln)
30 if buf as i64 == 0 {
31 es_puts("NX-WIREDCLAIM UNREADABLE " as *u8); es_puts(path); es_puts("\n" as *u8)
32 sys_exit(WC_UNREADABLE)
33 return WC_UNREADABLE
34 }
35 let cnt: *i64 = sys_mmap(64) as *i64
36 wc_scan(buf, ln[0], organ, cnt)
37 let v: i64 = wc_verdict(cnt)
38 es_puts("NX-WIREDCLAIM " as *u8); es_puts(wc_name(v)); es_puts(" " as *u8); es_puts(organ)
39 es_puts(" call_sites=" as *u8); es_putn(cnt[0])
40 es_puts(" comment_mentions=" as *u8); es_putn(cnt[1])
41 es_puts(" self_refs=" as *u8); es_putn(cnt[2])
42 es_puts(" hits=" as *u8); es_putn(cnt[3])
43 es_puts(" method=line-shape-over-grep" as *u8)
44 if v == WC_CLAIMED {
45 es_puts("\n CLAIMED BUT NOT CALLED: every mention is prose or self-reference. This is a REVIEW\n" as *u8)
46 es_puts(" TRIGGER, not proof of absence -- a call assembled at runtime (exec of a built path) or\n" as *u8)
47 es_puts(" split across lines reads the same. CONFIRM BY EXECUTION: exercise the chokepoint the\n" as *u8)
48 es_puts(" prose names and require the refusal it promises. If nothing refuses, the claim is false.\n" as *u8)
49 }
50 es_puts("\n" as *u8)
51 sys_exit(v)
52 return v
53}