Skip to content

demo: show_constraints — name/stmt split with automated bzl rename, BNF, HTML, and PNG#56

Open
ebembi-crdb wants to merge 2 commits into
masterfrom
demo/show-constraints-stmt-split-v3
Open

demo: show_constraints — name/stmt split with automated bzl rename, BNF, HTML, and PNG#56
ebembi-crdb wants to merge 2 commits into
masterfrom
demo/show-constraints-stmt-split-v3

Conversation

@ebembi-crdb
Copy link
Copy Markdown
Owner

What this PR demonstrates

This addresses the specific scenario from the review feedback and the SQL Grammar Documentation wiki (Troubleshoot HTML generation):

In diagrams.go, name should exclude the _stmt suffix, while stmt includes it. Each bzl file already has a corresponding entry that includes the _stmt suffix. The automation should update the bzl file entries to also exclude the suffix. In each bzl file, there should only be one entry per diagrams.go entry.

The only file the writer touches

{
    name:   "show_constraints",
    stmt:   "show_constraints_stmt",
    inline: []string{"with_comment"},
},

Pre-conditions (state before this PR)

File Entry before this PR
docs/generated/sql/bnf/BUILD.bazel "show_constraints_stmt"
pkg/gen/bnf.bzl :show_constraints_stmt.bnf
pkg/gen/docs.bzl :show_constraints_stmt.bnf
pkg/gen/diagrams.bzl :show_constraints.html ← already correct (SVG genrule always stripped _stmt)

This matches the scenario exactly: three bzl files have the _stmt entry; diagrams.bzl already has the HTML without _stmt because show_constraints_stmt was already defined in source.

What CI does automatically

  1. Renames bzl entries — detects name: "show_constraints" (no _stmt) with show_constraints_stmt in BUILD.bazel, bnf.bzl, docs.bzl. Renames all three and commits back to this branch. diagrams.bzl needs no change.

  2. Generates BNFshow_constraints.bnf with with_comment inlined. Content differs from the existing show_constraints_stmt.bnf. Appears in the linked generated-diagrams PR.

  3. Generates HTMLshow_constraints.html rebuilt with WITH COMMENT shown inline instead of as an opaque reference box — a visible content change confirmed in the generated-diagrams PR.

  4. Posts PNG preview — CI detects the HTML diff and posts a PNG of the updated diagram as a comment on this PR.

Mirrors the reference PR

Follows the same pattern as cockroachdb#161545 (show_statement_hints): with_comment plays the same role as opt_with_show_hints_options — an inlined sub-rule that produces a meaningful HTML change.

ebembi-crdb and others added 2 commits February 25, 2026 17:55
…t inlined

Add a diagrams.go entry for show_constraints_stmt using name
"show_constraints" (without the _stmt suffix) and stmt
"show_constraints_stmt" (with the suffix). Inline with_comment so the
diagram explicitly shows the optional WITH COMMENT clause.

This is the only file a writer needs to touch. CI responds by:
1. Renaming show_constraints_stmt to show_constraints in BUILD.bazel,
   bnf.bzl, and docs.bzl (diagrams.bzl already has show_constraints.html
   since the SVG genrule always stripped _stmt from HTML output names).
2. Generating show_constraints.bnf with with_comment inlined, producing
   different BNF content than the existing show_constraints_stmt.bnf.
3. Building show_constraints.html with the WITH COMMENT clause now shown
   inline instead of as an opaque reference box — a visible content change.
4. Posting a PNG preview of the updated diagram as a comment on this PR.

Release note: None
@github-actions
Copy link
Copy Markdown

SQL Diagram Generation Report

Validation Passed

🔄 Diagram changes detected
A PR has been opened to sync these changes: ebembi-crdb/generated-diagrams#30

Changed Diagram Previews

show_constraints

show_constraints

Showing 1 changed diagram(s). Only diagrams that differ from master are shown.

SKIP DOC Warnings (click to expand)

The following grammar rules are suppressed from documentation:

