Skip to content

Conversation

@m1n0
Copy link
Contributor

@m1n0 m1n0 commented Jan 27, 2026

Handles any v3 CLI command (with arguments or without) with the following message

$ soda scan -d ci_public -c sodacl_snowflake/configuration.yml   sodacl_snowflake/SODA_CORE_CI/PUBLIC/ECOMMERCE_ORDERS.yml  -V

  __|  _ \|  \   \\
\__ \ (   |   | _ \\
____/\___/___/_/  _\\ CLI v4.0.4b24
Soda v3 commands are no longer supported in Soda Core v4 CLI.
Please use the v3 version of Soda Core or upgrade to v4 Soda Contracts.
See https://docs.soda.io/soda-v4/ for more information.

Covered commands:
scan
scan_status
ingest
test_connection
simulate_anomaly_detection

(+ unrelated tiny test fix)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Soda Core v4 CLI to detect and block legacy Soda v3 commands early, exiting with a clear guidance message instead of falling through to argparse errors.

Changes:

  • Added early interception of legacy v3 CLI commands (scan, scan_status, ingest, test_connection, simulate_anomaly_detection) and exit with LOG_ERRORS.
  • Added a regression test asserting soda scan ... exits with code 3.
  • Updated a small test table purpose string used by contract verification log formatting tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
soda-core/src/soda_core/cli/cli.py Adds handle_legacy_commands() and invokes it before argument parsing to block v3 commands.
soda-tests/tests/components/test_cli.py Imports execute and adds a test for legacy scan exit behavior.
soda-tests/tests/components/test_contract_verification_logs.py Tweaks test table purpose string used by log formatting test setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 401 to 415
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

Comment on lines 83 to 90
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

Copy link

Copilot AI commented Jan 27, 2026

@m1n0 I've opened a new pull request, #2548, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Jan 27, 2026

@m1n0 I've opened a new pull request, #2549, to work on those changes. Once the pull request is ready, I'll request review from you.

* Initial plan

* Parametrize test to cover all 5 legacy v3 commands

Co-authored-by: m1n0 <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: m1n0 <[email protected]>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ m1n0
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

m1n0 and others added 2 commits January 27, 2026 12:10
* Initial plan

* Refactor: Move legacy_cmds to module-level constant as frozenset

Co-authored-by: m1n0 <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: m1n0 <[email protected]>
Co-authored-by: Milan Lukac <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Copy link
Contributor

@paulteehan paulteehan left a comment

Choose a reason for hiding this comment

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

Technically fine, might change the wording of the error message

Copy link
Contributor

@mivds mivds left a comment

Choose a reason for hiding this comment

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

Agree with Paul's comment. I think the wording Please use the v3 version of Soda Core is not correct. Soda library users may also run into this, and they would be directed to the wrong package

@sonarqubecloud
Copy link

@m1n0 m1n0 merged commit 511b296 into v4 Jan 27, 2026
75 of 79 checks passed
@m1n0 m1n0 deleted the chore/v3-cli branch January 27, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants