flatsql 2.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -64
  3. package/dist/artifacts/index.d.ts +1 -3
  4. package/dist/artifacts/index.d.ts.map +1 -1
  5. package/dist/artifacts/index.js +1 -3
  6. package/dist/artifacts/index.js.map +1 -1
  7. package/dist/response/artifact.d.ts +1 -2
  8. package/dist/response/artifact.d.ts.map +1 -1
  9. package/dist/response/artifact.js.map +1 -1
  10. package/dist/response/types.d.ts +6 -0
  11. package/dist/response/types.d.ts.map +1 -1
  12. package/dist/stress/index.d.ts +0 -1
  13. package/dist/stress/index.d.ts.map +1 -1
  14. package/dist/stress/index.js +0 -1
  15. package/dist/stress/index.js.map +1 -1
  16. package/dist/stress/native-publish-event-workload.d.ts.map +1 -1
  17. package/dist/stress/native-publish-event-workload.js +14 -4
  18. package/dist/stress/native-publish-event-workload.js.map +1 -1
  19. package/dist/stress/smoke-runner.d.ts.map +1 -1
  20. package/dist/stress/smoke-runner.js +6 -5
  21. package/dist/stress/smoke-runner.js.map +1 -1
  22. package/docs/PARTITION-STORE-WASM.md +262 -0
  23. package/docs/PARTITION-STORE.md +980 -0
  24. package/package.json +61 -22
  25. package/wasm/flatsql-io.js +4 -1
  26. package/wasm/flatsql-ps-threads.wasm +0 -0
  27. package/wasm/flatsql-wasi-noeh.wasm +0 -0
  28. package/wasm/flatsql-wasi.wasm +0 -0
  29. package/wasm/flatsql.js +1 -1
  30. package/wasm/flatsql.wasm +0 -0
  31. package/wasm/index.d.ts +2 -0
  32. package/wasm/index.js +16 -1
  33. package/wasm/integrity.json +28 -0
  34. package/wasm/ps-node-fault.d.mts +23 -0
  35. package/wasm/ps-node-fault.mjs +381 -0
  36. package/wasm/ps-node-guest.mjs +156 -0
  37. package/wasm/ps-node-host.d.mts +86 -0
  38. package/wasm/ps-node-host.mjs +431 -0
  39. package/wasm/ps-node-imports.mjs +847 -0
  40. package/wasm/ps.d.ts +21 -0
  41. package/wasm/ps.js +75 -0
  42. package/dist/artifacts/builder.d.ts +0 -31
  43. package/dist/artifacts/builder.d.ts.map +0 -1
  44. package/dist/artifacts/builder.js +0 -514
  45. package/dist/artifacts/builder.js.map +0 -1
  46. package/dist/artifacts/demo-extractors.d.ts +0 -15
  47. package/dist/artifacts/demo-extractors.d.ts.map +0 -1
  48. package/dist/artifacts/demo-extractors.js +0 -238
  49. package/dist/artifacts/demo-extractors.js.map +0 -1
  50. package/dist/artifacts/standalone-builder.d.ts +0 -62
  51. package/dist/artifacts/standalone-builder.d.ts.map +0 -1
  52. package/dist/artifacts/standalone-builder.js +0 -144
  53. package/dist/artifacts/standalone-builder.js.map +0 -1
  54. package/dist/artifacts/worker-client.d.ts +0 -32
  55. package/dist/artifacts/worker-client.d.ts.map +0 -1
  56. package/dist/artifacts/worker-client.js +0 -415
  57. package/dist/artifacts/worker-client.js.map +0 -1
  58. package/dist/core/database.d.ts +0 -86
  59. package/dist/core/database.d.ts.map +0 -1
  60. package/dist/core/database.js +0 -900
  61. package/dist/core/database.js.map +0 -1
  62. package/dist/core/index.d.ts +0 -3
  63. package/dist/core/index.d.ts.map +0 -1
  64. package/dist/core/index.js +0 -3
  65. package/dist/core/index.js.map +0 -1
  66. package/dist/core/table-store.d.ts +0 -30
  67. package/dist/core/table-store.d.ts.map +0 -1
  68. package/dist/core/table-store.js +0 -187
  69. package/dist/core/table-store.js.map +0 -1
  70. package/dist/flatbuffer-accessor.d.ts +0 -35
  71. package/dist/flatbuffer-accessor.d.ts.map +0 -1
  72. package/dist/flatbuffer-accessor.js +0 -114
  73. package/dist/flatbuffer-accessor.js.map +0 -1
  74. package/dist/index.d.ts +0 -15
  75. package/dist/index.d.ts.map +0 -1
  76. package/dist/index.js +0 -22
  77. package/dist/index.js.map +0 -1
  78. package/dist/stress/publish-event-workload.d.ts +0 -3
  79. package/dist/stress/publish-event-workload.d.ts.map +0 -1
  80. package/dist/stress/publish-event-workload.js +0 -467
  81. package/dist/stress/publish-event-workload.js.map +0 -1
  82. package/wasm/flatsql-artifact.worker.js +0 -847
  83. package/wasm/standalone.d.ts +0 -122
  84. package/wasm/standalone.js +0 -914
