Skip to content

docs(mutators): document return values, tx.retryOn() and isolation levels - #323

Closed
arv wants to merge 1 commit into
mainfrom
arv/docs-1.11-mutators
Closed

arv wants to merge 1 commit into
mainfrom
arv/docs-1.11-mutators

Conversation

@arv

@arv arv commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Documents three server mutator features from Zero 1.11. This is a draft until 1.11 ships.

Changes

contents/docs/mutators.mdx:

  • Returning Data: replaces the "not yet supported" note and keeps the #returning-data anchor. Covers:
    • the client and server runs return separate values, read from data on .client and .server;
    • data is typed ReadonlyJSONValue;
    • the mutate handler must return the mutator's result;
    • the server value is stored with the mutation result, so a lost response still delivers it.
  • Retrying Mutators: tx.retryOn(predicate). Covers:
    • the predicate receives (error, attempt) and can be async;
    • errors at COMMIT are included;
    • at most 5 runs per mutation per request;
    • tx can't be used inside the predicate;
    • only retry idempotent side effects;
    • a note on what a custom Database must do.
    • The 40001 example is stated only for node-postgres and postgres.js. Drizzle wraps driver errors, and I didn't confirm Prisma's error shape.

contents/docs/server-zql.mdx:

  • Isolation Level: isolationLevel for each adapter (Drizzle, Kysely, Prisma, node-postgres, postgres.js). For zeroNodePg it is the fourth argument. The section links to retryOn() for serialization failures.

This was checked against the code at rocicorp/mono 22fa3c27e:

  • RetryPredicate in zql/src/mutate/custom.ts;
  • MAX_MUTATOR_RUNS and mutation-result storage in zero-server/src/process-mutations.ts;
  • TransactionOptions and the adapter signatures, for example zeroNodePg(schema, pg, lc, options) in adapters/pg.ts;
  • MutatorResultDetails in zero-client/src/client/custom.ts.

Notes

  • assets/search-index.json is not regenerated, to avoid conflicts with the other 1.11 docs PRs. Regenerate it when merging.

Checks

prettier --check passes, both pages compile as MDX, and vitest run passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RRckJnCeGsYg9nCJSxBgTJ


Generated by Claude Code

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
zero-docs Ready Ready Preview Oct 14, 2026 3:52pm UTC

Request Review

arv commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

The Verify Signed Commit Authors check fails, but not because of what this PR changes. A cloud Claude Code session signed commit e73c6a9 with its own SSH key, which isn't in rocicorp/.github's allowed signers. A re-run won't fix it. To fix it, re-sign the commit with an allowed key:

git fetch origin arv/docs-1.11-mutators
git checkout arv/docs-1.11-mutators
git commit --amend --no-edit -S
git push --force-with-lease origin arv/docs-1.11-mutators

Generated by Claude Code

arv commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #325, which has all the 1.11 docs and the release notes in one PR. This commit is there unchanged.


Generated by Claude Code

@arv arv closed this Oct 14, 2026

This branch was successfully deployed

1 active deployment
Preview — e73c6a96 Deployed Oct 14, 2026 by vercel[bot]
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.

1 participant