code wiki / _hdl_build / nx_ws_ingest.nx

nx_ws_ingest.nx

buildroot/runtime/_hdl_build/nx_ws_ingest.nx

15992 B307 linesdepth 4pulls 6 transitivereach 5 importersview sourcekind librarytopic ws
docsdependenciesstructsconstsfunctions

about

nx_ws_ingest.nx -- THE MISSING INTEGRATION KEYSTONE (WMS derive-from-SSOT R1, for real). The operator's "we shouldn't have lots of separate systems" bug, named and fixed: the machine registry (knowledge/store/ws-, read by nx_ws_board) only ever tracked the assignment-queue ids (via nx_workstream_popqueue) and the PM/old WMS streams. The 426 durable project-*.md arcs -- genealogy, login, media, reader, brand, APM, doctor, ... -- were NEVER ingested, so the board could not see them. nx_ws_manifest_emit only rewrites a MARKDOWN list; it has zero ws_put. This organ is the half that was missing: it SCANS every project-*.md and ws_put's each into the registry so the board ENUMERATES every arc -> one source of truth, not three. REUSE / lineage: the dir walk is wme_scan (nx_ws_index_lib) -- names[] + REAL mtimes[]. The one-snapshot(ss_open)/one-writer(ss_begin)/one-commit(ss_commit) batch discipline + idempotent byte-compare skip is the proven nx_workstream_popqueue path (256-segment-cap safe at >1000 records; re-runs add ZERO segments). last_touched = the file mtime, so the board computes HONEST recency (ALIVE/STALLED) from real data instead of age=-1 phantom labels. State is data-derived: ACTIVE iff the file was touched within WSI_FRESH_SEC (genuinely in-flight), else FLOATING (indexed dormant history -- honest, never a faked DONE/ACTIVE). empire = best-effort keyword routing, unknown -> E-MISC (the documented catch-all, mirrors the popqueue doctrine); refined later from gate markers. memory_link = the project-*.md basename (so the arc is openable). Sovereign: imports only nx_workstream_store + nx_seg_store + nx_framed_append + nx_ws_index_lib + nx_syscalls (no gcc). Additive-only: modifies no existing organ. license_tier: ORIGINAL

dependencies 5 imports · 5 importers

nx_workstream_store.nx nx_seg_store.nx nx_framed_append.nx nx_ws_index_lib.nx nx_syscalls.nx nx_ws_ingest.nx nx_discover_loop.nx nx_ws_discover_gate.nx nx_ws_ingest_live.nx nx_ws_ingest_run.nx nx_ws_setstate.nx

imports: nx_workstream_store.nxnx_seg_store.nxnx_framed_append.nxnx_ws_index_lib.nxnx_syscalls.nx

imported by: nx_discover_loop.nxnx_ws_discover_gate.nxnx_ws_ingest_live.nxnx_ws_ingest_run.nxnx_ws_setstate.nx

structs

none

consts

28const WSI_MAGIC_1048576: i64 = 1048576
29const WSI_MAGIC_1024: i64 = 1024
31const WSI_CAP: i64 = 8192 // max project-*.md records (426 today; ample headroom)
32const WSI_FRESH_SEC: i64 = 432000 // 5 days: a file touched within this window -> state ACTIVE

functions

35func wsi_has_prefix(s: *u8, pre: *u8) -> i64
called by 1: wsi_id_from_name
42func wsi_id_eq(a: *u8, b: *u8) -> i64
called by 1: wsi_stage_records
50func wsi_setstr(out: *u8, s: *u8) -> i64
called by 1: wsi_empire_for
58func wsi_id_from_name(name: *u8, out: *u8) -> i64
72func wsi_contains(s: *u8, pat: *u8) -> i64
called by 1: wsi_empire_for calls 2: wme_lenwme_find
81func wsi_empire_for(id: *u8, out: *u8) -> i64
called by 1: wsi_reg_one calls 2: wsi_containswsi_setstr
147func wsi_build_record(id: *u8, empire: *u8, state: *u8, mtime: i64, memlink: *u8, out: *u8) -> i64
called by 2: wsi_reg_onemain calls 2: wme_catwme_catn
167func wsi_build_key(id: *u8, out: *u8) -> i64
179func wsi_streq_h(h: *i64, key: *u8, val: *u8) -> i64
193func wsi_merge_ids(h: *i64, ids: *i64, nids: i64, out: *u8) -> i64
218func wsi_derive_ids(names: *i64, cnt: i64, ids_out: *i64) -> i64
233func wsi_reg_one(h: *i64, w: *i64, id: *u8, name: *u8, mtime: i64, nowsec: i64, keybuf: *u8, recbuf: *u8, empbuf: *u8, out4: *i64) -> i64
247func wsi_stage_ids(h: *i64, w: *i64, ids: *i64, cnt: i64) -> i64
256func wsi_stage_records(h: *i64, w: *i64, names: *i64, mtimes: *i64, ids: *i64, cnt: i64, nowsec: i64, omit: *u8, out4: *i64) -> i64
279func wsi_ingest_omit_p(prefix: *u8, memdir: *u8, omit: *u8, out4: *i64) -> i64
303func wsi_ingest(memdir: *u8, out4: *i64) -> i64
called by 2: mainmain calls 1: wsi_ingest_omit_p