From dfe73b14c6295dddbc11916468e0acf0187fa802 Mon Sep 17 00:00:00 2001 From: Wayne Wollesen Date: Sun, 22 Mar 2026 10:44:27 -0700 Subject: [PATCH] Filter cloud-restricted descendants by ancestor path prefix, not exact match The cloud filtering for config diffs now matches descendant and indexed paths (e.g. SqlSettings.ReplicaLagSettings[0].DataSource) under tagged ancestor fields, not just exact path equality. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/public/model/config.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/server/public/model/config.go b/server/public/model/config.go index 27a299c2554..3b7f653abaf 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -5198,7 +5198,23 @@ func CloudRestrictedPaths() map[string]bool { return collectTaggedPaths(reflect.TypeFor[Config](), ConfigAccessTagType, ConfigAccessTagCloudRestrictable, "") } -// FilterCloudRestrictedChanges removes changes whose paths match cloud-restrictable config fields. +// isCloudRestricted checks whether a change path matches or is a descendant +// of any cloud-restrictable config field path (e.g. "SqlSettings.ReplicaLagSettings" +// also matches "SqlSettings.ReplicaLagSettings[0].DataSource"). +func isCloudRestricted(path string, restricted map[string]bool) bool { + if restricted[path] { + return true + } + for rp := range restricted { + if strings.HasPrefix(path, rp+".") || strings.HasPrefix(path, rp+"[") { + return true + } + } + return false +} + +// FilterCloudRestrictedChanges removes changes whose paths match or descend from +// cloud-restrictable config fields. func FilterCloudRestrictedChanges(items []*ConfigListItem) { restricted := CloudRestrictedPaths() for _, item := range items { @@ -5207,7 +5223,7 @@ func FilterCloudRestrictedChanges(items []*ConfigListItem) { } filtered := make([]ConfigChange, 0, len(item.Changes)) for _, ch := range item.Changes { - if !restricted[ch.Path] { + if !isCloudRestricted(ch.Path, restricted) { filtered = append(filtered, ch) } }