fix(github): lead wide shard groups with coverage instead of walling the plan comment - #1188
Conversation
There was a problem hiding this comment.
Pull request overview
Improves the readability of sharded plan PR comments for wide Strata/Vitess keyspaces by leading shard groups with coverage (e.g., “all 32 shards” / “15 of 16 shards”) and moving long shard name lists behind a collapsible disclosure, avoiding a large inline “wall of shards” before the DDL.
Changes:
- Add wide-keyspace shard group headings (“all N shards” / “N of M shards”) and collapse long shard name lists behind a
Show shards<details>block. - Compact shard suffixes in list-item contexts (e.g., unsafe findings) to a count once they exceed the same inline-name limit.
- Add preview + tests covering uniform-wide, divergent-wide, and unsafe-wide shard scenarios.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TEMPLATES.md | Adds a rendered example of the “Many Shards (32)” plan output. |
| pkg/webhook/templates/sharded_plan_test.go | Adds regression tests for wide shard groups (collapsed lists + coverage headings) and compacted unsafe suffixes. |
| pkg/webhook/templates/preview_sharded.go | Adds a new preview generator for a wide uniform sharded plan and a helper to generate keyrange-like shard names. |
| pkg/webhook/templates/plan.go | Implements wide-group headings, the inline-name limit constant, and collapsed shard list rendering; compacts list-item shard suffixes. |
| pkg/webhook/templates/apply.go | Reuses the shared shard inline-name limit constant for apply progress shard summaries. |
| pkg/cmd/internal/templates/preview_comment.go | Exposes the new “Many Shards (32)” preview in the CLI preview output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
d2e3091 to
8134403
Compare
…the plan comment A sharded plan across a wide keyspace rendered every shard range inline, so a 32-shard keyspace produced an unreadable wall of backticked ranges. Wide groups now lead with how much of the keyspace they cover — "all 32 shards" for a uniform change, "15 of 16 shards" for a divergent subset — with the names behind a collapsed block. Few shards still read inline by name, and list-item shard suffixes (unsafe/blocked/direct findings) compact to a count past the same limit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8134403 to
669a25d
Compare
|
🤖 Review findings - created by Kiran's code review agent - for schemabot/pull/1188, 669a25d. Verdict: 5 findings — 3 non-blocking (gate-line information loss, an inaccurate doc claim, a boundary coverage gap), 2 suggestions. No blocking issues; the "all N shards" coverage claim is sound. Non-blocking1. The compact gate-line form drops the denominator, so a subset and a whole keyspace read identically on the line the reviewer consents against. if len(shards) > shardNamesInlineLimit {
return fmt.Sprintf("%d shards", len(shards))
}
Failure scenario, rendered at head: a directly under a DDL heading that says 2. The doc comment justifies the drop with a fallback that does not exist — the CLI plan renders no shard names. // for a collapsed name list; the per-shard detail stays in the CLI plan.
3. Nothing pins the 8/9 boundary the new constant defines. The added tests build 32, 15+1 and 12 shard groups; but flipping plan.go:876 General suggestions4. The apply-side twin still walls — and could at least share the new constant. func shardList(shards []ShardStatus) string {
names := make([]string, len(shards))
for i, s := range shards {
names[i] = fmt.Sprintf("`%s`", s.Shard)
}Its sole caller (sharded_apply.go:195) emits the group heading immediately above 5. The identical The one thing that could have broken, verifiedCan Structurally: Upstream: the only path that shortens Verified correct
This review was generated by Claude Code (claude-opus-5). |
…bare count The unsafe, blocked, and direct-execution finding lines are what the reviewer consents against, so a wide shard suffix now reads "12 of 32 shards" (or "all 32 shards") instead of a bare count that leaves a subset indistinguishable from whole-keyspace coverage. The change data carries the keyspace's planned-shard total from the webhook builders, and the DDL headings share the same coverage phrase. The inline-versus- collapsed pivot is pinned at the limit, and the map-to-code-spans loop is extracted as markdownInlineCodeList for the three copies of it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
🤖 All 5 findings addressed; 1–3 and 5 land in d9f8367, 4 is sequenced for the apply-side stack. Per finding:
Verification: build + vet clean, This reply was generated by Claude Code (Claude Fable 5). |
…t-dialect-classify * origin/main: chore(postgres): remove unreachable blocked apply guard (#1203) feat(postgres): enforce the table size ceiling at plan time (#1199) fix(github): give multi-keyspace Strata applies the keyspace-grouped shard layout (#1189) feat(cli): name each remote handle in the deployment-filtered status list (#1062) fix(github): lead wide shard groups with coverage instead of walling the plan comment (#1188) feat(engine): cap how many drivers one apply may occupy (#1183) # Conflicts: # pkg/webhook/templates/plan.go # pkg/webhook/templates/sharded_plan_test.go
…ogress-dialect * origin/main: fix(github): redact paths and connection identities in comments (#1200) fix(github): classify and format plan DDL under its own dialect (#1194) chore(postgres): remove unreachable blocked apply guard (#1203) feat(postgres): enforce the table size ceiling at plan time (#1199) fix(github): give multi-keyspace Strata applies the keyspace-grouped shard layout (#1189) feat(cli): name each remote handle in the deployment-filtered status list (#1062) fix(github): lead wide shard groups with coverage instead of walling the plan comment (#1188) feat(engine): cap how many drivers one apply may occupy (#1183) # Conflicts: # pkg/ddl/format_test.go # pkg/webhook/templates/plan.go # pkg/webhook/templates/sharded_plan_test.go
Why this matters
A sharded plan comment names every shard in each group heading, so at real shard counts the reader scrolls a wall of backticked names before reaching the first DDL statement — and the list answers nothing, because the question at plan time is coverage, not enumeration. This PR makes a wide group lead with its coverage on a single collapsed line, with the names one click away.
What it does
Group headings pick a shape by width:
Shard-list suffixes that ride inside line items — the unsafe, blocked, and direct-execution finding lines the reviewer consents against — state their keyspace coverage past the same width limit, so a subset never reads like whole-keyspace coverage:
A finding line has no room for a collapsed list, so the full names stay reachable in the DDL section's collapsed shard groups. Shard names are normalized through
markdownInlineCodeso a name from the topology can't break the code span or the comment structure.Plan: Many Shards (32)
Schema Change Plan — Production
Database:
cdb_resolute| Type:StrataRequested by @jackjackbits at 2026-01-01 00:00:00 UTC · planned from
abcdef1Keyspace:
cdb_resolute_shardedall 32 shards
-08,08-10,10-18,18-20,20-28,28-30,30-38,38-40,40-48,48-50,50-58,58-60,60-68,68-70,70-78,78-80,80-88,88-90,90-98,98-a0,a0-a8,a8-b0,b0-b8,b8-c0,c0-c8,c8-d0,d0-d8,d8-e0,e0-e8,e8-f0,f0-f8,f8-📋 Plan: 1 table to alter
How it moves us toward the northstar
Sharded databases are only a first-class target if "plan once, fan out per shard" stays legible at fleet-real shard counts. This is the plan-comment half of that; the apply-comment half (keyspace grouping, table-altitude progress) follows in #1189–#1191.
Opened by Claude (Fable 5).