nx_doc_dashboard_substrate_state_test.nx source
↩ module page · 91 lines · 4578 B
1// nx_doc_dashboard_substrate_state_test.nx -- writes substrate's
2// REAL state dashboard to nxc2/docs/dashboards/substrate_state.md.
3//
4// First operational dashboard the user can OPEN. Hardcoded
5// substrate state captured from this-session measurements;
6// future: argv-driven + live state from audit primitives.
7
8import "nx_syscalls.nx"
9import "nx_string_ops.nx"
10import "nx_doc_decision.nx"
11import "nx_doc_incumbent.nx"
12import "nx_doc_dashboard.nx"
13
14func main() -> i64 {
15 let path: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/docs/dashboards/substrate_state.md"
16
17 // Build a few real ADRs from this session's decisions.
18 let dec_buf: *u8 = sys_mmap(3 * 128 + 16)
19 let d0: *NxDecisionRecord = dec_buf as *NxDecisionRecord
20 nx_decision_record_init(d0, 1, 20260521)
21 d0.title_ptr = "V5 docs doctrine: bits-up substrate-knowledge-system"
22 d0.title_len = 52
23 d0.status = NX_DECISION_ACCEPTED
24 d0.problem_ptr = "V4 living docs lacked reasoning chains + provenance tiers + multi-incumbent dashboards."
25 d0.problem_len = 87
26 d0.alternatives_ptr = "Adopt third-party tools (Honeycomb / Databox / Grafana); refused per bits-up cardinal."
27 d0.alternatives_len = 86
28 d0.chosen_ptr = "Bits-up nx_doc_decision (D20) + nx_doc_incumbent (D21+D22) + nx_doc_dashboard (D23) composite."
29 d0.chosen_len = 94
30 d0.formula_ptr = "ADR-shape per Cognitect/Nygard 2011 + MADR template."
31 d0.formula_len = 52
32 d0.physics_justification_ptr = "Reasoning chains are O(1) lookup vs O(n) corpus-grep when asking 'why X?'"
33 d0.physics_justification_len = 73
34 d0.research_opportunities_ptr = "Bits-up Mermaid renderer for SVG output; nx_doc_render_canvas queued D16."
35 d0.research_opportunities_len = 73
36
37 let d1: *NxDecisionRecord = ((dec_buf as *u8) + 128) as *NxDecisionRecord
38 nx_decision_record_init(d1, 2, 20260521)
39 d1.title_ptr = "Backtick-aware [[X]] extraction in nx_doc_xref"
40 d1.title_len = 46
41 d1.status = NX_DECISION_ACCEPTED
42 d1.problem_ptr = "Metal MSL [[buffer(N)]] etc. matched as Zettelkasten refs (false positives)."
43 d1.problem_len = 76
44 d1.alternatives_ptr = "Per-doc escape; markup change; OR architectural backtick-aware extraction."
45 d1.alternatives_len = 74
46 d1.chosen_ptr = "Backtick-state toggle during scan; skip [[X]] inside ` spans."
47 d1.chosen_len = 61
48 d1.formula_ptr = "inside_code ^= (byte == '`'); skip extraction while inside_code==1."
49 d1.formula_len = 66
50 d1.physics_justification_ptr = "Eliminates entire class of code-syntax false positives in O(n) single pass."
51 d1.physics_justification_len = 75
52 d1.research_opportunities_ptr = "Triple-backtick fences approximate; nested double-backtick edge cases queued."
53 d1.research_opportunities_len = 77
54
55 // Build incumbent table for DOCS class.
56 let table_buf: *u8 = sys_mmap(128)
57 let t: *NxIncumbentTable = table_buf as *NxIncumbentTable
58 nx_incumbent_table_init(t, NX_PCLASS_DOCS,
59 "auto-doc generation + multi-modal output", 40,
60 "compliance % vs spec (Q14)", 26,
61 16384, NX_PROVENANCE_PERSONALLY_MEASURED)
62 let rows_buf: *u8 = sys_mmap(5 * 48 + 16)
63 let rows: *NxIncumbentRow = rows_buf as *NxIncumbentRow
64 nx_incumbent_row_init(rows, "JavaDoc", 7, "23", 2, 8192, NX_PROVENANCE_INDUSTRY_STATED)
65 let r1: *NxIncumbentRow = ((rows_buf as *u8) + 48) as *NxIncumbentRow
66 nx_incumbent_row_init(r1, "Rustdoc", 7, "1.84", 4, 18000, NX_PROVENANCE_INDUSTRY_STATED)
67 let r2: *NxIncumbentRow = ((rows_buf as *u8) + 96) as *NxIncumbentRow
68 nx_incumbent_row_init(r2, "Sphinx", 6, "7.4", 3, 12000, NX_PROVENANCE_INDUSTRY_STATED)
69 let r3: *NxIncumbentRow = ((rows_buf as *u8) + 144) as *NxIncumbentRow
70 nx_incumbent_row_init(r3, "Mermaid", 7, "11.4", 4, 14000, NX_PROVENANCE_INDUSTRY_STATED)
71 let r4: *NxIncumbentRow = ((rows_buf as *u8) + 192) as *NxIncumbentRow
72 nx_incumbent_row_init(r4, "Obsidian", 8, "1.7", 3, 20000, NX_PROVENANCE_INDUSTRY_STATED)
73 nx_incumbent_table_set_rows(t, rows, 5)
74
75 let rc: i64 = nx_doc_dashboard_compose_to_file(
76 path,
77 "Nishi substrate — live state dashboard", 40,
78 20260521,
79 1600,
80 7, // V2 compliance %
81 5, // link rot %
82 46, 46, // cross-arch parity
83 0, // primitives at trust >= SUBOPTIMAL
84 0, // primitives at competitive >= PARITY
85 d0, 2, // 2 decisions
86 t, 1 // 1 incumbent table
87 )
88 if rc != 0 { return 10 }
89
90 return 0
91}