Skip to content

Correct the routing-rules scope and surface blocked updates - #1444

Merged
maxenglander merged 5 commits into
mainfrom
routing-rules-block-stale-writes
Sep 25, 2026
Merged

maxenglander merged 5 commits into
mainfrom
routing-rules-block-stale-writes

Conversation

@cursor

@cursor cursor Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

pscale branch routing-rules reads 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 under pscale 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 a get, edit, update round trip silently reverts every route that changed in between, because update replaces 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:

  • The routing-rules group no longer claims to manage keyspace routing rules.
  • routing-rules update is "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_blocked and schema_snapshot_not_ready now return status: action_required with the wait-and-retry step that clears each one, instead of a generic error. Both conditions are transient, so a caller branching on status should 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/...
  • Both rejection paths and the success path exercised end to end against a live control plane.

@maxenglander maxenglander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the base to main

Comment thread internal/cmd/branch/routing_rules.go Outdated
Comment thread internal/cmd/branch/routing_rules_test.go Outdated
Co-authored-by: max <max@planetscale.com>
@cursor
cursor Bot force-pushed the routing-rules-block-stale-writes branch from dbed9e0 to da25d98 Compare September 25, 2026 03:08
Co-authored-by: max <max@planetscale.com>
@planetscale-ai-tools
planetscale-ai-tools Bot changed the base branch from routing-rules-reject-stale to main September 25, 2026 03:24
cursoragent and others added 3 commits September 25, 2026 04:58
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>
@planetscale-ai-tools planetscale-ai-tools Bot changed the title Surface the stale-snapshot block on routing-rules update Correct the routing-rules scope and surface blocked updates Sep 25, 2026
@maxenglander
maxenglander marked this pull request as ready for review September 25, 2026 14:07
@maxenglander
maxenglander requested a review from a team as a code owner September 25, 2026 14:07
@maxenglander
maxenglander merged commit 033bd9d into main Sep 25, 2026
4 checks passed
@maxenglander
maxenglander deleted the routing-rules-block-stale-writes branch September 25, 2026 17:40
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