Skip to content

Consolidate coana launcher env vars into SOCKET_CLI_COANA_LAUNCHER#233

Open
Martin Torp (mtorp) wants to merge 1 commit into
mainfrom
martin/env-variable-cleanup
Open

Consolidate coana launcher env vars into SOCKET_CLI_COANA_LAUNCHER#233
Martin Torp (mtorp) wants to merge 1 commit into
mainfrom
martin/env-variable-cleanup

Conversation

@mtorp

Copy link
Copy Markdown
Contributor

Motivation

Follow-up from the review thread on #230 (#230 (comment)): the two coana launcher toggles introduced there (SOCKET_CLI_COANA_FORCE_NPM_INSTALL and SOCKET_CLI_COANA_DISABLE_NPM_FALLBACK) are consolidated into a single variable, mirroring the same change landing in the Node CLI (socket-cli, branch martin/env-variable-cleanup).

Changes

New SOCKET_CLI_COANA_LAUNCHER variable with three values:

  • auto (default / unset) — try npx first, fall back to npm install + node on launcher-level failures (unchanged default behavior).
  • npx — npx only; never fall back (replaces SOCKET_CLI_COANA_DISABLE_NPM_FALLBACK).
  • npm-install — skip npx entirely; always npm install + node (replaces SOCKET_CLI_COANA_FORCE_NPM_INSTALL).

Resolution rules (identical to the Node CLI):

  1. SOCKET_CLI_COANA_LAUNCHER is stripped/lowercased; a recognized value wins and the legacy vars are ignored entirely.
  2. A set-but-unrecognized value logs a warning and behaves as auto (legacy vars ignored here too).
  3. When unset/empty, the legacy vars apply: SOCKET_CLI_COANA_FORCE_NPM_INSTALLnpm-install, else SOCKET_CLI_COANA_DISABLE_NPM_FALLBACKnpx, else auto.

The legacy variables remain supported for back-compat but are deprecated and no longer documented. SOCKET_CLI_COANA_LOCAL_PATH is untouched.

  • socketsecurity/core/tools/reachability.py: new _resolve_coana_launcher_mode() helper; the npm-install and no-fallback gates now key off the resolved mode.
  • docs/cli-reference.md: the two legacy bullets replaced with the new variable and its three values.
  • tests/unit/test_reachability.py: legacy-var tests kept as back-compat coverage; new tests for npm-install, npx, precedence over legacy vars, and unrecognized-value-as-auto.
  • CHANGELOG.md: 2.4.8 entry.

Testing

uv run --extra test pytest tests/unit — 291 passed, 2 skipped (pre-existing).

@mtorp Martin Torp (mtorp) requested a review from a team as a code owner June 10, 2026 11:27
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.4.9.dev1

Docker image: socketdev/cli:pr-233

Replace the SOCKET_CLI_COANA_FORCE_NPM_INSTALL and
SOCKET_CLI_COANA_DISABLE_NPM_FALLBACK toggles with a single
SOCKET_CLI_COANA_LAUNCHER variable (auto | npx | npm-install), mirroring
the Socket Node CLI. The legacy variables remain supported when the new
variable is unset, but are deprecated and no longer documented.

Follow-up from the review thread on PR #230.
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.

1 participant