code wiki / _hdl_build / nx_figure_gate.nx
nx_figure_gate.nx
buildroot/runtime/_hdl_build/nx_figure_gate.nx
about
nx_figure_gate.nx -- IMS Thrust D R2 REFEREE: proves nx_chart (native SVG) + nx_dataset_export
(CSV/JSON/TSV) are CORRECT and HONEST, with negative-control TEETH (a green can't be faked).
REAL DATASET (not invented): the live wiki's own page-count growth across the IMS rungs --
8 -> 12 -> 13 -> 20 -> 21 pages (the documented arc progression; the corpus is at 21 today and
becomes 22 with this very page). Labels = the rung tags, values = the page count at each.
CHECKS:
(a) CHART well-formed:
A1 balanced: exactly one "<svg" and one "</svg>" in the output.
A2 bar count: exactly N occurrences of "<rect class=\"bar\"" for N data values.
A3 value->height: a known value's bar height equals the INDEPENDENTLY recomputed scaled
height vs_linear(0, nice_top, 0, CH_PLOT_H, v) -- read back from the emitted height="..".
(b) BYTE-FAITHFUL multi-format export (the round-trip oracle dx_equal):
B1 CSV -> parse -> dx_equal(original) (identical records)
B2 JSON -> parse -> dx_equal(original)
B3 TSV -> parse -> dx_equal(original)
B4 CROSS chain: original -> CSV -> ds1 -> JSON -> ds2 -> TSV -> ds3, all == original.
B5 ESCAPING TEETH: a cell containing a comma AND a double-quote (`a,"b`) survives the CSV
round trip byte-exact AND the CSV bytes actually quote+double it ("a,""b"). A naive
emitter that forgot to escape would corrupt the parse -> this check would FAIL.
(c) GRACEFUL edges:
C1 empty dataset (0 rows): CSV emits header-only (valid), chart emits 0 bars + stays balanced.
C2 malformed JSON ("not json") -> dx_parse_json returns a NEGATIVE verdict, no crash.
GREEN iff all pass. Evidence -> knowledge/status/figure_gate.log. Sovereign: imports the two organs
+ nx_framed_append + nx_syscalls. license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_chart.nxnx_dataset_export.nxnx_framed_append.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 33 | const FG_LOG: *u8 = "knowledge/status/figure_gate.log" |
| 34 | const FG_CAP: i64 = 512 |
functions
| 36 | func fg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 37 | func fg_num(v: i64) -> i64 |
| 45 | func fg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != 0 as u8 { dst[off + i] = s[i]; i = i + 1 } return off + i } |
| 46 | func fg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 56 | func fg_row(name: *u8, pass: i64) -> i64 |
| 69 | func fg_count(buf: *u8, n: i64, needle: *u8) -> i64 called by 1: main |
| 84 | func fg_find(buf: *u8, n: i64, needle: *u8) -> i64 called by 1: main |
| 100 | func fg_first_height(buf: *u8, n: i64, from: i64) -> i64 called by 1: main |
| 119 | func main() -> i64 |