code wiki / (root) / nx_packmirror.nx

nx_packmirror.nx

buildroot/runtime/nx_packmirror.nx

17179 B324 linesdepth 21pulls 150 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_packmirror.nx -- THE PACK ARCHIVE ORGAN (debt 1787064637). Walks a pCloud-publink manifest and mirrors EVERY file entry into <destdir> over the sovereign TLS stack, verifying each written file against the manifest's declared byte size. COMPOSES the proven lanes: nx_packmirror_lib (parse + verify core, gate-proven), nx_https_fetch_follow (the research_fetch TLS lane), the Mozilla trust store. RESUMABLE: a dest already at its declared size is SKIPPED, so a re-run drains stragglers -- that is the retry story (one attempt per file per run, no in-run backoff duplication). FAIL-CLOSED: a size mismatch keeps the evidence as <name>.partial and counts REFUSED; a body that fills the reserve to the brim is REFUSED-TRUNCATED unread (the RF_BODY_CAP witness, same law). THE RECEIPTS PARTITION MUST SUM: seen = fetched + skipped + refused (+ unparsed alongside), printed with the reconciliation -- a partition that does not sum exits RED on itself. usage: nx_packmirror <manifest.json> <publink-code> <destdir> (mirror, pCloud dialect) nx_packmirror verify <pcloud|thread|bepis> <manifest.json> <destdir> (population byte-verify, no fetch) exit: 0 all clean | 1 refused/unparsed/partition-leak | 2 usage | 3 manifest unreadable | 4 trust store license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_packmirror_lib.nx nx_tool_run.nx nx_base64.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_fetch_follow.nx nx_packmirror.nx

imports: nx_syscalls.nxnx_packmirror_lib.nxnx_tool_run.nxnx_base64.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nx

imported by: nobody (leaf or entry point)

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

main pc_eq pc_verify sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ pc_read_file sys_openat_rd sys_read sys_close pc_w sys_write ↻ pc_eq ↻ pm_parse_thread pm_findn pm_int_after pm_b pm_rfindn pm_findn ↻ pm_b ↻ sys_mmap ↻ pm_parse_manifest pm_findn ↻ pm_int_after ↻ pm_rfindn ↻ pm_b ↻ pm_sanitize pm_b ↻

structs

none

consts

23const PMC_MANIFEST_CAP: i64 = 1048576 // a publink manifest measures ~50KB; filling this REFUSES loudly below
24const PMC_CERTDATA_CAP: i64 = 4194304 // Mozilla certdata.txt reserve (its own, never shared)
28const PMC_BODY_CAP: i64 = 134217728
29const PMC_LINK_CAP: i64 = 65536 // getpublinkdownload JSON (~400B observed)
30const PMC_URL_CAP: i64 = 2048
31const PMC_PATH_CAP: i64 = 1024
32const PMC_MODE_FILE: i64 = 420 // 0644
33const PMC_MODE_DIR: i64 = 493 // 0755
34const PMC_REDIRECTS: i64 = 6 // the research_fetch lane's proven follow depth
116const PMC_HEX_0: i64 = 48 // '0' -- lowercase-hex emission base for digits
117const PMC_HEX_A: i64 = 87 // 'a' - 10 -- lowercase-hex emission base for a..f
118const PMC_RAW32: i64 = 32 // a sha256 digest is exactly 32 raw bytes; any other decode length is a bad pin
119const PMC_HEXCAP: i64 = 80 // 64 hex chars + NUL, with margin
120const PMC_HASHOUT: i64 = 4096 // nx_filehash JSON output reserve (observed ~120 B)

functions

36func pc_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: pc_verifymain calls 1: sys_write
37func pc_n(v: i64) -> i64
called by 2: pc_verifymain calls 2: sys_mmapsys_write
49func pc_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o+i] = s[i]; i = i + 1 } d[o+i] = 0 as u8; return o + i }
called by 2: pc_verifymain
50func pc_catn(d: *u8, o: i64, v: i64) -> i64
calls 1: sys_mmap
64func pc_jstr(buf: *u8, at: i64, end: i64, key: *u8, dst: *u8, dcap: i64) -> i64
called by 1: main calls 2: pm_findnpm_b
89func pc_read_file(path: *u8, buf: *u8, cap: i64) -> i64
101func pc_write_file(path: *u8, buf: *u8, n: i64) -> i64
114func pc_eq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
called by 2: pc_verifymain
121func pc_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: pc_pin_ok
124func pc_hex(raw: *u8, n: i64, out: *u8) -> i64
called by 1: pc_pin_ok
140func pc_pin_ok(path: *u8, hb64: *u8) -> i64
161func pc_verify(dialect: *u8, mpath: *u8, dest: *u8) -> i64
230func main(argc: i64, argv: *i64) -> i64