Skip to content

Commit 64c5024

Browse files
author
ebembi-crdb
committed
demo: add create_policy entry showing name/stmt suffix and inline diagram update
Add a diagrams.go entry for create_policy_stmt using name "create_policy" (without the _stmt suffix) and inline the four opt_ sub-rules: opt_policy_type, opt_policy_command, opt_policy_roles, opt_policy_exprs. This demo directly addresses Ryan's two feedback points: 1. BNF files missing: fixed by merged PRs #45 and #47. The CI now runs docgen directly (not via bazel run) and packages .bnf files correctly. alter_job.bnf in the generated-diagrams PR from demo #48 confirms this. 2. HTML content unchanged: the alter_job demo used a grammar simple enough that the diagrams.go entry produced identical HTML, so no diff was detected and no PNG was generated. create_policy_stmt is different: diagrams.bzl already has create_policy.html (generated without any inlining), so the four sub-rules appear as opaque reference boxes. Adding the inline list expands those sub-rules directly into the BNF, changing the HTML content. CI detects the diff, sets has_changes=true, generates a PNG preview, and posts it in the PR comment. Bazel file changes: - docs/generated/sql/bnf/BUILD.bazel: create_policy_stmt -> create_policy - pkg/gen/bnf.bzl: create_policy_stmt.bnf -> create_policy.bnf - pkg/gen/docs.bzl: create_policy_stmt.bnf -> create_policy.bnf - pkg/gen/diagrams.bzl: already has create_policy.html, no change needed Release note: None
1 parent 5011a32 commit 64c5024

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

docs/generated/sql/bnf/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ FILES = [
111111
"create_index_with_storage_param",
112112
"create_inverted_index_stmt",
113113
"create_logical_replication_stream_stmt",
114-
"create_policy_stmt",
114+
"create_policy",
115115
"create_proc",
116116
"create_role_stmt",
117117
"create_schedule_for_backup_stmt",

pkg/cmd/docgen/diagrams.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,16 @@ var specs = []stmtSpec{
831831
},
832832
nosplit: true,
833833
},
834+
{
835+
name: "create_policy",
836+
stmt: "create_policy_stmt",
837+
inline: []string{
838+
"opt_policy_type",
839+
"opt_policy_command",
840+
"opt_policy_roles",
841+
"opt_policy_exprs",
842+
},
843+
},
834844
{
835845
name: "create_schedule_for_backup_stmt",
836846
inline: []string{"string_or_placeholder_opt_list", "string_or_placeholder_list", "opt_with_backup_options", "cron_expr", "opt_full_backup_clause", "opt_with_schedule_options", "opt_backup_targets"},

pkg/gen/bnf.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ BNF_SRCS = [
112112
"//docs/generated/sql/bnf:create_index_with_storage_param.bnf",
113113
"//docs/generated/sql/bnf:create_inverted_index_stmt.bnf",
114114
"//docs/generated/sql/bnf:create_logical_replication_stream_stmt.bnf",
115-
"//docs/generated/sql/bnf:create_policy_stmt.bnf",
115+
"//docs/generated/sql/bnf:create_policy.bnf",
116116
"//docs/generated/sql/bnf:create_proc.bnf",
117117
"//docs/generated/sql/bnf:create_role_stmt.bnf",
118118
"//docs/generated/sql/bnf:create_schedule_for_backup_stmt.bnf",

pkg/gen/docs.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ DOCS_SRCS = [
122122
"//docs/generated/sql/bnf:create_index_with_storage_param.bnf",
123123
"//docs/generated/sql/bnf:create_inverted_index_stmt.bnf",
124124
"//docs/generated/sql/bnf:create_logical_replication_stream_stmt.bnf",
125-
"//docs/generated/sql/bnf:create_policy_stmt.bnf",
125+
"//docs/generated/sql/bnf:create_policy.bnf",
126126
"//docs/generated/sql/bnf:create_proc.bnf",
127127
"//docs/generated/sql/bnf:create_role_stmt.bnf",
128128
"//docs/generated/sql/bnf:create_schedule_for_backup_stmt.bnf",

0 commit comments

Comments
 (0)