yrby 0.2.3-x86_64-linux → 0.3.0-x86_64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5adb084218ebd515a711af9d4ad2b051397a11f233335665d43f7a92a9e43105
4
- data.tar.gz: ab5215dd6b731b05fa9524f39c1f6d71920c737ac87dc0e6ff1948a42bdb71c0
3
+ metadata.gz: 1c679e136a706fb345dedc22c7b3e9da97919a16c827dc67fe0a5e06ab0ed414
4
+ data.tar.gz: df08be53339b8a833474f3ecd8234838e1aad5dd178fd1ae419d44adaf29637c
5
5
  SHA512:
6
- metadata.gz: dcaf9f9d47d3850e417c2d9a8be15a429bf6c994c57b40941a4b43c1bb66b3254d83b31d8165fadd2c6068386c6cac927f2c205801059126e5dae06c05eef235
7
- data.tar.gz: 10d81ed6a00d6fec909eaf31f26a3a8bc8fe6097a199b37897cddebddf590e05e0aa6dc357c959a30ada68d1aa15110872b4fbbb07d9c034c5373caf7be880e1
6
+ metadata.gz: '0903a87fcf089ec17d8aafbe0feb39fdd05b1068ae85540167434c818b2542a8b4f252115fd79f3f3d01a1ac63ee1a0a54eabd28172600538154f195e330cb04'
7
+ data.tar.gz: 4f349abd4f2f62f662d8c988489a9a5b9b79892e5f78ce5790a4e0638217e4262b3c69d39d390c2f4d34bcf1b5a9ee981520ad178cd7b81c820ff08e7771fdc6
data/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ to follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.0] - 2026-07-01
10
+
11
+ ### Fixed
12
+
13
+ - **Sync no longer serves un-integrable pending structs.** When a doc holds a
14
+ *pending* struct (a gappy update whose causally-prior update is missing — e.g.
15
+ legacy data recorded before the `update_ready?` gate existed), its integrated
16
+ state vector is empty but `encode_state_as_update` merges the pending bytes back
17
+ in. Answering a peer's `SyncStep1` with that state handed the peer content it
18
+ couldn't integrate, so it parked the same pending forever and the empty-SV /
19
+ non-empty-content mismatch drove endless resync traffic (observed as a browser
20
+ re-sending frames several times a second). `handle_sync_message` now answers
21
+ `SyncStep1` with **integrated-only** state, so a server never serves a struct it
22
+ can't integrate itself. Neutralizes existing poisoned server state on deploy —
23
+ no migration needed. The server's own pending is untouched and still heals if
24
+ the missing dependency later arrives (only then does the content become
25
+ visible in sync). Live delta relay (`Update` frames) is unchanged.
26
+
27
+ ### Added
28
+
29
+ - `Doc#pending?` — true if the doc holds un-integrable pending structs or a
30
+ pending delete set (content waiting on a missing causally-prior update).
31
+ - `Doc#compacted_state_update` — like `encode_state_as_update` (full state) but
32
+ **gap-free**: excludes pending structs/delete set. Use it when persisting or
33
+ serving state other peers will apply. Non-destructive — the doc keeps its
34
+ pending (so it can still heal), and `encode_state_as_update` stays lossless for
35
+ raw-update recovery.
36
+
9
37
  ## [0.2.3] - 2026-07-01
10
38
 
11
39
  ### Fixed
data/README.md CHANGED
@@ -142,18 +142,39 @@ doc = Y::Doc.new(12345) # specific client ID (used for CRDT identity)
142
142
 
143
143
  # Encoding
144
144
  doc.encode_state_vector # => current state vector
145
- doc.encode_state_as_update # => full update
145
+ doc.encode_state_as_update # => full update (lossless: keeps pending)
146
146
  doc.encode_state_as_update(sv) # => update diff against state vector
147
+ doc.compacted_state_update # => full update, gap-free (excludes pending)
147
148
 
148
149
  # Applying updates
149
150
  doc.apply_update(update_bytes) # apply raw V1 update
151
+ doc.pending? # => true if holding un-integrable pending structs
150
152
 
151
153
  # Sync protocol
152
154
  doc.sync_step1 # => SyncStep1 message (this doc's state vector)
153
155
  doc.handle_sync_message(data) # => [msg_type, sync_type, response]; answers a
154
- # peer's SyncStep1 with a SyncStep2
156
+ # peer's SyncStep1 with an integrated-only
157
+ # SyncStep2 (never serves pending structs)
155
158
  ```
156
159
 
160
+ ### Pending structs and gap-free state
161
+
162
+ If a doc applies an update whose causally-prior update is missing (a "gappy"
163
+ update), yrs parks it as a **pending** struct: the integrated state vector stays
164
+ empty, but the pending block is held as a recovery buffer and heals if the
165
+ missing dependency later arrives. `Doc#pending?` reports this.
166
+
167
+ Pending structs are *not* document state, so they must not cross the sync
168
+ boundary — a peer that receives one can't integrate it and gets stuck. Two
169
+ guarantees keep serving safe:
170
+
171
+ - `handle_sync_message` answers `SyncStep1` with **integrated-only** state, so a
172
+ server never serves a struct it can't integrate itself (this is automatic).
173
+ - `Doc#compacted_state_update` gives you the same gap-free full-state update for
174
+ when you persist or hand off state yourself. It's non-destructive (the doc
175
+ keeps its pending), while `encode_state_as_update` stays lossless so you can
176
+ still preserve the raw pending bytes for recovery.
177
+
157
178
  ### Protocol codec (module functions)
158
179
 
159
180
  Classifying and unwrapping wire frames is stateless, so it's exposed as
data/lib/y/3.4/yrby.so CHANGED
Binary file
data/lib/y/4.0/yrby.so CHANGED
Binary file
data/lib/y/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Y
4
- VERSION = "0.2.3"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yrby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - JP Camara