nx_nishi_page_validator.nx
buildroot/runtime/hub/nx_nishi_page_validator.nx
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
imports: nx_syscalls.nxnx_html_extract.nx
imported by: nx_nishi_page_emit.nx
structs
| 87 | struct NxNishiPageReport |
consts
| 31 | const NX_NPV_OK: i64 = 0 // C0-conformant (V1) |
| 32 | const NX_NPV_BAD_INPUT: i64 = 2300 |
| 33 | const NX_NPV_INPUT_TOO_LARGE: i64 = 2301 |
| 34 | const NX_NPV_NO_HEAD_FOUND: i64 = 2302 |
| 35 | const NX_NPV_MISSING_CANONICAL: i64 = 2303 |
| 36 | const NX_NPV_MISSING_TITLE: i64 = 2304 |
| 37 | const NX_NPV_MISSING_SUMMARY: i64 = 2305 |
| 38 | const NX_NPV_MISSING_TAGS: i64 = 2306 |
| 39 | const NX_NPV_MISSING_LAST_MODIFIED: i64 = 2307 |
| 40 | const NX_NPV_MISSING_CONTENT_HASH: i64 = 2308 |
| 41 | const NX_NPV_MISSING_PAGE_VERSION: i64 = 2309 |
| 42 | const NX_NPV_MISSING_LICENSE: i64 = 2310 |
| 43 | const NX_NPV_MISSING_AUTHOR: i64 = 2311 |
| 44 | const NX_NPV_MALFORMED_CANONICAL: i64 = 2312 |
| 45 | const NX_NPV_MALFORMED_LAST_MODIFIED: i64 = 2313 |
| 46 | const NX_NPV_MALFORMED_CONTENT_HASH: i64 = 2314 |
| 47 | const NX_NPV_MALFORMED_PAGE_VERSION: i64 = 2315 |
| 48 | const NX_NPV_VERSION_INCOMPATIBLE: i64 = 2316 |
| 49 | const NX_NPV_LENGTH_OUT_OF_RANGE: i64 = 2317 |
| 50 | const NX_NPV_LOOP_BUDGET: i64 = 2318 |
| 51 | const NX_NPV_TOO_MANY_TAGS: i64 = 2319 |
| 54 | const NX_NPV_MAX_INPUT_BYTES: i64 = 1048576 // 1 MB |
| 55 | const NX_NPV_HEAD_SCAN_LIMIT: i64 = 65536 // first 64 KB |
| 56 | const NX_NPV_LOOP_BUDGET_CAP: i64 = 1000000 |
| 57 | const NX_NPV_CONTENT_HASH_LEN: i64 = 16 // 16 hex chars per spec §2.6 |
| 58 | const NX_NPV_MAX_TAG_COUNT: i64 = 50 // per §2.4 |
| 59 | const NX_NPV_MAX_INDEXER_MAJOR: i64 = 1 // we speak V1.x |
| 60 | const NX_NPV_MIN_INDEXER_MAJOR: i64 = 1 |
| 63 | const NX_NPV_TITLE_MIN: i64 = 1 |
| 64 | const NX_NPV_TITLE_MAX: i64 = 200 |
| 65 | const NX_NPV_SUMMARY_MIN: i64 = 1 |
| 66 | const NX_NPV_SUMMARY_MAX: i64 = 500 |
| 67 | const NX_NPV_AUTHOR_MIN: i64 = 1 |
| 68 | const NX_NPV_AUTHOR_MAX: i64 = 100 |
| 69 | const NX_NPV_LICENSE_MIN: i64 = 1 |
| 70 | const NX_NPV_LICENSE_MAX: i64 = 64 |
| 71 | const NX_NPV_CANONICAL_MAX: i64 = 2048 |
| 72 | const NX_NPV_TAGS_MAX: i64 = 1024 |
| 73 | const NX_NPV_LAST_MOD_MIN: i64 = 20 // "1970-01-01T00:00:00Z" |
| 74 | const NX_NPV_LAST_MOD_MAX: i64 = 32 |
| 77 | const NX_NPV_ASCII_LT: i64 = 0x3C |
| 78 | const NX_NPV_ASCII_GT: i64 = 0x3E |
| 79 | const NX_NPV_ASCII_QT: i64 = 0x22 // '"' |
functions
| 105 | func nx_npv_report_init(r: *NxNishiPageReport) -> i64 called by 1: nx_nishi_page_validate |
| 131 | func nx_npv_find_meta(src: *u8, src_n: i64, head_limit: i64, |
| 216 | func nx_npv_is_absolute_url(src: *u8, off: i64, n: i64) -> i64 called by 1: nx_nishi_page_validate |
| 243 | func nx_npv_is_hex(c: i64) -> i64 |
| 251 | func nx_npv_is_content_hash(src: *u8, off: i64, n: i64) -> i64 called by 1: nx_nishi_page_validate |
| 268 | func nx_npv_is_iso8601(src: *u8, off: i64, n: i64) -> i64 called by 1: nx_nishi_page_validate |
| 293 | func nx_npv_parse_semver(src: *u8, off: i64, n: i64, called by 1: nx_nishi_page_validate |
| 334 | func nx_npv_count_tags(src: *u8, off: i64, n: i64) -> i64 called by 1: nx_nishi_page_validate |
| 359 | func nx_nishi_page_validate(src: *u8, src_n: i64, |