JS WAM persistent indexed fact stores (GP-LMDB) - #4211
Open
s243a wants to merge 5 commits into
Open
Conversation
Extend D27 CallFactStream with source(P/2, indexed(Prefix)) (zero-dep sorted key table) and source(P/2, lmdb(Dir)) (lazy npm lmdb, loud missing-package error, never a silent fallback). file(Path) emit is unchanged. Ship uw_fact_index / uw_fact_lmdb builders and document the on-disk format, key encoding, and optional-dependency policy. Co-authored-by: johns243a <johns243a@gmail.com>
lmdb-js treats a path with an extension as the data file; edges.lmdb as a directory then throws EISDIR. Both the loader and runtime now open an environment directory. Bound-lookup stats also record n_reads. Co-authored-by: johns243a <johns243a@gmail.com>
Co-authored-by: johns243a <johns243a@gmail.com>
sub_string(..., 12, ...) skipped the leading digit of 506, so the proof printed 6. Require bytes_read > 200 so a mis-parse cannot pass. Co-authored-by: johns243a <johns243a@gmail.com>
Co-authored-by: johns243a <johns243a@gmail.com>
s243a
marked this pull request as ready for review
September 1, 2026 20:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add persistent indexed P/2 fact stores for the JavaScript WAM, extending D27
CallFactStreamrather than forking it.Option syntax
source(P/2, file(Path))— D27 in-memory TSV/CSV/JSONL. Emit is unchanged ({ path }, nokind).source(P/2, indexed(Prefix))— backend B (default capability, zero deps). Files:Prefix.data+Prefix.idx.source(P/2, lmdb(Dir))— backend A (opt-inlmdbnpm package).Diris an LMDB environment directory (noSubdir: false, so names likeedges.lmdbstay directories).Unbound A1 enumerates in source-file order. Bound A1 is an indexed lookup. Other-args-bound filters streamed candidates. Cells go through
parse_term(D34/D37).Backend B
Sorted key table + binary search (
Buffer.compare). Build:node scripts/js_wam/uw_fact_index.js build <tsv|jsonl> <prefix>. Format spec is indocs/WAM_JAVASCRIPT_STATUS.md. This is LMDB-style (persistent + indexed + seek-based), not LMDB.Bound-lookup proof on the 5004-row fixture:
fact_io bytes_read=506 data_size=992872 n_reads=29.Backend A
Lazy
createRequire("lmdb")only when anlmdb(...)source is used. Missing package is one loud error (npm install lmdb); never falls back to B. Not a repopackage.jsondependency. The lmdb-gated tests ran in this environment (npm install --prefix /tmp/uw-lmdb-pkg lmdb).Shared-semantics: SWI
probekey → [alpha,beta]; Node backends B and A both printshared_ok/true.Tests
UW_LMDB_FORCE_MISSING=1).Out of scope
Multi-arg secondary indexes and write paths.
docs/WAM_FLEET_GAPS.mdis not edited; the JS status doc records that this target now has LMDB while the fleet doc still lists it as Lua-matching out-of-scope.