From 0aa67439fd027c7c4d543d6ee4cb0a8988ed2142 Mon Sep 17 00:00:00 2001 From: ajp_anton Date: Mon, 26 Oct 2026 22:35:34 +0000 Subject: [PATCH] Preserve task description line breaks and expose run history --- python-tools/README.md | 2 ++ python-tools/static/style.css | 4 ++++ python-tools/templates/run.html | 5 ++++- python-tools/tests/test_descriptions.py | 18 ++++++++++++++++++ python-tools/tests/test_web.py | 8 ++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 python-tools/tests/test_descriptions.py diff --git a/python-tools/README.md b/python-tools/README.md index dcdccb6..db77465 100644 --- a/python-tools/README.md +++ b/python-tools/README.md @@ -108,6 +108,8 @@ the main part to use its current mode, or use the arrow to select the other mode. A successful review run can be repeated with its saved inputs in the execution mode from the run-detail page. The task must still revalidate the live filesystem before changing anything. +Execution creates a separate run; the original review and its output remain +accessible through Run history on either run's detail page. ```json { diff --git a/python-tools/static/style.css b/python-tools/static/style.css index 4a9e33c..6b619da 100644 --- a/python-tools/static/style.css +++ b/python-tools/static/style.css @@ -57,6 +57,10 @@ a { margin: .2rem 0; } +.task-details > p:not(.run-summary) { + white-space: pre-line; +} + .task-form { align-items: end; display: grid; diff --git a/python-tools/templates/run.html b/python-tools/templates/run.html index 7010358..eefe5f0 100644 --- a/python-tools/templates/run.html +++ b/python-tools/templates/run.html @@ -1,7 +1,10 @@ {% extends "base.html" %} {% block title %}Run {{ run.id }} · Server Maintenance{% endblock %} {% block content %} -

← Tasks

+

+ ← Tasks + · Run history +

{{ run.target_kind|title }} run #{{ run.id }}

Target
{{ run.target_path }}
diff --git a/python-tools/tests/test_descriptions.py b/python-tools/tests/test_descriptions.py new file mode 100644 index 0000000..7f8b853 --- /dev/null +++ b/python-tools/tests/test_descriptions.py @@ -0,0 +1,18 @@ +import json + +from app.web import create_app +from .conftest import write_task + + +def test_description_line_breaks_are_preserved_and_html_is_escaped(settings): + task = write_task(settings.task_root, "example", "inspect.py", 'print("done")\n') + manifest = {"version": 1, "tasks": {task.name: { + "description": "First line.\nSecond line.\n\n", + }}} + (task.parent / "task-inputs.json").write_text(json.dumps(manifest)) + client = create_app(settings).test_client() + response = client.get("/") + assert response.status_code == 200 + assert b"First line.\nSecond line.\n\n<script>Not HTML</script>" in response.data + stylesheet = client.get("/static/style.css") + assert b".task-details > p:not(.run-summary) {\n white-space: pre-line;" in stylesheet.data diff --git a/python-tools/tests/test_web.py b/python-tools/tests/test_web.py index bf10721..43f26c1 100644 --- a/python-tools/tests/test_web.py +++ b/python-tools/tests/test_web.py @@ -252,6 +252,14 @@ print(Path(os.environ["SERVER_MAINTENANCE_INPUT"]).read_text()) executed = app.extensions["run_store"].get(executed_id) assert executed is not None assert executed.input_json == '{"mode":"apply"}' + assert executed_id != run_id + assert app.extensions["run_store"].get(run_id).input_json == '{"mode":"report"}' + assert '"mode":"report"' in client.get(f"/runs/{run_id}/output").get_json()["output"] + executed_detail = client.get(f"/runs/{executed_id}") + assert b'href="/history/task/examples/migrate.py"' in executed_detail.data + history = client.get("/history/task/examples/migrate.py") + assert f"/runs/{run_id}".encode() in history.data + assert f"/runs/{executed_id}".encode() in history.data def test_successful_task_artifact_can_be_downloaded_once(settings) -> None: