code wiki / _hdl_build / nx_legal_store_gate.nx
nx_legal_store_gate.nx
buildroot/runtime/_hdl_build/nx_legal_store_gate.nx
about
nx_legal_store_gate.nx -- GATE for LEGAL D7 (nx_legal_store), the ENGINEER verify.
Composes a REAL D1 vault store + the persistence layer and asserts the durable-
state contract, each with a negative control:
T1 ROUND-TRIP : a 3-version vault saved + loaded into a FRESH array is
byte-identical (every record field), as after a restart.
T2 SURVIVES-RESTART: the reloaded array still satisfies the vault invariants
(version_count=3, chain OK, current=v3) -- real state, not bytes.
T3 TENANT ISOLATION: ls_path rejects '../x' / 'a/b' / '' (no traversal); a
different tenant's path is a different file -> can't load it.
T4 ABSENT + CORRUPT: load of a missing file -> -1; a wrong-magic file -> -MAGIC
(never silent garbage).
T5 STRIDE GUARD : a vault file (stride 8) loaded as stride 9 -> -STRIDE
(a vault can never be misread as an envelope).
T6 IDEMPOTENT : saving twice then loading yields the identical store (#10).
Evidence -> knowledge/status/legal_store.log
license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_legal_store.nxnx_doc_vault.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
| 23 | const LST_LOG: *u8 = "knowledge/status/legal_store.log" |
| 24 | const LST_BASE: *u8 = "/tmp/nx_ls_" |
functions
| 26 | func ew(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 27 | func ewn(fd: i64, v: i64) -> i64 |
| 37 | func main() -> i64 |