From 32dbc1dcda2255fd35969ec99cfc0170988c3eca Mon Sep 17 00:00:00 2001 From: unsupportedpastels Date: Fri, 20 Nov 2026 03:31:48 +0000 Subject: [PATCH] fix(web): preserve profile/state on /learn handoff, cancel on startup paste, and split chat learn tests - Preserve ?profile= when navigating from SkillsPage to /chat and preserve router location.state in ProfileProvider's ?profile= URL sync so delayed/lazy ChatPage mounts keep learnSeed. - Detect user-initiated terminal input (typing, editing keys, bracketed paste) independently of the mobile line tracker via isUserInitiatedTerminalInput while ignoring terminal-generated replies (CPR, DA, DECRPM, focus, OSC/DCS, mouse). - Move the self-contained /learn handoff tests out of ChatPage.test.tsx (restoring it to 946 lines) into ChatPage.learn.test.tsx, adding bracketed-paste cancellation and real ProfileProvider delayed-mount coverage. --- web/src/contexts/ProfileProvider.test.tsx | 18 +- web/src/contexts/ProfileProvider.tsx | 4 +- web/src/lib/learn-handoff.test.ts | 35 ++ web/src/lib/learn-handoff.ts | 20 + web/src/pages/ChatPage.learn.test.tsx | 532 ++++++++++++++++++++++ web/src/pages/ChatPage.test.tsx | 205 +-------- web/src/pages/ChatPage.tsx | 3 +- web/src/pages/SkillsPage.learn.test.tsx | 52 ++- web/src/pages/SkillsPage.tsx | 7 +- 9 files changed, 666 insertions(+), 210 deletions(-) create mode 100644 web/src/pages/ChatPage.learn.test.tsx diff --git a/web/src/contexts/ProfileProvider.test.tsx b/web/src/contexts/ProfileProvider.test.tsx index 4751c68f24..c394b5ffd5 100644 --- a/web/src/contexts/ProfileProvider.test.tsx +++ b/web/src/contexts/ProfileProvider.test.tsx @@ -34,7 +34,7 @@ const router: { navigate?: NavigateFunction } = {}; function Probe() { const navigate = useNavigate(); const { profile, setProfile } = useProfileScope(); - const { pathname, search } = useLocation(); + const { pathname, search, state } = useLocation(); useEffect(() => { router.navigate = navigate; }, [navigate]); @@ -42,6 +42,7 @@ function Probe() {