Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions soda-core/src/soda_core/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def execute() -> None:

signal.signal(signal.SIGINT, handle_ctrl_c)

handle_legacy_commands()

args = cli_parser.parse_args()

soda_telemetry.ingest_cli_arguments(vars(args))
Expand Down Expand Up @@ -78,6 +80,21 @@ def _configure_logging(verbose: bool) -> None:
configure_logging(verbose=verbose)


def handle_legacy_commands():
legacy_cmds = [
"scan",
"scan_status",
"ingest",
"test_connection",
"simulate_anomaly_detection",
]
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

For maintainability, legacy_cmds would be clearer as a module-level constant (and preferably a set/frozenset for membership checks). That also makes it easier to reuse the same source of truth from tests.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

if len(sys.argv) > 1 and sys.argv[1] in legacy_cmds:
soda_logger.error("Soda v3 commands are no longer supported in Soda Core v4 CLI.")
soda_logger.error("Please use the v3 version of Soda Core or upgrade to v4 Soda Contracts.")
soda_logger.error("See https://docs.soda.io/soda-v4/ for more information.")
exit_with_code(ExitCode.LOG_ERRORS)


def create_cli_parser() -> ArgumentParser:
parser = ArgumentParser(
prog="soda",
Expand Down
19 changes: 18 additions & 1 deletion soda-tests/tests/components/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from unittest.mock import patch

import pytest
from soda_core.cli.cli import create_cli_parser
from soda_core.cli.cli import create_cli_parser, execute
from soda_core.cli.exit_codes import ExitCode
from soda_core.common.logs import Logs

Expand Down Expand Up @@ -396,3 +396,20 @@ def test_cli_argument_mapping_for_soda_cloud_test_command(mock_handler):
assert e.value.code == 0

mock_handler.assert_called_once_with("sc.yaml")


def test_cli_v3_scan():
sys.argv = [
"soda",
"scan",
"-d",
"ds",
"-c",
"sodacl_snowflake/configuration.yml",
"sodacl_pg/checks.yml",
]

with pytest.raises(SystemExit) as e:
execute()

assert e.value.code == 3
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

This change adds special handling for 5 legacy v3 commands, but the new test only covers scan. Consider parametrizing the test over all entries in legacy_cmds so accidental regressions (e.g., typo in one command name) are caught.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

test_table_specification = (
TestTableSpecification.builder()
.table_purpose("row_count")
.table_purpose("logs_formatting")
.column_varchar("id")
.rows(
rows=[
Expand Down
Loading