fix: apply coderabbit reviews

This commit is contained in:
lda
2026-06-15 22:29:27 +07:00 Verified
parent fe473b9f8a
commit fe0b2b4f4d
2 changed files with 6 additions and 5 deletions
@@ -139,7 +139,7 @@ def wait_for_status(*, rpc_url: str, timeout_seconds: int) -> None:
return return
last_stderr = completed.stderr last_stderr = completed.stderr
time.sleep(0.5) time.sleep(0.5)
raise RuntimeError(f"wf status did not become ready: {last_stderr}") raise RuntimeError(f"wf status did not become ready: {last_stderr}")
def _safe_model_name(model: str) -> str: def _safe_model_name(model: str) -> str:
+5 -4
View File
@@ -5,6 +5,7 @@ import threading
import uuid import uuid
import webbrowser import webbrowser
from dataclasses import dataclass from dataclasses import dataclass
import html
from http import HTTPStatus from http import HTTPStatus
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from typing import ClassVar from typing import ClassVar
@@ -127,7 +128,7 @@ class _ClickHandler(BaseHTTPRequestHandler):
def _send_html(self) -> None: def _send_html(self) -> None:
session = self.server.session session = self.server.session
status = "Button clicked" if session.clicked.is_set() else "Waiting for click" status = "Button clicked" if session.clicked.is_set() else "Waiting for click"
html = f"""<!doctype html> html_doc = f"""<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
@@ -142,8 +143,8 @@ class _ClickHandler(BaseHTTPRequestHandler):
<body> <body>
<main> <main>
<h1>Workflow Click Fixture</h1> <h1>Workflow Click Fixture</h1>
<button id="continue" type="button">{session.button_label}</button> <button id="continue" type="button">{html.escape(session.button_label)}</button>
<p id="status">{status}</p> <p id="status">{html.escape(status)}</p>
</main> </main>
<script> <script>
document.getElementById("continue").addEventListener("click", async () => {{ document.getElementById("continue").addEventListener("click", async () => {{
@@ -153,7 +154,7 @@ class _ClickHandler(BaseHTTPRequestHandler):
</script> </script>
</body> </body>
</html>""" </html>"""
encoded = html.encode("utf-8") encoded = html_doc.encode("utf-8")
self.send_response(HTTPStatus.OK) self.send_response(HTTPStatus.OK)
self.send_header("Content-Type", "text/html; charset=utf-8") self.send_header("Content-Type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(encoded))) self.send_header("Content-Length", str(len(encoded)))