code wiki / _hdl_build / nx_meal_source.nx
nx_meal_source.nx
buildroot/runtime/_hdl_build/nx_meal_source.nx
about
nx_meal_source.nx -- LIB: the LINK-ROT-PROOF provenance spine of the meal planner. Every recipe rendered
on a Nishi page carries WHERE IT CAME FROM -- publisher, original URL, license -- together with a PRESERVED
COPY of that origin page written as a WARC/1.0 resource record (nx_web_archive, ISO 28500 -- the same format
the Internet Archive and Browsertrix emit, so ours interoperates). When the origin rots, the citation still
resolves: the page serves the preserved bytes instead of a 404, and the credit line stays TRUE instead of
pointing at a dead host.
HONESTY BY CONSTRUCTION (rule 23; R0a "a placeholder that reads as a real claim"): ms_is_archived is a
MEASUREMENT, never a stored flag -- it re-reads the WARC and confirms the payload is actually retrievable
before the page is permitted to render "archived copy". A recorded INTENT to archive can therefore never
masquerade as an archive that EXISTS. ms_capture_verify proves the same for a fresh capture, round-trip,
byte-for-byte -- binary payloads with embedded CRLF are exactly where a line-based archive corrupts silently.
Schema (prefix passed in, e.g. knowledge/store/meal-):
meal:srcids -> TAB list of recipe ids
meal:src:<rid> -> title <t> publisher <t> origin_url <t> license <t> captured_day <t> origin_bytes
This file RECORDS and MEASURES provenance; it renders NOTHING (rule 9) -- nx_meal_page owns all markup.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 4 imports · 4 importers
imports: nx_food_science.nxnx_web_archive.nxnx_seg_store.nxnx_syscalls.nx
imported by: nx_meal_emit.nxnx_meal_page.nxnx_meal_source_gate.nxnx_skill_video.nx
structs
| none |
consts
| 25 | const MS_TAB: i64 = 9 |
| 26 | const MS_KEYCAP: i64 = 160 |
| 27 | const MS_VALCAP: i64 = 2048 |
| 28 | const MS_LISTCAP: i64 = 8192 |
| 29 | const MS_TOKCAP: i64 = 96 |
| 32 | const MS_F_TITLE: i64 = 0 |
| 33 | const MS_F_PUBLISHER: i64 = 1 |
| 34 | const MS_F_URL: i64 = 2 |
| 35 | const MS_F_LICENSE: i64 = 3 |
| 36 | const MS_F_DAY: i64 = 4 |
| 37 | const MS_F_BYTES: i64 = 5 |
| 41 | const MS_ROT_NONE: i64 = 0 |
| 42 | const MS_ROT_RISK: i64 = 1 |
| 43 | const MS_ROT_PROOF: i64 = 2 |
functions
| 54 | func ms_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 55 | func ms_keybuf() -> *u8 { if MS_KB == 0 { MS_KB = sys_mmap(MS_KEYCAP) as i64 } return MS_KB as *u8 } |
| 56 | func ms_valbuf() -> *u8 { if MS_VB == 0 { MS_VB = sys_mmap(MS_VALCAP) as i64 } return MS_VB as *u8 } |
| 57 | func ms_pq() -> *i64 { if MS_PQ == 0 { MS_PQ = sys_mmap(16) as i64 } return MS_PQ as *i64 } called by 6: ms_listms_fieldms_is_archivedms_archive_bytesms_archive_offms_capture_verify calls 1: sys_mmap |
| 58 | func ms_lq() -> *i64 { if MS_LQ == 0 { MS_LQ = sys_mmap(16) as i64 } return MS_LQ as *i64 } called by 6: ms_listms_fieldms_is_archivedms_archive_bytesms_archive_offms_capture_verify calls 1: sys_mmap |
| 61 | func ms_put(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 71 | func ms_src_key(rid: *u8, out: *u8) -> i64 |
| 80 | func ms_split(buf: *u8, len: i64, outtoks: *i64) -> i64 |
| 105 | func ms_list(prefix: *u8, outtoks: *i64) -> i64 |
| 113 | func ms_list_add(prefix: *u8, rid: *u8) -> i64 |
| 137 | func ms_record(prefix: *u8, rid: *u8, title: *u8, publisher: *u8, url: *u8, license: *u8, captured_day: i64, origin_bytes: i64) -> i64 |
| 155 | func ms_field(prefix: *u8, rid: *u8, f: i64, out: *u8) -> i64 |
| 165 | func ms_field_num(prefix: *u8, rid: *u8, f: i64) -> i64 |
| 176 | func ms_capture(warc: *u8, off: i64, url: *u8, date: *u8, ctype: *u8, payload: *u8, plen: i64) -> i64 |
| 182 | func ms_is_archived(warc: *u8, warclen: i64, url: *u8) -> i64 |
| 191 | func ms_archive_bytes(warc: *u8, warclen: i64, url: *u8) -> i64 |
| 199 | func ms_archive_off(warc: *u8, warclen: i64, url: *u8) -> i64 |
| 208 | func ms_capture_verify(warc: *u8, warclen: i64, url: *u8, payload: *u8, plen: i64) -> i64 |
| 224 | func ms_is_citable(prefix: *u8, rid: *u8) -> i64 |
| 234 | func ms_rot_state(prefix: *u8, rid: *u8, warc: *u8, warclen: i64) -> i64 |