diff --git a/CHANGELOG.md b/CHANGELOG.md index fa8a0703..af47d49d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 2.15.0 + +### Upgrade notes + +- `--reach-enable-analysis-splitting` is deprecated and no longer has an + effect. With it, a reachability analysis that failed or timed out was + retried in smaller batches. Jobs that pass it now run one analysis, as jobs + without it already did, so their results can differ. The flag still parses, + so existing CI commands keep working. Remove it when convenient. + +### Changed + +- Reachability always passes `--disable-analysis-splitting` to the Coana CLI, + including for a Coana version picked with `--reach-version`. + ## 2.14.0 ### Upgrade notes diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 8e0704ce..db4df99a 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -218,7 +218,7 @@ socketcli [-h] [--api-token API_TOKEN] [--repo REPO] [--workspace WORKSPACE] [-- [--ignore-commit-files] [--disable-blocking] [--disable-ignore] [--enable-diff] [--scm SCM] [--timeout TIMEOUT] [--include-module-folders] [--reach] [--reach-version REACH_VERSION] [--reach-analysis-timeout REACH_ANALYSIS_TIMEOUT] [--reach-analysis-memory-limit REACH_ANALYSIS_MEMORY_LIMIT] [--reach-concurrency REACH_CONCURRENCY] [--reach-ecosystems REACH_ECOSYSTEMS] - [--reach-min-severity ] [--reach-skip-cache] [--reach-disable-analytics] [--reach-enable-analysis-splitting] [--reach-detailed-analysis-log-file] + [--reach-min-severity ] [--reach-skip-cache] [--reach-disable-analytics] [--reach-detailed-analysis-log-file] [--reach-use-only-pregenerated-sboms] [--reach-debug] [--reach-disable-external-tool-checks] [--reach-disable-dependency-downloads] [--reach-output-file REACH_OUTPUT_FILE] [--only-facts-file] [--version] ```` @@ -362,7 +362,6 @@ docs.socket.dev use `SOCKET_SECURITY_API_KEY`. Either works. If both are set, | `--reach-min-severity` | False | info | Minimum severity of vulnerabilities to analyze (info, low, moderate, high, critical). Omitted by default, so coana analyzes all severities — equivalent to `info`, the lowest. | | `--reach-skip-cache` | False | False | Skip cache and force fresh reachability analysis | | `--reach-disable-analytics` | False | False | Disable analytics collection during reachability analysis | -| `--reach-enable-analysis-splitting` | False | False | Enable analysis splitting/bucketing (a legacy performance feature). Splitting is disabled by default. | | `--reach-detailed-analysis-log-file` | False | False | Write a detailed analysis log file; its path is printed to stdout | | `--reach-use-only-pregenerated-sboms` | False | False | Build the scan only from pre-generated CycloneDX (CDX) and SPDX files in your project (requires --reach) | | `--reach-debug` | False | False | Enable coana debug output (`--debug`) for the analysis, independent of the global `--enable-debug` | diff --git a/pyproject.toml b/pyproject.toml index 4da80233..c470f129 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "socketsecurity" -version = "2.14.0" +version = "2.15.0" requires-python = ">= 3.11" license = {"file" = "LICENSE"} dependencies = [ diff --git a/socketsecurity/__init__.py b/socketsecurity/__init__.py index 0f2224d3..75c94609 100644 --- a/socketsecurity/__init__.py +++ b/socketsecurity/__init__.py @@ -1,4 +1,4 @@ __author__ = 'socket.dev' -__version__ = '2.14.0' +__version__ = '2.15.0' USER_AGENT_NAME = 'socket-python-cli' USER_AGENT = f'{USER_AGENT_NAME}/{__version__}' diff --git a/socketsecurity/config.py b/socketsecurity/config.py index a5ceadc9..7edb65e1 100644 --- a/socketsecurity/config.py +++ b/socketsecurity/config.py @@ -228,10 +228,7 @@ class CliConfig: reach_analysis_memory_limit: Optional[str] = None reach_analysis_timeout: Optional[str] = None reach_disable_analytics: bool = False - reach_disable_analysis_splitting: bool = False # Deprecated, kept for backwards compatibility - reach_enable_analysis_splitting: bool = False reach_detailed_analysis_log_file: bool = False - reach_lazy_mode: bool = False # Deprecated, kept for backwards compatibility reach_ecosystems: Optional[List[str]] = None reach_exclude_paths: Optional[List[str]] = None reach_skip_cache: bool = False @@ -398,10 +395,7 @@ def _from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig': 'reach_analysis_timeout': args.reach_analysis_timeout, 'reach_analysis_memory_limit': args.reach_analysis_memory_limit, 'reach_disable_analytics': args.reach_disable_analytics, - 'reach_disable_analysis_splitting': args.reach_disable_analysis_splitting, - 'reach_enable_analysis_splitting': args.reach_enable_analysis_splitting, 'reach_detailed_analysis_log_file': args.reach_detailed_analysis_log_file, - 'reach_lazy_mode': args.reach_lazy_mode, 'reach_ecosystems': args.reach_ecosystems.split(',') if args.reach_ecosystems else None, 'reach_exclude_paths': args.reach_exclude_paths.split(',') if args.reach_exclude_paths else None, 'exclude_paths': normalize_exclude_paths(args.exclude_paths), @@ -1206,7 +1200,7 @@ def create_argument_parser() -> argparse.ArgumentParser: "--reach-enable-analysis-splitting", dest="reach_enable_analysis_splitting", action="store_true", - help="Enable analysis splitting/bucketing for reachability analysis (disabled by default). This is a legacy feature for improving performance" + help=argparse.SUPPRESS # Deprecated, kept for backwards compatibility (no-op) ) reachability_group.add_argument( "--reach-detailed-analysis-log-file", diff --git a/socketsecurity/core/tools/reachability.py b/socketsecurity/core/tools/reachability.py index 01af52dd..e0561003 100644 --- a/socketsecurity/core/tools/reachability.py +++ b/socketsecurity/core/tools/reachability.py @@ -109,7 +109,6 @@ def run_reachability_analysis( min_severity: Optional[str] = None, skip_cache: bool = False, disable_analytics: bool = False, - enable_analysis_splitting: bool = False, detailed_analysis_log_file: bool = False, repo_name: Optional[str] = None, branch_name: Optional[str] = None, @@ -143,7 +142,6 @@ def run_reachability_analysis( min_severity: Minimum severity level (info, low, moderate, high, critical) skip_cache: Skip cache usage disable_analytics: Disable analytics sharing - enable_analysis_splitting: Enable analysis splitting (disabled by default) detailed_analysis_log_file: Print detailed analysis log file path repo_name: Repository name branch_name: Branch name @@ -181,9 +179,8 @@ def run_reachability_analysis( if disable_analytics: coana_args.append("--disable-analytics-sharing") - # Analysis splitting is disabled by default; only omit the flag if explicitly enabled - if not enable_analysis_splitting: - coana_args.append("--disable-analysis-splitting") + # Older Coana versions split analyses unless told not to. Newer ones ignore this flag. + coana_args.append("--disable-analysis-splitting") if detailed_analysis_log_file: coana_args.append("--print-analysis-log-file") diff --git a/socketsecurity/socketcli.py b/socketsecurity/socketcli.py index f7e3a297..586d1c0a 100644 --- a/socketsecurity/socketcli.py +++ b/socketsecurity/socketcli.py @@ -514,7 +514,6 @@ def main_code(config: Optional[CliConfig] = None): min_severity=config.reach_min_severity, skip_cache=config.reach_skip_cache or False, disable_analytics=config.reach_disable_analytics or False, - enable_analysis_splitting=config.reach_enable_analysis_splitting or False, detailed_analysis_log_file=config.reach_detailed_analysis_log_file or False, repo_name=None if repo_defaulted else config.repo, branch_name=None if branch_defaulted else config.branch, diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index d22b81ff..27d8d85f 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -300,6 +300,20 @@ def test_reach_disable_external_tool_checks_flag(self): ) assert config.reach_disable_external_tool_checks is True + @pytest.mark.parametrize( + "flag", + [ + "--reach-enable-analysis-splitting", + "--reach-disable-analysis-splitting", + "--reach-lazy-mode", + ], + ) + def test_deprecated_reach_flags_are_accepted_and_hidden(self, flag, capsys): + CliConfig.from_args(self.BASE_ARGS + ["--reach", flag]) + with pytest.raises(SystemExit): + CliConfig.from_args(["--help"]) + assert flag not in capsys.readouterr().out + def test_reach_new_flags_default_false(self): config = CliConfig.from_args(self.BASE_ARGS + ["--reach"]) assert config.reach_debug is False diff --git a/tests/unit/test_reachability.py b/tests/unit/test_reachability.py index f2c37095..441f9749 100644 --- a/tests/unit/test_reachability.py +++ b/tests/unit/test_reachability.py @@ -127,6 +127,10 @@ def test_disable_external_tool_checks(fake_run_path): assert "--disable-external-tool-checks" not in _run(fake_run_path)["args"] +def test_always_disables_analysis_splitting(fake_run_path): + assert "--disable-analysis-splitting" in _run(fake_run_path)["args"] + + def test_timeout_and_memory_forwarded_verbatim(fake_run_path): """coana parses the units; config-file ints are coerced to strings.""" args = _run(fake_run_path, timeout="10m", memory_limit=2048, concurrency=1)["args"] diff --git a/uv.lock b/uv.lock index d509bbc9..8074941e 100644 --- a/uv.lock +++ b/uv.lock @@ -1334,7 +1334,7 @@ wheels = [ [[package]] name = "socketsecurity" -version = "2.14.0" +version = "2.15.0" source = { editable = "." } dependencies = [ { name = "beautifulsoup4" },