Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion framework/configstore/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func newPostgresConfigStore(ctx context.Context, config *PostgresConfig, logger
return nil, err
}
dsn := postgresconn.BuildDSN(config)
logger.Info("configstore: postgres target host=%s port=%s db=%s sslmode=%s",
logger.Debug("configstore: postgres target host=%s port=%s db=%s sslmode=%s",
config.Host.GetValue(), config.Port.GetValue(), config.DBName.GetValue(), config.SSLMode.GetValue())

// Migration-only DSN. Forces pgx into simple-query protocol on the migration
Expand Down
34 changes: 15 additions & 19 deletions framework/logstore/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3244,10 +3244,6 @@ func migrationRecreateMatViewsWithGovernanceColumns(ctx context.Context, db *gor
migrationName := "logs_recreate_matviews_with_governance_columns"
logger.Info("[logstore] starting migration %s", migrationName)
defer logger.Info("[logstore] finished migration %s", migrationName)
// Materialized views are PostgreSQL-only; skip on other dialects
if db.Dialector.Name() != "postgres" {
return nil
}
opts := *migrator.DefaultOptions
opts.UseTransaction = true
m := migrator.New(db, &opts, []*migrator.Migration{{
Expand Down Expand Up @@ -3287,14 +3283,14 @@ func migrationSplitFilterDataMatView(ctx context.Context, db *gorm.DB, logger sc
logger.Info("[logstore] starting migration %s", migrationName)
defer logger.Info("[logstore] finished migration %s", migrationName)
// Materialized views are PostgreSQL-only; skip on other dialects.
if db.Dialector.Name() != "postgres" {
return nil
}
opts := *migrator.DefaultOptions
opts.UseTransaction = true
m := migrator.New(db, &opts, []*migrator.Migration{{
ID: migrationName,
Migrate: func(tx *gorm.DB) error {
if db.Dialector.Name() != "postgres" {
return nil
}
tx = tx.WithContext(ctx)
if err := tx.Exec("DROP MATERIALIZED VIEW IF EXISTS mv_logs_filterdata CASCADE").Error; err != nil {
return fmt.Errorf("failed to drop legacy mv_logs_filterdata: %w", err)
Expand Down Expand Up @@ -3531,14 +3527,14 @@ func migrationAddSafeJsonbFunction(ctx context.Context, db *gorm.DB, logger sche
migrationName := "logs_add_safe_jsonb_function"
logger.Info("[logstore] starting migration %s", migrationName)
defer logger.Info("[logstore] finished migration %s", migrationName)
if db.Dialector.Name() != "postgres" {
return nil
}
opts := *migrator.DefaultOptions
opts.UseTransaction = true
m := migrator.New(db, &opts, []*migrator.Migration{{
ID: migrationName,
Migrate: func(tx *gorm.DB) error {
if db.Dialector.Name() != "postgres" {
return nil
}
tx = tx.WithContext(ctx)
const stmt = `
CREATE OR REPLACE FUNCTION bifrost_safe_jsonb(t text) RETURNS text
Expand Down Expand Up @@ -3764,14 +3760,14 @@ func migrationRecreateFilterUsersMatView(ctx context.Context, db *gorm.DB, logge
migrationName := "logs_recreate_filter_users_matview"
logger.Info("[logstore] starting migration %s", migrationName)
defer logger.Info("[logstore] finished migration %s", migrationName)
if db.Dialector.Name() != "postgres" {
return nil
}
opts := *migrator.DefaultOptions
opts.UseTransaction = true
m := migrator.New(db, &opts, []*migrator.Migration{{
ID: migrationName,
Migrate: func(tx *gorm.DB) error {
if db.Dialector.Name() != "postgres" {
return nil
}
tx = tx.WithContext(ctx)
if err := tx.Exec("DROP MATERIALIZED VIEW IF EXISTS mv_filter_users CASCADE").Error; err != nil {
return fmt.Errorf("failed to drop mv_filter_users: %w", err)
Expand Down Expand Up @@ -3800,14 +3796,14 @@ func migrationRecreateFilterTeamBUMatViews(ctx context.Context, db *gorm.DB, log
migrationName := "logs_recreate_filter_team_bu_matviews_multivalue"
logger.Info("[logstore] starting migration %s", migrationName)
defer logger.Info("[logstore] finished migration %s", migrationName)
if db.Dialector.Name() != "postgres" {
return nil
}
opts := *migrator.DefaultOptions
opts.UseTransaction = true
m := migrator.New(db, &opts, []*migrator.Migration{{
ID: migrationName,
Migrate: func(tx *gorm.DB) error {
if db.Dialector.Name() != "postgres" {
return nil
}
tx = tx.WithContext(ctx)
for _, view := range []string{"mv_filter_teams", "mv_filter_business_units"} {
if err := tx.Exec("DROP MATERIALIZED VIEW IF EXISTS " + view + " CASCADE").Error; err != nil {
Expand Down Expand Up @@ -3914,14 +3910,14 @@ func migrationRecreateFilterCustomersMatView(ctx context.Context, db *gorm.DB, l
migrationName := "logs_recreate_filter_customers_matview_multivalue"
logger.Info("[logstore] starting migration %s", migrationName)
defer logger.Info("[logstore] finished migration %s", migrationName)
if db.Dialector.Name() != "postgres" {
return nil
}
opts := *migrator.DefaultOptions
opts.UseTransaction = true
m := migrator.New(db, &opts, []*migrator.Migration{{
ID: migrationName,
Migrate: func(tx *gorm.DB) error {
if db.Dialector.Name() != "postgres" {
return nil
}
tx = tx.WithContext(ctx)
if err := tx.Exec("DROP MATERIALIZED VIEW IF EXISTS mv_filter_customers CASCADE").Error; err != nil {
return fmt.Errorf("failed to drop mv_filter_customers: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion framework/logstore/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func newPostgresLogStore(ctx context.Context, config *PostgresConfig, logger sch
return sqlDB.Close()
}

logger.Info("logstore: postgres target host=%s port=%s db=%s sslmode=%s",
logger.Debug("logstore: postgres target host=%s port=%s db=%s sslmode=%s",
config.Host.GetValue(), config.Port.GetValue(), config.DBName.GetValue(), config.SSLMode.GetValue())

// Throwaway pool for the version gate and schema migrations. Closing it
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/python/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"env_label":"Development",
Comment thread
akshaydeo marked this conversation as resolved.
"mcp": {
"client_configs": [
{
Expand Down
4 changes: 2 additions & 2 deletions transports/bifrost-http/lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ func LoadConfig(ctx context.Context, configDirPath string) (*Config, error) {
// 12. Env label (config.json takes precedence over BIFROST_ENV_LABEL env var)
truncateLabel := func(s string) string {
r := []rune(s)
if len(r) > 10 {
return string(r[:10])
if len(r) > 14 {
return string(r[:14])
Comment on lines +893 to +894

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Update Schema Limit

The loader now accepts and truncates env_label at 14 runes, and this PR adds the 11-character value Development, but transports/config.schema.json still advertises and enforces maxLength: 10. Configs with labels from 11 to 14 characters can now load successfully at runtime but fail schema validation in tools or CI that use the published schema. Please update the schema description and maxLength to 14 with this runtime limit.

Rule Used: transports/config.schema.json is the source of tru... (source)

}
Comment thread
akshaydeo marked this conversation as resolved.
return s
}
Comment thread
akshaydeo marked this conversation as resolved.
Expand Down
Loading