code wiki / _hdl_build / nx_ingest_governed.nx
nx_ingest_governed.nx source
↩ module page · 68 lines · 3570 B
1// nx_ingest_governed.nx -- a loop-produced capability does NOT get auto-inserted into the ecosystem/
2// language (operator: "i dont want just automatic insertion... i want it to go through the council
3// processes and get documented and get the rigor of the engineer and all that"). A candidate must pass
4// the SAME governance any capability does, with RACI separation of duties (the organ that AUTHORS never
5// verifies or admits its own work):
6// 1. ENGINEER -- rigor: compile -> link -> run -> clean exit, classified (no silent miscompile passes).
7// 2. COUNCIL -- admit: only an Engineer-PASS that is ADDITIVE and authored-by-someone-else (no self-admit).
8// 3. SCRIBE -- document: a catalog + doc entry must exist before it is admitted to the registry.
9// 4. INGEST -- only when all three hold; else HELD with a routable reason (-> Doctor / -> document / -> reject).
10// license_tier: ORIGINAL Composes the existing organs (nx_engineer_gate_runner, nx_warden, nx_crew_scribe).
11
12import "nx_syscalls.nx"
13
14// --- 1. ENGINEER rigor (the four real build stages, classified -- mirrors eng_build_gate) ---
15const IG_ENG_PASS: i64 = 1
16const IG_ENG_COMPILE_FAIL: i64 = 2
17const IG_ENG_LINK_FAIL: i64 = 3
18const IG_ENG_CRASH: i64 = 4 // ran but died on a signal (the miscompile/segfault class)
19const IG_ENG_FAIL: i64 = 5 // ran, exited non-zero
20
21func ig_engineer(compiled: i64, linked: i64, ran_no_signal: i64, exit_ok: i64) -> i64 {
22 if compiled != 1 { return IG_ENG_COMPILE_FAIL }
23 if linked != 1 { return IG_ENG_LINK_FAIL }
24 if ran_no_signal != 1 { return IG_ENG_CRASH }
25 if exit_ok != 1 { return IG_ENG_FAIL }
26 return IG_ENG_PASS
27}
28
29// --- 2. COUNCIL admit (warden-gated; additive-only; SEPARATION OF DUTIES) ---
30const IG_ADMIT: i64 = 1
31const IG_REJECT: i64 = 0
32
33func ig_council(eng_verdict: i64, additive_only: i64, author_id: i64, admitter_id: i64) -> i64 {
34 if eng_verdict != IG_ENG_PASS { return IG_REJECT } // council admits only what the Engineer passed
35 if additive_only != 1 { return IG_REJECT } // never admit a destructive/overwriting change
36 if author_id == admitter_id { return IG_REJECT } // RACI: the author cannot admit its own work
37 return IG_ADMIT
38}
39
40// --- 3. SCRIBE documentation (catalog row + doc article both required before admission) ---
41func ig_documented(catalog_entry: i64, doc_entry: i64) -> i64 {
42 if catalog_entry == 1 { if doc_entry == 1 { return 1 } }
43 return 0
44}
45
46// --- 4. FINAL ingest decision: every gate must hold; else HELD with the first-failing reason ---
47const IG_INGEST: i64 = 1
48const IG_HELD: i64 = 0
49
50const IG_REASON_OK: i64 = 0
51const IG_REASON_ENGINEER: i64 = 1 // -> route to Doctor to heal, then re-verify
52const IG_REASON_COUNCIL: i64 = 2 // -> rejected (non-additive / self-admit / unverified)
53const IG_REASON_UNDOC: i64 = 3 // -> route to Scribe/Librarian to document, then re-submit
54
55func ig_decision(eng_verdict: i64, council: i64, documented: i64) -> i64 {
56 if eng_verdict != IG_ENG_PASS { return IG_HELD }
57 if council != IG_ADMIT { return IG_HELD }
58 if documented != 1 { return IG_HELD }
59 return IG_INGEST
60}
61
62// the routable reason a candidate was HELD (Engineer first, then Council, then documentation).
63func ig_held_reason(eng_verdict: i64, council: i64, documented: i64) -> i64 {
64 if eng_verdict != IG_ENG_PASS { return IG_REASON_ENGINEER }
65 if council != IG_ADMIT { return IG_REASON_COUNCIL }
66 if documented != 1 { return IG_REASON_UNDOC }
67 return IG_REASON_OK
68}