Skip to content

feat(zero-throughput): adapt for CloudZero with custom queries and transform endpoint - #6493

Merged
grgbkr merged 5 commits into
mainfrom
grgbkr/throughput-deployable
Sep 5, 2026
Merged

feat(zero-throughput): adapt for CloudZero with custom queries and transform endpoint#6493
grgbkr merged 5 commits into
mainfrom
grgbkr/throughput-deployable

Conversation

@grgbkr

@grgbkr grgbkr commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates apps/zero-throughput from legacy ad-hoc queries and local permissions to modern typed custom queries (defineQueries / defineQuery) and introduces a Fastify query-transform/mutator app server modeled after apps/zbugs.

Key Changes

  • Custom Query Definitions (src/queries.ts, src/profile-queries.ts): Replaced raw client queries across all 4 profiles (feed-append, email, forum, relational) with parameterized custom queries using zod/mini.
  • Fastify App Server (api/index.ts, src/server.ts): Implemented /api/query (query transform via handleQueryRequest), /api/mutate (no-op handler via handleMutateRequest), and health endpoints. Can be deployed standalone or serverless. Note: There is currently no UI for this app.
  • Removed Permissions & Legacy Queries: Removed permissions.ts, deployPermissions(), and ZERO_ALLOW_LEGACY_QUERIES.
  • Process Orchestration (src/processes.ts, src/main.ts): Automatically spawns and manages the local app server when starting zero-cache locally, wiring ZERO_QUERY_URL and ZERO_MUTATE_URL directly. When targeting external instances (e.g. CloudZero via --cache-url), no local app server is spawned.
  • Client & AST Analyzer Updates (src/client.ts, src/analyze.ts): Passes user authentication headers/tokens during client connection handshake and extracts ASTs from named queries for query plan logging.

Verification & Performance Impact

  • No Impact on Benchmark Results: Query transformation occurs only during initial subscription setup and is cached by zero-cache; steady-state IVM pipeline throughput, client-visible lag, and advance durations remain unchanged.
  • Monorepo typecheck across 39 packages passed with 0 errors.
  • pnpm --filter zero-throughput run check-types && pnpm --filter zero-throughput run lint passed.
  • Verified live single and distributed runs against local PostgreSQL and zero-cache.

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
replicache-docs Ready Ready Preview Sep 5, 2026 1:34am UTC
zbugs Ready Ready Preview Sep 5, 2026 1:34am UTC

Request Review

@grgbkr
grgbkr added this pull request to the merge queue Sep 5, 2026
Merged via the queue into main with commit 9771d54 Sep 5, 2026
38 checks passed
@grgbkr
grgbkr deleted the grgbkr/throughput-deployable branch September 5, 2026 18:30
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.

3 participants