Skip to content

feat(localscale): serve the branch table metrics endpoint - #1244

Closed
aparajon wants to merge 1 commit into
feat/table-size-capturefrom
claude/awesome-hodgkin-01a607
Closed

feat(localscale): serve the branch table metrics endpoint#1244
aparajon wants to merge 1 commit into
feat/table-size-capturefrom
claude/awesome-hodgkin-01a607

Conversation

@aparajon

@aparajon aparajon commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Stacks on #1238.

LocalScale did not serve GET /v1/organizations/{org}/databases/{db}/branches/{branch}/metrics/tables, so every plan against it took the metrics fail-open branch and no integration test could assert the size fields on planned changes — a regression in the PlanetScale size path was invisible to CI.

  • Serve the endpoint from the backing cluster's table statistics (SHOW TABLE STATUS data + index length), summed across a keyspace's shards on main and read from the branch databases on other branches, in the real API's flat per-table storage_bytes shape. Underscore-prefixed internal tables are excluded.
  • Add an integration test driving a real Plan against LocalScale: a change to an existing table must carry the keyspace's shard count and the exact byte figure the endpoint reports, while row counts stay absent on PlanetScale (the endpoint reports bytes only).
  • Keep the fail-open guarantee pinned: with the metrics call failing, the plan still succeeds and changes carry the shard count only.

🤖 Generated with Claude Code

The LocalScale PlanetScale API emulator did not serve GET
/v1/organizations/{org}/databases/{db}/branches/{branch}/metrics/tables,
so every plan against LocalScale took the fail-open branch and no
integration test could assert the size fields on planned changes.

Serve the endpoint from the backing cluster's table statistics (data
plus index length), summed across a keyspace's shards on main and read
from the branch databases on other branches, in the real API's flat
per-table storage_bytes shape.

Add integration tests proving a plan's table changes carry the shard
count and the exact byte figure the endpoint reports on the PlanetScale
path — with row counts absent, since the endpoint reports bytes only —
and that a failing metrics endpoint never fails the plan, leaving only
the shard count on each change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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