Guide repairs and expose worker progress
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-08-27 23:26:29 +02:00
parent dd86d8cd2d
commit 67ec2131c5
5 changed files with 178 additions and 17 deletions

View File

@@ -33,6 +33,10 @@ def test_task_contains_constraints_and_redacted_report() -> None:
assert "admin@example.com" not in task
assert "Do not commit or push" in task
assert "never mock or stub the behavior being tested" in task
assert "Repository ownership map:" in task
assert "config/erp_semantics.php owns ERP joins" in task
assert "Tests must contain assertions that execute" in task
assert "Do not expose protected production methods publicly" in task
assert "Feedback type: wrong_join" in task
assert "Join FK_Artikel with FK_AuftragPos and filter Auftragkennung = 3." in task
assert "The wrong product count was returned." in task

View File

@@ -1,3 +1,4 @@
import threading
from pathlib import Path
from unittest.mock import Mock, patch
@@ -60,6 +61,29 @@ def test_database_credentials_are_only_passed_to_test_process() -> None:
assert environment["COCKPIT_CONFIG_DATABASE"] == "cockpit_agent_test"
def test_validation_commands_are_logged_without_output(caplog) -> None:
worker = AutomationWorker(settings())
workspace = Mock()
workspace.run.return_value = Mock(returncode=0, stdout="sensitive output", stderr="")
with caplog.at_level("INFO"):
worker._run_tests(workspace, report_id=7, attempt=2)
assert "Report 7 attempt 2 validation command: php artisan test starting" in caplog.text
assert "returncode=0" in caplog.text
assert "sensitive output" not in caplog.text
def test_long_stage_emits_heartbeat(caplog) -> None:
worker = AutomationWorker(settings())
with caplog.at_level("INFO"), worker._progress(7, "agent attempt 1", interval=0.001):
threading.Event().wait(0.01)
assert "Report 7 agent attempt 1 still running" in caplog.text
assert "Report 7 agent attempt 1 finished" in caplog.text
def test_failed_validation_gets_one_correction_before_pr() -> None:
report = FailureReport(
id=13,