feat: edit hands from the viewer + "not my hand" disown

Addresses "no way to edit hands" and cleaning up misattributed ones:
- hand viewer (/hand/{id}) gets an "✎ Edit this hand" panel: position, cards,
  board, your net, tag, lesson → Save (existing PATCH), plus Delete.
- "Not my hand" → POST /hand/{id}/disown → poker.disown_hand clears the flat hero
  fields and rewrites structured with hero_involved=false, so a hand mislabeled as
  Brian's becomes a clean observed hand (replay stops showing him as hero).

1 test. Full suite 156 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-04 03:00:21 +00:00
parent 2be43848a7
commit 4ce1b05fad
4 changed files with 91 additions and 0 deletions
+16
View File
@@ -18,6 +18,22 @@ def lyra(tmp_path, monkeypatch):
return poker
def test_disown_hand_clears_hero_attribution(lyra):
poker = lyra
sid = poker.start_session(venue="Meadows", buy_in=300)
hid = poker.store_hand_history(
{"hero_involved": True, "hero_pos": "MP", "hero_cards": ["As", "3d"],
"players": [{"pos": "MP", "cards": ["As", "3d"]}],
"result": {"pot": 600, "hero_net": 304}}, session_id=sid, tag="notable")
h = poker.disown_hand(hid)
assert h["position"] is None and h["hole_cards"] is None and h["result"] is None
st = h["structured"]
if isinstance(st, str):
import json
st = json.loads(st)
assert st["hero_pos"] is None and not any(pl.get("hero") for pl in st["players"])
def test_hud_notes_scoped_to_session_by_tag(lyra):
poker = lyra
from lyra import memory