mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 11:49:28 +00:00
feat(cpg): add an explicit environment switch for the engine session (M2 11.3)
A measured run needs to enable the transport without changing any default. The switch reads as enabled only for the exact value "1"; unset, empty, "0", "true" and anything else leave the disposable path in place, and an explicit constructor argument still wins in both directions. 1,396 tests passed, nine skipped. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
co-authored by
Claude Opus 5
parent
87f7976a58
commit
fc69055a32
@@ -263,3 +263,18 @@ def _completed(stdout):
|
||||
import subprocess
|
||||
|
||||
return subprocess.CompletedProcess(["joern"], 0, stdout, "")
|
||||
|
||||
|
||||
def test_the_session_switch_is_explicit_and_defaults_off(monkeypatch):
|
||||
"""M2 11.3: a measured run can enable the transport without changing any default."""
|
||||
from openultrasast.cpg.backend import SESSION_ENV, JoernBackend
|
||||
|
||||
monkeypatch.delenv(SESSION_ENV, raising=False)
|
||||
assert JoernBackend().session_transport is False
|
||||
for value in ("", "0", "true", "yes", "2"):
|
||||
monkeypatch.setenv(SESSION_ENV, value)
|
||||
assert JoernBackend().session_transport is False, value
|
||||
monkeypatch.setenv(SESSION_ENV, "1")
|
||||
assert JoernBackend().session_transport is True
|
||||
# An explicit argument still wins over the environment in both directions.
|
||||
assert JoernBackend(session_transport=False).session_transport is False
|
||||
|
||||
Reference in New Issue
Block a user