Skip to content

feat: add --dispatch-strategy to override SpiceDB's secondary dispatch strategy - #730

Draft
ostafen wants to merge 2 commits into
mainfrom
feat/dispatch-strategy-flag
Draft

ostafen wants to merge 2 commits into
mainfrom
feat/dispatch-strategy-flag

Conversation

@ostafen

@ostafen ostafen commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Adds --dispatch-strategy to zed permission check, bulk, lookup-resources and lookup-subjects:

zed permission check document:1 view user:alice --dispatch-strategy "prefer_secondary(['tiger'], duration('50ms'))"

zed sends the expression in the io.spicedb.dispatchstrategy header (requestmeta.WithDispatchStrategy). SpiceDB then uses it instead of its configured secondary dispatch strategy, for the request and every dispatch it causes. That lets you try a strategy on one query without changing the cluster's configuration.

SpiceDB must run with --experimental-dispatch-secondary-allow-strategy-override (authzed/spicedb#3538). Otherwise, or for an invalid expression, the request fails with InvalidArgument. When the flag is unset, zed sends no header.

Before merging

Refs DATA-1133

🤖 Generated with Claude Code

…h strategy

`zed permission check`, `check-bulk`, `lookup-resources` and
`lookup-subjects` accept --dispatch-strategy, a secondary dispatch CEL
expression such as "prefer_secondary(['tiger'], duration('50ms'))".
zed sends it in the io.spicedb.dispatchstrategy header, and SpiceDB uses
it instead of its configured strategy for the request and every
dispatch it causes.

SpiceDB must run with --experimental-dispatch-secondary-allow-strategy-override;
otherwise, or for an invalid expression, the request fails with
InvalidArgument.

Refs DATA-1133
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/commands/permission.go 83.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Refs DATA-1133
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