@@ -0,0 +1,262 @@
1
+ # FlatSQL partition store: the wasm artifact and the Node host (T4)
2
+
3
+ The partition store engine (docs/PARTITION-STORE.md, T1 and T2) built as one
4
+ `wasm32-wasip1-threads` artifact, `wasm/flatsql-ps-threads.wasm`, and the
5
+ Node host that runs it and the engine's test suites with real threads. The
6
+ design is the stack's `docs/architecture/flatsql-partition-store.md`: §5.5,
7
+ §5.6, §18 T4 and the §22 amendments naming T4 (A1, A34, 22.3a-6/7). This file
8
+ records what was built, how to run it, the measured acceptance, and every
9
+ departure from the design.
10
+
11
+ ## 1. The artifact
12
+
13
+ | | |
14
+ |---|---|
15
+ | Build | `bash scripts/build-wasm.sh --ps` (artifact) or `--ps-tests` (plus the test commands). CMake: `cpp/cmake/wasi-threads-toolchain.cmake` and `cpp/cmake/flatsql_ps_wasm.cmake`, included from `cpp/CMakeLists.txt` only under the WASI toolchain. Engine and test sources are globbed (`src/ps/*.cpp`, `test/ps/*_test.cpp`), so files other tasks add build here unchanged. |
16
+ | Toolchain | wasi-sdk 30.0 (clang 21.1.4), target `wasm32-wasip1-threads`, `-pthread -matomics -mbulk-memory -fno-exceptions`, Release (`-O3 -DNDEBUG`), `-ffile-prefix-map` for the source, flatbuffers and SDK paths, `--strip-debug`. The build script refuses any other wasi-sdk version. |
17
+ | Bytes | The released artifact is the Linux wasi-sdk 30 build: Linux arm64 (Docker) and the x86_64 CI runner produce the same sha256 from different checkout paths. The macOS wasi-sdk 30 tarball ships a different sysroot (libc, libc++), compiler-rt and clang build and links different (equivalent) bytes; on macOS `bash scripts/build-wasm.sh --ps --linux` builds the released bytes in Docker (the Linux tarball, sha256-pinned). `npm-publish.yml` rebuilds and refuses to publish unless the build equals the committed file; CI warns when it differs. `wasm/integrity.json` holds the sha256, sha384 SRI and size of every shipped wasm (`scripts/write-integrity.mjs`, `npm run check:integrity`). |
18
+ | Shape | A reactor (`-mexec-model=reactor`). A host instantiates one instance per writer or reader instance; every guest thread is a new instance of the same module over the same shared memory. |
19
+ | Imports | `wasi_snapshot_preview1`: `clock_time_get fd_close fd_prestat_dir_name fd_prestat_get fd_seek fd_write proc_exit random_get sched_yield` (all provided by the SDK's browser and Node pool hosts); `wasi.thread-spawn`; `env.memory` (shared, 512 initial, 32768 maximum pages); the seven `env.flatsql_io_*`. Nothing else: `scripts/check-wasm-imports.mjs` and `test/standalone-wasm-imports.test.ts` fail on any change. |
20
+ | Exports | `flatsql_ps_init start stop pump wake layout reader_layout stats register_type register_partition ring` (docs/PARTITION-STORE.md §6), `flatsql_ps_alloc`/`flatsql_ps_free` (host-owned buffers for config TLVs and paths), `wasi_thread_start`, `_initialize`, `memory`. |
21
+ | SQLite | The lanes' SQL layer (ruling 1): `SQLITE_THREADSAFE=2`, `DEFAULT_MEMSTATUS=0`, `OMIT_WAL`, `TEMP_STORE=3`, `SQLITE_OS_OTHER`. No unix VFS (it would import WASI file calls): `src/ps/capi_wasm.cpp` registers a default VFS that opens no file, and installs pthread mutexes, because `SQLITE_OS_OTHER` compiles only no-op ones. The lanes open `:memory:` on `flatsql_ps_null` as natively. |
22
+ | Threads | `std::thread` defaults to 1 MiB stacks (wasi-libc's default is 128 KiB and a shadow stack has no guard page); lanes set their own (`ReaderConfig::stackBytes`). `sleepNs` is a timed `memory.atomic.wait32`, so the artifact never imports `poll_oneoff`. |
23
+ | Guard | `assertPthreadArtifact` (space-data-module-sdk 0.8.24) passes: shared memory, 1,636 atomic instructions, the wasi-threads contract, no emscripten thread hooks. |
24
+
25
+ ### Host obligations
26
+
27
+ - Create `env.memory` shared, with a maximum no larger than the import's
28
+ (browser writer 256 MiB, reader 128 MiB, design §5.5).
29
+ - Grow the heap before `flatsql_ps_start` when threads will allocate (alloc
30
+ then free a large block through `flatsql_ps_alloc`/`flatsql_ps_free`): V8
31
+ (Node 20–25, and browsers) refreshes each thread's view of a shared memory's
32
+ size lazily, so a thread touching memory another thread has just grown can
33
+ trap. WasmEdge is not affected.
34
+ - Give every guest thread a distinct `tid` below 2^29 (wasi-libc keeps it in
35
+ mutex words).
36
+
37
+ ## 2. The Node host (design §5.6)
38
+
39
+ `wasm/ps-node-host.mjs` (types `ps-node-host.d.mts`), with
40
+ `ps-node-guest.mjs`, `ps-node-imports.mjs` and `ps-node-fault.mjs`. Node 24+,
41
+ optional peer dependency `space-data-module-sdk` ≥ 0.8.24.
42
+
43
+ - **Supervisor.** The main thread never runs guest code. The guest's own
44
+ thread (`_start` for a command, the exec thread for a reactor instance) is a
45
+ worker; so is every guest thread.
46
+ - **wasi.thread-spawn** claims a pre-started worker from a pool the supervisor
47
+ keeps (16 warm, grown on demand to a cap of 512). The claim is a CAS on the
48
+ pool's SharedArrayBuffer and needs no event loop, so any guest thread can
49
+ spawn, and workers are reused: a crash harness that starts and stops engines
50
+ 12,000 times runs on 17 workers. Tids come from one shared counter.
51
+ - **flatsql_io** is the SDK's Node sync-fs provider (`createNodeSyncFsIo`: a
52
+ virtual-handle table in a SharedArrayBuffer, lazily opened fds per worker,
53
+ `fdatasync`/`F_FULLFSYNC`, `CREATE_PARENTS`, `UNLINK_IF_UNUSED`, A23
54
+ revocation) over the host root.
55
+ - **WASI preview1** is the host's own: a descriptor table in a
56
+ SharedArrayBuffer (a descriptor opened on one thread works on all, as in a
57
+ process), preopens, process-wide clocks (`process.hrtime`; a worker's
58
+ `performance.now()` has its own origin, which would break the engine's
59
+ cross-thread time comparisons), seeded `random_get` in deterministic mode,
60
+ `poll_oneoff` clock waits, `proc_exit` from any thread ending the guest.
61
+ - **File system.** `root` is the guest's "/" for WASI and for flatsql_io;
62
+ `mounts` preopen more host directories (the CLI mounts the checkout at its
63
+ own path so the test commands find their vectors). Default: a private
64
+ temporary root, removed afterwards.
65
+ - **Faults.** A guest thread that traps writes the trap to stderr from its own
66
+ worker and sets a shared fault word; the supervisor ends the run (the thread
67
+ that would join the dead one may be blocked forever).
68
+ - **API.** `runPsCommand(wasm, options)` (commands: exit code, kill, timeout,
69
+ thread report); `createPsNodeInstance(wasm, options)` (one artifact instance:
70
+ `call`, `write`, `read`, `threads`, `close`); CLI `node wasm/ps-node-host.mjs
71
+ <command.wasm> [args]`.
72
+
73
+ ### Fault overlay (§19, 22.3a-7)
74
+
75
+ `wasm/ps-node-fault.mjs`: a SharedArrayBuffer page table every worker
76
+ consults, interposed under the SDK provider's syscalls. It records the
77
+ pre-image of every 4 KiB page written since the file's last sync (pages wholly
78
+ past the synced size need none), the synced size, and files created since
79
+ their parent directory's last sync. The supervisor freezes it (later mutating
80
+ calls fail with EIO), stops the guest, and applies a crash: `dropAll` (every
81
+ unsynced page and size change undone, unsynced directory entries gone),
82
+ `pageSubset` (each unsynced page survives or not, in any order; the size is
83
+ the synced or the current one), `keepAll` (kill -9). Overflowing its page
84
+ budget fails the crash instead of making it partial.
85
+
86
+ ## 3. Test commands
87
+
88
+ | Command | Contents |
89
+ |---|---|
90
+ | `cpp/build-ps-wasm/flatsql-ps-test.wasm` | `flatsql_ps_test` (every test in `cpp/test/ps`) as a wasi-threads command; host I/O through the seven imports. `--list` prints the tests. |
91
+ | `cpp/build-ps-wasm/flatsql-ps-test-memio.wasm` | The same command with the seven functions defined in the guest (`test/ps/wasm_io_stub.cpp`, all ACCESS): imports only WASI, thread-spawn and memory, so a WASI-only host (the SDK WasmEdge C runner) runs every in-memory test. |
92
+
93
+ Added tests (`PS_SLOW_TEST`, run only when named): `parity_canonical_dump`,
94
+ `parity_deterministic_bytes` (`cpp/test/ps/parity_test.cpp`) and
95
+ `host_crash_ingest` / `host_crash_verify` (`host_crash_test.cpp`). The wasm
96
+ test main grows the heap by 1,536 MiB before any thread starts
97
+ (`PS_WASM_HEAP_MB`).
98
+
99
+ ```
100
+ npm run build:wasm:ps-tests # artifact + test commands
101
+ node wasm/ps-node-host.mjs cpp/build-ps-wasm/flatsql-ps-test.wasm --test=lane_
102
+ npm run test:ps-wasm # scripts/ps-wasm-suite.mjs: every default test + 1,000 crashes
103
+ FLATSQL_PS_WASM_SUITE=1 npm test -- test/ps-node-threads.test.ts
104
+ npm test -- test/ps-host-fault.test.ts test/ps-parity-vectors.test.ts
105
+ FLATSQL_PS_WASMEDGE=1 npm test -- test/ps-parity-vectors.test.ts # + the C runner lane
106
+ ```
107
+
108
+ ## 4. Acceptance (§18 T4 as amended)
109
+
110
+ Machine: the owner's Mac Studio (Darwin 25.3.0, arm64, 28 hardware threads,
111
+ APFS), Node 25.4.0, shared with other lanes: 1-minute load average 18–25
112
+ during these runs (37–41 for the release rerun, §4.2). Native builds
113
+ RelWithDebInfo; wasm builds as §1.
114
+
115
+ | # | Acceptance | Result |
116
+ |---|---|---|
117
+ | 1 | Imports exactly WASI p1 + `wasi.thread-spawn` + shared `env.memory` (≤ 32768 pages) + the 7 `env.flatsql_io_*`; exports `wasi_thread_start`; 0 emscripten imports; passes `assertPthreadArtifact` | **Pass.** §1 table; `scripts/check-wasm-imports.mjs`, `test/standalone-wasm-imports.test.ts` (the SDK guard runs in a child process). |
118
+ | 2 | The T1 and T2 suites, including 1,000 fault crashes, pass under the Node host with distinct OS thread ids ≥ writers + lanes | **Pass.** `scripts/ps-wasm-suite.mjs`: all 53 default-suite tests, each in its own guest process, plus `crash_faults_T1_1 --crash-trials=1000` (1,000 trials over the five modes, 298,923 acked records verified, 41.8 s). `readers_under_saturating_writers_T2_1` (8 writers, 16 lanes) ran 54 guest threads at once on 54 distinct worker (OS) threads. `test/ps-node-threads.test.ts`: the shipped artifact as a writer instance (4 writers) and a reader instance (4 lanes), each running thread on its own worker. `writer_backpressure_flood_T1_5` runs with `--bp-samples=40` (deviation 3). `crash_faults_T1_1_full` (10,000 trials, 64 types, 256 partitions): §4.1. |
119
+ | 3 | Parity: canonical dumps (by (pid, pseq)) and query results identical native vs Node; deterministic mode byte-identical across native, Node and the SDK WasmEdge C runner (patched 0.16.4) | **Pass.** Canonical dump, 4 writers, 11,313 lines (rows, counters, lane counters and six queries, partition and type level): sha256 `f3b419a2…` natively and under Node, three runs each. Deterministic mode, 122 files: in memory `e7ab8592…` natively, under Node and under the C runner (18.7 s, interpreted); on the host's files `c7e34c55…` natively and under Node. `test/ps-parity-vectors.test.ts`. |
120
+ | 4 | A published npm version with provenance; the wasm sha256 in `integrity.json`; `npm ls sql.js` empty; the package root exports only the wasm bindings | **Pass.** `flatsql@3.0.0`, §4.2 and §6. |
121
+
122
+ Host-level crashes (the overlay, §2): `test/ps-host-fault.test.ts` kills the
123
+ guest mid-ingest at a random 0.4–2.0 s, crashes the store in the three modes
124
+ in turn and verifies every acked record (bytes by CID), gap-free pseqs,
125
+ counters and 0 `d-*` bytes read at open; 9 cycles, half of them with the A8
126
+ journal. A negative control (half a data segment cut off) fails the verifier.
127
+
128
+ ### 4.1 Slow runs
129
+
130
+ - `crash_faults_T1_1_full` under the Node host (10,000 trials, 64 types, 256
131
+ partitions, the five crash modes, an A4 second crash every other trial, half
132
+ the stores journaled): pass in 377 s; 2,122,844 acked records verified,
133
+ 410,159 merges, 1,167,880 journal records replayed, 125,016 guest threads
134
+ spawned on 10 pooled workers. Mac, load 24 rising to 35 during the run
135
+ (natively 243 s).
136
+ - The whole default suite under the host, one guest process per test:
137
+ 155 s of test time; the most concurrent guest threads was 54
138
+ (`readers_under_saturating_writers_T2_1`), each on its own worker thread;
139
+ the largest guest memory 1,902 MiB (the 1,536 MiB pre-grown heap included).
140
+ - Deterministic vector under the C runner: 18.7 s interpreted (0.12 s natively).
141
+
142
+ ### 4.2 Release
143
+
144
+ - `flatsql@3.0.0`, published by `npm-publish.yml` from tag `v3.0.0` =
145
+ `79fd694` (run 36486543061) with a signed provenance statement
146
+ (`npm audit signatures`: verified attestation); `gitHead` 79fd694, dist-tag
147
+ `latest`, `dependencies` `{}`.
148
+ - `wasm/flatsql-ps-threads.wasm`: 2,074,707 bytes, sha256
149
+ `572a4bc38345d07ff91c345fc8d81e28873d72efa0fb8864a2edc5242145f9f5`, the same
150
+ in `wasm/integrity.json`, from the Linux arm64 Docker build, the x86_64
151
+ publish runner and the installed tarball.
152
+ - A fresh `npm install flatsql@3.0.0`: `npm ls sql.js` is empty; the root's
153
+ exports equal `flatsql/wasm`'s; `loadFlatSQLPsThreads()` checks the bytes
154
+ against `integrity.json`.
155
+ - At the release sources (`dac8d89` engine), under the Node host: the 55
156
+ default-suite tests and `crash_faults_T1_1 --crash-trials=1000` pass (1,000
157
+ trials, 403,798 acked records verified, 47.3 s; load 37–41). Main CI green
158
+ on `79fd694` (run 36482613908).
159
+ - Two engine defects the Node host found before the release, fixed in the
160
+ sources the artifact builds: the open path dropped the lane checkpoint
161
+ pointer of a head with more than 32 live lanes (`5c7e769`; the 1,000-trial
162
+ crash run, trial 317), and the type owner never merged its L0 directory
163
+ when `mergeL0Blocks` exceeded the directory cap, so labeling, partition
164
+ merges and acks stopped (`dac8d89`).
165
+
166
+ ## 5. Design deviations
167
+
168
+ 1. **The Node host's thread spawn is its own pool, not the SDK's Node
169
+ branch** (§5.6: "The SDK's Node branch (lazy worker_threads) runs the guest
170
+ threads"). `createWasiThreadSpawn` (0.8.24) removes a finished worker only on
171
+ its `exit` event, which runs on the spawning thread's event loop; that
172
+ thread is inside the guest, blocked, for the whole command. After `poolSize`
173
+ spawns every later spawn is declined, and without a pool the finished
174
+ threads are never joined. The crash harness spawns more than 12,000 guest
175
+ threads per run. The host keeps a pool whose idle/assign handshake is a
176
+ SharedArrayBuffer CAS, so no event loop is involved and any thread can
177
+ spawn. Reported to the module-sdk lane (SDK 0.8.25); the SDK's Node sync-fs
178
+ flatsql_io provider is used as designed.
179
+ 2. **WASI is the host's own**, not the SDK shim: the shim keeps descriptors
180
+ and clocks per worker (a worker's `performance.now()` has its own origin),
181
+ has no preopens and no `poll_oneoff`. The artifact itself imports only names
182
+ the SDK shim provides (§1), so browser hosts are unaffected.
183
+ 3. **The flood test runs 40 samples under wasm32** (`--bp-samples=40`, default
184
+ 150): its in-memory host keeps every flooded byte twice for as long as the
185
+ timed measurement lasts (12 GB resident natively with 150 samples), past
186
+ wasm32's 4 GiB. Its ring, credit, pool and zero-loss checks are unchanged;
187
+ the ack-p99 ratio is reported (1.066) and, as on any box with fewer than 8
188
+ hardware threads, not enforced: WASI reports one CPU. The same holds for the
189
+ T2 latency bounds (`latencyBoxQuiet` is false under wasm): they are native
190
+ Linux-8 acceptance numbers. `lane_needs_bulk_under_1ms_zero_rows_T2_4`
191
+ enforced its 1 ms p99 on every machine; it now follows the same rule
192
+ (enforced on a quiet box, reported elsewhere) after a Debug build on the
193
+ loaded 3-vCPU macOS CI runner and the Node host on the Linux runner
194
+ measured past it. Its status, rows and examined counts are enforced
195
+ everywhere. `type_arrivals_segments_and_fence_A15` caps type commits at 40
196
+ rows: a slow type owner labeled more than 40 rows in one commit and filled
197
+ an empty arrivals segment past its 40-entry seal (a batch never splits
198
+ across segments), which failed on the macOS runner (main 8aea463) and
199
+ under the Node host.
200
+ 4. **The C runner lane runs the memio command.** The SDK's WasmEdge
201
+ wasi-threads C runner provides WASI and thread-spawn only, so the byte
202
+ vectors there use the in-memory host, which is also compared natively and
203
+ under Node; the host-file vector is compared natively and under Node.
204
+ Adding flatsql_io to the runner (as the SDN C host module does) is an SDK
205
+ change.
206
+ 5. **Parity inputs are built deterministically.** A fixture expression such
207
+ as `a + b * c` is contracted to a fused multiply-add on arm64 and not in
208
+ wasm, which changes the input bytes (1 ULP), not the engine's output; the
209
+ parity workload builds its frames from exact doubles. `buildRecordAttr`
210
+ (`src/ps/writer_pool.cpp`) creates its strings inside one call's argument
211
+ list, whose evaluation order C++ leaves unspecified: GCC on x86_64 builds
212
+ them in the opposite order from clang and from GCC on arm64, so the same
213
+ attributes serialize to different bytes (measured on the CI runner and under
214
+ x86_64 emulation). The parity workload builds its attributes in a fixed
215
+ order; the helper itself belongs to the writer files T3 holds (reported). The canonical dump masks
216
+ `kRowAttrInM` (where attributes are stored until a merge moves them, like
217
+ offsets) and injects the engine's wall clock (TOMB arrival times).
218
+ 6. **Deterministic mode injects both clocks in the guest** (`setTestClock`,
219
+ `src/ps/platform.cpp`): the store UUID hashes the monotonic clock, and a
220
+ frozen clock keeps every time-based trigger out of the byte stream. A host
221
+ running the artifact deterministically injects `clock_time_get` and
222
+ `random_get` instead (the Node host's `deterministic` option seeds
223
+ `random_get`).
224
+ 7. **A wasm32 defect fixed in the lane arena**: the 256 GiB request bound was
225
+ `size_t(1) << 38`, undefined where `size_t` is 32 bits; every lane
226
+ allocation failed and every lane died at `sqlite3_open`.
227
+
228
+ ## 6. Package 3.0.0 (A1, A34)
229
+
230
+ Semver-major (A34). The package root is the wasm bindings: `wasm/index.js`
231
+ (the SQLite engine, as `flatsql/wasm`) plus the partition store locator
232
+ (`getFlatSQLPsThreadsURL`, `loadFlatSQLPsThreads`,
233
+ `FLATSQL_PS_THREADS_SHA256`). New subpaths: `flatsql/ps-threads.wasm`,
234
+ `flatsql/ps/node-host`, `flatsql/ps/fault`, `flatsql/integrity.json`.
235
+
236
+ Removed (A1 ledger row T4):
237
+
238
+ | Removed | Replaced by |
239
+ |---|---|
240
+ | `src/core/` (the TS engine) and the root exports `FlatSQLDatabase`, `DirectAccessor`, `FlatcAccessor`, `TableStore` | the wasm engines |
241
+ | the `node:sqlite` artifact builder (`FlatSQLArtifactBuilder`, its worker) and the `flatsql/artifacts/standalone` builder | — |
242
+ | `wasm/standalone.js` and `flatsql/standalone` | `flatsql/ps/node-host` for the partition store. The legacy WASI engine's own tests keep a test-only copy (`test/support/legacy-standalone.js`, not shipped) until T8 retires that engine. |
243
+ | `sql.js`, and the npm `flatbuffers` package (its only user was the deleted TS workload) | — |
244
+
245
+ The BTree, stacked store, schema parser and cluster detection stay, as
246
+ `flatsql/btree`, `flatsql/storage`, `flatsql/schema` and `flatsql/cluster`.
247
+
248
+ **A1 parity check (the receipt).** A1 allows the deletion when each consumer's
249
+ suite passes on the new bindings or the consumer pins the last pre-T4 major.
250
+ Every consumer pins an earlier major, so none resolves 3.0.0:
251
+
252
+ | Consumer (stack pin) | flatsql |
253
+ |---|---|
254
+ | space-data-module-sdk 0.8.24 (450aa78; `src/runtime-host/flatsqlRuntimeStore.js`) | `^2.0.0` |
255
+ | OrbPro (216083d024; `packages/wasm-engine`, root) | `^1.4.4` |
256
+ | OrbPro `packages/space-data-module-sdk` 0.8.23 | `^2.0.0` |
257
+ | spacedatastandards.org 1.228.0 (cd86467de5; `test-flatsql*.js`) | `^1.3.0` |
258
+ | spacedatastandards `packages/standards-explorer` | `^0.3.9` |
259
+ | sdn-js 3.1.0 (space-data-network f20dbc35d) | `2.0.3` |
260
+
261
+ Moving each consumer to 3.x (or recording that it stays on 2.x) is a ripple
262
+ task per repository (A1, A34).