Repository navigation
feat(zero-rust): inspector, query metrics, and slowMaterializeThreshold - #211
Merged
Merged
Conversation
tmm
force-pushed
the
feat/zero-rust-define
branch
from
November 14, 2026 12:36
43688aa to
7c2887f
Compare
tmm
force-pushed
the
feat/zero-rust-inspector
branch
from
November 14, 2026 12:36
862dc4a to
a73017e
Compare
tmm
force-pushed
the
feat/zero-rust-inspector
branch
from
November 14, 2026 13:52
a73017e to
02111df
Compare
Port @rocicorp/zero's inspector to the Rust client: Zero::inspector() lists the local clients and their queries, reads a client's map and rows, and runs the metrics, version, analyze-query, and authenticate RPCs over the socket's inspect messages. The client records JS's query metrics as TDigests (a port of shared/src/tdigest.ts), logs each query's end-to-end materialization against the new slow_materialize_threshold_ms, and ports astToZQL and formatPlannerEvents. Add JS-generated vectors for TDigest, astToZQL, and client inspector scenarios, and replay them in the Rust conformance runner.
…ectors The client scenario runner follows harness.ts: the logLevel option, the logs observation (the materialization messages Swift logs as one line, parsed back into JS's arguments), and inspect steps with the inspector observation and $inspect.<n> request IDs. client-inspector.json runs on memory and SQLite; tdigest.json and ast-to-zql.json (its unredacted code; Swift has no redactLiterals) replay in the primitive and AST suites.
tmm
force-pushed
the
feat/zero-rust-inspector
branch
from
November 14, 2026 14:47
02111df to
e2a0980
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decision 3, Rust half: JS's inspector, query metrics, and
slowMaterializeThresholdin zero-client, lined up with the Swift port (#210).zero-rustminor changeset, so it rides with 0.2.0.Swift's half merged as #210; this adds the Rust port, the shared JS vectors, and Swift's replay of them.
Rust (
feat(zero-rust)commit)client::{Inspector, InspectorClient, InspectorClientGroup, InspectorQuery, Metrics, AnalyzeQueryOptions, AnalyzeQueryResult, PlanDebugEvent},tdigest::TDigest,ast::ast_to_zql. Calls returnDeferreds.addMetric. AMeasurePushoperator times 1 push in 32, weighted 32 (UPDATE_SAMPLE_RATE); reconciles that reach a view aren't timed, as in JS. Evicted queries are kept once an inspector exists.debugPerfis sent at the debug log level.authenticate(password)is called, and an accepted password is presented again after a reconnect.close()instead of hanging.Vectors (JS-generated)
tdigest.json(72),ast-to-zql.json(101), andclient-inspector.json(12 scenarios).harness.tsgainsinspectsteps, theinspectorandlogsobservations, and theslowMaterializeThresholdandlogLeveloptions. Thelogsobservation adds expected warnings toclient-harden-mutations.jsonandharden-queries.json.Swift (
test(zero-swift)commit)TDigest.quantiletrapped instead of returning NaN,debugPerfwas missing, andinactivatedAtkept its fraction.ast-to-zql's unredacted code only, since it has noredactLiterals.Checked locally
cargo clippy --workspace --all-targets --all-features -D warnings,cargo test --workspace --all-features, andcargo doc -D warnings.swift format lint --strict, andConformanceTestswith 67 tests passing, client-inspector 12/12 on memory and SQLite.pnpm --filter zero-conformance run testpasses 265, and the vectors are unchanged afterwards.