@kedem/okdb 3.1.5 → 3.1.7

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,57 @@ All notable changes to `@kedem/okdb` are documented here. Format loosely follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
5
5
  Dates are release dates.
6
6
 
7
+ ## [3.1.7] - 2026-11-05
8
+
9
+ ### Fixed
10
+
11
+ - **A view bootstrap no longer holds the event loop for its whole duration.** 3.0 ran a view's build (`views.create()`, `rebuild()`,
12
+ `start()`, `resetView()` and the background rebuild of a view found unfinished at `open()` or on a views poke) inside one
13
+ native call: the 2.x worker thread and its awaits between batches were folded into one blocking scan. A `$ref` view over
14
+ ~10^5 parents pinned the process for minutes (store-oasis: a worker's loop watchdog killed it every time, and the rebuild
15
+ started over on the next boot). The build is now a step machine the env pump advances in ~20 ms slices
16
+ (`OKDB_VIEWS_BUILD_STEP_MS`). `views.create()` & co. still resolve once the view is ready, and `db._viewRebuildChain` (2.x)
17
+ settles when the background rebuilds are done. A background rebuild heartbeats its `view-rebuild:` lease every step and stops
18
+ if the lease was lost, instead of letting a peer take over and wipe the view under it after the 600 s TTL. Rust callers of
19
+ `Views::create` / `rebuild` keep the blocking form; `create_begin` / `rebuild_begin` queue the build.
20
+ - **A parent that leaves a `$ref` view, is deleted or changes bucket moves its children's grouped and sorted state too.**
21
+ The cascade that follows a parent's membership / bucket change moved only the children's scalar and item state: `$countBy` /
22
+ `$group` (per bucket and in total) and `$min` / `$max` ref state kept them where they were (store-oasis: a cancelled order's line
23
+ items kept counting in `byProduct` until a rebuild). A deleted parent of a sync bucketed view lost its children's bucket rows
24
+ while their totals stayed. The cascades now run the same per-child code as a child write. During a build they used to do
25
+ nothing (gated on `ready`) and the `$ref` section read parents as they are rather than as the view had applied them; both
26
+ are fixed, so parents moving mid-build are exact too. **Storage version 8**: views whose `$ref` has a grouped or `$min` /
27
+ `$max` reducer rebuild once on open (non-blocking, resumable); every other view is restamped.
28
+ - **An interrupted view build resumes instead of starting over.** Each build step commits a checkpoint (section and last applied
29
+ key) in the same transaction as the rows it covers, and the build pins the changelog at its start clock in `~proc:state`
30
+ (`view:<name>:build`) so GC keeps what the resumed replay reads. The next lease holder (the next `open()`, or a peer)
31
+ continues where the dead builder stopped; a builder generation fences a stale one that is still running. A build without a
32
+ checkpoint (a 2.x view, or no pin) still rebuilds from scratch, and a fresh build now wipes every derived sub-DB (prevDb,
33
+ `$ref` tracking and items included) instead of leaving them from the failed attempt.
34
+ - **A view no longer stays `partially-ready` forever after a crash in its tail replay or finalize.** Every section read ready, so
35
+ open treated it as built, while its live handlers were never registered and it skipped every write. Such a view (its
36
+ `bootstrapStartClock` still set) is now treated as an unfinished build. A peer no longer rewrites the meta of a view another
37
+ process is building (it used to flip it to `creating` before taking the lease).
38
+ - **A `$ref` child no longer rewrites a whole-map row per grouped reducer.** Every child doc decoded, rewrote and re-encoded a
39
+ map of all groups for each `$countBy` / `$group` ref reducer: a row nothing reads (grouped state lives in per-group rows), but
40
+ it made a `$ref` build O(children x groups). store-oasis `commerce` view, 6 000 line items: 48.8 s -> 0.7 s at 2 000
41
+ products, now independent of the product count. Output unchanged.
42
+ - **Writes during a `$ref` view bootstrap are counted exactly once.** The tail replay applied an update of an already-scanned
43
+ child with no old value (counted twice) and never updated the ref's per-group rows (`$countBy` / `$group` previews stayed
44
+ wrong until the next rebuild). The replay now runs the live ref handler with the value the build applied for that child, kept
45
+ in a per-section `bprev` sub-DB while the view builds. The same covers the primary section of sync views (an update of an
46
+ already-scanned doc was counted twice). Async primaries already had this through `prevDb`.
47
+
48
+ ## [3.1.6] - 2026-11-03
49
+
50
+ ### Fixed
51
+
52
+ - **A JS embedder's `Float32Array` vectors reach the core in one copy.** Every vector an embedder returned was turned into a
53
+ plain array and read back one number at a time (~0.2 ms for a 2560-dimension vector). A `Float32Array` is now handed over
54
+ as its bytes. Plain number arrays, a `Float64Array` or any other array-like are converted as before. Stored vectors, search
55
+ results and what happens to a wrong-length vector are unchanged. (As before, a vector holding `NaN` or a non-number is
56
+ stored, with `NaN` in it.)
57
+
7
58
  ## [3.1.5] - 2026-11-03
8
59
 
9
60
  ### Fixed