From 3fc279a6ed62bf540e81aa4726a11050a8925b54 Mon Sep 17 00:00:00 2001 From: tegwick Date: Tue, 29 Sep 2026 11:17:08 +0200 Subject: [PATCH] Feedback section closes after collection and links back to the runbook list Co-Authored-By: Claude Sonnet 5.5 Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 295952@bnt-lap001 Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477 --- rtut/ui.py | 17 +++++++++-------- tests/test_ui.py | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/rtut/ui.py b/rtut/ui.py index 6378e4e..fb0f089 100644 --- a/rtut/ui.py +++ b/rtut/ui.py @@ -154,20 +154,21 @@ class App: def feedback_form(self, i: int, rid: str, r) -> str: fb = R.latest_feedback(r) - thanks = "" - if fb: - face = next(f for k, f, _ in SMILEYS if k == fb["rating"]) - thanks = (f"

Thank you. Recorded: {face} {e(fb['comment'] or '(no comment)')} " - "You can change it below.

") btns = " ".join(f"" for k, face, t in SMILEYS) - return (f"

How was this runbook?

{thanks}" - f"
{self.hidden()}" + form = (f"{self.hidden()}" "

Practicable? Anything that felt strange or unclear, or an idea to make it better. " "Never include secrets.

" f"

{btns}

") + f"{e(fb['comment']) if fb else ''}

{btns}

") + if fb: # collected: close the section, suggest the next step + face = next(f for k, f, _ in SMILEYS if k == fb["rating"]) + return ("

Thank you. Recorded: " + f"{face} {e(fb['comment'] or '(no comment)')}

" + "

← Back to the runbook list

" + f"
Change my feedback{form}
") + return f"

How was this runbook?

{form}
" def run_page(self, i: int, rid: str, msg: str = "") -> bytes: p = self.packs[i]; r = R.load(p, rid); d = p.data diff --git a/tests/test_ui.py b/tests/test_ui.py index 4ead875..9e8a132 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -215,6 +215,10 @@ def test_feedback_form_after_all_steps_done_and_recording(srv): assert st == 303 and loc2.endswith("#feedback") _, _, body = req(srv, "GET", base) assert "Thank you." in body and "step 3 was unclear" in body + assert "How was this runbook?" not in body # the section closed once feedback was collected + assert "← Back to the runbook list" in body # the probable next step + assert "Change my feedback" in body # the form is still reachable, folded away + assert req(srv, "GET", "/")[0] == 200 def test_feedback_validation(srv):