Context
apps/loopover-miner-ui/src/lib/chat-scroll.ts (isChatViewportNearBottom/scrollChatViewportToBottom/CHAT_NEAR_BOTTOM_PX) encodes the boundary threshold (<= 80px) and clamp logic for the chat stick-to-bottom auto-scroll feature. Confirmed via repo-wide grep that these exports are referenced only from apps/loopover-miner-ui/src/components/chat/message-list.tsx, and no test file imports or exercises this module's logic directly — message-list.test.tsx's coverage only checks DOM structure/StateBoundary branches, not the scroll math (jsdom doesn't meaningfully simulate scrollTop/scrollHeight there anyway).
This is exactly the kind of fiddly, easy-to-regress logic that benefits most from a unit test: per git log, it already needed one dedicated bug-fix PR (8cbcb5379, #7229/#7298). The sibling pure-logic modules in the same directory (lib/demo-data.ts → demo-data.test.ts, lib/chat-portfolio-queue-resolve.ts → covered by chat-portfolio-queue-actions.test.tsx) establish a one-test-per-pure-module convention this file is the exception to.
The current implementation was verified logically correct against boundary/short-content cases — this is a coverage gap, not an active bug.
Requirements
Add a direct unit test file for chat-scroll.ts covering isChatViewportNearBottom's boundary condition (<= 80px threshold, both sides) and scrollChatViewportToBottom's clamp behavior, following the one-test-per-pure-module convention already established by demo-data.test.ts in the same directory.
Deliverables
Test Coverage Requirements
apps/loopover-miner-ui is not covered by the src/** 99% patch gate - the new test file is this issue's own coverage deliverable.
Expected Outcome
A future regression in the stick-to-bottom auto-scroll boundary/clamp logic is caught by a direct unit test instead of requiring another dedicated bug-fix PR to notice.
Links & Resources
apps/loopover-miner-ui/src/lib/chat-scroll.ts, apps/loopover-miner-ui/src/components/chat/message-list.tsx (the only consumer), apps/loopover-miner-ui/src/lib/demo-data.ts/demo-data.test.ts (the convention to follow), PR #7229/#7298 (the prior bug this logic already needed once)
Context
apps/loopover-miner-ui/src/lib/chat-scroll.ts(isChatViewportNearBottom/scrollChatViewportToBottom/CHAT_NEAR_BOTTOM_PX) encodes the boundary threshold (<= 80px) and clamp logic for the chat stick-to-bottom auto-scroll feature. Confirmed via repo-wide grep that these exports are referenced only fromapps/loopover-miner-ui/src/components/chat/message-list.tsx, and no test file imports or exercises this module's logic directly —message-list.test.tsx's coverage only checks DOM structure/StateBoundary branches, not the scroll math (jsdom doesn't meaningfully simulatescrollTop/scrollHeightthere anyway).This is exactly the kind of fiddly, easy-to-regress logic that benefits most from a unit test: per
git log, it already needed one dedicated bug-fix PR (8cbcb5379, #7229/#7298). The sibling pure-logic modules in the same directory (lib/demo-data.ts→demo-data.test.ts,lib/chat-portfolio-queue-resolve.ts→ covered bychat-portfolio-queue-actions.test.tsx) establish a one-test-per-pure-module convention this file is the exception to.The current implementation was verified logically correct against boundary/short-content cases — this is a coverage gap, not an active bug.
Requirements
Add a direct unit test file for
chat-scroll.tscoveringisChatViewportNearBottom's boundary condition (<= 80pxthreshold, both sides) andscrollChatViewportToBottom's clamp behavior, following the one-test-per-pure-module convention already established bydemo-data.test.tsin the same directory.Deliverables
isChatViewportNearBottomandscrollChatViewportToBottomfromapps/loopover-miner-ui/src/lib/chat-scroll.ts, including the exact boundary case that motivated the prior bug-fix PR Chat rail never auto-scrolls to a new message or a live streaming response #7229/fix(miner-ui): chat rail stick-to-bottom auto-scroll #7298 if it's still reconstructable from that PR's description.Test Coverage Requirements
apps/loopover-miner-ui is not covered by the src/** 99% patch gate - the new test file is this issue's own coverage deliverable.
Expected Outcome
A future regression in the stick-to-bottom auto-scroll boundary/clamp logic is caught by a direct unit test instead of requiring another dedicated bug-fix PR to notice.
Links & Resources
apps/loopover-miner-ui/src/lib/chat-scroll.ts,apps/loopover-miner-ui/src/components/chat/message-list.tsx(the only consumer),apps/loopover-miner-ui/src/lib/demo-data.ts/demo-data.test.ts(the convention to follow), PR #7229/#7298 (the prior bug this logic already needed once)