Block publish when LLM rewrite quality degrades

This commit is contained in:
Mimikko-zeus
2026-06-04 16:29:40 +08:00
parent 5a98696255
commit f7e4c9722b
6 changed files with 132 additions and 1 deletions

View File

@@ -52,6 +52,19 @@ class LegacyScriptDelegationTests(unittest.TestCase):
self.assertEqual(calls[0]["source_mode"], "mock")
self.assertEqual(calls[0]["llm_mode"], "mock")
def test_main_exits_nonzero_when_new_pipeline_blocks_publish(self):
module = load_pipeline_module()
def fake_run_daily_report(**kwargs):
return {"reports": {"stage8": {"status": "blocked", "error": "rewrite_fallback_ratio_exceeded"}}}
with patch.object(module, "load_env", return_value={}):
with patch("ai_daily_report.runner.run_daily_report", side_effect=fake_run_daily_report):
with self.assertRaises(SystemExit) as raised:
module.main()
self.assertEqual(raised.exception.code, 2)
if __name__ == "__main__":
unittest.main()