Skip to content

Commit cf49d19

Browse files
Matovidloclaude
andcommitted
fix(push): downgrade JSON schema validation errors to warnings (PSGO-198)
kbc push was blocking users from pushing changes to their branch when unrelated branches had invalid configs. The server already accepted those configs, so the CLI was stricter than the source of truth. Aligns push with pull behaviour: validation failures are now shown as warnings and push proceeds, since the server determines what is valid. Also updates the pull warning message - it no longer says push will be blocked when the project is in an invalid state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2202d0e commit cf49d19

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/lib/operation/project/sync/pull/operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func Run(ctx context.Context, projectState *project.State, o Options, d dependen
143143
logger.Warn(ctx, "")
144144
logger.Warn(ctx, `The project has been pulled, but it is not in a valid state.`)
145145
logger.Warn(ctx, `Please correct the problems listed above.`)
146-
logger.Warn(ctx, `Push operation is only possible when project is valid.`)
146+
logger.Warn(ctx, `Push will proceed with warnings for configs already accepted by the server.`)
147147
}
148148

149149
// Log untracked paths

pkg/lib/operation/project/sync/push/operation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/keboola/keboola-as-code/internal/pkg/project"
1313
"github.com/keboola/keboola-as-code/internal/pkg/project/ignore"
1414
"github.com/keboola/keboola-as-code/internal/pkg/telemetry"
15+
"github.com/keboola/keboola-as-code/internal/pkg/utils/errors"
1516
"github.com/keboola/keboola-as-code/pkg/lib/operation/project/local/encrypt"
1617
"github.com/keboola/keboola-as-code/pkg/lib/operation/project/local/validate"
1718
createDiff "github.com/keboola/keboola-as-code/pkg/lib/operation/project/sync/diff/create"
@@ -60,7 +61,10 @@ func Run(ctx context.Context, projectState *project.State, o Options, d dependen
6061
ValidateJSONSchema: true,
6162
}
6263
if err := validate.Run(ctx, projectState, validateOptions, d); err != nil {
63-
return err
64+
logger.Warn(ctx, errors.Format(errors.PrefixError(err, "warning"), errors.FormatAsSentences()))
65+
logger.Warn(ctx, "")
66+
logger.Warn(ctx, "Validation warnings found, proceeding with push.")
67+
logger.Warn(ctx, "The configs already exist on the server; the server is the source of truth.")
6468
}
6569
}
6670

0 commit comments

Comments
 (0)