port: the main menu remembers its cursor -- a measured P5 defect, fixed and scoped

Measured by the Decoder today: (B) from the menu to the title and (A) back
returns to the item you left, not to a default; their control passed first, two
delivery-confirmed DOWNs moving the cursor exactly two items before the round
trip. The port reset to initial_focus on every entry, so a player who moved to
EXTRAS, pressed (B) then (A) landed back on NEW GAME. MenuFlow.enter() now
consults opening_focus(), and a new set_focus() writes the memory.

set_focus() exists because two call sites set focus -- a cursor move and (B)'s
restore -- and a memory updated at only one of them is right until the player
uses the other.

focus_persists is true on main_menu and nowhere else, and the scope is the
authored part. wrap generalised because it was measured on two screens; this was
measured on one. Here that is stronger than a preference: extras opens on MISSION
SELECT as a MEASURED initial focus, so a menu-wide memory would have silently
replaced a measured value with a derived one.

Both halves are in one artifact, because a one-sided test passes a port that
quietly generalised: the menu returns to ptbtn05 after the round trip, and extras
opens on ptbtn11 both times despite being left on ptbtn12. contract-check asserts
the pair -- on where measured, off elsewhere -- and fails its known negative.
Eleven checks.

Not assumed: whether the memory survives a reboot, or whether any other screen
has it. Their reach is one boot, one round trip, one direction. The finding also
reframes this morning's initial-focus warning without settling it -- if focus
persists, a reading not taken on a fresh boot's first entry is measuring history.
NEW GAME stays authored, on its own reasoning.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N7FiFFFwbvG2uxdcEh8HyF
This commit is contained in:
Sylpheed port agent
2026-08-30 21:36:43 +00:00
parent 0e41f5381d
commit 6e3347a338
5 changed files with 384 additions and 248 deletions

View File

@@ -818,7 +818,7 @@ func _menu_arrive() -> void:
if action.get("pop", false):
# MEASURED, HANDOFF Q5: (B) restores the focus you came from.
_menu.pop()
_menu.stack[_menu.stack.size() - 1]["focus"] = String(action["restore_focus"])
_menu.set_focus(String(action["restore_focus"]))
view.focused_id = _menu.focus()
view.queue_redraw()
print(" menu on %s, focus restored to %s" % [name, _focus_label(view.focused_id)])