code wiki / (root) / nx_asset_meta_gate.nx

nx_asset_meta_gate.nx

buildroot/runtime/nx_asset_meta_gate.nx

18386 B360 linesdepth 9pulls 18 transitivereach 0 importersview sourcekind gate/prooftopic asset
docsdependenciesstructsconstsfunctions

about

nx_asset_meta_gate.nx -- KAT + TEETH for nx_asset_meta + nx_asset_autotag (R3 of the universal organization-tooling arc). ONE gate, both organs. PROVES the catalog can know WHAT each asset IS and WHICH media are NEAR-duplicates: (a) METADATA (KAT, REAL extraction): - a REAL PNG byte buffer (signature + IHDR, width=320 height=200) -> am_enrich_image populates width="320" / height="200" / encoding_format="image/png" extracted FROM THE BYTES; - those fields ROUND-TRIP through R0's ar_encode -> ar_decode -> ar_get byte-faithfully; - a DOC record -> am_enrich_doc populates dc:title + dc:subject, round-tripping the same way; - TEETH: non-PNG bytes -> am_enrich_image refuses (AM_NOT_PNG), inventing NO dimensions. (b) NEAR-DUP via perceptual hash: - two NEAR-identical grayscale images (a small perturbation) -> at_neardup GROUPS them (Hamming < threshold); - two CLEARLY-DIFFERENT images -> NOT grouped (TEETH: no false-merge); - identical bytes -> Hamming 0 AND same CID (ar_cid). (c) THE WHOLE POINT -- perceptual hash catches a near-dup that exact-CID does NOT: a 1-pixel-changed image has a DIFFERENT CID (ar_cid differs) but a near-zero Hamming distance -> grouped. Both asserted (CID differs AND phash groups). Verdict logged to knowledge/status/asset_meta_gate.log (append-only; ADDITIVE law #13). expect_exit: 0 license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_asset_record.nx nx_asset_meta.nx nx_asset_autotag.nx nx_gate_verdict.nx nx_asset_meta_gate.nx

imports: nx_syscalls.nxnx_asset_record.nxnx_asset_meta.nxnx_asset_autotag.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_append g_puts sys_write sys_mmap gate_make_png ar_addf ar_present am_enrich_image am_extract_image png_check_sig sys_mmap ↻ png_parse_ihdr png_read_u32_be am_itoa sys_mmap ↻ ar_cpy ar_addf ↻ g_streq ar_encode canon_encode sys_mmap ↻ cc_cmp cc_w32 cc_len sys_munmap ar_decode canon_decode ud_r32 sys_mmap ↻ ar_get ar_streq am_enrich_doc ar_addf ↻ g_putn sys_mmap ↻ g_puts ↻ sys_write ↻ gate_fill_gradient gate_memcpy

structs

none

consts

none

functions

33func g_puts(logfd: i64, s: *u8) -> i64
called by 2: g_putnmain calls 1: sys_write
40func g_putn(logfd: i64, v: i64) -> i64
called by 1: main calls 3: sys_mmapg_putssys_write
54func g_streq(a: *u8, b: *u8) -> i64
called by 1: main
64func E() -> *u8 { return "\x00" as *u8 }
69func gate_make_png(raw: *u8, w: i64, h: i64) -> i64
called by 1: main
88func gate_fill_gradient(g: *u8, w: i64, h: i64) -> i64
called by 1: main
101func gate_memcpy(dst: *u8, src: *u8, n: i64) -> i64
called by 1: main
107func main() -> i64