Skip to content

chore(zero): remove ast from downstream query patch messages [cust-queries] #4392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tantaman
Copy link
Contributor

  1. It is extra information that does not need to be sent
  2. Custom queries will not send their AST to the client

@tantaman tantaman requested review from grgbkr and darkgnotic May 16, 2025 17:01
Copy link

vercel bot commented May 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
replicache-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2025 11:19pm
zbugs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2025 11:19pm

Copy link

github-actions bot commented May 16, 2025

🐰 Bencher Report

Branchmlaw/no-ast-patch
TestbedLinux
Click to view all benchmark results
BenchmarkFile SizeBenchmark Result
kilobytes (KB)
(Result Δ%)
Upper Boundary
kilobytes (KB)
(Limit %)
zero-package.tgz📈 view plot
🚷 view threshold
1,165.06 KB
(-0.02%)Baseline: 1,165.28 KB
1,188.59 KB
(98.02%)
zero.js📈 view plot
🚷 view threshold
193.86 KB
(+0.01%)Baseline: 193.84 KB
197.72 KB
(98.05%)
zero.js.br📈 view plot
🚷 view threshold
54.45 KB
(+0.06%)Baseline: 54.42 KB
55.51 KB
(98.10%)
🐰 View full continuous benchmarking report in Bencher

Copy link

github-actions bot commented May 16, 2025

🐰 Bencher Report

Branchmlaw/no-ast-patch
TestbedLinux
Click to view all benchmark results
BenchmarkThroughputBenchmark Result
operations / second (ops/s)
(Result Δ%)
Lower Boundary
operations / second (ops/s)
(Limit %)
src/client/custom.bench.ts > big schema📈 view plot
🚷 view threshold
321,482.58 ops/s
(+15.80%)Baseline: 277,611.56 ops/s
104,489.26 ops/s
(32.50%)
src/client/zero.bench.ts > basics > All 1000 rows x 10 columns (numbers)📈 view plot
🚷 view threshold
1,549.83 ops/s
(+20.47%)Baseline: 1,286.53 ops/s
513.54 ops/s
(33.14%)
src/client/zero.bench.ts > pk compare > pk = N📈 view plot
🚷 view threshold
31,133.77 ops/s
(+22.88%)Baseline: 25,336.37 ops/s
11,796.50 ops/s
(37.89%)
src/client/zero.bench.ts > with filter > Lower rows 500 x 10 columns (numbers)📈 view plot
🚷 view threshold
2,508.00 ops/s
(+23.81%)Baseline: 2,025.71 ops/s
793.89 ops/s
(31.65%)
🐰 View full continuous benchmarking report in Bencher

@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from e160127 to fa70c57 Compare May 16, 2025 18:07
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from fa70c57 to 6219c2e Compare May 16, 2025 18:13
@tantaman tantaman marked this pull request as draft May 16, 2025 18:13
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch 2 times, most recently from 88f5a0d to 9c3cddf Compare May 16, 2025 18:25
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from 9c3cddf to 623fd14 Compare May 16, 2025 18:38
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from 623fd14 to abb3a51 Compare May 16, 2025 18:40
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from abb3a51 to 7181f3e Compare May 16, 2025 18:41
@tantaman tantaman marked this pull request as ready for review May 16, 2025 18:42
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from 7181f3e to 116788c Compare May 16, 2025 18:42
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from 116788c to 2758668 Compare May 16, 2025 19:04
@tantaman tantaman force-pushed the mlaw/no-ast-patch branch from 2758668 to fe1efe8 Compare May 16, 2025 19:05
1. It is extra information that does not need to be sent
2. Custom queries will not send their AST to the client
@@ -4,10 +4,13 @@ import {astSchema} from './ast.ts';
export const putOpSchema = v.object({
op: v.literal('put'),
hash: v.string(),
ast: astSchema,
Copy link
Contributor

@darkgnotic darkgnotic May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tricky one. We're bumping the PROTOCOL_VERSION (which is correct), but not the MIN_SERVER_SUPPORTED_PROTOCOL_VERSION, which means the server will still accept connections from old clients (that expect the ast field), and for them the server will return a response that fails to parse on the client side. (I think ... we should be parsing with strict rather than passthrough for the wire protocol, to be extra safe)

Best thing to do would be to make ast optional, with a comment that it's deprecated, and when we later bump the MIN_SERVER_SUPPORTED_PROTOCOL_VERSION to 17, then we can delete the field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, to clarify, we should not bump the MIN_SERVER_SUPPORTED_PROTOCOL in this change as that would result in a period of time in which the new server cannot talk to any old clients.

Copy link
Contributor

@darkgnotic darkgnotic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay. Thank you for cleaning this up. This simplifies and clarifies the protocol a lot. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants