From b33ac4d9463691e1519c34d81747b27c0aa6f126 Mon Sep 17 00:00:00 2001 From: Replicated Engineering Date: Thu, 13 Aug 2026 23:22:21 +0000 Subject: [PATCH 1/2] fix(lint2,cli): resolve dependency update validation failures - Fix isHiddenPath to evaluate paths relative to cwd so hidden parent directories outside the project (e.g. /home/user/.openclaw/...) do not cause manifest files to be skipped. This broke HelmChart discovery when builder values were needed for charts with required values. - Skip API credential setup for release lint v2 (REPLICATED_RELEASE_VALIDATION_V2=1), which is intentionally offline and should not require credentials. - Add regression test for absolute paths under a hidden parent directory. --- cli/cmd/root.go | 11 +++++++---- pkg/lint2/discovery.go | 12 ++++++++++++ pkg/lint2/discovery_test.go | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 0f037dd68..d69e7cac1 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -489,16 +489,19 @@ func Execute(rootCmd *cobra.Command, stdin io.Reader, stdout io.Writer, stderr i }() } - if err = preRunSetupAPIs(cmd, args); err != nil { - return errors.Wrap(err, "set up APIs") - } - // release lint with REPLICATED_RELEASE_VALIDATION_V2=1 (local lint) reads // .replicated independently for lint config and doesn't need app context. // Skip .replicated app resolution only in that specific case to avoid // unnecessary API calls when the app slug in .replicated doesn't exist. isV2Lint := cmd.Name() == "lint" && cmd.Parent() != nil && cmd.Parent().Name() == "release" && os.Getenv("REPLICATED_RELEASE_VALIDATION_V2") == "1" + + // v2 lint runs locally and intentionally works without API credentials. + if !isV2Lint { + if err = preRunSetupAPIs(cmd, args); err != nil { + return errors.Wrap(err, "set up APIs") + } + } if isV2Lint { if appSlugOrID == "" { appSlugOrID = os.Getenv("REPLICATED_APP") diff --git a/pkg/lint2/discovery.go b/pkg/lint2/discovery.go index ad34e30b8..d98716c83 100644 --- a/pkg/lint2/discovery.go +++ b/pkg/lint2/discovery.go @@ -47,6 +47,18 @@ func DiscoverSupportBundlesFromManifests(manifestGlobs []string) ([]string, erro // Returns true for paths like .git, .github, foo/.hidden/bar, etc. // Does not consider . or .. as hidden (current/parent directory references). func isHiddenPath(path string) bool { + // Treat paths relative to the current working directory so that parent + // directories outside the project (e.g., /home/user/.openclaw/...) are not + // considered hidden. Hidden directories should only be evaluated within the + // project tree. + if abs, err := filepath.Abs(path); err == nil { + if cwd, err := os.Getwd(); err == nil { + if rel, err := filepath.Rel(cwd, abs); err == nil && !filepath.IsAbs(rel) { + path = rel + } + } + } + parts := strings.Split(filepath.ToSlash(path), "/") for _, part := range parts { if strings.HasPrefix(part, ".") && part != "." && part != ".." { diff --git a/pkg/lint2/discovery_test.go b/pkg/lint2/discovery_test.go index 303bda5ff..9f0d1889c 100644 --- a/pkg/lint2/discovery_test.go +++ b/pkg/lint2/discovery_test.go @@ -674,6 +674,42 @@ func TestIsHiddenPath(t *testing.T) { } } +func TestIsHiddenPath_AbsolutePathUnderHiddenParent(t *testing.T) { + // Paths should be evaluated relative to the project (cwd), not the absolute + // filesystem path. A workspace located under a hidden directory like + // /home/user/.openclaw/project should not cause files inside the project to + // be treated as hidden. + tmpDir := t.TempDir() + projectDir := filepath.Join(tmpDir, ".openclaw", "workspace") + if err := os.MkdirAll(projectDir, 0755); err != nil { + t.Fatal(err) + } + + originalWd, err := os.Getwd() + if err != nil { + t.Fatal(err) + } + defer func() { + if err := os.Chdir(originalWd); err != nil { + t.Errorf("failed to restore cwd: %v", err) + } + }() + + if err := os.Chdir(projectDir); err != nil { + t.Fatal(err) + } + + normalFile := filepath.Join(projectDir, "manifests", "helmchart.yaml") + if isHiddenPath(normalFile) { + t.Errorf("isHiddenPath(%q) = true, want false (hidden parent outside project should not matter)", normalFile) + } + + hiddenFile := filepath.Join(projectDir, ".hidden", "config.yaml") + if !isHiddenPath(hiddenFile) { + t.Errorf("isHiddenPath(%q) = false, want true (hidden segment inside project should be hidden)", hiddenFile) + } +} + func TestIsChartDirectory(t *testing.T) { tmpDir := t.TempDir() From a01e0101a359f761ce7a654b4fb3fb6e01887250 Mon Sep 17 00:00:00 2001 From: ElasticClaw Factory Date: Fri, 14 Aug 2026 04:19:44 +0000 Subject: [PATCH 2/2] chore(deps): update go.mod and go.sum --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 10bddc24e..ed530f815 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( golang.org/x/term v0.45.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - helm.sh/helm/v3 v3.21.3 + helm.sh/helm/v3 v3.21.4 k8s.io/apimachinery v0.36.3 k8s.io/client-go v0.36.3 oras.land/oras-go/v2 v2.6.2 @@ -66,7 +66,7 @@ require ( github.com/Masterminds/semver/v3 v3.5.0 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/ProtonMail/go-crypto v1.3.0 // indirect + github.com/ProtonMail/go-crypto v1.4.1 // indirect github.com/ahmetalpbalkan/go-cursor v0.0.0-20131010032410-8136607ea412 // indirect github.com/andybalholm/brotli v1.2.2 // indirect github.com/apparentlymart/go-cidr v1.1.1 // indirect diff --git a/go.sum b/go.sum index 008a661dc..2cf8a56d2 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,8 @@ github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA4 github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= -github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE= +github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM= +github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo= github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= github.com/ahmetalpbalkan/go-cursor v0.0.0-20131010032410-8136607ea412 h1:vOVO0ypMfTt6tZacyI0kp+iCZb1XSNiYDqnzBWYgfe4= @@ -926,8 +926,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= -helm.sh/helm/v3 v3.21.3 h1:wkamdwI3liEkW6wI1l9aGqQZGxcTKyt8kx0qJLPcmCg= -helm.sh/helm/v3 v3.21.3/go.mod h1:iaJ0iNsPoTZl++7h6vzQFyT0VEVtLYJiyRBDkPOOBTs= +helm.sh/helm/v3 v3.21.4 h1:T/GcIEXU/gNjJnkITlIZ3e9xqkZjhFTmISuStTZ6+Qg= +helm.sh/helm/v3 v3.21.4/go.mod h1:cS2FBb+xfLuaSqvEmbqIeKUVFgHdHVHtVeXb2epof3M= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.36.3 h1:NxB+05W2UGqXWFXcLO0RB5cnqnUPP5v5sVlaOH0Iz4w=