code wiki / _hdl_build / nx_pub_census.nx

nx_pub_census.nx source

↩ module page · 69 lines · 5661 B

1import "nx_gate_base.nx" 2// nx_pub_census.nx -- the HONEST STARTING LINE for the NISHI PUBLISHER role. A data-driven scorecard: one row 3// per RESPONSIBILITY (each researched + cited to a sovereign-fetched source cluster in knowledge/fetched/pub_*.raw), 4// graded ABSENT / PRESENT by whether a REAL sovereign primitive does it TODAY -- with a LIAR-KILL (a row claiming 5// PRESENT without a named primitive is INVALID). Mirrors nx_ge_census. The honest finding it encodes: the PARTS 6// (serialize, transport, verify, control-plane) already exist as primitives; the PUBLISHER (the unifying queue + 7// single-authority LAW + staging + atomic-promote + rollback + idempotency + ledger + policy) is what we build. 8// license_tier: ORIGINAL expect_exit: 0 9import "nx_syscalls.nx" 10 11func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw(" 12" as *u8); return ok } 13func pn(v0: i64) -> i64 { var v: i64=v0; if v<0 { sys_write(1,"-" as *u8,1); v=0-v } let b: *u8=sys_mmap(24); var k: i64=0; if v==0 {b[0]=48;k=1} while v>0 {b[k]=(48+(v%10)) as u8; v=v/10; k=k+1} let o: *u8=sys_mmap(24); var j: i64=0; while j<k {o[j]=b[k-1-j];j=j+1} sys_write(1,o,k); return 0 } 14 15func gstr(g: i64) -> *u8 { 16 if g==0 { return "ABSENT " as *u8 } 17 if g==1 { return "PRESENT" as *u8 } 18 if g==2 { return "PARITY " as *u8 } 19 return "EXCEEDS" 20} 21// st[0]=absent st[1]=present st[2]=invalid st[3]=total 22func row(name: *u8, src: *u8, grade: i64, has_ev: i64, prim: *u8, st: *i64) -> i64 { 23 st[3] = st[3] + 1 24 gw(" [" as *u8); gw(gstr(grade)); gw("] " as *u8); gw(name); gw(" {src:" as *u8); gw(src); gw("}" as *u8) 25 if grade >= 1 { 26 if has_ev == 1 { gw(" <= " as *u8); gw(prim) } 27 else { gw(" !!INVALID: PRESENT without a named primitive (liar-kill)" as *u8); st[2] = st[2] + 1 } 28 } 29 gw("\n" as *u8) 30 if grade == 0 { st[0] = st[0] + 1 } else { st[1] = st[1] + 1 } 31 return 0 32} 33 34func main() -> i64 { 35 let st: *i64 = sys_mmap(64) as *i64 36 st[0]=0; st[1]=0; st[2]=0; st[3]=0 37 gw("=== NISHI PUBLISHER -- RESPONSIBILITY CENSUS (researched + cited: knowledge/fetched/pub_*.raw) ===\n" as *u8) 38 gw("grade = does a REAL sovereign primitive do this TODAY? ABSENT = build it ยท PRESENT = primitive exists\n\n" as *u8) 39 40 // grades flipped via the RATCHET (build cap -> gate GREEN -> flip cell). EXCEEDS = a MEASURED head-to-head 41 // (nx_pub_exceed_gate) beat the naive baseline; PRESENT = built + gated. NONE self-scored. 42 row("single-writer SERIALIZE -- one publish at a time\x00" as *u8, "C:lock/mutual-exclusion\x00" as *u8, 3, 1, "nx_arbiter + nx_pub_loop_gate (locked 3 vs unlocked 6) + nx_pub_exceed_gate\x00" as *u8, st) 43 row("NO-BYPASS LAW + audit -- workstreams may NOT push direct\x00" as *u8, "A:release-mgmt / D:CMS-approval\x00" as *u8, 1, 1, "pub_audit_file + nx_pub_bypass_gate 4/4\x00" as *u8, st) 44 row("durable request QUEUE + submit() intake -- decouple producers\x00" as *u8, "C:message-queue/event-driven\x00" as *u8, 3, 1, "pub_submit + nx_pub_submit_gate + nx_pub_exceed_gate (137 torn->0)\x00" as *u8, st) 45 row("deploy TRANSPORT to target -- sovereign, no hand-shell\x00" as *u8, "B:continuous-delivery\x00" as *u8, 1, 1, "nx_aw_send / nx_aw_push / nx_hostctl recv\x00" as *u8, st) 46 row("STAGE slot -- deploy to pre-prod before live\x00" as *u8, "B:deployment-environment\x00" as *u8, 1, 1, "pub_deploy stage + nx_pub_deploy_gate\x00" as *u8, st) 47 row("VERIFY artifact integrity before promote -- fail-closed\x00" as *u8, "E:smoke-test\x00" as *u8, 3, 1, "pub_deploy verify + nx_pub_deploy_gate + nx_pub_exceed_gate (naive serves corrupt)\x00" as *u8, st) 48 row("ATOMIC promote live<-staging -- all-or-none switch\x00" as *u8, "E:atomic-commit / B:blue-green\x00" as *u8, 1, 1, "pub_promote_atomic + nx_pub_promote_gate\x00" as *u8, st) 49 row("ROLLBACK / keep-previous on failure\x00" as *u8, "E:rollback / B:blue-green\x00" as *u8, 3, 1, "pub_rollback + nx_pub_promote_gate + nx_pub_exceed_gate (naive no-prev)\x00" as *u8, st) 50 row("IDEMPOTENT submit -- sha-keyed, safe re-submit/crash-resume\x00" as *u8, "C:idempotence\x00" as *u8, 1, 1, "pub_led_has + nx_pub_loop_gate\x00" as *u8, st) 51 row("release LEDGER -- append-only sha/dest/site/PUBLISHED\x00" as *u8, "A:config-mgmt / release-eng reproducibility\x00" as *u8, 1, 1, "pub_record_ledger + nx_pub_loop_gate\x00" as *u8, st) 52 row("release POLICY / approval gate -- outward needs operator-ok\x00" as *u8, "A:ITIL change-mgmt / D:CMS-approval\x00" as *u8, 1, 1, "pub_policy_allows + nx_pub_policy_gate\x00" as *u8, st) 53 row("HEALTH-aware + COORDINATE w/ owning workstream -- never brick\x00" as *u8, "A:release-mgmt control\x00" as *u8, 1, 1, "nx_aw_hostctl control-plane\x00" as *u8, st) 54 55 gw("\n TALLY: total=" as *u8); pn(st[3]); gw(" PRESENT=" as *u8); pn(st[1]); gw(" ABSENT=" as *u8); pn(st[0]); gw(" invalid=" as *u8); pn(st[2]); gw("\n" as *u8) 56 let real_invalid: i64 = st[2] 57 58 gw("\n -- liar-kill self-test (a fabricated PRESENT-without-primitive MUST be caught) --\n" as *u8) 59 let st2: *i64 = sys_mmap(64) as *i64 60 st2[0]=0; st2[1]=0; st2[2]=0; st2[3]=0 61 row("FABRICATED cap claiming PRESENT with no evidence\x00" as *u8, "neg-control\x00" as *u8, 1, 0, "-\x00" as *u8, st2) 62 gw(" liar-kill fired=" as *u8); pn(st2[2]); gw(" (expect 1)\n" as *u8) 63 64 gw("\nPUBLISHER-CENSUS verdict=" as *u8) 65 if real_invalid == 0 { if st2[2] == 1 { gw("GREEN (scorecard honest, liar-kill armed)\n" as *u8); sys_exit(0); return 0 } } 66 gw("RED (a real row faked PRESENT, or the liar-kill is disarmed)\n" as *u8) 67 sys_exit(1) 68 return 1 69}