From b77bbefba505747cb961287ab92a941fb0d37ad1 Mon Sep 17 00:00:00 2001 From: xuyucai Date: Tue, 17 Feb 2026 16:41:32 +0800 Subject: [PATCH 1/2] fix: correct operator precedence in install command validation Fixed issue #335: --pr cannot be used with --version or --commit The condition "pr and version not in {None, \"nightly\"} or commit" was evaluated incorrectly due to operator precedence. Added parentheses to ensure the logic only triggers error when --pr is actually combined with conflicting flags, not when only --commit is specified. Co-Authored-By: Claude --- comfy_cli/cmdline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_cli/cmdline.py b/comfy_cli/cmdline.py index 3699ffe..5284752 100644 --- a/comfy_cli/cmdline.py +++ b/comfy_cli/cmdline.py @@ -325,7 +325,7 @@ def install( ) raise typer.Exit(code=1) - if pr and version not in {None, "nightly"} or commit: + if pr and (version not in {None, "nightly"} or commit): rprint("--pr cannot be used with --version or --commit") raise typer.Exit(code=1) From 65dca94f6f1c3489e4a1af726292ed2b46c99cfc Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Wed, 11 Mar 2026 13:50:30 +0000 Subject: [PATCH 2/2] test: add regression test for --commit without --pr (issue #335) Ensures that using --commit with --version nightly (without --pr) does not falsely trigger the "--pr cannot be used" error. --- tests/comfy_cli/command/github/test_pr.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/comfy_cli/command/github/test_pr.py b/tests/comfy_cli/command/github/test_pr.py index 8f72d16..b9c308d 100644 --- a/tests/comfy_cli/command/github/test_pr.py +++ b/tests/comfy_cli/command/github/test_pr.py @@ -298,6 +298,20 @@ def test_pr_and_commit_conflict(self, runner): assert result.exit_code != 0 + @patch("comfy_cli.command.install.execute") + @patch("comfy_cli.cmdline.check_comfy_repo", return_value=(False, None)) + @patch("comfy_cli.cmdline.workspace_manager") + @patch("comfy_cli.tracking.prompt_tracking_consent") + def test_commit_without_pr_does_not_conflict(self, mock_track, mock_ws, mock_check, mock_execute, runner): + """Test that --commit alone does not trigger --pr conflict error (issue #335)""" + mock_ws.get_workspace_path.return_value = ("/tmp/test", None) + result = runner.invoke( + app, ["--skip-prompt", "install", "--version", "nightly", "--commit", "abc123", "--nvidia"] + ) + + assert "--pr cannot be used" not in result.stdout + assert mock_execute.called + class TestPRInfoDataClass: """Test PRInfo data class"""