code wiki / _hdl_build / nx_office_gate.nx
nx_office_gate.nx source
↩ module page · 21 lines · 1485 B
1// nx_office_gate.nx -- the OFFLINE gate for Nishi Office v1 (consumes the pure core nx_office_serve, no sockets).
2// Runs the full selftest against a FRESH throwaway root (/tmp, unique by now_us): create doc/sheet/deck through
3// of_handle with real HTTP request bytes, prove additive versioning (v1 bytes untouched after v2), byte-identical
4// downloads, computed spreadsheet formulas in the preview, and LOUD refusals (bad name / kind flip / missing
5// version / cross-origin POST). GREEN = exit 0. Runs the REAL format organs (_offc/nx_docx|nx_xlsx|nx_pptx.elf)
6// via fork+exec, so it must run from the nxc2 root. license_tier: ORIGINAL expect_exit: 0
7// D001 (2026-09-02): every tooth is a gv_check through the selftest's one ruler (of_ck) and the verdict is
8// gv_verdict, emitted LAST, so /api/gate_run and the compare referee read the outcome from the exit code
9// and the canonical tally line instead of a hand-rolled PASS/FAIL print nothing could judge.
10import "nx_office_serve.nx"
11import "nx_gate_verdict.nx"
12
13func main() -> i64 {
14 let root: *u8 = sys_mmap(128)
15 var o: i64 = of_cat(root, 0, "/tmp/officegate_" as *u8)
16 o = of_catn(root, o, sys_now_us())
17 root[o] = 0 as u8
18 let c: *i64 = gv_ctr()
19 of_selftest_gv(root, c)
20 return gv_verdict("NX-OFFICE-SELFTEST" as *u8, c, "the office round-trips: create/edit/version/preview/download, additive by construction; the AI tooth probes the seat and asserts the contract that matches its state" as *u8)
21}