Remove _diff marker: use self-describing jay_diff protocol
Server (network.py): send every record in diff mode starting from
prev={}, including the first — fixes history drop on new client connect.
Collect (collect.py): remove payload["_diff"] = True from live broadcast.
GUI client (gui_client.py): always call jay_merge_full in diff mode;
drop the _diff key check that gated reconstruction.
CLI client (client.py): fix `args.diff or True` guard that made --diff
irrelevant.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-8
@@ -31,16 +31,12 @@ def _accept_loop(
|
||||
records = in_mem
|
||||
|
||||
try:
|
||||
if store_ref.get("diff_mode") and len(records) > 1:
|
||||
lines = [json.dumps(records[0], default=str) + "\n"]
|
||||
prev = records[0]
|
||||
for record in records[1:]:
|
||||
if store_ref.get("diff_mode"):
|
||||
prev: dict = {}
|
||||
for record in records:
|
||||
diff = jay_diff_full(prev, record, combine_upd_add=True)
|
||||
diff["_diff"] = True
|
||||
lines.append(json.dumps(diff, default=str) + "\n")
|
||||
prev = record
|
||||
for line in lines:
|
||||
conn.sendall(line.encode())
|
||||
conn.sendall((json.dumps(diff, default=str) + "\n").encode())
|
||||
else:
|
||||
for record in records:
|
||||
conn.sendall((json.dumps(record, default=str) + "\n").encode())
|
||||
|
||||
Reference in New Issue
Block a user