code wiki / _hdl_build / nx_dev_pipeline.nx
nx_dev_pipeline.nx source
↩ module page · 116 lines · 5322 B
1// nx_dev_pipeline.nx -- the team's DEVELOPMENT PIPELINE as a mapped state machine (operator: encode the
2// flow like RACI so we keep refining; don't CONFLATE capabilities -- the Builder BUILDS and passes to the
3// Engineer for TESTING; testing is the Engineer's, never the Builder's). The flow:
4// BUILD(Builder) -> TEST(Engineer) -> [issue -> HEAL(Doctor, feedback to Builder, SLA <=1 step/<10s) ->
5// [builder-can't -> RESEARCH(Researcher: search space -> Library) -> SPEC(PM: spec + measure time/effort/
6// outcome + prioritize) -> BUILD(Builder) -> DOCTOR_USE(Doctor) -> RETEST(Engineer)]] -> COUNCIL(admit) ->
7// [arc-end -> REFEREE(benchmark vs S-class / tracks: beyond-toy?)] -> DONE. CONDUCTOR watches every stage
8// so nothing gets stuck silently or loudly. license_tier: ORIGINAL Composes nx_raci_collab + nx_maturity_auditor.
9
10import "nx_syscalls.nx"
11
12// stages (each owned by exactly ONE role)
13const DP_BUILD: i64 = 1
14const DP_TEST: i64 = 2
15const DP_HEAL: i64 = 3
16const DP_RESEARCH: i64 = 4
17const DP_SPEC: i64 = 5
18const DP_DOCTOR_USE: i64 = 6
19const DP_RETEST: i64 = 7
20const DP_COUNCIL: i64 = 8
21const DP_REFEREE: i64 = 9
22const DP_DONE: i64 = 10
23const DP_FAILED: i64 = 0
24
25// roles (RACI -- no conflation)
26const DP_R_BUILDER: i64 = 1
27const DP_R_ENGINEER: i64 = 2
28const DP_R_DOCTOR: i64 = 3
29const DP_R_RESEARCHER:i64 = 4
30const DP_R_PM: i64 = 5
31const DP_R_COUNCIL: i64 = 6
32const DP_R_REFEREE: i64 = 7
33const DP_R_CONDUCTOR: i64 = 8 // owns the watchdog across ALL stages
34
35// outcomes
36const DP_OK: i64 = 1
37const DP_ISSUE: i64 = 2
38const DP_BUILDER_CANT:i64 = 3
39const DP_TIMEOUT: i64 = 4
40
41// the owner of each stage -- the anti-conflation map.
42func dp_owner(stage: i64) -> i64 {
43 if stage == DP_BUILD { return DP_R_BUILDER }
44 if stage == DP_TEST { return DP_R_ENGINEER } // TESTING is the Engineer's, NOT the Builder's
45 if stage == DP_HEAL { return DP_R_DOCTOR }
46 if stage == DP_RESEARCH { return DP_R_RESEARCHER }
47 if stage == DP_SPEC { return DP_R_PM }
48 if stage == DP_DOCTOR_USE { return DP_R_DOCTOR }
49 if stage == DP_RETEST { return DP_R_ENGINEER }
50 if stage == DP_COUNCIL { return DP_R_COUNCIL }
51 if stage == DP_REFEREE { return DP_R_REFEREE }
52 return DP_R_CONDUCTOR
53}
54
55// the transition map. post_spec=1 routes a spec-driven build to the Doctor (use) instead of first Test.
56func dp_next(stage: i64, outcome: i64, post_spec: i64, arc_end: i64) -> i64 {
57 if outcome == DP_TIMEOUT { return DP_FAILED } // conductor caught it stuck
58 if stage == DP_BUILD {
59 if outcome == DP_OK { if post_spec == 1 { return DP_DOCTOR_USE } return DP_TEST }
60 return DP_FAILED
61 }
62 if stage == DP_TEST {
63 if outcome == DP_OK { if arc_end == 1 { return DP_REFEREE } return DP_COUNCIL }
64 if outcome == DP_ISSUE { return DP_HEAL }
65 return DP_FAILED
66 }
67 if stage == DP_HEAL {
68 if outcome == DP_OK { return DP_RETEST }
69 if outcome == DP_BUILDER_CANT { return DP_RESEARCH } // builder can't -> researcher searches the space
70 return DP_FAILED
71 }
72 if stage == DP_RESEARCH { if outcome == DP_OK { return DP_SPEC } return DP_FAILED }
73 if stage == DP_SPEC { if outcome == DP_OK { return DP_BUILD } return DP_FAILED } // -> build (post_spec=1)
74 if stage == DP_DOCTOR_USE { if outcome == DP_OK { return DP_RETEST } return DP_FAILED }
75 if stage == DP_RETEST {
76 if outcome == DP_OK { if arc_end == 1 { return DP_REFEREE } return DP_COUNCIL }
77 if outcome == DP_ISSUE { return DP_HEAL }
78 return DP_FAILED
79 }
80 if stage == DP_COUNCIL {
81 if outcome == DP_OK { if arc_end == 1 { return DP_REFEREE } return DP_DONE }
82 return DP_FAILED
83 }
84 if stage == DP_REFEREE { if outcome == DP_OK { return DP_DONE } return DP_FAILED }
85 return DP_FAILED
86}
87
88// Engineer/Doctor SLA: resolve in <=1 step beyond, <10s; else escalate (Doctor feedback -> Builder -> Research).
89func dp_sla_ok(steps: i64, seconds: i64) -> i64 { if steps <= 1 { if seconds < 10 { return 1 } } return 0 }
90
91// Conductor watchdog: a stage that exceeds its time budget is STUCK -> flag (loud, never silent).
92func dp_watchdog_stuck(elapsed_s: i64, budget_s: i64) -> i64 { if elapsed_s > budget_s { return 1 } return 0 }
93
94func dp_stage_name(s: i64) -> *u8 {
95 if s == DP_BUILD { return "BUILD" as *u8 }
96 if s == DP_TEST { return "TEST" as *u8 }
97 if s == DP_HEAL { return "HEAL" as *u8 }
98 if s == DP_RESEARCH { return "RESEARCH" as *u8 }
99 if s == DP_SPEC { return "SPEC" as *u8 }
100 if s == DP_DOCTOR_USE { return "DOCTOR-USE" as *u8 }
101 if s == DP_RETEST { return "RETEST" as *u8 }
102 if s == DP_COUNCIL { return "COUNCIL" as *u8 }
103 if s == DP_REFEREE { return "REFEREE" as *u8 }
104 if s == DP_DONE { return "DONE" as *u8 }
105 return "FAILED" as *u8
106}
107func dp_role_name(r: i64) -> *u8 {
108 if r == DP_R_BUILDER { return "BUILDER" as *u8 }
109 if r == DP_R_ENGINEER { return "ENGINEER" as *u8 }
110 if r == DP_R_DOCTOR { return "DOCTOR" as *u8 }
111 if r == DP_R_RESEARCHER { return "RESEARCHER" as *u8 }
112 if r == DP_R_PM { return "PM" as *u8 }
113 if r == DP_R_COUNCIL { return "COUNCIL" as *u8 }
114 if r == DP_R_REFEREE { return "REFEREE" as *u8 }
115 return "CONDUCTOR" as *u8
116}