Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4d6b32b
chore: upgrade jackc/pgx from v4 to v5
ravisuhag Mar 27, 2026
9b36aef
chore: upgrade grpc-middleware v1 to v2 and modernize gRPC setup
ravisuhag Mar 27, 2026
11b2a43
chore: upgrade r3labs/diff from v2 to v3
ravisuhag Mar 27, 2026
c705dba
chore: upgrade go-elasticsearch from v7 to v8, remove olivere/elastic
ravisuhag Mar 27, 2026
306d877
chore: upgrade raystack/salt from v0.3 to v0.7
ravisuhag Mar 27, 2026
905cee3
chore: bump all dependency versions to latest
ravisuhag Mar 27, 2026
f82102c
fix: replace deprecated grpc.DialContext and WithBlock with grpc.NewC…
ravisuhag Mar 27, 2026
e99f18b
build: upgrade CI Go version to 1.25 and Elasticsearch to 8.x
ravisuhag Mar 27, 2026
088d69f
build: upgrade CI Go version to 1.26
ravisuhag Mar 27, 2026
816e009
build: use go-version-file instead of hardcoded Go version in CI
ravisuhag Mar 27, 2026
264d39f
chore: fix ci
ravisuhag Mar 27, 2026
7246c9d
chore: optimize CI pipeline and fix JSONB NULL scan error
ravisuhag Mar 27, 2026
5a20ab1
chore: avoid duplicate CI runs on PR branches
ravisuhag Mar 27, 2026
441c374
chore: add concurrency groups to cancel stale CI runs
ravisuhag Mar 27, 2026
ac37120
Revert "chore: add concurrency groups to cancel stale CI runs"
ravisuhag Mar 27, 2026
28abc09
Reapply "chore: add concurrency groups to cancel stale CI runs"
ravisuhag Mar 27, 2026
313492c
chore: remove unnecessary build-essential and add release cache
ravisuhag Mar 27, 2026
21b8dbe
fix: handle NULL JSONB/JSONText scanning and ES 8.x purge compatibility
ravisuhag Mar 27, 2026
9ac0e8f
chore: simplify root config files and fix ES 8.x test purge
ravisuhag Mar 27, 2026
a9c4ae7
fix: exclude system indices from ES test purge for 8.x compatibility
ravisuhag Mar 27, 2026
367e610
fix: list and delete only user indices in ES test purge
ravisuhag Mar 28, 2026
df95c2b
chore: clean up goreleaser config and fix config comment syntax
ravisuhag Mar 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions cli/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (

"github.com/raystack/compass/internal/client"
compassv1beta1 "github.com/raystack/compass/proto/raystack/compass/v1beta1"
"github.com/raystack/salt/term"

"github.com/MakeNowJust/heredoc"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/cli/printer"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -105,13 +104,13 @@ func listAllAssetsCommand(cfg *Config) *cobra.Command {
report := [][]string{}
report = append(report, []string{"ID", "TYPE", "SERVICE", "URN", "NAME", "VERSION"})
for _, i := range res.GetData() {
report = append(report, []string{i.Id, i.Type, i.Service, i.Urn, term.Bluef(i.Name), i.Version})
report = append(report, []string{i.Id, i.Type, i.Service, i.Urn, printer.Bluef("%s", i.Name), i.Version})
}
printer.Table(os.Stdout, report)

fmt.Println(term.Cyanf("To view all the data in JSON format, use flag `-o json`"))
fmt.Println(printer.Cyanf("To view all the data in JSON format, use flag `-o json`"))
} else {
fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))
}

return nil
Expand Down Expand Up @@ -164,7 +163,7 @@ func viewAssetByIDCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))
return nil
},
}
Expand Down Expand Up @@ -214,7 +213,7 @@ func editAssetCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println("ID: \t", term.Greenf(res.Id))
fmt.Println("ID: \t", printer.Greenf("%s", res.Id))
return nil
},
}
Expand Down Expand Up @@ -256,7 +255,7 @@ func deleteAssetByIDCommand(cfg *Config) *cobra.Command {
return err
}
spinner.Stop()
fmt.Println("Asset ", term.Redf(assetID), " Deleted Successfully")
fmt.Println("Asset ", printer.Redf("%s", assetID), " Deleted Successfully")
return nil
},
}
Expand Down Expand Up @@ -304,7 +303,7 @@ func listAllTypesCommand(cfg *Config) *cobra.Command {

report := [][]string{{"NAME", "COUNT"}}
for _, i := range res.GetData() {
report = append(report, []string{term.Bluef(i.Name), fmt.Sprintf("%v", i.Count)})
report = append(report, []string{printer.Bluef("%s", i.Name), fmt.Sprintf("%v", i.Count)})
}
printer.Table(os.Stdout, report)

Expand Down Expand Up @@ -350,7 +349,7 @@ func listAssetStargazerCommand(cfg *Config) *cobra.Command {
return err
}
spinner.Stop()
fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))
return nil
},
}
Expand Down Expand Up @@ -388,7 +387,7 @@ func starAssetCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef("Asset %v starred successfully", assetID))
fmt.Println(printer.Bluef("Asset %v starred successfully", assetID))

return nil
},
Expand Down Expand Up @@ -424,7 +423,7 @@ func unstarAssetCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef("Asset %v unstarred successfully", assetID))
fmt.Println(printer.Bluef("Asset %v unstarred successfully", assetID))

return nil
},
Expand Down Expand Up @@ -468,13 +467,13 @@ func starredAssetCommand(cfg *Config) *cobra.Command {
report := [][]string{}
report = append(report, []string{"ID", "TYPE", "SERVICE", "URN", "NAME", "VERSION"})
for _, i := range res.GetData() {
report = append(report, []string{i.Id, i.Type, i.Service, i.Urn, term.Bluef(i.Name), i.Version})
report = append(report, []string{i.Id, i.Type, i.Service, i.Urn, printer.Bluef("%s", i.Name), i.Version})
}
printer.Table(os.Stdout, report)

fmt.Println(term.Cyanf("To view all the data in JSON format, use flag `-o json`"))
fmt.Println(printer.Cyanf("To view all the data in JSON format, use flag `-o json`"))
} else {
fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))
}

return nil
Expand Down Expand Up @@ -517,7 +516,7 @@ func versionHistoryAssetCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))

return nil
},
Expand Down Expand Up @@ -560,7 +559,7 @@ func viewAssetByVersionCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))

return nil
},
Expand Down
39 changes: 14 additions & 25 deletions cli/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cli

