demo: show_constraints — name/stmt split with automated bzl rename, BNF, HTML, and PNG#56
Open
ebembi-crdb wants to merge 2 commits into
Open
demo: show_constraints — name/stmt split with automated bzl rename, BNF, HTML, and PNG#56ebembi-crdb wants to merge 2 commits into
ebembi-crdb wants to merge 2 commits into
Conversation
…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
SQL Diagram Generation Report✅ Validation Passed 🔄 Diagram changes detected Changed Diagram Previewsshow_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: This comment was generated by the SQL Diagram CI workflow. |
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.

What this PR demonstrates
This addresses the specific scenario from the review feedback and the SQL Grammar Documentation wiki (Troubleshoot HTML generation):
The only file the writer touches
{ name: "show_constraints", stmt: "show_constraints_stmt", inline: []string{"with_comment"}, },Pre-conditions (state before this PR)
docs/generated/sql/bnf/BUILD.bazel"show_constraints_stmt"pkg/gen/bnf.bzl:show_constraints_stmt.bnfpkg/gen/docs.bzl:show_constraints_stmt.bnfpkg/gen/diagrams.bzl:show_constraints.html← already correct (SVG genrule always stripped_stmt)This matches the scenario exactly: three bzl files have the
_stmtentry;diagrams.bzlalready has the HTML without_stmtbecauseshow_constraints_stmtwas already defined in source.What CI does automatically
Renames bzl entries — detects
name: "show_constraints"(no_stmt) withshow_constraints_stmtin BUILD.bazel, bnf.bzl, docs.bzl. Renames all three and commits back to this branch. diagrams.bzl needs no change.Generates BNF —
show_constraints.bnfwithwith_commentinlined. Content differs from the existingshow_constraints_stmt.bnf. Appears in the linked generated-diagrams PR.Generates HTML —
show_constraints.htmlrebuilt withWITH COMMENTshown inline instead of as an opaque reference box — a visible content change confirmed in the generated-diagrams PR.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_commentplays the same role asopt_with_show_hints_options— an inlined sub-rule that produces a meaningful HTML change.