code wiki / _hdl_build / nx_ws_ingest.nx
nx_ws_ingest.nx
buildroot/runtime/_hdl_build/nx_ws_ingest.nx
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
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
| 28 | const WSI_MAGIC_1048576: i64 = 1048576 |
| 29 | const WSI_MAGIC_1024: i64 = 1024 |
| 31 | const WSI_CAP: i64 = 8192 // max project-*.md records (426 today; ample headroom) |
| 32 | const WSI_FRESH_SEC: i64 = 432000 // 5 days: a file touched within this window -> state ACTIVE |
functions
| 35 | func wsi_has_prefix(s: *u8, pre: *u8) -> i64 called by 1: wsi_id_from_name |
| 42 | func wsi_id_eq(a: *u8, b: *u8) -> i64 called by 1: wsi_stage_records |
| 50 | func wsi_setstr(out: *u8, s: *u8) -> i64 called by 1: wsi_empire_for |
| 58 | func wsi_id_from_name(name: *u8, out: *u8) -> i64 |
| 72 | func wsi_contains(s: *u8, pat: *u8) -> i64 |
| 81 | func wsi_empire_for(id: *u8, out: *u8) -> i64 |
| 147 | func wsi_build_record(id: *u8, empire: *u8, state: *u8, mtime: i64, memlink: *u8, out: *u8) -> i64 |
| 167 | func wsi_build_key(id: *u8, out: *u8) -> i64 |
| 179 | func wsi_streq_h(h: *i64, key: *u8, val: *u8) -> i64 |
| 193 | func wsi_merge_ids(h: *i64, ids: *i64, nids: i64, out: *u8) -> i64 |
| 218 | func wsi_derive_ids(names: *i64, cnt: i64, ids_out: *i64) -> i64 |
| 233 | func wsi_reg_one(h: *i64, w: *i64, id: *u8, name: *u8, mtime: i64, nowsec: i64, keybuf: *u8, recbuf: *u8, empbuf: *u8, out4: *i64) -> i64 called by 1: wsi_stage_records calls 5: wsi_empire_forwsi_build_keywsi_build_recordwsi_streq_hss_add |
| 247 | func wsi_stage_ids(h: *i64, w: *i64, ids: *i64, cnt: i64) -> i64 |
| 256 | func wsi_stage_records(h: *i64, w: *i64, names: *i64, mtimes: *i64, ids: *i64, cnt: i64, nowsec: i64, omit: *u8, out4: *i64) -> i64 |
| 279 | func wsi_ingest_omit_p(prefix: *u8, memdir: *u8, omit: *u8, out4: *i64) -> i64 called by 3: mainwsi_ingestmain calls 10: sys_mmapwme_scanwsi_derive_idssys_now_realtime_secss_openss_begin+4 |
| 303 | func wsi_ingest(memdir: *u8, out4: *i64) -> i64 |