code wiki / (root) / nx_synthetic_upstream.nx

nx_synthetic_upstream.nx

buildroot/runtime/nx_synthetic_upstream.nx

11294 B330 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_synthetic_upstream.nx -- canned-response replay for adapter testing. module: nishi-core.ingest.synthetic_upstream depends: nishi-core.io.syscalls, nishi-core.io.iso8601, nishi-core.io.json, nishi-core.io.csv disk_kb: 6 capability: CORE_IO license_tier: PUBLIC_NISHI_SUBSTRATE genealogy_id: nock_mock_pattern_software_testing + wiremock_2011_http_stub_pattern + vcr_python_cassette_pattern + nishi_build_the_system_cardinal_2026 Per cardinal [[feedback-build-the-system-not-manual-output]]: this is THE SYSTEM that proves the ingestion substrate works. Replays CANNED HTTP responses from disk fixtures back to adapter code, so every adapter runs end-to-end (URL parse → "fetch" → JSON/CSV parse → canonicalize → license guard → JSONL emit) WITHOUT needing real network. Once this primitive ships, every NX-INGEST adapter shipped this arc gets exercised in a substrate-level smoke test that proves: - the URL builder produces the right query string - the canned response gets parsed correctly - the canonicalize step extracts the right fields - the license-tier viral propagation works - the JSONL emit shape matches expectations Substrate runs in CI without internet. Once nx_dns_resolve glue lands, the SAME adapter code (Cardinal 19) swaps the synthetic upstream for real nx_https_get with no caller change.

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_iso8601.nx nx_synthetic_upstream.nx nx_smoke_harness.nx

imports: nx_syscalls.nxnx_iso8601.nx

imported by: nx_smoke_harness.nx

structs

76struct SyntheticUpstream
157struct FixtureResponse

consts

45const NX_SU_OK: i64 = 1
46const NX_SU_FIXTURE_NOT_FOUND: i64 = 2
47const NX_SU_FIXTURE_PARSE_FAIL: i64 = 3
48const NX_SU_NO_RESPONSE_REGISTERED: i64 = 4
49const NX_SU_MULTIPLE_AMBIGUOUS: i64 = 5
91const NX_SU_BYTES: i64 = 80 // 10 fields * 8 bytes
118const NX_SU_FNV1A_OFFSET_BASIS: i64 = -3750763034362895579
119const NX_SU_FNV1A_PRIME: i64 = 1099511628211
171const NX_FIXTURE_RESPONSE_BYTES: i64 = 88 // 11 fields * 8 bytes
304const NX_SU_RECORD_MODE_OFF: i64 = 0 // pure replay
305const NX_SU_RECORD_MODE_NEW: i64 = 1 // record only if fixture missing
306const NX_SU_RECORD_MODE_ALL: i64 = 2 // overwrite existing fixtures
307const NX_SU_RECORD_MODE_NONE: i64 = 3 // never record (CI mode)

functions

51func nx_su_verdict_name(v: i64) -> *u8
93func nx_synthetic_upstream_new(
calls 1: sys_mmap
121func nx_su_request_hash(method_ptr: *u8, method_len: i64, url_ptr: *u8, url_len: i64) -> i64
177func nx_su_build_fixture_path(
245func nx_synthetic_upstream_serve(
309func nx_su_record_mode_name(m: i64) -> *u8
326func nx_synthetic_upstream_hit_rate_q10(u: *SyntheticUpstream) -> i64