nx_probiome_provenance.nx source
↩ module page · 90 lines · 5245 B
1// nx_probiome_provenance.nx -- R6d grounding: "research not bro science".
2// Maps each nx_probiome cite_id (1..22) to the REAL source file the Nishi
3// researcher fetched (nx_probiome_research_fetch -> knowledge/fetched/
4// probiome_c<NN>_*.raw) and proves the file genuinely landed: it must be
5// at least PG_MIN_SOURCE_BYTES, so a 404 error page (~48 KB here) can
6// NEVER masquerade as a citation. This is the honest counterpart of the
7// food branch's nx_food_ground_gate ("N science rules cited to real
8// fetched sources").
9//
10// Absolute paths (cwd-independent: the native-lane gate runs from bench/,
11// the researcher wrote from nxc2/, so a relative path would diverge).
12//
13// genealogy_id: nishi_food_ground_gate + rule4_verified_facts_not_assumptions
14
15import "nx_syscalls.nx"
16import "nx_probiome.nx"
17
18// A real fetched Wikipedia article here is >100 KB; the two 404 pages the
19// first pass saved were ~48-49 KB. 80 KB cleanly separates real from 404.
20const PG_MIN_SOURCE_BYTES: i64 = 80000
21const PG_CITE_N: i64 = 22 // cite ids 1..22 are all referenced by strains
22
23// cite_id -> absolute path of the fetched source (or a non-existent
24// sentinel for an unknown id, so the grounding check fails closed).
25func pg_cite_path(cite: i64) -> *u8 {
26 if cite == 1 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c01_listeria.raw" as *u8 }
27 if cite == 2 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c02_bacillus_subtilis.raw" as *u8 }
28 if cite == 3 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c03_bacillus_cereus.raw" as *u8 }
29 if cite == 4 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c04_enterococcus_faecium.raw" as *u8 }
30 if cite == 5 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c05_rhizobium.raw" as *u8 }
31 if cite == 6 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c06_azospirillum.raw" as *u8 }
32 if cite == 7 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c07_pseudomonas_fluorescens.raw" as *u8 }
33 if cite == 8 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c08_lactic_acid_bacteria.raw" as *u8 }
34 if cite == 9 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c09_bifidobacterium.raw" as *u8 }
35 if cite == 10 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c10_nitrosomonas.raw" as *u8 }
36 if cite == 11 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c11_pseudomonas_putida.raw" as *u8 }
37 if cite == 12 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c12_acetic_acid_bacteria.raw" as *u8 }
38 if cite == 13 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c13_saccharomyces_boulardii.raw" as *u8 }
39 if cite == 14 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c14_propionibacterium.raw" as *u8 }
40 if cite == 15 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c15_aspergillus_oryzae.raw" as *u8 }
41 if cite == 16 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c16_arbuscular_mycorrhiza.raw" as *u8 }
42 if cite == 17 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c17_trichoderma.raw" as *u8 }
43 if cite == 18 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c18_rhizopus.raw" as *u8 }
44 if cite == 19 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c19_penicillium_roqueforti.raw" as *u8 }
45 if cite == 20 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c20_leuconostoc.raw" as *u8 }
46 if cite == 21 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c21_bacillus_amyloliquefaciens.raw" as *u8 }
47 if cite == 22 { return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/probiome_c22_aflatoxin.raw" as *u8 }
48 return "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/fetched/__no_such_source__.raw" as *u8
49}
50
51// File size in bytes via lseek(SEEK_END), or -1 if the file is absent.
52func pg_file_size(path: *u8) -> i64 {
53 let fd: i64 = sys_openat_rd(path)
54 if fd < 0 { return -1 }
55 let sz: i64 = sys_lseek(fd, 0, 2)
56 sys_close(fd)
57 return sz
58}
59
60// A cite is GROUNDED iff its fetched file exists and clears the byte floor
61// (so a 404 stub cannot count).
62func pg_cite_grounded(cite: i64) -> i64 {
63 let p: *u8 = pg_cite_path(cite)
64 if pg_file_size(p) >= PG_MIN_SOURCE_BYTES { return 1 }
65 return 0
66}
67
68// How many of the 22 referenced cites are grounded in a real source.
69func pg_count_grounded() -> i64 {
70 var n: i64 = 0
71 var c: i64 = 1
72 while c <= PG_CITE_N {
73 if pg_cite_grounded(c) == 1 { n = n + 1 }
74 c = c + 1
75 }
76 return n
77}
78
79// Anti-bro-science: is EVERY real catalog strain cited (cite_id >= 1)?
80// Returns the count of uncited strains (0 = all cited).
81func pg_uncited_strains() -> i64 {
82 var bad: i64 = 0
83 var id: i64 = 0
84 while id < PB_STR_N {
85 let s: *NxProbiomeStrain = nx_probiome_strain(id)
86 if s.cite_id < 1 { bad = bad + 1 }
87 id = id + 1
88 }
89 return bad
90}