Skip to content

tests: test_cicd_policy_enforcement_gates calls _enforce_policy_gates (Part of #8434) - #8605

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
churn/8434-20261118T1345Z
Nov 18, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
churn/8434-20261118T1345Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #8434 (security epic #8427).

What changed

tests/core_engine/test_galaxyscope.py::test_cicd_policy_enforcement_gates used to re-implement the gate in an inline loop and assert its own result, so it passed whatever Orchestrator._enforce_policy_gates did. It now builds a real Orchestrator and calls _enforce_policy_gates for every gate. One hand-written file.

  • test_cicd_policy_enforcement_gates: secrets (fires, clean graph, other gate does not trip it, no gate enabled) and malware (same four shapes).
  • test_max_risk_exposure_gate_at_threshold_and_below: 80.0 fails, 79.9 passes, one bad file among clean ones fails, threshold 0 disables.
  • test_max_systemic_threat_gate_at_threshold_and_below: magnitude * blast radius at the ceiling fails, just under passes, zero magnitude passes, ceiling 0 disables.
  • test_max_systemic_threat_not_evaluated_without_blast_radius: the "not evaluated for " warning fires and the gate does not fail on a placeholder.

policy_failed is reset to None before each call so the gate must set it itself.

Mutation check (each applied to gitgalaxy/galaxyscope.py, reverted after)

Mutation Result
systemic >= to > (if systemic_threat >= max_systemic_threat) 1 failed
risk >= to > (if highest_risk >= max_risk_allowed) 1 failed
malware condition replaced with False 1 failed
if has_secrets: replaced with if False: 1 failed
if blast_radius is None: replaced with if False: 1 failed

Unmutated: 4 passed. ruff format (pinned 0.17.4) leaves the file unchanged. Not run: pr_gates, golden bless (no engine change).

Class / Sibling gaps

Class: tests that re-implement the code under test instead of calling it (sweep scope tests/security_auditing, tests/tools, gate/policy tests in tests/core_engine).

Member Status
test_galaxyscope.py::test_cicd_policy_enforcement_gates fixed here (all four gates, threshold, below, not-evaluated)
test_cli_contract.py gate tests already call the CLI; model to copy
test_galaxyscope.py SARIF sanitization test (Phase 10.8, ~:2567 before this edit) re-implements inline; not fixed here
test_galaxyscope.py Active Hemorrhage "post-hoc reimplementation" (~:1366) re-implements; not fixed here
tests/security_auditing/* (30+ files) not swept
tests/tools/* not swept

Sibling gaps: the SARIF and Active Hemorrhage tests need a different mechanism (extracting the inline phase into a callable first), so they are not done here; the two unswept directories are listed below.

Remaining slices

  1. test_galaxyscope.py SARIF sanitization (Phase 10.8) and Active Hemorrhage tests: extract the phase into a method, call it from the test (galaxyscope.py plus the test, 2 files).
  2. Sweep tests/security_auditing/* for assertion paths that never call the function they name (start with test_supply_chain_firewall.py, which also feeds a shape the CLI no longer reads), in batches of 5 files.
  3. Sweep tests/tools/* (grep "manually", "mirror", local copies of production logic), same batching.
  4. Update the class table in Tests re-implement the gate logic instead of calling it: --max-systemic-threat is untested #8434 after each slice.

Lessons for agents

None.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 18, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 18, 2026 13:48
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

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

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant