code wiki / hub / nx_nishi_page_validator.nx

nx_nishi_page_validator.nx

buildroot/runtime/hub/nx_nishi_page_validator.nx

19468 B478 linesdepth 3pulls 3 transitivereach 25 importersview sourcekind librarytopic nishi
docsdependenciesstructsconstsfunctions

about

nx_nishi_page_validator.nx -- HUB primitive; conformance validator for Nishi Page Format V1. Reference: NISHI_PAGE_FORMAT_V1.md §5. COMPOSES (HUB primitives only): nx_html_extract (case-insensitive byte match + parse helpers) COMPOSED BY: (future) hub/nx_nishi_page_emit (emitter cross-checks own output) (future) hub/nx_search_offsite_crawler (skips non-conformant) (future) wiki/nx_wiki_index_builder (skips non-conformant) (future) bin/nishi-validate CLI V1 SCOPE per NISHI_PAGE_FORMAT_V1.md §1: - C0 (MUST): 9 required <meta name="nishi-*"> tags present + per-tag rules pass - C1 (SHOULD): C0 + body conventions (h1 matches title; section ids) - C2 (MAY): C1 + semantic enrichment (time datetime, dl, address, cite) V2 SCOPE (TODO): - Body-convention deep validation (C1+C2 partial; structural now) - Anti-pattern detection (§8): canonical-mismatch, content-hash drift, tag-stuffing, license-omission, author-impersonation - SemVer-compatible version dispatch when V1.1/V2.0 ship Status: V1. 2026-05-27.

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_html_extract.nx nx_nishi_page_validator.nx nx_nishi_page_emit.nx

imports: nx_syscalls.nxnx_html_extract.nx

imported by: nx_nishi_page_emit.nx

structs

87struct NxNishiPageReport

consts

31const NX_NPV_OK: i64 = 0 // C0-conformant (V1)
32const NX_NPV_BAD_INPUT: i64 = 2300
33const NX_NPV_INPUT_TOO_LARGE: i64 = 2301
34const NX_NPV_NO_HEAD_FOUND: i64 = 2302
35const NX_NPV_MISSING_CANONICAL: i64 = 2303
36const NX_NPV_MISSING_TITLE: i64 = 2304
37const NX_NPV_MISSING_SUMMARY: i64 = 2305
38const NX_NPV_MISSING_TAGS: i64 = 2306
39const NX_NPV_MISSING_LAST_MODIFIED: i64 = 2307
40const NX_NPV_MISSING_CONTENT_HASH: i64 = 2308
41const NX_NPV_MISSING_PAGE_VERSION: i64 = 2309
42const NX_NPV_MISSING_LICENSE: i64 = 2310
43const NX_NPV_MISSING_AUTHOR: i64 = 2311
44const NX_NPV_MALFORMED_CANONICAL: i64 = 2312
45const NX_NPV_MALFORMED_LAST_MODIFIED: i64 = 2313
46const NX_NPV_MALFORMED_CONTENT_HASH: i64 = 2314
47const NX_NPV_MALFORMED_PAGE_VERSION: i64 = 2315
48const NX_NPV_VERSION_INCOMPATIBLE: i64 = 2316
49const NX_NPV_LENGTH_OUT_OF_RANGE: i64 = 2317
50const NX_NPV_LOOP_BUDGET: i64 = 2318
51const NX_NPV_TOO_MANY_TAGS: i64 = 2319
54const NX_NPV_MAX_INPUT_BYTES: i64 = 1048576 // 1 MB
55const NX_NPV_HEAD_SCAN_LIMIT: i64 = 65536 // first 64 KB
56const NX_NPV_LOOP_BUDGET_CAP: i64 = 1000000
57const NX_NPV_CONTENT_HASH_LEN: i64 = 16 // 16 hex chars per spec §2.6
58const NX_NPV_MAX_TAG_COUNT: i64 = 50 // per §2.4
59const NX_NPV_MAX_INDEXER_MAJOR: i64 = 1 // we speak V1.x
60const NX_NPV_MIN_INDEXER_MAJOR: i64 = 1
63const NX_NPV_TITLE_MIN: i64 = 1
64const NX_NPV_TITLE_MAX: i64 = 200
65const NX_NPV_SUMMARY_MIN: i64 = 1
66const NX_NPV_SUMMARY_MAX: i64 = 500
67const NX_NPV_AUTHOR_MIN: i64 = 1
68const NX_NPV_AUTHOR_MAX: i64 = 100
69const NX_NPV_LICENSE_MIN: i64 = 1
70const NX_NPV_LICENSE_MAX: i64 = 64
71const NX_NPV_CANONICAL_MAX: i64 = 2048
72const NX_NPV_TAGS_MAX: i64 = 1024
73const NX_NPV_LAST_MOD_MIN: i64 = 20 // "1970-01-01T00:00:00Z"
74const NX_NPV_LAST_MOD_MAX: i64 = 32
77const NX_NPV_ASCII_LT: i64 = 0x3C
78const NX_NPV_ASCII_GT: i64 = 0x3E
79const NX_NPV_ASCII_QT: i64 = 0x22 // '"'

functions

105func nx_npv_report_init(r: *NxNishiPageReport) -> i64
131func nx_npv_find_meta(src: *u8, src_n: i64, head_limit: i64,
216func nx_npv_is_absolute_url(src: *u8, off: i64, n: i64) -> i64
243func nx_npv_is_hex(c: i64) -> i64
251func nx_npv_is_content_hash(src: *u8, off: i64, n: i64) -> i64
268func nx_npv_is_iso8601(src: *u8, off: i64, n: i64) -> i64
293func nx_npv_parse_semver(src: *u8, off: i64, n: i64,
334func nx_npv_count_tags(src: *u8, off: i64, n: i64) -> i64
359func nx_nishi_page_validate(src: *u8, src_n: i64,