style(host-agent): format Console task submission files
This commit is contained in:
@@ -93,17 +93,14 @@ def test_history_store_records_task_submission_without_device(tmp_path) -> None:
|
||||
|
||||
entries = store.list_recent()
|
||||
|
||||
assert entries[0]["summary"] == (
|
||||
"task submitted: task-cloud-2 (automatic device)"
|
||||
)
|
||||
assert entries[0]["summary"] == ("task submitted: task-cloud-2 (automatic device)")
|
||||
assert entries[0]["detail"] == {"task_id": "task-cloud-2"}
|
||||
|
||||
|
||||
def test_history_store_task_submission_redacts_goal_and_secrets(tmp_path) -> None:
|
||||
store = ConsoleHistoryStore(tmp_path / "history.sqlite3")
|
||||
secret_goal = (
|
||||
"rotate secret-XYZ-abcdef-very-secret "
|
||||
"cookie=session-abc; lease=lease-stale"
|
||||
"rotate secret-XYZ-abcdef-very-secret cookie=session-abc; lease=lease-stale"
|
||||
)
|
||||
|
||||
store.record_task_submission(task_id="task-cloud-3", device_id="device-cloud-a")
|
||||
@@ -111,8 +108,7 @@ def test_history_store_task_submission_redacts_goal_and_secrets(tmp_path) -> Non
|
||||
|
||||
entries = store.list_recent()
|
||||
rendered = "\n".join(
|
||||
repr(entry["summary"]) + " " + json.dumps(entry["detail"])
|
||||
for entry in entries
|
||||
repr(entry["summary"]) + " " + json.dumps(entry["detail"]) for entry in entries
|
||||
)
|
||||
|
||||
assert secret_goal not in rendered
|
||||
@@ -135,4 +131,4 @@ def test_history_store_task_submissions_prune_beyond_limit(tmp_path) -> None:
|
||||
"task-4",
|
||||
"task-3",
|
||||
"task-2",
|
||||
]
|
||||
]
|
||||
|
||||
@@ -49,9 +49,7 @@ def _build_client(
|
||||
session_manager = SessionManager(ttl_seconds=3600.0)
|
||||
metadata_store: TaskMetadataStore | None = None
|
||||
if include_metadata_store:
|
||||
metadata_store = TaskMetadataStore(
|
||||
db_path=tmp_path / "task_metadata.sqlite3"
|
||||
)
|
||||
metadata_store = TaskMetadataStore(db_path=tmp_path / "task_metadata.sqlite3")
|
||||
|
||||
app = create_console_app(
|
||||
config=config,
|
||||
@@ -373,7 +371,11 @@ def _make_submission_recorder(
|
||||
def asyncio_run(coro):
|
||||
import asyncio
|
||||
|
||||
return asyncio.get_event_loop().run_until_complete(coro) if asyncio.get_event_loop().is_running() else asyncio.run(coro)
|
||||
return (
|
||||
asyncio.get_event_loop().run_until_complete(coro)
|
||||
if asyncio.get_event_loop().is_running()
|
||||
else asyncio.run(coro)
|
||||
)
|
||||
|
||||
|
||||
def test_tasks_page_renders_submission_form_with_device_options(tmp_path) -> None:
|
||||
@@ -444,8 +446,7 @@ def test_authenticated_explicit_device_submission_uses_runtime_id(tmp_path) -> N
|
||||
|
||||
assert response.status_code == 303
|
||||
assert (
|
||||
response.headers["location"]
|
||||
== "/tasks?submitted=1&task_id=task-cloud-explicit"
|
||||
response.headers["location"] == "/tasks?submitted=1&task_id=task-cloud-explicit"
|
||||
)
|
||||
assert captured == {"goal": "open mail", "device_id": "device-cloud-a"}
|
||||
|
||||
@@ -577,9 +578,7 @@ def test_cloud_definitive_rejection_renders_safe_error_without_calling_history(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
submit, captured = _make_submission_recorder(
|
||||
raise_api_error=HostAgentAPIError(
|
||||
403, "Host self-submission is disabled"
|
||||
),
|
||||
raise_api_error=HostAgentAPIError(403, "Host self-submission is disabled"),
|
||||
)
|
||||
client, context = _build_client(tmp_path, submit_self_task=submit)
|
||||
context["manager"].register_device(
|
||||
|
||||
Reference in New Issue
Block a user