Skip to content

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

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

ostafen wants to merge 3 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

@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…h strategy

`zed permission 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
Refs DATA-1133
@ostafen
ostafen force-pushed the feat/dispatch-strategy-flag branch from d4a3b8c to ce4ef44 Compare December 1, 2026 10:33
Run check, bulk, lookup-resources and lookup-subjects as zed builds
them, so the test also fails if a command does not register the flag
or does not send the header.

Refs DATA-1133
@ostafen
ostafen marked this pull request as ready for review December 1, 2026 14:24
@ostafen
ostafen requested a review from tstirrat15 December 1, 2026 14:26
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