Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor(advisor/tidb): migrate naming_auto_increment_column + column_type_disallow_list to omni AST (Phase 1.5 §1.5.3 batch 12) (#20308)
Vincent Huang0d0319e468fb
diff --git a/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type.go b/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type.goindex 5d239a6960..1f78134c82 100644--- a/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type.go+++ b/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type.go@@ -159,17 +159,16 @@ func omniBuildColumnTypeString(dt *ast.DataType) string {}lower := strings.ToLower(dt.Name)- // Build the base form (without UNSIGNED/ZEROFILL modifiers).- // Modifier handling is centralized below so canonical-bare-form- // types (DECIMAL → decimal(10,0), INT → int(11), etc.) compose- // correctly with UNSIGNED/ZEROFILL — this avoids the- // bare-form × modifier Cartesian product false-positive class- // (Codex round-8 catch on PR #20302; otherwise- // `MODIFY x DECIMAL UNSIGNED` against `decimal(10,0) unsigned`- // catalog would false-positive because my builder previously- // emitted "decimal unsigned" and normalizeColumnType had no- // "decimal unsigned" entry).- base := buildBaseTypeForm(dt, lower)+ // Build the compact (no-modifier) form first; this is the+ // CompactStr-equivalent that maps directly to pingcap's+ // `column.Tp.CompactStr()` and to MySQL info_schema's+ // non-attribute column-type rendering. Modifier handling is+ // centralized below so canonical-bare-form types (DECIMAL →+ // decimal(10,0), INT → int(11), etc.) compose correctly with+ // UNSIGNED/ZEROFILL — this avoids the bare-form × modifier+ // Cartesian product false-positive class (Codex round-8 catch+ // on PR #20302).+ base := omniBuildCompactTypeString(dt, lower)// ZEROFILL implies UNSIGNED in MySQL storage; pingcap's Tp.String()// rendered both. Match that convention.@@ -182,10 +181,40 @@ func omniBuildColumnTypeString(dt *ast.DataType) string {return base}-// buildBaseTypeForm renders the type body (without UNSIGNED/ZEROFILL-// suffixes), applying MySQL canonical default precisions where the-// type family carries them. ENUM/SET use their value list as the body.-func buildBaseTypeForm(dt *ast.DataType, lower string) string {+// omniBuildCompactTypeString renders the type body in the+// CompactStr-equivalent form: type name + canonicalized length/scale+// (ENUM/SET value list) without UNSIGNED/ZEROFILL/charset suffixes.+// Matches pingcap's `column.Tp.CompactStr()` output and MySQL+// info_schema's non-attribute column-type rendering.+//+// Use this when comparing against:+// - User-provided blocklist/allowlist entries (column_type_disallow_list)+// - Pingcap CompactStr-equivalent fixture content+//+// For catalog comparison that needs UNSIGNED/ZEROFILL preservation,+// wrap with omniBuildColumnTypeString which appends the modifiers.+//+// The `lower` argument should be `strings.ToLower(dt.Name)` — callers+// often have it available already; passing in avoids re-computing.+//+// Length/scale rendering rules per type family (each verified+// empirically against pingcap's Tp.String()/CompactStr() during+// batch 11 + 12 pre-batch protocol):+//+// - **ENUM / SET:** value list as body.+// - **DECIMAL / NUMERIC / FIXED (exact-precision):** always (M,D),+// defaulting Scale=0; canonicalize the name to `decimal`.+// - **FLOAT / DOUBLE / REAL (approximate):** (M,D) only when Scale > 0;+// otherwise bare name (matches pingcap's precision-hint drop).+// - **Bare-form types with MySQL canonical defaults**: apply via+// `canonicalBareTypeForm` (INT → int(11), TINYINT → tinyint(4),+// BIT → bit(1), BINARY → binary(1), YEAR → year(4), BOOLEAN →+// tinyint(1), DECIMAL → decimal(10,0), …).+// - **All other types**: (Length) when Length > 0; bare name otherwise.+func omniBuildCompactTypeString(dt *ast.DataType, lower string) string {+ if dt == nil {+ return ""+ }switch {case isEnumOrSetTypeName(lower):return fmt.Sprintf("%s(%s)", lower, formatEnumValueList(dt.EnumValues))diff --git a/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type_test.go b/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type_test.goindex 342cbb9a97..325600dd70 100644--- a/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type_test.go+++ b/backend/plugin/advisor/tidb/advisor_column_disallow_changing_type_test.go@@ -11,11 +11,85 @@ package tidb// directly. No shared-mock-catalog cross-engine impact concern.import (+ "strings""testing""github.com/bytebase/omni/tidb/ast")+// TestOmniBuildCompactTypeString locks the CompactStr-equivalent+// rendering used by column_type_disallow_list. Codex round-1 catch on+// PR #20308 (Codex P1) flagged that the earlier omniDataTypeNameCompact+// rendering dropped length/literal/canonicalization information that+// pingcap's `column.Tp.CompactStr()` preserved — breaking user+// blocklist entries like "VARCHAR(255)" / "TINYINT(1)" / "ENUM('X','Y')".+// These tests pin the CompactStr-equivalent contract.+func TestOmniBuildCompactTypeString(t *testing.T) {+ cases := []struct {+ name string+ dt *ast.DataType+ want string+ }{+ // Bare-name types: pingcap CompactStr also renders bare.+ {"JSON", &ast.DataType{Name: "JSON"}, "json"},+ {"BLOB", &ast.DataType{Name: "BLOB"}, "blob"},+ {"DATE", &ast.DataType{Name: "DATE"}, "date"},+ // Length-bearing types: preserve length in CompactStr form.+ {"VARCHAR(255)", &ast.DataType{Name: "VARCHAR", Length: 255}, "varchar(255)"},+ {"CHAR(10)", &ast.DataType{Name: "CHAR", Length: 10}, "char(10)"},+ {"BINARY(16)", &ast.DataType{Name: "BINARY", Length: 16}, "binary(16)"},+ // Bare-form integer: canonical default width applied.+ {"INT bare → int(11)", &ast.DataType{Name: "INT"}, "int(11)"},+ {"TINYINT bare → tinyint(4)", &ast.DataType{Name: "TINYINT"}, "tinyint(4)"},+ {"SMALLINT bare → smallint(6)", &ast.DataType{Name: "SMALLINT"}, "smallint(6)"},+ {"MEDIUMINT bare → mediumint(9)", &ast.DataType{Name: "MEDIUMINT"}, "mediumint(9)"},+ {"BIGINT bare → bigint(20)", &ast.DataType{Name: "BIGINT"}, "bigint(20)"},+ {"BIT bare → bit(1)", &ast.DataType{Name: "BIT"}, "bit(1)"},+ {"BINARY bare → binary(1)", &ast.DataType{Name: "BINARY"}, "binary(1)"},+ {"YEAR bare → year(4)", &ast.DataType{Name: "YEAR"}, "year(4)"},+ // Specified integer length: preserved.+ {"TINYINT(1)", &ast.DataType{Name: "TINYINT", Length: 1}, "tinyint(1)"},+ {"INT(11)", &ast.DataType{Name: "INT", Length: 11}, "int(11)"},+ // Exact-decimal: canonicalize to decimal(M,D).+ {"DECIMAL bare → decimal(10,0)", &ast.DataType{Name: "DECIMAL"}, "decimal(10,0)"},+ {"DECIMAL(10)", &ast.DataType{Name: "DECIMAL", Length: 10}, "decimal(10,0)"},+ {"DECIMAL(10,2)", &ast.DataType{Name: "DECIMAL", Length: 10, Scale: 2}, "decimal(10,2)"},+ {"NUMERIC(10,2) → decimal", &ast.DataType{Name: "NUMERIC", Length: 10, Scale: 2}, "decimal(10,2)"},+ // Approximate float: drop precision hint when Scale=0.+ {"FLOAT bare", &ast.DataType{Name: "FLOAT"}, "float"},+ {"FLOAT(10) → float", &ast.DataType{Name: "FLOAT", Length: 10}, "float"},+ {"FLOAT(10,2)", &ast.DataType{Name: "FLOAT", Length: 10, Scale: 2}, "float(10,2)"},+ // ENUM/SET: value list as body.+ {"ENUM('x','y')", &ast.DataType{Name: "ENUM", EnumValues: []string{"x", "y"}}, "enum('x','y')"},+ {"SET('a','b')", &ast.DataType{Name: "SET", EnumValues: []string{"a", "b"}}, "set('a','b')"},+ // BOOLEAN canonicalizes to tinyint(1).+ {"BOOLEAN → tinyint(1)", &ast.DataType{Name: "BOOLEAN"}, "tinyint(1)"},+ // Crucially: CompactStr does NOT include UNSIGNED/ZEROFILL+ // modifiers, even when set on the DataType. The wrapper+ // omniBuildColumnTypeString appends those; the compact form+ // stays modifier-free (matches pingcap's CompactStr behavior:+ // `BIGINT UNSIGNED` → CompactStr "bigint(20)" — no UNSIGNED).+ {"BIGINT UNSIGNED → compact has no UNSIGNED", &ast.DataType{Name: "BIGINT", Unsigned: true}, "bigint(20)"},+ {"INT(11) UNSIGNED → compact has no UNSIGNED", &ast.DataType{Name: "INT", Length: 11, Unsigned: true}, "int(11)"},+ {"INT ZEROFILL → compact has no ZEROFILL", &ast.DataType{Name: "INT", Zerofill: true}, "int(11)"},+ // nil safety.+ {"nil", nil, ""},+ }++ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ lower := ""+ if tc.dt != nil {+ lower = strings.ToLower(tc.dt.Name)+ }+ got := omniBuildCompactTypeString(tc.dt, lower)+ if got != tc.want {+ t.Errorf("omniBuildCompactTypeString = %q, want %q", got, tc.want)+ }+ })+ }+}+func TestOmniBuildColumnTypeString(t *testing.T) {cases := []struct {name stringdiff --git a/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go b/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.goindex bb39280282..96e85314b6 100644--- a/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go+++ b/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go@@ -1,24 +1,20 @@package tidb-// Framework code is generated by the generator.-import ("context""fmt""strings"- "github.com/bytebase/bytebase/backend/plugin/advisor/code"-- "github.com/pingcap/tidb/pkg/parser/ast"+ "github.com/bytebase/omni/tidb/ast""github.com/bytebase/bytebase/backend/common"storepb "github.com/bytebase/bytebase/backend/generated-go/store""github.com/bytebase/bytebase/backend/plugin/advisor"+ "github.com/bytebase/bytebase/backend/plugin/advisor/code")var (_ advisor.Advisor = (*ColumnTypeDisallowListAdvisor)(nil)- _ ast.Visitor = (*columnTypeDisallowListChecker)(nil))func init() {@@ -31,8 +27,7 @@ type ColumnTypeDisallowListAdvisor struct {// Check checks for column type restriction.func (*ColumnTypeDisallowListAdvisor) Check(_ context.Context, checkCtx advisor.Context) ([]*storepb.Advice, error) {- stmtList, err := getTiDBNodes(checkCtx)-+ stmts, err := getTiDBOmniNodes(checkCtx)if err != nil {return nil, err}@@ -41,100 +36,93 @@ func (*ColumnTypeDisallowListAdvisor) Check(_ context.Context, checkCtx advisor.if err != nil {return nil, err}+ title := checkCtx.Rule.Type.String()stringArrayPayload := checkCtx.Rule.GetStringArrayPayload()- checker := &columnTypeDisallowListChecker{- level: level,- title: checkCtx.Rule.Type.String(),- typeRestriction: make(map[string]bool),- }+ typeRestriction := make(map[string]bool)for _, tp := range stringArrayPayload.List {- checker.typeRestriction[strings.ToUpper(tp)] = true- }-- for _, stmt := range stmtList {- checker.text = stmt.Text()- checker.line = stmt.OriginTextPosition()- (stmt).Accept(checker)+ typeRestriction[strings.ToUpper(tp)] = true}- return checker.adviceList, nil-}--type columnTypeDisallowListChecker struct {- adviceList []*storepb.Advice- level storepb.Advice_Status- title string- text string- line int- typeRestriction map[string]bool-}--type columnTypeData struct {- table string- column string- tp string- line int-}--// Enter implements the ast.Visitor interface.-func (checker *columnTypeDisallowListChecker) Enter(in ast.Node) (ast.Node, bool) {- var columnList []columnTypeData- switch node := in.(type) {- case *ast.CreateTableStmt:- for _, column := range node.Cols {- if _, exist := checker.typeRestriction[strings.ToUpper(column.Tp.CompactStr())]; exist {- columnList = append(columnList, columnTypeData{- table: node.Table.Name.O,- column: column.Name.Name.O,- tp: strings.ToUpper(column.Tp.CompactStr()),- line: column.OriginTextPosition(),- })+ var adviceList []*storepb.Advice+ for _, ostmt := range stmts {+ switch n := ostmt.Node.(type) {+ case *ast.CreateTableStmt:+ if n.Table == nil {+ continue}- }- case *ast.AlterTableStmt:- for _, spec := range node.Specs {- switch spec.Tp {- case ast.AlterTableAddColumns:- for _, column := range spec.NewColumns {- if _, exist := checker.typeRestriction[strings.ToUpper(column.Tp.CompactStr())]; exist {- columnList = append(columnList, columnTypeData{- table: node.Table.Name.O,- column: column.Name.Name.O,- tp: strings.ToUpper(column.Tp.CompactStr()),- line: node.OriginTextPosition(),- })- }+ tableName := n.Table.Name+ for _, column := range n.Columns {+ if column == nil {+ continue}- case ast.AlterTableChangeColumn, ast.AlterTableModifyColumn:- column := spec.NewColumns[0]- if _, exist := checker.typeRestriction[strings.ToUpper(column.Tp.CompactStr())]; exist {- columnList = append(columnList, columnTypeData{- table: node.Table.Name.O,- column: column.Name.Name.O,- tp: strings.ToUpper(column.Tp.CompactStr()),- line: node.OriginTextPosition(),- })+ if advice := checkColumnTypeDisallow(typeRestriction, level, title, tableName, column, ostmt.AbsoluteLine(column.Loc.Start)); advice != nil {+ adviceList = append(adviceList, advice)+ }+ }+ case *ast.AlterTableStmt:+ if n.Table == nil {+ continue+ }+ tableName := n.Table.Name+ stmtLine := ostmt.AbsoluteLine(n.Loc.Start)+ for _, cmd := range n.Commands {+ if cmd == nil {+ continue+ }+ switch cmd.Type {+ case ast.ATAddColumn:+ for _, column := range addColumnTargets(cmd) {+ if column == nil {+ continue+ }+ if advice := checkColumnTypeDisallow(typeRestriction, level, title, tableName, column, stmtLine); advice != nil {+ adviceList = append(adviceList, advice)+ }+ }+ case ast.ATChangeColumn, ast.ATModifyColumn:+ if cmd.Column == nil {+ continue+ }+ if advice := checkColumnTypeDisallow(typeRestriction, level, title, tableName, cmd.Column, stmtLine); advice != nil {+ adviceList = append(adviceList, advice)+ }+ default:}- default:}+ default:}- default:- }-- for _, column := range columnList {- checker.adviceList = append(checker.adviceList, &storepb.Advice{- Status: checker.level,- Code: code.DisabledColumnType.Int32(),- Title: checker.title,- Content: fmt.Sprintf("Disallow column type %s but column `%s`.`%s` is", column.tp, column.table, column.column),- StartPosition: common.ConvertANTLRLineToPosition(column.line),- })}- return in, false+ return adviceList, nil}-// Leave implements the ast.Visitor interface.-func (*columnTypeDisallowListChecker) Leave(in ast.Node) (ast.Node, bool) {- return in, true+// checkColumnTypeDisallow returns an advice if the column's rendered+// type is in the user-supplied blocklist, or nil if not.+//+// Uses omniBuildCompactTypeString — the CompactStr-equivalent — to+// match the pre-migration pingcap behavior. Pingcap's+// `column.Tp.CompactStr()` rendered length, scale, and ENUM/SET+// literals (e.g. "varchar(255)", "enum('x','y')", "tinyint(1)"),+// applied canonical defaults to bare integer forms ("int" →+// "int(11)"), and canonicalized aliases ("BOOLEAN" → "tinyint(1)").+// A user blocklist of ["VARCHAR(255)"] matched VARCHAR(255) columns+// exactly; a blocklist of ["JSON"] matched JSON columns. The earlier+// commit on this PR used omniDataTypeNameCompact (bare lowercase+// Name only), which silently broke length/literal blocklist entries+// — Codex P1 catch.+func checkColumnTypeDisallow(typeRestriction map[string]bool, level storepb.Advice_Status, title, tableName string, col *ast.ColumnDef, line int) *storepb.Advice {+ if col.TypeName == nil {+ return nil+ }+ columnType := strings.ToUpper(omniBuildCompactTypeString(col.TypeName, strings.ToLower(col.TypeName.Name)))+ if !typeRestriction[columnType] {+ return nil+ }+ return &storepb.Advice{+ Status: level,+ Code: code.DisabledColumnType.Int32(),+ Title: title,+ Content: fmt.Sprintf("Disallow column type %s but column `%s`.`%s` is", columnType, tableName, col.Name),+ StartPosition: common.ConvertANTLRLineToPosition(line),+ }}diff --git a/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go b/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.goindex d9872a707e..6da4b330e0 100644--- a/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go+++ b/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go@@ -1,13 +1,11 @@package tidb-// Framework code is generated by the generator.-import ("context""fmt""regexp"- "github.com/pingcap/tidb/pkg/parser/ast"+ "github.com/bytebase/omni/tidb/ast""github.com/pkg/errors""github.com/bytebase/bytebase/backend/common"@@ -18,7 +16,6 @@ import (var (_ advisor.Advisor = (*NamingAutoIncrementColumnAdvisor)(nil)- _ ast.Visitor = (*namingAutoIncrementColumnChecker)(nil))func init() {@@ -31,8 +28,7 @@ type NamingAutoIncrementColumnAdvisor struct {// Check checks for auto-increment naming convention.func (*NamingAutoIncrementColumnAdvisor) Check(_ context.Context, checkCtx advisor.Context) ([]*storepb.Advice, error) {- stmtList, err := getTiDBNodes(checkCtx)-+ stmts, err := getTiDBOmniNodes(checkCtx)if err != nil {return nil, err}@@ -45,125 +41,45 @@ func (*NamingAutoIncrementColumnAdvisor) Check(_ context.Context, checkCtx advisif namingPayload == nil {return nil, errors.New("naming_payload is required for this rule")}-format, err := regexp.Compile(namingPayload.Format)if err != nil {return nil, errors.Wrapf(err, "failed to compile regex format %q", namingPayload.Format)}-maxLength := int(namingPayload.MaxLength)if maxLength == 0 {maxLength = advisor.DefaultNameLengthLimit}- checker := &namingAutoIncrementColumnChecker{- level: level,- title: checkCtx.Rule.Type.String(),- format: format,- maxLength: maxLength,- }-- for _, stmt := range stmtList {- checker.text = stmt.Text()- checker.line = stmt.OriginTextPosition()- (stmt).Accept(checker)- }-- return checker.adviceList, nil-}--type namingAutoIncrementColumnChecker struct {- adviceList []*storepb.Advice- level storepb.Advice_Status- title string- text string- line int- format *regexp.Regexp- maxLength int-}--// Enter implements the ast.Visitor interface.-func (checker *namingAutoIncrementColumnChecker) Enter(in ast.Node) (ast.Node, bool) {- type columnData struct {- name string- line int- }- var columnList []columnData- var tableName string- switch node := in.(type) {- // CREATE TABLE- case *ast.CreateTableStmt:- tableName = node.Table.Name.O- for _, column := range node.Cols {- if isAutoIncrement(column) {- columnList = append(columnList, columnData{- name: column.Name.Name.O,- line: column.OriginTextPosition(),+ title := checkCtx.Rule.Type.String()++ var adviceList []*storepb.Advice+ for _, ostmt := range stmts {+ cols := collectColumnViolations(ostmt, func(col *ast.ColumnDef) bool {+ return col != nil && col.AutoIncrement+ })+ // Each AUTO_INCREMENT column may produce TWO advices (format+ // mismatch + length overflow). Pingcap-typed predecessor emitted+ // both independently per column — preserve.+ for _, col := range cols {+ if !format.MatchString(col.column) {+ adviceList = append(adviceList, &storepb.Advice{+ Status: level,+ Code: code.NamingAutoIncrementColumnConventionMismatch.Int32(),+ Title: title,+ Content: fmt.Sprintf("`%s`.`%s` mismatches auto_increment column naming convention, naming format should be %q", col.table, col.column, format),+ StartPosition: common.ConvertANTLRLineToPosition(col.line),})}- }- // ALTER TABLE- case *ast.AlterTableStmt:- tableName = node.Table.Name.O- for _, spec := range node.Specs {- switch spec.Tp {- // ADD COLUMNS- case ast.AlterTableAddColumns:- for _, column := range spec.NewColumns {- if isAutoIncrement(column) {- columnList = append(columnList, columnData{- name: column.Name.Name.O,- line: in.OriginTextPosition(),- })- }- }- // CHANGE COLUMN/MODIFY COLUMN- case ast.AlterTableChangeColumn, ast.AlterTableModifyColumn:- if isAutoIncrement(spec.NewColumns[0]) {- columnList = append(columnList, columnData{- name: spec.NewColumns[0].Name.Name.O,- line: in.OriginTextPosition(),- })- }- default:+ if maxLength > 0 && len(col.column) > maxLength {+ adviceList = append(adviceList, &storepb.Advice{+ Status: level,+ Code: code.NamingAutoIncrementColumnConventionMismatch.Int32(),+ Title: title,+ Content: fmt.Sprintf("`%s`.`%s` mismatches auto_increment column naming convention, its length should be within %d characters", col.table, col.column, maxLength),+ StartPosition: common.ConvertANTLRLineToPosition(col.line),+ })}}- default:- }-- for _, column := range columnList {- if !checker.format.MatchString(column.name) {- checker.adviceList = append(checker.adviceList, &storepb.Advice{- Status: checker.level,- Code: code.NamingAutoIncrementColumnConventionMismatch.Int32(),- Title: checker.title,- Content: fmt.Sprintf("`%s`.`%s` mismatches auto_increment column naming convention, naming format should be %q", tableName, column.name, checker.format),- StartPosition: common.ConvertANTLRLineToPosition(column.line),- })- }- if checker.maxLength > 0 && len(column.name) > checker.maxLength {- checker.adviceList = append(checker.adviceList, &storepb.Advice{- Status: checker.level,- Code: code.NamingAutoIncrementColumnConventionMismatch.Int32(),- Title: checker.title,- Content: fmt.Sprintf("`%s`.`%s` mismatches auto_increment column naming convention, its length should be within %d characters", tableName, column.name, checker.maxLength),- StartPosition: common.ConvertANTLRLineToPosition(column.line),- })- }}- return in, false-}--// Leave implements the ast.Visitor interface.-func (*namingAutoIncrementColumnChecker) Leave(in ast.Node) (ast.Node, bool) {- return in, true-}--func isAutoIncrement(column *ast.ColumnDef) bool {- for _, option := range column.Options {- if option.Tp == ast.ColumnOptionAutoIncrement {- return true- }- }- return false+ return adviceList, nil}diff --git a/backend/plugin/advisor/tidb/test/column_type_disallow_list.yaml b/backend/plugin/advisor/tidb/test/column_type_disallow_list.yamlindex 4bf03d6d10..52ab9fdff9 100644--- a/backend/plugin/advisor/tidb/test/column_type_disallow_list.yaml+++ b/backend/plugin/advisor/tidb/test/column_type_disallow_list.yaml@@ -37,3 +37,13 @@line: 2column: 0endposition: null+# Bare-name no-flag pin (batch 12 / Codex P1): user blocklist ["JSON",+# "BINARY_FLOAT"] does NOT contain "BLOB", "VARCHAR", "VARCHAR(255)",+# etc. CompactStr-equivalent rendering renders e.g. VARCHAR(255) as+# "varchar(255)" — the blocklist would need exactly "VARCHAR(255)" to+# match. The earlier batch-12 commit rendered bare "VARCHAR" which+# would have caused the inverse drift (matching a "VARCHAR" entry+# against a VARCHAR(255) column). Confirms no-flag for non-blocklist+# types regardless of length-bearing form.+- statement: CREATE TABLE t(a VARCHAR(255), b BLOB, c TINYINT(1))+ changeType: 1