Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(project): make BatchDeleteProjects purge atomic (T18c-i) (#21314)
Danny Xufdd4956b1abe
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex 03d5980b97..cf9d7ff20c 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -412,7 +412,7 @@ func (s *ProjectService) DeleteProject(ctx context.Context, req *connect.Request}// Permanently delete the project and all related resources (moves databases to default project)- if err := s.store.DeleteProject(ctx, project.Workspace, project.ResourceID); err != nil {+ if err := s.store.DeleteProjects(ctx, project.Workspace, project.ResourceID); err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to purge project"))}@@ -491,16 +491,25 @@ func (s *ProjectService) BatchDeleteProjects(ctx context.Context, request *conne}}- // Permanently delete all projects (moves databases to default project)+ // Sample cleanup runs first and outside the purge transaction because it+ // releases resources outside the metadata database that no rollback can+ // restore. It leaves the project rows untouched, so a failure here still+ // purges nothing.+ resourceIDs := make([]string, 0, len(projectsToPurge))for _, project := range projectsToPurge {if s.sampleManager != nil {if err := s.sampleManager.HandleProjectPurge(ctx, project.Workspace, project.ResourceID); err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to clean up sample project %q", project.Title))}}- if err := s.store.DeleteProject(ctx, project.Workspace, project.ResourceID); err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to purge project %q", project.Title))- }+ resourceIDs = append(resourceIDs, project.ResourceID)+ }++ // Permanently delete all projects in one transaction (moves databases to+ // default project), so a failure partway leaves every project intact+ // instead of irreversibly purging the ones already reached.+ if err := s.store.DeleteProjects(ctx, common.GetWorkspaceIDFromContext(ctx), resourceIDs...); err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to purge projects"))}return connect.NewResponse(&emptypb.Empty{}), nil}diff --git a/backend/store/instance_project_test.go b/backend/store/instance_project_test.goindex 1ee49b7f1a..c9172b16f9 100644--- a/backend/store/instance_project_test.go+++ b/backend/store/instance_project_test.go@@ -180,7 +180,7 @@ func TestDeleteProjectDeletesProjectInstancesAndKeepsWorkspaceInstanceDatabases(`)require.NoError(t, err)- require.NoError(t, s.DeleteProject(ctx, "default", "project-a"))+ require.NoError(t, s.DeleteProjects(ctx, "default", "project-a"))var projectInstanceCount, projectDatabaseCount intrequire.NoError(t, db.QueryRowContext(ctx, `diff --git a/backend/store/project.go b/backend/store/project.goindex 58d590bbe7..5a4120a93b 100644--- a/backend/store/project.go+++ b/backend/store/project.go@@ -4,6 +4,7 @@ import ("context"stdsql "database/sql""fmt"+ "slices""strings""github.com/google/cel-go/cel"@@ -275,7 +276,10 @@ func (s *Store) UpdateProjects(ctx context.Context, patches ...*UpdateProjectMesreturn nil}- // Remove all projects from cache first+ // Evict on both sides of the write. Before, so no reader can be served a+ // cache hit carrying the pre-update row once the write commits; after, so a+ // reader that refilled the cache from the pre-update row during the write+ // does not leave that entry behind it.for _, patch := range patches {s.removeProjectCache(patch.ResourceID)}@@ -318,6 +322,17 @@ func (s *Store) UpdateProjects(ctx context.Context, patches ...*UpdateProjectMesreturn err}+ // The second eviction: see the comment above. Project settings gate+ // authorization — AllowLastPlanEditorApproval decides who may approve — so a+ // stale entry reads as a revoked permission still being granted. One+ // narrower window survives both evictions: a reader whose row read began+ // before the commit and whose cache fill lands after this line. Closing it+ // needs the cache to track a generation per key, which is more machinery+ // than the exposure warrants.+ for _, patch := range patches {+ s.removeProjectCache(patch.ResourceID)+ }+return nil}@@ -350,21 +365,21 @@ type projectSchemaCacheKey struct {}// captureProjectDescendantCacheKeys reads the cache keys of every descendant-// row that DeleteProject will delete (project instances and their databases+// row that DeleteProjects will delete (project instances and their databases// and schemas) or reassign (workspace-instance databases owned by the-// project). It must run inside the purge transaction before any of those rows+// projects). It must run inside the purge transaction before any of those rows// are removed.-func captureProjectDescendantCacheKeys(ctx context.Context, tx *stdsql.Tx, projectID string) (*projectDescendantCacheKeys, error) {+func captureProjectDescendantCacheKeys(ctx context.Context, tx *stdsql.Tx, projectIDs []string) (*projectDescendantCacheKeys, error) {keys := &projectDescendantCacheKeys{}rows, err := tx.QueryContext(ctx, `SELECT resource_idFROM instance- WHERE project = $1+ WHERE project = ANY($1)ORDER BY resource_id- `, projectID)+ `, projectIDs)if err != nil {- return nil, errors.Wrapf(err, "failed to capture project instance cache keys for project %s", projectID)+ return nil, errors.Wrapf(err, "failed to capture project instance cache keys for projects %s", strings.Join(projectIDs, ", "))}defer rows.Close()for rows.Next() {@@ -382,11 +397,11 @@ func captureProjectDescendantCacheKeys(ctx context.Context, tx *stdsql.Tx, projeSELECT db.instance, db.name, instance.workspaceFROM dbJOIN instance ON instance.resource_id = db.instance- WHERE instance.project = $1 OR db.project = $1+ WHERE instance.project = ANY($1) OR db.project = ANY($1)ORDER BY db.instance, db.name- `, projectID)+ `, projectIDs)if err != nil {- return nil, errors.Wrapf(err, "failed to capture project database cache keys for project %s", projectID)+ return nil, errors.Wrapf(err, "failed to capture project database cache keys for projects %s", strings.Join(projectIDs, ", "))}defer rows.Close()for rows.Next() {@@ -404,11 +419,11 @@ func captureProjectDescendantCacheKeys(ctx context.Context, tx *stdsql.Tx, projeSELECT db_schema.instance, db_schema.db_nameFROM db_schemaJOIN instance ON instance.resource_id = db_schema.instance- WHERE instance.project = $1+ WHERE instance.project = ANY($1)ORDER BY db_schema.instance, db_schema.db_name- `, projectID)+ `, projectIDs)if err != nil {- return nil, errors.Wrapf(err, "failed to capture project schema cache keys for project %s", projectID)+ return nil, errors.Wrapf(err, "failed to capture project schema cache keys for projects %s", strings.Join(projectIDs, ", "))}defer rows.Close()for rows.Next() {@@ -426,9 +441,9 @@ func captureProjectDescendantCacheKeys(ctx context.Context, tx *stdsql.Tx, proje}// removeProjectDescendantCaches invalidates the captured descendant cache-// entries and the project entry itself. It must only run after the purge+// entries and the project entries themselves. It must only run after the purge// transaction commits; a failed purge must not publish invalidation.-func (s *Store) removeProjectDescendantCaches(keys *projectDescendantCacheKeys, projectID string) {+func (s *Store) removeProjectDescendantCaches(keys *projectDescendantCacheKeys, projectIDs []string) {for _, instanceID := range keys.instanceIDs {s.instanceCache.Remove(getInstanceCacheKey(instanceID))}@@ -440,15 +455,23 @@ func (s *Store) removeProjectDescendantCaches(keys *projectDescendantCacheKeys,for _, key := range keys.schemas {s.dbSchemaCache.Remove(getDBSchemaCacheKey(key.instanceID, key.databaseName))}- s.projectCache.Remove(projectID)+ for _, projectID := range projectIDs {+ s.projectCache.Remove(projectID)+ }}-// DeleteProject permanently purges a soft-deleted project and all related resources.-// This operation is irreversible and should only be used for:+// DeleteProjects permanently purges soft-deleted projects and all related+// resources in one transaction, so a batch either removes every named project+// or leaves them all intact. This is irreversible and should only be used for:// - Administrative cleanup of old soft-deleted projects// - Test cleanup// Following AIP-164/165, this only works on projects where deleted = TRUE.-func (s *Store) DeleteProject(ctx context.Context, workspace string, resourceID string) error {+func (s *Store) DeleteProjects(ctx context.Context, workspace string, resourceIDs ...string) error {+ if len(resourceIDs) == 0 {+ return nil+ }+ projectList := strings.Join(resourceIDs, ", ")+defaultProjectID, err := s.GetDefaultProjectID(ctx, workspace)if err != nil {return errors.Wrap(err, "failed to get default project ID")@@ -462,31 +485,36 @@ func (s *Store) DeleteProject(ctx context.Context, workspace string, resourceID// Capture descendant cache keys before any descendant rows are removed so// the post-commit invalidation is precise and does not require re-reading// rows that no longer exist.- cacheKeys, err := captureProjectDescendantCacheKeys(ctx, tx, resourceID)+ cacheKeys, err := captureProjectDescendantCacheKeys(ctx, tx, resourceIDs)if err != nil {return errors.Wrap(err, "failed to capture project descendant cache keys")}// Delete query history before database-scoped rows.- q := qb.Q().Space("DELETE FROM query_history WHERE project = ?", resourceID)+ q := qb.Q().Space("DELETE FROM query_history WHERE project = ANY(?)", resourceIDs)sql, args, err := q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build query_history delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete query_history for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete query_history for projects %s", projectList)}- // Delete policy entries that reference this project.+ // Delete policy entries that reference these projects. Policy rows name the+ // project by resource name, not by ID.+ policyResources := make([]string, 0, len(resourceIDs))+ for _, resourceID := range resourceIDs {+ policyResources = append(policyResources, common.FormatProject(resourceID))+ }q = qb.Q().Space("DELETE FROM policy")- q.Space("WHERE (resource_type = ? AND resource = 'projects/' || ?)", storepb.Policy_PROJECT.String(), resourceID)+ q.Space("WHERE (resource_type = ? AND resource = ANY(?))", storepb.Policy_PROJECT.String(), policyResources)q.And("workspace = ?", workspace)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build policy delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete policy for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete policy for projects %s", projectList)}// Delete star rows before their parents, in full primary-key order: stars@@ -496,162 +524,72 @@ func (s *Store) DeleteProject(ctx context.Context, workspace string, resourceIDWHERE (saved_query, principal) IN (SELECT saved_query, principalFROM saved_query_star- WHERE principal IN (SELECT email FROM service_account WHERE project = ? AND workspace = ?)- OR principal IN (SELECT email FROM workload_identity WHERE project = ? AND workspace = ?)+ WHERE principal IN (SELECT email FROM service_account WHERE project = ANY(?) AND workspace = ?)+ OR principal IN (SELECT email FROM workload_identity WHERE project = ANY(?) AND workspace = ?)OR saved_query IN (SELECT resource_id FROM saved_query- WHERE creator IN (SELECT email FROM service_account WHERE project = ? AND workspace = ?)- OR creator IN (SELECT email FROM workload_identity WHERE project = ? AND workspace = ?)+ WHERE creator IN (SELECT email FROM service_account WHERE project = ANY(?) AND workspace = ?)+ OR creator IN (SELECT email FROM workload_identity WHERE project = ANY(?) AND workspace = ?))- )`, resourceID, workspace, resourceID, workspace, resourceID, workspace, resourceID, workspace)+ )`, resourceIDs, workspace, resourceIDs, workspace, resourceIDs, workspace, resourceIDs, workspace)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build saved_query_star delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete saved_query_star for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete saved_query_star for projects %s", projectList)}// Delete saved queries created by project service accounts or workload identities.q = qb.Q().Space(`DELETE FROM saved_query- WHERE creator IN (SELECT email FROM service_account WHERE project = ? AND workspace = ?)- OR creator IN (SELECT email FROM workload_identity WHERE project = ? AND workspace = ?)`, resourceID, workspace, resourceID, workspace)+ WHERE creator IN (SELECT email FROM service_account WHERE project = ANY(?) AND workspace = ?)+ OR creator IN (SELECT email FROM workload_identity WHERE project = ANY(?) AND workspace = ?)`, resourceIDs, workspace, resourceIDs, workspace)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build saved query delete query for principals")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete saved queries for project principals %s", resourceID)+ return errors.Wrapf(err, "failed to delete saved queries for project principals %s", projectList)}- // Reassign remaining saved queries associated with this project.- q = qb.Q().Space("UPDATE saved_query SET project = ? WHERE project = ?", defaultProjectID, resourceID)+ // Reassign remaining saved queries associated with these projects.+ q = qb.Q().Space("UPDATE saved_query SET project = ? WHERE project = ANY(?)", defaultProjectID, resourceIDs)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build saved query update query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to update saved queries for project %s", resourceID)- }-- // Delete issue_comment entries for issues in this project- q = qb.Q().Space("DELETE FROM issue_comment WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build issue_comment delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete issue_comment for project %s", resourceID)- }-- // Delete review_run entries for issues in this project- q = qb.Q().Space("DELETE FROM review_run WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build review_run delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete review_run for project %s", resourceID)- }-- // Delete issues associated with this project- q = qb.Q().Space("DELETE FROM issue WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build issue delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete issues for project %s", resourceID)- }-- // Delete plan_webhook_delivery entries for plans in this project- q = qb.Q().Space("DELETE FROM plan_webhook_delivery WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build plan_webhook_delivery delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete plan_webhook_delivery for project %s", resourceID)- }-- // Delete plan_check_run entries for plans in this project- q = qb.Q().Space("DELETE FROM plan_check_run WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build plan_check_run delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete plan_check_run for project %s", resourceID)- }-- // Delete task_run_log entries for tasks in plans of this project- q = qb.Q().Space("DELETE FROM task_run_log WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build task_run_log delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete task_run_log for project %s", resourceID)- }-- // Delete task_run entries for tasks in plans of this project- q = qb.Q().Space("DELETE FROM task_run WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build task_run delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete task_run for project %s", resourceID)- }-- // Delete tasks in plans of this project.- q = qb.Q().Space("DELETE FROM task WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build task delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete tasks for project %s", resourceID)- }-- // Delete plans associated with this project- q = qb.Q().Space("DELETE FROM plan WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build plan delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete plans for project %s", resourceID)- }-- // Delete access_grant associated with this project- q = qb.Q().Space("DELETE FROM access_grant WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build access_grant delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete access_grants for project %s", resourceID)+ return errors.Wrapf(err, "failed to update saved queries for projects %s", projectList)}- // Delete releases associated with this project- q = qb.Q().Space("DELETE FROM release WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build release delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete releases for project %s", resourceID)- }-- // Delete db_groups associated with this project- q = qb.Q().Space("DELETE FROM db_group WHERE project = ?", resourceID)- sql, args, err = q.ToSQL()- if err != nil {- return errors.Wrap(err, "failed to build db_group delete query")- }- if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete db_groups for project %s", resourceID)+ // Delete the project-scoped rows, deepest child first: every chain in+ // backend/store/AGENTS.md is walked bottom-up for the whole batch at once,+ // so one table's rows are removed for every project before the next table.+ for _, statement := range []struct {+ name string+ sql string+ }{+ {"issue_comment", "DELETE FROM issue_comment WHERE project = ANY(?)"},+ {"review_run", "DELETE FROM review_run WHERE project = ANY(?)"},+ {"issue", "DELETE FROM issue WHERE project = ANY(?)"},+ {"plan_webhook_delivery", "DELETE FROM plan_webhook_delivery WHERE project = ANY(?)"},+ {"plan_check_run", "DELETE FROM plan_check_run WHERE project = ANY(?)"},+ {"task_run_log", "DELETE FROM task_run_log WHERE project = ANY(?)"},+ {"task_run", "DELETE FROM task_run WHERE project = ANY(?)"},+ {"task", "DELETE FROM task WHERE project = ANY(?)"},+ {"plan", "DELETE FROM plan WHERE project = ANY(?)"},+ {"access_grant", "DELETE FROM access_grant WHERE project = ANY(?)"},+ {"release", "DELETE FROM release WHERE project = ANY(?)"},+ {"db_group", "DELETE FROM db_group WHERE project = ANY(?)"},+ } {+ q = qb.Q().Space(statement.sql, resourceIDs)+ sql, args, err = q.ToSQL()+ if err != nil {+ return errors.Wrapf(err, "failed to build %s delete query", statement.name)+ }+ if _, err := tx.ExecContext(ctx, sql, args...); err != nil {+ return errors.Wrapf(err, "failed to delete %s for projects %s", statement.name, projectList)+ }}// Purge the databases and database-scoped history of project instances.@@ -661,26 +599,26 @@ func (s *Store) DeleteProject(ctx context.Context, workspace string, resourceIDname stringsql string}{- {"changelog", "DELETE FROM changelog WHERE instance IN (SELECT resource_id FROM instance WHERE project = ?)"},- {"sync_history", "DELETE FROM sync_history WHERE instance IN (SELECT resource_id FROM instance WHERE project = ?)"},+ {"changelog", "DELETE FROM changelog WHERE instance IN (SELECT resource_id FROM instance WHERE project = ANY(?))"},+ {"sync_history", "DELETE FROM sync_history WHERE instance IN (SELECT resource_id FROM instance WHERE project = ANY(?))"},{"revision deleter", `UPDATE revision SET deleter = NULL- WHERE deleter IN (SELECT email FROM service_account WHERE project = ? AND workspace = ?)- OR deleter IN (SELECT email FROM workload_identity WHERE project = ? AND workspace = ?)`},- {"revision", "DELETE FROM revision WHERE instance IN (SELECT resource_id FROM instance WHERE project = ?)"},- {"db_schema", "DELETE FROM db_schema WHERE instance IN (SELECT resource_id FROM instance WHERE project = ?)"},- {"database", "DELETE FROM db WHERE instance IN (SELECT resource_id FROM instance WHERE project = ?)"},+ WHERE deleter IN (SELECT email FROM service_account WHERE project = ANY(?) AND workspace = ?)+ OR deleter IN (SELECT email FROM workload_identity WHERE project = ANY(?) AND workspace = ?)`},+ {"revision", "DELETE FROM revision WHERE instance IN (SELECT resource_id FROM instance WHERE project = ANY(?))"},+ {"db_schema", "DELETE FROM db_schema WHERE instance IN (SELECT resource_id FROM instance WHERE project = ANY(?))"},+ {"database", "DELETE FROM db WHERE instance IN (SELECT resource_id FROM instance WHERE project = ANY(?))"},} {if statement.name == "revision deleter" {- q = qb.Q().Space(statement.sql, resourceID, workspace, resourceID, workspace)+ q = qb.Q().Space(statement.sql, resourceIDs, workspace, resourceIDs, workspace)} else {- q = qb.Q().Space(statement.sql, resourceID)+ q = qb.Q().Space(statement.sql, resourceIDs)}sql, args, err = q.ToSQL()if err != nil {return errors.Wrapf(err, "failed to build %s delete query", statement.name)}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete %s for project %s", statement.name, resourceID)+ return errors.Wrapf(err, "failed to delete %s for projects %s", statement.name, projectList)}}@@ -691,103 +629,98 @@ func (s *Store) DeleteProject(ctx context.Context, workspace string, resourceIDSET project = ?FROM instanceWHERE db.instance = instance.resource_id- AND db.project = ?+ AND db.project = ANY(?)AND instance.project IS NULL- `, defaultProjectID, resourceID)+ `, defaultProjectID, resourceIDs)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build workspace database update query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to move workspace databases to default project for project %s", resourceID)+ return errors.Wrapf(err, "failed to move workspace databases to default project for projects %s", projectList)}- // Delete sheet refs owned by this project. Blobs stay: content-addressed+ // Delete sheet refs owned by these projects. Blobs stay: content-addressed// rows may be shared with other projects, and unreferenced blobs are a// future GC's concern (see the sheet_blob comment in LATEST.sql).- q = qb.Q().Space("DELETE FROM sheet_blob_ref WHERE project = ?", resourceID)+ q = qb.Q().Space("DELETE FROM sheet_blob_ref WHERE project = ANY(?)", resourceIDs)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build sheet_blob_ref delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete sheet_blob_ref for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete sheet_blob_ref for projects %s", projectList)}// Delete project webhooks- q = qb.Q().Space("DELETE FROM project_webhook WHERE project = ?", resourceID)+ q = qb.Q().Space("DELETE FROM project_webhook WHERE project = ANY(?)", resourceIDs)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build project_webhook delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete project_webhook for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete project_webhook for projects %s", projectList)}// Delete project service accounts- q = qb.Q().Space("DELETE FROM service_account WHERE project = ? AND workspace = ?", resourceID, workspace)+ q = qb.Q().Space("DELETE FROM service_account WHERE project = ANY(?) AND workspace = ?", resourceIDs, workspace)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build service_account delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete service accounts for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete service accounts for projects %s", projectList)}// Delete project workload identities- q = qb.Q().Space("DELETE FROM workload_identity WHERE project = ? AND workspace = ?", resourceID, workspace)+ q = qb.Q().Space("DELETE FROM workload_identity WHERE project = ANY(?) AND workspace = ?", resourceIDs, workspace)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build workload_identity delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete workload identities for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete workload identities for projects %s", projectList)}// Every project instance is deleted with its owner; they are never converted// into workspace instances.- q = qb.Q().Space("DELETE FROM instance WHERE project = ?", resourceID)+ q = qb.Q().Space("DELETE FROM instance WHERE project = ANY(?)", resourceIDs)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build project instance delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete project instances for project %s", resourceID)- }-- var projectDeleted bool- if err := tx.QueryRowContext(ctx, `- SELECT deleted- FROM project- WHERE resource_id = $1 AND workspace = $2- FOR UPDATE- `, resourceID, workspace).Scan(&projectDeleted); err != nil {- if errors.Is(err, stdsql.ErrNoRows) {- return errors.Errorf("project %s not found or not marked as deleted", resourceID)- }- return errors.Wrapf(err, "failed to lock project %s", resourceID)- }- if !projectDeleted {- return errors.Errorf("project %s not found or not marked as deleted", resourceID)+ return errors.Wrapf(err, "failed to delete project instances for projects %s", projectList)}- // Finally, delete the project itself (only if it's marked as deleted)- q = qb.Q().Space("DELETE FROM project WHERE resource_id = ? AND deleted = TRUE AND workspace = ?", resourceID, workspace)+ // Finally, delete the projects themselves. The predicate is the archived+ // guard: a name that is missing, still active, or in another workspace does+ // not come back, and rolls the whole batch back.+ q = qb.Q().Space("DELETE FROM project WHERE resource_id = ANY(?) AND deleted = TRUE AND workspace = ? RETURNING resource_id", resourceIDs, workspace)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build project delete query")}- result, err := tx.ExecContext(ctx, sql, args...)+ rows, err := tx.QueryContext(ctx, sql, args...)if err != nil {- return errors.Wrapf(err, "failed to delete project %s", resourceID)+ return errors.Wrapf(err, "failed to delete projects %s", projectList)}-- rowsAffected, err := result.RowsAffected()- if err != nil {- return errors.Wrap(err, "failed to get rows affected")+ defer rows.Close()+ var purged []string+ for rows.Next() {+ var resourceID string+ if err := rows.Scan(&resourceID); err != nil {+ return errors.Wrap(err, "failed to scan purged project")+ }+ purged = append(purged, resourceID)+ }+ if err := rows.Err(); err != nil {+ return errors.Wrapf(err, "failed to read purged projects %s", projectList)}- if rowsAffected == 0 {- return errors.Errorf("project %s not found or not marked as deleted", resourceID)+ for _, resourceID := range resourceIDs {+ if !slices.Contains(purged, resourceID) {+ return errors.Errorf("project %s not found or not marked as deleted", resourceID)+ }}if err := tx.Commit(); err != nil {@@ -796,7 +729,7 @@ func (s *Store) DeleteProject(ctx context.Context, workspace string, resourceID// Publish invalidation only after the purge commits: every captured// descendant entry is removed while unrelated cache entries survive.- s.removeProjectDescendantCaches(cacheKeys, resourceID)+ s.removeProjectDescendantCaches(cacheKeys, resourceIDs)return nil}diff --git a/backend/store/project_purge_cache_test.go b/backend/store/project_purge_cache_test.goindex e73b7a72f3..6ddd54e42c 100644--- a/backend/store/project_purge_cache_test.go+++ b/backend/store/project_purge_cache_test.go@@ -114,7 +114,7 @@ func TestDeleteProjectPurgeInvalidatesDescendantCaches(t *testing.T) {workspaceInstanceID := "workspace-instance"workspaceDBName := "workspace-db"- require.NoError(t, s.DeleteProject(ctx, "default", "project-a"))+ require.NoError(t, s.DeleteProjects(ctx, "default", "project-a"))// Observable seam: purged descendants are immediately unavailable through// the cached getters.@@ -164,7 +164,7 @@ func TestDeleteProjectPurgeSupportsDescendantIDReuse(t *testing.T) {seedProjectPurgeFixture(ctx, t, db)warmProjectPurgeCaches(ctx, t, s)- require.NoError(t, s.DeleteProject(ctx, "default", "project-a"))+ require.NoError(t, s.DeleteProjects(ctx, "default", "project-a"))projectInstanceID := "project-instance"projectDBName := "project-db"@@ -208,12 +208,12 @@ func TestDeleteProjectFailedTransactionKeepsDescendantCaches(t *testing.T) {projectInstanceID := "project-instance"projectDBName := "project-db"- // project-a is not marked deleted, so DeleteProject removes all descendant+ // project-a is not marked deleted, so DeleteProjects removes all descendant// rows inside the transaction and then fails on the deleted guard, rolling// the whole purge back._, err := db.ExecContext(ctx, `UPDATE project SET deleted = FALSE WHERE resource_id = 'project-a'`)require.NoError(t, err)- err = s.DeleteProject(ctx, "default", "project-a")+ err = s.DeleteProjects(ctx, "default", "project-a")require.Error(t, err)// Remove the descendant rows behind the store's back so that only adiff --git a/backend/store/project_setting_cache_test.go b/backend/store/project_setting_cache_test.gonew file mode 100644index 0000000000..fce3a3db7f--- /dev/null+++ b/backend/store/project_setting_cache_test.go@@ -0,0 +1,57 @@+package store_test++import (+ "testing"++ "github.com/stretchr/testify/require"++ storepb "github.com/bytebase/bytebase/backend/generated-go/store"+ "github.com/bytebase/bytebase/backend/store"+)++// A project setting decides authorization — AllowLastPlanEditorApproval gates+// who may approve an issue — and GetProject serves it from cache on the+// single-process deployments that enable caching. Invalidating the cache+// before the write leaves a window in which a concurrent reader loads the+// pre-update row and caches it, so the stale setting outlives the write and+// every later authorization check runs on it.+func TestUpdateProjectsDoesNotLeaveAStaleSettingCached(t *testing.T) {+ fixture := newStorePostgresFixture(t, `+ UPDATE project SET setting = '{"allowLastPlanEditorApproval": true}' WHERE resource_id = 'project-a';+ `)+ cached, err := store.New(fixture.ctx, fixture.pgURL, true)+ require.NoError(t, err)+ t.Cleanup(func() { require.NoError(t, cached.Close()) })++ projectID := "project-a"+ readSetting := func() bool {+ project, err := cached.GetProject(fixture.ctx, &store.FindProjectMessage{Workspace: "default", ResourceID: &projectID, ShowDeleted: true})+ require.NoError(t, err)+ require.NotNil(t, project)+ return project.Setting.GetAllowLastPlanEditorApproval()+ }+ require.True(t, readSetting(), "seeded setting")++ const barrierID = 9981+ barrier := newMaintenanceLockBarrier(fixture.ctx, t, fixture.db, barrierID)+ installMaintenanceLockBarrier(t, fixture.db, barrierID, "BEFORE UPDATE ON project FOR EACH STATEMENT")++ updateDone := make(chan error, 1)+ go func() {+ updateDone <- cached.UpdateProjects(fixture.ctx, &store.UpdateProjectMessage{+ Workspace: "default",+ ResourceID: projectID,+ Setting: &storepb.Project{AllowLastPlanEditorApproval: false},+ })+ }()+ waitForMaintenanceBarrier(fixture.ctx, t, fixture.db, barrierID)++ // A reader lands while the write is in flight and caches the pre-update row.+ require.True(t, readSetting(), "the in-flight write is not visible yet")++ barrier.release(t)+ requireMaintenanceResult(t, updateDone)++ require.False(t, readSetting(),+ "the committed setting must be readable; a cache entry from the write window must not outlive it")+}diff --git a/backend/store/saved_query_purge_isolation_test.go b/backend/store/saved_query_purge_isolation_test.goindex d7d12a7c59..e385709140 100644--- a/backend/store/saved_query_purge_isolation_test.go+++ b/backend/store/saved_query_purge_isolation_test.go@@ -8,7 +8,7 @@ import (// saved_query_star is keyed (saved_query, principal) and its parent key is// globally unique, so it carries no project-scoped id-reuse risk. What it does-// carry is the purge: DeleteProject is the one writer whose star predicate+// carry is the purge: DeleteProjects is the one writer whose star predicate// reaches outside the project being purged, because a project principal may// have starred another project's saved query. This locks down that reach —// rows belonging to a surviving project must not be collateral.@@ -33,7 +33,7 @@ func TestDeleteProjectPurgeKeepsOtherProjectSavedQueryStars(t *testing.T) {`fixture := newStorePostgresFixture(t, seedSQL)- require.NoError(t, fixture.store.DeleteProject(fixture.ctx, "default", "project-a"))+ require.NoError(t, fixture.store.DeleteProjects(fixture.ctx, "default", "project-a"))savedQueryExists := func(resourceID string) bool {var exists booldiff --git a/docs/design/sheet-blob-scoping.md b/docs/design/sheet-blob-scoping.mdindex 3d6fcaa1ae..0744a3ef1d 100644--- a/docs/design/sheet-blob-scoping.md+++ b/docs/design/sheet-blob-scoping.md@@ -195,7 +195,7 @@ operator who tops up `(requesting project, sha)` for the ones they confirm. Thatgrant rather than an inferred one, and the operator has context the migration does not — whether adatabase was transferred, and who should see its history.-**Corroboration is checked on the referenced row, not on the project.** `DeleteProject` hard-deletes+**Corroboration is checked on the referenced row, not on the project.** `DeleteProjects` hard-deletesthe `project` row and `CreateProject` accepts a caller-supplied `ProjectId`(`backend/api/v1/project_service.go:210`), so a purged ID can be reused; a surviving revision namingthe *old* project would otherwise resolve to an unrelated *new* project of the same name and grant itdiff --git a/docs/design/sheet-history-on-database-transfer.md b/docs/design/sheet-history-on-database-transfer.mdindex 3305dcd8c1..2138a3ec29 100644--- a/docs/design/sheet-history-on-database-transfer.md+++ b/docs/design/sheet-history-on-database-transfer.md@@ -21,7 +21,7 @@ Four code paths move a database between projects, only one of which is a user-fa| `UpdateDatabase` | `backend/store/database.go:332-380` | one database || `BatchUpdateDatabases` | `backend/store/database.go:397-560` | a batch || `updateInstanceLifecycle` | `backend/store/instance.go:373-455` | every database of a **workspace** instance, on archive |-| `DeleteProject` | `backend/store/project.go:722-729` | workspace-instance databases, reassigned to the default project |+| `DeleteProjects` | `backend/store/project.go:611-620` | workspace-instance databases, reassigned to the default project |Both instance-related paths concern **workspace** instances specifically, and for the same reason:those instances are shared infrastructure, so their databases cannot simply be deleted along with a@@ -33,9 +33,9 @@ instance" (`backend/store/instance.go:44-46`), and `:434` rejects the project-inwith *cannot transfer databases while archiving project instance*. It also requires `Deleted` to beset (`:288`), so it is an archive path rather than an ordinary update.-`DeleteProject` is the same shape and the one most easily missed: purge does not delete+`DeleteProjects` is the same shape and the one most easily missed: purge does not deleteworkspace-instance databases, it reassigns them to the default project, and the `revision` delete at-`:702` covers only project instances — so those revisions survive a purge with their hashes intact.+`:593` covers only project instances — so those revisions survive a purge with their hashes intact.Project-instance databases are deleted with their instance in both paths and raise no question.## Requirements@@ -172,7 +172,7 @@ stamp only when the server knew the owner at creation or the backfill corroborat**Purge timing splits into two outcomes, deliberately.** A project purged *before* the migrationleaves its surviving revisions unstampable — provenance naming it can no longer corroborate, since-`DeleteProject` hard-deletes the `release`, `task` and `plan` rows — so those rows carry no name.+`DeleteProjects` hard-deletes the `release`, `task` and `plan` rows — so those rows carry no name.A project purged *after* its revisions were stamped leaves the stamp behind: the revision keepsnaming the purged project, the name 404s on read (purge deleted the refs), and the UI reports thestatement as owned by a project the caller cannot read. The dangling name is accepted rather than@@ -234,8 +234,8 @@ corruption outweighs the modelling improvement.current project would keep exactly the false resource name the scoping doc's R7 exists toeliminate — a response handing the client `projects/B/sheets/{sha}` to follow, which then 404s.- No *carry* logic in `UpdateDatabase`, `BatchUpdateDatabases`, `updateInstanceLifecycle`, or- `DeleteProject` — nothing moves refs between projects. `DeleteProject` still needs its- `DELETE FROM sheet_blob_ref WHERE project = ?` from the scoping doc: `sheet_blob_ref(project)` has+ `DeleteProjects` — nothing moves refs between projects. `DeleteProjects` still needs its+ `DELETE FROM sheet_blob_ref WHERE project = ANY(?)` from the scoping doc: `sheet_blob_ref(project)` hasa plain foreign key with no `ON DELETE CASCADE`, so purging a project that owns refs fails withoutit. "No changes" here means no transfer behavior, not no purge cleanup.diff --git a/docs/design/v1-api-audit-2026-08.md b/docs/design/v1-api-audit-2026-08.mdindex 12e2a40a5f..fb51d5b69d 100644--- a/docs/design/v1-api-audit-2026-08.md+++ b/docs/design/v1-api-audit-2026-08.md@@ -11,7 +11,7 @@ where noted. Fixed findings are removed and listed at the end.| | Problem | Severity ||---|---|---|| T12 | Anonymous callers can read your LDAP config | MED |-| T18c i–iii | Half-finished delete, broken filter, unpaginated list, existence-leaking error codes | MED |+| T18c ii–iii | Broken filter, unpaginated list, existence-leaking error codes | MED || T18c-iv | `BatchDeleteProjects` checks its permission against the workspace, not the named projects — latent, no predefined role reaches it | LOW |---@@ -62,16 +62,6 @@ by anything stated — and nothing in the proto says the batch form needs worksp----## The API says OK and does nothing--### T18c-i · Deleting several projects can half-finish — MED--`BatchDeleteProjects` purges in a loop with no transaction. A failure partway leaves some projects-irreversibly purged, and the error names only the one that failed — not the ones already gone.-`project_service.go:492-500`------## Lists that return the wrong rows### T18c-ii · Two smaller list bugs — MED@@ -185,6 +175,7 @@ constraints.| T13 issue filters | `approval_status` and `current_approver` are matched in SQL before `LIMIT`, so a filtered page can no longer come back empty under a live page token. The status is a `CASE` over `payload->'approval'` mirroring `computeApprovalStatus`; `current_approver` cannot be resolved in SQL alone (binding conditions and group expansion are evaluated in Go), so the caller passes down the `(project, role)` pairs the named user holds, the same shape as the saved-query `AccessMembers` predicate. Accepted with it: the predicates are not indexable, so a filtered list scans until it has a full page of matches — measured on 50,000 issues across 40 projects, that is ~9 ms against ~14 ms for the same unfiltered query, and ~3.5 ms in the zero-match case, because PostgreSQL drives the join from the small `(project, role)` set, so no expression index is warranted yet. Deliberately unchanged: the filter still ignores rejection and self-approval, so a rejected issue names the holder of the *next* role as its current approver — masked in the default view, and worth its own fix || T18 worksheet write/delete | [#21169](https://github.com/bytebase/bytebase/pull/21169) + [#21181](https://github.com/bytebase/bytebase/pull/21181) — per-verb permissions; SQL Editor Read User can no longer rewrite or delete || T17 | Every CEL string literal the frontend emits now comes from `celString`/`celStringList`/`celMapField` in a dependency-free `frontend/src/utils/v1/celLiteral.ts` — the helpers own the quotes, so the escape cannot be forgotten the way it was at 11 of 17 sites. Worst was the access-grant page, whose search box takes SQL: a quoted identifier made `InvalidArgument` routine. All 17 sites converted, the enum and resource-name ones included, because an absolute rule is the only one a machine can check — `src/architecture/cel-filter-literals.test.ts` scans `src/**` for the three raw shapes and fails CI on a new one, in the style of the existing Vue-boundary guards. The helpers are a leaf module because putting them beside the CEL RPC clients dragged `@/api` into `modules/cel/logic/stringify.ts` and broke that subtree's tests. Two adjacent defects the sweep found, neither of which escaping addresses, fixed with it. **A label key with a dash never reached the backend at all**: keys are validated `^[a-z][a-z0-9_-]{0,62}$`, and CEL parses `labels.cost-center` as subtraction, so the store answered `unsupport variable \"\"` — the frontend now emits `labels[\"key\"]` index syntax, `getVariableAndValueFromExpr` canonicalizes both forms, and the key is **bound** rather than interpolated into the JSONB path, since index syntax admits a quote the dotted form could not. **`%` and `_` reached `LIKE` as wildcards**, so a statement search containing either silently over-matched — `escapeLikePattern`, already in-tree for saved queries, plus `ESCAPE '\\'` now covers all 13 `contains` translations. The three copies of the label-filter closure collapsed into one `buildLabelFilterSQL`, which also drops an unchecked `raw.(string)` that panicked on `labels.k in [1]`. Verified against PostgreSQL 16: `->>$1::text` matches, an injected key is inert, and `\_` stops matching what `_` did. Accepted with it: the guard is line-based and skips test files, which should spell out expected filter strings literally; and `query_history`'s two remaining raw-`LIKE` filters are left alone — `instance ==` missing its wildcard and `statement ==` missing the escape, both T18c-ii. Its `database ==` is plain equality and was never affected |+| T18c-i | `BatchDeleteProjects` purges every named project in one transaction, so a failure partway rolls the whole batch back instead of leaving the projects ahead of it irreversibly gone with an error naming only the one that failed. There is one store method where there were two — `DeleteProjects`, variadic like the `UpdateProjects` beside it — and its statements carry `project = ANY(?)`, one per table for the whole batch, in the child-to-parent table order the loop already used, so the chains in [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#transaction-row-lock-ordering) are walked bottom-up for every project at once. The separate `SELECT ... FOR UPDATE` that guarded the archived state is gone rather than generalized: it only duplicated the `AND deleted = TRUE` on the delete two lines below it, which takes the same row locks at the same point. That delete now carries `RETURNING resource_id`, and a name that does not come back — missing, still active, or in another workspace — fails the batch with the message the single-project purge already used. No ordering is claimed for concurrent purges: the descendant statements that run first never had one either, and [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#transaction-row-lock-ordering) already treats purge as a point-in-time lifecycle operation whose conflicts are best-effort. Accepted with it: sample-instance cleanup still runs per project *before* the transaction, because it removes an embedded PostgreSQL data directory or an external database and role that no rollback restores — it writes no project row, so a failure there still purges nothing, and `sample_instance_setup` holds one live row per workspace, so at most one project in a batch has work to do. Unchanged: the default-project and archived-before-purge guards are still checked for every name before any purge begins, and the soft-delete path was already a single `UPDATE`. **Shipped with no test of its own, deliberately — the atomicity is unlocked.** Every existing purge test (`TestCollisionDeleteProjectCascade`, the three `project_purge_cache_test.go` cases, `TestDeleteProjectPurgeKeepsOtherProjectSavedQueryStars`, `TestDeleteProjectDeletesProjectInstancesAndKeepsWorkspaceInstanceDatabases`) now drives the batched SQL, so the rewrite of ~25 statements to `project = ANY(?)` is covered — but only ever with one name, so nothing catches a predicate that reaches some projects and not others, and nothing fails if the handler returns to a per-project loop. A handler-level test could not have covered it either: the archived-before-purge guard rejects the whole request before the transaction starts, so a mid-batch failure is unreachable through the API and the invariant is only observable from the store. The batch is also a changed multi-row transaction shipping without the contention coverage step 5 of [`docs/pre-pr-checklist.md`](../../docs/pre-pr-checklist.md) asks for; the sort-before-lock argument is the only thing standing behind the deadlock claim. Judged not worth the test weight. Untouched, and still open as T18c-iv: the batch form is authorized at workspace scope || T18a | [#21265](https://github.com/bytebase/bytebase/pull/21265) — `BatchCancelTaskRuns` confines its lookup to the plan and environment just authorized; the stage in a task run name is caller-supplied, so cancel rights in one environment reached a RUNNING row in another. An out-of-scope ID is rejected, not dropped — the cancel is driven by the requested IDs || T9 | [#21189](https://github.com/bytebase/bytebase/pull/21189) (self-hosted audit rows) + [#21234](https://github.com/bytebase/bytebase/pull/21234) — one `login_attempt` table bounds password, email-code, and MFA guessing per identity on both deployments, replacing the audit-log counter and the per-code attempt column (which bypassed the resend cooldown). Accepted with it: no per-tenant failed-login record on Cloud, and lockout-as-denial-of-service — see [`login-attempt-lockout.md`](login-attempt-lockout.md) || T15 | `update_mask` now decides what each of the four Update methods writes. **`UpdateDataSource`** dispatches the IAM credential on the mask path instead of the request's `authentication_type`, which was unset on any request that masked only the credential — the AIP-134 shape — so rotating a leaked key returned 200 and wrote nothing. The same branch, given a body type that disagreed with the mask, wrote the *other* credential and moved `authentication_type` with it though the mask named neither; the effective type is now resolved from the mask before the loop and a mismatched path is `InvalidArgument`. **`UpdateSetting(APP_IM)`** splices only the masked providers into the stored value rather than assigning the request wholesale, so saving Slack no longer erases the Feishu, WeCom, Lark, DingTalk and Teams secrets; the mask is now required, and a masked provider the payload omits is removed, which is how the console deletes one (it no longer merges the list client-side). **`UpdateIssue`** rejects paths it does not implement instead of returning 200 and dropping them — `status` belongs to `BatchUpdateIssuesStatus` and approvals to `ApproveIssue`/`RejectIssue`, so the supported set was right and only the silence was wrong. **`UpdateDatabaseCatalog`** keeps full-replace semantics and now says so in the proto; its `allow_missing` is removed and the number reserved, because a catalog is not independently creatable — it exists once its database is synced — so the flag had nothing to create, and the ACL's create-permission check on it denied every caller. Both merges were extracted into pure functions (`applyDataSourceUpdateMask`, `mergeAppIMSetting`), so `instance_service_test.go` and `setting_service_test.go` pin the behavior in milliseconds without a server or a metadata database. Accepted with it: the APP_IM mask paths still name no real proto field (`AppIMSetting` holds one repeated `settings`, and `value.app_im_setting_value.teams` is not a field path at all), so they are matched as a fixed vocabulary — making them true paths means restructuring the message one-field-per-provider, which needs a JSONB migration. Also left open, and the reason `UpdateDatabaseCatalog`'s hazard is documented rather than removed: a mask cannot express "this one table" while `schemas` is repeated, and read-modify-write on the catalog still loses one side of a concurrent edit, which needs an etag (AIP-154); the IAM-policy half of it is fixed, see T18b below |