code wiki / (root) / nx_meal_capture.nx

nx_meal_capture.nx

buildroot/runtime/nx_meal_capture.nx

7488 B185 linesdepth 7pulls 11 transitivereach 0 importersview sourcekind tooltopic meal
docsdependenciesstructsconstsfunctions

about

nx_meal_capture.nx -- MAIN: preserve ONE origin recipe page into the sovereign WARC, correctly. WHY THIS IS ITS OWN ORGAN. It began as a stage inside nx_meal_emit. Pulling in nx_gzip_wrap there dragged nx_runtime + nx_tier + nx_deflate + nx_crc32 in behind it, and the emitter's seg-store seeding -- code that had not been touched and had run green minutes earlier -- started dying silently. Rather than fight that, the two jobs are separated the way they should have been from the start (rule 9): CAPTURE owns bytes off the wire and touches no store; EMIT owns the stores and the page and touches no decompressor. Each organ now imports only what its own job needs. WHAT IT FIXES. A raw sovereign fetch returns the body exactly as it travelled: HTTP/1.1 CHUNK-FRAMED, and then DEFLATE-compressed. Archiving those bytes preserves something nobody can read, while still answering "is this URL archived?" with YES -- so a page would claim the link cannot rot over a blob it cannot serve. That is the estate's own gzip-undecoded class, already paid for once in the crawler. SO IT REFUSES. If the decoded payload is not recognisably HTML, NOTHING is written to the archive, and the meal page will honestly report the source as unpreserved. An empty archive that admits it is empty beats a full one that lies. Decoders are the INCUMBENTS: nx_http_chunked (gate-proven) and nx_gzip_wrap (~10 consumers, KAT-proven). nx_inflate.nx is a known second implementation whose own header says DO NOT ADD NEW CONSUMERS. argv[1] = raw fetch file argv[2] = WARC path argv[3] = target URI argv[4] = ISO date license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_web_archive.nx nx_http_chunked.nx nx_gzip_wrap.nx nx_syscalls.nx nx_meal_capture.nx

imports: nx_web_archive.nxnx_http_chunked.nxnx_gzip_wrap.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

structs

none

consts

29const MCAP_WARC: i64 = 4194304
30const MCAP_GZ_MAGIC1: i64 = 31
31const MCAP_GZ_MAGIC2: i64 = 139

functions

33func mcap_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
calls 1: sys_write
34func mcap_n(v: i64) -> i64
47func mcap_find(hay: *u8, hl: i64, needle: *u8, nl: i64, from: i64) -> i64
61func main(argc: i64, argv: *i64) -> i64