code wiki / _hdl_build / nx_dev_pipeline_test.nx

nx_dev_pipeline_test.nx source

↩ module page · 83 lines · 7255 B

1// nx_dev_pipeline_test.nx -- walk the happy path + the full research-escalation loop, prove no capability 2// conflation (Builder builds / Engineer tests), the SLA + Conductor watchdog, and emit knowledge/DEV_PIPELINE.md. 3// Exit 0 on 12/12. license_tier: ORIGINAL 4 5import "nx_dev_pipeline.nx" 6import "nx_syscalls.nx" 7 8func dt_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 9func dt_arrow(s: *u8) -> i64 { dt_puts(s); dt_puts(" -> " as *u8); return 0 } 10func dt_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } 11 12func main() -> i64 { 13 dt_puts("=== DEV PIPELINE (mapped state machine; no capability conflation) ===\n" as *u8) 14 15 // ---- happy path with arc-end: BUILD -> TEST -> REFEREE -> DONE ---- 16 dt_puts(" happy: " as *u8) 17 var s: i64 = DP_BUILD; dt_arrow(dp_stage_name(s)) 18 s = dp_next(s, DP_OK, 0, 1); dt_arrow(dp_stage_name(s)) // TEST 19 let h_test: i64 = s 20 s = dp_next(s, DP_OK, 0, 1); dt_arrow(dp_stage_name(s)) // REFEREE (arc-end) 21 let h_ref: i64 = s 22 s = dp_next(s, DP_OK, 0, 1); dt_puts(dp_stage_name(s)); dt_puts("\n" as *u8) // DONE 23 let h_done: i64 = s 24 25 // ---- escalation loop: TEST issue -> HEAL -> builder-can't -> RESEARCH -> SPEC -> BUILD -> DOCTOR-USE -> RETEST -> COUNCIL -> DONE ---- 26 dt_puts(" escalate: BUILD -> TEST" as *u8) 27 s = DP_TEST 28 s = dp_next(s, DP_ISSUE, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // HEAL 29 let e_heal: i64 = s 30 s = dp_next(s, DP_BUILDER_CANT, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // RESEARCH 31 let e_research: i64 = s 32 s = dp_next(s, DP_OK, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // SPEC 33 let e_spec: i64 = s 34 s = dp_next(s, DP_OK, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // BUILD (post_spec) 35 s = dp_next(s, DP_OK, 1, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // DOCTOR-USE 36 let e_docuse: i64 = s 37 s = dp_next(s, DP_OK, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // RETEST 38 let e_retest: i64 = s 39 s = dp_next(s, DP_OK, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)) // COUNCIL 40 s = dp_next(s, DP_OK, 0, 0); dt_puts(" -> " as *u8); dt_puts(dp_stage_name(s)); dt_puts("\n" as *u8) // DONE 41 let e_done: i64 = s 42 43 // ---- emit the mapped doc ---- 44 let fd: i64 = sys_openat_wr("knowledge/DEV_PIPELINE.md" as *u8, 0x1a4) 45 dt_w(fd, "# Nishi Development Pipeline -- mapped flow (no capability conflation)\n\n" as *u8) 46 dt_w(fd, "Like RACI, but for the build->ship arc. Each STAGE has exactly ONE owner. The Conductor watches all stages so nothing gets stuck (silently or loudly).\n\n" as *u8) 47 dt_w(fd, "## Stages & owners\n| stage | owner | does |\n|---|---|---|\n" as *u8) 48 dt_w(fd, "| BUILD | BUILDER | authors the module (never tests its own work) |\n" as *u8) 49 dt_w(fd, "| TEST | ENGINEER | tests the Builder's output -- testing is the Engineer's, NOT the Builder's |\n" as *u8) 50 dt_w(fd, "| HEAL | DOCTOR | resolves issues, gives the Builder feedback (SLA: <=1 step, <10s) |\n" as *u8) 51 dt_w(fd, "| RESEARCH | RESEARCHER | when the Builder can't address it: search the bug-class space (benchmarks + published info) -> bring it to the Library |\n" as *u8) 52 dt_w(fd, "| SPEC | PM | build the spec, MEASURE time/effort/outcome, report, prioritize |\n" as *u8) 53 dt_w(fd, "| DOCTOR-USE | DOCTOR | puts the spec-driven build to use |\n" as *u8) 54 dt_w(fd, "| RETEST | ENGINEER | runs its cycle again on the fixed build |\n" as *u8) 55 dt_w(fd, "| COUNCIL | COUNCIL | determines if it enters the ecosystem (additive-only + separation of duties) |\n" as *u8) 56 dt_w(fd, "| REFEREE | REFEREE | at an ARC end: benchmark vs known S-class / test in 'tracks' -> is a novel item beyond TOY level? |\n" as *u8) 57 dt_w(fd, "\n## Happy path\nBUILD -> TEST -> COUNCIL -> (arc end) REFEREE -> DONE\n\n" as *u8) 58 dt_w(fd, "## Escalation loop (issue the Builder can't fix)\nTEST(issue) -> HEAL(Doctor; if >1 step / can't) -> RESEARCH(Researcher -> Library) -> SPEC(PM: measure + prioritize) -> BUILD(Builder) -> DOCTOR-USE(Doctor) -> RETEST(Engineer) -> COUNCIL -> (arc end) REFEREE\n\n" as *u8) 59 dt_w(fd, "## Guards\n- **SLA (Engineer/Doctor):** resolve in <=1 step, <10s; else the Doctor feeds back to the Builder, and if the Builder still can't, it escalates to RESEARCH.\n- **Conductor watchdog:** every stage has a time budget; an over-budget stage is flagged STUCK (loud, never silent) -- nothing stalls unseen.\n- **Failures** at any stage have their own handling -> FAILED with the owning role notified.\n\n" as *u8) 60 dt_w(fd, "## Hardware analogy (could guide future Nishi hardware)\nThis IS a motherboard: roles = functional units (Builder=ALU/synthesis, Engineer=test harness/BIST, Doctor=error-correction, Researcher=fetch/cache, PM=scheduler, Council=memory-protection/admission, Referee=benchmark unit), handoffs = the bus, and the CONDUCTOR = the clock + watchdog timer + bus arbiter that keeps every unit in lockstep and catches a hung transaction. Mapping the team this way means the eventual sovereign hardware can mirror the proven org chart.\n" as *u8) 61 sys_close(fd) 62 63 let r: *i64 = sys_mmap(16*8) as *i64 64 r[0]=0; if h_test == DP_TEST { r[0]=1 } 65 r[1]=0; if h_ref == DP_REFEREE { r[1]=1 } 66 r[2]=0; if h_done == DP_DONE { r[2]=1 } 67 r[3]=0; if e_heal == DP_HEAL { r[3]=1 } 68 r[4]=0; if e_research == DP_RESEARCH { r[4]=1 } // builder-can't routes to the Researcher 69 r[5]=0; if e_spec == DP_SPEC { r[5]=1 } // research -> PM spec 70 r[6]=0; if e_docuse == DP_DOCTOR_USE { r[6]=1 } // spec-driven build -> Doctor uses it 71 r[7]=0; if e_retest == DP_RETEST { r[7]=1 }; if e_done != DP_DONE { r[7]=0 } 72 // ANTI-CONFLATION: Builder builds, Engineer tests -- never the same role 73 r[8]=0; if dp_owner(DP_BUILD) == DP_R_BUILDER { if dp_owner(DP_TEST) == DP_R_ENGINEER { if dp_owner(DP_BUILD) != dp_owner(DP_TEST) { r[8]=1 } } } 74 r[9]=0; if dp_owner(DP_RETEST) == DP_R_ENGINEER { if dp_owner(DP_HEAL) == DP_R_DOCTOR { r[9]=1 } } 75 // SLA + watchdog 76 r[10]=0; if dp_sla_ok(1, 5) == 1 { if dp_sla_ok(2, 5) == 0 { if dp_sla_ok(1, 12) == 0 { r[10]=1 } } } 77 r[11]=0; if dp_watchdog_stuck(15, 10) == 1 { if dp_watchdog_stuck(5, 10) == 0 { if dp_next(DP_TEST, DP_TIMEOUT, 0, 0) == DP_FAILED { r[11]=1 } } } 78 var pass: i64 = 0; var i: i64 = 0 79 while i < 12 { pass = pass + r[i]; i = i + 1 } 80 dt_puts("---- passed " as *u8); { let d: *u8=sys_mmap(8); var m: i64=pass; var k: i64=0; let t: *u8=sys_mmap(8); if m==0{t[0]=48;k=1} while m>0{t[k]=48+(m%10);m=m/10;k=k+1} var z: i64=0; while z<k{d[z]=t[k-1-z];z=z+1} sys_write(1,d,k) } dt_puts("/12 ---- map -> knowledge/DEV_PIPELINE.md\n" as *u8) 81 if pass == 12 { dt_puts(" Pipeline mapped: Builder builds / Engineer tests / Doctor heals / Researcher searches / PM specs+measures / Council admits / Referee benchmarks; Conductor watches all. No conflation.\n" as *u8); sys_exit(0); return 0 } 82 dt_puts(" FAIL\n" as *u8); sys_exit(1); return 1 83}