Correct the routing-rules scope and surface blocked updates - #1444
Merged
Merged
Conversation
maxenglander
left a comment
Contributor
There was a problem hiding this comment.
change the base to main
Co-authored-by: max <max@planetscale.com>
cursor
Bot
force-pushed
the
routing-rules-block-stale-writes
branch
from
September 25, 2026 03:08
dbed9e0 to
da25d98
Compare
Co-authored-by: max <max@planetscale.com>
planetscale-ai-tools
Bot
changed the base branch from
routing-rules-reject-stale
to
main
September 25, 2026 03:24
The API now rejects routing-rules updates with schema_mutation_blocked or schema_snapshot_not_ready, and no longer blocks keyspace routing rules writes. Co-authored-by: max <max@planetscale.com>
Co-authored-by: max <max@planetscale.com>
Co-authored-by: max <max@planetscale.com>
maxenglander
marked this pull request as ready for review
September 25, 2026 14:07
no-itsbackpack
approved these changes
Sep 25, 2026
maxenglander
approved these changes
Sep 25, 2026
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.
pscale branch routing-rulesreads the branch schema snapshot and writes a full replacement, and the help text said neither. It also announced itself as managing keyspace routing rules, which is a different map that lives underpscale branch vtctl get-keyspace-routing-rules/apply-keyspace-routing-rules.The gap that matters is between the read and the write. If live routing moves after the snapshot was taken — a MoveTables
switch-traffic, say — then aget, edit,updateround trip silently reverts every route that changed in between, becauseupdatereplaces the whole document rather than merging into it. The API refuses those writes; this makes the CLI say so before you run one.Help text:
routing-rulesgroup no longer claims to manage keyspace routing rules.routing-rules updateis "Replace", not "Update", and its long help states that the request is a full replacement and that it fails while a vtctld schema mutation is in progress or the branch schema snapshot is not ready.JSON errors:
schema_mutation_blockedandschema_snapshot_not_readynow returnstatus: action_requiredwith the wait-and-retry step that clears each one, instead of a genericerror. Both conditions are transient, so a caller branching onstatusshould wait and retry rather than treat the write as permanently rejected.To read what is actually routing right now, rather than what the snapshot says, use
pscale branch vtctl get-routing-rules.The server-side rejection ships separately. Until it does, the two codes never arrive and the mapping is inert.
Testing
go test ./internal/cmd/branch/... ./internal/cmdutil/...