Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(plan): use contains for title filters and dedupe locale keys (#19836)

p0nyb17a7b1a0148
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 4f3ae22b29..a38f3b3a9d 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -13164,7 +13164,7 @@ components:
- create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
- has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
- has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
- spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
- state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
@@ -13172,7 +13172,7 @@ components:
creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
has_rollout == false && has_issue == true
title == "My Plan"
- title.matches("database migration")
+ title.contains("database migration")
spec_type == "change_database_config"
state == "ACTIVE"
title: ListPlansRequest
diff --git a/backend/generated-go/v1/plan_service.pb.go b/backend/generated-go/v1/plan_service.pb.go
index da8bd21c80..fcb1923453 100644
--- a/backend/generated-go/v1/plan_service.pb.go
+++ b/backend/generated-go/v1/plan_service.pb.go
@@ -203,7 +203,7 @@ type ListPlansRequest struct {
// - create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
// - has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
// - has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- // - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ // - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
// - spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
// - state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
//
@@ -211,7 +211,7 @@ type ListPlansRequest struct {
// creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
// has_rollout == false && has_issue == true
// title == "My Plan"
- // title.matches("database migration")
+ // title.contains("database migration")
// spec_type == "change_database_config"
// state == "ACTIVE"
Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`
diff --git a/backend/store/plan.go b/backend/store/plan.go
index 5e33fec019..eca23bd5cd 100644
--- a/backend/store/plan.go
+++ b/backend/store/plan.go
@@ -383,7 +383,7 @@ func GetListPlanFilter(filter string) (*qb.Query, error) {
return qb.Q().Space("plan.created_at >= ?", t), nil
}
return qb.Q().Space("plan.created_at <= ?", t), nil
- case celoverloads.Matches:
+ case celoverloads.Contains:
variable := expr.AsCall().Target().AsIdent()
args := expr.AsCall().Args()
if len(args) != 1 {
@@ -400,7 +400,7 @@ func GetListPlanFilter(filter string) (*qb.Query, error) {
case "title":
return qb.Q().Space("LOWER(plan.name) LIKE ?", "%"+strValue+"%"), nil
default:
- return nil, errors.Errorf(`only "title" supports %q operator, but found %q`, celoverloads.Matches, variable)
+ return nil, errors.Errorf(`only "title" supports %q operator, but found %q`, celoverloads.Contains, variable)
}
default:
return nil, errors.Errorf("unsupported function %v", functionName)
diff --git a/backend/store/plan_filter_test.go b/backend/store/plan_filter_test.go
index 237ef63a5d..088d093ad9 100644
--- a/backend/store/plan_filter_test.go
+++ b/backend/store/plan_filter_test.go
@@ -60,8 +60,14 @@ func TestGetListPlanFilter(t *testing.T) {
wantErr: false,
},
{
- name: "title matches",
- filter: `title.matches("test")`,
+ name: "title matches is unsupported",
+ filter: `title.matches("test")`,
+ wantErr: true,
+ errContains: "unsupported function matches",
+ },
+ {
+ name: "title contains",
+ filter: `title.contains("test")`,
wantSQL: "(LOWER(plan.name) LIKE $1)",
wantArgs: []any{"%test%"},
wantErr: false,
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 88da54749a..3576ac3a3b 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -115,7 +115,6 @@
"Default": "Default",
"definition": "Definition",
"empty": "Empty",
- "creating": "Creating...",
"address": "Address",
"created": "Created",
"labels": "Labels",
@@ -262,8 +261,6 @@
"deploying": "Deploying",
"in-review": "In Review",
"done": "Done",
- "canceled": "canceled",
- "recent": "Recent",
"and": "and",
"import": "Import",
"hard-delete": {
diff --git a/frontend/src/store/modules/v1/plan.ts b/frontend/src/store/modules/v1/plan.ts
index ec2edf49da..1ffd9edd2c 100644
--- a/frontend/src/store/modules/v1/plan.ts
+++ b/frontend/src/store/modules/v1/plan.ts
@@ -31,7 +31,7 @@ export interface PlanFind {
export const buildPlanFilter = (find: PlanFind): string => {
const filter: string[] = [];
if (find.query) {
- filter.push(`title.matches("${find.query.trim().toLowerCase()}")`);
+ filter.push(`title.contains("${find.query.trim().toLowerCase()}")`);
}
if (find.creator) {
filter.push(`creator == "${find.creator}"`);
diff --git a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
index eadb5021ea..491d7955c9 100644
--- a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
@@ -77,7 +77,7 @@ export declare type ListPlansRequest = Message<"bytebase.v1.ListPlansRequest"> &
* - create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
* - has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
* - has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- * - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ * - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
* - spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
* - state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
*
@@ -85,7 +85,7 @@ export declare type ListPlansRequest = Message<"bytebase.v1.ListPlansRequest"> &
* creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
* has_rollout == false && has_issue == true
* title == "My Plan"
- * title.matches("database migration")
+ * title.contains("database migration")
* spec_type == "change_database_config"
* state == "ACTIVE"
*
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 70a8953ad4..59c02c8106 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -8993,7 +8993,7 @@ paths:
- create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
- has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
- has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
- spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
- state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
@@ -9001,7 +9001,7 @@ paths:
creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
has_rollout == false && has_issue == true
title == "My Plan"
- title.matches("database migration")
+ title.contains("database migration")
spec_type == "change_database_config"
state == "ACTIVE"
schema:
@@ -9016,7 +9016,7 @@ paths:
- create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
- has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
- has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
- spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
- state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
@@ -9024,7 +9024,7 @@ paths:
creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
has_rollout == false && has_issue == true
title == "My Plan"
- title.matches("database migration")
+ title.contains("database migration")
spec_type == "change_database_config"
state == "ACTIVE"
responses:
@@ -22388,7 +22388,7 @@ components:
- create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
- has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
- has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
- spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
- state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
@@ -22396,7 +22396,7 @@ components:
creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
has_rollout == false && has_issue == true
title == "My Plan"
- title.matches("database migration")
+ title.contains("database migration")
spec_type == "change_database_config"
state == "ACTIVE"
title: ListPlansRequest
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 2cf3e1a435..e3353c7183 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -8742,9 +8742,9 @@ SQLService executes SQL queries and manages query operations.
When paginating, all other parameters provided to `ListPlans` must match the call that provided the page token. |
| filter | [string](#string) | | Filter is used to filter plans returned in the list. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-Supported filters: - creator: the plan creator full name in &#34;users/{email or id}&#34; format, support &#34;==&#34; operator. - create_time: the plan create time in &#34;2006-01-02T15:04:05Z07:00&#34; format, support &#34;&gt;=&#34; or &#34;&lt;=&#34; operator. - has_rollout: whether the plan has rollout, support &#34;==&#34; operator, the value should be &#34;true&#34; or &#34;false&#34;. - has_issue: the plan has issue or not, support &#34;==&#34; operator, the value should be &#34;true&#34; or &#34;false&#34;. - title: the plan title, support &#34;==&#34; operator for exact match and &#34;.matches()&#34; operator for case-insensitive substring match. - spec_type: the plan spec config type, support &#34;==&#34; operator, the value should be &#34;create_database_config&#34;, &#34;change_database_config&#34;, or &#34;export_data_config&#34;. - state: the plan state, support &#34;==&#34; operator, the value should be &#34;ACTIVE&#34; or &#34;DELETED&#34;.
+Supported filters: - creator: the plan creator full name in &#34;users/{email or id}&#34; format, support &#34;==&#34; operator. - create_time: the plan create time in &#34;2006-01-02T15:04:05Z07:00&#34; format, support &#34;&gt;=&#34; or &#34;&lt;=&#34; operator. - has_rollout: whether the plan has rollout, support &#34;==&#34; operator, the value should be &#34;true&#34; or &#34;false&#34;. - has_issue: the plan has issue or not, support &#34;==&#34; operator, the value should be &#34;true&#34; or &#34;false&#34;. - title: the plan title, support &#34;==&#34; operator for exact match and &#34;.contains()&#34; operator for case-insensitive substring match. - spec_type: the plan spec config type, support &#34;==&#34; operator, the value should be &#34;create_database_config&#34;, &#34;change_database_config&#34;, or &#34;export_data_config&#34;. - state: the plan state, support &#34;==&#34; operator, the value should be &#34;ACTIVE&#34; or &#34;DELETED&#34;.
-For example: creator == &#34;users/[email protected]&#34; &amp;&amp; create_time &gt;= &#34;2025-01-02T15:04:05Z07:00&#34; has_rollout == false &amp;&amp; has_issue == true title == &#34;My Plan&#34; title.matches(&#34;database migration&#34;) spec_type == &#34;change_database_config&#34; state == &#34;ACTIVE&#34; |
+For example: creator == &#34;users/[email protected]&#34; &amp;&amp; create_time &gt;= &#34;2025-01-02T15:04:05Z07:00&#34; has_rollout == false &amp;&amp; has_issue == true title == &#34;My Plan&#34; title.contains(&#34;database migration&#34;) spec_type == &#34;change_database_config&#34; state == &#34;ACTIVE&#34; |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index b466ec7527..08f65e673d 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -24602,7 +24602,7 @@ Supported filters:
- create_time: the plan create time in &#34;2006-01-02T15:04:05Z07:00&#34; format, support &#34;&gt;=&#34; or &#34;&lt;=&#34; operator.
- has_rollout: whether the plan has rollout, support &#34;==&#34; operator, the value should be &#34;true&#34; or &#34;false&#34;.
- has_issue: the plan has issue or not, support &#34;==&#34; operator, the value should be &#34;true&#34; or &#34;false&#34;.
-- title: the plan title, support &#34;==&#34; operator for exact match and &#34;.matches()&#34; operator for case-insensitive substring match.
+- title: the plan title, support &#34;==&#34; operator for exact match and &#34;.contains()&#34; operator for case-insensitive substring match.
- spec_type: the plan spec config type, support &#34;==&#34; operator, the value should be &#34;create_database_config&#34;, &#34;change_database_config&#34;, or &#34;export_data_config&#34;.
- state: the plan state, support &#34;==&#34; operator, the value should be &#34;ACTIVE&#34; or &#34;DELETED&#34;.
@@ -24610,7 +24610,7 @@ For example:
creator == &#34;users/[email protected]&#34; &amp;&amp; create_time &gt;= &#34;2025-01-02T15:04:05Z07:00&#34;
has_rollout == false &amp;&amp; has_issue == true
title == &#34;My Plan&#34;
-title.matches(&#34;database migration&#34;)
+title.contains(&#34;database migration&#34;)
spec_type == &#34;change_database_config&#34;
state == &#34;ACTIVE&#34; </p></td>
</tr>
diff --git a/proto/v1/v1/plan_service.proto b/proto/v1/v1/plan_service.proto
index 9fedc18dd8..1f6d3d076c 100644
--- a/proto/v1/v1/plan_service.proto
+++ b/proto/v1/v1/plan_service.proto
@@ -137,7 +137,7 @@ message ListPlansRequest {
// - create_time: the plan create time in "2006-01-02T15:04:05Z07:00" format, support ">=" or "<=" operator.
// - has_rollout: whether the plan has rollout, support "==" operator, the value should be "true" or "false".
// - has_issue: the plan has issue or not, support "==" operator, the value should be "true" or "false".
- // - title: the plan title, support "==" operator for exact match and ".matches()" operator for case-insensitive substring match.
+ // - title: the plan title, support "==" operator for exact match and ".contains()" operator for case-insensitive substring match.
// - spec_type: the plan spec config type, support "==" operator, the value should be "create_database_config", "change_database_config", or "export_data_config".
// - state: the plan state, support "==" operator, the value should be "ACTIVE" or "DELETED".
//
@@ -145,7 +145,7 @@ message ListPlansRequest {
// creator == "users/[email protected]" && create_time >= "2025-01-02T15:04:05Z07:00"
// has_rollout == false && has_issue == true
// title == "My Plan"
- // title.matches("database migration")
+ // title.contains("database migration")
// spec_type == "change_database_config"
// state == "ACTIVE"
string filter = 4;