code wiki / _hdl_build / nx_pub_census.nx

nx_pub_census.nx source

↩ module page · 70 lines · 5809 B

1// nx_pub_census.nx -- Encodes a sovereign census of publisher responsibilities, grading existing primitives and identifying gaps for construction. 2import "nx_gate_base.nx" 3// nx_pub_census.nx -- the HONEST STARTING LINE for the NISHI PUBLISHER role. A data-driven scorecard: one row 4// per RESPONSIBILITY (each researched + cited to a sovereign-fetched source cluster in knowledge/fetched/pub_*.raw), 5// graded ABSENT / PRESENT by whether a REAL sovereign primitive does it TODAY -- with a LIAR-KILL (a row claiming 6// PRESENT without a named primitive is INVALID). Mirrors nx_ge_census. The honest finding it encodes: the PARTS 7// (serialize, transport, verify, control-plane) already exist as primitives; the PUBLISHER (the unifying queue + 8// single-authority LAW + staging + atomic-promote + rollback + idempotency + ledger + policy) is what we build. 9// license_tier: ORIGINAL expect_exit: 0 10import "nx_syscalls.nx" 11 12func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw(" 13" as *u8); return ok } 14func 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 } 15 16func gstr(g: i64) -> *u8 { 17 if g==0 { return "ABSENT " as *u8 } 18 if g==1 { return "PRESENT" as *u8 } 19 if g==2 { return "PARITY " as *u8 } 20 return "EXCEEDS" 21} 22// st[0]=absent st[1]=present st[2]=invalid st[3]=total 23func row(name: *u8, src: *u8, grade: i64, has_ev: i64, prim: *u8, st: *i64) -> i64 { 24 st[3] = st[3] + 1 25 gw(" [" as *u8); gw(gstr(grade)); gw("] " as *u8); gw(name); gw(" {src:" as *u8); gw(src); gw("}" as *u8) 26 if grade >= 1 { 27 if has_ev == 1 { gw(" <= " as *u8); gw(prim) } 28 else { gw(" !!INVALID: PRESENT without a named primitive (liar-kill)" as *u8); st[2] = st[2] + 1 } 29 } 30 gw("\n" as *u8) 31 if grade == 0 { st[0] = st[0] + 1 } else { st[1] = st[1] + 1 } 32 return 0 33} 34 35func main() -> i64 { 36 let st: *i64 = sys_mmap(64) as *i64 37 st[0]=0; st[1]=0; st[2]=0; st[3]=0 38 gw("=== NISHI PUBLISHER -- RESPONSIBILITY CENSUS (researched + cited: knowledge/fetched/pub_*.raw) ===\n" as *u8) 39 gw("grade = does a REAL sovereign primitive do this TODAY? ABSENT = build it ยท PRESENT = primitive exists\n\n" as *u8) 40 41 // grades flipped via the RATCHET (build cap -> gate GREEN -> flip cell). EXCEEDS = a MEASURED head-to-head 42 // (nx_pub_exceed_gate) beat the naive baseline; PRESENT = built + gated. NONE self-scored. 43 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) 44 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) 45 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) 46 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) 47 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) 48 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) 49 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) 50 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) 51 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) 52 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) 53 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) 54 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) 55 56 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) 57 let real_invalid: i64 = st[2] 58 59 gw("\n -- liar-kill self-test (a fabricated PRESENT-without-primitive MUST be caught) --\n" as *u8) 60 let st2: *i64 = sys_mmap(64) as *i64 61 st2[0]=0; st2[1]=0; st2[2]=0; st2[3]=0 62 row("FABRICATED cap claiming PRESENT with no evidence\x00" as *u8, "neg-control\x00" as *u8, 1, 0, "-\x00" as *u8, st2) 63 gw(" liar-kill fired=" as *u8); pn(st2[2]); gw(" (expect 1)\n" as *u8) 64 65 gw("\nPUBLISHER-CENSUS verdict=" as *u8) 66 if real_invalid == 0 { if st2[2] == 1 { gw("GREEN (scorecard honest, liar-kill armed)\n" as *u8); sys_exit(0); return 0 } } 67 gw("RED (a real row faked PRESENT, or the liar-kill is disarmed)\n" as *u8) 68 sys_exit(1) 69 return 1 70}