Skip to content

Tests re-implement the gate logic instead of calling it: --max-systemic-threat is untested #8434

Closed

Description

@squid-protocol

Part of #8427. Source: the security claims audit in #8426 (docs/security_claims_inventory.md, section B: --max-systemic-threat is UNTESTED).

Problem

tests/core_engine/test_galaxyscope.py::test_cicd_policy_enforcement_gates (line 74) never calls the code under test. It builds a mock graph and then re-implements the gate logic inline ("We manually trigger the logic inside Phase 10.5", lines 110-120): its own loop sets scope.policy_failed = True for secrets, is_ml_threat and a risk_vector max, then asserts it. Orchestrator._enforce_policy_gates (gitgalaxy/galaxyscope.py:1813, called at :2156 and :4234) is never invoked, so the test passes whatever the gate does. It also never sets MAX_SYSTEMIC_THREAT, so --max-systemic-threat (galaxyscope.py:1822-1931) has no test at all.

Class: tests that re-implement the code under test instead of calling it

Sweep scope: tests/security_auditing, tests/tools, and the gate/policy tests in tests/core_engine. Found so far (the sweep for the rest is part of this issue):

Member Status Evidence
test_galaxyscope.py::test_cicd_policy_enforcement_gates re-implements the gate; never calls _enforce_policy_gates; no --max-systemic-threat tests/core_engine/test_galaxyscope.py:74-122
test_galaxyscope.py SARIF sanitization test ("Manually trigger the SARIF sanitization block (Phase 10.8)") re-implements Phase 10.8 inline test_galaxyscope.py:2567
test_galaxyscope.py Active Hemorrhage post-hoc reimplementation (the docstring at :1366 calls it a "post-hoc reimplementation") re-implements test_galaxyscope.py:1366
tests/security_auditing/* (30+ files) not yet swept: check each assertion path calls the function it names, not a copy e.g. test_supply_chain_firewall.py also feeds a shape the CLI no longer reads (see the CLI issue in this epic)
tests/tools/* (229 files) swept (slice 4, PR #8626): two local copies of workflow_inputs.glob_re / triggers in test_ci_critical_path_split.py and test_ci_replay_6278.py now call it; the rest are fixtures or independent oracles PR #8626 body table
tests/core_engine/test_cli_contract.py gate tests handled: they run the CLI (test_a_tripped_gate_exits_1_with_every_report_written, test_gates_run_on_an_incremental_scan_and_catch_an_added_secret) model to copy

Acceptance

  • test_cicd_policy_enforcement_gates calls _enforce_policy_gates (or runs the CLI as test_cli_contract.py does) for each gate: secrets, malware, --max-risk-exposure, and --max-systemic-threat (a case at threshold, a case below it, and the "not evaluated for " branch near galaxyscope.py:1925).
  • Mutation check in the PR: breaking _enforce_policy_gates (for example inverting the >= at :1931) makes the test fail.
  • Each member marked "not yet swept" is checked and the table updated; every re-implementing test is fixed or deleted with a reason. Prefer a short CLI-contract test over mocks.

Activity

  1. added
    appsec
    testing
    on Nov 13, 2026
  2. squid-protocol commented on Nov 18, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host nyx, lease renewed 2026-11-18T21:32Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:nyx label.

  3. squid-protocol commented on Nov 18, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 8434-20261118T1909Z (host nyx) ended without a PR. slice already on main (#8605); no PR. Check test_galaxyscope.py:1366 and :2567 for remaining reimplementation

  4. squid-protocol commented on Nov 18, 2026

    @squid-protocol
    OwnerAuthor

    Closing: every table row is handled. test_cicd_policy_enforcement_gates fixed by #8605; SARIF Phase 10.8 test now calls _apply_threat_suppression (#8619); the Active Hemorrhage test drives the real _process_file_worker (the 're-implementation' is a docstring phrase only); tests/security_auditing swept in #8620; tests/tools swept in #8626.

  5. squid-protocol commented on Nov 18, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 8434-20261118T2156Z (host nyx) ended without a PR. all rows handled (#8605 #8619 #8620 #8626); issue #8434 closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appsecclaim:nyxpriority: mediumtesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions