FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

CM-68642: stop SCA scan on restore command failure with --stop-on-error by omer-roth · Pull Request #495 · cycodehq/cycode-cli · GitHub

CM-68642: stop SCA scan on restore command failure with --stop-on-error - #495

Merged
omer-roth merged 2 commits into
mainfrom
CM-68642-sca-dependency-path-missing-in-cli-ui
Jul 23, 2026
Merged

CM-68642: stop SCA scan on restore command failure with --stop-on-error#495
omer-roth merged 2 commits into
mainfrom
CM-68642-sca-dependency-path-missing-in-cli-ui

Conversation

Copy link
Copy Markdown
Collaborator

Problem

A restore command failing with a non-zero exit code (e.g. poetry lock exit 1) did not stop the scan, even with --stop-on-error.

Root cause — failure-sentinel mismatch:

  • shell() signals a non-zero exit by returning None (catches CalledProcessError, logs, returns None).
  • execute_commands dropped that None via if command_output: and joined an empty list into '' — an empty-string success.
  • try_restore_dependencies only checks if output is None, so '' was treated as success and a Document was returned.
  • restore() therefore never returned None, making the --stop-on-error escalation in _try_restore_dependencies unreachable for a clean non-zero exit.

Fix

execute_commands now treats shell() → None as a failed command and returns None (short-circuiting remaining commands). Propagation is restored: fail → None all the way up → FileCollectionError raised under --stop-on-error.

Tests

Existing stop-on-error tests all mocked execute_commands → None, so they never covered the production path where a real non-zero exit produced ''. Added:

  • TestExecuteCommands — real execute_commands with only shell() mocked: fail→None, short-circuit at first failure, empty-output success ≠ failure, joins outputs.
  • test_shell_failure_propagates_to_none_and_no_lockfile — e2e through try_restore_dependencies.

All 27 SCA restore/collector tests pass.

🤖 Generated with Claude Code

execute_commands swallowed a non-zero restore exit (shell() returns None)
into an empty-string success, so restore() never returned None and the
--stop-on-error escalation in _try_restore_dependencies was unreachable.
Treat a None from shell() as a failed command and propagate None.

Add tests exercising the real execute_commands with only shell() mocked,
covering the failure sentinel the previous mocked tests skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
omer-roth requested a review from avishaiamiel as a code owner July 14, 2026 12:31

claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

omer-roth enabled auto-merge (squash) July 14, 2026 13:05
omer-roth merged commit ed2f714 into main Jul 23, 2026
28 checks passed
omer-roth deleted the CM-68642-sca-dependency-path-missing-in-cli-ui branch July 23, 2026 07:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL