This commit is contained in:
@@ -12,7 +12,7 @@ def test_aider_command_cannot_mutate_git_configuration_or_send_analytics() -> No
|
||||
assert "--no-analytics" in command
|
||||
assert "--no-auto-commits" in command
|
||||
assert command.count("/dev/null") == 2
|
||||
assert command[-4:] == ["--edit-format", "diff", "--timeout", "180"]
|
||||
assert command[-4:] == ["--edit-format", "udiff", "--timeout", "180"]
|
||||
|
||||
|
||||
def test_aider_environment_does_not_include_database_credentials(tmp_path, monkeypatch) -> None:
|
||||
|
||||
@@ -105,6 +105,29 @@ def test_incorrect_answer_task_guides_semantics_level_repair() -> None:
|
||||
assert "protected schema/business-" in task
|
||||
assert "context builder" in task
|
||||
assert "known-bad SQL" in task
|
||||
assert "compare every alias.column" in task
|
||||
assert "Never replace one missing column" in task
|
||||
|
||||
|
||||
def test_retry_task_keeps_failure_from_start_of_long_output() -> None:
|
||||
report = FailureReport(
|
||||
id=43,
|
||||
chat_message_id=1,
|
||||
source="automatic",
|
||||
category="sql_execution",
|
||||
user_feedback=None,
|
||||
feedback_type=None,
|
||||
expected_behavior=None,
|
||||
prompt="Top products",
|
||||
response=None,
|
||||
sql_query="SELECT a.missing FROM orders a",
|
||||
error_message="Unknown column",
|
||||
context={"database_type": "erp"},
|
||||
)
|
||||
|
||||
task = build_retry_task(report, RuntimeError("DECISIVE ASSERTION\n" + "x" * 11_000))
|
||||
|
||||
assert "DECISIVE ASSERTION" in task
|
||||
|
||||
|
||||
def test_customer_database_task_explains_tenant_scope() -> None:
|
||||
|
||||
@@ -74,6 +74,27 @@ def test_validation_commands_are_logged_without_output(caplog) -> None:
|
||||
assert "sensitive output" not in caplog.text
|
||||
|
||||
|
||||
def test_failed_validation_preserves_start_and_end_of_long_output() -> None:
|
||||
worker = AutomationWorker(settings())
|
||||
workspace = Mock()
|
||||
workspace.run.return_value = Mock(
|
||||
returncode=1,
|
||||
stdout="DECISIVE ASSERTION\n" + "x" * 13_000,
|
||||
stderr="FINAL ERROR",
|
||||
)
|
||||
|
||||
try:
|
||||
worker._run_tests(workspace)
|
||||
except RuntimeError as exception:
|
||||
failure = str(exception)
|
||||
else:
|
||||
raise AssertionError("Expected failed validation")
|
||||
|
||||
assert "DECISIVE ASSERTION" in failure
|
||||
assert "...[middle omitted]..." in failure
|
||||
assert "FINAL ERROR" in failure
|
||||
|
||||
|
||||
def test_long_stage_emits_heartbeat(caplog) -> None:
|
||||
worker = AutomationWorker(settings())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user