Node detail: make the Back row leave, like Esc

Committing the Back action resolved a bare "back" token, but the opener's
action loop only breaks on CANCEL (or None) and has no "back" branch — so it
fell through and simply re-showed the page. Back appeared inert while Esc
worked. Resolve CANCEL for the Back row so it leaves the screen on the same
path Esc does, back to the contact list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 4.8 committed 2026-07-22 20:34:15 -04:00
1 parent 8d8193b6b1
commit a770f559cd
2 files changed
+18 -1

No files matched your search

+4 -1
View File
@@ -313,7 +313,10 @@ class NodeDetailScreen(Screen):
kind, payload = focus[self._row_index % n]
if kind == "action":
assert isinstance(payload, _Action)
self.resolve(payload.key)
# Back leaves the page exactly as Esc does — it resolves the same
# CANCEL the opener's loop breaks on, not a "back" token the loop would
# ignore and re-show the page over.
self.resolve(CANCEL if payload.key == "back" else payload.key)
# A route row is inert on Enter: selecting it (the highlight + graph) is the
# whole interaction; the dedicated Trace row is what opens the trace flow.
elif action in ("right", "tab"):
+14
View File
@@ -411,6 +411,20 @@ def test_node_detail_screen_cursor_and_commit() -> None:
assert resolved == ["timemachine", CANCEL]
def test_node_detail_back_row_leaves_like_escape() -> None:
"""Committing the Back row resolves CANCEL — the same leave Esc does — not a stray token
the opener's loop would ignore and re-show the page over."""
screen = _screen()
resolved: list = []
screen.resolve = lambda value: resolved.append(value) # type: ignore[method-assign]
screen.render_body(72)
screen.handle("down") # Trace -> Time machine
screen.handle("down") # Time machine -> Back
screen.handle("enter")
assert resolved == [CANCEL]
def test_node_detail_screen_route_selection_arms_the_trace() -> None:
"""↑/↓ over the route rows moves the graph highlight and the spec a Trace would arm on."""
routes = _RoutesView(