code wiki / _hdl_build / nx_wiki_walkability.nx
nx_wiki_walkability.nx
buildroot/runtime/_hdl_build/nx_wiki_walkability.nx
about
nx_wiki_walkability.nx -- IMS arc: MEASURED walkability scorecard over the
REAL published wiki link graph (READ-ONLY baseline, no assertions).
PURPOSE: produce the honest navigation baseline the operator asked for --
NUMBERS from the link graph, not claims. Over the live corpus it computes:
1. N pages, total internal page-links, avg/min/max OUT-degree + IN-degree.
2. ORPHANS (in==0, excluding root) + DEAD-ENDS (out==0), with slugs.
3. RECIPROCAL page pairs (A->B AND B->A) vs ONE-WAY pairs.
4. Reachability from start: reachable count, max clicks-to-reach (BFS
depth), and STRANDED pages (unreachable from start).
READ-ONLY BY CONSTRUCTION: reads ONE framed corpus snapshot via sys_read_file
(the exact A1 transport) and computes in memory. Writes NOTHING to the corpus
-- the only output is the scorecard to stdout + a status log.
COMPOSES (DRY -- zero new corpus/link/slug substrate invented):
nx_ims_monitor nx_ims_collect_targets (the ONE unified outbound
[[wikilink]]+href extractor), nx_ims_slug_eq (the
ONE slug resolver), nx_ims_resolve_root, and the
NxWikiDocStore it composes -- so this scorecard's
notion of "a link/edge" is byte-identical to the
orphan/dead-link monitor and the graph builder.
nx_syscalls sys_read_file (read-only) + sys_mmap scratch.
The adjacency is built ONCE into a dense N*N edge bitmatrix (self-edges
dropped -- a page linking itself is not navigation), then every metric is a
pure read of that matrix. N is small (corpus cap), so N*N is trivial.
Hygiene: M1 out-params; M3 every while hard-capped; M5 bounded indexing;
M6 real semantics; M7 named constants; M8 verdicts. ("loop"/"match" reserved.)
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_ims_monitor.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 34 | const NX_MAGIC_8192: i64 = 8192 |
| 35 | const NX_MAGIC_16384: i64 = 16384 |
| 36 | const NX_MAGIC_1000000: i64 = 1000000 |
| 39 | const NX_WALK_OK: i64 = 0 |
| 40 | const NX_WALK_BAD_INPUT: i64 = 2760 |
| 41 | const NX_WALK_OVERFLOW: i64 = 2761 |
| 44 | const WALK_MAX_PAGES: i64 = 256 // corpus cap for the dense matrix |
| 45 | const WALK_MAX_BYTES: i64 = 4194304 // 4 MB snapshot cap |
| 46 | const WALK_MARK_PAGE_N: i64 = 8 // len("###PAGE ") |
| 47 | const WALK_MAX_LINKS_PP: i64 = 512 // outbound targets scanned per page |
functions
| 50 | func wlp(fd: i64, s: *u8) -> i64 |
| 57 | func wln(fd: i64, v: i64) -> i64 |
| 72 | func wln2(fd: i64, scaled: i64) -> i64 |
| 80 | func wlb(fd: i64, p: *u8, n: i64) -> i64 |
| 94 | func walk_parse_int(buf: *u8, off: i64, lim: i64, out_off: *i64) -> i64 called by 1: walk_ingest |
| 110 | func walk_is_page_mark(buf: *u8, off: i64, lim: i64) -> i64 called by 1: walk_ingest |
| 125 | func walk_ingest(store: *NxWikiDocStore, buf: *u8, total: i64) -> i64 |
| 172 | func walk_build_adj(store: *NxWikiDocStore, adj: *i64, n: i64) -> i64 |
| 234 | func main() -> i64 |