code wiki / _hdl_build / nx_legal_store_gate.nx

nx_legal_store_gate.nx

buildroot/runtime/_hdl_build/nx_legal_store_gate.nx

6358 B144 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic legal
docsdependenciesstructsconstsfunctions

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

nx_legal_store.nx nx_doc_vault.nx nx_syscalls.nx nx_legal_store_gate.nx

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

main sys_mmap nx_vault_add ls_path nx_vault_valid_tid ls_cat ls_save sys_openat_wr sys_mmap ↻ sys_write sys_close ls_load sys_openat_rd sys_mmap ↻ sys_read sys_close ↻ nx_vault_version_count nx_vault_verify_chain nx_vault_current_idx sys_openat_wr ↻ sys_write ↻ sys_close ↻ ew sys_write ↻ ewn sys_mmap ↻ sys_write ↻ sys_openat_append

structs

none

consts

23const LST_LOG: *u8 = "knowledge/status/legal_store.log"
24const LST_BASE: *u8 = "/tmp/nx_ls_"

functions

26func 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 }
called by 1: main calls 1: sys_write
27func ewn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
37func main() -> i64