code wiki / _hdl_build / nx_pm_sclass.nx
nx_pm_sclass.nx source
↩ module page · 115 lines · 7296 B
1// nx_pm_sclass.nx -- THE PM OWNS THE S-CLASS-EXCEED PROGRAM (operator: "get the nishi pm to really own
2// this s class exceeds push ... and iterate with the team"). The PM is Accountable for `coordinate` in the
3// RACI, so it legitimately OWNS this program: for every gap in the grounded maturity audit it (1) looks up
4// the activity-Accountable role, (2) ROUTES the work to that role via pm_route (logs the pmcoord seg-store channel + queues
5// apply-roles), and (3) REGISTERS the item as a LIVE workstream in the WMS registry (empire E-PM) so it
6// shows on nx_ws_board -- then BEATS its own heartbeat so the PM's program stream is the first ALIVE stream
7// (the board's "active all UNKNOWN / doesn't flow" finding starts to move, measurably + live).
8//
9// Source of the gaps = knowledge/library/nishi-sclass-exceed-program-backlog-2026-06-21.txt (foundationed,
10// CID nxc1-aaab312a...). Convergence (does the team SEE what the audit saw?) = nx_pm_sclass_converge.
11// REUSE (rule 15): pm_route/pm_accountable (nx_pm), ws_put_p/ws_member/WS_PREFIX (nx_workstream_store),
12// hb_beat_s (nx_heartbeat_str), rq_cat/rq_n/rq_w (nx_role_queue). Sovereign, idempotent, additive.
13// license_tier: ORIGINAL expect_exit: 0
14import "nx_pm.nx"
15import "nx_ws_cas.nx"
16import "nx_heartbeat_str.nx"
17const PMS_MAGIC_1024: i64 = 1024
18
19const PMS_HB: *u8 = "knowledge/status/wms_heartbeat.log"
20const PMS_MEM: *u8 = "nishi-sclass-exceed-program-backlog-2026-06-21"
21const PMS_BACKLOG: *u8 = "knowledge/library/nishi-sclass-exceed-program-backlog-2026-06-21.txt"
22
23// register ONE workstream into the WMS registry, concurrency-safe: hold the per-prefix wlock across the
24// whole ws:ids read-modify-write AND the ws:<id> record write (mirrors nx_ws_cas; NO nested ws_put_locked
25// to avoid self-deadlock on the same lock file). Idempotent (ws_put_p skips unchanged; ws:ids appended once).
26func pms_register(id: *u8, state: *u8, code: *u8) -> i64 {
27 let wp: *u8 = WS_PREFIX
28 let lp: *u8 = sys_mmap(512)
29 var i: i64 = 0
30 while wp[i] != (0 as u8) { lp[i] = wp[i]; i = i + 1 }
31 let suf: *u8 = "wlock"
32 var s: i64 = 0
33 while suf[s] != (0 as u8) { lp[i] = suf[s]; i = i + 1; s = s + 1 }
34 lp[i] = 0 as u8
35 let lfd: i64 = sys_openat_append(lp, 0x1a4)
36 if lfd >= 0 { sys_flock(lfd, SYS_LOCK_EX) }
37
38 let key: *u8 = sys_mmap(192)
39 key[0] = 119 as u8; key[1] = 115 as u8; key[2] = 58 as u8 // "ws:"
40 var k: i64 = 0
41 while id[k] != (0 as u8) { key[3 + k] = id[k]; k = k + 1 }
42 key[3 + k] = 0 as u8
43
44 let rec: *u8 = sys_mmap(PMS_MAGIC_1024)
45 var o: i64 = 0
46 o = rq_cat(rec, o, id); rec[o] = 9 as u8; o = o + 1
47 o = rq_cat(rec, o, "E-PM" as *u8); rec[o] = 9 as u8; o = o + 1
48 o = rq_cat(rec, o, state); rec[o] = 9 as u8; o = o + 1
49 o = rq_n(rec, o, sys_now_realtime_sec()); rec[o] = 9 as u8; o = o + 1
50 o = rq_cat(rec, o, PMS_MEM); rec[o] = 9 as u8; o = o + 1
51 o = rq_cat(rec, o, code); rec[o] = 9 as u8; o = o + 1
52 o = rq_cat(rec, o, "-" as *u8)
53 rec[o] = 0 as u8
54 ws_put_p(WS_PREFIX, key, rec)
55
56 let pq: *i64 = sys_mmap(16) as *i64
57 let lq: *i64 = sys_mmap(16) as *i64
58 if ss_get(WS_PREFIX, "ws:ids" as *u8, pq, lq) == 1 {
59 let ids: *u8 = pq[0] as *u8
60 let idn: i64 = lq[0]
61 if ws_member(ids, idn, id) == 0 {
62 let nb: *u8 = sys_mmap(idn + 192)
63 var c: i64 = 0
64 while c < idn { nb[c] = ids[c]; c = c + 1 }
65 nb[c] = 9 as u8; c = c + 1
66 var d: i64 = 0
67 while id[d] != (0 as u8) { nb[c] = id[d]; c = c + 1; d = d + 1 }
68 nb[c] = 0 as u8
69 ws_put_p(WS_PREFIX, "ws:ids" as *u8, nb)
70 }
71 }
72 if lfd >= 0 { sys_flock(lfd, SYS_LOCK_UN); sys_close(lfd) }
73 return 0
74}
75
76// own + route + register ONE program item.
77func pms_item(id: *u8, activity: *u8, pillar: *u8, target: *u8, gate: *u8) -> i64 {
78 rq_w(" ITEM " as *u8); rq_w(id); rq_w(" [pillar " as *u8); rq_w(pillar); rq_w("] target=" as *u8); rq_w(target); rq_w("\n" as *u8)
79 rq_w(" gate-to-prove-convergence=" as *u8); rq_w(gate); rq_w("\n " as *u8)
80 pm_route(activity, id, PMS_BACKLOG, PMS_BACKLOG, "pm-sclass" as *u8)
81 pms_register(id, "ACTIVE" as *u8, gate)
82 return 0
83}
84
85func main() -> i64 {
86 rq_w("=== NISHI PM owns the S-CLASS-EXCEED program (Accountable for `coordinate`; routes to the team) ===\n" as *u8)
87 rq_w("source of gaps: " as *u8); rq_w(PMS_BACKLOG); rq_w(" (foundationed, lineage-to-god)\n\n" as *u8)
88
89 rq_w("-- MOVE 1: MAKE THE TEAM FLOW (Pillar B) --\n" as *u8)
90 pms_item("SCLASS-FLOW-01" as *u8, "build" as *u8, "B" as *u8, "autonomous task pickup: dispatcher feeds REAL registry streams" as *u8, "real-stream-end-to-end gate" as *u8)
91 pms_item("SCLASS-FLOW-02" as *u8, "publish" as *u8, "B" as *u8, "drain the 172-row publisher queue (PENDING->PUBLISHED)" as *u8, "queue.tsv PENDING falls + signed receipts" as *u8)
92 pms_item("SCLASS-FLOW-03" as *u8, "optimize" as *u8, "B" as *u8, "live heartbeats: board liveness != UNKNOWN" as *u8, "nx_ws_board LIVE alive>0" as *u8)
93 pms_item("SCLASS-FLOW-04" as *u8, "optimize" as *u8, "B" as *u8, "de-flake control plane (dispatch/journal/boot-revive)" as *u8, "3x deterministic GREEN each" as *u8)
94 pms_item("SCLASS-FLOW-05" as *u8, "coordinate" as *u8, "B" as *u8, "PM owns + tracks the program LIVE (this build)" as *u8, "nx_pm_sclass_converge_gate" as *u8)
95
96 rq_w("\n-- MOVE 2: GET ONE THING ONTO REAL METAL (Pillar C) --\n" as *u8)
97 pms_item("SCLASS-METAL-01" as *u8, "build" as *u8, "C" as *u8, "FPGA boot: P&R->bitstream->JTAG->RV64IM on ULX3S ECP5" as *u8, "omniforge SI 'physical FPGA boot' ABSENT->PRESENT" as *u8)
98 pms_item("SCLASS-METAL-02" as *u8, "build" as *u8, "C" as *u8, "robot HAL on real MMIO + move 1 axis under never-brick clamp" as *u8, "omniforge RC 'physical bench validation' ABSENT->PRESENT" as *u8)
99 pms_item("SCLASS-METAL-03" as *u8, "fix" as *u8, "C" as *u8, "fix gate-ALU rs2[5:0] shift-mask divergence" as *u8, "nx_cpu_rtype shift KAT 0 mismatch" as *u8)
100
101 rq_w("\n-- MOVE 3: VALIDATE THE EXCEEDS NEUTRALLY (Pillar A) --\n" as *u8)
102 pms_item("SCLASS-NEUTRAL-01" as *u8, "verify" as *u8, "A" as *u8, "durability head-to-head vs LIVE git (not a by-design reference)" as *u8, "nx_ws_exceed vs an executed git baseline" as *u8)
103 pms_item("SCLASS-NEUTRAL-02" as *u8, "verify" as *u8, "A" as *u8, "codec on a public neutral corpus (lossless beat + honest lossy gap)" as *u8, "nx_codec_exceed on a cited corpus" as *u8)
104
105 rq_w("\n-- the PM's own program stream goes LIVE (registered + heartbeat) --\n" as *u8)
106 pms_register("SCLASS-PM" as *u8, "ACTIVE" as *u8, "nx_pm_sclass" as *u8)
107 hb_beat_s(PMS_HB, "SCLASS-PM" as *u8, 1)
108 rq_w(" SCLASS-PM registered (E-PM) + heartbeat beaten -> the first ALIVE program stream on the board.\n" as *u8)
109
110 rq_w("\n=== PM OWNS IT. 10 items routed to their RACI-accountable roles (see the pmcoord channel in the sovereign seg-store knowledge/store/roles-*, NO TSV) +\n" as *u8)
111 rq_w(" registered LIVE on the WMS board (E-PM). Next: nx_pm_sclass_converge tracks the team's own\n" as *u8)
112 rq_w(" measurement vs the audit, live, until it sees what the audit saw. ===\n" as *u8)
113 sys_exit(0)
114 return 0
115}