import (
"errors"
"fmt"
"os"

Expand All @@ -12,7 +11,6 @@ import (
"github.com/raystack/compass/internal/store/postgres"
"github.com/raystack/compass/pkg/metrics"
"github.com/raystack/compass/pkg/telemetry"
"github.com/raystack/salt/cmdx"
"github.com/raystack/salt/config"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -46,13 +44,13 @@ func configInitCommand() *cobra.Command {
"group": "core",
},
RunE: func(cmd *cobra.Command, args []string) error {
cfg := cmdx.SetConfig("compass")
loader := config.NewLoader(config.WithAppConfig("compass"))

if err := cfg.Init(&Config{}); err != nil {
if err := loader.Init(&Config{}); err != nil {
return err
}

fmt.Printf("config created: %v\n", cfg.File())
fmt.Println("config created")
return nil
},
}
Expand Down Expand Up @@ -100,35 +98,26 @@ type Config struct {

func LoadConfig() (*Config, error) {
var cfg Config
err := LoadFromCurrentDir(&cfg)

if errors.As(err, &config.ConfigFileNotFoundError{}) {
err := cmdx.SetConfig("compass").Load(&cfg)
if err != nil {
if errors.As(err, &config.ConfigFileNotFoundError{}) {
return &cfg, ErrConfigNotFound
}
return &cfg, err
// Try loading from current directory first
err := LoadFromCurrentDir(&cfg)
if err != nil {
// Fall back to app config directory
loader := config.NewLoader(config.WithAppConfig("compass"))
if loadErr := loader.Load(&cfg); loadErr != nil {
Comment on lines +106 to +107

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -path "*/cli/config.go" -type f

Repository: raystack/compass

Length of output: 75


🏁 Script executed:

cat -n ./cli/config.go | head -150

Repository: raystack/compass

Length of output: 3794


🏁 Script executed:

cat -n ./cli/config.go | tail -50

Repository: raystack/compass

Length of output: 1562


Add config.WithEnvPrefix("COMPASS") to all config loader paths for consistency.

Environment variable overrides (COMPASS_*) are currently only applied when loading from the current directory. The app-config fallback (line 106) and the --config flag path (line 122) omit the env prefix, so these configuration values are ignored in those scenarios.

Suggested change
-		loader := config.NewLoader(config.WithAppConfig("compass"))
+		loader := config.NewLoader(
+			config.WithAppConfig("compass"),
+			config.WithEnvPrefix("COMPASS"),
+		)
-	return config.NewLoader(config.WithFile(cfgFile)).Load(cfg)
+	return config.NewLoader(
+		config.WithFile(cfgFile),
+		config.WithEnvPrefix("COMPASS"),
+	).Load(cfg)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
loader := config.NewLoader(config.WithAppConfig("compass"))
if loadErr := loader.Load(&cfg); loadErr != nil {
loader := config.NewLoader(
config.WithAppConfig("compass"),
config.WithEnvPrefix("COMPASS"),
)
if loadErr := loader.Load(&cfg); loadErr != nil {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/config.go` around lines 106 - 107, The config loader creation calls
(e.g., the loader := config.NewLoader(config.WithAppConfig("compass")) used
before Load(&cfg) and the loader used for the --config flag path) are missing
the environment prefix; update both NewLoader calls to include
config.WithEnvPrefix("COMPASS") alongside config.WithAppConfig("compass") (and
any other loader options) so that environment overrides (COMPASS_*) are applied
consistently regardless of which loader path is used.

return &cfg, ErrConfigNotFound
Comment on lines +102 to +108

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Don't hide invalid config files behind fallback.

This now falls back on any LoadFromCurrentDir error and then rewrites any app-config load failure to ErrConfigNotFound. A malformed local file or permission problem becomes indistinguishable from “not found”, so the CLI can ignore a broken config and continue with different settings. Please only fall back on the loader's file-missing case and return the original error otherwise.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/config.go` around lines 102 - 108, The code currently falls back on any
error from LoadFromCurrentDir and maps all loader.Load failures to
ErrConfigNotFound; change the logic so LoadFromCurrentDir's non-nil error is
checked for a "not found" condition (use os.IsNotExist(err) or the loader's
file-not-found sentinel) and only then attempt the app-config fallback via
config.NewLoader; conversely, if LoadFromCurrentDir returns a different error,
return that original error immediately; likewise, when calling
loader.Load(&cfg), if loadErr is a file-not-found error return
ErrConfigNotFound, otherwise return loadErr so real parse/permission errors
surface instead of being hidden.

}
}
return &cfg, nil
}

func LoadFromCurrentDir(cfg *Config) error {
var opts []config.LoaderOption
opts = append(opts,
config.WithPath("./"),
config.WithFile("config.yaml"),
config.WithEnvKeyReplacer(".", "_"),
return config.NewLoader(
config.WithFile("./config.yaml"),
config.WithEnvPrefix("COMPASS"),
)

return config.NewLoader(opts...).Load(cfg)
).Load(cfg)
Comment on lines 114 to +118

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Align the local config filename with the CLI guidance.

This lookup now uses ./config.yaml, but cli/errors.go:9-18 tells users to create compass.yaml in the current directory. One of them has to change, or the documented local override path will never be found.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/config.go` around lines 114 - 118, The function LoadFromCurrentDir
currently loads "./config.yaml" but the user-facing guidance in cli/errors.go
instructs creating "compass.yaml"; update LoadFromCurrentDir to look for
"./compass.yaml" (i.e., change the config.WithFile argument) so the local
override filename matches the documented CLI guidance; ensure nothing else
relies on "config.yaml" or update the docs instead if you prefer the other name.

}

func LoadConfigFromFlag(cfgFile string, cfg *Config) error {
var opts []config.LoaderOption
opts = append(opts, config.WithFile(cfgFile))

return config.NewLoader(opts...).Load(cfg)
return config.NewLoader(config.WithFile(cfgFile)).Load(cfg)
}
11 changes: 5 additions & 6 deletions cli/discussions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (

"github.com/raystack/compass/internal/client"
compassv1beta1 "github.com/raystack/compass/proto/raystack/compass/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/term"
"github.com/raystack/salt/cli/printer"

"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -75,9 +74,9 @@ func listAllDiscussionsCommand(cfg *Config) *cobra.Command {
}
printer.Table(os.Stdout, report)

fmt.Println(term.Cyanf("To view all the data in JSON format, use flag `-o json`"))
fmt.Println(printer.Cyanf("To view all the data in JSON format, use flag `-o json`"))
} else {
fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))
}

return nil
Expand Down Expand Up @@ -119,7 +118,7 @@ func viewDiscussionByIDCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))
return nil
},
}
Expand Down Expand Up @@ -173,7 +172,7 @@ func postDiscussionCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println("ID: \t", term.Greenf(res.Id))
fmt.Println("ID: \t", printer.Greenf("%s", res.Id))
return nil
},
}
Expand Down
5 changes: 2 additions & 3 deletions cli/lineage.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/compass/internal/client"
compassv1beta1 "github.com/raystack/compass/proto/raystack/compass/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/term"
"github.com/raystack/salt/cli/printer"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -44,7 +43,7 @@ func lineageCommand(cfg *Config) *cobra.Command {
return err
}

fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))

return nil
},
Expand Down
11 changes: 5 additions & 6 deletions cli/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (

"github.com/raystack/compass/internal/client"
compassv1beta1 "github.com/raystack/compass/proto/raystack/compass/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/term"
"github.com/raystack/salt/cli/printer"

"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -76,9 +75,9 @@ func listNamespacesCommand(cfg *Config) *cobra.Command {
}
printer.Table(os.Stdout, report)

fmt.Println(term.Cyanf("To view all the data in JSON format, use flag `-o json`"))
fmt.Println(printer.Cyanf("To view all the data in JSON format, use flag `-o json`"))
} else {
fmt.Println(term.Bluef(prettyPrint(res.GetNamespaces())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetNamespaces())))
}
return nil
},
Expand Down Expand Up @@ -118,7 +117,7 @@ func getNamespaceCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println(term.Bluef(prettyPrint(res.GetNamespace())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetNamespace())))
return nil
},
}
Expand Down Expand Up @@ -161,7 +160,7 @@ func createNamespaceCommand(cfg *Config) *cobra.Command {
}
spinner.Stop()

fmt.Println("ID: \t", term.Greenf(res.Id))
fmt.Println("ID: \t", printer.Greenf("%s", res.Id))
return nil
},
}
Expand Down
16 changes: 10 additions & 6 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/salt/cmdx"
"github.com/raystack/salt/cli/commander"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -64,11 +64,15 @@ func New(cliConfig *Config) *cobra.Command {
versionCmd(),
)

// Help topics
rootCmd.AddCommand(cmdx.SetCompletionCmd("compass"))
rootCmd.AddCommand(cmdx.SetRefCmd(rootCmd))
rootCmd.AddCommand(cmdx.SetHelpTopicCmd("environment", envHelp))
cmdx.SetHelp(rootCmd)
// Help topics, completion, reference
mgr := commander.New(rootCmd, commander.WithTopics([]commander.HelpTopic{
{
Name: "environment",
Short: envHelp["short"],
Long: envHelp["long"],
},
}))
mgr.Init()

return rootCmd
}
5 changes: 2 additions & 3 deletions cli/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/raystack/compass/internal/client"
compassv1beta1 "github.com/raystack/compass/proto/raystack/compass/v1beta1"
"github.com/raystack/salt/printer"
"github.com/raystack/salt/term"
"github.com/raystack/salt/cli/printer"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -43,7 +42,7 @@ func searchCommand(cfg *Config) *cobra.Command {
return err
}

fmt.Println(term.Bluef(prettyPrint(res.GetData())))
fmt.Println(printer.Bluef("%s", prettyPrint(res.GetData())))

return nil
},
Expand Down
2 changes: 1 addition & 1 deletion cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
esStore "github.com/raystack/compass/internal/store/elasticsearch"
"github.com/raystack/compass/internal/store/postgres"
"github.com/raystack/compass/pkg/telemetry"
"github.com/raystack/salt/log"
log "github.com/raystack/salt/observability/logger"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cli
import (
"fmt"

"github.com/raystack/salt/term"
"github.com/raystack/salt/version"
"github.com/raystack/salt/cli/printer"
"github.com/raystack/salt/cli/releaser"
"github.com/spf13/cobra"
)

Expand All @@ -16,12 +16,12 @@ func versionCmd() *cobra.Command {
Short: "Print version information",
RunE: func(cmd *cobra.Command, args []string) error {
if Version == "" {
fmt.Println(term.Yellow("Version information not available"))
fmt.Println(printer.Yellow("Version information not available"))
return nil
}

fmt.Printf("compass version %s", Version)
fmt.Println(term.Yellow(version.UpdateNotice(Version, "raystack/compass")))
fmt.Println(printer.Yellow(releaser.CheckForUpdate(Version, "raystack/compass")))
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion core/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"time"

"github.com/r3labs/diff/v2"
"github.com/r3labs/diff/v3"
"github.com/raystack/compass/core/namespace"
"github.com/raystack/compass/core/user"
)
Expand Down
Loading
Loading