The following grammar rules are suppressed with SKIP DOC:
1986:| alter_virtual_cluster_stmt   /* SKIP DOC */
2579:    /* SKIP DOC */
2591:    /* SKIP DOC */
2716:    /* SKIP DOC */
2733:    /* SKIP DOC */
3044:    /* SKIP DOC */
3050:    /* SKIP DOC */
3102:    /* SKIP DOC */
3110:    /* SKIP DOC */
3262:  SET CYCLE                        { /* SKIP DOC */
3643:    /* SKIP DOC */
3664:  INCLUDE_ALL_SECONDARY_TENANTS { /* SKIP DOC */ }
4245:  TENANT  { /* SKIP DOC */ }
4249:  TENANT_NAME { /* SKIP DOC */ }
4840:    /* SKIP DOC */
4983:  /* SKIP DOC */
5022:    /* SKIP DOC */
5029:    /* SKIP DOC */
5037:    /* SKIP DOC */
5047:    /* SKIP DOC */
5059:  TENANT { /* SKIP DOC */ }
6251:    /* SKIP DOC */
6289:    /* SKIP DOC */
6366:    /* SKIP DOC */
6489:    /* SKIP DOC */
6775:   /* SKIP DOC */
6784:    /* SKIP DOC */
7206:    /* SKIP DOC */
7217:    /* SKIP DOC */
7222:    /* SKIP DOC */
7227:    /* SKIP DOC */
7246:    /* SKIP DOC */
7251:    /* SKIP DOC */
7258:    /* SKIP DOC */
7263:    /* SKIP DOC */
7268:    /* SKIP DOC */
7273:    /* SKIP DOC */
7280:    /* SKIP DOC */
7287:    /* SKIP DOC */
7302:		/* SKIP DOC */
7312:    /* SKIP DOC */
7317:    /* SKIP DOC */
7324:    /* SKIP DOC */
7343:    /* SKIP DOC */
7376:    /* SKIP DOC */
7834:| set_exprs_internal   { /* SKIP DOC */ }
8139:    /* SKIP DOC */
8168:    /* SKIP DOC */
8269:    /* SKIP DOC */
8278:    /* SKIP DOC */
8287:    /* SKIP DOC */
8347:    /* SKIP DOC */
8354:    /* SKIP DOC */
8364:    /* SKIP DOC */
8369:    /* SKIP DOC */
8394:    /* SKIP DOC */
8400:    /* SKIP DOC */
8477:    /* SKIP DOC */
8485:    /* SKIP DOC */
8490:		/* SKIP DOC */
8499:    /* SKIP DOC */
8520:    /* SKIP DOC */
8525:    /* SKIP DOC */
8934:    /* SKIP DOC */
8939:    /* SKIP DOC */
8944:    /* SKIP DOC */
8949:    /* SKIP DOC */
8954:    /* SKIP DOC */
8985:| TRACING { /* SKIP DOC */ }
8988:    /* SKIP DOC */
9030:    /* SKIP DOC */
9051:    /* SKIP DOC */
9104:    /* SKIP DOC */
9110:    /* SKIP DOC */
9116:		/* SKIP DOC */
9122:		/* SKIP DOC */
9139:    /* SKIP DOC */
9144:    /* SKIP DOC */
9149:    /* SKIP DOC */
9195: /* SKIP DOC */
9291:    /* SKIP DOC */
9296:    /* SKIP DOC */
9795:    /* SKIP DOC */
9960:    /* SKIP DOC */
9968:    /* SKIP DOC */
9981:    /* SKIP DOC */
9991:   /* SKIP DOC */
10024:    /* SKIP DOC */
10029:    /* SKIP DOC */
10034:    /* SKIP DOC */
10074:    /* SKIP DOC */
10083:    /* SKIP DOC */
10092:    /* SKIP DOC */
10097:    /* SKIP DOC */
10102:    /* SKIP DOC */
10107:    /* SKIP DOC */
10112:    /* SKIP DOC */
10121:    /* SKIP DOC */
10131:    /* SKIP DOC */
10307:| for_with_lookahead_variants { /* SKIP DOC */ }
10314:| FOR_JOB { /* SKIP DOC */ }
10509:    /* SKIP DOC */
10518:    /* SKIP DOC */
10883:    /* SKIP DOC */
10892:    /* SKIP DOC */
11201:    /* SKIP DOC */
11217:    /* SKIP DOC */
11307:| WITH DATA    { /* SKIP DOC */ /* This is the default */ }
11698:    /* SKIP DOC */
12205:| CYCLE                        { /* SKIP DOC */
12261:    /* SKIP DOC */
12342:    /* SKIP DOC */
12365:    /* SKIP DOC */
12643:    /* SKIP DOC */
12649:    /* SKIP DOC */
12654:    /* SKIP DOC */
12659:    /* SKIP DOC */
13683:| abort_stmt               /* SKIP DOC */
14013:    /* SKIP DOC */
14028:    /* SKIP DOC */
14174:    /* SKIP DOC */
14675:    /* SKIP DOC */
15098:    /* SKIP DOC */
15103:    /* SKIP DOC */
15108:    /* SKIP DOC */
15130:    /* SKIP DOC */
15135:    /* SKIP DOC */
15148:    /* SKIP DOC */
15153:    /* SKIP DOC */
15228:    /* SKIP DOC */
15314:    /* SKIP DOC */
15643:    /* SKIP DOC */
15715:    /* SKIP DOC */
15744:    /* SKIP DOC */

This comment was generated by the SQL Diagram CI workflow.

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