mvanhorn--last30days-skill
2860fb5d18
Security / Dependency review (push) Has been skipped
Scorecard / Scorecard analysis (push) Failing after 0s
Security / Dependency audit (push) Failing after 1s
Security / Secret scan (push) Failing after 1s
Validate / eval (push) Failing after 0s
Validate / tests (push) Failing after 0s
Validate / mcp-tests (push) Failing after 1s
GitHub Actions Security Analysis with zizmor 🌈 / zizmor (push) Failing after 1s
Security / SAST scan (push) Failing after 13m52s
49 行
1.6 KiB
Python
49 行
1.6 KiB
Python
"""Tests for planner.plan_query internal_subrun quiet mode."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import io
|
|
import unittest
|
|
from contextlib import redirect_stderr
|
|
|
|
from lib import planner
|
|
|
|
|
|
class PlannerQuietModeTests(unittest.TestCase):
|
|
def _call(self, *, internal_subrun: bool):
|
|
err = io.StringIO()
|
|
with redirect_stderr(err):
|
|
plan = planner.plan_query(
|
|
topic="Acme Corp",
|
|
available_sources=["grounding", "reddit"],
|
|
requested_sources=None,
|
|
depth="default",
|
|
provider=None,
|
|
model=None,
|
|
internal_subrun=internal_subrun,
|
|
)
|
|
return plan, err.getvalue()
|
|
|
|
def test_default_emits_law7_warning(self):
|
|
plan, stderr = self._call(internal_subrun=False)
|
|
self.assertIn("No --plan passed", stderr)
|
|
self.assertIn("YOU ARE the planner", stderr)
|
|
self.assertTrue(plan.subqueries)
|
|
|
|
def test_internal_subrun_suppresses_warning(self):
|
|
plan, stderr = self._call(internal_subrun=True)
|
|
self.assertNotIn("No --plan passed", stderr)
|
|
self.assertNotIn("YOU ARE the planner", stderr)
|
|
# Still returns a valid fallback plan
|
|
self.assertTrue(plan.subqueries)
|
|
|
|
def test_internal_subrun_still_allows_other_warnings(self):
|
|
"""Quiet mode only silences the LAW 7 block, not all planner output."""
|
|
plan, _stderr = self._call(internal_subrun=True)
|
|
# The plan itself is deterministic fallback; verify note carries
|
|
# no planner-error indication.
|
|
self.assertGreater(len(plan.subqueries), 0)
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|